text:
package org.guvnor.ala.services.api;

import java.util.List;
import javax.validation.constraints.NotNull;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.DefaultValue;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;

import org.guvnor.ala.pipeline.Input;
import org.guvnor.ala.pipeline.PipelineConfig;
import org.guvnor.ala.runtime.providers.ProviderType;
import org.guvnor.ala.services.api.itemlist.PipelineConfigsList;
import org.guvnor.ala.services.exceptions.BusinessException;

import static javax.ws.rs.core.MediaType.APPLICATION_JSON;

/**
 * Pipeline Service interface. It allows us to create and run new Pipelines
 * URL: {app-context}/pipelines/
 */
@Path("pipelines")
public interface PipelineService {

    /**
     * Gets all the Pipeline Configurations registered in the service.
     * @return a PipelineConfigsList with the list of pipeline configurations.
     * @see PipelineConfigsList
     */
    @GET
    @Produces(value = APPLICATION_JSON)
    @Consumes(value = APPLICATION_JSON)
    PipelineConfigsList getPipelineConfigs(@QueryParam("page") @DefaultValue("0") Integer page,
                                           @QueryParam("pageSize") @DefaultValue("10") Integer pageSize,
                                           @QueryParam("sort") String sort,
                                           @QueryParam("sortOrder") @DefaultValue("true") boolean sortOrder)
            throws BusinessException;

    /**
     * Gets the Pipeline Configurations registered in the service and associated to the given provider type.
     * @param providerTypeName a provider type name registered in the system.
     * @param providerTypeVersion the provider type version corresponding to the provider type.
     * @return a PipelineConfigsList with the pipeline configurations associated with the provider type.
     * @see PipelineConfigsList
     */
    @GET
    @Path("providertype")
    @Produces(value = APPLICATION_JSON)
    @Consumes(value = APPLICATION_JSON)
    PipelineConfigsList getPipelineConfigs(@QueryParam("providerTypeName") String providerTypeName,
                                           @QueryParam("providerTypeVersion") String providerTypeVersion,
                                           @QueryParam("page") @DefaultValue("0") Integer page,
                                           @QueryParam("pageSize") @DefaultValue("10") Integer pageSize,
                                           @QueryParam("sort") String sort,
                                           @QueryParam("sortOrder") @DefaultValue("true") boolean sortOrder)
            throws BusinessException;

    /**
     * Gets the names of the Pipelines associated to the given provider type.
     * @param providerTypeName a provider type name registered in the system.
     * @param providerTypeVersion the provider type version corresponding to the provider type.
     * @return a list with the names of the Pipelines associated with the provider type.
     */
    @GET
    @Path("providertype/names")
    @Produces(value = APPLICATION_JSON)
    @Consumes(value = APPLICATION_JSON)
    List<String> getPipelineNames(@QueryParam("providerTypeName") String providerTypeName,
                                  @QueryParam("providerTypeVersion") String providerTypeVersion,
                                  @QueryParam("page") @DefaultValue("0") Integer page,
                                  @QueryParam("pageSize") @DefaultValue("10") Integer pageSize,
                                  @QueryParam("sort") String sort,
                                  @QueryParam("sortOrder") @DefaultValue("true") boolean sortOrder)
            throws BusinessException;

    /**
     * Registers a new Pipeline with the provided configuration.
     * @param config the pipeline configuration.
     * @return the pipeline id.
     * @see PipelineConfig
     */
    @POST
    @Consumes(value = APPLICATION_JSON)
    @Produces(value = APPLICATION_JSON)
    String newPipeline(@NotNull PipelineConfig config) throws BusinessException;

    /**
     * Registers a new Pipeline with the provided configuration and associates it with the given provider type.
     * @param config the pipeline configuration.
     * @param providerType A provider type for associating the pipeline.
     * @return String with the pipeline id
     * @see PipelineConfig
     */
    @POST
    @Path("providertype")
    @Consumes(value = APPLICATION_JSON)
    @Produces(value = APPLICATION_JSON)
    String newPipeline(@NotNull PipelineConfig config,
                       @NotNull ProviderType providerType) throws BusinessException;

    /**
     * Run/Execute a registered Pipeline.
     * @param pipelineId of the pipeline to be executed.
     * @param input Input values to be used for the pipeline execution.
     * @param async establishes the execution mode. true for asynchronous execution, false for synchronous execution.
     * @return the pipeline execution id.
     */
    @POST
    @Consumes(value = APPLICATION_JSON)
    @Produces(value = APPLICATION_JSON)
    @Path("execution/{pipelineId}/run")
    String runPipeline(@PathParam("pipelineId") String pipelineId,
                       @NotNull Input input,
                       @NotNull boolean async) throws BusinessException;

    /**
     * Stops a running pipeline execution.
     * @param executionId A pipeline execution id to stop. The pipeline execution id is typically returned by
     * the runPipeline method.
     * @throws BusinessException
     */
    @PUT
    @Path("execution/{executionId}/stop")
    void stopPipelineExecution(@PathParam("executionId") String executionId) throws BusinessException;

