text:
package org.deeplearning4j.clustering.condition;

import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import org.deeplearning4j.clustering.iteration.IterationHistory;
import org.nd4j.linalg.indexing.conditions.Condition;
import org.nd4j.linalg.indexing.conditions.LessThan;

import java.io.Serializable;

/**
 *
 */
@NoArgsConstructor(access = AccessLevel.PROTECTED)
@AllArgsConstructor
public class VarianceVariationCondition implements ClusteringAlgorithmCondition, Serializable {

    private Condition varianceVariationCondition;
    private int period;

    /**
     *
     * @param varianceVariation
     * @param period
     * @return
     */
    public static VarianceVariationCondition varianceVariationLessThan(double varianceVariation, int period) {
        Condition condition = new LessThan(varianceVariation);
        return new VarianceVariationCondition(condition, period);
    }

    /**
     *
     * @param iterationHistory
     * @return
     */
    public boolean isSatisfied(IterationHistory iterationHistory) {
        if (iterationHistory.getIterationCount() <= period)
            return false;

        for (int i = 0, j = iterationHistory.getIterationCount(); i < period; i++) {
            double variation = iterationHistory.getIterationInfo(j - i).getClusterSetInfo()
                            .getPointDistanceFromClusterVariance();
            variation -= iterationHistory.getIterationInfo(j - i - 1).getClusterSetInfo()
                            .getPointDistanceFromClusterVariance();
            variation /= iterationHistory.getIterationInfo(j - i - 1).getClusterSetInfo()
                            .getPointDistanceFromClusterVariance();

            if (!varianceVariationCondition.apply(variation))
                return false;
        }

        return true;
    }

}


text:
FROM alpine:latest

# Add Required Packages [Layer 1]
RUN apk update && \
    apk add ca-certificates cmake g++ git make

# Download Sources [Layer 2]
RUN cd ~ && \
    git clone https://github.com/remote-wiring/remote-wiring.git --recursive && \
    cd remote-wiring/ && \
    mkdir build

# Verify Build and Install
CMD cd ~/remote-wiring/build/ && \
    cmake .. && \
    make

redpajama_set_name: RedPajamaGithub


text:
(function (root)
{
	var app = root.App;

	app.UserProfile = app.BaseModel.extend({
		url: "api/profile",
		defaults: {
			id: null,
			userName: null,
			displayName: null,
			profileImageUrl64: null,
			showProfile: null,
			email: null
		},
		initialize: function (opt)
		{
			_.bindAll(this, "authChange", "onChange");

			this.login = opt.login;
			this.login.bind("change:isAuthenticated", this.authChange);
			this.bind("change", this.onChange);
		},
		onChange: function () {
			this.login.set({ displayName: this.get('displayName') });
		},
		authChange: function ()
		{
			if (this.login.get("isAuthenticated"))
				this.fetch();
			else
				this.clear();
		}
	});

	app.UserProfileView = app.BaseView.extend(
		{
			initialize: function ()
			{
				_.bindAll(this, "render");
				this.model.bind("change", this.render);
				this.$el = $(this.el);
				this.template = _.template($("#template-userprofile").html());
			},
			render: function ()
			{
				this.$el.hide();
				var attrs = this.model.attributes;
				attrs.twitterUserId = attrs.twitterUserId || null;
				attrs.facebookUserId = attrs.facebookUserId || null;
				console.log(attrs);

				var showProfile = attrs.email || attrs.twitterUserId || attrs.facebookUserId;
				if (showProfile)
				{
					var html = this.template(attrs);
					this.$el.html(html);
					this.$el.fadeIn('fast');
				}
				else
				{
					this.$el.html("");
					this.$el.hide();
				}

				$("#facebook-signin").toggle(!attrs.facebookUserId);
				$("#twitter-signin").toggle(!attrs.twitterUserId);
			}
		});

})(window);


text:
package org.jbpm.workbench.ht.model;

public final class TaskDataSetConstants {

    public static final String HUMAN_TASKS_DATASET = "jbpmHumanTasks";
    public static final String HUMAN_TASKS_WITH_USER_DATASET = "jbpmHumanTasksWithUser";
    public static final String HUMAN_TASKS_WITH_ADMIN_DATASET = "jbpmHumanTasksWithAdmin";
    public static final String HUMAN_TASKS_WITH_VARIABLES_DATASET = "jbpmHumanTasksWithVariables";

    public static final String COLUMN_ACTIVATION_TIME = "activationTime";
    public static final String COLUMN_ACTUAL_OWNER = "actualOwner";
    public static final String COLUMN_CREATED_BY = "createdBy";
    public static final String COLUMN_CREATED_ON = "createdOn";
    public static final String COLUMN_DEPLOYMENT_ID = "deploymentId";
    public static final String COLUMN_DESCRIPTION = "description";
    public static final String COLUMN_DUE_DATE = "dueDate";
    public static final String COLUMN_NAME = "name";
    public static final String COLUMN_PARENT_ID = "parentId";
    public static final String COLUMN_PRIORITY = "priority";
    public static final String COLUMN_PROCESS_ID = "processId";
    public static final String COLUMN_PROCESS_INSTANCE_ID = "processInstanceId";
    public static final String COLUMN_PROCESS_SESSION_ID = "processSessionId";
    public static final String COLUMN_STATUS = "status";
    public static final String COLUMN_TASK_ID = "taskId";
    public static final String COLUMN_WORK_ITEM_ID = "workItemId";
    public static final String COLUMN_ORGANIZATIONAL_ENTITY = "id";
    public static final String COLUMN_LAST_MODIFICATION_DATE = "lastModificationDate";
    public static final String COLUMN_PROCESS_INSTANCE_CORRELATION_KEY = "correlationKey";
    public static final String COLUMN_PROCESS_INSTANCE_DESCRIPTION = "processInstanceDescription";
    public static final String COLUMN_EXCLUDED_OWNER = "entity_id";
    public static final String COLUMN_SLA_DUE_DATE = "sla_due_date";
    public static final String COLUMN_SLA_COMPLIANCE = "slaCompliance";

    public static final String COLUMN_TASK_VARIABLE_TASK_ID = "taskId";
    public static final String COLUMN_TASK_VARIABLE_NAME = "name";
    public static final String COLUMN_TASK_VARIABLE_VALUE = "value";

    public static final String COLUMN_ERROR_COUNT = "errorCount";

    private TaskDataSetConstants() {}
}


text:
<template name="metrics">

                        Current Revenue
                        Employee Cost
                        Status
                        Misc

	</template>


text:
namespace DfBAdminToolkit.Model {

    using System.Collections.Generic;

    public class GroupsModel
       : IGroupsModel {

        public string AccessToken { get; set; }

        public string GroupInputFilePath { get; set; }

        public string GroupMemberInputFilePath { get; set; }

        public List<GroupListViewItemModel> Groups { get; set; }

        public List<GroupInfoItemModel> GroupInfo { get; set; }

        public List<GroupPermsItemModel> GroupPerms { get; set; }

        public GroupsModel() {
            Initialize();
        }

        public void Initialize() {
            Groups = new List<GroupListViewItemModel>();
            GroupInfo = new List<GroupInfoItemModel>();
            GroupPerms = new List<GroupPermsItemModel>();
            AccessToken = ApplicationResource.DefaultProvisionToken;
        }

        public void CleanUp() {
        }
    }
}


text:
/* @test
 * @bug 4115296
 *
 * @summary synopsis: NoSuchObjectException not thrown for non-existent
 * activatable objects
 * @author Ann Wollrath
 *
 * @library ../../../testlibrary
 * @build TestLibrary RMID ActivationLibrary
 * @build ActivateMe
 * @build NonExistentActivatable
 * @build NonExistentActivatable_Stub
 * @run main/othervm/policy=security.policy/timeout=240 NonExistentActivatable
 */

import java.io.*;
import java.rmi.*;
import java.rmi.activation.*;
import java.rmi.server.*;
import java.rmi.registry.*;
import java.util.Properties;

public class NonExistentActivatable
        extends Activatable
        implements ActivateMe, Runnable
{

    public NonExistentActivatable(ActivationID id, MarshalledObject obj)
        throws ActivationException, RemoteException
    {
        super(id, 0);
    }

    public void ping()
    {}

    public void unregister() throws Exception {
        super.unregister(super.getID());
    }

    /**
     * Spawns a thread to deactivate the object.
     */
    public void shutdown() throws Exception
    {
        (new Thread(this,"NonExistentActivatable")).start();
    }

    /**
     * Thread to deactivate object. First attempts to make object
     * inactive (via the inactive method).  If that fails (the
     * object may still have pending/executing calls), then
     * unexport the object forcibly.
     */
    public void run()
    {
        ActivationLibrary.deactivate(this, getID());
    }

    public static void main(String[] args) {

        System.out.println("\nRegression test for bug 4115331\n");

        TestLibrary.suggestSecurityManager("java.rmi.RMISecurityManager");

        RMID rmid = null;

        try {
            RMID.removeLog();
            rmid = RMID.createRMID();
            rmid.start();

            /* Cause activation groups to have a security policy that will
             * allow security managers to be downloaded and installed
             */
            Properties p = new Properties();
            // this test must always set policies/managers in its
            // activation groups
            p.put("java.security.policy",
                  TestParams.defaultGroupPolicy);
            p.put("java.security.manager",
                  TestParams.defaultSecurityManager);

            System.err.println("Create activation group in this VM");
            ActivationGroupDesc groupDesc =
                new ActivationGroupDesc(p, null);
            ActivationSystem system = ActivationGroup.getSystem();
            ActivationGroupID groupID = system.registerGroup(groupDesc);
            ActivationGroup.createGroup(groupID, groupDesc, 0);

            System.err.println("Creating descriptor");
            ActivationDesc desc =
                new ActivationDesc("NonExistentActivatable", null, null);

            System.err.println("Registering descriptor");
            ActivateMe obj = (ActivateMe) Activatable.register(desc);

            System.err.println("Activate object via method call");
            obj.ping();

            System.err.println("Unregister object");
            obj.unregister();

            System.err.println("Make object inactive");
            obj.shutdown();

            System.err.println("Reactivate object");
            try {
                obj.ping();
            } catch (NoSuchObjectException e) {
                System.err.println("Test succeeded: " +
                                   "NoSuchObjectException caught");
                return;
            } catch (Exception e) {
                TestLibrary.bomb("Test failed: exception other than NoSuchObjectException",
                     e);
            }

        } catch (Exception e) {
            TestLibrary.bomb("test failed", e);
        } finally {
            ActivationLibrary.rmidCleanup(rmid);
        }
    }
}


text:
static NSString *const jsDelegate = @"jsDelegate";
@implementation UINavigationController (JsenKit)

+ (void)load {
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        Class class = [self class];

        SEL originalSelector = @selector(navigationBar:shouldPopItem:);
        SEL swizzledSelector = @selector(js_navigationBar:shouldPopItem:);

        SEL originalSelector2 = @selector(viewDidLoad);
        SEL swizzledSelector2 = @selector(js_viewDidLoad);

        [UINavigationController swizzClass:class originalSelector:originalSelector swizzledSelector:swizzledSelector];
        [UINavigationController swizzClass:class originalSelector:originalSelector2 swizzledSelector:swizzledSelector2];

    });
}

