text:
#include "postgres.h"

#include "access/amvalidate.h"
#include "access/gin_private.h"
#include "access/htup_details.h"
#include "catalog/pg_amop.h"
#include "catalog/pg_amproc.h"
#include "catalog/pg_opclass.h"
#include "catalog/pg_opfamily.h"
#include "catalog/pg_type.h"
#include "utils/builtins.h"
#include "utils/lsyscache.h"
#include "utils/syscache.h"

/*
 * Validator for a GIN opclass.
 */
bool
ginvalidate(Oid opclassoid)
{
	bool		result = true;
	HeapTuple	classtup;
	Form_pg_opclass classform;
	Oid			opfamilyoid;
	Oid			opcintype;
	Oid			opckeytype;
	char	   *opclassname;
	HeapTuple	familytup;
	Form_pg_opfamily familyform;
	char	   *opfamilyname;
	CatCList   *proclist,
			   *oprlist;
	List	   *grouplist;
	OpFamilyOpFuncGroup *opclassgroup;
	int			i;
	ListCell   *lc;

	/* Fetch opclass information */
	classtup = SearchSysCache1(CLAOID, ObjectIdGetDatum(opclassoid));
	if (!HeapTupleIsValid(classtup))
		elog(ERROR, "cache lookup failed for operator class %u", opclassoid);
	classform = (Form_pg_opclass) GETSTRUCT(classtup);

	opfamilyoid = classform->opcfamily;
	opcintype = classform->opcintype;
	opckeytype = classform->opckeytype;
	if (!OidIsValid(opckeytype))
		opckeytype = opcintype;
	opclassname = NameStr(classform->opcname);

	/* Fetch opfamily information */
	familytup = SearchSysCache1(OPFAMILYOID, ObjectIdGetDatum(opfamilyoid));
	if (!HeapTupleIsValid(familytup))
		elog(ERROR, "cache lookup failed for operator family %u", opfamilyoid);
	familyform = (Form_pg_opfamily) GETSTRUCT(familytup);

	opfamilyname = NameStr(familyform->opfname);

	/* Fetch all operators and support functions of the opfamily */
	oprlist = SearchSysCacheList1(AMOPSTRATEGY, ObjectIdGetDatum(opfamilyoid));
	proclist = SearchSysCacheList1(AMPROCNUM, ObjectIdGetDatum(opfamilyoid));

	/* Check individual support functions */
	for (i = 0; i < proclist->n_members; i++)
	{
		HeapTuple	proctup = &proclist->members[i]->tuple;
		Form_pg_amproc procform = (Form_pg_amproc) GETSTRUCT(proctup);
		bool		ok;

		/*
		 * All GIN support functions should be registered with matching
		 * left/right types
		 */
		if (procform->amproclefttype != procform->amprocrighttype)
		{
			ereport(INFO,
					(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
					 errmsg("gin operator family \"%s\" contains support procedure %s with cross-type registration",
							opfamilyname,
							format_procedure(procform->amproc))));
			result = false;
		}

		/*
		 * We can't check signatures except within the specific opclass, since
		 * we need to know the associated opckeytype in many cases.
		 */
		if (procform->amproclefttype != opcintype)
			continue;

		/* Check procedure numbers and function signatures */
		switch (procform->amprocnum)
		{
			case GIN_COMPARE_PROC:
				ok = check_amproc_signature(procform->amproc, INT4OID, false,
											2, 2, opckeytype, opckeytype);
				break;
			case GIN_EXTRACTVALUE_PROC:
				/* Some opclasses omit nullFlags */
				ok = check_amproc_signature(procform->amproc, INTERNALOID, false,
											2, 3, opcintype, INTERNALOID,
											INTERNALOID);
				break;
			case GIN_EXTRACTQUERY_PROC:
				/* Some opclasses omit nullFlags and searchMode */
				ok = check_amproc_signature(procform->amproc, INTERNALOID, false,
											5, 7, opcintype, INTERNALOID,
											INT2OID, INTERNALOID, INTERNALOID,
											INTERNALOID, INTERNALOID);
				break;
			case GIN_CONSISTENT_PROC:
				/* Some opclasses omit queryKeys and nullFlags */
				ok = check_amproc_signature(procform->amproc, BOOLOID, false,
											6, 8, INTERNALOID, INT2OID,
											opcintype, INT4OID,
											INTERNALOID, INTERNALOID,
											INTERNALOID, INTERNALOID);
				break;
			case GIN_COMPARE_PARTIAL_PROC:
				ok = check_amproc_signature(procform->amproc, INT4OID, false,
											4, 4, opckeytype, opckeytype,
											INT2OID, INTERNALOID);
				break;
			case GIN_TRICONSISTENT_PROC:
				ok = check_amproc_signature(procform->amproc, CHAROID, false,
											7, 7, INTERNALOID, INT2OID,
											opcintype, INT4OID,
											INTERNALOID, INTERNALOID,
											INTERNALOID);
				break;
			default:
				ereport(INFO,
						(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
						 errmsg("gin operator family \"%s\" contains function %s with invalid support number %d",
								opfamilyname,
								format_procedure(procform->amproc),
								procform->amprocnum)));
				result = false;
				continue;		/* don't want additional message */
		}

		if (!ok)
		{
			ereport(INFO,
					(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
					 errmsg("gin operator family \"%s\" contains function %s with wrong signature for support number %d",
							opfamilyname,
							format_procedure(procform->amproc),
							procform->amprocnum)));
			result = false;
		}
	}

	/* Check individual operators */
	for (i = 0; i < oprlist->n_members; i++)
	{
		HeapTuple	oprtup = &oprlist->members[i]->tuple;
		Form_pg_amop oprform = (Form_pg_amop) GETSTRUCT(oprtup);

		/* TODO: Check that only allowed strategy numbers exist */
		if (oprform->amopstrategy < 1 || oprform->amopstrategy > 63)
		{
			ereport(INFO,
					(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
					 errmsg("gin operator family \"%s\" contains operator %s with invalid strategy number %d",
							opfamilyname,
							format_operator(oprform->amopopr),
							oprform->amopstrategy)));
			result = false;
		}

		/* gin doesn't support ORDER BY operators */
		if (oprform->amoppurpose != AMOP_SEARCH ||
			OidIsValid(oprform->amopsortfamily))
		{
			ereport(INFO,
					(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
					 errmsg("gin operator family \"%s\" contains invalid ORDER BY specification for operator %s",
							opfamilyname,
							format_operator(oprform->amopopr))));
			result = false;
		}

		/* Check operator signature --- same for all gin strategies */
		if (!check_amop_signature(oprform->amopopr, BOOLOID,
								  oprform->amoplefttype,
								  oprform->amoprighttype))
		{
			ereport(INFO,
					(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
					 errmsg("gin operator family \"%s\" contains operator %s with wrong signature",
							opfamilyname,
							format_operator(oprform->amopopr))));
			result = false;
		}
	}

	/* Now check for inconsistent groups of operators/functions */
	grouplist = identify_opfamily_groups(oprlist, proclist);
	opclassgroup = NULL;
	foreach(lc, grouplist)
	{
		OpFamilyOpFuncGroup *thisgroup = (OpFamilyOpFuncGroup *) lfirst(lc);

		/* Remember the group exactly matching the test opclass */
		if (thisgroup->lefttype == opcintype &&
			thisgroup->righttype == opcintype)
			opclassgroup = thisgroup;

		/*
		 * There is not a lot we can do to check the operator sets, since each
		 * GIN opclass is more or less a law unto itself, and some contain
		 * only operators that are binary-compatible with the opclass datatype
		 * (meaning that empty operator sets can be OK).  That case also means
		 * that we shouldn't insist on nonempty function sets except for the
		 * opclass's own group.
		 */
	}

	/* Check that the originally-named opclass is complete */
	for (i = 1; i <= GINNProcs; i++)
	{
		if (opclassgroup &&
			(opclassgroup->functionset & (((uint64) 1) << i)) != 0)
			continue;			/* got it */
		if (i == GIN_COMPARE_PARTIAL_PROC)
			continue;			/* optional method */
		if (i == GIN_CONSISTENT_PROC || i == GIN_TRICONSISTENT_PROC)
			continue;			/* don't need both, see check below loop */
		ereport(INFO,
				(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
		   errmsg("gin operator class \"%s\" is missing support function %d",
				  opclassname, i)));
		result = false;
	}
	if (!opclassgroup ||
		((opclassgroup->functionset & (1 << GIN_CONSISTENT_PROC)) == 0 &&
		 (opclassgroup->functionset & (1 << GIN_TRICONSISTENT_PROC)) == 0))
	{
		ereport(INFO,
				(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
				 errmsg("gin operator class \"%s\" is missing support function %d or %d",
						opclassname,
						GIN_CONSISTENT_PROC, GIN_TRICONSISTENT_PROC)));
		result = false;
	}

	ReleaseCatCacheList(proclist);
	ReleaseCatCacheList(oprlist);
	ReleaseSysCache(familytup);
	ReleaseSysCache(classtup);

	return result;
}