    /**
     * Deletes a pipeline execution
     * @param executionId A pipeline execution id to delete. The pipeline execution id is typically returned by
     * the runPipeline method.
     * @throws BusinessException
     */
    @DELETE
    @Path("execution/{executionId}")
    void deletePipelineExecution(@PathParam("executionId") String executionId) throws BusinessException;
}


text:
<topbar></topbar>
<category-bar></category-bar>

{{ product.name }}

Price {{ product.price | currency:USD:'1.2-2'}}

In Stock: {{ product.in_stock }}

					Quantity

						<input type="text"
							class="form-control quant"
							type="number"
							id="inlineFormInputGroup"
							placeholder="1"
							[(ngModel)]="quantity"
							#quant="ngModel"
							[range]="[1, product?.in_stock]">

Wrong number of pieces.

						<button class="btn btn-primary" (click)="addToCart()" [disabled]="quant.errors"> Add to Cart</button>

{{ product.description }}

Reviews

						Rating: {{ rev.rating }} | {{ rev.timestamp*1000 | date }} | {{ rev.customer.username }}

{{ rev.content }}

You must be logged in to review a product | Login

					<form (ngSubmit)="addReview()">
						<textarea class="form-control" placeholder="Write a review..." [(ngModel)]="newReview.content" name="review">
						</textarea>

						Rate the product *
						<select [(ngModel)]="newReview.rating" name="rating" #frate="ngModel" required="true" class="custom-select">
							<option value="1">1 - worst</option>
							<option value="2">2</option>
							<option value="3">3</option>
							<option value="4">4</option>
							<option value="5">5 - best</option>
						</select>

You must rate the product

						<button class="btn btn-primary" [disabled]="frate?.errors || message" type="submit">Add review</button>

					</form>

	<ng-template #admin_edit>

Product edit

				Name

					<inline-editor type="text" [(ngModel)]="product.name" name="name" (onSave)="update($event)"></inline-editor>

				Price

					<inline-editor type="number" [(ngModel)]="product.price" name="price" (onSave)="update($event)"></inline-editor>

				Image

					<inline-editor type="text" [(ngModel)]="product.image" name="image" (onSave)="update($event)"></inline-editor>

				Stock

					<inline-editor type="text" [(ngModel)]="product.in_stock" name="stock" (onSave)="update($event)"></inline-editor>

				Description

					<inline-editor type="text" [(ngModel)]="product.description" name="description" (onSave)="update($event)"></inline-editor>

		<button class="btn btn-primary" (click)="remove()">
			Unhide
			Hide
		</button>
	</ng-template>
	{{ message?.message }}

{{ message?.message }}

redpajama_set_name: RedPajamaGithub


text:
package gui;

import java.awt.Dimension;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.IOException;
import java.sql.SQLException;

import javax.swing.JButton;
import javax.swing.JOptionPane;
import javax.swing.JPanel;

import database.Database;

/**
 * Componente di PannelloGestisciRelazioni che permette l'aggiunta di nuove relazioni e l'eliminazione di quelle già esistenti.
 * @see PannelloGestisciRelazioni
 */
@SuppressWarnings("serial")
public class FormGestisciRelazioni extends JPanel implements ActionListener {

	private CampoCredenziale idPersonale;
	private CampoCredenziale idStrumentazione;
	private final int ALTEZZA_CAMPI = 40;
	private Visualizzatore v;
	private final String regexQualsiasiNumero = "\\d+";
	private final int righeRadioButtons = 1;

	/**
	 * Crea il form e inizializza tutte le sue componenti.
	 * @param v La tabella relazioni su cui visualizzare i dati esistenti.
	 */
	public FormGestisciRelazioni(Visualizzatore v) {

		super();

		this.v = v;

		final int tipiElementi = 3;
		setLayout(new GridLayout(righeRadioButtons, tipiElementi));

		final int sizeFontCampi = 16;
		Font fontCampi = new Font("Arial", Font.PLAIN, sizeFontCampi);

		idPersonale = new CampoCredenziale("ID Personale");
		idPersonale.setPreferredSize(new Dimension(0, ALTEZZA_CAMPI));
		idStrumentazione = new CampoCredenziale("ID Strumentazione");

		idPersonale.setFont(fontCampi);
		idStrumentazione.setFont(fontCampi);

		JButton cmdAggiungi = new JButton("Aggiungi");
		cmdAggiungi.setActionCommand("Aggiungi");
		cmdAggiungi.addActionListener(this);

		JButton cmdElimina = new JButton("Elimina");
		cmdElimina.setActionCommand("Elimina");
		cmdElimina.addActionListener(this);

		add(idPersonale);
		add(idStrumentazione);
		add(cmdAggiungi);
		add(cmdElimina);
	}

	@Override
	public void actionPerformed(ActionEvent e) {

		if (e.getActionCommand().equals("Aggiungi")) {

			int risposta = JOptionPane.showConfirmDialog(null, "Sicuro?", "Conferma", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE);
			if (!(risposta == JOptionPane.CLOSED_OPTION || risposta == JOptionPane.NO_OPTION)) {

				String idPersonale = FormGestisciRelazioni.this.idPersonale.get();
				String idStrumentazione = FormGestisciRelazioni.this.idStrumentazione.get();

				aggiungiRelazione(idPersonale, idStrumentazione);
			}
		}
		else if (e.getActionCommand().equals("Elimina")) {

			int risposta = JOptionPane.showConfirmDialog(null, "Sicuro?", "Conferma", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE);
			if (!(risposta == JOptionPane.CLOSED_OPTION || risposta == JOptionPane.NO_OPTION)) {

				String idPersonale = FormGestisciRelazioni.this.idPersonale.get();
				String idStrumentazione = FormGestisciRelazioni.this.idStrumentazione.get();

				eliminaRelazione(idPersonale, idStrumentazione);
			}
		}
	}