+ (void)swizzClass:(Class)class originalSelector:(SEL)originalSelector swizzledSelector:(SEL)swizzledSelector {

    Method originalMethod = class_getInstanceMethod(class, originalSelector);
    Method swizzledMethod = class_getInstanceMethod(class, swizzledSelector);

    BOOL didAddMethod = class_addMethod(class, originalSelector, method_getImplementation(swizzledMethod), method_getTypeEncoding(swizzledMethod));

    if (didAddMethod) {
        class_replaceMethod(class, swizzledSelector, method_getImplementation(originalMethod), method_getTypeEncoding(originalMethod));
    }else {
        method_exchangeImplementations(originalMethod, swizzledMethod);
    }
}

- (void)js_viewDidLoad {
    [self js_viewDidLoad];

    objc_setAssociatedObject(self, [jsDelegate UTF8String], self.interactivePopGestureRecognizer.delegate, OBJC_ASSOCIATION_ASSIGN);
    NSLog(@"%@",self.interactivePopGestureRecognizer.delegate);
    self.interactivePopGestureRecognizer.delegate = (id<UIGestureRecognizerDelegate>)self;
}

- (BOOL)js_navigationBar:(UINavigationBar *)navigationBar shouldPopItem:(UINavigationItem *)item {
    UIViewController *vc = self.topViewController;

    if (item != vc.navigationItem) {
        return YES;
    }

    if ([vc conformsToProtocol:@protocol(UINavigationControllerShouldPop)]) {
        if ([(id<UINavigationControllerShouldPop>)vc navigationControllerShouldPop:self]) {
            return [self js_navigationBar:navigationBar shouldPopItem:item];
        }else {
            return NO;
        }
    }else {
        return [self js_navigationBar:navigationBar shouldPopItem:item];
    }

}

- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer {
    if (gestureRecognizer == self.interactivePopGestureRecognizer) {
        UIViewController *vc = [self topViewController];
        if ([vc conformsToProtocol:@protocol(UINavigationControllerShouldPop)]) {
            if (![(id<UINavigationControllerShouldPop>)vc navigationControllerShouldStartInteractivePopGestureRecognizer:self]) {
                return NO;
            }
        }

        id<UIGestureRecognizerDelegate> originDelegate = objc_getAssociatedObject(self, [jsDelegate UTF8String]);
        return [originDelegate gestureRecognizerShouldBegin:gestureRecognizer];
    }
    return YES;
}

- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch {
    if (gestureRecognizer == self.interactivePopGestureRecognizer) {
        id<UIGestureRecognizerDelegate> originDelegate = objc_getAssociatedObject(self, [jsDelegate UTF8String]);
        return [originDelegate gestureRecognizer:gestureRecognizer shouldReceiveTouch:touch];
    }
    return YES;
}

- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer {
    if (gestureRecognizer == self.interactivePopGestureRecognizer) {
        id<UIGestureRecognizerDelegate> originDelegate = objc_getAssociatedObject(self, [jsDelegate UTF8String]);
        return [originDelegate gestureRecognizer:gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:otherGestureRecognizer];
    }
    return YES;
}

@end


text:
using System.IO;

namespace OpenSage.FileFormats.W3d
{
    public sealed class W3dTextureInfo : W3dChunk
    {
        public override W3dChunkType ChunkType { get; } = W3dChunkType.W3D_CHUNK_TEXTURE_INFO;

        /// <summary>
        /// Flags for this texture
        /// </summary>
        public W3dTextureFlags Attributes { get; private set; }

        /// <summary>
        /// animation logic
        /// </summary>
        public W3dTextureAnimation AnimationType { get; private set; }

        /// <summary>
        /// Number of frames (1 if not animated)
        /// </summary>
        public uint FrameCount { get; private set; }

        /// <summary>
        /// Frame rate, frames per second in floating point
        /// </summary>
        public float FrameRate { get; private set; }

        internal static W3dTextureInfo Parse(BinaryReader reader, W3dParseContext context)
        {
            return ParseChunk(reader, context, header =>
            {
                return new W3dTextureInfo
                {
                    Attributes = reader.ReadUInt16AsEnumFlags<W3dTextureFlags>(),
                    AnimationType = reader.ReadUInt16AsEnum<W3dTextureAnimation>(),
                    FrameCount = reader.ReadUInt32(),
                    FrameRate = reader.ReadSingle(),
                };
            });
        }