redpajama_set_name: RedPajamaGithub


text:
This app allows firmware upgrades of routers while keeping user installed packages.
To do so the app sends a request to an *Atttended SysUpgrade server* which will
respond with a custom image, containing all previously installed packages.

The process takes per images between 30 seconds and 5 minutes, please be
patient.

More information on the backend server and how to host one are available on the
projects page: https://github.com/aparcar/asu/


text:
'use strict';

class VideojsPlayer {
	/**
	 * @param {options}
	 */
	constructor(userParams) {

		// Merge default params with user params
		this.options = Object.assign({
			multiplePlaying: true
		}, userParams || {});

		this.players = [];
		this.playerOnPlaying = [];

	}

	/**
	 * Create the Videojs player
	 * @param {Object} userParams Options to create a player
	 */
	create(userParams) {

		// Merge default params with user params
		const params = Object.assign({
			element: null,
			playerVars: {
				'nativeControlsForTouch': false,
				'preload': 'auto',
				'volumeControl': false,
				'controls': true,
				'preload': 'auto'
			},
			events: {}
		}, userParams || {});

		// Generate unique ID for every player
		const generatedId = new Date().getTime();
		const selectorId = `videojs-${generatedId}`;
		params.element['VJS_ID'] = selectorId;
		params.element.setAttribute('id', selectorId);

		// Init Videojs player
		this.players.push(videojs(params.element, params.playerVars, () => {

			const player = videojs.getPlayers()[selectorId];

			player.on('play', () => {

				this.playerOnPlaying.push(selectorId);

				if (!this.options.multiplePlaying) {
					this.pauseOtherVideo(selectorId);
				}

			});

			player.on('pause', this.updateArrayPlayersPlaying.bind(this, selectorId));
			player.on('ended', this.updateArrayPlayersPlaying.bind(this, selectorId));

			if (typeof params.events.onPlayerReady === 'function') {
				params.events.onPlayerReady(player);
			}

		}));

	}