	private void aggiungiRelazione(String idPers, String idStru) {

		boolean inputValido = true;
		inputValido &= idPers.matches(regexQualsiasiNumero);
		inputValido &= idStru.matches(regexQualsiasiNumero);
		if (inputValido) {
			try {
				Database dbElementi = new Database();
				String queryInserisci = "INSERT INTO Utilizzo (idPersonale, idStrumentazione) VALUES (" + idPers + ", " + idStru + ")";
				dbElementi.eseguiQuery(queryInserisci);
			} catch (ClassNotFoundException | SQLException | IOException e1) {
				try {
					throw new InputInvalidoException(null);
				} catch (InputInvalidoException e2) {;}
			}
		}

		try {
			v.caricaPannelloDati();
		} catch (ClassNotFoundException | IOException e1) {;}
	}

	private void eliminaRelazione(String idPers, String idStru) {

		boolean inputValido = true;
		inputValido &= idPers.matches(regexQualsiasiNumero);
		inputValido &= idStru.matches(regexQualsiasiNumero);
		if (inputValido) {
			try {
				Database dbElementi = new Database();
				String queryElimina = "DELETE FROM Utilizzo WHERE idPersonale = " + idPers + " AND idStrumentazione = " + idStru;
				dbElementi.eseguiQuery(queryElimina);
			} catch (ClassNotFoundException | SQLException | IOException e1) {;}
		}

		try {
			v.caricaPannelloDati();
		} catch (ClassNotFoundException | IOException e1) {;}
	}
}


text:
<!DOCTYPE html>

    <base href="<?php echo base_url() ?>">
    <title><?php echo $template['title']; ?></title>
    <meta http-equiv="content-type" content="text/html;charset=UTF-8" />
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <meta content="" name="description" />
    <meta content="" name="author" />

    <link href="themes/admin/assets/plugins/pace/pace-theme-flash.css" rel="stylesheet" type="text/css" media="screen" />
    <link href="themes/admin/assets/plugins/bootstrapv3/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
    <link href="themes/admin/assets/plugins/bootstrapv3/css/bootstrap-theme.min.css" rel="stylesheet" type="text/css" />
    <link href="themes/admin/assets/plugins/font-awesome/css/font-awesome.css" rel="stylesheet" type="text/css" />
    <link href="themes/admin/assets/plugins/dropzone/css/dropzone.css" rel="stylesheet" type="text/css"/>
    <link href="themes/admin/assets/plugins/animate.min.css" rel="stylesheet" type="text/css" />
    <link href="themes/admin/assets/plugins/jquery-scrollbar/jquery.scrollbar.css" rel="stylesheet" type="text/css" />
    <link href="themes/admin/assets/plugins/bootstrap-select2/select2.css" rel="stylesheet" type="text/css">
    <link href="themes/admin/assets/plugins/bootstrap-tag/bootstrap-tagsinput.min.css" rel="stylesheet" type="text/css">
    <link href="themes/admin/assets/plugins/jquery-datatable/css/jquery.dataTables.css" rel="stylesheet" type="text/css">
    <link href="themes/admin/assets/plugins/datatables-responsive/css/datatables.responsive.css" rel="stylesheet" type="text/css" media="screen">
    <link href="themes/admin/assets/plugins/bootstrap-datepicker/css/datepicker.css" rel="stylesheet" type="text/css">
    <link href="themes/admin/assets/plugins/bootstrap-timepicker/css/bootstrap-timepicker.css" rel="stylesheet" type="text/css">
    <link href="themes/admin/assets/plugins/boostrap-clockpicker/bootstrap-clockpicker.min.css" rel="stylesheet" type="text/css" media="screen"/>

    <link href="themes/admin/assets/webarch/css/webarch.css" rel="stylesheet" type="text/css" />

    <?php include 'navigation.php'?>

    Scroll<?php ?>

                %

            <?php echo $template['body']; ?>

<?php echo $template['metadata']; ?>


text:
package seedu.address.model;

import static org.junit.Assert.assertEquals;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;

import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;

import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import seedu.address.testutil.TypicalTestTasks;
import seedu.task.model.ReadOnlyTaskManager;
import seedu.task.model.TaskManager;
import seedu.task.model.tag.Tag;
import seedu.task.model.task.ReadOnlyTask;
import seedu.task.model.task.Task;

public class TaskManagerTest {

    @Rule
    public ExpectedException thrown = ExpectedException.none();

    private final TaskManager taskManager = new TaskManager();

    @Test
    public void constructor() {
        assertEquals(Collections.emptyList(), taskManager.getTaskList());
        assertEquals(Collections.emptyList(), taskManager.getTagList());
    }