        protected override void WriteToOverride(BinaryWriter writer)
        {
            writer.Write((ushort) Attributes);
            writer.Write((ushort) AnimationType);
            writer.Write(FrameCount);
            writer.Write(FrameRate);
        }
    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<billStatus>
  <bill>
    <relatedBills />
    <sponsors>
      <item>
        <bioguideId>L000580</bioguideId>
        <state>NM</state>
        <fullName>Rep. Lujan Grisham, Michelle [D-NM-1]</fullName>
        <identifiers>
          <bioguideId>L000580</bioguideId>
          <lisID>2146</lisID>
          <gpoId />
        </identifiers>
        <party>D</party>
        <district>1</district>
        <byRequestType />
        <middleName />
        <lastName>Lujan Grisham</lastName>
        <firstName>Michelle</firstName>
      </item>
    </sponsors>
    <updateDate>2017-06-19T22:15:28Z</updateDate>
    <recordedVotes />
    <notes />
    <introducedDate>2017-05-03</introducedDate>
    <calendarNumbers />
    <laws />
    <version>1.0.0</version>
    <committeeReports />
    <originChamber>House</originChamber>
    <summaries>
      <billSummaries>
        <item>
          <lastSummaryUpdateDate>2017-06-05T14:20:01Z</lastSummaryUpdateDate>
          <actionDesc>Introduced in House</actionDesc>
          <actionDate>2017-05-03</actionDate>
          <updateDate>2017-05-03T04:00:00Z</updateDate>
          <versionCode>00</versionCode>
          <name>Introduced in House</name>
          <text><![CDATA[
501(c)(4) Reform Act of 2017

This bill amends the Internal Revenue Code, with respect to the tax exemption under section 501(c)(4) for social welfare organizations and local associations of employees, to prohibit such entities from participating or intervening (including the publishing or distributing of statements) in any political campaign on behalf of, or in opposition to, any candidate for public office.
]]></text>
        </item>
      </billSummaries>
    </summaries>
    <titles>
      <item>
        <parentTitleType />
        <chamberCode />
        <chamberName />
        <title>501(c)(4) Reform Act of 2017</title>
        <titleType>(Extracted from GPO) Short Titles as Introduced</titleType>
      </item>
      <item>
        <parentTitleType />
        <chamberCode />
        <chamberName />
        <title>501(c)(4) Reform Act of 2017</title>
        <titleType>Short Titles as Introduced</titleType>
      </item>
      <item>
        <parentTitleType />
        <chamberCode />
        <chamberName />
        <title>To amend the Internal Revenue Code of 1986 to prohibit 501(c)(4) entities from participating in, or intervening in (including the publishing or distributing of statements), any political campaign.</title>
        <titleType>Official Title as Introduced</titleType>
      </item>
      <item>
        <parentTitleType />
        <chamberCode />
        <chamberName />
        <title>501(c)(4) Reform Act of 2017</title>
        <titleType>Display Title</titleType>
      </item>
    </titles>
    <billType>HR</billType>
    <amendments />
    <actions>
      <actionTypeCounts>
        <billReferrals>1</billReferrals>
        <introducedInTheHouse>1</introducedInTheHouse>
        <introducedInHouse>1</introducedInHouse>
      </actionTypeCounts>
      <item>
        <links />
        <actionCode>H11100</actionCode>
        <type>IntroReferral</type>
        <committee>
          <name>Ways and Means Committee</name>
          <systemCode>hswm00</systemCode>
        </committee>
        <actionDate>2017-05-03</actionDate>
        <text>Referred to the House Committee on Ways and Means.</text>
        <sourceSystem>
          2
          <name>House floor actions</name>
        </sourceSystem>
      </item>
      <item>
        <links />
        <actionCode>Intro-H</actionCode>
        <type>IntroReferral</type>
        <committee />
        <actionDate>2017-05-03</actionDate>
        <text>Introduced in House</text>
        <sourceSystem>
          9
          <name>Library of Congress</name>
        </sourceSystem>
      </item>
      <item>
        <links />
        <actionCode>1000</actionCode>
        <type>IntroReferral</type>
        <committee />
        <actionDate>2017-05-03</actionDate>
        <text>Introduced in House</text>
        <sourceSystem>
          9
          <name>Library of Congress</name>
        </sourceSystem>
      </item>
      <actionByCounts>
        <houseOfRepresentatives>3</houseOfRepresentatives>
      </actionByCounts>
    </actions>
    <latestAction>
      <actionDate>2017-05-03</actionDate>
      <links />
      <text>Referred to the House Committee on Ways and Means.</text>
    </latestAction>
    <billNumber>2338</billNumber>
    <congress>115</congress>
    <title>501(c)(4) Reform Act of 2017</title>
    <policyArea>
      <name>Taxation</name>
    </policyArea>
    <subjects>
      <billSubjects>
        <policyArea>
          <name>Taxation</name>
        </policyArea>
        <legislativeSubjects>
          <item>
            <name>Elections, voting, political campaign regulation</name>
          </item>
          <item>
            <name>Political advertising</name>
          </item>
          <item>
            <name>Tax-exempt organizations</name>
          </item>
        </legislativeSubjects>
      </billSubjects>
    </subjects>
    <cboCostEstimates />
    <cosponsors />
    <committees>
      <billCommittees>
        <item>
          <systemCode>hswm00</systemCode>
          <type>Standing</type>
          <name>Ways and Means Committee</name>
          <subcommittees />
          <chamber>House</chamber>
          <activities>
            <item>
              <name>Referred to</name>
              <date>2017-05-03T14:05:05Z</date>
            </item>
          </activities>
        </item>
      </billCommittees>
    </committees>
    <constitutionalAuthorityStatementText><![CDATA[
From the Congressional Record Online through the Government Publishing Office [www.gpo.gov]By Ms. MICHELLE LUJAN GRISHAM of New Mexico:H.R. 2338.Congress has the power to enact this legislation pursuantto the following:Article 1, Section 8, Clause 18[Page H3325]
]]></constitutionalAuthorityStatementText>
    <createDate>2017-05-04T03:11:54Z</createDate>
  </bill>
  <dublinCore xmlns:dc="http://purl.org/dc/elements/1.1/">
    <dc:format>text/xml</dc:format>
    <dc:language>EN</dc:language>
    <dc:rights>Pursuant to Title 17 Section 105 of the United States Code, this file is not subject to copyright protection and is in the public domain.</dc:rights>
    <dc:contributor>Congressional Research Service, Library of Congress</dc:contributor>
    <dc:description>This file contains bill summaries and statuses for federal legislation. A bill summary describes the most significant provisions of a piece of legislation and details the effects the legislative text may have on current law and federal programs. Bill summaries are authored by the Congressional Research Service (CRS) of the Library of Congress. As stated in Public Law 91-510 (2 USC 166 (d)(6)), one of the duties of CRS is "to prepare summaries and digests of bills and resolutions of a public general nature introduced in the Senate or House of Representatives". For more information, refer to the User Guide that accompanies this file.</dc:description>
  </dublinCore>
</billStatus>


text:
var assert = require('assert'),
	testUtil = require('./testUtil');

var arrowDBEntryPoint = (process.env.ARROWDB_ENTRYPOINT ? process.env.ARROWDB_ENTRYPOINT : 'https://api.cloud.appcelerator.com');
var arrowDBKey = process.env.ARROWDB_APPKEY;
if (!arrowDBKey) {
	console.error('Please create an ArrowDB app and assign ARROWDB_APPKEY in environment vars.');
	process.exit(1);
}
console.log('ArrowDB Entry Point: %s', arrowDBEntryPoint);
console.log('MD5 of ARROWDB_APPKEY: %s', testUtil.md5(arrowDBKey));

var ArrowDB = require('../index'),
	arrowDBApp = new ArrowDB(arrowDBKey, {
		apiEntryPoint: arrowDBEntryPoint,
		prettyJson: true
	}),
	arrowDBUsername_1 = null,
	arrowDBPassword = 'cocoafish',
	arrowDBUsername_2 = null,
	subject = 'New SDK!',
	body = 'ArrowDB Node SDK Redesign Test - messages',
	arrowDBUser1_id = null,
	message_id = null,
	reply_message_id = null,
	thread_id = null;

describe('Messages Test', function() {
	this.timeout(50000);
	before(function(done) {
		testUtil.generateUsername(function(username) {
			arrowDBUsername_1 = username;
			console.log('\tGenerated arrowdb user 1: %s', arrowDBUsername_1);
			testUtil.generateUsername(function(username) {
				arrowDBUsername_2 = username;
				console.log('\tGenerated arrowdb user 2: %s', arrowDBUsername_2);
				done();
			});
		});
	});

	describe('create user', function() {
		it('Should create user 1 successfully', function(done) {
			arrowDBApp.usersCreate({
				username: arrowDBUsername_1,
				password: arrowDBPassword,
				password_confirmation: arrowDBPassword
			}, function(err, result) {
				assert.ifError(err);
				assert(result.body);
				assert(result.body.meta);
				assert.equal(result.body.meta.code, 200);
				assert.equal(result.body.meta.method_name, 'createUser');
				var obj = result.body.response.users[0];
				assert.equal(obj.username, arrowDBUsername_1);
				arrowDBUser1_id = obj.id;
				done();
			});
		});

		it('Should create user 2 successfully', function(done) {
			arrowDBApp.usersCreate({
				username: arrowDBUsername_2,
				password: arrowDBPassword,
				password_confirmation: arrowDBPassword
			}, function(err, result) {
				assert.ifError(err);
				assert(result.body);
				assert(result.body.meta);
				assert.equal(result.body.meta.code, 200);
				assert.equal(result.body.meta.method_name, 'createUser');
				var obj = result.body.response.users[0];
				assert.equal(obj.username, arrowDBUsername_2);
				done();
			});
		});
	});

	describe('Positive messages tests', function() {
		it('User 2 should be able to login successfully', function(done) {
			arrowDBApp.usersLogin({
				login: arrowDBUsername_2,
				password: arrowDBPassword
			}, function(err, result) {
				assert.ifError(err);
				assert(result.body);
				assert(result.body.meta);
				assert.equal(result.body.meta.code, 200);
				assert.equal(result.body.meta.method_name, 'loginUser');
				var obj = result.body.response.users[0];
				assert.equal(obj.username, arrowDBUsername_2);

				arrowDBApp.usersLogin({
					login: arrowDBUsername_2,
					password: arrowDBPassword
				}, function (err, result) {
					assert.ifError(err);
					assert(result);
					done();
				});
			});
		});

		it('Should send message to user 1 successfully', function(done) {
			arrowDBApp.messagesCreate({
				to_ids: arrowDBUser1_id,
				body: body,
				subject: subject
			}, function(err, result) {
				assert.ifError(err);
				assert(result.body);
				assert(result.body.meta);
				assert.equal(result.body.meta.code, 200);
				assert.equal(result.body.meta.method_name, 'createMessage');
				var obj = result.body.response.messages[0];
				message_id = obj.id;
				thread_id = obj.thread_id;
				assert.equal(obj.body, body);
				assert.equal(obj.subject, subject);
				done();
			});
		});

		it('Should show a message successfully', function(done) {
			arrowDBApp.messagesShow({
				message_id: message_id
			}, function(err, result) {
				assert.ifError(err);
				assert(result.body);
				assert(result.body.meta);
				assert.equal(result.body.meta.code, 200);
				assert.equal(result.body.meta.method_name, 'showMessage');
				var obj = result.body.response.messages[0];
				message_id = obj.id;
				assert.equal(obj.body, body);
				assert.equal(obj.subject, subject);
				done();
			});
		});

		it('Should show sent messages successfully', function(done) {
			arrowDBApp.messagesShowSent({}, function(err, result) {
				assert.ifError(err);
				assert(result.body);
				assert(result.body.meta);
				assert.equal(result.body.meta.code, 200);
				assert.equal(result.body.meta.method_name, 'showMessagesSent');
				var obj = result.body.response.messages[0];
				message_id = obj.id;
				assert.equal(obj.body, body);
				assert.equal(obj.subject, subject);
				assert.equal(obj.status, 'sent');
				done();
			});
		});

		it('Should show a message thread successfully', function(done) {
			arrowDBApp.messagesShowThread({
				thread_id: thread_id
			}, function(err, result) {
				assert.ifError(err);
				assert(result.body);
				assert(result.body.meta);
				assert.equal(result.body.meta.code, 200);
				assert.equal(result.body.meta.method_name, 'showThreadMessages');
				var obj = result.body.response.messages[0];
				assert.equal(obj.body, body);
				assert.equal(obj.subject, subject);
				assert.equal(obj.status, 'sent');
				done();
			});
		});

		it('Should query messages successfully', function(done) {
			arrowDBApp.messagesQuery({}, function(err, result) {
				assert.ifError(err);
				assert(result.body);
				assert(result.body.meta);
				assert.equal(result.body.meta.code, 200);
				assert.equal(result.body.meta.method_name, 'queryMessages');
				done();
			});
		});

		it('User 1 should be able to login successfully', function(done) {
			arrowDBApp.usersLogin({
				login: arrowDBUsername_1,
				password: arrowDBPassword
			}, function(err, result) {
				assert.ifError(err);
				assert(result.body);
				assert(result.body.meta);
				assert.equal(result.body.meta.code, 200);
				assert.equal(result.body.meta.method_name, 'loginUser');
				var obj = result.body.response.users[0];
				assert.equal(obj.username, arrowDBUsername_1);
				done();
			});
		});

		it('Should show message threads successfully', function(done) {
			arrowDBApp.messagesShowThreads({}, function(err, result) {
				assert.ifError(err);
				assert(result.body);
				assert(result.body.meta);
				assert.equal(result.body.meta.code, 200);
				assert.equal(result.body.meta.method_name, 'showThreads');
				var obj = result.body.response.messages[0];
				assert.equal(obj.body, body);
				assert.equal(obj.subject, subject);
				assert.equal(obj.status, 'unread');
				done();
			});
		});

		it('Should show inbox messages successfully', function(done) {
			arrowDBApp.messagesShowInbox({}, function(err, result) {
				assert.ifError(err);
				assert(result.body);

				assert(result.body.meta);
				assert.equal(result.body.meta.code, 200);
				assert.equal(result.body.meta.method_name, 'showMessagesInbox');
				var obj = result.body.response.messages[0];
				assert.equal(obj.body, body);
				assert.equal(obj.subject, subject);
				assert.equal(obj.status, 'unread');
				done();
			});
		});

		it('Should reply a message to user 2 successfully', function(done) {
			var body = 'Thanks for your invitation.';
			arrowDBApp.messagesReply({
				message_id: message_id,
				body: 'Thanks for your invitation.'
			}, function(err, result) {
				assert.ifError(err);
				assert(result.body);
				assert(result.body.meta);
				assert.equal(result.body.meta.code, 200);
				assert.equal(result.body.meta.method_name, 'replyMessage');
				var obj = result.body.response.messages[0];
				reply_message_id = obj.id;
				assert.equal(obj.body, body);
				assert.equal(obj.status, 'sent');
				done();
			});
		});

		it('Should count messages successfully', function(done) {
			arrowDBApp.messagesCount(function(err, result) {
				assert.ifError(err);
				assert(result.body);
				assert(result.body.meta);
				assert.equal(result.body.meta.code, 200);
				done();
			});
		});

		it('Should delete a thread successfully', function(done) {
			arrowDBApp.messagesDeleteThread({
				thread_id: thread_id
			}, function(err, result) {
				assert.ifError(err);
				assert(result.body);
				assert(result.body.meta);
				assert.equal(result.body.meta.code, 200);
				assert.equal(result.body.meta.method_name, 'deleteMessageThread');
				done();
			});
		});
	});

	describe('Negative messages tests', function() {
		it('Should fail to send message to user 1 without body', function(done) {
			arrowDBApp.messagesReply({
				message_id: message_id
			}, function(err) {
				//                assert.equal(err !== undefined, true);
				//                assert.equal(err.message, 'Required parameter body is missing.');
				assert(err);
				assert.equal(err.statusCode, 400);
				assert.equal(err.body.meta.method_name, 'replyMessage');
				done();
			});
		});

		it('Should fail to send message to user 1 without message_id', function(done) {
			arrowDBApp.messagesReply({
				body: body
			}, function(err) {
				//                assert.equal(err !== undefined, true);
				//                assert.equal(err.message, 'Required parameter message_id is missing.');
				assert(err);
				assert.equal(err.statusCode, 400);
				assert.equal(err.body.meta.method_name, 'replyMessage');
				done();
			});
		});

		it('Should fail to send message to user 1 without body', function(done) {
			arrowDBApp.messagesCreate({
				to_ids: arrowDBUser1_id,
				subject: subject
			}, function(err) {
				assert(err);
				assert.equal(err.statusCode, 400);
				assert.equal(err.body.meta.message, 'Failed to send message: Validation failed - Body can\'t be blank.');
				done();
			});
		});

		it('Should fail to show a message without message_id', function(done) {
			arrowDBApp.messagesShow({}, function(err) {
				assert(err);
				assert.equal(err.statusCode, 400);
				assert.equal(err.body.meta.message, 'Required field: message_id');
				done();
			});
		});

		it('Should reply a message to user 2 successfully', function(done) {
			arrowDBApp.messagesReply({
				message_id: message_id
			}, function(err) {
				assert(err);
				assert.equal(err.statusCode, 400);
				assert.equal(err.body.meta.method_name, 'replyMessage');
				done();
			});
		});

		it('Should fail delete a thread without thread_id', function(done) {
			arrowDBApp.messagesDeleteThread({}, function(err) {
				//                assert.equal(err !== undefined, true);
				//                assert.equal(err.message, 'Required parameter thread_id is missing.');
				assert(err);
				assert.equal(err.statusCode, 400);
				assert.equal(err.body.meta.method_name, 'deleteMessageThread');
				done();
			});
		});
	});

	describe('cleanup', function() {

		it('Should delete a message successfully', function(done) {
			arrowDBApp.messagesDelete({
				message_id: message_id
			}, function(err) {
				assert(err);
				assert.equal(err.statusCode, 400);
				assert.equal(err.body.meta.method_name, 'deleteMessage');
				done();
			});
		});

		it('Should delete current user successfully', function(done) {
			arrowDBApp.usersRemove(function(err, result) {
				assert.ifError(err);
				assert(result);
				assert(result.body);
				assert(result.body.meta);
				assert.equal(result.body.meta.code, 200);
				assert.equal(result.body.meta.method_name, 'deleteUser');
				done();
			});
		});
	});
});


text:
function A = unpickle( strIn )

% parse the header
sepInd = find( ':' == strIn );
if ~isempty(sepInd) && (length(sepInd) == 2) && (sepInd(2) < length(strIn)-1)
    classStr = strIn(1:sepInd(1)-1);
    sizeStr = strIn(sepInd(1)+1:sepInd(2)-1);
    dataStr = strIn(sepInd(2)+1:end-1);
else
    error( 'This string cannot be unpickled; it lacks the proper header' );
end

% convert the str to a MATLAB object
switch classStr