	/**
	 * Update the array of playing players
	 * @param {String} currentSelectorId ID of the current player
	 */
	updateArrayPlayersPlaying(currentSelectorId) {

		this.playerOnPlaying.forEach((playerId, index) => {
			if (playerId === currentSelectorId) {
				this.playerOnPlaying.splice(index, 1);
			}
		});

	}

	/**
	 * Pause other playing players
	 * @param {String} currentSelectorId ID of the current player
	 */
	pauseOtherVideo(currentSelectorId) {

		if (this.playerOnPlaying.length) {
			this.playerOnPlaying.forEach(playerId => {
				// Prevent pause current player
				if (playerId !== currentSelectorId) {
					videojs.getPlayers()[playerId].pause();
				}
			});
		}

	}

}

export default VideojsPlayer;


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Nano.Modbus;
using NUnit.Framework;

namespace NanoModbusTests {
    [TestFixture]
    public class RegisterHolderTest {

        [Test]
        public void testToBytes() {
            RegisterHolder holder = new RegisterHolder((byte)1, (short)4, 5);
            Console.WriteLine(ByteUtils.ToHexString(holder.ToBytes()));
            Assert.AreEqual(ByteUtils.ToHexString(holder.ToBytes()), "9C4100050A00000000000000000000");

            holder[0] = 2;
            holder[1] = 500;
            holder[2] = 200;
            holder[3] = 4;
            holder[4] = 5000;
            Console.WriteLine(ByteUtils.ToHexString(holder.ToBytes()));
        }

