text:
import { Injectable, NgZone }   from '@angular/core';

import { Observable }           from 'rxjs/Rx';
import { BehaviorSubject }      from "rxjs/Rx";

import { IDesignerTree }            from '../interface/IDesignerTree';
import { IDesignerDragProgress }    from '../interface/IDesignerDragProgress';
import { IDesignerItem }            from '../interface/IDesignerItem';
import { IDesignerItemConnection }  from '../interface/IDesignerItemConnection';
import { IDesignerItemSetting }     from '../interface/IDesignerItemSetting';
import { IDesignerItemTerminal }    from '../interface/IDesignerItemTerminal';
import { IDesignerPoint }           from '../interface/IDesignerPoint';
import { IDesignerUiInstance }      from '../interface/IDesignerUiInstance';

import { DataframeBase, IHttpInvokeResult } from './dataframe.base';

import { DatastoreService, IStoreConfig }   from './datastore.service';

import * as RSVP                from 'rsvp';

@Injectable()
export class DataframeDesignerTreeItemTerminal extends DataframeBase
{
    TYPE_INPUT  : number = 0;
    TYPE_OUTPUT : number = 1;

    store_config    : IStoreConfig =
    {
        store_key   : 'designerTreeItemTerminalId',
        store_name  : 'designerTreeItemTerminal'
    };

    constructor ( protected _ngZone : NgZone,
                  private   _store  : DatastoreService )
    {
        super ( _ngZone );

        _store.init ( this.store_config ).then (

            () => {},
            () => {}

        );
    }

    frameoption () : any
    {
        let retval : any =
        {
            url_part : 'designerTreeItemTerminal',
            verb     : 'POST'
        };

        return retval;
    }

    write ( terminal : IDesignerItemTerminal, uiInstance : IDesignerUiInstance, self ) : Promise<IHttpInvokeResult>
    {
        return new Promise ( ( resolve, reject ) =>
        {
            let frame =
            {
                write                       : true,
                designerTreeItemTerminalId  : terminal.designerTreeItemTerminalId,
                businessId                  : uiInstance.tree_selected.businessId,
                designerTreeItemId          : terminal.designerTreeItemId,
                terminalType                : terminal.terminalType,
                idx                         : terminal.idx,
                label                       : terminal.label,
                radius                      : terminal.radius,
                cx                          : terminal.cx,
                cy                          : terminal.cy,
            };

            self.invoke_frame ( frame, self.frameoption () ).then (

                ( value ) =>
                {
                    if ( 200 === value.status )
                    {
                        let data   = JSON.parse ( value.data );
                        let result = data.result[0][0];

                        for ( let i = 0; i < uiInstance.listof_item.length; ++i )
                        {
                            for ( let j = 0; j < uiInstance.listof_item[i].input.length; ++j )
                            {
                                if ( uiInstance.listof_item[i].input[j].idx === result.idx )
                                {
                                    uiInstance.listof_item[i].input[j].designerTreeItemTerminalId = result.designerTreeItemTerminalId;
                                }
                            }

                            for ( let j = 0; j < uiInstance.listof_item[i].output.length; ++j )
                            {
                                if ( uiInstance.listof_item[i].output[j].idx === result.idx )
                                {
                                    uiInstance.listof_item[i].output[j].designerTreeItemTerminalId = result.designerTreeItemTerminalId;
                                }
                            }
                        }

                        resolve ( result );

                    } else
                    {
                        reject ( `!!! ERROR : Status ${ value.status }` );
                    }
                },
                ( error ) =>
                {
                    reject ( error );
                }

            ).catch (

                ( ex ) =>
                {
                    reject ( ex );
                }

            );

        } );
    }

    patch ( terminal : IDesignerItemTerminal, uiInstance : IDesignerUiInstance, self ) : Promise<IHttpInvokeResult>
    {
        return new Promise ( ( resolve, reject ) =>
        {
            let frame =
            {
                patch                       : true,
                designerTreeItemTerminalId  : terminal.designerTreeItemTerminalId,
                businessId                  : uiInstance.tree_selected.businessId,
                designerTreeItemId          : terminal.designerTreeItemId,
                terminalType                : terminal.terminalType,
                idx                         : terminal.idx,
                label                       : terminal.label,
                radius                      : terminal.radius,
                cx                          : terminal.cx,
                cy                          : terminal.cy,
            };

            self.invoke_frame ( frame, self.frameoption () ).then (

                ( value ) =>
                {
                    if ( 200 === value.status )
                    {
                        let data   = JSON.parse ( value.data );
                        let result = data.result[0][0];

                        resolve ( result );

                    } else
                    {
                        reject ( `!!! ERROR : Status ${ value.status }` );
                    }
                },
                ( error ) =>
                {
                    reject ( error );
                }

            ).catch (

                ( ex ) =>
                {
                    reject ( ex );
                }

            );

        } );
    }

    persist ( terminal : IDesignerItemTerminal, uiInstance : IDesignerUiInstance, self ) : Promise<any>
    {
        return new Promise ( ( resolve, reject ) =>
        {
            let fx_persist;

            if ( 0 < terminal.designerTreeItemTerminalId )
            {
                fx_persist = self.patch;

            } else
            {
                fx_persist = self.write;
            }

            fx_persist ( terminal, uiInstance, self ).then (

                ( value ) =>
                {
                    resolve ( value );
                },
                ( error ) =>
                {
                    throw ( error );
                }

            ).catch
            (
                ( ex ) =>
                {
                    reject ( ex );
                }

            );

        } );
    }

    fetch_tree ( decision_tree : IDesignerTree, uiInstance : IDesignerUiInstance, self ) : Promise<any>
    {
        if ( ! self ) self = this;

        return new Promise ( ( resolve, reject ) => self._ngZone.run ( ( ) =>
        {
            let frame =
            {
                fetch_tree      : true,
                designerTreeId  : decision_tree.designerTreeId
            };

            self.invoke_frame ( frame, self.frameoption ( ) ).then (

                ( value ) =>
                {
                    if ( 200 === value.status )
                    {
                        let data   = JSON.parse ( value.data );
                        let result = data.result[0];

                        for ( let i = 0; i < result.length; ++i )
                        {
                            for ( let j = 0; j < uiInstance.listof_item.length; ++j )
                            {
                                if ( result[i].designerTreeItemId === uiInstance.listof_item[j].designerTreeItemId )
                                {
                                    if ( result[i].terminalType === self.TYPE_INPUT )
                                    {
                                        uiInstance.listof_item[j].input.push ( result[i] );
                                    }

                                    if (result[i].terminalType === self.TYPE_OUTPUT )
                                    {
                                        uiInstance.listof_item[j].output.push ( result[i] );
                                    }

                                }

                            }

                        }

                        resolve ( result );

                    } else
                    {
                        reject ( `!!! ERROR : Status ${ value.status }` );
                    }
                },
                ( error ) =>
                {
                    reject ( error );
                }

            ).catch (

                ( ex ) =>
                {
                    reject ( ex );
                }

            );

        } ) );

    };

    persist_setof_terminal ( uiInstance : IDesignerUiInstance ) : Promise<any>
    {
        let self = this;

        return new Promise ( ( resolve, reject ) => this._ngZone.run ( ( ) =>
        {
            let setof_terminal = [];

            for ( let i = 0; i < uiInstance.listof_item.length; ++i )
            {
                for ( let m = 0; m < uiInstance.listof_item[i].input.length; ++m )
                {
                    setof_terminal.push ( uiInstance.listof_item[i].input[m] );
                }

                for ( let w = 0; w < uiInstance.listof_item[i].output.length; ++w )
                {
                    setof_terminal.push ( uiInstance.listof_item[i].output[w] );
                }

            }

            setof_terminal.reduce ( ( cur, terminal ) =>

                {
                    return cur.then ( ( ) =>
                    {
                        return self.persist ( terminal, uiInstance, self );

                    } );

                }, RSVP.resolve ( true )

            ).then (

                ( ) =>
                {
                    resolve ( '' );
                }

            ).catch (

                ( ex ) =>
                {
                    resolve ( '' );
                }

            );

        } ) );
    }

    fetch_setof_terminal ( uiInstance           : IDesignerUiInstance,
                           listof_decision_tree : IDesignerTree [] ) : Promise<any>
    {
        let self = this;

        return new Promise ( ( resolve, reject ) => this._ngZone.run ( ( ) =>
        {
            this.fetch_tree ( uiInstance.tree_selected, uiInstance, self ).then (

                ( value ) =>
                {
                    resolve ( '' );
                },
                ( error ) =>
                {
                    resolve ( '' );
                }

            ).catch (

                ( ex ) =>
                {
                    resolve ( '' );
                }

            );

        } ) );

    }

}


text:
using System;
using System.Net.Sockets;
using System.Text;
using System.Text.RegularExpressions;
using System.Collections;

using System.Runtime.Remoting.Channels;
using System.IO;
using System.Net;
using System.Runtime.Remoting.Messaging;

namespace System.Runtime.Remoting.Channels.Http
{

	internal class RequestArguments
	{
		static int count;
		Socket socket;

		public RequestArguments (Socket socket, HttpServerTransportSink sink)
		{
			Id = count++;
			NetworkStream ns = new NetworkStream (socket);
			this.Stream = ns;
			this.socket = socket;
			Sink = sink;
		}

		public void Process ()
		{
			HttpServer.ProcessRequest (this);
		}

		public IPAddress ClientAddress
		{
			get {
				IPEndPoint ep = socket.RemoteEndPoint as IPEndPoint;
				if (ep != null) return ep.Address;
				else return null;
			}
		}

		public int Id;
		public Stream Stream;
		public HttpServerTransportSink Sink;
	}

	internal sealed class HttpServer
	{
		public static void ProcessRequest (RequestArguments reqArg)
		{
			//Step (1) Start Reciceve the header
			ArrayList  Headers = RecieveHeader (reqArg);

			//Step (2) Start Parse the header
			IDictionary HeaderFields = new Hashtable();
			IDictionary CustomHeaders = new Hashtable();
			if (!ParseHeader (reqArg, Headers, HeaderFields, CustomHeaders))
				return;

			//Step (3)
			if (!CheckRequest (reqArg, HeaderFields, CustomHeaders))
				return;

			//Step (4) Recieve the entity body

			byte[] buffer;
			object len = HeaderFields["content-length"];
			if (len != null)
			{
				buffer = new byte [(int)len];
				if (!RecieveEntityBody (reqArg, buffer))
					return;
			}
			else
				buffer = new byte [0];

			//Step (5)
			SendRequestForChannel (reqArg, HeaderFields, CustomHeaders, buffer);
		}

		private static ArrayList RecieveHeader (RequestArguments reqArg)
		{
			bool bLastLine = false;
			bool bEndOfLine = false;

			byte[] buffer = new byte[1024];
			ArrayList  Headers = new ArrayList();

			Stream ist = reqArg.Stream;

			int index =0;
			while (!bLastLine)
			{
				//recieve line by line
				index = 0;
				bEndOfLine = false;

				//Step (1) is it an empty line?
				ist.Read (buffer, index, 1);

				if(buffer[index++]==13)
				{
					ist.Read (buffer, index, 1);
					bLastLine=true;
					bEndOfLine = true;
				}

				//Step (2) recieve line bytes
				while (!bEndOfLine)
				{
					ist.Read (buffer, index, 1);

					if(buffer [index++]==13)
					{
						bEndOfLine = true;
						ist.Read (buffer,index,1);
					}
				}

				//Step (3) convert bytes to a string
				if (bLastLine)
					continue;

                Headers.Add (Encoding.ASCII.GetString (buffer,0,index));

			}//end while loop

			return Headers;
		}