 case 'char'
  sizeVal = str2num( sizeStr );
  A = dataStr;
  A = reshape( A , sizeVal );

 otherwise
  sizeVal = str2num( sizeStr );
  A = str2num( dataStr );
  A = reshape( A , sizeVal );
end


text:
require 'eight_corner'
require 'csv'

### TUNABLES

width = 2550
height = 3300 # kinda deceptive. doc will be cut off at this point if the number
              # of figures warrants. figs will not be fit into this amount of
              # vertical space. (they're given square spaces based on width.)
cols = 11

x_margin = 150
y_margin = 150

figure_x_margin = 5
figure_y_margin = 5

log = Logger.new($stderr)
log.level = Logger::INFO

figure_interdependence = true

### OK, STOP TUNING NOW.

figure_width = (width - (x_margin * 2) - (cols * figure_x_margin * 2)) / cols
figure_height = figure_width

base = EightCorner::Base.new(
  figure_width,
  figure_height,
  logger: log
)
printer = EightCorner::SvgPrinter.new

data = CSV.read('ted_staff.csv', headers: true)
figure_count = data.size

# try to center-ish the last row of figures
figures_in_last_row = figure_count % cols
last_row_starts_at = figure_count - figures_in_last_row
width_of_last_row_data = (figure_width + (figure_x_margin * 2)) * figures_in_last_row
unoccupied_last_row_space = width - x_margin*2 - width_of_last_row_data
pixel_offset_in_last_row = unoccupied_last_row_space / 2

# this is necessary to make the last row center properly.
# which means i have a math error in here somewhere...
# pixel_offset_in_last_row += 30

svg = printer.svg(width, height) do |p|
  idx = 0
  out = ''
  previous_figure = nil

  data.each do |data|
    log.debug ['data', data.inspect]

    # out += "<!-- #{data['full']} -->\n"

    previous_potential = previous_figure.nil? ? 0.5 : previous_figure.potential
    previous_potential = 0.5 if figure_interdependence == false
    # puts "#{data['full']}\t#{previous_potential}"

    figure = base.plot(data['full'].to_s,
      point_interdependence: true,
      initial_potential: previous_potential
    )

    log.debug ['points', figure.points.inspect]

    col = idx % cols
    figure_x_origin = figure_width * col + (figure_x_margin * col * 2) + x_margin
    # try to center-ish the last row of figures
    if idx >= last_row_starts_at
      figure_x_origin += pixel_offset_in_last_row
    end

    row = idx/cols
    figure_y_origin = figure_height * row + (figure_y_margin * row * 2) + y_margin

    out += p.draw(figure,
      show_border: true,
      mark_initial_point: true,
      method: :incremental_colors,
      label: data['full'],
      # label: data['full'][0..5] +' '+previous_potential.to_s[0..10],
      # method: :solid,
      x_offset: figure_x_origin,
      y_offset: figure_y_origin,
      width: figure_width,
      height: figure_height
    )
    idx += 1

    previous_figure = figure
  end
  out
end

# filename = File.basename(__FILE__, '.rb')
filename = "output"

svg_filename = "#{filename}.svg"
File.open(svg_filename, 'w') {|f| f.write svg }

`open -a Firefox #{svg_filename}`


text:
from phi.flow import *

DOMAIN = dict(x=30, y=30)
DT = 0.1

def move_obstacle(obs: Obstacle):
    if (obs.geometry.center[0]) > 35:
        new_geometry = Box(x=(-6, 0), y=(10, 16))
    else:
        new_geometry = obs.geometry.shifted([1. * DT, 0])
    return obs.copied_with(geometry=new_geometry)

obstacle = Obstacle(Box(x=(5, 11), y=(10, 16)), velocity=[1., 0], angular_velocity=tensor(0,))
velocity = StaggeredGrid(0, extrapolation.ZERO, **DOMAIN)
obstacle_mask = CenteredGrid(HardGeometryMask(obstacle.geometry), extrapolation.BOUNDARY, **DOMAIN)
pressure = None

for _ in view(velocity, obstacle_mask, play=True, namespace=globals()).range():
    obstacle = move_obstacle(obstacle)
    velocity = advect.mac_cormack(velocity, velocity, DT)
    velocity, pressure = fluid.make_incompressible(velocity, (obstacle,))
    fluid.masked_laplace.tracers.clear()  # we will need to retrace because the matrix changes each step. This is not needed when JIT-compiling the physics.
    obstacle_mask = HardGeometryMask(obstacle.geometry) @ pressure


text:
<?xml version="1.0"?>
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">

  <id>html.java.net</id>
  <formats>
      <format>zip</format>
  </formats>
  <baseDirectory>${project.build.finalName}-app</baseDirectory>
  <dependencySets>
    <dependencySet>
        <useProjectArtifact>false</useProjectArtifact>
        <scope>runtime</scope>
        <outputDirectory>lib</outputDirectory>
    </dependencySet>
  </dependencySets>
  <files>
    <file>
      <source>${project.build.directory}/${project.build.finalName}.jar</source>
      <outputDirectory>/</outputDirectory>
    </file>
  </files>
  <fileSets>
    <fileSet>
       <directory>src/main/webapp/</directory>
       <outputDirectory>/</outputDirectory>
       <includes>
          <include>pages/**</include>
       </includes>
    </fileSet>
  </fileSets>
</assembly>


text:
<?xml version="1.0" encoding="UTF-8"?>
<project name="flexiblepower.ui.connectionspage" default="build">

	<!-- -->

	<import file="../cnf/build.xml" />
</project>


text:
require "abstract_unit"
require "action_dispatch/http/rack_cache"

class RackCacheMetaStoreTest < ActiveSupport::TestCase
  class ReadWriteHash < ::Hash
    alias :read  :[]
    alias :write :[]=
  end

  setup do
    @store = ActionDispatch::RailsMetaStore.new(ReadWriteHash.new)
  end

  test "stuff is deep duped" do
    @store.write(:foo, bar: :original)
    hash = @store.read(:foo)
    hash[:bar] = :changed
    hash = @store.read(:foo)
    assert_equal :original, hash[:bar]
  end
end


text:
package org.lcmanager.gdb.service.data.util;

import java.util.Arrays;
import java.util.Locale;

import lombok.Getter;
import lombok.ToString;

import org.lcmanager.gdb.base.Formatable;

/**
 * An OS family contains multiple operating system that are built upon the same
 * technologies (e.g. the WINDOWS family contains
 * Windows XP, Windows 2000 and so on).
 *
 *
 */
@Getter
@ToString
public enum OsFamily implements Formatable {
    /**
     * Windows.
     *
     */
    WINDOWS(1, "Windows"),
    /**
     * Unix.
     *
     */
    UNIX(2, "Unix", "Linux"),
    /**
     * Mac OS.
     *
     */
    MAC(3, "Mac OS"),
    /**
     * Other families that are not explicitly listed.
     *
     */
    OTHER(4, "Other");

    /**
     * The ID of this operating system family.
     *
     */
    private final int id;
    /**
     * The name of this operating system family.
     *
     */
    private final String name;
    /**
     * The aliases of this operating system or other families that are mapped to
     * the same family (e.g. clones of Unix).
     *
     */
    private final String[] aliases;

    /**
     * Constructor of OsFamily.
     *
     * @param id
     *            The {@link #id} to set.
     * @param name
     *            The {@link #name} to set.
     * @param aliases
     *            The {@link #aliases} to set.
     */
    private OsFamily(final int id, final String name, final String... aliases) {
        this.id = id;
        this.name = name;
        this.aliases = aliases;
    }

    /**
     * Finds the OS family with the given ID.
     *
     * @param id
     *            The ID of the OS family to find.
     * @return The OS family.
     * @throws IllegalArgumentException
     *             If the OS family was not found.
     */
    public static OsFamily getById(final int id) {
        final OsFamily result = Arrays.stream(OsFamily.values()).filter(value -> value.getId() == id).findFirst().get();
        if (result == null) {
            throw new IllegalArgumentException("Invalid id: " + id + ". Not found!");
        }
        return result;
    }

    /**
     * {@inheritDoc}
     *
     * @see org.lcmanager.gdb.base.Formatable#format(java.util.Locale)
     */
    @Override
    public String format(final Locale locale) {
        return this.name;
    }
}


text:
#! /usr/bin/env node

require('dotenv').config({ silent: true });

const server = require('./app');

const port = process.env.PORT || 3000;

server.listen(port, () => {
  // eslint-disable-next-line no-console
  console.log('Server running on port: %d', port);
});


text:
package com.PRIME.main.operations.menubars.displayMenu.surface;

import javafx.geometry.Point3D;
import javafx.scene.Scene;
import javafx.scene.control.*;
import javafx.scene.layout.GridPane;
import javafx.scene.paint.Color;
import javafx.stage.Stage;
import org.jzy3d.plot3d.primitives.Scatter;
import org.jzy3d.plot3d.primitives.Shape;
import org.renjin.sexp.ListVector;

import javax.script.ScriptException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

/**
 * Created by hkban on 7/10/2017.
 */
public class windowregion {

    Stage primaryStage = new Stage();
    static String name ="";
    List<Point3D> uppersurface= new ArrayList<>();
    List<Point3D> lowersurface= new ArrayList<>();
    Shape surface = null;
    Scatter scatter =null;
    static boolean flag = false;