    @Test
    public void resetData_null_throwsAssertionError() {
        thrown.expect(AssertionError.class);
        taskManager.resetData(null);
    }

    @Test
    public void resetData_withValidReadOnlyTaskManager_replacesData() {
        TaskManager newData = new TypicalTestTasks().getTypicalTaskManger();
        taskManager.resetData(newData);
        assertEquals(newData, taskManager);
    }

    @Test
    public void resetData_withDuplicatePersons_throwsAssertionError() {
        TypicalTestTasks td = new TypicalTestTasks();
        // Repeat td.alice twice
        List<Task> newTasks = Arrays.asList(new Task(td.task11), new Task(td.task11));
        List<Task> completedTasks = Arrays.asList(new Task(td.task33));
        List<Tag> newTags = td.task11.getTags().asObservableList();
        TaskManagerStub newData = new TaskManagerStub(newTasks, completedTasks, newTags);

        thrown.expect(AssertionError.class);
        taskManager.resetData(newData);
    }

    @Test
    public void resetData_withDuplicateTags_throwsAssertionError() {
        TaskManager typicalAddressBook = new TypicalTestTasks().getTypicalTaskManger();
        List<ReadOnlyTask> newTasks = typicalAddressBook.getTaskList();
        List<ReadOnlyTask> completedTasks = typicalAddressBook.getCompletedTaskList();
        List<Tag> newTags = new ArrayList<>(typicalAddressBook.getTagList());
        // Repeat the first tag twice
        newTags.add(newTags.get(0));
        TaskManagerStub newData = new TaskManagerStub(newTasks, completedTasks, newTags);

        thrown.expect(AssertionError.class);
        taskManager.resetData(newData);
    }

    /**
     * A stub ReadOnlyTaskManager whose tasks and tags lists can violate interface constraints.
     */
    private static class TaskManagerStub implements ReadOnlyTaskManager {
        private final ObservableList<ReadOnlyTask> tasks = FXCollections.observableArrayList();
        private final ObservableList<ReadOnlyTask> completedTasks = FXCollections.observableArrayList();
        private final ObservableList<ReadOnlyTask> overdueTasks = FXCollections.observableArrayList();
        private final ObservableList<Tag> tags = FXCollections.observableArrayList();

        TaskManagerStub(Collection<? extends ReadOnlyTask> tasks,
                Collection<? extends ReadOnlyTask> completedTasks, Collection<? extends Tag> tags) {
            this.tasks.setAll(tasks);
            this.tags.setAll(tags);
            this.completedTasks.setAll(completedTasks);
        }

        @Override
        public ObservableList<ReadOnlyTask> getTaskList() {
            return tasks;
        }

        @Override
        public ObservableList<Tag> getTagList() {
            return tags;
        }

        @Override
        public ObservableList<ReadOnlyTask> getCompletedTaskList() {
            return completedTasks;
        }

        @Override
        public ObservableList<ReadOnlyTask> getOverdueTaskList() {
            return overdueTasks;
        }
    }

}


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.15"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Ray Tracer Common Project: Class Members - Functions</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>

<link href="search/search.css" rel="stylesheet" type="text/css"/>

<link href="doxygen.css" rel="stylesheet" type="text/css" />

Ray Tracer Common Project

Image rendering program based on the ray tracing technique.

- d -

date()
: rt::hit

defaultMaterial()
: rt::Material

determinant()
: rt::matrix

diffuse()
: rt::DayNightMaterial
, rt::Material
, rt::TexturedMaterial

direction()
: rt::euclidian

distance()
: rt::Light
, rt::OmniLight
, rt::vector

draw_line()
: rt::image

draw_rect()
: rt::image

<address class="footer">
Generated on Fri Jan 26 2018 17:51:59 for Ray Tracer Common Project by

 1.8.15
</address>