		private static bool ParseHeader (RequestArguments reqArg, ArrayList Headers, IDictionary HeaderFields, IDictionary CustomHeaders)
		{
			for (int i=0;i<Headers.Count;i++)
			{
				if (ReqMessageParser.ParseHeaderField ((string)Headers[i],HeaderFields))
					continue;

				if (!ReqMessageParser.IsCustomHeader((string)Headers[i],CustomHeaders ) )
				{
					SendResponse (reqArg, 400, null, null);
					return false;
				}
			}

			return true;
		}

		private static bool CheckRequest (RequestArguments reqArg, IDictionary HeaderFields, IDictionary CustomHeaders)
		{
			string temp;

			if (HeaderFields["expect"] as string == "100-continue")
				SendResponse (reqArg, 100, null, null);

			//Check the method
			temp = HeaderFields["method"].ToString();
			if (temp != "POST")
                return true;

			//Check for the content-length field
			if (HeaderFields["content-length"]==null)
			{
				SendResponse (reqArg, 411, null, null);
				return false;
			}
			return true;
		}

		private static bool RecieveEntityBody (RequestArguments reqArg, byte[] buffer)
		{
			try
			{
				int nr = 0;
				while (nr < buffer.Length)
					nr += reqArg.Stream.Read (buffer, nr, buffer.Length - nr);
			}
			catch (SocketException e)
			{
				switch(e.ErrorCode)
				{
					case 10060 : //TimeOut
						SendResponse (reqArg, 408, null, null);
						break;
					default :
						throw e;
				}

				return false;
			}//end catch

			return true;
		}

		private static bool SendRequestForChannel (RequestArguments reqArg, IDictionary HeaderFields, IDictionary CustomHeaders, byte[] buffer)
		{
			TransportHeaders THeaders = new TransportHeaders();

			Stream stream = new MemoryStream(buffer);

			if(stream.Position !=0)
				stream.Seek(0,SeekOrigin.Begin);

			THeaders[CommonTransportKeys.RequestUri] = FixURI((string)HeaderFields["request-url"]);
			THeaders[CommonTransportKeys.ContentType]= HeaderFields["content-type"];
			THeaders[CommonTransportKeys.RequestVerb]= HeaderFields["method"];
			THeaders[CommonTransportKeys.HttpVersion] = HeaderFields["http-version"];
			THeaders[CommonTransportKeys.UserAgent] = HeaderFields["user-agent"];
			THeaders[CommonTransportKeys.Host] = HeaderFields["host"];
			THeaders[CommonTransportKeys.SoapAction] = HeaderFields["SOAPAction"];
			THeaders[CommonTransportKeys.IPAddress] = reqArg.ClientAddress;
			THeaders[CommonTransportKeys.ConnectionId] = reqArg.Id;

			foreach(DictionaryEntry DictEntry in CustomHeaders)
			{
				THeaders[DictEntry.Key.ToString()] = DictEntry.Value.ToString();
			}

			reqArg.Sink.ServiceRequest (reqArg, stream, THeaders);
			return true;
		}

		private static string FixURI(string RequestURI)
		{

			if(RequestURI.IndexOf ( '.' ) == -1)
				return RequestURI;
			else
				return RequestURI.Substring(1);

		}

		public static void SendResponse (RequestArguments reqArg, int httpStatusCode, ITransportHeaders headers, Stream responseStream)
		{
			byte [] headersBuffer = null;
			byte [] entityBuffer = null;

			StringBuilder responseStr;
			String reason = null;

			if (headers != null && headers[CommonTransportKeys.HttpStatusCode] != null) {
				// The formatter can override the result code
				httpStatusCode = int.Parse ((string)headers [CommonTransportKeys.HttpStatusCode]);
				reason = (string) headers [CommonTransportKeys.HttpReasonPhrase];
			}

			if (reason == null)
				reason = GetReasonPhrase (httpStatusCode);

			//Response Line
			responseStr = new StringBuilder ("HTTP/1.0 " + httpStatusCode + " " + reason + "\r\n" );

			if (headers != null)
			{
				foreach (DictionaryEntry entry in headers)
				{
					string key = entry.Key.ToString();
					if (key != CommonTransportKeys.HttpStatusCode && key != CommonTransportKeys.HttpReasonPhrase)
						responseStr.Append(key + ": " + entry.Value.ToString() + "\r\n");
				}
			}

			responseStr.Append("Server: Mono Remoting, Mono CLR " + System.Environment.Version.ToString() + "\r\n");

			if(responseStream != null && responseStream.Length!=0)
			{
				responseStr.Append("Content-Length: "+responseStream.Length.ToString()+"\r\n");
				entityBuffer  = new byte[responseStream.Length];
				responseStream.Seek(0 , SeekOrigin.Begin);
				responseStream.Read(entityBuffer,0,entityBuffer.Length);
			}
			else
				responseStr.Append("Content-Length: 0\r\n");

			responseStr.Append("X-Powered-By: Mono\r\n");
			responseStr.Append("Connection: close\r\n");
   			responseStr.Append("\r\n");

		   	headersBuffer = Encoding.ASCII.GetBytes (responseStr.ToString());

			//send headersBuffer
			reqArg.Stream.Write (headersBuffer, 0, headersBuffer.Length);

			if (entityBuffer != null)
				reqArg.Stream.Write (entityBuffer, 0, entityBuffer.Length);
		}

		internal static string GetReasonPhrase (int HttpStatusCode)
		{
			switch (HttpStatusCode)
			{
				case 100 : return "Continue" ;
				case 101  :return "Switching Protocols";
				case 200  :return "OK";
				case 201  :return "Created";
				case 202  :return "Accepted";
				case 203   :return "Non-Authoritative Information";
				case 204  :return "No Content";
				case 205   :return "Reset Content";
				case 206   :return "Partial Content";
				case 300   :return "Multiple Choices";
				case 301   :return "Moved Permanently";
				case 302   :return  "Found";
				case 303   :return  "See Other";
				case 304   :return  "Not Modified";
				case 305  :return   "Use Proxy";
				case 307   :return  "Temporary Redirect";

				case 400   :return  "Bad Request";
				case 401   :return  "Unauthorized";
				case 402   :return  "Payment Required";
				case 403   :return  "Forbidden";
				case 404   :return  "Not Found";
				case 405   :return  "Method Not Allowed";
				case 406   :return  "Not Acceptable";

				case 407   :return  "Proxy Authentication Required";
				case 408   :return  "Request Time-out";
				case 409   :return  "Conflict";
				case 410   :return  "Gone";
				case 411   :return  "Length Required";
				case 412   :return  "Precondition Failed";
				case 413   :return  "Request Entity Too Large";
				case 414   :return  "Request-URI Too Large";
				case 415   :return  "Unsupported Media Type";
				case 416   :return  "Requested range not satisfiable";
				case 417   :return  "Expectation Failed";

				case 500  :return   "Internal Server Error";
				case 501  :return   "Not Implemented";
				case 502   :return  "Bad Gateway";
				case 503  :return   "Service Unavailable";
				case 504   :return  "Gateway Time-out";
				case 505   :return  "HTTP Version not supported";
				default: return "";

			}
		}

	}

	internal sealed class ReqMessageParser
	{
		private  const int nCountReq = 14;
		private  const int nCountEntity = 15;

		private static bool bInitialized = false;

		private static String [] ReqRegExpString = new String [nCountReq ];
		private static String [] EntityRegExpString = new String[nCountEntity];

		private static Regex [] ReqRegExp = new Regex[nCountReq];
		private static Regex [] EntityRegExp = new Regex[nCountEntity];

		public ReqMessageParser ()
		{
		}

		 public static bool ParseHeaderField(string buffer,IDictionary headers)
		 {
			 try
			 {
				 if(!bInitialized)
				 {
					 Initialize();
					 bInitialized =true;
				 }

				 if(IsRequestField(buffer,headers))
					 return true;
				 if(IsEntityField(buffer,headers))
					 return true ;

			 }
			 catch(Exception )
			 {
				 //<Exception>
			 }

			 //Exception

			 return false;
		 }

		 private static bool Initialize()
		 {
			 if(bInitialized)
				 return true;

			 bInitialized = true;

			 //initialize array
			 //Create all the Regular expressions
			 InitializeRequestRegExp();
			 InitiazeEntityRegExp();

			 for(int i=0;i<nCountReq;i++)
				 ReqRegExp[i] = new Regex(ReqRegExpString[i],RegexOptions.Compiled|RegexOptions.IgnoreCase);

			 for(int i=0;i<nCountEntity;i++)
				 EntityRegExp[i] = new Regex(EntityRegExpString[i],RegexOptions.Compiled|RegexOptions.IgnoreCase);

			 return true;

		 }

		 private static void InitializeRequestRegExp()
		 {
			 //Request Header Fields
			 //
			 ReqRegExpString[0] = "^accept(\\s*:\\s*)(?<accept>\\S+)(\\s*|)(\\s*)$";
			 ReqRegExpString[1] = "^accept-charset(\\s*:\\s*)(?<accept_charset>\\S+(\\s|\\S)*\\S)(\\s*)$";
			 ReqRegExpString[2] = "^accept-encoding(\\s*:\\s*)(?<accept_Encoding>\\S+(\\s|\\S)*\\S)(\\s*)$";
			 ReqRegExpString[3] = "^authorization(\\s*:\\s*)(?<authorization>\\S+(\\s|\\S)*\\S)(\\s*)$";
			 ReqRegExpString[4] = "^accept-language(\\s*:\\s*)(?<accept_Language>\\S+(\\s|\\S)*\\S)(\\s*)$";
			 ReqRegExpString[5] = "^from(\\s*:\\s*)(?<from>\\S+(\\s|\\S)*\\S)(\\s*)$";
			 ReqRegExpString[6] = "^host(\\s*:\\s*)(?<host>\\S+(\\s|\\S)*\\S)(\\s*)$";
			 ReqRegExpString[7] = "^if-modified-since(\\s*:\\s*)(?<if_modified>\\S+(\\s|\\S)*\\S)(\\s*)$";
			 ReqRegExpString[8] = "^proxy-authorization(\\s*:\\s*)(?<proxy_auth>\\S+(\\s|\\S)*\\S)(\\s*)$";
			 ReqRegExpString[9] = "^range(\\s*:\\s*)(?<range>\\S+(\\s|\\S)*\\S)(\\s*)$";
			 ReqRegExpString[10] = "^user-agent(\\s*:\\s*)(?<user_agent>\\S+(\\s|\\S)*\\S)(\\s*)$";
			 ReqRegExpString[11] = "^expect(\\s*:\\s*)(?<expect>\\S+(\\s|\\S)*\\S)(\\s*)$";
			 ReqRegExpString[12] = "^connection(\\s*:\\s*)(?<connection>\\S+(\\s|\\S)*\\S)(\\s*)$";
			 ReqRegExpString[13] = "^(?<method>\\w+)(\\s+)(?<request_url>\\S+)(\\s+)(?<http_version>\\S+)(\\s*)$";
			// ReqRegExpString[14] = "";
		 }