    GridPane gp = new GridPane();
    public Shape coordinates(List<String> wellnames) throws IOException, ScriptException {

        TextField xval1[]= new TextField[wellnames.size()];
        TextField yval1[]= new TextField[wellnames.size()];
        TextField zval1[]= new TextField[wellnames.size()];
        TextField xval2[]= new TextField[wellnames.size()];
        TextField yval2[]= new TextField[wellnames.size()];
        TextField zval2[]= new TextField[wellnames.size()];
        Label name[] = new Label[wellnames.size()];
        RadioButton[] addbutton = new RadioButton[wellnames.size()];
        int row =0;
        int column =0;
        Label wellname = new Label("WELL NAME");
        gp.add(wellname,0,0);
        Label x1coordi = new Label("x1coordi");
        gp.add(x1coordi,1,0);
        Label y1coordi = new Label("y1coordi");
        gp.add(y1coordi,2,0);
        Label z1coordi = new Label("z1coordi");
        gp.add(z1coordi,3,0);
        Label x2coordi = new Label("x2coordi");
        gp.add(x2coordi,4,0);
        Label y2coordi = new Label("y2coordi");
        gp.add(y2coordi,5,0);
        Label z2coordi = new Label("z2coordi");
        gp.add(z2coordi,6,0);
        Label Add = new Label("ADDWELL");
        gp.add(Add,7,0);
        for(int i=0;i<wellnames.size();i++)
        {
            row++;
            name[i] = new Label(wellnames.get(i));
            gp.add(name[i],0,row);
            xval1[i] =new TextField();
            gp.add(xval1[i],1,row);
            yval1[i] =new TextField();
            gp.add(yval1[i],2,row);
            zval1[i] =new TextField();
            gp.add(zval1[i],3,row);
            xval2[i] =new TextField();
            gp.add(xval2[i],4,row);
            yval2[i] =new TextField();
            gp.add(yval2[i],5,row);
            zval2[i] =new TextField();
            gp.add(zval2[i],6,row);
            addbutton[i]= new RadioButton();
            gp.add(addbutton[i],7,row);
        }
        ToggleGroup paramvalue = new ToggleGroup();
        Label Parameter = new Label("Parameter");
        gp.add(Parameter,0,++row);
        RadioButton Saturation  = new RadioButton("Saturation");
        Saturation.setUserData("Saturation");
        Saturation.setToggleGroup(paramvalue);
        Saturation.setSelected(true);
        gp.add(Saturation,1,row);
        RadioButton Neut = new RadioButton("NEUT");
        Neut.setUserData("NEUT");
        Neut.setToggleGroup(paramvalue);
        gp.add(Neut,2,row);
        RadioButton OOIP = new RadioButton("OOIP");
        OOIP.setUserData("OOIP");
        OOIP.setToggleGroup(paramvalue);
        gp.add(OOIP,3,row);

        Label Plots = new Label("Plots");
        gp.add(Plots,0,++row);
        ToggleGroup plotvalue = new ToggleGroup();
        RadioButton ScatterPoints = new RadioButton("ScatterPlots");
        ScatterPoints.setUserData("ScatterPlots");
        ScatterPoints.setToggleGroup(plotvalue);
        gp.add(ScatterPoints,1,row);
        RadioButton Surfaceplots = new RadioButton("SurfacePlots");
        Surfaceplots.setUserData("SurfacePlots");
        Surfaceplots.setToggleGroup(plotvalue);
        gp.add(Surfaceplots,2,row);
        Button show = new Button("SHOW SURFACE");
        gp.add(show,8,++row);

        show.setOnAction(e->{
            uppersurface.add(new Point3D(-39.43171,174.18095,3565.55040));
            uppersurface.add(new Point3D(-39.47241,174.17548,5000.02440));
            uppersurface.add(new Point3D(-39.49464,174.18576,3000.09760));
            lowersurface.add(new Point3D(-39.43171,174.18095,2565.55040));
            lowersurface.add(new Point3D(-39.47241,174.17548,4000.02440));
            lowersurface.add(new Point3D(-39.49464,174.18576,2000.09760));
//            for(int i=0;i<wellnames.size();i++)
//            {
//                if(addbutton[i].isSelected()) {
//
//
//                    Point3D point1 = new Point3D(Double.parseDouble(xval1[i].getText()), Double.parseDouble(yval1[i].getText()), Double.parseDouble(zval1[i].getText()));
//                    Point3D point2 = new Point3D(Double.parseDouble(xval2[i].getText()), Double.parseDouble(yval2[i].getText()), Double.parseDouble(zval2[i].getText()));
//                    uppersurface.add(point1);
//                    lowersurface.add(point2);
//                }
//            }
            String plotval="";
            if(plotvalue.getSelectedToggle()!=null)
            {plotval=plotvalue.getSelectedToggle().getUserData().toString();}

            RegionPlot plot  = null;
            try {
                plot = new RegionPlot();
            } catch (ScriptException e1) {
                e1.printStackTrace();
            }
            ListVector list1 = null;
            ListVector list2 = null;
            try {
                list1 = Surface.method(uppersurface);
                list2 = Surface.method(lowersurface);
            } catch (IOException | ScriptException e1) {
                e1.printStackTrace();
            }
            try {
                surface = plot.Regionplot(list1,list2,wellnames,paramvalue.getSelectedToggle().getUserData().toString(),plotval);
            } catch (IOException | ScriptException e1) {
                e1.printStackTrace();
            }

            if(Objects.equals(plotval, "ScatterPlots"))
            {

                try {
                     scatter = plot.Scatterplot();
                } catch (IOException e1) {
                    e1.printStackTrace();
                }
                flag = true;
            }
            primaryStage.close();
        });
        gp.setHgap(10);
        gp.setVgap(10);
        Scene scene = new Scene(gp, 1500, 300);
        scene.setFill(Color.GREY);
        primaryStage.setTitle("Molecule Sample Application");
        primaryStage.setScene(scene);
        primaryStage.showAndWait();
        return surface;
    }

    public Scatter Discrete(){
        return scatter;
    }
}


text:
package net.sourceforge.myvd.types;

import com.novell.ldap.LDAPExtendedOperation;

public class ExtendedOperation {
	LDAPExtendedOperation op;
	DistinguishedName dn;
	boolean isWrite;

	public ExtendedOperation(DistinguishedName dn,LDAPExtendedOperation op) {
		this.dn = dn;
		this.op = op;
		this.isWrite = true;
	}

	public DistinguishedName getDn() {
		if (this.dn == null) {
			return new DistinguishedName("");
		} else {
			return dn;
		}
	}

	public void setDn(DistinguishedName dn) {
		this.dn = dn;
	}

	public LDAPExtendedOperation getOp() {
		return op;
	}

	public void setOp(LDAPExtendedOperation op) {
		this.op = op;
	}

	public boolean isWrite() {
		return isWrite;
	}

	public void setWrite(boolean isWrite) {
		this.isWrite = isWrite;
	}
}


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

[RequireComponent(typeof(Animator))]
[RequireComponent(typeof(Rigidbody))]
public class PlayerMovement : MonoBehaviour {
    public float speedMagnitude;

    private float verticalVelocity;
    public float gravity = 14.0f;
    public float jumpForce = 5.0f;
    public bool canDoubleJump;

    private Animator animator;
    private Rigidbody rigidBody;
    private CharacterController characterController;

    public Camera camera;

    void Start() {
        animator = GetComponent<Animator>();
        rigidBody = GetComponent<Rigidbody>();
        characterController = GetComponent<CharacterController>();
    }

    void Update() {
        MovementController();
        RotationController();
    }

    private void MovementController() {
        if (!characterController.isGrounded && canDoubleJump) {
            if (Input.GetButtonDown("Jump")) {
                verticalVelocity = jumpForce;
                canDoubleJump = false;
            }
        }

        if (characterController.isGrounded) {
            verticalVelocity = -gravity * Time.deltaTime;

            if(Input.GetAxis("Jump") != 0) {
                canDoubleJump = true;

                verticalVelocity = jumpForce;
            }
        } else {
            verticalVelocity -= gravity * Time.deltaTime;
        }

        float trueSpeedMagnitude = speedMagnitude * Time.deltaTime;
        Vector3 movement = (transform.right * Input.GetAxis("Horizontal") * trueSpeedMagnitude);
        movement.y = verticalVelocity;
        movement += transform.forward * Input.GetAxis("Vertical") * trueSpeedMagnitude;

        GetComponent<CharacterController>().Move(movement * Time.deltaTime);
    }