        [Test]
        public void testSize() {
            RegisterHolder holder = new RegisterHolder((byte)1, (short)4, (short)5);
            Assert.AreEqual(holder.Size(), 5 + 10);
        }
    }
}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
null

#### Original name
Akanthomyces lathrobii Thaxt.

### Remarks
null


text:
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.

using System;
using UnityEngine;

namespace HoloToolkit.Unity
{
    /// <summary>
    /// Provides interpolation over Vector3.
    /// </summary>
    [Serializable]
    public class InterpolatedVector3 : InterpolatedValue<Vector3>
    {
        /// <summary>
        /// Instantiates the InterpolatedVector3 with default of Vector3 as initial value and skipping the first update frame.
        /// </summary>
        public InterpolatedVector3() : this(default(Vector3)) { }

        /// <summary>
        /// Instantiates the InterpolatedVector3 with a given Vector3 value as initial value and defaulted to skipping the first update frame.
        /// </summary>
        /// <param name="initialValue">Initial current value to use.</param>
        /// <param name="skipFirstUpdateFrame">A flag to skip first update frame after the interpolation target has been set.</param>
        public InterpolatedVector3(Vector3 initialValue, bool skipFirstUpdateFrame = false) : base(initialValue, skipFirstUpdateFrame) { }

        /// <summary>
        /// Overrides the method to check if two Vector3s are close enough.
        /// </summary>
        /// <remarks>This method is public because of a Unity compilation bug when dealing with abstract methods on generics.</remarks>
        /// <param name="one">First Vector3 value.</param>
        /// <param name="other">Second Vector3 value.</param>
        /// <returns>True if the Vector3 are close enough.</returns>
        public override bool DoValuesEqual(Vector3 one, Vector3 other)
        {
            return (one - other).sqrMagnitude <= SmallNumberSquared;
        }

        /// <summary>
        /// Overrides the method to calculate the current Vector3 interpolation value by using a Vector3.Lerp function.
        /// </summary>
        /// <remarks>This method is public because of a Unity compilation bug when dealing with abstract methods on generics.</remarks>
        /// <param name="startValue">The Vector3 value that the interpolation started at.</param>
        /// <param name="targetValue">The target Vector3 value that the interpolation is moving to.</param>
        /// <param name="curveValue">A curve evaluated interpolation position value. This will be in range of [0, 1]</param>
        /// <returns>The new calculated Vector3 interpolation value.</returns>
        public override Vector3 ApplyCurveValue(Vector3 startValue, Vector3 targetValue, float curveValue)
        {
            return Vector3.Lerp(startValue, targetValue, curveValue);
        }
    }
}


text:
package org.jetbrains.plugins.scala.failed.annotator

import com.intellij.testFramework.fixtures.CodeInsightTestFixture
import org.jetbrains.plugins.scala.PerfCycleTests
import org.junit.experimental.categories.Category

/**
  * @author Nikolay.Tropin
  */
@Category(Array(classOf[PerfCycleTests]))
class MissingParameterTypeTest extends BadCodeGreenTestBase {

  import CodeInsightTestFixture.CARET_MARKER

  def testScl4692(): Unit = {
    val text =
     s"""object Test {
        |  def processStrings(strings: String*) = 1.23
        |
        |  val processAny = processStrings(${CARET_MARKER}_: _*)
        |}
      """.stripMargin
    //missing parameter type for expanded function ((x$1) => processStrings((x$1: _*)))
    doTest(text)
  }

  def testScl10539(): Unit = {
    val text =
      s"""class Foo(x: Int)(y: Int)
         |val foo = new Foo$CARET_MARKER(1)
      """.stripMargin
    doTest(text)
  }