		 private static void InitiazeEntityRegExp()
		 {
			EntityRegExpString[0] = "^allow(\\s*:\\s*)(?<allow>[0-9]+)(\\s*)$";
		    EntityRegExpString[1] = "^content-encoding(\\s*:\\s*)(?<content_encoding>\\S+(\\s|\\S)*\\S)(\\s*)$";
			EntityRegExpString[2] = "^content-language(\\s*:\\s*)(?<content_language>\\S+(\\s|\\S)*\\S)(\\s*)$";
			EntityRegExpString[3] = "^content-length(\\s*:\\s*)(?<content_length>[0-9]+)(\\s*)$";
			EntityRegExpString[4] = "^content-range(\\s*:\\s*)(?<content_range>\\S+(\\s|\\S)*\\S)(\\s*)$";
			EntityRegExpString[5] = "^content-type(\\s*:\\s*)(?<content_type>\\S+(\\s|\\S)*\\S)(\\s*)$";
			EntityRegExpString[6] = "^content-version(\\s*:\\s*)(?<content_version>\\S+(\\s|\\S)*\\S)(\\s*)$";
			EntityRegExpString[7] = "^derived-from(\\s*:\\s*)(?<derived_from>\\S+(\\s|\\S)*\\S)(\\s*)$";
			EntityRegExpString[8] = "^expires(\\s*:\\s*)(?<expires>\\S+(\\s|\\S)*\\S)(\\s*)$";//date
			EntityRegExpString[9] = "^last-modified(\\s*:\\s*)(?<last_modified>\\S+(\\s|\\S)*\\S)(\\s*)$";//date
			EntityRegExpString[10] = "^link(\\s*:\\s*)(?<link>\\S+(\\s|\\S)*\\S)(\\s*)$";
			EntityRegExpString[11] = "^title(\\s*:\\s*)(?<title>\\S+(\\s|\\S)*\\S)(\\s*)$";
		    EntityRegExpString[12] = "^transfere-encoding(\\s*:\\s*)(?<transfere_encoding>\\S+(\\s|\\S)*\\S)(\\s*)$";
		    EntityRegExpString[13] = "^url-header(\\s*:\\s*)(?<url_header>\\S+(\\s|\\S)*\\S)(\\s*)$";
			EntityRegExpString[14] = "^extension-header(\\s*:\\s*)(?<extension_header>\\S+(\\s|\\S)*\\S)(\\s*)$";
		 }

		 private static void CopyGroupNames(Regex regEx , Match m , IDictionary headers)
		 {

			 if(!m.Success)
				 return;

			 string [] ar = regEx.GetGroupNames();
			 GroupCollection gc = m.Groups;

			 for(int i=0;i<ar.Length;i++)
			 {
				 if(! char.IsLetter(ar[i],0))
					 continue;

				headers.Add(ar[i],gc[ar[i]].Value);
			 }
		 }

		 private static bool IsRequestField(string buffer , IDictionary HeaderItems)
		 {

			 if(Request_accept(buffer , HeaderItems))
				 return true;

			 if(Request_accept_charset(buffer , HeaderItems))
				 return true;

			 if(Request_accept_encoding(buffer , HeaderItems))
				 return true;

			 if(Request_accept_language(buffer , HeaderItems))
				 return true;

			 if(Request_authorization(buffer , HeaderItems))
				 return true;

			 if(Request_connection(buffer , HeaderItems))
				 return true;

			 if(Request_expect(buffer , HeaderItems))
				 return true;

			 if(Request_from(buffer , HeaderItems))
				 return true;

			 if(Request_host(buffer , HeaderItems))
				 return true;

			 if(Request_modified(buffer , HeaderItems))
				 return true;

			 if(Request_proxy_authorization(buffer , HeaderItems))
				 return true;

			 if(Request_user_agent(buffer , HeaderItems))
				 return true;

			 if(Request_request_line(buffer , HeaderItems))
				 return true;

			 return false;
		 }

		 private static bool IsEntityField(string buffer , IDictionary HeaderItems)
		 {
			 if(Entity_allow(buffer , HeaderItems))
				 return true;

			 if(Entity_content_encoding(buffer , HeaderItems))
				 return true;

			 if(Entity_content_language(buffer , HeaderItems))
				 return true;

			 if(Entity_content_length(buffer , HeaderItems))
				 return true;

			 if(Entity_content_range(buffer , HeaderItems))
				 return true;

			 if(Entity_content_type(buffer , HeaderItems))
				 return true;

			 if(Entity_content_version(buffer , HeaderItems))
				 return true;

			 if(Entity_dervied_from(buffer , HeaderItems))
				 return true;

			 if(Entity_expires(buffer , HeaderItems))
				 return true;

			 if(Entity_extension_header(buffer , HeaderItems))
				 return true;

			 if(Entity_last_modified(buffer , HeaderItems))
				 return true;

			 if(Entity_link(buffer , HeaderItems))
				 return true;

			 if(Entity_title(buffer , HeaderItems))
				 return true;

			 if(Entity_transfere_encoding(buffer , HeaderItems))
				 return true;

			 if(Entity_url_header(buffer , HeaderItems))
				 return true;

			 return false;

		 }

		 public static bool IsCustomHeader(string buffer,IDictionary CustomHeader)
		 {
			 Regex CustomHeaderEx = new Regex("^(?<header>\\S+)(\\s*:\\s*)(?<field>\\S+(\\s|\\S)*\\S)(\\s*)",RegexOptions.Compiled);

			 Match m = CustomHeaderEx.Match(buffer);
			 if(!m.Success)
				 return false;

			 CustomHeader.Add(m.Groups["header"].Value,m.Groups["field"].Value);
			 return true;

		 }

		 //********************************************************
		 //REQUEST
		 private static bool Request_accept(string buffer,IDictionary HeaderItems)
		 {
			 Match m = ReqRegExp[0].Match(buffer);
			 if(!m.Success)
				 return false;

			 HeaderItems.Add("accept",m.Groups["accept"].Value);
			 return true;
		 }

		 private static bool Request_accept_charset(string buffer,IDictionary HeaderItems)
		 {
			 Match m = ReqRegExp[1].Match(buffer);
			 if(!m.Success)
				 return false;

			 HeaderItems.Add("accept-charset",m.Groups["accept_charset"].Value);
			 return true;

		 }
		 private static bool Request_accept_encoding(string buffer,IDictionary HeaderItems)
		 {
			 Match m = ReqRegExp[2].Match(buffer);
			 if(!m.Success)
				 return false;

			 HeaderItems.Add("accept-encoding",m.Groups["accept_encoding"].Value);
			 return true;
		 }
		 private static bool Request_authorization(string buffer,IDictionary HeaderItems)
		 {
			 Match m = ReqRegExp[3].Match(buffer);
			 if(!m.Success)
				 return false;

			 HeaderItems.Add("authorization",m.Groups["authorization"].Value);
			 return true;
		 }
		 private static bool Request_accept_language(string buffer,IDictionary HeaderItems)
		 {
			 Match m = ReqRegExp[4].Match(buffer);
			 if(!m.Success)
				 return false;

			 HeaderItems.Add("accept-language",m.Groups["accept_language"].Value);
			 return true;
		 }
		 private static bool Request_from(string buffer,IDictionary HeaderItems)
		 {
			 Match m = ReqRegExp[5].Match(buffer);
			 if(!m.Success)
				 return false;

			 HeaderItems.Add("from",m.Groups["from"].Value);
			 return true;
		 }
		 private static bool Request_host(string buffer,IDictionary HeaderItems)
		 {
			 Match m = ReqRegExp[6].Match(buffer);
			 if(!m.Success)
				 return false;

			 HeaderItems.Add("host",m.Groups["host"].Value);
			 return true;
		 }
		 private static bool Request_modified(string buffer,IDictionary HeaderItems)
		 {
			 Match m = ReqRegExp[7].Match(buffer);
			 if(!m.Success)
				 return false;

			 HeaderItems.Add("modified",m.Groups["modified"].Value);
			 return true;
		 }
		 private static bool Request_proxy_authorization(string buffer,IDictionary HeaderItems)
		 {
			 Match m = ReqRegExp[8].Match(buffer);
			 if(!m.Success)
				 return false;

			 HeaderItems.Add("proxy-authorization",m.Groups["proxy_authorization"].Value);
			 return true;
		 }
		 private static bool Request_range(string buffer , IDictionary HeaderItems)
		 {
			 Match m = ReqRegExp[9].Match(buffer);
			 if(!m.Success)
				 return false;

			 HeaderItems.Add("range",m.Groups["range"].Value);
			 return true;

		 }
		 private static bool Request_user_agent(string buffer,IDictionary HeaderItems)
		 {
			 Match m = ReqRegExp[10].Match(buffer);
			 if(!m.Success)
				 return false;

			 HeaderItems.Add("user-agent",m.Groups["user_agent"].Value);
			 return true;
		 }
		 private static bool Request_expect(string buffer,IDictionary HeaderItems)
		 {
			 Match m = ReqRegExp[11].Match(buffer);
			 if(!m.Success)
				 return false;

			 HeaderItems.Add("expect",m.Groups["expect"].Value);
			 return true;
		 }

		 private static bool Request_connection(string buffer,IDictionary HeaderItems)
		 {
			 Match m = ReqRegExp[12].Match(buffer);
			 if(!m.Success)
				 return false;

			 HeaderItems.Add("connection",m.Groups["connection"].Value);
			 return true;
		 }

		 private static bool Request_request_line(string buffer, IDictionary HeaderItems)
		 {
			 Match m = ReqRegExp[13].Match(buffer);
			 if(!m.Success)
				 return false;
			//ReqRegExpString[13] = "(?<method>\\w+)(\\s+)(?<request_url>\\S+)(\\s+)(?<http_version>\\S+)";

			 HeaderItems.Add("method",m.Groups["method"].Value);
			 HeaderItems.Add("request-url",m.Groups["request_url"].Value);
			 HeaderItems.Add("http-version",m.Groups["http_version"].Value);
			 return true;
		 }
		//********************************************************

		 //********************************************************
		 //ENTITY
		 private static bool Entity_allow(string buffer,IDictionary HeaderItems)
		 {
			 Match m = EntityRegExp[0].Match(buffer);
			 if(!m.Success)
				 return false;

			 HeaderItems.Add("allow",m.Groups["allow"].Value);
			 return true;
		 }

		 private static bool Entity_content_encoding(string buffer,IDictionary HeaderItems)
		 {
			 Match m = EntityRegExp[1].Match(buffer);
			 if(!m.Success)
				 return false;

			 HeaderItems.Add("content-encoding",m.Groups["content_encoding"].Value);
			 return true;
		 }
		 private static bool Entity_content_language(string buffer,IDictionary HeaderItems)
		 {
			 Match m = EntityRegExp[2].Match(buffer);
			 if(!m.Success)
				 return false;

			 HeaderItems.Add("content-language",m.Groups["content_language"].Value);
			 return true;
		 }
		 private static bool Entity_content_length(string buffer,IDictionary HeaderItems)
		 {
			 Match m = EntityRegExp[3].Match(buffer);
			 if(!m.Success)
				 return false;

			int length;
			 try
			 {
				 length = Int32.Parse(m.Groups["content_length"].ToString());
			 }
			 catch (Exception )
			 {
				 //<Exception>
				 return false;
			 }

			 HeaderItems.Add("content-length",length);
			 return true;
		 }
		 private static bool Entity_content_range(string buffer,IDictionary HeaderItems)
		 {
			 Match m = EntityRegExp[4].Match(buffer);
			 if(!m.Success)
				 return false;

			 HeaderItems.Add("content-range",m.Groups["content_range"].Value);
			 return true;
		 }
		 private static bool Entity_content_type(string buffer,IDictionary HeaderItems)
		 {
			 Match m = EntityRegExp[5].Match(buffer);
			 if(!m.Success)
				 return false;

			 HeaderItems.Add("content-type",m.Groups["content_type"].Value);
			 return true;
		 }

		 private static bool Entity_content_version(string buffer,IDictionary HeaderItems)
		 {
			 Match m = EntityRegExp[6].Match(buffer);
			 if(!m.Success)
				 return false;

			 HeaderItems.Add("content-version",m.Groups["content_version"].Value);
			 return true;
		 }
		 private static bool Entity_dervied_from(string buffer,IDictionary HeaderItems)
		 {
			 Match m = EntityRegExp[7].Match(buffer);
			 if(!m.Success)
				 return false;

			 HeaderItems.Add("dervied-from",m.Groups["dervied_from"].Value);
			 return true;
		 }
		 private static bool Entity_expires(string buffer,IDictionary HeaderItems)
		 {
			 Match m = EntityRegExp[8].Match(buffer);
			 if(!m.Success)
				 return false;

			 HeaderItems.Add("expires",m.Groups["expires"].Value);
			 return true;
		 }
		 private static bool Entity_last_modified(string buffer,IDictionary HeaderItems)
		 {
			 Match m = EntityRegExp[9].Match(buffer);
			 if(!m.Success)
				 return false;

			 HeaderItems.Add("last-modified",m.Groups["last_modified"].Value);
			 return true;
		 }
		 private static bool Entity_link(string buffer,IDictionary HeaderItems)
		 {
			 Match m = EntityRegExp[10].Match(buffer);
			 if(!m.Success)
				 return false;

			 HeaderItems.Add("link",m.Groups["link"].Value);
			 return true;
		 }
		 private static bool Entity_title(string buffer,IDictionary HeaderItems)
		 {
			 Match m = EntityRegExp[11].Match(buffer);
			 if(!m.Success)
				 return false;

			 HeaderItems.Add("title",m.Groups["title"].Value);
			 return true;
		 }