    private void RotationController() {
        if (Input.GetAxis("Horizontal") != 0 || Input.GetAxis("Vertical") != 0) {
            Quaternion newRotation = Quaternion.Euler(0, camera.transform.eulerAngles.y, 0);
            transform.rotation = newRotation;
        }
    }
}


text:
<?php
  $local = array();
  $local['Please login to continue.'] = 'Perfavore esegui l\'accesso per continuare';
  $local['Shells signature database updated succesfully!'] = 'Il database delle shell ` stato aggiornato con successo!';
  $local['Cant save shells signature database please check permissions'] = 'Non è possibile salvare il database controlla i permessi';
  $local['Your shells signatures database already updated!'] = 'Il database delle shell è già aggiornato!';
  $local['New version of application found. Please update!'] = 'È stata trovata una nuova versione dell\'applicazione. Perfavore procedi con l\'aggiornamento!';
  $local['Cant connect to server! Application version check failed!'] = 'Non è possibile connettersi al server! Il controllo della versione è fallito!';
  $local['New version of shells signature database found. Please update!'] = 'È stata trovata una nuova versione del database. Perfavore procedi con l

\'aggiornamento!';
  $local['Cant connect to server! Version check failed!'] = 'Non è possibile connettersi al server! Il controllo della versione è fallitto!';
  $local['You code submited. Thank you.'] = 'Il codice è stato inviato. Grazie.';
  $local['Cant find selected file.'] = 'Non è stato trovato il file selezionato';
  $local['No file specified.'] = 'Nessun file speficiato';
  $local['Starting file scanner, please be patient file scanning can take some time.'] = 'Avvio dell\'analisi dei file, si prega di attendere la scansione può

richiedere diverso tempo.';
  $local['Number of known shells in database is: '] = 'Numero di shell conosciute nel database: ';
  $local['Files found:'] = 'File trovati:';
  $local['File limit reached, scanning process stopped.'] = 'Il limite dei file è stato raggiunto, la scansione &egrave stata interrota.';
  $local['File scan done, we have: @count files to analize'] = 'La scansione dei file è stata effettuata, abbiamo: @count file da analizzare';
  $local['Please note suspicious files information will not be displayed'] = 'Si prega di notare le informazioni dei file sospetti non verranno visualizzati';
  $local['Show sha for file:'] = 'Mostra sha per file:';
  $local['Full path:'] = 'Percorso Completo:';
  $local['Sha1:'] = 'Sha1:';
  $local['please note it`s a malicious file not a shell'] = 'si prega di notare questo è un file sospetto non una shell';
  $local['please note potentially dangerous file (legit file but may be used by hackers)'] = 'vi prego di notare questo file è potenzialmente pericoloso (file

legittimo, ma può essere utilizzato dagli hacker)';
  $local['Fingerprint:'] = 'Impronta:';
  $local['Positive, it`s a '] = 'Positivo, è una ';
  $local['suspicious functions used:'] = 'Funzione sospetta:';
  $local['line:'] = 'linea:';
  $local['Status: @count suspicious files found and @shells shells found'] = 'Stato: Trovati @count file sospetti e @shells shell';
  $local['Negative'] = 'Negativo';
  $local['if wrong'] = 'se sbagliato';
  $local['submit file for analize'] = 'Invia file per l\'analisi';
  $local['Submit file'] = 'Invia file';
  $local['Your email'] = 'Tua email';
  $local['(in case you want to be notified):'] = '(Se vuoi essere informato):';
  $local['Suspicious behavior found in:'] = 'Elemento sospetto trovato in:';
  $local['Owner:'] = 'Proprietario:';
  $local['Permission:'] = 'Permessi:';
  $local['Last accessed:'] = 'Ultimo accesso:';
  $local['Last modified:'] = 'Ultima modifica:';
  $local['MD5 hash:'] = 'MD5 hash:';
  $local['Filesize:'] = 'Dimensione:';
  $local['Please wait'] = 'Attendere';
  $local['Error: '] = 'Errore:';
  $local[' line: '] = 'linea:';
?>


text:
import * as b from "bobril";
import { IRouteWithNavDefinition } from "../../../../common/routing";
import { Anchor } from "../../../../common/Anchor";
import { Example } from "../../../../common/Example";
import { float } from "../../../../../index";
import { Code } from "../../../../common/Code";
import { Lead } from "../../../../common/Lead";

export const floatRoute: IRouteWithNavDefinition = {
    url: "float",
    name: "float",
    label: "Float",
    handler: () => <FloatDoc />,
    subs: [
        {
            url: "overview",
            name: "float-overview",
            label: "Overview",
            subs: [],
        },
        {
            url: "responsive",
            name: "float-responsive",
            label: "Responsive",
            subs: [],
        },
    ],
};

export function FloatDoc(): b.IBobrilNode {
    return (
        <>
            <Anchor name="float">

Float

            </Anchor>
            <Lead>Toggle floats on any element, across any breakpoint, using our responsive float utilities.</Lead>
            <Anchor name="float-overview">

Examples

            </Anchor>

                These utility float an element to the left or right, or disable floating, based on the current viewport size using the{" "}

                    CSS float property

                . !important is included to avoid specificity issues. These use the same viewport breakpoints as our grid
                system. Please be aware float utilities have no effect on flex items.

            <Example>

Float start on all viewport sizes

Float end on all viewport sizes

Don't float on all viewport sizes

            </Example>
            {`
Float start on all viewport sizes

Float end on all viewport sizes

Don't float on all viewport sizes
`}
            <Anchor name="float-responsive">

Responsive

            </Anchor>

                Responsive variations also exist for each float value.

            <Example>

Float start on viewports sized SM (small) or wider

Float start on viewports sized MD (medium) or wider

Float start on viewports sized LG (large) or wider

Float start on viewports sized XL (extra-large) or wider

            </Example>
            {`
Float start on all viewport sizes

Float end on all viewport sizes

Don't float on all viewport sizes
`}
        </>
    );
}


text:
package v1

import (
	v1 "github.com/openshift/origin/pkg/user/apis/user/v1"
	"k8s.io/apimachinery/pkg/api/errors"
	meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/apimachinery/pkg/labels"
	"k8s.io/client-go/tools/cache"
)

// UserLister helps list Users.
type UserLister interface {
	// List lists all Users in the indexer.
	List(selector labels.Selector) (ret []*v1.User, err error)
	// Get retrieves the User from the index for a given name.
	Get(name string) (*v1.User, error)
	UserListerExpansion
}

// userLister implements the UserLister interface.
type userLister struct {
	indexer cache.Indexer
}

// NewUserLister returns a new UserLister.
func NewUserLister(indexer cache.Indexer) UserLister {
	return &userLister{indexer: indexer}
}

// List lists all Users in the indexer.
func (s *userLister) List(selector labels.Selector) (ret []*v1.User, err error) {
	err = cache.ListAll(s.indexer, selector, func(m interface{}) {
		ret = append(ret, m.(*v1.User))
	})
	return ret, err
}

// Get retrieves the User from the index for a given name.
func (s *userLister) Get(name string) (*v1.User, error) {
	key := &v1.User{ObjectMeta: meta_v1.ObjectMeta{Name: name}}
	obj, exists, err := s.indexer.Get(key)
	if err != nil {
		return nil, err
	}
	if !exists {
		return nil, errors.NewNotFound(v1.Resource("user"), name)
	}
	return obj.(*v1.User), nil
}


text:
#include <jni.h>
#include <windows.h>

JNIEXPORT void JNICALL Java_com_intellij_rt_execution_application_AppMain_triggerControlBreak(JNIEnv *env, jclass clazz) {
  GenerateConsoleCtrlEvent(CTRL_BREAK_EVENT, 0);
}


text:
package net.gumbix.hl7dsl.DSL

import org.hl7.rim.{Role, RimObjectFactory, Entity, LanguageCommunication}
import org.hl7.types._
import java.util.{ArrayList, List}
import scala.collection.JavaConversions._
import net.gumbix.hl7dsl.helper.ImplicitDef._
import net.gumbix.hl7dsl.helper.{Name, RimRelationshipMany, RimRelationshipOne}

/**
 * Wrapper Class for the RIM Class "Entity"
 * @author Ahmet Gül (guel.ahmet@hotmail.de)
 */
class EntityDSL(val entity: Entity) extends RimDSL(entity) {

  /**
   * @param cloneName Required to navigate through the object graph.
   */
  def this() = {
    this (RimObjectFactory.getInstance.createRimObject("Entity").asInstanceOf[Entity])
  }

  /**
   * @return CS
   */
  def classCode: CS = entity.getClassCode

  def classCode_=(v: CS) {
    entity.setClassCode(v)
  }

  /**
   * @return CS
   */
  def determinerCode: CS = entity.getDeterminerCode

  def determinerCode_=(v: CS) {
    entity.setDeterminerCode(v)
  }

  /**
   * @return SET[II]
   */
  def id: SET[II] = entity.getId

  def id_=(v: SET[II]) {
    entity.setId(v)
  }

  /**
   * @return CE
   */
  def code: CE = entity.getCode

  def code_=(v: CE) {
    entity.setCode(v)
  }

  /**
   * @return SET[PQ]
   */
  def quantity: SET[PQ] = entity.getQuantity

  def quantity_=(v: SET[PQ]) {
    entity.setQuantity(v)
  }

  /**
   * @return BAG[EN]
   */
  def name = {
    def nameChanged(name: Name) {
      entity.setName(name.toRSBag)
    }
    new Name(entity.getName, nameChanged)
  }

  def name_=(pn: Name) {
    entity.setName(pn.toRSBag)
  }

  /**
   * @return ED
   */
  def desc: ED = entity.getDesc

  def desc_=(v: ED) {
    entity.setDesc(v)
  }

  /**
   * @return CS
   */
  def statusCode: CS = entity.getStatusCode

  def statusCode_=(v: CS) {
    entity.setStatusCode(v)
  }

  /**
   * @return IVL[TS]
   */
  def existenceTime: IVL[TS] = entity.getExistenceTime

  def existenceTime_=(v: IVL[TS]) {
    entity.setExistenceTime(v)
  }

  /**
   * @return BAG[TEL]
   */
  def telecom: BAG[TEL] = entity.getTelecom

  def telecom_=(v: BAG[TEL]) {
    entity.setTelecom(v)
  }

  /**
   * @return CE
   */
  def riskCode: CE = entity.getRiskCode

  def riskCode_=(v: CE) {
    entity.setRiskCode(v)
  }

  /**
   * @return CE
   */
  def handlingCode: CE = entity.getHandlingCode

  def handlingCode_=(v: CE) {
    entity.setHandlingCode(v)
  }

  val languageCommunication = {
    new RimRelationshipMany[LanguageCommunication, LanguageCommunicationDSL](
      v => entity.addLanguageCommunication(v),
      entity.getLanguageCommunication(),
      p => new LanguageCommunicationDSL(p))
  }

  val scopedRole = {
    new RimRelationshipMany[Role, RoleDSL](
      v => entity.addScopedRole(v),
      entity.getScopedRole(),
      p => new RoleDSL(p))
  }