  def testScl5943(): Unit = {
    val text =
      s"""List("A", "B").foreach {it =>
          |    println("it = " + ${CARET_MARKER}_)
          |  }
      """.stripMargin
    doTest(text)
  }
}


text:
title: One Page Demo Site
menu: Home
onpage_menu: true
body_classes: title-h1h2 header-dark header-transparent

content:
    items: @self.modular
---


text: The card game for us in Windows platform.


text:
import fastify from "fastify"

import cache from "./cache"

const server = fastify({})

server.get("/", (req, res) => {
  res.send("Hello, Tyrian!\n")
})

server.put("/:key/:value", (req, res) => {
  cache.put(req.params["key"], req.params["value"])
  res.send("")
})

server.get("/:key", (req, res) => {
  const key = req.params["key"]
  res.send(cache.getIfPresent(key) + "\n")
})

server.listen(8080)


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd">

<TITLE>
Xerces2 Implementation: Package org.apache.xerces.impl.xpath.regex
</TITLE>
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../../stylesheet.css" TITLE="Style">

      Overview
    Package
      Class
      Tree
      Serialized
      Deprecated
      Index
      Help

 PREV PACKAGE
 NEXT PACKAGE

  FRAMES
 NO FRAMES

Package org.apache.xerces.impl.xpath.regex

Class Summary

BMPattern
Boyer-Moore searcher.

Match
An instance of this class has ranges captured in matching.

RegularExpression
A regular expression matching engine using Non-deterministic Finite Automaton (NFA).

REUtil

INTERNAL:

Exception Summary

ParseException

INTERNAL:

      Overview
    Package
      Class
      Tree
      Serialized
      Deprecated
      Index
      Help

 PREV PACKAGE
 NEXT PACKAGE

  FRAMES
 NO FRAMES

Copyright © 1999-2010 The Apache Software Foundation. All Rights Reserved.


text:
define(function (require) {
  'use strict';

  var modules = require('modules');
  var _ = require('lodash');

  require('scripts/applications/services/application_environment_services');
  require('scripts/applications/services/environment_event_services');

  modules.get('a4c-applications').factory('applicationEnvironmentsManagerFactory', ['$translate', 'toaster', 'applicationEnvironmentServices', 'environmentEventServicesFactory',
    function($translate, toaster, applicationEnvironmentServices, environmentEventServicesFactory) {

      var ApplicationEnvironmentsManager = function (application, environments) {
        this.application = application;
        this.environments = _.undefined(environments) ? [] : environments;

        this.eventRegistrations = [];
        for (var i = 0; i < this.environments.length; i++) {
          var environment = this.environments[i];
          this.registerEventListener(environment);
        }
      };

      ApplicationEnvironmentsManager.prototype = {
        constructor: ApplicationEnvironmentsManager,

        add: function(environment) {
          this.environments.push(environment);
          this.registerEventListener(environment);
        },

        // replace the environment with the one given as a parameter.
        update: function(environment) {
          var envIndex = _.findIndex(this.environments, 'id', environment.id);
          if (envIndex !== -1) { // note registration does not change
            this.environments.splice(envIndex, 1, environment);
          }
        },

        get: function(environmentId) {
          return _.find(this.environments, 'id', environmentId);
        },

        remove: function(environmentId) {
          var envIndex = _.findIndex(this.environments, 'id', environmentId);
          if (envIndex !== -1) { // remove the environment
            // close event registration
            this.eventRegistrations[envIndex].close();
            this.eventRegistrations.splice(envIndex, 1);
            this.environments.splice(envIndex, 1);
          }
        },

        stopEvents: function() {
          _.each(this.eventRegistrations, function(eventRegistration){
            eventRegistration.close();
          });
        },

        //reload the environment given its id
        reload: function(environmentId, optionalCallback) {
          var self = this;
          applicationEnvironmentServices.get({
            applicationId: this.application.id,
            applicationEnvironmentId: environmentId
          }, function(result){
            self.update(result.data);
            if (_.defined(optionalCallback)) {
              optionalCallback(result.data);
            }
          });
        },

        registerEventListener: function(environment) {
          var registration = environmentEventServicesFactory(this.application.id, environment, this.onDeploymentStatusEvent.bind(this));
          this.eventRegistrations.push(registration);
        },

        displayDeploymentStatusToaster: function(environment) {
          if (environment.status === 'FAILURE') {
            toaster.pop(
              'error',
              $translate.instant('DEPLOYMENT.STATUS.FAILURE'),
              $translate.instant('DEPLOYMENT.TOASTER_STATUS.FAILURE', {
                envName : environment.name,
                appName : this.application.name
              }),
              6000, 'trustedHtml', null
            );
          } else if (environment.status === 'DEPLOYED') {
            toaster.pop(
              'success',
              $translate.instant('DEPLOYMENT.STATUS.DEPLOYED'),
              $translate.instant('DEPLOYMENT.TOASTER_STATUS.DEPLOYED', {
                envName : environment.name,
                appName : this.application.name
              }),
              4000, 'trustedHtml', null
            );
          }
        },

        onDeploymentStatusEvent: function(environment, event) {
          environment.status = event.deploymentStatus;
          this.displayDeploymentStatusToaster(environment);
          if(_.defined(this.onEnvironmentStateChangedCallback)) {
            // Allow the application.detail controller to update the angular scope.
            this.onEnvironmentStateChangedCallback(environment);
          }
        },
      };

      // The application environments manager factory load all environments and return an environments manager instance
      return function(application) {
        // The factory returns a promise
        return applicationEnvironmentServices.getAllEnvironments(application.id).then(function(environmentSearchRestResponse) {
          // Once the promise is resolved we return an instance of the ApplicationEnvironmentsManager.
          return new ApplicationEnvironmentsManager(application, environmentSearchRestResponse.data.data);
        });
      };
    }
  ]);
});