		 private static bool Entity_transfere_encoding(string buffer,IDictionary HeaderItems)
		 {
			 Match m = EntityRegExp[12].Match(buffer);
			 if(!m.Success)
				 return false;

			 HeaderItems.Add("transfere-encoding",m.Groups["transfere_encoding"].Value);
			 return true;
		 }
		 private static bool Entity_url_header(string buffer,IDictionary HeaderItems)
		 {
			 Match m = EntityRegExp[13].Match(buffer);
			 if(!m.Success)
				 return false;

			 HeaderItems.Add("url-header",m.Groups["url_header"].Value);
			 return true;
		 }

		 private static bool Entity_extension_header(string buffer,IDictionary HeaderItems)
		 {
			 Match m = EntityRegExp[14].Match(buffer);
			 if(!m.Success)
				 return false;

			 HeaderItems.Add("extension-header",m.Groups["extension_header"].Value);
			 return true;
		 }

		 //********************************************************
	}

}

redpajama_set_name: RedPajamaGithub


text:
A simple, convenient, reliable, well tested HTTP/HTTPS web server to host static files.
It can host a local directory or contents of a zip file.

## values.yaml

TODO: This is not available yet.


text:
package org.apache.geode.session.tests;

import static org.junit.Assert.assertEquals;

import java.io.IOException;
import java.net.URISyntaxException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.function.IntSupplier;

import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.rules.TestName;

import org.apache.geode.internal.UniquePortSupplier;
import org.apache.geode.modules.session.functions.GetMaxInactiveInterval;
import org.apache.geode.test.dunit.rules.ClusterStartupRule;
import org.apache.geode.test.dunit.rules.MemberVM;
import org.apache.geode.test.junit.categories.SessionTest;

/**
 * Base class for test of session replication.
 *
 * This class contains all of the tests of session replication functionality. Subclasses of this
 * class configure different containers in order to run these tests against specific containers.
 */
@Category({SessionTest.class})
public abstract class CargoTestBase {
  private final UniquePortSupplier portSupplier = new UniquePortSupplier();

  @Rule
  public TestName testName = new TestName();

  @Rule
  public ClusterStartupRule clusterStartupRule = new ClusterStartupRule(2);

  protected Client client;
  protected ContainerManager manager;
  protected ContainerInstall install;
  protected MemberVM locatorVM;

  /**
   * Should only be called once per test.
   *
   * @return a newly initialized ContainerInstall
   */
  public abstract ContainerInstall getInstall(IntSupplier portSupplier) throws Exception;

  /**
   * Sets up the {@link #client} and {@link #manager} variables by creating new instances of each.
   *
   * Adds two new containers to the {@link #manager} based on the subclass's
   * {@link #getInstall(IntSupplier)} method. Also sets the test name in the {@link #manager} to the
   * name of the current test.
   */
  @Before
  public void setup() throws Exception {
    dumpDockerInfo();
    announceTest("START");

    locatorVM = clusterStartupRule.startLocatorVM(0, 0);

    client = new Client();
    manager = new ContainerManager();

    manager.setTestName(testName.getMethodName());

    install = getInstall(portSupplier::getAvailablePort);
    install.setDefaultLocatorPort(locatorVM.getPort());

    manager.addContainers(2, install);

    customizeContainers();
  }

  public void customizeContainers() throws Exception {}

  /**
   * Stops all containers that were previously started and cleans up their configurations
   */
  @After
  public void stop() throws IOException, InterruptedException {
    try {
      manager.stopAllActiveContainers();
    } finally {
      try {
        manager.dumpLogs();
      } finally {
        try {
          manager.cleanUp();
        } finally {
          announceTest("END");
        }
      }
    }
  }

  /**
   * Gets the specified key from all the containers within the container manager and check that each
   * container has the associated expected value
   */
  public void getKeyValueDataOnAllClients(String key, String expectedValue, String expectedCookie)
      throws IOException, URISyntaxException {
    for (int i = 0; i < manager.numContainers(); i++) {
      // Set the port for this server
      client.setPort(Integer.parseInt(manager.getContainerPort(i)));
      // Get the response to a get on the specified key from this server
      Client.Response resp = client.get(key);

      // Null would mean we don't expect the same cookie as before
      if (expectedCookie != null)
        assertEquals("Sessions are not replicating properly", expectedCookie,
            resp.getSessionCookie());

      // Check that the response from this server is correct
      assertEquals("Session data is not replicating properly", expectedValue, resp.getResponse());
    }
  }

  /**
   * Test that when multiple containers are using session replication, all of the containers will
   * use the same session cookie for the same client.
   */
  @Test
  public void containersShouldReplicateCookies() throws IOException, URISyntaxException {
    manager.startAllInactiveContainers();

    client.setPort(Integer.parseInt(manager.getContainerPort(0)));
    Client.Response resp = client.get(null);

    getKeyValueDataOnAllClients(null, "", resp.getSessionCookie());
  }

  /**
   * Test that when a session attribute is set in one container, it is replicated to other
   * containers
   */
  @Test
  public void containersShouldHavePersistentSessionData() throws IOException, URISyntaxException {
    manager.startAllInactiveContainers();

    String key = "value_testSessionPersists";
    String value = "Foo";

    client.setPort(Integer.parseInt(manager.getContainerPort(0)));
    Client.Response resp = client.set(key, value);

    getKeyValueDataOnAllClients(key, value, resp.getSessionCookie());
  }

  /**
   * Test that when a container fails, session attributes that were previously set in that container
   * are still available in other containers
   */
  @Test
  public void failureShouldStillAllowOtherContainersDataAccess()
      throws IOException, URISyntaxException {
    manager.startAllInactiveContainers();

    String key = "value_testSessionPersists";
    String value = "Foo";

    client.setPort(Integer.parseInt(manager.getContainerPort(0)));
    Client.Response resp = client.set(key, value);

    manager.stopContainer(0);
    manager.removeContainer(0);

    getKeyValueDataOnAllClients(key, value, resp.getSessionCookie());
  }

  /**
   * Test that invalidating a session in one container invalidates the session in all containers.
   */
  @Test
  public void invalidationShouldRemoveValueAccessForAllContainers() throws Exception {
    manager.startAllInactiveContainers();

    String key = "value_testInvalidate";
    String value = "Foo";

    client.setPort(Integer.parseInt(manager.getContainerPort(0)));
    client.set(key, value);

    client.invalidate();

    verifySessionIsRemoved(key);
  }

  protected void verifySessionIsRemoved(String key) throws IOException, URISyntaxException {
    getKeyValueDataOnAllClients(key, "", null);
  }

  /**
   * Test that if a session is not used within the expiration time, it is expired and removed from
   * all containers
   */
  @Test
  public void containersShouldExpireInSetTimeframe()
      throws IOException, URISyntaxException, InterruptedException {
    manager.startAllInactiveContainers();

    String key = "value_testSessionExpiration";
    String value = "Foo";

    client.setPort(Integer.parseInt(manager.getContainerPort(0)));
    Client.Response resp = client.set(key, value);

    if (!localCacheEnabled()) {
      getKeyValueDataOnAllClients(key, value, resp.getSessionCookie());
    }

    client.setMaxInactive(1);
    Thread.sleep(5000);

    verifySessionIsRemoved(key);
  }

  private boolean localCacheEnabled() {
    return install.getConnectionType().enableLocalCache();
  }

  /**
   * Test that if a session is not used within the expiration time, it is expired and removed from
   * all containers
   */
  @Test
  public void sessionPicksUpSessionTimeoutConfiguredInWebXml()
      throws IOException, URISyntaxException, InterruptedException {
    manager.startAllInactiveContainers();

    String key = "value_testSessionExpiration";
    String value = "Foo";

    client.setPort(Integer.parseInt(manager.getContainerPort(0)));
    Client.Response resp = client.set(key, value);

    // 59 minutes is the value configured in web.xml
    verifyMaxInactiveInterval(59 * 60);

    if (!localCacheEnabled()) {
      client.setMaxInactive(63);

      verifyMaxInactiveInterval(63);
    }

  }

  protected void verifyMaxInactiveInterval(int expected) throws IOException, URISyntaxException {
    for (int i = 0; i < manager.numContainers(); i++) {
      client.setPort(Integer.parseInt(manager.getContainerPort(i)));
      assertEquals(Integer.toString(expected),
          client.executionFunction(GetMaxInactiveInterval.class).getResponse());
    }
  }

  /**
   * Test that if one container is accessing a session, that will prevent the session from expiring
   * in all containers.
   */
  @Test
  public void containersShouldShareSessionExpirationReset()
      throws URISyntaxException, IOException, InterruptedException {
    manager.startAllInactiveContainers();

    int timeToExp = 30;
    String key = "value_testSessionExpiration";
    String value = "Foo";

    client.setPort(Integer.parseInt(manager.getContainerPort(0)));
    Client.Response resp = client.set(key, value);
    String cookie = resp.getSessionCookie();

    resp = client.setMaxInactive(timeToExp);
    assertEquals(cookie, resp.getSessionCookie());

    long startTime = System.currentTimeMillis();
    long curTime = System.currentTimeMillis();
    // Run for 2 times the set expiration time
    while (curTime - startTime < timeToExp * 2000) {
      resp = client.get(key);
      Thread.sleep(500);
      curTime = System.currentTimeMillis();

      assertEquals("Sessions are not replicating properly", cookie, resp.getSessionCookie());
      assertEquals("Containers are not replicating session expiration reset", value,
          resp.getResponse());
    }

    getKeyValueDataOnAllClients(key, value, resp.getSessionCookie());
  }

  /**
   * Test that if a session attribute is removed in one container, it is removed from all containers
   */
  @Test
  public void containersShouldShareDataRemovals() throws IOException, URISyntaxException {
    manager.startAllInactiveContainers();

    String key = "value_testSessionRemove";
    String value = "Foo";

    client.setPort(Integer.parseInt(manager.getContainerPort(0)));
    Client.Response resp = client.set(key, value);

    if (!localCacheEnabled()) {
      getKeyValueDataOnAllClients(key, value, resp.getSessionCookie());
    }

    client.setPort(Integer.parseInt(manager.getContainerPort(0)));
    client.remove(key);

    getKeyValueDataOnAllClients(key, "", resp.getSessionCookie());
  }

  /**
   * Test that a container added to the system after puts still can access the correct sessions and
   * data.
   */
  @Test
  public void newContainersShouldShareDataAccess() throws Exception {
    manager.startAllInactiveContainers();

    String key = "value_testSessionAdd";
    String value = "Foo";

    client.setPort(Integer.parseInt(manager.getContainerPort(0)));
    Client.Response resp = client.set(key, value);

    getKeyValueDataOnAllClients(key, value, resp.getSessionCookie());

    int numContainers = manager.numContainers();
    // Add and start new container
    manager.addContainer(install);
    customizeContainers();

    manager.startAllInactiveContainers();
    // Check that a container was added
    assertEquals(numContainers + 1, manager.numContainers());

    getKeyValueDataOnAllClients(key, value, resp.getSessionCookie());
  }

  private void announceTest(String status) {
    System.out.format("TEST %s %s.%s%n", status, getClass().getSimpleName(),
        testName.getMethodName());
  }