  val playedRole = {
    new RimRelationshipMany[Role, RoleDSL](
      v => entity.addPlayedRole(v),
      entity.getPlayedRole(),
      p => new RoleDSL(p))
  }
}


text:
'''
Created on 7. okt. 2015

@author: kga
'''

#############################
#
#    SETTINGS
#

# When safe = True no changes to twitter account is performed
# Queries to twitter account is still done
SAFE = True

#DO NOT TOUCH - TODO: move to constant file?
METHOD_FOLLOWBACK = "FOLLOWBACK"
METHOD_UNFOLLOW = "UNFOLLOW"

#############################
#
#    Logging
#

import logging

LOGNAME = 'example.log'
#LOGNAME = False

if LOGNAME:
    logging.basicConfig(filename=LOGNAME,level=logging.DEBUG)
else:
    logging.basicConfig(level=logging.DEBUG)

################################
#
#    Twitter account info and general api configuration
#
TWITTER_CONSUMER_KEY = ""
TWITTER_CONSUMER_SECRET = ""

TWITTER_USER_KEY = ""
TWITTER_USER_SECRET = ""

SCREEN_NAME = ""

# <= 0 THEN scrape all ELSE limit api calls
MAX_PAGES_INGATHER_FRIENDSHIPS = 0

###################################
#
#    Friendship check parameters - Facts
#

# Check to se if: followers > friends * d_friends
D_FRIENDSHIP = 0.6

# LEN_DESCRIPTION, check if user description has more characters
LEN_DESCRIPTION = 10

#NR_STATUSES: Check to se if  user have more statuses
NR_STATUSES = 300

#Check if user has status updates or not
HAS_STATUS = True

# DAYS_LAST_ACTIVE:  Check if user has been active in these last days
DAYS_LAST_ACTIVE = 5

# PROFILE_AGE: User must be older than x weeks. PROFILE_AGE is in weeks
PROFILE_AGE = 30

# QUARIES is a list of string quaries that is used to check if any of them exist in user profile
# ["nerd", "programming", "tv", "fantasy books"]
#Currently only checks in description... what about checking x latest tweets?
QUARIES = ["book","movie","film","tv","show","serie",
           "author","writer","read","fantasy","anime","manga",
           "action","sci","listening","geek","nerd",
           "drama","fiction"]

#PROFILE_IMAGE: to check if user has a profile image
PROFILE_IMAGE=True

# Config parameters fro followback function
FOLLOWBACK_D_FRIENDSHIP = 0.9
FOLLOWBACK_LEN_DESCRIPTION = LEN_DESCRIPTION
FOLLOWBACK_NR_STATUSES = NR_STATUSES
FOLLOWBACK_HAS_STATUS = HAS_STATUS
FOLLOWBACK_DAYS_LAST_ACTIVE = 50
FOLLOWBACK_PROFILE_AGE = PROFILE_AGE
FOLLOWBACK_QUARIES = QUARIES
FOLLOWBACK_PROFILE_IMAGE = PROFILE_IMAGE

# Config parameters for unfollow function
UNFOLLOW_D_FRIENDSHIP = None
UNFOLLOW_LEN_DESCRIPTION = None
UNFOLLOW_NR_STATUSES = None
UNFOLLOW_HAS_STATUS = None
UNFOLLOW_DAYS_LAST_ACTIVE = 100
UNFOLLOW_PROFILE_AGE = None
UNFOLLOW_QUARIES = None
UNFOLLOW_PROFILE_IMAGE = None

###################################
#
#    Friendship rules
#
#    Used to deside whix rules are to be run
#    Rules are hard. If one id fails then all fails

RULE_FRIENDSHIP_NR = False
RULE_DESCRIPTION_LENGTH = False
RULE_STATUS_NR = False
RULE_HAS_STATUS = False
RULE_LAST_ACTIVE = False
RULE_PROFILE_AGE = False
RULE_QUARIES = False
RULE_PROFILE_IMAGE = False

RULE_MAJORITY_RULE = False

#Followback rules
RULE_FRIENDSHIP_NR_FOLLOWBACK = False
RULE_DESCRIPTION_LENGTH_FOLLOWBACK = False
RULE_STATUS_NR_FOLLOWBACK = False
RULE_HAS_STATUS_FOLLOWBACK = True
RULE_LAST_ACTIVE_FOLLOWBACK = False
RULE_PROFILE_AGE_FOLLOWBACK = True
RULE_QUARIES_FOLLOWBACK = True
RULE_PROFILE_IMAGE_FOLLOWBACK = False

RULE_MAJORITY_RULE_FOLLOWBACK = True

#Unfollow rules
RULE_FRIENDSHIP_NR_UNFOLLOW = False
RULE_DESCRIPTION_LENGTH_UNFOLLOW = False
RULE_STATUS_NR_UNFOLLOW = False
RULE_HAS_STATUS_UNFOLLOW = False
RULE_LAST_ACTIVE_UNFOLLOW = True
RULE_PROFILE_AGE_UNFOLLOW = False
RULE_QUARIES_UNFOLLOW = False
RULE_PROFILE_IMAGE_UNFOLLOW = False

RULE_MAJORITY_RULE_UNFOLLOW = False


text:
<?php

// Include the API
require '../../lastfmapi/lastfmapi.php';

// Get the session auth data
$file = fopen('../auth.txt', 'r');
// Put the auth data into an array
$authVars = array(
	'apiKey' => trim(fgets($file)),
	'secret' => trim(fgets($file)),
	'username' => trim(fgets($file)),
	'sessionKey' => trim(fgets($file)),
	'subscriber' => trim(fgets($file))
);
$config = array(
	'enabled' => true,
	'path' => '../../lastfmapi/',
	'cache_length' => 1800
);
// Pass the array to the auth class to eturn a valid auth
$auth = new lastfmApiAuth('setsession', $authVars);

$apiClass = new lastfmApi();
$groupClass = $apiClass->getPackage($auth, 'group', $config);

// Setup the variables
$methodVars = array(
	'group' => 'Last.fm Web Services',
	'from' => '1217764800',
	'to' => '1218369600'
);

if ( $tracks = $groupClass->getWeeklyTrackChart($methodVars) ) {
	echo 'Data Returned';
	echo '
';
	print_r($tracks);
	echo '
';
}
else {
	die('Error '.$groupClass->error['code'].' - '.$groupClass->error['desc'].'');
}

?>


text:
var express = require('express');
var router = express.Router();
var User = require('../lib/user');

router.get('/', function(req, res) {
  res.render('register', {title: 'Register'});
});

router.post('/', function(req, res, next) {
  var data = req.body.user;
  User.getByName(data.name, function(err, user) {
    if (err) return next(err);

    // redis will default it
    if (user.id) {
      res.error('Username already taken');
      res.redirect('back');
    } else {
      var user = new User({
        name: data.name,
        pass: data.pass
      });

      user.save(function(err) {
        if (err) return next(err);
        req.session.uid = user.id;
        res.redirect('/');
      });
    }
  });
});

module.exports = router;


text:
<html>
<head>
<title>CSS3 media query test: media query testing compound queries (screen and (color) and (grid:0)). Using style element, css @import rule</title>
<link rel="help" href="http://www.w3.org/TR/css3-mediaqueries/#syntax" />
<style type="text/css" >
@import url(import-p-green.css) screen and (color) and (grid:0);
</style>

</head>
<body>
<p> This text should be green on bitmap color devices.</p>
</body>
</html>


text:
import rule from '@next/eslint-plugin-next/lib/rules/google-font-preconnect'
import { RuleTester } from 'eslint'
;(RuleTester as any).setDefaultConfig({
  parserOptions: {
    ecmaVersion: 2020,
    sourceType: 'module',
    ecmaFeatures: {
      modules: true,
      jsx: true,
    },
  },
})
const ruleTester = new RuleTester()

ruleTester.run('google-font-preconnect', rule, {
  valid: [
    `export const Test = () => (

          <link rel="preconnect" href="https://fonts.gstatic.com"/>
          <link
            href={process.env.NEXT_PUBLIC_CANONICAL_URL}
            rel="canonical"
          />
          <link
            href={new URL("../public/favicon.ico", import.meta.url).toString()}
            rel="icon"
          />

      )
    `,
  ],

  invalid: [
    {
      code: `
      export const Test = () => (

          <link href="https://fonts.gstatic.com"/>

      )
    `,
      errors: [
        {
          message:
            'Preconnect is missing. See https://nextjs.org/docs/messages/google-font-preconnect.',
          type: 'JSXOpeningElement',
        },
      ],
    },
    {
      code: `
      export const Test = () => (

          <link rel="preload" href="https://fonts.gstatic.com"/>

      )
    `,
      errors: [
        {
          message:
            'Preconnect is missing. See https://nextjs.org/docs/messages/google-font-preconnect.',
          type: 'JSXOpeningElement',
        },
      ],
    },
  ],
})


text:
import moksha
import pylons

from tg import url, config
from tg import expose, flash, tmpl_context, redirect
from tg.decorators import override_template
from pylons.i18n import ugettext as _

from moksha.lib.base import BaseController
from moksha.controllers.error import ErrorController
from moksha.controllers.apps import AppController
from moksha.controllers.widgets import WidgetController
from moksha.controllers.secure import SecureController

class DefaultRootController(BaseController):

    @expose('mako:moksha.templates.index')
    def index(self, *args, **kw):
        if 'default_menu' in moksha.menus:
            tmpl_context.menu_widget = moksha.menus['default_menu']
        else:
            tmpl_context.menu_widget = lambda: ''
        #tmpl_context.contextual_menu_widget = moksha.menus['contextual_menu']
        return dict(title='[ Moksha ]')

class RootController(BaseController):

    apps = AppController()
    widgets = WidgetController()
    error = ErrorController()
    moksha_admin = SecureController()

    @expose()
    def _lookup(self, *remainder):
        if moksha.root:
            return moksha.root(), remainder
        else:
            # If we're running moksha without a root specified on the
            # moksha.root entry-point, then redirect to a moksha logo
            return DefaultRootController(), remainder

    @expose()
    def livesocket(self, topic=None, callback=None, json=True):
        """Returns a raw Moksha live socket, for use in non-Moksha apps.

        <script> function bar(msg) { alert('bar(' + msg + ')'); } </script>
        <script type="text/javascript"
                src="http://localhost:8080/livesocket?topic=foo&callback=bar">
        </script>

        """
        data = {'topic': topic, 'callback': callback, 'json': json}
        backend = config.get('moksha.livesocket.backend', 'stomp').lower()
        if backend == 'stomp':
            override_template(self.livesocket, 'mako:moksha.templates.stomp_socket')
            data['stomp_host'] = config.get('stomp_host', 'localhost')
            data['stomp_port'] = config.get('stomp_port', 61613)
            data['stomp_user'] = config.get('stomp_user', 'guest')
            data['stomp_pass'] = config.get('stomp_pass', 'guest')
        elif backend == 'amqp':
            override_template(self.livesocket, 'mako:moksha.templates.amqp_socket')
            data['amqp_broker_host'] = config.get('amqp_broker_host', 'localhost')
            data['amqp_broker_port'] = config.get('amqp_broker_port', 5672)
            data['amqp_broker_user'] = config.get('amqp_broker_user', 'guest')
            data['amqp_broker_pass'] = config.get('amqp_broker_pass', 'guest')

        data['orbited_host'] = config.get('orbited_host', 'localhost')
        data['orbited_port'] = config.get('orbited_port', 9000)
        data['orbited_scheme'] = config.get('orbited_scheme', 'http')
        data['orbited_url'] = '%s://%s:%s' % (data['orbited_scheme'],
                data['orbited_host'], data['orbited_port'])

        environ = pylons.request.environ
        data['server'] = '%s://%s:%s%s' % (environ.get('wsgi.url_scheme', 'http'),
                                            environ['SERVER_NAME'],
                                            environ['SERVER_PORT'],
                                            environ['toscawidgets.prefix'])
        return data

    @expose('mako:moksha.templates.login')
    def login(self, came_from=None):
        """Start the user login."""
        if not came_from:
            came_from = url('/')
        login_counter = pylons.request.environ['repoze.who.logins']
        if login_counter > 0:
            flash(_('Wrong credentials'), 'warning')
        return dict(page='login', login_counter=str(login_counter),
                    came_from=came_from)

    @expose()
    def post_login(self, came_from=None):
        """
        Redirect the user to the initially requested page on successful
        authentication or redirect her back to the login page if login failed.

        """
        if not came_from:
            came_from = url('/')
        if not pylons.request.identity:
            login_counter = pylons.request.environ['repoze.who.logins'] + 1
            redirect(url('/login', came_from=came_from, __logins=login_counter))
        userid = pylons.request.identity['repoze.who.userid']
        flash(_('Welcome back, %s!') % userid)
        redirect(came_from)