text:
/* Router config */
ASTool.Router.reopen({
	// TODO: use 'hash' here.
	location: 'hash',
});

/* Route Map */
ASTool.Router.map(function() {
	this.resource('projects', function() {
		this.resource('project', { path: ':project_id' }, function() {
			this.resource('spider', { path: ':spider_id' }, function() {
				this.resource('template', { path: ':template_id' }, function() {
					this.resource('items');
					this.resource('annotation', { path: ':annotation_id' });
				});
			});

		});
	});
});

ASTool.IndexRoute = Ember.Route.extend({
	activate: function() {
		this.transitionTo('projects');
	},
}),

ASTool.ProjectsIndexRoute = Ember.Route.extend({
	model: function() {
		return this.get('slyd').getProjectNames();
	},

	renderTemplate: function() {
		var controller = this.controllerFor('projects.index');
		this.render('toolbox-projects', {
      		controller: controller,
    	});

    	this.render('topbar-projects', {
    		into: 'application',
      		outlet: 'topbar',
      		controller: controller,
    	});
	},
});

ASTool.ProjectRoute = Ember.Route.extend({
	model: function(params) {
		this.set('slyd.project', params.project_id);
		return { id: params.project_id };
	},
});

ASTool.ProjectIndexRoute = Ember.Route.extend({
	model: function() {
		return this.get('slyd').getSpiderNames();
	},

	renderTemplate: function() {
		var controller = this.controllerFor('project.index');
		this.render('toolbox-project', {
      		controller: controller,
    	});

    	this.render('topbar-project', {
    		into: 'application',
      		outlet: 'topbar',
      		controller: controller,
    	});
	},

	serialize: function(model, params) {
		var controller = this.controllerFor('project');
		return { project_id: controller.get('name') };
	},
});

ASTool.SpiderRoute = Ember.Route.extend({
	model: function(params) {
		return this.get('slyd').loadSpider(params.spider_id);
	},
}),