  private static void dumpDockerInfo() throws IOException {
    Path dockerInfoPath = Paths.get("/", "proc", "self", "cgroup");
    if (Files.isReadable(dockerInfoPath)) {
      System.out.println("Docker info:");
      System.out.println("------------------------------------");
      Files.lines(dockerInfoPath).forEach(System.out::println);
      System.out.println("------------------------------------");
    }
  }
}


text:
<template>
  <require from="./../../../attributes"></require>
  <require from="./form-group"></require>
  <form-group role="group" element.bind="formField.element" message.bind="formField.message" description.bind="formField.description">
    <association-select
      attributes.bind      = "formField.element.attributes"
      multiple.bind        = "formField.element.multiple"
      value.bind           = "formField.value"
      property.bind        = "formField.element.property"
      repository.bind      = "formField.element.repository"
      resource.bind        = "formField.element.resource"

      association.bind     = "association"
      manyAssociation.bind = "manyAssociation"

      criteria.bind        = "formField.element.criteria"></association-select>
  </form-group>
</template>


text:
namespace System.ComponentModel {
  public class ArrayConverter : CollectionConverter {
    public ArrayConverter();
    public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType);
  }
  public abstract class BaseNumberConverter : TypeConverter {
    protected BaseNumberConverter();
    public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType);
    public override bool CanConvertTo(ITypeDescriptorContext context, Type t);
    public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value);
    public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType);
  }
  public class BooleanConverter : TypeConverter {
    public BooleanConverter();
    public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType);
    public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value);
  }
  public class ByteConverter : BaseNumberConverter {
    public ByteConverter();
  }
  public class CharConverter : TypeConverter {
    public CharConverter();
    public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType);
    public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value);
    public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType);
  }
  public class CollectionConverter : TypeConverter {
    public CollectionConverter();
    public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType);
  }
  public class DateTimeConverter : TypeConverter {
    public DateTimeConverter();
    public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType);
    public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType);
    public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value);
    public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType);
  }
  public class DateTimeOffsetConverter : TypeConverter {
    public DateTimeOffsetConverter();
    public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType);
    public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType);
    public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value);
    public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType);
  }
  public class DecimalConverter : BaseNumberConverter {
    public DecimalConverter();
    public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType);
    public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType);
  }
  public class DoubleConverter : BaseNumberConverter {
    public DoubleConverter();
  }
  public class EnumConverter : TypeConverter {
    public EnumConverter(Type type);
    protected Type EnumType { get; }
    public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType);
    public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType);
    public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value);
    public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType);
  }
  public class GuidConverter : TypeConverter {
    public GuidConverter();
    public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType);
    public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType);
    public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value);
    public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType);
  }
  public class Int16Converter : BaseNumberConverter {
    public Int16Converter();
  }
  public class Int32Converter : BaseNumberConverter {
    public Int32Converter();
  }
  public class Int64Converter : BaseNumberConverter {
    public Int64Converter();
  }
  public interface ITypeDescriptorContext : IServiceProvider {
    IContainer Container { get; }
    object Instance { get; }
    PropertyDescriptor PropertyDescriptor { get; }
    void OnComponentChanged();
    bool OnComponentChanging();
  }
  public class MultilineStringConverter : TypeConverter {
    public MultilineStringConverter();
    public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType);
  }
  public class NullableConverter : TypeConverter {
    public NullableConverter(Type type);
    public Type NullableType { get; }
    public Type UnderlyingType { get; }
    public TypeConverter UnderlyingTypeConverter { get; }
    public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType);
    public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType);
    public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value);
    public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType);
  }
  public abstract class PropertyDescriptor {
  }
  public class SByteConverter : BaseNumberConverter {
    public SByteConverter();
  }
  public class SingleConverter : BaseNumberConverter {
    public SingleConverter();
  }
  public class StringConverter : TypeConverter {
    public StringConverter();
    public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType);
    public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value);
  }
  public class TimeSpanConverter : TypeConverter {
    public TimeSpanConverter();
    public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType);
    public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType);
    public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value);
    public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType);
  }
  public class TypeConverter {
    public TypeConverter();
    public virtual bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType);
    public bool CanConvertFrom(Type sourceType);
    public virtual bool CanConvertTo(ITypeDescriptorContext context, Type destinationType);
    public bool CanConvertTo(Type destinationType);
    public virtual object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value);
    public object ConvertFrom(object value);
    public object ConvertFromInvariantString(string text);
    public object ConvertFromString(ITypeDescriptorContext context, CultureInfo culture, string text);
    public object ConvertFromString(string text);
    public virtual object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType);
    public object ConvertTo(object value, Type destinationType);
    public string ConvertToInvariantString(object value);
    public string ConvertToString(ITypeDescriptorContext context, CultureInfo culture, object value);
    public string ConvertToString(object value);
    protected Exception GetConvertFromException(object value);
    protected Exception GetConvertToException(object value, Type destinationType);
  }
  public sealed class TypeConverterAttribute : Attribute {
    public TypeConverterAttribute(string typeName);
    public TypeConverterAttribute(Type type);
    public string ConverterTypeName { get; }
    public override bool Equals(object obj);
    public override int GetHashCode();
  }
  public sealed class TypeDescriptor {
    public static TypeConverter GetConverter(Type type);
  }
  public abstract class TypeListConverter : TypeConverter {
    protected TypeListConverter(Type[] types);
    public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType);
    public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType);
    public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value);
    public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType);
  }
  public class UInt16Converter : BaseNumberConverter {
    public UInt16Converter();
  }
  public class UInt32Converter : BaseNumberConverter {
    public UInt32Converter();
  }
  public class UInt64Converter : BaseNumberConverter {
    public UInt64Converter();
  }
}


text:
/**
 * # Question JSON data format
 *
 * Describes the data structure of the question
 *
 *      // Entire list of questions (with nesting to keep the hierarchy)
 *      [
 *          {
 *               "id" : 1,
 *               "key" : "1|9@@0",
 *               "shortcut" : "csp",
 *               "caption" : "CSP",
 *               "type" : 0,
 *               "properties" : { "caption" : "Individual" },
 *               "children": [
 *                     {
 *                         "id" : 2,
 *                         "key" : "1|10@@0",
 *                         "shortcut" : "gender",
 *                         "caption" : "Gender",
 *                         "type" : 7,
 *                         "properties" : { "caption" : "You are:" }
 *                     },
 *                     {
 *                          "id" : 3,
 *                          "key" : "1|11@@0",
 *                          "shortcut" : "age",
 *                          "caption" : "Age",
 *                          "type" : 7,
 *                          "properties" : { "caption" : "How old are you?" }
 *                     },
 *                     {
 *                           "id" : 4,
 *                           "key" : "1|12@@0",
 *                           "shortcut" : "profession",
 *                           "caption" : "Profession",
 *                           "type" : 7,
 *                           "properties" : { "caption" : "What is your socio-professional category?" }
 *                     }
 *                ]
 *          },
 *          {
 *               "id" : 10,
 *               "key" : "1|2@@0",
 *               "shortcut" : "appreciation",
 *               "caption" : "Appreciation",
 *               "type" : 7,
 *               "properties" : { "caption" : "What is your overall film's appreciation?" }
 *          }
 *      ]
 *
 *      // List of question from the profile or the search engine
 *      [
 *          {
 *               "id" : 2,
 *               "key" : "1|10@@0",
 *               "shortcut" : "gender",
 *               "caption" : "Gender",
 *               "type" : 7
 *           },
 *           {
 *                "id" : 3,
 *                "key" : "1|11@@0",
 *                "shortcut" : "age",
 *                "caption" : "Age",
 *                "type" : 7
 *           },
 *           {
 *                "id" : 4,
 *                "key" : "1|12@@0",
 *                "shortcut" : "profession",
 *                "caption" : "Profession",
 *                "type" : 7
 *           }
 *      ]
 *
 * @class askiaVista.data.question
 * @protected
 */
/**
 * Id of the question
 *
 * @member askiaVista.data.question
 * @property {Number} id
 */
/**
 * Key of the question
 *
 * @member askiaVista.data.question
 * @property {String} key
 */
/**
 * Shortcut of the question
 *
 * @member askiaVista.data.question
 * @property {String} shortcut
 */
/**
 * Caption of the question, it's the caption to display in treeview.
 *
 * The type of this caption is defined in the administration of AskiaVista.
 *
 * @member askiaVista.data.question
 * @property {String} caption
 */
/**
 * Type of the question
 *
 * Also see: askiaVista.enumerators.questionType
 *
 * @member askiaVista.data.question
 * @property {Number} type
 */
/**
 * When getting the entire list of questions, it specified the sub-questions of this question.
 *
 * @member askiaVista.data.question
 * @property {askiaVista.data.question[]} [children=null]
 */
/**
 * Responses of the question.
 *
 * It's not available when getting the entire list of questions or the search.<br />
 * It's available when getting the entire list of profiles with the verbosity option.
 *
 * @member askiaVista.data.question
 * @property {askiaVista.data.response[]} [responses=null]
 */
/**
 * Custom properties of the questions that could be used for the cross-tab queries.
 *
 * @member askiaVista.data.question
 * @property {askiaVista.data.question.properties} [properties=null]
 */

/**
 * # Question Properties JSON data format
 *
 * Describes the data structure of the question properties
 *
 *      {
 *          "caption" : "Gender",
 *          "bold"     : true,
 *          "italic"   : true,
 *          "subPopulation" : "UK",
 *          "weighting" : "Weight",
 *          "breakAfter" : true
 *      }
 *
 * @class askiaVista.data.question.properties
 * @extends askiaVista.abstracts.questionProperties
 * @protected
 */


text:
<?php

namespace Pendulage\Bundle\AccueilBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * Ohle
 *
 * @ORM\Table(name="ohle")
 * @ORM\Entity
 */
class Ohle
{
    /**
     * @var integer
     *
     * @ORM\Column(name="id_ohle", type="integer", nullable=false)
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="IDENTITY")
     */
    private $idOhle;

    /**
     * @var float
     *
     * @ORM\Column(name="MessengerWireWeight", type="float", precision=10, scale=0, nullable=false)
     */
    private $messengerwireweight;

    /**
     * @var float
     *
     * @ORM\Column(name="MessengerWireTension", type="float", precision=10, scale=0, nullable=false)
     */
    private $messengerwiretension;

    /**
     * @var float
     *
     * @ORM\Column(name="ContactWireWeight", type="float", precision=10, scale=0, nullable=false)
     */
    private $contactwireweight;

    /**
     * @var float
     *
     * @ORM\Column(name="ContactWireTension", type="float", precision=10, scale=0, nullable=false)
     */
    private $contactwiretension;

    /**
     * @var float
     *
     * @ORM\Column(name="WeightOfDropper", type="float", precision=10, scale=0, nullable=false)
     */
    private $weightofdropper;

    /**
     * @var string
     *
     * @ORM\Column(name="TypeOfOhle", type="string", length=45, nullable=false)
     */
    private $typeofohle;

    /**
     * Get idOhle
     *
     * @return integer
     */
    public function getIdOhle()
    {
        return $this->idOhle;
    }

    /**
     * Set messengerwireweight
     *
     * @param float $messengerwireweight
     * @return Ohle
     */
    public function setMessengerwireweight($messengerwireweight)
    {
        $this->messengerwireweight = $messengerwireweight;

        return $this;
    }

    /**
     * Get messengerwireweight
     *
     * @return float
     */
    public function getMessengerwireweight()
    {
        return $this->messengerwireweight;
    }

    /**
     * Set messengerwiretension
     *
     * @param float $messengerwiretension
     * @return Ohle
     */
    public function setMessengerwiretension($messengerwiretension)
    {
        $this->messengerwiretension = $messengerwiretension;

        return $this;
    }

    /**
     * Get messengerwiretension
     *
     * @return float
     */
    public function getMessengerwiretension()
    {
        return $this->messengerwiretension;
    }