text:
Node.js (v8.2.1) API for [RaspiSMS](https://github.com/RaspbianFrance/RaspiSMS/) application

## Details
This API contains:

- [ExpressJS](https://github.com/expressjs/express), for your web server.
- Logs to trace HTTP requests and Node.js messages with [Morgan](https://github.com/expressjs/morgan) and [Log4JS](https://github.com/nomiddlename/log4js-node).
- Units tests with [Mocha](https://github.com/mochajs/mocha), [Chai](https://github.com/chaijs/chai), [Supertest](https://github.com/visionmedia/supertest) and [Istanbul](https://github.com/gotwarlost/istanbul).
- [Gulp](https://github.com/gulpjs/gulp), awesome to build your production package.
- [Yarn](https://github.com/yarnpkg/yarn), instead of NPM, to manage dependencies.
- [ESLint](https://github.com/eslint/eslint), to standardize source code.
- [apiDoc](https://github.com/apidoc/apidoc ), to generate documentation for API.
- [documentation](https://github.com/documentationjs/documentation), to generate developer documentation.

## Prerequisites
- Node.js v8.2.1
- Yarn: `npm i -g yarn`

## Development install
Install dependencies with `yarn` command.

Run the server with `npm run dev` command.

### Recommendations
Use ESLint plugin for your code editor to lint easely your code:

- [Atom](https://github.com/AtomLinter/linter-eslint)
- [WebStorm](https://plugins.jetbrains.com/plugin/7494-eslint)
- [SublimeText](https://github.com/roadhump/SublimeLinter-eslint)


text:
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Web;
using Microsoft.Crm.UnifiedServiceDesk.Dynamics;
using Microsoft.Uii.Common;
using Microsoft.Uii.Csr;
using Microsoft.Uii.Desktop.Cti.Core;
using Microsoft.USD.ComponentLibrary.Adapters;

namespace Microsoft.USD.ComponentLibrary
{
    /// <summary>
    /// Example URL to trigger stuff
    /// http://localhost:5000/?eventname=TestEvent&askresponse=true
    /// </summary>
	public class ExternalListener : DynamicsBaseHostedControl
	{
		/// <summary>
		/// The CRM listener
		/// </summary>
        private HttpListener crmListener;

		/// <summary>
		/// The CRM request worker
		/// </summary>
        private Thread crmRequestWorker;

		/// <summary>
		/// The response timeout
		/// </summary>
		private TimeSpan responseTimeout = TimeSpan.FromSeconds(60);

        public ExternalListener()
        {
        }

		/// <summary>
		/// Initializes a new instance of the <see cref="Listener"/> class.
		/// </summary>
		/// <param name="appID">The application identifier.</param>
		/// <param name="appName">Name of the application.</param>
		/// <param name="initString">The initialize string.</param>
        public ExternalListener(Guid appID, string appName, string initString)
				: base (appID, appName, initString)
        {
        }

		/// <summary>
		/// Initializes this Listener.
		/// </summary>
        public override void Initialize()
        {
            base.Initialize();
        }

		protected override void DoAction(RequestActionEventArgs args)
		{
            if (args.Action.Equals("startlistener", StringComparison.OrdinalIgnoreCase))
            {
				this.crmListener = new HttpListener();

				// set default prefix
				string listenerUrl = "http://localhost:5000/";

				// grab prefix from options
				string prefixOption = ConfigurationValueReader.ConfigurationReader().ReadAppSettings("ListenerPrefix");

				// grab prefix from start action
				List<KeyValuePair<string, string>> parameters = Utility.SplitLines(args.Data, CurrentContext, localSession);
				string prefixParameter = Utility.GetAndRemoveParameter(parameters, "prefix");

				// set prefix by order of precidence: Action parameter, CCD Option, default
				if (!string.IsNullOrEmpty(prefixOption))
					listenerUrl = prefixOption;
				if (!string.IsNullOrEmpty(prefixParameter))
					listenerUrl = prefixParameter;

				// Start the listener...
				try
				{
					this.crmListener.Prefixes.Add(listenerUrl);
					this.crmListener.Start();
					this.crmRequestWorker = new Thread(new ParameterizedThreadStart(this.RequestWorker))
					{
						IsBackground = true
					};
					this.crmRequestWorker.Start();
				}
				catch
				{
				}
            }
            else if (args.Action.Equals("settimeout", StringComparison.OrdinalIgnoreCase))
            {
				// grab timeout from start action
				List<KeyValuePair<string, string>> parameterstimeout = Utility.SplitLines(args.Data, CurrentContext, localSession);
				string sTimeout = Utility.GetAndRemoveParameter(parameterstimeout, "timeout");

				// Set timeout
                if (!string.IsNullOrEmpty(sTimeout))
				{
					double outvar;
					if (double.TryParse(sTimeout, out outvar))
						this.responseTimeout = TimeSpan.FromSeconds(System.Math.Abs(outvar));
				}
				else
				{
					double outvar;
                    // grab timeout from options
                    string timeoutOption = ConfigurationValueReader.ConfigurationReader().ReadAppSettings("ListenerTimeout");

                    if (double.TryParse(timeoutOption, out outvar))
						this.responseTimeout = TimeSpan.FromSeconds(System.Math.Abs(outvar));
				}

            }
            else if (args.Action.Equals("sendmessage", StringComparison.OrdinalIgnoreCase))
            {
                // Grab url from data
				List<KeyValuePair<string, string>> smparameters = Utility.SplitLines(args.Data, CurrentContext, localSession);
				string url = Utility.GetAndRemoveParameter(smparameters, "url");

				// Make request and store return
				var webReq = new MCSWebRequest();
				args.ActionReturnValue = webReq.GetStringResponse(url);
            }
            else if (args.Action.Equals("SetData", StringComparison.OrdinalIgnoreCase))
            {
                // Grab url from data
                List<KeyValuePair<string, string>> smparameters = Utility.SplitLines(args.Data, CurrentContext, localSession);
                string eventname = Utility.GetAndRemoveParameter(smparameters, "eventname");
                string data = Utility.GetAndRemoveParameter(smparameters, "data");
                if (eventDataReturn.ContainsKey(eventname))
                {
                    SendResponse(eventDataReturn[eventname].httpContext, data);
                    eventDataReturn[eventname].Dispose();
                }
            }
			base.DoAction(args);
		}

        static Dictionary<string, HttpReturnContext> eventDataReturn = new Dictionary<string, HttpReturnContext>();
        class HttpReturnContext : IDisposable
        {
            public HttpListenerContext httpContext;
            private Timer timeout;
            private string eventName;

            public HttpReturnContext(string eventName, HttpListenerContext httpContext, TimeSpan responseTimeout)
            {
                this.eventName = eventName;
                this.httpContext = httpContext;
                timeout = new Timer(new TimerCallback(Timeout), null, responseTimeout, TimeSpan.Zero);
            }

            private void Timeout(object obj)
            {
                Dispose();
                SendResponse(httpContext, "");
            }

            public void Dispose()
            {
                if (timeout != null)
                    timeout.Dispose();
                lock (eventDataReturn)
                {
                    if (eventDataReturn.ContainsKey(eventName))
                        eventDataReturn.Remove(eventName);
                }
            }
        }

		/// <summary>
		/// The Worker Thread.
		/// </summary>
		/// <param name="obj">The object.</param>
        private void RequestWorker(object obj)
        {
            while (true)
            {
                // Get request data
				HttpListenerContext httpContext = this.crmListener.GetContext();
                string rawdata = "";
                using (StreamReader sr = new StreamReader(httpContext.Request.InputStream))
                {
                    rawdata = sr.ReadToEnd();
                }

				// Get Query parameters
				Dictionary<string, string> qParams = new Dictionary<string,string>();
				List<LookupRequestItem> itemsList = new List<LookupRequestItem>();
				NameValueCollection nvpQuery = HttpUtility.ParseQueryString(rawdata);
				nvpQuery.Add(httpContext.Request.QueryString);
				foreach (string s in nvpQuery.Keys)
				{
					qParams.Add(s, nvpQuery[s]);
					itemsList.Add(new LookupRequestItem(s, nvpQuery[s]));
				}

				// Process the request
                try
                {
					if (qParams["eventname"] != null || qParams["eventname"] != "")
					{
						switch(qParams["eventname"])
						{
							case "ScreenPop":
                                Dispatcher.Invoke(() =>
                                    {
                                        CtiLookupRequest data = new CtiLookupRequest(Guid.NewGuid(), base.ApplicationName, qParams["calltype"], qParams["ani"], qParams["dnis"]);
                                        data.Items.AddRange(itemsList);
                                        base.FireRequestAction(new RequestActionEventArgs("*", CtiLookupRequest.CTILOOKUPACTIONNAME, GeneralFunctions.Serialize<CtiLookupRequest>(data)));
                                        SendResponse(httpContext, "");
                                    }
                                );
								continue;

							default:
                                if (qParams.ContainsKey("askresponse") && qParams["askresponse"].ToLower() == "true")
								{
                                    lock (eventDataReturn)
                                    {
                                        eventDataReturn.Add(qParams["eventname"], new HttpReturnContext(qParams["eventname"], httpContext, responseTimeout));
                                    }
                                    Dispatcher.Invoke(() =>
                                    {
                                        base.FireEvent(qParams["eventname"], qParams);
                                    });
                                    continue;
								}
                                Dispatcher.Invoke(() =>
                                {
                                    base.FireEvent(qParams["eventname"], qParams);
                                });
								break;
						}
					}
                }
                catch
                {
					// TODO: implement error logging
                }
                SendResponse(httpContext, "");
            }
        }

		/// <summary>
		/// Sends the response.
		/// </summary>
		/// <param name="httpContext">The HTTP context.</param>
		/// <param name="response">The response.</param>
		private static void SendResponse(HttpListenerContext httpContext, string response)
		{
			try
			{
				using (StreamWriter sw = new StreamWriter(httpContext.Response.OutputStream))
				{
					httpContext.Response.AddHeader("cache-control", "no-cache");
					httpContext.Response.AddHeader("pragma", "no-cache");
					httpContext.Response.AddHeader("expires", "0");
					httpContext.Response.AddHeader("expiresabsolute", "-1");
                    sw.WriteLine(HttpUtility.HtmlEncode(response));
					sw.Close();
				}
			}
			catch
			{
			}
		}
	}
}


text:
Command-line Tool (Deamon) Template
=====================

A Xcode template that builds a dynamic library but don't require mobile substrate.

1. Download or clone the repository
2. Move the folder `Command-line Tool (Deamon).xctemplate` in the repository into the

		/opt/iOSOpenDev/templates
3. In Xcode, check that installation was successful by creating a New Project (⌘⇧N), and checking for the iOSOpenDev section under iOS.

## Uninstallation
just delete it from your device.

## Screenshot
![image](https://raw.githubusercontent.com/BlueCocoa/Command-line-Tool--Deamon--Template/master/1.png)

![image](https://raw.githubusercontent.com/BlueCocoa/Command-line-Tool--Deamon--Template/master/2.png)

## License

Command-line Tool (Deamon) Template is available under the MIT license. See the LICENSE file for more info.


text:
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Xml;
using System.Xml.Linq;
using System.Xml.Schema;
using System.Xml.Serialization;
using MathNet.Numerics.LinearAlgebra;
using MathNet.Spatial.Units;

namespace MathNet.Spatial
{
    [Serializable]
    public struct Vector2D : IXmlSerializable, IEquatable<Vector2D>, IFormattable
    {
        /// <summary>
        /// Using public fields cos: http://blogs.msdn.com/b/ricom/archive/2006/08/31/performance-quiz-11-ten-questions-on-value-based-programming.aspx
        /// </summary>
        public readonly double X;

        /// <summary>
        /// Using public fields cos: http://blogs.msdn.com/b/ricom/archive/2006/08/31/performance-quiz-11-ten-questions-on-value-based-programming.aspx
        /// </summary>
        public readonly double Y;

        static readonly Vector2D CachedXAxis = new Vector2D(1, 0);
        static readonly Vector2D CachedYAxis = new Vector2D(0, 1);

        public Vector2D(double x, double y)
        {
            this.X = x;
            this.Y = y;
        }

        /// <summary>
        /// Creates a vector with length r rotated a counterclockwise from X-Axis
        /// </summary>
        /// <param name="r">The radius</param>
        /// <param name="a">The angle</param>
        public Vector2D(double r, Angle a)
            : this(r*Math.Cos(a.Radians), r*Math.Sin(a.Radians))
        {
            if (r < 0)
            {
                throw new ArgumentException("r < 0", "r");
            }
        }

        public Vector2D(IEnumerable<double> data)
            : this(data.ToArray())
        {
        }

        public Vector2D(double[] data)
            : this(data[0], data[1])
        {
            if (data.Length != 2)
            {
                throw new ArgumentException("data.Length != 2!");
            }
        }

        public static Vector2D XAxis
        {
            get { return CachedXAxis; }
        }

        public static Vector2D YAxis
        {
            get { return CachedYAxis; }
        }

        public static Vector2D Parse(string value)
        {
            var doubles = Parser.ParseItem2D(value);
            return new Vector2D(doubles);
        }

        public static Vector2D ReadFrom(XmlReader reader)
        {
            var v = new Vector2D();
            v.ReadXml(reader);
            return v;
        }

        public static bool operator ==(Vector2D left, Vector2D right)
        {
            return left.Equals(right);
        }

        public static bool operator !=(Vector2D left, Vector2D right)
        {
            return !left.Equals(right);
        }

        public static Vector2D operator +(Vector2D v1, Vector2D v2)
        {
            return v1.Add(v2);
        }

        public static Vector2D operator -(Vector2D v1, Vector2D v2)
        {
            return v1.Subtract(v2);
        }

        public static Vector2D operator -(Vector2D v)
        {
            return v.Negate();
        }

        public static Vector2D operator *(double d, Vector2D v)
        {
            return new Vector2D(d*v.X, d*v.Y);
        }

        public static Vector2D operator /(Vector2D v, double d)
        {
            return new Vector2D(v.X/d, v.Y/d);
        }

        public Vector2D TransformBy(Matrix<double> m)
        {
            var transformed = m.Multiply(this.ToVector());
            return new Vector2D(transformed);
        }

        public override string ToString()
        {
            return this.ToString(null, CultureInfo.InvariantCulture);
        }

        public string ToString(IFormatProvider provider)
        {
            return this.ToString(null, provider);
        }

        public string ToString(string format, IFormatProvider provider = null)
        {
            var numberFormatInfo = provider != null ? NumberFormatInfo.GetInstance(provider) : CultureInfo.InvariantCulture.NumberFormat;
            string separator = numberFormatInfo.NumberDecimalSeparator == "," ? ";" : ",";
            return string.Format("({0}{1} {2})", this.X.ToString(format, numberFormatInfo), separator, this.Y.ToString(format, numberFormatInfo));
        }

        public bool Equals(Vector2D other)
        {
            // ReSharper disable CompareOfFloatsByEqualityOperator
            return this.X == other.X && this.Y == other.Y;
            // ReSharper restore CompareOfFloatsByEqualityOperator
        }

        public bool Equals(Vector2D other, double tolerance)
        {
            if (tolerance < 0)
            {
                throw new ArgumentException("epsilon < 0");
            }

            return Math.Abs(other.X - this.X) < tolerance &&
                   Math.Abs(other.Y - this.Y) < tolerance;
        }

        public override bool Equals(object obj)
        {
            if (ReferenceEquals(null, obj))
            {
                return false;
            }

            return obj is Vector2D && this.Equals((Vector2D)obj);
        }

        public override int GetHashCode()
        {
            unchecked
            {
                return (this.X.GetHashCode()*397) ^ this.Y.GetHashCode();
            }
        }

        /// <summary>
        /// This method is reserved and should not be used. When implementing the IXmlSerializable interface, you should return null (Nothing in Visual Basic) from this method, and instead, if specifying a custom schema is required, apply the <see cref="T:System.Xml.Serialization.XmlSchemaProviderAttribute"/> to the class.
        /// </summary>
        /// <returns>
        /// An <see cref="T:System.Xml.Schema.XmlSchema"/> that describes the XML representation of the object that is produced by the <see cref="M:System.Xml.Serialization.IXmlSerializable.WriteXml(System.Xml.XmlWriter)"/> method and consumed by the <see cref="M:System.Xml.Serialization.IXmlSerializable.ReadXml(System.Xml.XmlReader)"/> method.
        /// </returns>
        public XmlSchema GetSchema()
        {
            return null;
        }

        /// <summary>
        /// Generates an object from its XML representation.
        /// Handles both attribute and element style
        /// </summary>
        /// <param name="reader">The <see cref="T:System.Xml.XmlReader"/> stream from which the object is deserialized. </param>
        public void ReadXml(XmlReader reader)
        {
            reader.MoveToContent();
            var e = (XElement)XNode.ReadFrom(reader);

            // Hacking set readonly fields here, can't think of a cleaner workaround
            XmlExt.SetReadonlyField(ref this, x => x.X, XmlConvert.ToDouble(e.ReadAttributeOrElementOrDefault("X")));
            XmlExt.SetReadonlyField(ref this, x => x.Y, XmlConvert.ToDouble(e.ReadAttributeOrElementOrDefault("Y")));
        }

        /// <summary>
        /// Converts an object into its XML representation.
        /// </summary>
        /// <param name="writer">The <see cref="T:System.Xml.XmlWriter"/> stream to which the object is serialized. </param>
        public void WriteXml(XmlWriter writer)
        {
            writer.WriteAttribute("X", this.X);
            writer.WriteAttribute("Y", this.Y);
        }

        public bool IsParallelTo(Vector2D othervector, double tolerance = 1.40129846432482E-45)
        {
            var @this = this.Normalize();
            var other = othervector.Normalize();
            var dp = Math.Abs(@this.DotProduct(other));
            return Math.Abs(1 - dp) < tolerance;
        }

        public bool IsPerpendicularTo(Vector2D othervector, double tolerance = 1.40129846432482E-45)
        {
            var @this = this.Normalize();
            var other = othervector.Normalize();
            return Math.Abs(@this.DotProduct(other)) < tolerance;
        }

        /// <summary>
        ///
        /// </summary>
        /// <param name="v2"></param>
        /// <param name="clockWise">Positive in clockwisedirection</param>
        /// <param name="returnNegative">If angle is > 180° a negative value is returned</param>
        /// <returns></returns>
        public Angle SignedAngleTo(Vector2D v2, bool clockWise, bool returnNegative = false)
        {
            int sign = clockWise ? -1 : 1;
            double a1 = Math.Atan2(this.Y, this.X);
            if (a1 < 0)
            {
                a1 += 2*Math.PI;
            }

            double a2 = Math.Atan2(v2.Y, v2.X);
            if (a2 < 0)
            {
                a2 += 2*Math.PI;
            }

            double a = sign*(a2 - a1);
            if (a < 0 && !returnNegative)
            {
                a += 2*Math.PI;
            }

            if (a > Math.PI && returnNegative)
            {
                a -= 2*Math.PI;
            }

            return new Angle(a, AngleUnit.Radians);
        }

        public Angle AngleTo(Vector2D toVector2D)
        {
            var @this = this.Normalize();
            var other = toVector2D.Normalize();
            return new Angle(Math.Acos(@this.DotProduct(other)), AngleUnit.Radians);
        }

        public Vector2D Rotate<T>(double angle, T angleUnit) where T : IAngleUnit
        {
            return this.Rotate(Angle.From(angle, angleUnit));
        }

        public Vector2D Rotate(Angle angle)
        {
            var cs = Math.Cos(angle.Radians);
            var sn = Math.Sin(angle.Radians);
            var x = (this.X*cs) - (this.Y*sn);
            var y = (this.X*sn) + (this.Y*cs);
            return new Vector2D(x, y);
        }

        public double Length
        {
            get { return Math.Sqrt((this.X*this.X) + (this.Y*this.Y)); }
        }

        public double DotProduct(Vector2D other)
        {
            return (this.X*other.X) + (this.Y*other.Y);
        }

        public Vector2D Normalize()
        {
            var l = this.Length;
            return new Vector2D(this.X/l, this.Y/l);
        }

        public Vector2D ScaleBy(double d)
        {
            return new Vector2D(d*this.X, d*this.Y);
        }

        public Vector2D Negate()
        {
            return new Vector2D(-1*this.X, -1*this.Y);
        }

        public Vector2D Subtract(Vector2D v)
        {
            return new Vector2D(this.X - v.X, this.Y - v.Y);
        }

        public Vector2D Add(Vector2D v)
        {
            return new Vector2D(this.X + v.X, this.Y + v.Y);
        }

        /// <summary>
        /// Create a new Vector2D from a Math.NET Numerics vector of length 2.
        /// </summary>
        public static Vector2D OfVector(Vector<double> vector)
        {
            if (vector.Count != 2)
            {
                throw new ArgumentException("The vector length must be 2 in order to convert it to a Vector2D");
            }

            return new Vector2D(vector.At(0), vector.At(1));
        }

        /// <summary>
        /// Convert to a Math.NET Numerics dense vector of length 2.
        /// </summary>
        public Vector<double> ToVector()
        {
            return Vector<double>.Build.Dense(new[] { X, Y });
        }
    }
}


text:
/*
 * ViewController
 */
define(['./Base'], function (Base) {
	console.log('KICK: viewController called');
    var d = new Date().getTime();
    var uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
    	var r = (d + Math.random()*16)%16 | 0;
    	d = Math.floor(d/16);
    	return (c=='x' ? r : (r&0x7|0x8)).toString(16);
    });
    var _ViewController = new Base(uuid);

    // following this example, slightly
    // http://sandbox.thewikies.com/javascript-mvc-hello-world/index.2.html

    return _ViewController;
});