ASTool.SpiderIndexRoute = Ember.Route.extend({
	model: function(params) {
		return this.modelFor('spider');
	},

	afterModel: function() {
		// Load the items.
		var controller = this.controllerFor('spider.index');
		return this.get('slyd').loadItems().then(function(items) {
			controller.set('itemDefinitions', items);
		});
	},

	renderTemplate: function() {
		var controller = this.controllerFor('spider.index');
		this.render('toolbox-spider', {
      		controller: controller,
    	});

    	this.render('topbar-browse', {
    		into: 'application',
      		outlet: 'topbar',
      		controller: controller,
    	});
	},
});

ASTool.TemplateRoute = Ember.Route.extend({
	model: function(params) {
		var spider = this.modelFor('spider');
		return spider.get('templates').findBy('id', params.template_id);
	},
});

ASTool.TemplateIndexRoute = Ember.Route.extend({

	model: function(params) {
		return this.modelFor('template');
	},

	afterModel: function(model) {
		var controller = this.controllerFor('template.index');
		var slyd = this.get('slyd');
		// Load the annotations if we can.
		if (controller.get('documentView').getIframe().length) {
			var annotationsPromise = new Ember.RSVP.Promise(function(resolve) {
				controller.get('documentView').displayDocument(
					model.get('annotated_body'),
					function(docIframe){
						ASTool.set('iframe', docIframe);
						resolve();
					}
				);
			}).then(function() {
				return this.get('annotationsStore').findAll();
			}.bind(this)).then(function(annotations) {
				controller.set('annotationsLoaded', true);
				controller.set('annotations', annotations);
			});
		} else {
			// If we fall here, the iframe was not yet inserted in the DOM
			// thus preventing loading the annotations. We just mark the
			// controller so it can fix the issue later.
			controller.set('annotationsLoaded', false);
		}

		// Load the items.
		var itemsPromise = slyd.loadItems().then(function(items) {
			controller.set('items', items);
		});
		// Load the extractors.
		var extractorsPromise = slyd.loadExtractors().then(function(extractors) {
			controller.set('extractors', extractors);
		});
		return Em.RSVP.all([annotationsPromise, itemsPromise, extractorsPromise])
	},

	renderTemplate: function() {
		var controller = this.controllerFor('template.index');
		this.render('toolbox-template', {
      		controller: controller,
    	});
    	this.render('topbar-extraction', {
    		into: 'application',
      		outlet: 'topbar',
      		controller: controller,
    	});
	},
});

ASTool.AnnotationRoute = Ember.Route.extend({

	model: function() {
		return null;
	},

	afterModel: function(model) {
		if (Em.isEmpty(model)) {
			this.transitionTo('template');
		}
	},

	renderTemplate: function() {
		var controller = this.controllerFor('annotation');
		this.render('toolbox-annotation', {
      		controller: controller,
    	});

    	this.render('topbar-extraction', {
    		into: 'application',
      		outlet: 'topbar',
      		controller: 'annotation',
    	});
	},
});

ASTool.ItemsRoute = Ember.Route.extend({
	model: function() {
		return this.get('slyd').loadItems();
	},

	renderTemplate: function() {
		this.render('toolbox-items', {
			into: 'application',
      		outlet: 'main',
      		controller: 'items',
    	});

    	this.render('topbar-extraction', {
    		into: 'application',
      		outlet: 'topbar',
      		controller: 'items',
    	});
	},
});


text:
<component name="libraryTable">
  <library name="SBT: org.apache.spark:spark-streaming-twitter_2.11:1.4.1:jar">
    <CLASSES>
      <root url="jar://$USER_HOME$/.ivy2/cache/org.apache.spark/spark-streaming-twitter_2.11/jars/spark-streaming-twitter_2.11-1.4.1.jar!/" />
    </CLASSES>
    <JAVADOC>
      <root url="jar://$USER_HOME$/.ivy2/cache/org.apache.spark/spark-streaming-twitter_2.11/docs/spark-streaming-twitter_2.11-1.4.1-javadoc.jar!/" />
    </JAVADOC>
    <SOURCES>
      <root url="jar://$USER_HOME$/.ivy2/cache/org.apache.spark/spark-streaming-twitter_2.11/srcs/spark-streaming-twitter_2.11-1.4.1-sources.jar!/" />
    </SOURCES>
  </library>
</component>