    /**
     * Set contactwireweight
     *
     * @param float $contactwireweight
     * @return Ohle
     */
    public function setContactwireweight($contactwireweight)
    {
        $this->contactwireweight = $contactwireweight;

        return $this;
    }

    /**
     * Get contactwireweight
     *
     * @return float
     */
    public function getContactwireweight()
    {
        return $this->contactwireweight;
    }

    /**
     * Set contactwiretension
     *
     * @param float $contactwiretension
     * @return Ohle
     */
    public function setContactwiretension($contactwiretension)
    {
        $this->contactwiretension = $contactwiretension;

        return $this;
    }

    /**
     * Get contactwiretension
     *
     * @return float
     */
    public function getContactwiretension()
    {
        return $this->contactwiretension;
    }

    /**
     * Set weightofdropper
     *
     * @param float $weightofdropper
     * @return Ohle
     */
    public function setWeightofdropper($weightofdropper)
    {
        $this->weightofdropper = $weightofdropper;

        return $this;
    }

    /**
     * Get weightofdropper
     *
     * @return float
     */
    public function getWeightofdropper()
    {
        return $this->weightofdropper;
    }

    /**
     * Set typeofohle
     *
     * @param string $typeofohle
     * @return Ohle
     */
    public function setTypeofohle($typeofohle)
    {
        $this->typeofohle = $typeofohle;

        return $this;
    }

    /**
     * Get typeofohle
     *
     * @return string
     */
    public function getTypeofohle()
    {
        return $this->typeofohle;
    }

    public function __toString() {
        return $this->typeofohle
                ." | ".$this->messengerwireweight
                ." kg/m | ".$this->messengerwiretension
                ." N | ".$this->contactwireweight
                ." kg/m | ".$this->contactwiretension
                ." N | ".$this->weightofdropper
                ." kg"
                ;
    }

}


text:
**Installation made on OS X Yosemite 10.10.5**

I'm faded to install my dev env each times my mac is recovering.

I did a script that allows me to install all my useful software.

Today I share it with you !

# My personal backup