    @expose()
    def post_logout(self, came_from=None):
        """
        Redirect the user to the initially requested page on logout and say
        goodbye as well.

        """
        flash(_('We hope to see you soon!'))
        if not came_from:
            came_from = url('/')
        redirect(came_from)


text:
COMMAND=$1
EXIT_VALUE=0

##
# SCRIPT COMMANDS
##

# before-install
#
# Do some stuff before npm install
#
before-install() {
  # Add our key
  if ([ $TRAVIS_BRANCH == "master" ] || [ ! -z "$TRAVIS_TAG" ]) &&
    [ $TRAVIS_PULL_REQUEST == "false" ] &&
    [ $TRAVIS_REPO_SLUG == "kalabox/kalabox-plugin-git" ]; then
      openssl aes-256-cbc -K $encrypted_dd11ce1f2e12_key -iv $encrypted_dd11ce1f2e12_iv -in ci/travis.id_rsa.enc -out $HOME/.ssh/travis.id_rsa -d
  fi
}

#$ node -pe 'JSON.parse(process.argv[1]).foo' "$(cat foobar.json)"

# before-script
#
#
before-script() {
  npm install -g grunt-cli
  # Upgrade to lastest NPM
  npm install -g npm
}

# script
#
# Run the tests.
#
script() {
  # Code l/hinting and standards
  grunt test
  # @todo clean this up
  EXIT_STATUS=$?
  if [[ $EXIT_STATUS != 0 ]] ; then
    exit $EXIT_STATUS
  fi
}

# after-script
#
# Clean up after the tests.
#
after-script() {
  echo
}

# after-success
#
# Clean up after the tests.
#
after-success() {
  if ([ $TRAVIS_BRANCH == "master" ] || [ ! -z "$TRAVIS_TAG" ]) &&
    [ $TRAVIS_PULL_REQUEST == "false" ] &&
    [ $TRAVIS_REPO_SLUG == "kalabox/kalabox-plugin-git" ]; then

    # Only do our stuff on the latest node version
    if [ $TRAVIS_NODE_VERSION == "0.12" ] ; then
      # DO VERSION BUMPING FOR KALABOX/KALABOX
      COMMIT_MESSAGE=$(git log --format=%B -n 1)
      BUILD_VERSION=$(node -pe 'JSON.parse(process.argv[1]).version' "$(cat $TRAVIS_BUILD_DIR/package.json)")
      # BUMP patch but only on master and not a tag
      if [ -z "$TRAVIS_TAG" ] && [ $TRAVIS_BRANCH == "master" ] && [ "${COMMIT_MESSAGE}" != "Release v${BUILD_VERSION}" ] ; then
        grunt bump-patch
      fi
      # Get updated build version
      BUILD_VERSION=$(node -pe 'JSON.parse(process.argv[1]).version' "$(cat $TRAVIS_BUILD_DIR/package.json)")
      chmod 600 $HOME/.ssh/travis.id_rsa

      # SET UP SSH THINGS
      eval "$(ssh-agent)"
      ssh-add $HOME/.ssh/travis.id_rsa
      git config --global user.name "Kala C. Bot"
      git config --global user.email "kalacommitbot@kalamuna.com"

      # RESET UPSTREAM SO WE CAN PUSH VERSION CHANGES TO IT
      # We need to re-add this in because our clone was originally read-only
      git remote rm origin
      git remote add origin git@github.com:$TRAVIS_REPO_SLUG.git
      git checkout $TRAVIS_BRANCH
      git add -A
      if [ -z "$TRAVIS_TAG" ]; then
        git commit -m "KALABOT TWERKING VERSION ${BUILD_VERSION} [ci skip]" --author="Kala C. Bot <kalacommitbot@kalamuna.com>" --no-verify
      fi
      git push origin $TRAVIS_BRANCH

      # DEPLOY OUR BUILD TO NPM
      $HOME/npm-config.sh > /dev/null
      npm publish ./
    fi
  else
    exit $EXIT_VALUE
  fi
}

# before-deploy
#
# Clean up after the tests.
#
before-deploy() {
  echo
}

# after-deploy
#
# Clean up after the tests.
#
after-deploy() {
  echo
}

##
# UTILITY FUNCTIONS:
##

# Sets the exit level to error.
set_error() {
  EXIT_VALUE=1
  echo "$@"
}

# Runs a command and sets an error if it fails.
run_command() {
  set -xv
  if ! $@; then
    set_error
  fi
  set +xv
}

##
# SCRIPT MAIN:
##

# Capture all errors and set our overall exit value.
trap 'set_error' ERR

# We want to always start from the same directory:
cd $TRAVIS_BUILD_DIR

case $COMMAND in
  before-install)
    run_command before-install
    ;;

  before-script)
    run_command before-script
    ;;

  script)
    run_command script
    ;;

  after-script)
    run_command after-script
    ;;

  after-success)
    run_command after-success
    ;;

  before-deploy)
    run_command before-deploy
    ;;

  after-deploy)
    run_command after-deploy
    ;;
esac

exit $EXIT_VALUE


text:
The MP3 file format, didn't provide any means for including metadata about the song.

**ID3 tags** were invented to solve this problem.

* You can tell if an MP3 file includes **ID3 tags** by examining the *last 128 bytes* of the file.
* If they begin with the characters TAG, you have found a ID3 tag.

**Tags are fixed-width fields with no spacing between them.**

`Song`, `album`, `artist`, and `comment` are **30 bytes each**.
The `year` is four bytes and the `genre` just gets one, which is an index into a list of predefined genres.

The format of the tag is as follows:

    Field      | TAG | song | artist | album | year | comment | genre
    Byte Width | 3   | 30   | 30     | 30    | 4    | 30      | 1
    ------------------------------------------------------------------
    128 Bytes

A minor change was later made to ID3 tags to allow them to include track numbers, creating ID3v1.1. In that format, if the 29th byte of a comment is null and the 30th is not, the 30th byte is an integer representing the track number.

This is derived from a quiz posted on rubyquiz.com see: http://rubyquiz.com/quiz136.html

## Lets write a parser!

Scenario 1:

    As a *user*
    When I run the program against an MP3 file
    Any tag present is identified

Scenario 2:

    As a *user*
    When an ID3 tag is detected
    Tag data is output to the screen

    Accept:
      When no tag found "No tag found" outputted

Scenario 3:

    As a *user*
    When an ID3 tag has a track number
    The track number is correctly outputted

## Test Data

The file `frederic-chopin-piano-sonata-2-op35-3-funeral-march.mp3` is included in this repository - sourced from the collection at [mfiles](http://www.mfiles.co.uk/mp3-files.htm)

If you open this file up in a hex editor (tip: you can rename the file to .bin and Visual Studio will happily open it) and the last 128 bytes of the file look like this

    TAGFuneral March (Sonata Op.35)Frederic Chopinwww.mfiles.co.uk© Music Files Ltd

This is an ID3V1 tag, with no track information.

## Genre list

The official ID3v1 genre list is this, and it's zero-indexed (i.e. Blues is 0, Classic Rock is 1...)

    Blues
    Classic Rock
    Country
    Dance
    Disco
    Funk
    Grunge
    Hip-Hop
    Jazz
    Metal
    New Age
    Oldies
    Other
    Pop
    R&B
    Rap
    Reggae
    Rock
    Techno
    Industrial
    Alternative
    Ska
    Death Metal
    Pranks
    Soundtrack
    Euro-Techno
    Ambient
    Trip-Hop
    Vocal
    Jazz+Funk
    Fusion
    Trance
    Classical
    Instrumental
    Acid
    House
    Game
    Sound Clip
    Gospel
    Noise
    AlternRock
    Bass
    Soul
    Punk
    Space
    Meditative
    Instrumental Pop
    Instrumental Rock
    Ethnic
    Gothic
    Darkwave
    Techno-Industrial
    Electronic
    Pop-Folk
    Eurodance
    Dream
    Southern Rock
    Comedy
    Cult
    Gangsta
    Top 40
    Christian Rap
    Pop/Funk
    Jungle
    Native American
    Cabaret
    New Wave
    Psychadelic
    Rave
    Showtunes
    Trailer
    Lo-Fi
    Tribal
    Acid Punk
    Acid Jazz
    Polka
    Retro
    Musical
    Rock & Roll
    Hard Rock
    Folk
    Folk-Rock
    National Folk
    Swing
    Fast Fusion
    Bebob
    Latin
    Revival
    Celtic
    Bluegrass
    Avantgarde
    Gothic Rock
    Progressive Rock
    Psychedelic Rock
    Symphonic Rock
    Slow Rock
    Big Band
    Chorus
    Easy Listening
    Acoustic
    Humour
    Speech
    Chanson
    Opera
    Chamber Music
    Sonata
    Symphony
    Booty Bass
    Primus
    Porn Groove
    Satire
    Slow Jam
    Club
    Tango
    Samba
    Folklore
    Ballad
    Power Ballad
    Rhythmic Soul
    Freestyle
    Duet
    Punk Rock
    Drum Solo
    A capella
    Euro-House
    Dance Hall


text:
	<jaxer:include src="jaxer-include/templates/header.html"></jaxer:include>

 (signout)

			<button id="add_new_chatroom" type="button">Add New Chatroom</button>

Users in Chatroom

	<jaxer:include src="jaxer-include/templates/footer.html"></jaxer:include>


text:
Rails.application.config.assets.precompile += %w( ckeditor/filebrowser/javascripts/fileuploader.js
                                                  ckeditor/filebrowser/javascripts/jquery.endless-scroll.js
ckeditor/filebrowser/javascripts/jquery.min.js
ckeditor/filebrowser/javascripts/jquery.tmpl.min.js
ckeditor/filebrowser/javascripts/rails.js
ckeditor/filebrowser/stylesheets/uploader.css)


text:
package core

import io.apibuilder.spec.v0.models.ParameterLocation
import org.scalatest.{FunSpec, Matchers}

class ServiceAnnotationsSpec extends FunSpec with Matchers {

  it("fields specifying an undefined annotation are NOT allowed") {
    val json =
      """
    {
      "name": "Api Doc",
      "apidoc": { "version": "0.9.6" },
      "models": {
        "user": {
          "fields": [
            { "name": "id", "type": "long", "annotations": ["nope"]}
          ]
        }
      }
    }
    """
    val validator = TestHelper.serviceValidatorFromApiJson(json)
    validator.errors().mkString should not be("")
  }

  it("a defined annotation is allowed") {
    val json =
      """
    {
      "name": "Api Doc",
      "apidoc": { "version": "0.9.6" },
      "annotations": {
        "okay": {}
      }
    }
    """
    val validator = TestHelper.serviceValidatorFromApiJson(json)
    validator.errors().mkString should be("")
  }

  it("a defined annotation must have a name") {
    val json =
      """
    {
      "name": "Api Doc",
      "apidoc": { "version": "0.9.6" },
      "annotations": {
        "": {}
      }
    }
    """
    val validator = TestHelper.serviceValidatorFromApiJson(json)
    validator.errors().mkString should be("Annotations must have a name")
  }

  it("a defined annotation must have a name without special characters") {
    val json =
      """
    {
      "name": "Api Doc",
      "apidoc": { "version": "0.9.6" },
      "annotations": {
        "@!#?@!": {}
      }
    }
    """
    val validator = TestHelper.serviceValidatorFromApiJson(json)
    validator.errors().mkString should be("Annotation[@!#?@!] name is invalid: Name can only contain a-z, A-Z, 0-9, - and _ characters and Name must start with a letter")
  }

  it("fields specifying a defined annotation are allowed") {
    val json =
      """
    {
      "name": "Api Doc",
      "apidoc": { "version": "0.9.6" },
      "annotations": {
        "okay": {}
      },
      "models": {
        "user": {
          "fields": [
            { "name": "id", "type": "long", "annotations": ["okay"]}
          ]
        }
      }
    }
    """
    val validator = TestHelper.serviceValidatorFromApiJson(json)
    validator.errors().mkString should be("")
  }

  it("fields specifying duplicated annotations are NOT allowed") {
    val json =
      """
    {
      "name": "Api Doc",
      "apidoc": { "version": "0.9.6" },
      "annotations": {
        "nodupes": {}
      },
      "models": {
        "user": {
          "fields": [
            { "name": "id", "type": "long", "annotations": ["nodupes", "nodupes"]}
          ]
        }
      }
    }
    """
    val validator = TestHelper.serviceValidatorFromApiJson(json)
    validator.errors().nonEmpty should be(true)
    validator.errors().mkString should be("user.id.annotation[nodupes] appears more than once")
  }

  it("fields with multiple annotations allowed") {
    val json =
      """
    {
      "name": "Api Doc",
      "apidoc": { "version": "0.9.6" },
      "annotations": {
        "one": {},
        "two": {}
      },
      "models": {
        "user": {
          "fields": [
            { "name": "id", "type": "long", "annotations": ["one", "two"]}
          ]
        }
      }
    }
    """
    val validator = TestHelper.serviceValidatorFromApiJson(json)
    validator.errors().mkString should be("")
    validator.service().annotations.size should be(2)
    validator.service().models.head.fields.head.annotations.size should be(2)
  }
}