I have all my documents hosted on [Google Drive](https://drive.google.com) and my code on [Github](https://github.com).

I do a backup of my Mac every month using [Time Machine](http://www.apple.com/osx/apps/#timemachine) with an external hard drive.

I consider it's good to have a backup but it's better to have twice :).

## 1. Run Software Update

Make sure everything is up to date.

1. Click on the apple at the top left
2. Click on about this mac
3. Click on software update

## 2. Prerequisites [Xcode](https://developer.apple.com/xcode/) and its Command Line Tools

1. Go to the terminal and install "Command Line Tools", a little dialog box will appear

  ```sh
  xcode-select --install
  ```

2. Go to App Store and install Xcode.

### Preview of Macvim and iterm2 conf

I definitely like the colors and all the awesome stuffs. Thanks a lot to [@excid3](https://github.com/excid3) for that.

![My conf](http://f.cl.ly/items/3u3A1X2H1e3N3m150z3v/Image%202015-10-08%20at%2011.52.30%20AM.png)

## 3. Install Softwares

You can install softwares from [homebrew-cask](https://github.com/caskroom/homebrew-cask) if you like command lines or manually with a dmg files.

### What I use everyday ?

###### Browser

* [Chrome](https://www.google.com/intl/en/chrome/browser/desktop/index.html) for surfing on internet

###### Development

* [MacVim](https://github.com/b4winckler/macvim) for editing code
* [pgAdmin](http://www.pgadmin.org/download/macosx.php) for database administration
* [Postgres.app](http://postgresapp.com/) for using PostgreSQL
* [iTerm 2](http://www.iterm2.com/#/section/home) for terminal client
* [VirtualBox](https://www.virtualbox.org/wiki/Downloads) for virtual machines
* [Oh my zsh](http://ohmyz.sh/) for pretty terminal
* [Heroku](https://toolbelt.heroku.com/osx) for deploying app easily
* [Github](https://github.com/) for hosting code

###### App Store

* [Caffeine](https://itunes.apple.com/us/app/caffeine/id411246225?l=en&mt=12) for keeping Mac awake
* [Slack](https://itunes.apple.com/us/app/slack/id803453959?l=en&mt=12) for communication with your team
* [ScreenFlow](https://itunes.apple.com/us/app/screenflow-5/id917790450?l=en&mt=12) for screencast recording
* [Navicat](https://itunes.apple.com/us/app/navicat-data-modeler-essentials/id532423082?l=en&mt=12) for data modeling
* [Twitter](https://itunes.apple.com/us/app/twitter/id409789998?l=en&mt=12) for keeping update
* [Skitch](https://itunes.apple.com/us/app/skitch-snap.-mark-up.-share./id425955336?l=en&mt=12) for productivity
* [Keynote](https://itunes.apple.com/us/app/keynote/id409183694?l=en&mt=12) for presentations
* [Pages](https://itunes.apple.com/us/app/pages/id409201541?l=en&mt=12) for documents
* [Numbers](https://itunes.apple.com/us/app/numbers/id409203825?l=en&mt=12) for excel

###### Workflow

* [Alfred](http://www.alfredapp.com/) for workflow automation
* [Dash](https://kapeli.com/dash) a local documentation
* [1Password](https://1password.com/) a password manager
* [Pocket](https://getpocket.com/) read something later
* [Screenhero](https://screenhero.com/) remote pair programming
* [Skype](http://www.skype.com/en/) for international calls
* [VLC](http://www.videolan.org/vlc/download-macosx.html) for videos watching
* [uTorrent](http://www.utorrent.com/intl/fr/) for torrent download
* [Android File Transfert](https://www.android.com/filetransfer/) for android on Mac
* [SizeUp](http://www.irradiatedsoftware.com/sizeup/) for window management
* [Spectable](https://www.spectacleapp.com/) for window management
* [iStat Menus](https://bjango.com/mac/istatmenus/) for monitoring system
* [Flux](https://justgetflux.com/) for resting your eyes
* [Unified Remote](https://www.unifiedremote.com/download) for remote control of your Mac
* [Wireshark](https://www.wireshark.org/#download) for network analysis
* [XQuartz](http://xquartz.macosforge.org/landing/) for using Wireshark compatibility on Yosemite
* [POP](https://popapp.in/) for prototyping on paper
* [Namecheap](https://www.namecheap.com/) for buying domain name
* [Facturation Pro](https://www.facturation.pro) for billing
* [User Voice](https://www.uservoice.com/) for listening your customers
* [Intercom](https://www.intercom.io/) for communication with your customers
* [Typeform](http://www.typeform.com/) for beautiful form
* [Wufoo](http://www.wufoo.com/) form for getting feedback
* [Appear](https://appear.in/) for video conversations
* [Rubular](http://rubular.com/) for ruby regex
* [Strfti](http://www.strfti.me/) for format dates and times
* [Polymail](https://polymail.io/) email client
* [Monosnap](https://monosnap.com/welcome) taking screenshots and more
* [NordVPN](https://nordvpn.com/fr/) vpn client
* [Quiver](http://happenapps.com/#quiver) the programmer's notebook
* [Unetbootin](https://unetbootin.github.io/) to create bootable live
  usb
* [UnRarX](http://www.unrarx.com/) to unrar
* [Zoiper](https://www.zoiper.com/en) VoIP client
* [X-Lite](http://www.counterpath.com/x-lite/) VoIP client
* [Kodi](https://kodi.tv/) a media center
* [Whatsapp](https://www.whatsapp.com/) messaging app
* [Spotify](https://www.spotify.com) music everywhere
* [Tor](https://www.torproject.org/) anonymous online

###### 🌱  Growth

* [GoRails](https://gorails.com) Rails screencasts about new features
* [Upcase](https://thoughtbot.com/upcase) Screencasts
* [Destroyallsoftware](https://www.destroyallsoftware.com) deep dive

## 4. Set up Ruby on Rails for Yosemite 10.10

1. You can find more informations about the following installation here : [Go Rails Setup] (https://gorails.com/setup/osx/10.10-yosemite)
2. This will install and configure : git, ssh key on github, homebrew, iterm2, brew-cask, google-chrome, rbenv (ruby version manager), ruby, postgreSQL, rails, alfred, some tools for quicklook and oh-my-zsh.
3. Get an internet connection
4. Go to your terminal and execute the script :

```sh
./setup_dev_osx.sh
```

## 5. Install Dotfiles from [Excid3](https://github.com/excid3/dotfiles)

I love [@exci3d](https://github.com/excid3/dotfiles) conf, and I recommend people to use it if they want to improve their productivity.

0. Go [here](https://github.com/excid3/dotfiles)
1. Click on Download ZIP
2. Copy and paste the 3 files inside the vim directory at the root of your environment
3. Open Iterm, Click on Preferences ➜ General ➜ Load preferences from a custom folder ➜ Import profile.itermcolors inside iterm directory
4. Go to zsh directory ➜ Go to themes ➜ Copy the excid3.zsh-theme inside ~/.oh-my-zsh/themes/
5. Go to zsh directory ➜ Copy zshrc content instead of your ~/.zshrc
6. Copy the gemrc inside your ~/.gem/

## 6. Enjoy and configure as you wish

Don't hesitate to contribute :)


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Engine
{
    public static class Revenues
    {
        public static decimal Revenue(decimal sum)
        {
            return sum * 4;
        }
    }
}


text:
package org.wso2.carbon.social.cassandra.summarizer;

import com.google.gson.JsonObject;
import org.wso2.carbon.social.core.Activity;

import java.util.Map;

public interface Summarizer {

    boolean add(Activity activity);

    void summarize(JsonObject root, Map<String, Activity> activities);
}


text:
if [ -f /var/log/messages ]; then
    echo "/var/log/messages exists."
fi
#   Check if file does not exist.
if [ ! -f /var/log/messages ]; then
    touch /var/log/messages
fi

#   Check if dir exists.
if [ -d "$HOME/.ssh" ]; then
    echo "$HOME/.ssh exists."
fi
#   Check if dir does not exist.
if [ ! -d "$HOME/.ssh" ]; then
    mkdir "$HOME/.ssh"
fi

#   Else example.
REMOTE='origin'
if [[ ! -z $4 ]]; then
    echo -e "Option detected : ${REMOTE} will be pushed to."
    REMOTE=$4
else
    echo -e "Default remote ${REMOTE} will be pushed to."
fi


text:
const createQuery = require('./create-query');
const regexpEscape = require('./regexp-escape');

jest.mock('./regexp-escape');
regexpEscape.mockReturnValue('test');

describe('Create query', () => {
  it('should return a query object for gene field', () => {
    const searchString = '^test$';
    const re = new RegExp(searchString, 'i');
    const expected = {
      $or: [
        { gene: { $regex: re } },
        { synonyms: re },
        { geneAlternateSymbols: re },
      ],
    };
    expect(createQuery('gene', 'test')).toEqual(expected);
  });

  it('should return a query object for non gene field', () => {
    const expected = {
      uniprot: 'test',
    };
    expect(createQuery('uniprot', 'test')).toEqual(expected);
  });
});


text:
package edu.gemini.model.p1.targetio.impl

import edu.gemini.model.p1.immutable.SiderealTarget

import edu.gemini.model.p1.targetio.table.Readers._
import edu.gemini.model.p1.targetio.table.Serializers._
import edu.gemini.model.p1.targetio.table.{Column, StilSerializer}
import edu.gemini.spModel.core.{MagnitudeBand, Magnitude}

private [targetio] object SiderealColumns {
  val NAME   = col("Name",     readString,         _.name)
  val RA     = col("RAJ2000",  readRa,             a => Some(a.coords.ra))
  val DEC    = col("DecJ2000", readDec,            a => Some(a.coords.dec))
  val PM_RA  = col("pmRA",     readOptionalDouble, _.properMotion.map(_.deltaRA))
  val PM_DEC = col("pmDec",    readOptionalDouble, _.properMotion.map(_.deltaDec))

  val REQUIRED: List[Column[SiderealTarget, _]] = List(NAME, RA, DEC)

  private def extractMagValue[T](target: SiderealTarget, band: MagnitudeBand, f: Magnitude => T): Option[T] =
    target.magnitudes.find(_.band == band).map(f(_))

  def magnitude(band: MagnitudeBand) =
    col(band.name, readOptionalMagnitude(band), target => extractMagValue(target, band, identity))

  def magnitudeSystem(band: MagnitudeBand) =
    col("%s_sys".format(band.name), readOptionalSystem(band), target => extractMagValue(target, band, _.system))

  private def col[T](name: String, parse: PartialFunction[Any, T], extract: SiderealTarget => T)(implicit serializer: StilSerializer[T]) =
    Column[SiderealTarget, T](name, parse, extract, serializer)
}


text:
Inspections  Open source

  Name

     public method void getPlayerTurns()

  Location

     class MainController
(application)

  Problem synopsis

Can be package local (at line 314)


text:
/* jshint camelcase:false */
/* globals Creature,CreatureAnimation,CreatureManager */
/**
* @author       Richard Davey <rich@photonstorm.com>
* @author       Kestrel Moon Studios <creature@kestrelmoon.com>
* @copyright    2016 Photon Storm Ltd and Kestrel Moon Studios
* @license      {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/

/**
 * @class CreatureShader
 * @constructor
 * @param gl {WebGLContext} the current WebGL drawing context
 */
PIXI.CreatureShader = function(gl)
{
  /**
   * @property _UID
   * @type Number
   * @private
   */
  this._UID = Phaser._UID++;

  /**
   * @property gl
   * @type WebGLContext
   */
  this.gl = gl;

  /**
   * The WebGL program.
   * @property program
   * @type Any
   */
  this.program = null;

  /**
   * The fragment shader.
   * @property fragmentSrc
   * @type Array
   */
  this.fragmentSrc = [
    '//CreatureShader Fragment Shader.',
    'precision mediump float;',
    'varying vec2 vTextureCoord;',
    'varying float vTextureIndex;',
    'varying vec4 vColor;',
    //'uniform float alpha;',
    //'uniform vec3 tint;',
    'uniform sampler2D uSampler;',
    'void main(void) {',
    '   gl_FragColor = texture2D(uSampler, vTextureCoord) * vColor;',
    '}'
  ];

  /**
   * The vertex shader.
   * @property vertexSrc
   * @type Array
   */
  this.vertexSrc  = [
    '//CreatureShader Vertex Shader.',
    'attribute vec2 aVertexPosition;',
    'attribute vec2 aTextureCoord;',
    'attribute float aTextureIndex;',
    'uniform mat3 translationMatrix;',
    'uniform vec2 projectionVector;',
    'uniform vec2 offsetVector;',
    'uniform float alpha;',
    'uniform vec3 tint;',
    'varying vec2 vTextureCoord;',
    'varying float vTextureIndex;',
    'varying vec4 vColor;',

    'void main(void) {',
    '   vec3 v = translationMatrix * vec3(aVertexPosition , 1.0);',
    '   v -= offsetVector.xyx;',
    '   gl_Position = vec4( v.x / projectionVector.x -1.0, v.y / -projectionVector.y + 1.0 , 0.0, 1.0);',
    '   vTextureCoord = aTextureCoord;',
    '   vTextureIndex = aTextureIndex;',
    '   vColor = vec4(tint[0], tint[1], tint[2], 1.0) * alpha;',
    '}'
  ];

  this.init();
};

PIXI.CreatureShader.prototype.constructor = PIXI.CreatureShader;

/**
 * Initialises the shader.
 *
 * @method PIXI.CreatureShader#init
 */
PIXI.CreatureShader.prototype.init = function()
{
  var gl = this.gl;
  var program = PIXI.compileProgram(gl, this.vertexSrc, this.fragmentSrc);
  gl.useProgram(program);

  // get and store the uniforms for the shader
  this.uSampler = PIXI._enableMultiTextureToggle ?
    gl.getUniformLocation(program, 'uSamplerArray[0]') :
    gl.getUniformLocation(program, 'uSampler');

  this.projectionVector = gl.getUniformLocation(program, 'projectionVector');
  this.offsetVector = gl.getUniformLocation(program, 'offsetVector');
  this.colorAttribute = gl.getAttribLocation(program, 'aColor');
  this.aTextureIndex = gl.getAttribLocation(program, 'aTextureIndex');
  //this.dimensions = gl.getUniformLocation(this.program, 'dimensions');

  // get and store the attributes
  this.aVertexPosition = gl.getAttribLocation(program, 'aVertexPosition');
  this.aTextureCoord = gl.getAttribLocation(program, 'aTextureCoord');

  this.attributes = [this.aVertexPosition, this.aTextureCoord, this.aTextureIndex];

  this.translationMatrix = gl.getUniformLocation(program, 'translationMatrix');
  this.alpha = gl.getUniformLocation(program, 'alpha');
  this.tintColor = gl.getUniformLocation(program, 'tint');

  this.program = program;
};

/**
 * Destroys the shader.
 *
 * @method PIXI.CreatureShader#destroy
 */
PIXI.CreatureShader.prototype.destroy = function() {
  this.gl.deleteProgram(this.program);
  this.uniforms = null;
  this.gl = null;

  this.attribute = null;
};

/**
* Creature is a custom Game Object used in conjunction with the Creature Runtime libraries by Kestrel Moon Studios.
*
* It allows you to display animated Game Objects that were created with the [Creature Automated Animation Tool](http://www.kestrelmoon.com/creature/).
*
* Note 1: You can only use Phaser.Creature objects in WebGL enabled games. They do not work in Canvas mode games.
*
* Note 2: You must use a build of Phaser that includes the CreatureMeshBone.js runtime and gl-matrix.js, or have them
* loaded before your Phaser game boots.
*
* See the Phaser custom build process for more details.
*
* By default the Creature runtimes are NOT included in any pre-configured version of Phaser.
*
* So you'll need to do `grunt custom` to create a build that includes them.
*
* @class Phaser.Creature
* @extends PIXI.DisplayObjectContainer
* @extends Phaser.Component.Core
* @extends Phaser.Component.Angle
* @extends Phaser.Component.AutoCull
* @extends Phaser.Component.BringToTop
* @extends Phaser.Component.Destroy
* @extends Phaser.Component.FixedToCamera
* @extends Phaser.Component.LifeSpan
* @extends Phaser.Component.Reset
* @extends Phaser.Component.InputEnabled
* @constructor
* @param {Phaser.Game} game - A reference to the currently running game.
* @param {number} x - The x coordinate of the Game Object. The coordinate is relative to any parent container this Game Object may be in.
* @param {number} y - The y coordinate of the Game Object. The coordinate is relative to any parent container this Game Object may be in.
* @param {string|PIXI.Texture} key - The texture used by the Creature Object during rendering. It can be a string which is a reference to the Cache entry, or an instance of a PIXI.Texture.
* @param {string} mesh - The mesh data for the Creature Object. It should be a string which is a reference to the Cache JSON entry.
* @param {string} [animation='default'] - The animation within the mesh data  to play.
*/
Phaser.Creature = function (game, x, y, key, mesh, animation, loadAnchors) {

    /**
     * @property {Phaser.Game} game - A reference to the currently running game.
     */
    this.game = game;

    if (animation === undefined) { animation = 'default'; }

    /**
    * @property {number} type - The const type of this object.
    * @readonly
    */
    this.type = Phaser.CREATURE;

    if (!game.cache.checkJSONKey(mesh))
    {
        console.warn('Phaser.Creature: Invalid mesh key given. Not found in Phaser.Cache');
        return;
    }

    var meshData = game.cache.getJSON(mesh);

    /**
    * @property {Creature} _creature - The Creature instance.
    * @private
    */
    this._creature = new Creature(meshData, loadAnchors);

    /**
    * @property {CreatureAnimation} animation - The CreatureAnimation instance.
    */
    this.animation = new CreatureAnimation(meshData, animation, this._creature);

    /**
    * @property {CreatureManager} manager - The CreatureManager instance for this object.
    */
    this.manager = new CreatureManager(this._creature);

    /**
    * @property {number} timeDelta - How quickly the animation advances.
    * @default
    */
    this.timeDelta = 0.05;

    if (typeof key === 'string')
    {
        var texture = new PIXI.Texture(game.cache.getBaseTexture(key));
    }
    else
    {
        var texture = key;
    }

    /**
    * @property {PIXI.Texture} texture - The texture the animation is using.
    */
    this.texture = texture;

    PIXI.DisplayObjectContainer.call(this);

    this.dirty = true;
    this.blendMode = PIXI.blendModes.NORMAL;

    /**
    * @property {Phaser.Point} creatureBoundsMin - The minimum bounds point.
    * @protected
    */
    this.creatureBoundsMin = new Phaser.Point();

    /**
    * @property {Phaser.Point} creatureBoundsMax - The maximum bounds point.
    * @protected
    */
    this.creatureBoundsMax = new Phaser.Point();

    var target = this.manager.target_creature;

    /**
    * @property {Float32Array} vertices - The vertices data.
    * @protected
    */
    this.vertices = new Float32Array(target.total_num_pts * 2);

    /**
    * @property {Float32Array} uvs - The UV data.
    * @protected
    */
    this.uvs = new Float32Array(target.total_num_pts * 2);

    /**
    * @property {Uint16Array} indices
    * @protected
    */
    this.indices = new Uint16Array(target.global_indices.length);

    for (var i = 0; i < this.indices.length; i++)
    {
        this.indices[i] = target.global_indices[i];
    }

    /**
    * @property {Uint16Array} colors - The vertices colors
    * @protected
    */
    this.colors = new Float32Array([1, 1, 1, 1]);

    this.updateRenderData(target.global_pts, target.global_uvs);

    this.manager.AddAnimation(this.animation);
    this.manager.SetActiveAnimationName(animation, false);

    Phaser.Component.Core.init.call(this, game, x, y);

    /**
    * @property {number} tint - colour change
    * @default
    */
    this.data.tint = 0xFFFFFF;

    /**
    * @property {number} alpha - set the opacity
    * @default
    */
    this.data.alpha = 1.0;

};

Phaser.Creature.prototype = Object.create(PIXI.DisplayObjectContainer.prototype);
Phaser.Creature.prototype.constructor = Phaser.Creature;

Phaser.Component.Core.install.call(Phaser.Creature.prototype, [
    'Angle',
    'AutoCull',
    'BringToTop',
    'Destroy',
    'FixedToCamera',
    'LifeSpan',
    'Reset',
    'InputEnabled'
]);

Phaser.Creature.prototype.preUpdateInWorld = Phaser.Component.InWorld.preUpdate;
Phaser.Creature.prototype.preUpdateCore = Phaser.Component.Core.preUpdate;

/**
* Automatically called by World.preUpdate.
*
* @method Phaser.Creature#preUpdate
* @memberof Phaser.Creature
*/
Phaser.Creature.prototype.preUpdate = function () {

    if (!this.preUpdateInWorld())
    {
        return false;
    }

    this.manager.Update(this.timeDelta);

    this.updateData();

    return this.preUpdateCore();

};

/**
*
*
* @method Phaser.Creature#_initWebGL
* @memberof Phaser.Creature
* @private
*/
Phaser.Creature.prototype._initWebGL = function (renderSession) {

    // build the strip!
    var gl = renderSession.gl;

    this._vertexBuffer = gl.createBuffer();
    this._indexBuffer = gl.createBuffer();
    this._uvBuffer = gl.createBuffer();
    this._colorBuffer = gl.createBuffer();

    gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer);
    gl.bufferData(gl.ARRAY_BUFFER, this.vertices, gl.DYNAMIC_DRAW);

    gl.bindBuffer(gl.ARRAY_BUFFER, this._uvBuffer);
    gl.bufferData(gl.ARRAY_BUFFER,  this.uvs, gl.DYNAMIC_DRAW);

    gl.bindBuffer(gl.ARRAY_BUFFER, this._colorBuffer);
    gl.bufferData(gl.ARRAY_BUFFER, this.colors, gl.STATIC_DRAW);

    gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer);
    gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this.indices, gl.STATIC_DRAW);

};

/**
* @method Phaser.Creature#_renderWebGL
* @memberof Phaser.Creature
* @private
*/
Phaser.Creature.prototype._renderWebGL = function (renderSession) {

    //  If the sprite is not visible or the alpha is 0 then no need to render this element
    if (!this.visible || this.alpha <= 0)
    {
        return;
    }

    renderSession.spriteBatch.stop();

    // init! init!
    if (!this._vertexBuffer)
    {
        this._initWebGL(renderSession);
    }

    renderSession.shaderManager.setShader(renderSession.shaderManager.creatureShader);

    this._renderCreature(renderSession);

    renderSession.spriteBatch.start();

};

/**
* @method Phaser.Creature#_renderCreature
* @memberof Phaser.Creature
* @private
*/
Phaser.Creature.prototype._renderCreature = function (renderSession) {

    var gl = renderSession.gl;

    var projection = renderSession.projection;
    var offset = renderSession.offset;
    var shader = renderSession.shaderManager.creatureShader;

    renderSession.blendModeManager.setBlendMode(this.blendMode);

    //  Set uniforms
    gl.uniformMatrix3fv(shader.translationMatrix, false, this.worldTransform.toArray(true));
    gl.uniform2f(shader.projectionVector, projection.x, -projection.y);
    gl.uniform2f(shader.offsetVector, -offset.x, -offset.y);
    gl.uniform1f(shader.alpha, this.worldAlpha);
    gl.uniform3fv(shader.tintColor, Phaser.Color.hexToRGBArray(this.tint));
    gl.uniform1f(shader.alpha, this.alpha);

    if (!this.dirty)
    {
        gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer);
        gl.bufferSubData(gl.ARRAY_BUFFER, 0, this.vertices);
        gl.vertexAttribPointer(shader.aVertexPosition, 2, gl.FLOAT, false, 0, 0);

        //  Update the uvs
        gl.bindBuffer(gl.ARRAY_BUFFER, this._uvBuffer);
        gl.vertexAttribPointer(shader.aTextureCoord, 2, gl.FLOAT, false, 0, 0);

        gl.activeTexture(gl.TEXTURE0);

        //  Check if a texture is dirty..
        if (this.texture.baseTexture._dirty[gl.id])
        {
            renderSession.renderer.updateTexture(this.texture.baseTexture);
        }
        else
        {
            //  Bind the current texture
            gl.bindTexture(gl.TEXTURE_2D, this.texture.baseTexture._glTextures[gl.id]);
        }

        //  Don't need to upload!
        gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer);
    }
    else
    {
        this.dirty = false;

        gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer);
        gl.bufferData(gl.ARRAY_BUFFER, this.vertices, gl.DYNAMIC_DRAW);
        gl.vertexAttribPointer(shader.aVertexPosition, 2, gl.FLOAT, false, 0, 0);

        //  Update the uvs
        gl.bindBuffer(gl.ARRAY_BUFFER, this._uvBuffer);
        gl.bufferData(gl.ARRAY_BUFFER, this.uvs, gl.DYNAMIC_DRAW);
        gl.vertexAttribPointer(shader.aTextureCoord, 2, gl.FLOAT, false, 0, 0);

        gl.activeTexture(gl.TEXTURE0);

        //  Check if a texture is dirty
        if (this.texture.baseTexture._dirty[gl.id])
        {
            renderSession.renderer.updateTexture(this.texture.baseTexture);
        }
        else
        {
            gl.bindTexture(gl.TEXTURE_2D, this.texture.baseTexture._glTextures[gl.id]);
        }

        //  Don't need to upload!
        gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer);
        gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, this.indices, gl.STATIC_DRAW);
    }

    gl.drawElements(gl.TRIANGLES, this.indices.length, gl.UNSIGNED_SHORT, 0);

};

/**
* @method Phaser.Creature#updateCreatureBounds
* @memberof Phaser.Creature
* @private
*/
Phaser.Creature.prototype.updateCreatureBounds = function () {

    //  Update bounds based off world transform matrix
    var target = this.manager.target_creature;

    target.ComputeBoundaryMinMax();

    this.creatureBoundsMin.set(target.boundary_min[0], -target.boundary_min[1]);
    this.creatureBoundsMax.set(target.boundary_max[0], -target.boundary_max[1]);

    this.worldTransform.apply(this.creatureBoundsMin, this.creatureBoundsMin);
    this.worldTransform.apply(this.creatureBoundsMax, this.creatureBoundsMax);

};

/**
* @method Phaser.Creature#updateData
* @memberof Phaser.Creature
* @private
*/
Phaser.Creature.prototype.updateData = function () {

    var target = this.manager.target_creature;

    var read_pts = target.render_pts;
    var read_uvs = target.global_uvs;

    this.updateRenderData(read_pts, read_uvs);
    this.updateCreatureBounds();

    this.dirty = true;

};

/**
* @method Phaser.Creature#updateRenderData
* @memberof Phaser.Creature
* @private
*/
Phaser.Creature.prototype.updateRenderData = function (verts, uvs) {

    var target = this.manager.target_creature;

    var pt_index = 0;
    var uv_index = 0;

    var write_pt_index = 0;

    for (var i = 0; i < target.total_num_pts; i++)
    {
        this.vertices[write_pt_index] = verts[pt_index];
        this.vertices[write_pt_index + 1] = -verts[pt_index + 1];

        this.uvs[uv_index] = uvs[uv_index];
        this.uvs[uv_index + 1] = uvs[uv_index + 1];

        pt_index += 3;
        uv_index += 2;

        write_pt_index += 2;
    }

};

/**
* Sets the Animation this Creature object will play, as defined in the mesh data.
*
* @method Phaser.Creature#setAnimation
* @memberof Phaser.Creature
* @param {string} key - The key of the animation to set, as defined in the mesh data.
*/
Phaser.Creature.prototype.setAnimation = function (key) {

    this.data.anchorY = null;
    this.data.anchorX = null;
    this.data.animation = key;
    this.manager.SetActiveAnimationName(key, true);

};

/**
 * Sets the animation playback speed
 *
 * @method Phaser.Creature#setAnimationPlaySpeed
 * @memberof Phaser.Creature
 * @param {number} speed - Sets the playback speed
 */
Phaser.Creature.prototype.setAnimationPlaySpeed = function (speed) {

  if (speed) {
    this.timeDelta = speed;
  }

};

/**
* Plays the currently set animation.
*
* @method Phaser.Creature#play
* @memberof Phaser.Creature
* @param {boolean} [loop=false] - Should the animation loop?
*/
Phaser.Creature.prototype.play = function (loop) {

    if (loop === undefined) { loop = false; }

    this.loop = loop;

    this.manager.SetIsPlaying(true);
    this.manager.RunAtTime(0);

};

/**
* Stops the currently playing animation.
*
* @method Phaser.Creature#stop
* @memberof Phaser.Creature
*/
Phaser.Creature.prototype.stop = function () {

    this.manager.SetIsPlaying(false);

};

/**
* @name Phaser.Creature#isPlaying
* @property {boolean} isPlaying - Is the _current_ animation playing?
*/
Object.defineProperty(Phaser.Creature.prototype, 'isPlaying', {

    get: function() {

        return this.manager.GetIsPlaying();

    },

    set: function(value) {

        this.manager.SetIsPlaying(value);

    }

});

/**
* @name Phaser.Creature#loop
* @property {boolean} loop - Should the _current_ animation loop or not?
*/
Object.defineProperty(Phaser.Creature.prototype, 'loop', {

    get: function() {

        return this.manager.should_loop;

    },

    set: function(value) {

        this.manager.SetShouldLoop(value);

    }

});

/**
 * @name Phaser.Creature#height
 * @property {number} height - Sets the height of the animation
 */
Object.defineProperty(Phaser.Creature.prototype, 'height', {

  get: function() {

    return this.data.height;

  },

  set: function(value) {

    var target = this.manager.target_creature;

    var width = this.data.width ? this.data.width : 0;

    var values = target.GetPixelScaling(width, value);
    this.scale.set(values[0], values[1]);
    this.data.height = value;

  }

});

/**
 * @name Phaser.Creature#width
 * @property {number} width - Sets the width of the animation
 */
Object.defineProperty(Phaser.Creature.prototype, 'width', {

  get: function() {

    return this.data.width;

  },

  set: function(value) {

    var target = this.manager.target_creature;

    var height = this.data.height ? this.data.height : 0;

    var values = target.GetPixelScaling(value, height);
    this.scale.set(values[0], values[1]);
    this.data.width = value;

  }

});

/**
 * @name Phaser.Creature#anchorX
 * @property {number} anchorX - Sets the anchorX of the animation
 */
Object.defineProperty(Phaser.Creature.prototype, 'anchorX', {

  get: function() {

    return this.data.anchorX;

  },

  set: function(value) {

    if (value === 0) {
        value = 0.01;
    }

    if (value === 1) {
        value = 0.99;
    }

    if (value === this.data.anchorX) {
        return;
    }

    var target = this.manager.target_creature;

    this.stop();
    this.manager.RunAtTime(0);

    if (this.data.anchorX) {
      target.SetAnchorPoint(-this.data.anchorX, null, this.data.animation);

        this.play(true);
        this.stop();
        this.manager.RunAtTime(0);
    }

    target.SetAnchorPoint(value, null, this.data.animation);
    this.play(true);

    this.data.anchorX = value;
  }

});

/**
 * @name Phaser.Creature#anchorY
 * @property {number} anchorY - Sets the anchorY of the animation
 */
Object.defineProperty(Phaser.Creature.prototype, 'anchorY', {

  get: function() {

    return this.data.anchorY;

  },

  set: function(value) {

    if (value === 0) {
        value = 0.01;
    }

    if (value === 1) {
        value = 0.99;
    }

    if (value === this.data.anchorY) {
        return;
    }

    var target = this.manager.target_creature;

    this.stop();
    this.manager.RunAtTime(0);

    if (this.data.anchorY) {
        target.SetAnchorPoint(null, -this.data.anchorY, this.data.animation);

        this.play(true);
        this.stop();
        this.manager.RunAtTime(0);
    }

    target.SetAnchorPoint(null, value, this.data.animation);
    this.play(true);

    this.data.anchorY = value;
  }

});

/**
 * @name Phaser.Creature#tint
 * @property {number} tint - Sets the colour tint
 */
Object.defineProperty(Phaser.Creature.prototype, 'tint', {

  get: function() {

    return this.data.tint;

  },

  set: function(value) {

    this.data.tint = value;
  }

});

/**
 * @name Phaser.Creature#alpha
 * @property {number} alpha - Sets the opacity
 */
Object.defineProperty(Phaser.Creature.prototype, 'alpha', {

  get: function() {

    return this.data.alpha;

  },

  set: function(value) {

    this.data.alpha = value;
  }

});

/**
* Sets whether anchor point transformations are active.
*
* @method Phaser.Creature#setAnchorPointEnabled
* @memberof Phaser.Creature
*/
Phaser.Creature.prototype.setAnchorPointEnabled = function(value) {
  var target = this.manager.target_creature;
  target.SetAnchorPointEnabled(value);
};

/**
* @method Phaser.Creature#createAllAnimations
* @memberof Phaser.Creature
*/
Phaser.Creature.prototype.createAllAnimations = function (mesh) {

    if (!this.game.cache.checkJSONKey(mesh))
    {
        console.warn('Phaser.Creature: Invalid mesh key given. Not found in Phaser.Cache');
        return;
    }

    var meshData = this.game.cache.getJSON(mesh);

    this.manager.CreateAllAnimations(meshData);
};