text:
<?php

/**
 *
 * @package CRM
 * @copyright CiviCRM LLC (c) 2004-2015
 * $Id$
 *
 */
class CRM_Mailing_BAO_Query {

  static $_mailingFields = NULL;

  /**
   * @return array|null
   */
  public static function &getFields() {
    if (!self::$_mailingFields) {
      self::$_mailingFields = array();
      $_mailingFields['mailing_id'] = array(
        'name' => 'mailing_id',
        'title' => 'Mailing ID',
        'where' => 'civicrm_mailing.id',
      );
    }
    return self::$_mailingFields;
  }

  /**
   * If mailings are involved, add the specific Mailing fields
   *
   * @param $query
   *
   * @return void
   */
  public static function select(&$query) {
    // if Mailing mode add mailing id
    if ($query->_mode & CRM_Contact_BAO_Query::MODE_MAILING) {
      $query->_select['mailing_id'] = "civicrm_mailing.id as mailing_id";
      $query->_element['mailing_id'] = 1;

      // base table is contact, so join recipients to it
      $query->_tables['civicrm_mailing_recipients'] = $query->_whereTables['civicrm_mailing_recipients']
        = " INNER JOIN civicrm_mailing_recipients ON civicrm_mailing_recipients.contact_id = contact_a.id ";

      $query->_tables['civicrm_mailing'] = $query->_whereTables['civicrm_mailing'] = 1;

      // get mailing name
      if (!empty($query->_returnProperties['mailing_name'])) {
        $query->_select['mailing_name'] = "civicrm_mailing.name as mailing_name";
        $query->_element['mailing_name'] = 1;
      }

      // get mailing subject
      if (!empty($query->_returnProperties['mailing_subject'])) {
        $query->_select['mailing_subject'] = "civicrm_mailing.subject as mailing_subject";
        $query->_element['mailing_subject'] = 1;
      }

      // get mailing status
      if (!empty($query->_returnProperties['mailing_job_status'])) {
        $query->_tables['civicrm_mailing_job'] = $query->_whereTables['civicrm_mailing_job']
          = " LEFT JOIN civicrm_mailing_job ON civicrm_mailing_job.mailing_id = civicrm_mailing.id AND civicrm_mailing_job.parent_id IS NULL AND civicrm_mailing_job.is_test != 1 ";
        $query->_select['mailing_job_status'] = "civicrm_mailing_job.status as mailing_job_status";
        $query->_element['mailing_job_status'] = 1;
      }

      // get email on hold
      if (!empty($query->_returnProperties['email_on_hold'])) {
        $query->_select['email_on_hold'] = "recipient_email.on_hold as email_on_hold";
        $query->_element['email_on_hold'] = 1;
        $query->_tables['recipient_email'] = $query->_whereTables['recipient_email'] = 1;
      }

      // get recipient email
      if (!empty($query->_returnProperties['email'])) {
        $query->_select['email'] = "recipient_email.email as email";
        $query->_element['email'] = 1;
        $query->_tables['recipient_email'] = $query->_whereTables['recipient_email'] = 1;
      }

      // get user opt out
      if (!empty($query->_returnProperties['contact_opt_out'])) {
        $query->_select['contact_opt_out'] = "contact_a.is_opt_out as contact_opt_out";
        $query->_element['contact_opt_out'] = 1;
      }

      // mailing job end date / completed date
      if (!empty($query->_returnProperties['mailing_job_end_date'])) {
        $query->_tables['civicrm_mailing_job'] = $query->_whereTables['civicrm_mailing_job']
          = " LEFT JOIN civicrm_mailing_job ON civicrm_mailing_job.mailing_id = civicrm_mailing.id AND civicrm_mailing_job.parent_id IS NULL AND civicrm_mailing_job.is_test != 1 ";
        $query->_select['mailing_job_end_date'] = "civicrm_mailing_job.end_date as mailing_job_end_date";
        $query->_element['mailing_job_end_date'] = 1;
      }

      if (!empty($query->_returnProperties['mailing_recipients_id'])) {
        $query->_select['mailing_recipients_id'] = " civicrm_mailing_recipients.id as mailing_recipients_id";
        $query->_element['mailing_recipients_id'] = 1;
      }
    }
  }

  /**
   * @param $query
   */
  public static function where(&$query) {
    $grouping = NULL;
    foreach (array_keys($query->_params) as $id) {
      if (empty($query->_params[$id][0])) {
        continue;
      }
      if (substr($query->_params[$id][0], 0, 8) == 'mailing_') {
        if ($query->_mode == CRM_Contact_BAO_QUERY::MODE_CONTACTS) {
          $query->_useDistinct = TRUE;
        }
        $grouping = $query->_params[$id][3];
        self::whereClauseSingle($query->_params[$id], $query);
      }
    }
  }

  /**
   * @param string $name
   * @param $mode
   * @param $side
   *
   * @return null|string
   */
  public static function from($name, $mode, $side) {
    $from = NULL;

    switch ($name) {
      case 'civicrm_mailing_recipients':
        $from = " $side JOIN civicrm_mailing_recipients ON civicrm_mailing_recipients.contact_id = contact_a.id";
        break;

      case 'civicrm_mailing_event_queue':
        // this is tightly binded so as to do a check WRT actual job recipients ('child' type jobs)
        $from = " INNER JOIN civicrm_mailing_event_queue ON
          civicrm_mailing_event_queue.contact_id = civicrm_mailing_recipients.contact_id
          AND civicrm_mailing_event_queue.job_id = civicrm_mailing_job.id AND civicrm_mailing_job.job_type = 'child'";
        break;

      case 'civicrm_mailing':
        $from = " $side JOIN civicrm_mailing ON civicrm_mailing.id = civicrm_mailing_recipients.mailing_id ";
        break;

      case 'civicrm_mailing_job':
        $from = " $side JOIN civicrm_mailing_job ON civicrm_mailing_job.mailing_id = civicrm_mailing.id AND civicrm_mailing_job.is_test != 1 ";
        break;

      case 'civicrm_mailing_event_bounce':
      case 'civicrm_mailing_event_delivered':
      case 'civicrm_mailing_event_opened':
      case 'civicrm_mailing_event_reply':
      case 'civicrm_mailing_event_unsubscribe':
      case 'civicrm_mailing_event_forward':
      case 'civicrm_mailing_event_trackable_url_open':
        $from = " $side JOIN $name ON $name.event_queue_id = civicrm_mailing_event_queue.id";
        break;

      case 'recipient_email':
        $from = " $side JOIN civicrm_email recipient_email ON recipient_email.id = civicrm_mailing_recipients.email_id";
        break;
    }

    return $from;
  }

  /**
   * @param $mode
   * @param bool $includeCustomFields
   *
   * @return array|null
   */
  public static function defaultReturnProperties(
    $mode,
    $includeCustomFields = TRUE
  ) {

    $properties = NULL;
    if ($mode & CRM_Contact_BAO_Query::MODE_MAILING) {
      $properties = array(
        'mailing_id' => 1,
        'mailing_name' => 1,
        'sort_name' => 1,
        'email' => 1,
        'mailing_subject' => 1,
        'email_on_hold' => 1,
        'contact_opt_out' => 1,
        'mailing_job_status' => 1,
        'mailing_job_end_date' => 1,
        'contact_type' => 1,
        'contact_sub_type' => 1,
        'mailing_recipients_id' => 1,
      );
    }
    return $properties;
  }

  /**
   * @param $values
   * @param $query
   */
  public static function whereClauseSingle(&$values, &$query) {
    list($name, $op, $value, $grouping, $wildcard) = $values;

    $fields = array();
    $fields = self::getFields();

    switch ($name) {
      case 'mailing_id':
        $selectedMailings = array_flip($value);
        $value = "(" . implode(',', $value) . ")";
        $op = 'IN';
        $query->_where[$grouping][] = "civicrm_mailing.id $op $value";

        $mailings = CRM_Mailing_BAO_Mailing::getMailingsList();
        foreach ($selectedMailings as $id => $dnc) {
          $selectedMailings[$id] = $mailings[$id];
        }
        $selectedMailings = implode(' or ', $selectedMailings);

        $query->_qill[$grouping][] = "Mailing Name $op \"$selectedMailings\"";
        $query->_tables['civicrm_mailing'] = $query->_whereTables['civicrm_mailing'] = 1;
        $query->_tables['civicrm_mailing_recipients'] = $query->_whereTables['civicrm_mailing_recipients'] = 1;
        return;

      case 'mailing_name':
        $value = strtolower(addslashes($value));
        if ($wildcard) {
          $value = "%$value%";
          $op = 'LIKE';
        }
        $query->_where[$grouping][] = "LOWER(civicrm_mailing.name) $op '$value'";
        $query->_qill[$grouping][] = "Mailing Namename $op \"$value\"";
        $query->_tables['civicrm_mailing'] = $query->_whereTables['civicrm_mailing'] = 1;
        $query->_tables['civicrm_mailing_recipients'] = $query->_whereTables['civicrm_mailing_recipients'] = 1;
        return;

      case 'mailing_date':
      case 'mailing_date_low':
      case 'mailing_date_high':
        // process to / from date
        $query->_tables['civicrm_mailing'] = $query->_whereTables['civicrm_mailing'] = 1;
        $query->_tables['civicrm_mailing_event_queue'] = $query->_whereTables['civicrm_mailing_event_queue'] = 1;
        $query->_tables['civicrm_mailing_job'] = $query->_whereTables['civicrm_mailing_job'] = 1;
        $query->_tables['civicrm_mailing_recipients'] = $query->_whereTables['civicrm_mailing_recipients'] = 1;
        $query->dateQueryBuilder($values,
          'civicrm_mailing_job', 'mailing_date', 'start_date', 'Mailing Delivery Date'
        );
        return;

      case 'mailing_delivery_status':
        $options = CRM_Mailing_PseudoConstant::yesNoOptions('delivered');

        list($name, $op, $value, $grouping, $wildcard) = $values;
        if ($value == 'Y') {
          self::mailingEventQueryBuilder($query, $values,
            'civicrm_mailing_event_delivered',
            'mailing_delivery_status',
            ts('Mailing Delivery'),
            $options
          );
        }
        elseif ($value == 'N') {
          $options['Y'] = $options['N'];
          $values = array($name, $op, 'Y', $grouping, $wildcard);
          self::mailingEventQueryBuilder($query, $values,
            'civicrm_mailing_event_bounce',
            'mailing_delivery_status',
            ts('Mailing Delivery'),
            $options
          );
        }
        return;

      case 'mailing_bounce_types':
        $op = 'IN';
        $values = array($name, $op, $value, $grouping, $wildcard);
        self::mailingEventQueryBuilder($query, $values,
          'civicrm_mailing_event_bounce',
          'bounce_type_id',
          ts('Bounce type(s)'),
          CRM_Core_PseudoConstant::get('CRM_Mailing_Event_DAO_Bounce', 'bounce_type_id', array(
              'keyColumn' => 'id',
              'labelColumn' => 'name',
            ))
        );
        return;

      case 'mailing_open_status':
        self::mailingEventQueryBuilder($query, $values,
          'civicrm_mailing_event_opened', 'mailing_open_status', ts('Mailing: Trackable Opens'), CRM_Mailing_PseudoConstant::yesNoOptions('open')
        );
        return;

      case 'mailing_click_status':
        self::mailingEventQueryBuilder($query, $values,
          'civicrm_mailing_event_trackable_url_open', 'mailing_click_status', ts('Mailing: Trackable URL Clicks'), CRM_Mailing_PseudoConstant::yesNoOptions('click')
        );
        return;

      case 'mailing_reply_status':
        self::mailingEventQueryBuilder($query, $values,
          'civicrm_mailing_event_reply', 'mailing_reply_status', ts('Mailing: Trackable Replies'), CRM_Mailing_PseudoConstant::yesNoOptions('reply')
        );
        return;

      case 'mailing_optout':
        $valueTitle = array(1 => ts('Opt-out Requests'));
        // include opt-out events only
        $query->_where[$grouping][] = "civicrm_mailing_event_unsubscribe.org_unsubscribe = 1";
        self::mailingEventQueryBuilder($query, $values,
          'civicrm_mailing_event_unsubscribe', 'mailing_unsubscribe',
          ts('Mailing: '), $valueTitle
        );
        return;

      case 'mailing_unsubscribe':
        $valueTitle = array(1 => ts('Unsubscribe Requests'));
        // exclude opt-out events
        $query->_where[$grouping][] = "civicrm_mailing_event_unsubscribe.org_unsubscribe = 0";
        self::mailingEventQueryBuilder($query, $values,
          'civicrm_mailing_event_unsubscribe', 'mailing_unsubscribe',
          ts('Mailing: '), $valueTitle
        );
        return;

      case 'mailing_forward':
        $valueTitle = array('Y' => ts('Forwards'));
        // since its a checkbox
        $values[2] = 'Y';
        self::mailingEventQueryBuilder($query, $values,
          'civicrm_mailing_event_forward', 'mailing_forward',
          ts('Mailing: '), $valueTitle
        );
        return;

      case 'mailing_job_status':
        if (!empty($value)) {
          if ($value != 'Scheduled' && $value != 'Canceled') {
            $query->_tables['civicrm_mailing_event_queue'] = $query->_whereTables['civicrm_mailing_event_queue'] = 1;
          }
          $query->_tables['civicrm_mailing'] = $query->_whereTables['civicrm_mailing'] = 1;
          $query->_tables['civicrm_mailing_job'] = $query->_whereTables['civicrm_mailing_job'] = 1;
          $query->_tables['civicrm_mailing_recipients'] = $query->_whereTables['civicrm_mailing_recipients'] = 1;

          $query->_where[$grouping][] = " civicrm_mailing_job.status = '{$value}' ";
          $query->_qill[$grouping][] = "Mailing Job Status IS \"$value\"";
        }
        return;
    }
  }

  /**
   * Add all the elements shared between Mailing search and advnaced search.
   *
   *
   * @param CRM_Core_Form $form
   * @return void
   */
  public static function buildSearchForm(&$form) {
    // mailing selectors
    $mailings = CRM_Mailing_BAO_Mailing::getMailingsList();

    if (!empty($mailings)) {
      $form->add('select', 'mailing_id', ts('Mailing Name(s)'), $mailings, FALSE,
        array('id' => 'mailing_id', 'multiple' => 'multiple', 'class' => 'crm-select2')
      );
    }

    CRM_Core_Form_Date::buildDateRange($form, 'mailing_date', 1, '_low', '_high', ts('From'), FALSE);

    $mailingJobStatuses = array(
      '' => ts('- select -'),
      'Complete' => 'Complete',
      'Scheduled' => 'Scheduled',
      'Running' => 'Running',
      'Canceled' => 'Canceled',
    );
    $form->addElement('select', 'mailing_job_status', ts('Mailing Job Status'), $mailingJobStatuses, FALSE);

    $mailingBounceTypes = CRM_Core_PseudoConstant::get(
      'CRM_Mailing_Event_DAO_Bounce', 'bounce_type_id',
      array('keyColumn' => 'id', 'labelColumn' => 'name')
    );
    $form->add('select', 'mailing_bounce_types', ts('Bounce Types'), $mailingBounceTypes, FALSE,
      array('id' => 'mailing_bounce_types', 'multiple' => 'multiple', 'class' => 'crm-select2')
    );

    // event filters
    $form->addRadio('mailing_delivery_status', ts('Delivery Status'), CRM_Mailing_PseudoConstant::yesNoOptions('delivered'), array('allowClear' => TRUE));
    $form->addRadio('mailing_open_status', ts('Trackable Opens'), CRM_Mailing_PseudoConstant::yesNoOptions('open'), array('allowClear' => TRUE));
    $form->addRadio('mailing_click_status', ts('Trackable URLs'), CRM_Mailing_PseudoConstant::yesNoOptions('click'), array('allowClear' => TRUE));
    $form->addRadio('mailing_reply_status', ts('Trackable Replies'), CRM_Mailing_PseudoConstant::yesNoOptions('reply'), array('allowClear' => TRUE));

    $form->add('checkbox', 'mailing_unsubscribe', ts('Unsubscribe Requests'));
    $form->add('checkbox', 'mailing_optout', ts('Opt-out Requests'));
    $form->add('checkbox', 'mailing_forward', ts('Forwards'));

    $form->assign('validCiviMailing', TRUE);
  }

  /**
   * @param $row
   * @param int $id
   */
  public static function searchAction(&$row, $id) {
  }

  /**
   * @param $tables
   */
  public static function tableNames(&$tables) {
  }

  /**
   * Filter query results based on which contacts do (not) have a particular mailing event in their history.
   *
   * @param $query
   * @param $values
   * @param string $tableName
   * @param string $fieldName
   * @param $fieldTitle
   *
   * @param $valueTitles
   *
   * @return void
   */
  public static function mailingEventQueryBuilder(&$query, &$values, $tableName, $fieldName, $fieldTitle, &$valueTitles) {
    list($name, $op, $value, $grouping, $wildcard) = $values;

    if (empty($value) || $value == 'A') {
      // don't do any filtering
      return;
    }

    if ($value == 'Y') {
      $query->_where[$grouping][] = $tableName . ".id is not null ";
    }
    elseif ($value == 'N') {
      $query->_where[$grouping][] = $tableName . ".id is null ";
    }

    if (is_array($value)) {
      $query->_where[$grouping][] = "$tableName.$fieldName $op (" . implode(',', $value) . ")";
      $query->_qill[$grouping][] = "$fieldTitle $op " . implode(', ', array_intersect_key($valueTitles, array_flip($value)));
    }
    else {
      $query->_qill[$grouping][] = $fieldTitle . ' - ' . $valueTitles[$value];
    }

    $query->_tables['civicrm_mailing'] = $query->_whereTables['civicrm_mailing'] = 1;
    $query->_tables['civicrm_mailing_job'] = $query->_whereTables['civicrm_mailing_job'] = 1;
    $query->_tables['civicrm_mailing_event_queue'] = $query->_whereTables['civicrm_mailing_event_queue'] = 1;
    $query->_tables['civicrm_mailing_recipients'] = $query->_whereTables['civicrm_mailing_recipients'] = 1;
    $query->_tables[$tableName] = $query->_whereTables[$tableName] = 1;
  }

}


text:
@interface RealmLineChartViewController : RealmDemoBaseViewController

@end

redpajama_set_name: RedPajamaGithub


text:
/*--------------------------------------------------------*\
|                                                          |
|                          hprose                          |
|                                                          |
| Official WebSite: https://hprose.com                     |
|                                                          |
| rpc/plugins/loadbalance/random_loadbalance.go            |
|                                                          |
| LastModified: Mar 12, 2021                               |
| Author: Ma Bingyao <andot@hprose.com>                    |
|                                                          |
\*________________________________________________________*/

package loadbalance

import (
	"context"
	"math/rand"

	"github.com/hprose/hprose-golang/v3/rpc/core"
)

// RandomLoadBalance plugin for hprose.
type RandomLoadBalance struct {
}

// NewRandomLoadBalance returns a RandomLoadBalance instance.
func NewRandomLoadBalance() *RandomLoadBalance {
	return &RandomLoadBalance{}
}

// Handler for RandomLoadBalance.
func (lb *RandomLoadBalance) Handler(ctx context.Context, request []byte, next core.NextIOHandler) (response []byte, err error) {
	clientContext := core.GetClientContext(ctx)
	urls := clientContext.Client().URLs
	clientContext.URL = urls[rand.Intn(len(urls))]
	return next(ctx, request)
}


text:
package bencode

import (
	"errors"
	"fmt"
	"sort"
	"strconv"
)

type BEncodable interface {
	BEncode() string
}

// BEInteger type ----------------------------------------------

type BEInteger int

func (bei BEInteger) BEncode() string {
	return fmt.Sprintf("i%de", bei)
}

// BEString type -----------------------------------------------

type BEString string

func (bes BEString) BEncode() string {
	return fmt.Sprintf("%d:%s", len(bes), bes)
}

// BEList type -------------------------------------------------

type BEList []BEncodable

func (bel BEList) BEncode() string {
	bestr := "l"
	for _, bencodable := range bel {
		bestr += bencodable.BEncode()
	}
	return bestr + "e"
}

// BEDictionary type -------------------------------------------

type BEDictionary map[string]BEncodable

func (bed BEDictionary) BEncode() string {
	bestr := "d"

	// BitTorrent spec says keys should be sorted
	keys := make([]string, 0, len(bed))
	for key := range bed {
		keys = append(keys, key)
	}
	sort.Strings(keys)

	for _, dictKey := range keys {
		bestr += BEString(dictKey).BEncode()
		bestr += bed[dictKey].BEncode()
	}
	return bestr + "e"
}

// Decode function --------------------------------------------------

func Decode(beString string) (BEncodable, error) {
	be, _, err := doDecode(beString, 0)
	return be, err
}

func doDecode(beString string, startIndex int) (BEncodable, int, error) {
	if len(beString) == 0 {
		return nil, 0, errors.New("bencode: cannot decode empty string")
	}
	if startIndex > len(beString) {
		return nil, startIndex, errors.New("bencode: unexpected end of string to be decoded")
	}
	if beString[startIndex] == 'i' {
		// Handle integer
		endIndex, err := findChar(beString, startIndex, 'e')
		if err != nil {
			return nil, startIndex, err
		}
		i, err := strconv.Atoi(beString[startIndex+1 : endIndex])
		if err != nil {
			return nil, startIndex, err
		} else {
			return BEInteger(i), endIndex + 1, nil
		}
	} else if beString[startIndex] == 'l' {
		// Handle list
		beList := BEList{}
		startIndex++
		for beString[startIndex] != 'e' {
			var beListItem BEncodable
			var err error
			beListItem, startIndex, err = doDecode(beString, startIndex)
			if err != nil {
				return nil, startIndex, err
			} else {
				beList = append(beList, beListItem)
			}
			// Handle falling off the edge of the string here, otherwise
			// our for condition blows up
			if startIndex >= len(beString) {
				return nil, startIndex, errors.New("bencode: unexpected end of string while trying to find list closure")
			}
		}
		return beList, startIndex + 1, nil
	} else if beString[startIndex] == 'd' {
		// Handle dictionary
		beDict := BEDictionary{}
		startIndex++
		for beString[startIndex] != 'e' {
			var beKey, beValue BEncodable
			beKey, startIndex, _ = doDecode(beString, startIndex)
			beValue, startIndex, _ = doDecode(beString, startIndex)
			beKeyStr := string(beKey.(BEString))
			beDict[beKeyStr] = beValue
		}
		return beDict, startIndex + 1, nil
	} else {
		// Handle string
		endIndex, err := findChar(beString, startIndex, ':')
		if err != nil {
			return nil, startIndex, err
		}
		strLength, err := strconv.Atoi(beString[startIndex:endIndex])
		if err != nil {
			return nil, startIndex, err
		}
		startIndex = endIndex + 1
		if startIndex+strLength > len(beString) {
			return nil, startIndex, errors.New("bencode: string length was greater than encoded string size")
		} else {
			return BEString(beString[startIndex : startIndex+strLength]), startIndex + strLength, nil
		}
	}
}

func findChar(beString string, startIndex int, char uint8) (int, error) {
	for i := startIndex; i < len(beString); i++ {
		if beString[i] == char {
			return i, nil
		}
	}
	return startIndex, errors.New("bencode: failed to find expected terminating character")
}


text:
package de.tomgrill.gdxfirebase.core.admob;

public class AdmobErrorCode {
    public static final int UNKNOWN_OR_NOT_IMPLEMENTED = 9000;
    public static final int NO_FILL = 9001;
}


text:
using System;
using System.Collections.Generic;
using Core.Core;
using Core.Handlers;
using Core.Handlers.Factory;

namespace Core
{
    /// <summary>
    /// Контекст для инжектирования в приложении
    /// </summary>
    static class AppContext
    {
        /// <summary>
        /// Список сингелтонов
        /// </summary>
        private static readonly Dictionary<Type, Object> SingDictionary = new Dictionary<Type, Object>();

        static AppContext()
        {
            SingDictionary.Add(typeof(IActionExecutorFactory), new DefaultActionExecutorFactory());
            SingDictionary.Add(typeof(IMouse), new NativeMouse());
            SingDictionary.Add(typeof(IWindowsProc), new NativeWindowsProc());
            SingDictionary.Add(typeof(IConfigValidator), new ConfigValidator());
        }

        public static T Get<T>() where T : class
        {
            if (SingDictionary.ContainsKey(typeof(T)))
                return (T)SingDictionary[typeof(T)];
            switch (typeof(T).Name)
            {
                case nameof(IExecutiveCore):
                    return CoreWrapperProxy.CreateInstance(new DefaultExecutiveCore(new DefaultActionExecutorFactory(), Get<IConfigValidator>())) as T;
                case nameof(IActionExecutorFactory):
                    return new DefaultActionExecutorFactory() as T;
            }
            throw new NotSupportedException(nameof(T));
        }
    }
}


text:
        Group Member ({{groupMemberList.length}})

            <button *ngIf="currentUserGroupId" class="btn btn-sm btn-blue" (click)="onReload()"></button>
            <button class="fas fa-exchange-alt l-group-member-sort-exchange" (click)="onSort()"></button>

        <pp-group-member
            [groupMemberList]="groupMemberList"
            (outRemove)="onRemoveGroupMember($event)"
        ></pp-group-member>

    <ng-container *ngIf="errorMessage">
        <pp-server-error-message
            [message]="errorMessage"
            (outClose)="onCloseErrorMessage()">
        </pp-server-error-message>
    </ng-container>
    <pp-film-for-disable *ngIf="useDisable" [zIndex]="9" [marginWidth]="0"></pp-film-for-disable>
    <pp-loading [showLoading]="showLoading" [zIndex]="20"></pp-loading>


text:
<link rel="import" href="chrome://resources/polymer/v1_0/polymer/polymer.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-icon/iron-icon.html">
<link rel="import" href="chrome://resources/polymer/v1_0/iron-icons/iron-icons.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-button/paper-button.html">
<dom-module name="issue-banner">
  <link rel="import" type="css" href="../../media_router_common.css">
  <link rel="import" type="css" href="issue_banner.css">
  <template>

          <iron-icon icon="report-problem" id="blocking-icon">
          </iron-icon>

[[issue.title]]

        <paper-button flat id="opt-button" class="button"
            on-click="onClickOptAction_"
            hidden$="[[computeOptionalActionHidden_(issue)]]">
          [[secondaryActionButtonText_]]
        </paper-button>
        <paper-button flat id="default-button"
            class="button action" on-click="onClickDefaultAction_">
          [[defaultActionButtonText_]]
        </paper-button>

  </template>

</dom-module>


text:
using UnityEngine;
using System.Collections;

public class Parallaxing : MonoBehaviour {

	public Transform[] objectsToParallax; 		//Sprites to be parallaxed
	private float[] scales; 					// proportion of cameras movement to move bgs by.

	public float smoothing = 1f; 				//how smooth the parallax is: >0

	private Transform cam; 						// main camera transform
	private Vector3 lastCamPos; 				// camera pos in previous frame

	/// <summary>
	/// Adds the object to the objectToParallax list.
	/// </summary>
	/// <param name="bg">Background to parallax</param>
	public void AddBG(Transform bg)
	{
		Transform[] newBgs = new Transform[objectsToParallax.Length + 1];

		for (int i=0;i<objectsToParallax.Length; i++) {
			newBgs[i] = objectsToParallax[i];
		}

		newBgs[objectsToParallax.Length] = bg;

		objectsToParallax = newBgs;

		StartScales ();
	}

	// Called before start, good for references
	void Awake ()
	{
		// setup camera reference
		cam = Camera.main.transform;

	}

	// Use this for initialization
	void Start () {

		// previous frame had the current frame pos
		lastCamPos = cam.position;

		StartScales();
	}

	void StartScales()
	{
		// assign corresponding parallax size
		scales = new float[objectsToParallax.Length];
		for (int i = 0; i<objectsToParallax.Length; i++) {
			scales[i] = objectsToParallax[i].position.z *-1;
		}

	}

	// Update is called once per frame
	void Update () {

		// for each bg
		for (int i = 0; i<objectsToParallax.Length; i++) {
			// the prallax is the opposite of the camara movement because the prevuous frame multiplied by the scale
			float parallax = (lastCamPos.x - cam.position.x) * (scales[i]);

			// set a target x position which is the current pos + the parallax
			float bgTargetPosX = objectsToParallax[i].position.x + parallax;

			// Create the target position for the bg based on the bgTargetPosX
			Vector3 bgTargetPos = new Vector3(bgTargetPosX,objectsToParallax[i].position.y,objectsToParallax[i].position.z);

			// fade between current pos and target pos using Lerp
			objectsToParallax[i].position = Vector3.Lerp(objectsToParallax[i].position,bgTargetPos, smoothing * Time.deltaTime);

		}

		// set the lastPosition to the current camera pos.
		lastCamPos = cam.position;
	}
}


text:
if [ $# -eq 0 ]; then
	echo 1>&2 "Usage: `basename $0` [MAKEVAR=value...] path..."
	exit 1
fi

# MAKE_ARGS is intentionally not reset to allow caller to specify additional MAKE_ARGS
SUBDIR=
for i in "$@"; do
	case "$i" in
	*=*)
		MAKE_ARGS="$MAKE_ARGS $i"
		;;
	*)
		SUBDIR="$SUBDIR $i"
		;;
	esac
done
make tinderbox UNIVERSE_TARGET="_cleanobj _obj _depend everything" $MAKE_ARGS SUBDIR_OVERRIDE="$SUBDIR"


text:
angular.module('tkrekryApp')
    .factory('Session', function($resource) {
        'use strict';

        return $resource('/api/session/');
    });


text:
using UnityEngine;
using System.Threading;
using System.Text;
using System.Collections;
using System.IO;
using System;

/// \mainpage
/// \section Overview
/// The .NET Visual C# library for the Make Controller Kit is designed
/// to make it as simple as possible for developers to integrate the
/// Make Controller Kit into their desktop applications, offering the
/// transparency that makes open source software so rewarding to work with.
/// You can communicate with the Make Controller Kit from your applications
/// over either an Ethernet or USB connection, or both.  This library is
/// supplied both in source form and built, as MakeControllerOsc.dll
/// This document is a reference for MakeControllerOsc.
///
/// \section Communication
/// Messages to and from the board conform to the OSC (Open Sound Control) protocol.
/// OSC is an open, transport-independent standard supported by an increasing
/// number of environments and devices.
///
/// \subsection OSCmessages OSC Messages
/// OSC messages are represented by the class OscMessage, and consist of two elements:
/// - An address string for the device on the board youíre dealing with.
/// - A list of value(s) being sent to or from that device. The list of values is optional.
///
/// From the perspective of OSC addresses, the Make Controller Kit is organized into a hierarchy of two or three layers:
/// - subsystems ñ classes of device, such as analog inputs, servo controllers, and digital outputs.
/// - devices ñ the index of a specific device within a subsystem.
/// If there is only one device in a subsystem, the device is not included in the OSC address.
/// - properties ñ different devices have different properties, such as the value of an analog input,
/// the position of a servo motor, or the state of an LED.
///
/// OSC messages always begin with a slash, and use a slash to delimit each element in the address,
/// so an example OSC address string would look like:
/// \code /subsystem/device/property \endcode
///
/// The second part of an OscMessage is a list of values to be sent to the specified address.
/// The OSC types that are used by the Make Controller Kit for these values are integers,
/// floats, and strings.  The values in this list are simply separated by spaces, and the
/// list can be arbitrarily long.  Most devices on the Make Controller Kit expect only one value.
/// For example, to set the position of servo 1, you might send a message which
/// in string form might look like:
/// \code /servo/1/position 512 \endcode
///
/// This addressing scheme allows interactions with the board's various subsystems
/// and properties, and most importantly, accommodates the possibility of future or
/// custom devices on the board that have not yet been implemented or imagined.
/// If somebody creates, for example, a GPS extension to the board, communicating
/// with that device from this library is the same as for any other.  More details
/// about OSC can be found at http://www.opensoundcontrol.org.
///
/// \section sendingdata Sending Data
/// As previously mentioned, the Make Controller Kit can communicate over both
/// Ethernet and USB.  Messages are sent as packets, both over USB and UDP, and
/// corresponding structures are used ñ UsbPacket and UdpPacket.  Once youíve created
/// a packet, you can simply call its Send() method, with the OscMessage youíd like to send.
/// There are helper methods to create an OscMessage from a string, or you can pass in the OscMessage itself.
///
/// For example, you might set up your UsbSend() routine to look something like:
/// \code public void usbSend(string text)
/// {
///     OscMessage oscM = Osc.StringToOscMessage(text);
///     oscUsb is an Osc object, connected to a UsbPacket object
///     oscUsb.Send(oscM);
/// } \endcode
/// If your data is already in the form of an OscMessage, you can call oscUsb.Send() directly.
///
/// \section readingdata Reading Data
/// The Make Controller Kit must be polled in order to read data from it.  To do this,
/// send an OscMessage with the address of the device youíd like to read, but omit
/// the list of values.  When the board receives an OscMessage with no value,
/// it interprets that as a read request, and sends back an OscMessage with the
/// current value at the appropriate address.
///
/// The .NET Make Controller Kit library conveniently provides handlers that will
/// call back a given function when an OscMessage with a given address string is received.
/// Your implementation could look something like:
/// \code// Set the handler in the constructor for a particular address
/// MyConstructor()
/// {
///     udpPacket = new UdpPacket();
///     oscUdp = new Osc(udpPacket);
///     // A thread is started when the Osc object is created to read
///     // incoming messages.
///     oscUdp.SetAddressHandler("/analogin/0/value", Ain0Message);
/// }
///
/// // The method you specified as the handler will be called back when a
/// // message with a matching address string comes back from the board.
/// public void AIn0Message(OscMessage oscMessage)
/// {
///     // write the message to a console, for example
///     mct.WriteLine("AIn0 > " + Osc.OscMessageToString(oscMessage));
/// } \endcode
/// You could alternatively set a handler for all incoming messages by calling
/// the SetAllMessageHandler() method in your setup, instead of SetAddressHandler().
///
///

//namespace MakingThings
//{
  /// <summary>
  /// The OscMessage class is a data structure that represents
  /// an OSC address and an arbitrary number of values to be sent to that address.
  /// </summary>
  public class OscMessage
  {
   /// <summary>
   /// The OSC address of the message as a string.
   /// </summary>
   public string Address;
   /// <summary>
   /// The list of values to be delivered to the Address.
   /// </summary>
   public ArrayList Values;
    public OscMessage()
    {
      Values = new ArrayList();
    }
  }

  public delegate void OscMessageHandler( OscMessage oscM );

  /// <summary>
  /// The Osc class provides the methods required to send, receive, and manipulate OSC messages.
  /// Several of the helper methods are static since a running Osc instance is not required for
  /// their use.
  ///
  /// When instanciated, the Osc class opens the PacketIO instance that's handed to it and
  /// begins to run a reader thread.  The instance is then ready to service Send OscMessage requests
  /// and to start supplying OscMessages as received back.
  ///
  /// The Osc class can be called to Send either individual messages or collections of messages
  /// in an Osc Bundle.  Receiving is done by delegate.  There are two ways: either submit a method
  /// to receive all incoming messages or submit a method to handle only one particular address.
  ///
  /// Messages can be encoded and decoded from Strings via the static methods on this class, or
  /// can be hand assembled / disassembled since they're just a string (the address) and a list
  /// of other parameters in Object form.
  ///
  /// </summary>
  public class Osc : MonoBehaviour
  {
      private UDPPacketIO OscPacketIO;
      Thread ReadThread;
      private bool ReaderRunning;
      private OscMessageHandler AllMessageHandler;
      Hashtable AddressTable;

	void Start() {
		//do nothing, init must be called
	}

	public void init(UDPPacketIO oscPacketIO){
	  OscPacketIO = oscPacketIO;

      // Create the hashtable for the address lookup mechanism
      AddressTable = new Hashtable();

      ReadThread = new Thread(Read);
      ReaderRunning = true;
      ReadThread.IsBackground = true;
      ReadThread.Start();
	}

    /// <summary>
    /// Make sure the PacketExchange is closed.
    /// </summary>
    ~Osc()
    {
    	if (ReaderRunning) Cancel();
        //Debug.LogError("~Osc");
    }

    public void Cancel()
    {
        //Debug.Log("Osc Cancel start");
        if (ReaderRunning)
        {
            ReaderRunning = false;
            ReadThread.Abort();
        }

        //if (OscPacketIO != null && OscPacketIO.IsOpen())
		if (OscPacketIO != null && OscPacketIO.IsOpen())
        {
            OscPacketIO.Close();
            OscPacketIO = null;
        }
        //Debug.Log("Osc Cancel finished");
    }

    /// <summary>
    /// Read Thread.  Loops waiting for packets.  When a packet is received, it is
    /// dispatched to any waiting All Message Handler.  Also, the address is looked up and
    /// any matching handler is called.
    /// </summary>
    private void Read()
    {
        try
        {
            while (ReaderRunning)
            {
                byte[] buffer = new byte[1000];
                int length = OscPacketIO.ReceivePacket(buffer);
                //Debug.Log("received packed of len=" + length);
                if (length > 0)
                {
                    ArrayList messages = Osc.PacketToOscMessages(buffer, length);
                    foreach (OscMessage om in messages)
                    {
                        if (AllMessageHandler != null)
                            AllMessageHandler(om);
                        OscMessageHandler h = (OscMessageHandler)Hashtable.Synchronized(AddressTable)[om.Address];
                        if (h != null)
                            h(om);
                    }
                }
                else
                    Thread.Sleep(20);
            }
        }
        catch (Exception e)
        {
            Debug.Log("ThreadAbortException"+e);
        }
        finally
        {
            Debug.Log("terminating thread - clearing handlers");
            Cancel();
            Hashtable.Synchronized(AddressTable).Clear();
        }

    }

    /// <summary>
    /// Send an individual OSC message.  Internally takes the OscMessage object and
    /// serializes it into a byte[] suitable for sending to the PacketIO.
    /// </summary>
    /// <param name="oscMessage">The OSC Message to send.</param>
    public void Send( OscMessage oscMessage )
    {
      byte[] packet = new byte[1000];
      int length = Osc.OscMessageToPacket( oscMessage, packet, 1000 );
      OscPacketIO.SendPacket( packet, length);
    }

    /// <summary>
    /// Sends a list of OSC Messages.  Internally takes the OscMessage objects and
    /// serializes them into a byte[] suitable for sending to the PacketExchange.
    /// </summary>
    /// <param name="oms">The OSC Message to send.</param>
    public void Send(ArrayList oms)
    {
      byte[] packet = new byte[1000];
      int length = Osc.OscMessagesToPacket(oms, packet, 1000);
      OscPacketIO.SendPacket(packet, length);
    }

    /// <summary>
    /// Set the method to call back on when any message is received.
    /// The method needs to have the OscMessageHandler signature - i.e. void amh( OscMessage oscM )
    /// </summary>
    /// <param name="amh">The method to call back on.</param>
    public void SetAllMessageHandler(OscMessageHandler amh)
    {
      AllMessageHandler = amh;
    }

    /// <summary>
    /// Set the method to call back on when a message with the specified
    /// address is received.  The method needs to have the OscMessageHandler signature - i.e.
    /// void amh( OscMessage oscM )
    /// </summary>
    /// <param name="key">Address string to be matched</param>
    /// <param name="ah">The method to call back on.</param>
    public void SetAddressHandler(string key, OscMessageHandler ah)
    {
      Hashtable.Synchronized(AddressTable).Add(key, ah);
    }

    /// <summary>
    /// General static helper that returns a string suitable for printing representing the supplied
    /// OscMessage.
    /// </summary>
    /// <param name="message">The OscMessage to be stringified.</param>
    /// <returns>The OscMessage as a string.</returns>
    public static string OscMessageToString(OscMessage message)
    {
      StringBuilder s = new StringBuilder();
      s.Append(message.Address);
      foreach( object o in message.Values )
      {
        s.Append(" ");
        s.Append(o.ToString());
      }
      return s.ToString();
    }

    /// <summary>
    /// Creates an OscMessage from a string - extracts the address and determines each of the values.
    /// </summary>
    /// <param name="message">The string to be turned into an OscMessage</param>
    /// <returns>The OscMessage.</returns>
    public static OscMessage StringToOscMessage(string message)
    {
      OscMessage oM = new OscMessage();
      // Console.WriteLine("Splitting " + message);
      string[] ss = message.Split(new char[] { ' ' });
      IEnumerator sE = ss.GetEnumerator();
      if (sE.MoveNext())
        oM.Address = (string)sE.Current;
      while ( sE.MoveNext() )
      {
        string s = (string)sE.Current;
        // Console.WriteLine("  <" + s + ">");
        if (s.StartsWith("\""))
        {
          StringBuilder quoted = new StringBuilder();
          bool looped = false;
          if (s.Length > 1)
            quoted.Append(s.Substring(1));
          else
            looped = true;
          while (sE.MoveNext())
          {
            string a = (string)sE.Current;
            // Console.WriteLine("    q:<" + a + ">");
            if (looped)
              quoted.Append(" ");
            if (a.EndsWith("\""))
            {
              quoted.Append(a.Substring(0, a.Length - 1));
              break;
            }
            else
            {
              if (a.Length == 0)
                quoted.Append(" ");
              else
                quoted.Append(a);
            }
            looped = true;
          }
          oM.Values.Add(quoted.ToString());
        }
        else
        {
          if (s.Length > 0)
          {
            try
            {
              int i = int.Parse(s);
              // Console.WriteLine("  i:" + i);
              oM.Values.Add(i);
            }
            catch
            {
              try
              {
                float f = float.Parse(s);
                // Console.WriteLine("  f:" + f);
                oM.Values.Add(f);
              }
              catch
              {
                // Console.WriteLine("  s:" + s);
                oM.Values.Add(s);
              }
            }

          }
        }
      }
      return oM;
    }

    /// <summary>
    /// Takes a packet (byte[]) and turns it into a list of OscMessages.
    /// </summary>
    /// <param name="packet">The packet to be parsed.</param>
    /// <param name="length">The length of the packet.</param>
    /// <returns>An ArrayList of OscMessages.</returns>
    public static ArrayList PacketToOscMessages(byte[] packet, int length)
    {
      ArrayList messages = new ArrayList();
      ExtractMessages(messages, packet, 0, length);
      return messages;
    }

    /// <summary>
    /// Puts an array of OscMessages into a packet (byte[]).
    /// </summary>
    /// <param name="messages">An ArrayList of OscMessages.</param>
    /// <param name="packet">An array of bytes to be populated with the OscMessages.</param>
    /// <param name="length">The size of the array of bytes.</param>
    /// <returns>The length of the packet</returns>
    public static int OscMessagesToPacket(ArrayList messages, byte[] packet, int length)
    {
      int index = 0;
      if (messages.Count == 1)
        index = OscMessageToPacket((OscMessage)messages[0], packet, 0, length);
      else
      {
        // Write the first bundle bit
        index = InsertString("#bundle", packet, index, length);
        // Write a null timestamp (another 8bytes)
        int c = 8;
        while (( c-- )>0)
          packet[index++]++;
        // Now, put each message preceded by it's length
        foreach (OscMessage oscM in messages)
        {
          int lengthIndex = index;
          index += 4;
          int packetStart = index;
          index = OscMessageToPacket(oscM, packet, index, length);
          int packetSize = index - packetStart;
          packet[lengthIndex++] = (byte)((packetSize >> 24) & 0xFF);
          packet[lengthIndex++] = (byte)((packetSize >> 16) & 0xFF);
          packet[lengthIndex++] = (byte)((packetSize >> 8) & 0xFF);
          packet[lengthIndex++] = (byte)((packetSize) & 0xFF);
        }
      }
      return index;
    }

    /// <summary>
    /// Creates a packet (an array of bytes) from a single OscMessage.
    /// </summary>
    /// <remarks>A convenience method, not requiring a start index.</remarks>
    /// <param name="oscM">The OscMessage to be returned as a packet.</param>
    /// <param name="packet">The packet to be populated with the OscMessage.</param>
    /// <param name="length">The usable size of the array of bytes.</param>
    /// <returns>The length of the packet</returns>
    public static int OscMessageToPacket(OscMessage oscM, byte[] packet, int length)
    {
      return OscMessageToPacket(oscM, packet, 0, length);
    }

    /// <summary>
    /// Creates an array of bytes from a single OscMessage.  Used internally.
    /// </summary>
    /// <remarks>Can specify where in the array of bytes the OscMessage should be put.</remarks>
    /// <param name="oscM">The OscMessage to be turned into an array of bytes.</param>
    /// <param name="packet">The array of bytes to be populated with the OscMessage.</param>
    /// <param name="start">The start index in the packet where the OscMessage should be put.</param>
    /// <param name="length">The length of the array of bytes.</param>
    /// <returns>The index into the packet after the last OscMessage.</returns>
    private static int OscMessageToPacket(OscMessage oscM, byte[] packet, int start, int length)
    {
      int index = start;
      index = InsertString(oscM.Address, packet, index, length);
      //if (oscM.Values.Count > 0)
      {
        StringBuilder tag = new StringBuilder();
        tag.Append(",");
        int tagIndex = index;
        index += PadSize(2 + oscM.Values.Count);

        foreach (object o in oscM.Values)
        {
          if (o is int)
          {
            int i = (int)o;
            tag.Append("i");
            packet[index++] = (byte)((i >> 24) & 0xFF);
            packet[index++] = (byte)((i >> 16) & 0xFF);
            packet[index++] = (byte)((i >> 8) & 0xFF);
            packet[index++] = (byte)((i) & 0xFF);
          }
          else
          {
            if (o is float)
            {
              float f = (float)o;
              tag.Append("f");
              byte[] buffer = new byte[4];
              MemoryStream ms = new MemoryStream(buffer);
              BinaryWriter bw = new BinaryWriter(ms);
              bw.Write(f);
              packet[index++] = buffer[3];
              packet[index++] = buffer[2];
              packet[index++] = buffer[1];
              packet[index++] = buffer[0];
            }
            else
            {
              if (o is string)
              {
                tag.Append("s");
                index = InsertString(o.ToString(), packet, index, length);
              }
              else
              {
                tag.Append("?");
              }
            }
          }
        }
        InsertString(tag.ToString(), packet, tagIndex, length);
      }
      return index;
    }

    /// <summary>
    /// Receive a raw packet of bytes and extract OscMessages from it.  Used internally.
    /// </summary>
    /// <remarks>The packet may contain a OSC message or a bundle of messages.</remarks>
    /// <param name="messages">An ArrayList to be populated with the OscMessages.</param>
    /// <param name="packet">The packet of bytes to be parsed.</param>
    /// <param name="start">The index of where to start looking in the packet.</param>
    /// <param name="length">The length of the packet.</param>
    /// <returns>The index after the last OscMessage read.</returns>
    private static int ExtractMessages(ArrayList messages, byte[] packet, int start, int length)
    {
      int index = start;
      switch ( (char)packet[ start ] )
      {
        case '/':
          index = ExtractMessage( messages, packet, index, length );
          break;
        case '#':
          string bundleString = ExtractString(packet, start, length);
          if ( bundleString == "#bundle" )
          {
            // skip the "bundle" and the timestamp
            index+=16;
            while ( index < length )
            {
              int messageSize = ( packet[index++] << 24 ) + ( packet[index++] << 16 ) + ( packet[index++] << 8 ) + packet[index++];
              /*int newIndex = */ExtractMessages( messages, packet, index, length );
              index += messageSize;
            }
          }
          break;
      }
      return index;
    }

    /// <summary>
    /// Extracts a messages from a packet.
    /// </summary>
    /// <param name="messages">An ArrayList to be populated with the OscMessage.</param>
    /// <param name="packet">The packet of bytes to be parsed.</param>
    /// <param name="start">The index of where to start looking in the packet.</param>
    /// <param name="length">The length of the packet.</param>
    /// <returns>The index after the OscMessage is read.</returns>
    private static int ExtractMessage(ArrayList messages, byte[] packet, int start, int length)
    {
      OscMessage oscM = new OscMessage();
      oscM.Address = ExtractString(packet, start, length);
      int index = start + PadSize(oscM.Address.Length+1);
      string typeTag = ExtractString(packet, index, length);
      index += PadSize(typeTag.Length + 1);
      //oscM.Values.Add(typeTag);
      foreach (char c in typeTag)
      {
        switch (c)
        {
          case ',':
            break;
          case 's':
            {
              string s = ExtractString(packet, index, length);
              index += PadSize(s.Length + 1);
              oscM.Values.Add(s);
              break;
            }
          case 'i':
            {
              int i = ( packet[index++] << 24 ) + ( packet[index++] << 16 ) + ( packet[index++] << 8 ) + packet[index++];
              oscM.Values.Add(i);
              break;
            }
          case 'f':
            {
              byte[] buffer = new byte[4];
              buffer[3] = packet[index++];
              buffer[2] = packet[index++];
              buffer[1] = packet[index++];
              buffer[0] = packet[index++];
              MemoryStream ms = new MemoryStream(buffer);
              BinaryReader br = new BinaryReader(ms);
              float f = br.ReadSingle();
              oscM.Values.Add(f);
              break;
            }
        }
      }
      messages.Add( oscM );
      return index;
    }

    /// <summary>
    /// Removes a string from a packet.  Used internally.
    /// </summary>
    /// <param name="packet">The packet of bytes to be parsed.</param>
    /// <param name="start">The index of where to start looking in the packet.</param>
    /// <param name="length">The length of the packet.</param>
    /// <returns>The string</returns>
    private static string ExtractString(byte[] packet, int start, int length)
    {
      StringBuilder sb = new StringBuilder();
      int index = start;
      while (packet[index] != 0 && index < length)
        sb.Append((char)packet[index++]);
      return sb.ToString();
    }

    private static string Dump(byte[] packet, int start, int length)
    {
      StringBuilder sb = new StringBuilder();
      int index = start;
      while (index < length)
        sb.Append(packet[index++]+"|");
      return sb.ToString();
    }

    /// <summary>
    /// Inserts a string, correctly padded into a packet.  Used internally.
    /// </summary>
    /// <param name="string">The string to be inserted</param>
    /// <param name="packet">The packet of bytes to be parsed.</param>
    /// <param name="start">The index of where to start looking in the packet.</param>
    /// <param name="length">The length of the packet.</param>
    /// <returns>An index to the next byte in the packet after the padded string.</returns>
    private static int InsertString(string s, byte[] packet, int start, int length)
    {
      int index = start;
      foreach (char c in s)
      {
        packet[index++] = (byte)c;
        if (index == length)
          return index;
      }
      packet[index++] = 0;
      int pad = (s.Length+1) % 4;
      if (pad != 0)
      {
        pad = 4 - pad;
        while (pad-- > 0)
          packet[index++] = 0;
      }
      return index;
    }

    /// <summary>
    /// Takes a length and returns what it would be if padded to the nearest 4 bytes.
    /// </summary>
    /// <param name="rawSize">Original size</param>
    /// <returns>padded size</returns>
    private static int PadSize(int rawSize)
    {
      int pad = rawSize % 4;
      if (pad == 0)
        return rawSize;
      else
        return rawSize + (4 - pad);
    }
  }
//}


text:
#include <assert.h>
#include <string.h>

#include "HiveRowSet.h"
#include "hiveclienthelper.h"

/*************************************************************************************************
 * Base HiveRowSet Class Logic
 ************************************************************************************************/

HiveRowSet::HiveRowSet() {
  m_is_completely_read = false;
  m_bytes_read = 0;
  m_last_column_fetched = 0;
  m_field_buffer[0] = '\0';
}

HiveRowSet::~HiveRowSet() {
}

void HiveRowSet::reset() {
  m_is_completely_read = false;
  m_bytes_read = 0;
  m_last_column_fetched = 0;
  m_field_buffer[0] = '\0';
  /* Non Virtual Calls Pure Virtual Idiom */
  specialized_reset(); /* Call the specialized subclass reset method */
}

void HiveRowSet::initFieldBuffer() {
  /* m_field_buffer should always correspond to the field indicated by m_last_column_fetched*/
  extractField(m_last_column_fetched);
}

HiveReturn HiveRowSet::getFieldDataLen(size_t column_idx, size_t* col_len, char* err_buf,
                                       size_t err_buf_len) {
  RETURN_ON_ASSERT(col_len == NULL, __FUNCTION__,
                   "Pointer to col_len (output) cannot be NULL.", err_buf, err_buf_len, HIVE_ERROR);
  RETURN_ON_ASSERT(getColumnCount() == 0, __FUNCTION__,
                   "Rowset contains zero columns.", err_buf, err_buf_len, HIVE_ERROR);
  RETURN_ON_ASSERT(column_idx >= getColumnCount(), __FUNCTION__,
                   "Column index out of bounds.", err_buf, err_buf_len, HIVE_ERROR);
  *col_len = getFieldLen(column_idx);
  return HIVE_SUCCESS;
}

HiveReturn HiveRowSet::getFieldAsCString(size_t column_idx, char* buffer, size_t buffer_len,
                                         size_t* data_byte_size, int* is_null_value, char* err_buf,
                                         size_t err_buf_len) {
  RETURN_ON_ASSERT(buffer == NULL, __FUNCTION__,
                   "Column data output buffer cannot be NULL.", err_buf, err_buf_len, HIVE_ERROR);
  RETURN_ON_ASSERT(is_null_value == NULL, __FUNCTION__,
                   "Column data is_null_value (output) cannot be NULL.", err_buf, err_buf_len,
                   HIVE_ERROR);
  RETURN_ON_ASSERT(getColumnCount() == 0, __FUNCTION__,
                   "Rowset contains zero columns.", err_buf, err_buf_len, HIVE_ERROR);
  RETURN_ON_ASSERT(column_idx >= getColumnCount(), __FUNCTION__,
                   "Column index out of bounds.", err_buf, err_buf_len, HIVE_ERROR);
  RETURN_ON_ASSERT(buffer_len == 0, __FUNCTION__,
                   "Output buffer cannot have a size of zero.", err_buf, err_buf_len, HIVE_ERROR);

  if (m_last_column_fetched != column_idx) {
    extractField(column_idx);
    m_bytes_read = 0; /* Reset the read offset if different from the last column fetched */
    m_last_column_fetched = column_idx;
    m_is_completely_read = false;
  }
  if (m_is_completely_read) {
    return HIVE_NO_MORE_DATA; /* This field has already been completely fetched by a previous call*/
  }
  /* If the column data is the same as the null format spec... */
  if (strcmp(getNullFormat(), m_field_buffer) == 0) {
    /* This value must be NULL */
    *is_null_value = 1;
    if (data_byte_size != NULL) {
      *data_byte_size = 0;
    }
    buffer[0] = '\0';
  } else {
    /* This value has been determined not to be NULL */
    *is_null_value = 0;
    size_t data_total_len = getFieldLen(column_idx);
    /* Cannot read more data then the total number of bytes available */
    assert(data_total_len >= m_bytes_read);
    size_t bytes_remaining = data_total_len - m_bytes_read; // Excludes null char
    if (data_byte_size != NULL) {
      /* Save the number of remaining characters to return before this fetch */
      *data_byte_size = bytes_remaining;
    }
    /* Move pointer to the read location */
    const char* src_str_ptr = m_field_buffer + m_bytes_read;
    /* The total number of bytes to read (+1 null terminator) should be no more than the
     * size of the field buffer */
    assert(m_bytes_read + bytes_remaining + 1 <= sizeof(m_field_buffer));
    /* Copy as many characters as possible from the read location */
    size_t bytes_copied = safe_strncpy(buffer, src_str_ptr, min(buffer_len, bytes_remaining + 1)); // +1 for null terminator
    /* bytes_copied does not count the null terminator */
    m_bytes_read += bytes_copied;
    if (m_bytes_read < data_total_len) {
      return HIVE_SUCCESS_WITH_MORE_DATA; /* Data truncated; more data to return */
    }
  }
  m_is_completely_read = true;
  return HIVE_SUCCESS; /* All data successfully read */
}

HiveReturn HiveRowSet::getFieldAsDouble(size_t column_idx, double* buffer, int* is_null_value,
                                        char* err_buf, size_t err_buf_len) {
  RETURN_ON_ASSERT(buffer == NULL, __FUNCTION__,
                   "Column data output buffer cannot be NULL.", err_buf, err_buf_len, HIVE_ERROR);
  RETURN_ON_ASSERT(is_null_value == NULL, __FUNCTION__,
                   "Column data is_null_value (output) cannot be NULL.", err_buf, err_buf_len,
                   HIVE_ERROR);
  RETURN_ON_ASSERT(getColumnCount() == 0, __FUNCTION__,
                   "Rowset contains zero columns.", err_buf, err_buf_len, HIVE_ERROR);
  RETURN_ON_ASSERT(column_idx >= getColumnCount(), __FUNCTION__,
                   "Column index out of bounds.", err_buf, err_buf_len, HIVE_ERROR);

  if (m_last_column_fetched != column_idx) {
    /* Reset if this column was not fetched on the last attempt */
    extractField(column_idx);
    m_bytes_read = 0; /* Reset the read offset if different from the last column fetched */
    m_last_column_fetched = column_idx;
    m_is_completely_read = false;
  }
  if (m_is_completely_read) {
    return HIVE_NO_MORE_DATA; /* This column has already been completely fetched */
  }
  /* If the column data is the same as the nullformat spec... */
  if (strcmp(getNullFormat(), m_field_buffer) == 0) {
    *is_null_value = 1;
    *buffer = 0.0;
  } else {
    *is_null_value = 0;
    *buffer = atof(m_field_buffer);
  }
  m_is_completely_read = true;
  return HIVE_SUCCESS;
}

HiveReturn HiveRowSet::getFieldAsInt(size_t column_idx, int* buffer, int* is_null_value,
                                     char* err_buf, size_t err_buf_len) {
  RETURN_ON_ASSERT(buffer == NULL, __FUNCTION__,
                   "Column data output buffer cannot be NULL.", err_buf, err_buf_len, HIVE_ERROR);
  RETURN_ON_ASSERT(is_null_value == NULL, __FUNCTION__,
                   "Column data is_null_value (output) cannot be NULL.", err_buf, err_buf_len,
                   HIVE_ERROR);
  RETURN_ON_ASSERT(getColumnCount() == 0, __FUNCTION__,
                   "Rowset contains zero columns.", err_buf, err_buf_len, HIVE_ERROR);
  RETURN_ON_ASSERT(column_idx >= getColumnCount(), __FUNCTION__,
                   "Column index out of bounds.", err_buf, err_buf_len, HIVE_ERROR);

  if (m_last_column_fetched != column_idx) {
    extractField(column_idx);
    m_bytes_read = 0; /* Reset the read offset if different from the last column fetched */
    m_last_column_fetched = column_idx;
    m_is_completely_read = false;
  }
  if (m_is_completely_read) {
    return HIVE_NO_MORE_DATA; /* This column has already been completely fetched */
  }
  /* If the column data is the same as the null format spec... */
  if (strcmp(getNullFormat(), m_field_buffer) == 0) {
    *is_null_value = 1;
    *buffer = 0;
  } else {
    *is_null_value = 0;
    *buffer = atoi(m_field_buffer);
  }
  m_is_completely_read = true;
  return HIVE_SUCCESS;
}

HiveReturn HiveRowSet::getFieldAsLong(size_t column_idx, long* buffer, int* is_null_value,
                                      char* err_buf, size_t err_buf_len) {
  RETURN_ON_ASSERT(buffer == NULL, __FUNCTION__,
                   "Column data output buffer cannot be NULL.", err_buf, err_buf_len, HIVE_ERROR);
  RETURN_ON_ASSERT(is_null_value == NULL, __FUNCTION__,
                   "Column data is_null_value (output) cannot be NULL.", err_buf, err_buf_len,
                   HIVE_ERROR);
  RETURN_ON_ASSERT(getColumnCount() == 0, __FUNCTION__,
                   "Rowset contains zero columns.", err_buf, err_buf_len, HIVE_ERROR);
  RETURN_ON_ASSERT(column_idx >= getColumnCount(), __FUNCTION__,
                   "Column index out of bounds.", err_buf, err_buf_len, HIVE_ERROR);

  if (m_last_column_fetched != column_idx) {
    extractField(column_idx);
    m_bytes_read = 0; /* Reset the read offset if different from the last column fetched */
    m_last_column_fetched = column_idx;
    m_is_completely_read = false;
  }
  if (m_is_completely_read) {
    return HIVE_NO_MORE_DATA; /* This column has already been completely fetched */
  }
  /* If the column data is the same as the null format spec... */
  if (strcmp(getNullFormat(), m_field_buffer) == 0) {
    *is_null_value = 1;
    *buffer = 0;
  } else {
    *is_null_value = 0;
    *buffer = atol(m_field_buffer);
  }
  m_is_completely_read = true;
  return HIVE_SUCCESS;
}

HiveReturn HiveRowSet::getFieldAsULong(size_t column_idx, unsigned long* buffer,
                                       int* is_null_value, char* err_buf, size_t err_buf_len) {
  RETURN_ON_ASSERT(buffer == NULL, __FUNCTION__,
                   "Column data output buffer cannot be NULL.", err_buf, err_buf_len, HIVE_ERROR);
  RETURN_ON_ASSERT(is_null_value == NULL, __FUNCTION__,
                   "Column data is_null_value (output) cannot be NULL.", err_buf, err_buf_len,
                   HIVE_ERROR);
  RETURN_ON_ASSERT(getColumnCount() == 0, __FUNCTION__,
                   "Rowset contains zero columns.", err_buf, err_buf_len, HIVE_ERROR);
  RETURN_ON_ASSERT(column_idx >= getColumnCount(), __FUNCTION__,
                   "Column index out of bounds.", err_buf, err_buf_len, HIVE_ERROR);

  if (m_last_column_fetched != column_idx) {
    extractField(column_idx);
    m_bytes_read = 0; /* Reset the read offset if different from the last column fetched */
    m_last_column_fetched = column_idx;
    m_is_completely_read = false;
  }
  if (m_is_completely_read) {
    return HIVE_NO_MORE_DATA; /* This column has already been completely fetched */
  }
  /* If the column data is the same as the null format spec... */
  if (strcmp(getNullFormat(), m_field_buffer) == 0) {
    *is_null_value = 1;
    *buffer = 0;
  } else {
    *is_null_value = 0;
    *buffer = strtoul(m_field_buffer, NULL, 10);
  }
  m_is_completely_read = true;
  return HIVE_SUCCESS;
}

HiveReturn HiveRowSet::getFieldAsI64(size_t column_idx, int64_t* buffer, int* is_null_value,
                                     char* err_buf, size_t err_buf_len) {
  RETURN_ON_ASSERT(buffer == NULL, __FUNCTION__,
                   "Column data output buffer cannot be NULL.", err_buf, err_buf_len, HIVE_ERROR);
  RETURN_ON_ASSERT(is_null_value == NULL, __FUNCTION__,
                   "Column data is_null_value (output) cannot be NULL.", err_buf, err_buf_len,
                   HIVE_ERROR);
  RETURN_ON_ASSERT(getColumnCount() == 0, __FUNCTION__,
                   "Rowset contains zero columns.", err_buf, err_buf_len, HIVE_ERROR);
  RETURN_ON_ASSERT(column_idx >= getColumnCount(), __FUNCTION__,
                   "Column index out of bounds.", err_buf, err_buf_len, HIVE_ERROR);

  if (m_last_column_fetched != column_idx) {
    extractField(column_idx);
    m_bytes_read = 0; /* Reset the read offset if different from the last column fetched */
    m_last_column_fetched = column_idx;
    m_is_completely_read = false;
  }
  if (m_is_completely_read) {
    return HIVE_NO_MORE_DATA; /* This column has already been completely fetched */
  }
  /* If the column data is the same as the null format spec... */
  if (strcmp(getNullFormat(), m_field_buffer) == 0) {
    *is_null_value = 1;
    *buffer = 0;
  } else {
    *is_null_value = 0;
    *buffer = ATOI64(m_field_buffer);
  }
  m_is_completely_read = true;
  return HIVE_SUCCESS;
}

HiveReturn HiveRowSet::getFieldAsI64U(size_t column_idx, uint64_t* buffer, int* is_null_value,
                                      char* err_buf, size_t err_buf_len) {
  RETURN_ON_ASSERT(buffer == NULL, __FUNCTION__,
                   "Column data output buffer cannot be NULL.", err_buf, err_buf_len, HIVE_ERROR);
  RETURN_ON_ASSERT(is_null_value == NULL, __FUNCTION__,
                   "Column data is_null_value (output) cannot be NULL.", err_buf, err_buf_len,
                   HIVE_ERROR);
  RETURN_ON_ASSERT(getColumnCount() == 0, __FUNCTION__,
                   "Rowset contains zero columns.", err_buf, err_buf_len, HIVE_ERROR);
  RETURN_ON_ASSERT(column_idx >= getColumnCount(), __FUNCTION__,
                   "Column index out of bounds.", err_buf, err_buf_len, HIVE_ERROR);

  if (m_last_column_fetched != column_idx) {
    extractField(column_idx);
    m_bytes_read = 0; /* Reset the read offset if different from the last column fetched */
    m_last_column_fetched = column_idx;
    m_is_completely_read = false;
  }
  if (m_is_completely_read) {
    return HIVE_NO_MORE_DATA; /* This column has already been completely fetched */
  }
  /* If the column data is the same as the null format spec... */
  if (strcmp(getNullFormat(), m_field_buffer) == 0) {
    *is_null_value = 1;
    *buffer = 0;
  } else {
    *is_null_value = 0;
    *buffer = ATOI64U(m_field_buffer);
  }
  m_is_completely_read = true;
  return HIVE_SUCCESS;
}

/*************************************************************************************************
 * HiveSerializedRowSet Subclass Definition
 ************************************************************************************************/

HiveSerializedRowSet::HiveSerializedRowSet() {
  m_row_weak_ptr = NULL;
  m_null_format_weak_ptr = NULL;
}

HiveSerializedRowSet::~HiveSerializedRowSet() {
  /* Nothing to deallocate */
}

void HiveSerializedRowSet::initialize(Apache::Hadoop::Hive::Schema& schema, string& serialized_row) {
  m_row_weak_ptr = &serialized_row;
  /* Allocate sufficient space to prevent further resizing */
  m_field_offsets.reserve(schema.fieldSchemas.size());
  initializeOffsets(schema, serialized_row); // Initialize m_field_offsets
  assert(m_field_offsets.size() == schema.fieldSchemas.size());
  assert(schema.properties[SERIALIZATION_NULL_FORMAT].length() > 0);
  m_null_format_weak_ptr = &(schema.properties[SERIALIZATION_NULL_FORMAT]);
  /* Synchronize m_field_buffer and m_last_column_fetched now that extractField() works */
  initFieldBuffer();
}

/* This method should never be called outside of the inherited HiveRowSet::reset() */
void HiveSerializedRowSet::specialized_reset() {
  m_row_weak_ptr = NULL;
  m_field_offsets.clear();
  m_null_format_weak_ptr = NULL;
}

void HiveSerializedRowSet::initializeOffsets(Apache::Hadoop::Hive::Schema& schema, string& serialized_row) {
  m_field_offsets.push_back(0); // There will always be at least one column
  // Keep a temporary field_delim reference so we don't have to keep using the map
  string& field_delim(schema.properties[FIELD_DELIM]);
  assert(field_delim.length() > 0);

  // Assumes that field delimiters will only be one character
  size_t idx = serialized_row.find_first_of(field_delim);
  while (idx != string::npos) {
    // Set the field offset to the start of the following field
    m_field_offsets.push_back(idx + 1);
    idx = serialized_row.find_first_of(field_delim, idx + 1);
  }
}

size_t HiveSerializedRowSet::getColumnCount() {
  return m_field_offsets.size();
}

const char* HiveSerializedRowSet::getNullFormat() {
  assert(m_null_format_weak_ptr != NULL);
  return m_null_format_weak_ptr->c_str();
}

size_t HiveSerializedRowSet::getFieldLen(size_t column_idx) {
  assert(column_idx < getColumnCount());
  assert(m_row_weak_ptr != NULL);
  size_t len;
  // If this is the last column...
  if (column_idx == getColumnCount() - 1) {
    assert(m_row_weak_ptr->length() >= m_field_offsets[column_idx]);
    len = m_row_weak_ptr->length() - m_field_offsets[column_idx];
  } else {
    assert(m_field_offsets[column_idx + 1] > m_field_offsets[column_idx]);
    len = m_field_offsets[column_idx + 1] - m_field_offsets[column_idx] - 1;
  }
  /* Enforce the constraint that no data exceed MAX_BYTE_LENGTH */
  len = min(len, (size_t) MAX_BYTE_LENGTH);
  return len;
}

void HiveSerializedRowSet::extractField(size_t column_idx) {
  assert(column_idx < getColumnCount());
  assert(m_row_weak_ptr != NULL);
  /* The field buffer should always be large enough to hold the field */
  assert(getFieldLen(column_idx) < sizeof(m_field_buffer));
  /* Just safety precaution to prevent buffer overflow */
  /* Reduce buffer size by one to save space for null terminator */
  size_t extract_len = min(getFieldLen(column_idx), sizeof(m_field_buffer) - 1);
  size_t copied = m_row_weak_ptr->copy(m_field_buffer, extract_len, m_field_offsets[column_idx]);
  assert(copied == extract_len);
  /* Make sure the buffer is null terminated */
  m_field_buffer[extract_len] = '\0';
}

/*************************************************************************************************
 * HiveStringVectorRowSet Subclass Definition
 ************************************************************************************************/

HiveStringVectorRowSet::HiveStringVectorRowSet() {
  m_fields_weak_ptr = NULL;
  m_null_format_weak_ptr = NULL;
}

HiveStringVectorRowSet::~HiveStringVectorRowSet() {
  /* Nothing to deallocate */
}

void HiveStringVectorRowSet::initialize(Apache::Hadoop::Hive::Schema& schema, vector<string>* fields) {
  assert(fields != NULL);
  m_fields_weak_ptr = fields;
  assert(schema.properties[SERIALIZATION_NULL_FORMAT].length() > 0);
  m_null_format_weak_ptr = &(schema.properties[SERIALIZATION_NULL_FORMAT]);
  /* Synchronize m_field_buffer and m_last_column_fetched now that extractField() works */
  initFieldBuffer();
}

/* This method should never be called outside of the inherited HiveRowSet::reset() */
void HiveStringVectorRowSet::specialized_reset() {
  m_fields_weak_ptr = NULL;
  m_null_format_weak_ptr = NULL;
}

size_t HiveStringVectorRowSet::getColumnCount() {
  assert(m_fields_weak_ptr != NULL);
  return m_fields_weak_ptr->size();
}

const char* HiveStringVectorRowSet::getNullFormat() {
  assert(m_null_format_weak_ptr != NULL);
  return m_null_format_weak_ptr->c_str();
}

size_t HiveStringVectorRowSet::getFieldLen(size_t column_idx) {
  assert(column_idx < getColumnCount());
  assert(m_fields_weak_ptr != NULL);
  size_t len = m_fields_weak_ptr->at(column_idx).length();
  /* Enforce the constraint that no data exceed MAX_BYTE_LENGTH */
  len = min(len, (size_t) MAX_BYTE_LENGTH);
  return len;
}

void HiveStringVectorRowSet::extractField(size_t column_idx) {
  assert(column_idx < getColumnCount());
  assert(m_fields_weak_ptr != NULL);
  safe_strncpy(m_field_buffer, m_fields_weak_ptr->at(column_idx).c_str(), sizeof(m_field_buffer));
}


text:
NEUTRON = "application/vnd.org.midonet.neutron.Neutron-v3+json"
NETWORK = "application/vnd.org.midonet.neutron.Network-v1+json"
NETWORKS = "application/vnd.org.midonet.neutron.Networks-v1+json"
SUBNET = "application/vnd.org.midonet.neutron.Subnet-v1+json"
SUBNETS = "application/vnd.org.midonet.neutron.Subnets-v1+json"
PORT = "application/vnd.org.midonet.neutron.Port-v1+json"
PORTS = "application/vnd.org.midonet.neutron.Ports-v1+json"

# L3 Extension
ROUTER = "application/vnd.org.midonet.neutron.Router-v1+json"
ROUTERS = "application/vnd.org.midonet.neutron.Routers-v1+json"
ROUTER_INTERFACE = \
    "application/vnd.org.midonet.neutron.RouterInterface-v1+json"
FLOATING_IP = "application/vnd.org.midonet.neutron.FloatingIp-v1+json"
FLOATING_IPS = "application/vnd.org.midonet.neutron.FloatingIps-v1+json"

# Security Groups extension
SECURITY_GROUP = "application/vnd.org.midonet.neutron.SecurityGroup-v1+json"
SECURITY_GROUPS = "application/vnd.org.midonet.neutron.SecurityGroups-v1+json"
SG_RULE = "application/vnd.org.midonet.neutron.SecurityGroupRule-v1+json"
SG_RULES = "application/vnd.org.midonet.neutron.SecurityGroupRules-v1+json"

# Load Balancer extension
VIP = "application/vnd.org.midonet.neutron.lb.Vip-v1+json"
VIPS = "application/vnd.org.midonet.neutron.lb.Vips-v1+json"

POOL = "application/vnd.org.midonet.neutron.lb.Pool-v1+json"
POOLS = "application/vnd.org.midonet.neutron.lb.Pools-v1+json"

MEMBER = "application/vnd.org.midonet.neutron.lb.PoolMember-v1+json"
MEMBERS = "application/vnd.org.midonet.neutron.lb.PoolMembers-v1+json"

HEALTH_MONITOR = "application/vnd.org.midonet.neutron.lb.HealthMonitor-v1+json"
HEALTH_MONITORS = ("application/vnd.org.midonet"
                   ".neutron.lb.HealthMonitors-v1+json")

POOL_HEALTH_MONITOR = ("application/vnd.org.midonet"
                       ".neutron.lb.PoolHealthMonitor-v1+json")

# Firewall extension
FIREWALLS = "application/vnd.org.midonet.neutron.Firewall-v1+json"

# VPNaaS extension
VPN_SERVICE = "application/vnd.org.midonet.neutron.VPNService-v1+json"
IPSEC_SITE_CONN = "application/vnd.org.midonet.neutron.IpsecSiteConn-v1+json"


text:
void import_2_4_uchar()
{
	NumpyEigenConverter<Eigen::Matrix< boost::uint8_t, 2, 4 > >::register_converter();
}


text:
/**
 * @fileOverview Donor business logic layer.
 */

var validation = require('../utils/validation');

 module.exports = function (db) {
  var Donor = db.Donor;

  return {

    /**
     * Registers a new donor.
     *
     * @param      {Object}    donor   Donor data.
     * @param      {Function}  fn      Callback.
     */
    registerDonor: function (donor, fn) {

      // validate input
      var errors = validation.validateDonor(donor);
      if (Object.keys(errors).length > 0) {
        var err = new Error('Donor validation failed');
        err.status = 400;
        err.errors = errors;
        return fn(err);
      }

      Donor.create({
        firstName: donor.firstName,
        lastName: donor.lastName,
        contactNumber: donor.contactNumber,
        emailAddress: donor.emailAddress,
        bloodGroup: donor.bloodGroup,
        loc: donor.loc
      }, fn);
    },

    /**
     * Retreives donor by id.
     *
     * @param      {string}    id      Donor id.
     * @param      {Function}  fn      Callback.
     */
    getDonor: function (id, fn) {
      Donor.findById(id, fn);
    },

    /**
     * Updates donor data.
     *
     * @param      {string}    id      Donor id.
     * @param      {object}    data    Donor data.
     * @param      {Function}  fn      Callback.
     */
    updateDonor: function(id, data, fn) {
      // checking if donor exists first
      Donor.findById(id, function (err, donor) {
        if (err) return fn(err);

        if (!donor) {
          err = new Error('Could not find donor with id ' + id);
          err.status = 404;
          return fn(err);
        }

        // validating inputs
        var errors = validation.validateDonor(data);
        if (Object.keys(errors).length > 0) {
          err = new Error('Donor validation failed');
          err.status = 400;
          err.errors = errors;
          return fn(err);
        }

        // updating donor data
        delete data._id;
        Object.assign(donor, data);

        donor.save(fn);
      });
    },

    /**
     * Deletes donor by id.
     *
     * @param      {string}    id      Donor id.
     * @param      {Function}  fn      Callback.
     */
    deleteDonor: function(id, fn) {
      Donor.remove({ _id: id }, fn);
    },

    /**
     * Finds donors in rectanbular area specified by bottom-left and upper-right points.
     *
     * @param      {[Number]}    bl      [lng, lat] of bottom-left corner.
     * @param      {[Number]}    ur      [lng, lat] of upper-right corner.
     * @param      {Function}  fn      The function
     */
    findDonors: function (bl, ur, fn) {
      Donor.findDonors(bl, ur, fn);
    }
  };

 };


text:
<?php namespace App;
use Illuminate\Database\Eloquent\Model;
class Category extends Model {

    protected $table = 'categories';

    protected $guarded = array();

    public static $rules = array();

}


text:
cp package.json import_today_ext/package.json.backup
cp import_today_ext/empty.package.json package.json
ionic state reset
cordova plugin add https://github.com/DavidStrausz/cordova-plugin-today-widget.git
cp config.xml import_today_ext/config.xml.backup
cp import_today_ext/import.config.xml config.xml
cordova platform rm ios;cordova platform add ios
cordova plugin rm cordova-plugin-today-widget
cp -a ../tw.ios/TodayWeather/*.lproj platforms/ios/TodayWeather/
mv import_today_ext/package.json.backup package.json
mv import_today_ext/config.xml.backup config.xml
open platforms/ios/TodayWeather.xcodeproj


text:
today = Date.today
two_days_ago = Date.today - 2.days
three_days_ago = Date.today - 3.days
dates = [today, two_days_ago, three_days_ago]

User.destroy_all
TodoList.destroy_all

100.times { |index| TodoList.create! list_name: "List #{index}", list_due_date: dates.sample }

TodoList.all.each do |list|
  list.todo_items.create! [
    { title: "Task 1", due_date: dates.sample, description: "very important task TEST", completed: false },
    { title: "Task 2", due_date: dates.sample, description: "do something else TEST", completed: true},
    { title: "Task 3", due_date: dates.sample, description: "learn Action Pack TEST", completed: true}
  ]
end

users = User.create! [
  { username: "jim", password: "abc123" },
  { username: "rich", password: "123abc" }
]

User.all.each do |user|
  user.create_profile!(first_name: user.username, last_name: user.username + "last")
  user.save!
end

TodoList.all.each do |list|
  list.user = users.sample
  list.save!
end


text:
if [ -z "$CONNECTOR_HOME" ]; then
  echo "You must set the CONNECTOR_HOME variable before running this script."
  exit 1
fi

#install archetype for mediation connectors
mvn install -f "$CONNECTOR_HOME/org.wso2.carbon.mediation.library.connectors.connector-archetype/pom.xml"

mvn archetype:generate -DarchetypeCatalog=local -DarchetypeGroupId=org.wso2.carbon -DarchetypeArtifactId=org.wso2.carbon.mediation.library.connectors.connector-archetype


text:
package chandu0101.scalajs.react.components
package elementalui

import chandu0101.macros.tojs.JSMacro
import japgolly.scalajs.react._
import scala.scalajs.js
import scala.scalajs.js.`|`

case class Alert(
    className: js.UndefOr[String] = js.undefined,
    `type`: js.UndefOr[AlertType] = js.undefined) {

  def apply(children: ReactNode*) = {
    val props = JSMacro[Alert](this)
    val f = React.asInstanceOf[js.Dynamic].createFactory(Eui.Alert)
    f(props, children.toJsArray).asInstanceOf[ReactComponentU_]
  }
}

case class AlertType private (val value: String) extends AnyVal
object AlertType {
  val INFO = AlertType("info")
  val PRIMARY = AlertType("primary")
  val SUCCESS = AlertType("success")
  val WARNING = AlertType("warning")
  val DANGER = AlertType("danger")
}


text:
<?xml version="1.0" encoding="utf-8"?>
<com.goka.walker.WalkerLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/walker"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@android:color/holo_blue_light">

    <TextView
        android:id="@+id/title"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true"
        android:tag="1"
        android:text="Automatic"
        android:textColor="@android:color/white"
        android:textSize="24sp"
        android:textStyle="bold" />

    <ImageView
        android:id="@+id/img"
        android:layout_width="wrap_content"
        android:layout_height="200dp"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true"
        android:src="@drawable/iphone" />

</com.goka.walker.WalkerLayout>


text:
<?php

namespace Resty\JsonApiError\Test;

use Resty\JsonApiError\Error;
use Resty\JsonApiError\Message;
use PHPUnit\Framework\TestCase;

/**
 * MessageTest
 *
 * @category  JsonApiError
 * @package   JsonApiError
 * @author    Federico Lozada Mosto <mosto.federico@gmail.com>
 * @copyright 2017 Federico Lozada Mosto <mosto.federico@gmail.com>
 * @license   MIT License (http://www.opensource.org/licenses/mit-license.php):Error
 * @link      http://www.mostofreddy.com.ar
 */
class MessageTest extends TestCase
{
    /**
     * Test append method
     *
     * @return void
     */
    public function testAppend()
    {
        $error = (new Error())
            ->setTitle("Test");

        $message = (new Message())
            ->append($error);

        foreach ($message as $errorMessage) {
            $this->assertEquals($error, $errorMessage);
        }
    }

    /**
     * Test add method
     *
     * @return void
     */
    public function testAdd()
    {
        $title = "Test";
        $detail = "Unit Test";
        $expected = [
            "errors" => [
                [
                    'title' => $title,
                    'details' => $detail
                ]
            ]
        ];

        $message = new Message();
        $message->add($title, $detail);

        $this->assertEquals($expected, $message->toArray());
    }

    /**
     * Test jsonSerialize method
     *
     * @return void
     */
    public function testJsonSerialize()
    {
        $title = "Test";
        $detail = "Unit Test";
        $expected = [
            "errors" => [
                [
                    'title' => $title,
                    'details' => $detail
                ]
            ]
        ];

        $message = new Message();
        $message->add($title, $detail);

        $this->assertEquals(json_encode($expected), json_encode($message));
    }

    /**
     * Test count method
     *
     * @return void
     */
    public function testCount()
    {
        $title = "Test";
        $detail = "Unit Test";
        $expected = [
            "errors" => [
                [
                    'title' => $title,
                    'details' => $detail
                ]
            ]
        ];

        $message = new Message();
        $message->add($title, $detail);

        $this->assertEquals(count($expected), $message->count());
    }

    /**
     * Test serialize method
     *
     * @return void
     */
    public function testSerialize()
    {
        $title = "Test";
        $detail = "Unit Test";
        $expected = [
            "errors" => [
                [
                    'title' => $title,
                    'details' => $detail
                ]
            ]
        ];

        $message = new Message();
        $message->add($title, $detail);

        $serialization = $message->serialize();

        $message2 = new Message();
        $message2->unserialize($serialization);

        $this->assertEquals($message, $message2);
    }
}


text:
<?php

namespace Laracore\Exception;

class ModelClassNotSetException extends \Exception
{
    //
}


text:
"use strict";
import { getFormatterList, FormatterDetail } from "@textlint/linter-formatter";
import { getFixerFormatterList, FixerFormatterDetail } from "@textlint/fixer-formatter";

const optionator = require("optionator");

const concatFormatterList = (formatterList: FormatterDetail[] | FixerFormatterDetail[]) => {
    return formatterList
        .map((formatter) => {
            return formatter.name;
        })
        .join(", ");
};

export const options = optionator({
    prepend: "textlint [options] file.md [file|dir|glob*]",
    concatRepeatedArrays: true,
    mergeRepeatedObjects: true,
    options: [
        { heading: "Options" },
        {
            option: "help",
            alias: "h",
            type: "Boolean",
            description: "Show help."
        },
        {
            option: "config",
            alias: "c",
            type: "path::String",
            description: "Use configuration from this file or sharable config.",
            example: "--config /path/to/.textlintrc"
        },
        {
            option: "ignore-path",
            type: "path::String",
            description: "Specify path to a file containing patterns that describes files to ignore.",
            default: ".textlintignore",
            example: "--ignore-path /path/to/.textlintignore"
        },
        {
            option: "init",
            type: "Boolean",
            default: "false",
            description: "Create the config file if not existed."
        },
        {
            option: "fix",
            type: "Boolean",
            default: false,
            description: "Automatically fix problems",
            example: "--fix"
        },
        {
            option: "dry-run",
            type: "Boolean",
            default: false,
            description: "Enable dry-run mode for --fix. Only show result, don't change the file.",
            example: "--fix --dry-run"
        },
        {
            option: "debug",
            type: "Boolean",
            default: false,
            description: "Outputs debugging information"
        },
        {
            option: "version",
            alias: "v",
            type: "Boolean",
            description: "Outputs the version number."
        },
        {
            heading: "Using stdin"
        },
        {
            option: "stdin",
            type: "Boolean",
            default: "false",
            description: "Lint text provided on <STDIN>."
        },
        {
            option: "stdin-filename",
            type: "String",
            description: "Specify filename to process STDIN as",
            example: "cat ./README.md | textlint --stdin --stdin-filename README.md"
        },
        {
            heading: "Output"
        },
        {
            option: "output-file",
            alias: "o",
            type: "path::String",
            description: "Enable report to be written to a file."
        },
        {
            option: "format",
            alias: "f",
            type: "String",
            description: `Use a specific output format.
                             Available formatter          : ${concatFormatterList(getFormatterList())}
                             Available formatter for --fix: ${concatFormatterList(getFixerFormatterList())}`,
            example: "--format pretty-error"
        },
        {
            option: "color",
            type: "Boolean",
            default: "true",
            description: "Disable color in piped output.",
            example: "textlint --no-color"
        },
        {
            option: "quiet",
            type: "Boolean",
            default: "false",
            description: "Report errors only."
        },
        {
            heading: "Specifying rules and plugins"
        },
        {
            option: "textlintrc",
            type: "Boolean",
            default: "true",
            description: "Disable .textlintrc",
            example: "textlint --no-textlintrc --rule textlint-no-todo README.md"
        },
        {
            option: "plugin",
            type: "[String]",
            description: "Set plugin package name",
            example: "--plugin plugin-name"
        },
        {
            option: "rule",
            type: "[String]",
            description: "Set rule package name"
        },
        {
            option: "preset",
            type: "[String]",
            description: "Set preset package name and load rules from preset package."
        },
        {
            option: "rulesdir",
            type: "[path::String]",
            description: "Use additional rules from this directory"
        },
        {
            heading: "Caching"
        },
        {
            option: "cache",
            type: "Boolean",
            default: "false",
            description: "Only check changed files",
            example: "textlint --cache docs/"
        },
        {
            option: "cache-location",
            type: "path::String",
            description: "Path to the cache file or directory",
            example: 'textlint --cache --cache-location "/Users/user/.textlintcache" docs/'
        },
        {
            heading: "Experimental"
        },
        {
            option: "experimental",
            type: "Boolean",
            default: false,
            description: "Enable experimental flag.Some feature use on experimental.",
            example: "--experimental"
        },
        {
            option: "rules-base-directory",
            type: "path::String",
            description:
                "Set module base directory. textlint load modules(rules/presets/plugins) from the base directory.",
            example: 'textlint --rules-base-directory "/path/to/other/project/node_modules/"'
        },
        {
            option: "parallel",
            type: "Boolean",
            description: "Lint files in parallel",
            example: 'textlint --experimental --parallel "*.md"'
        },
        {
            option: "max-concurrency",
            type: "Number",
            description: "maxConcurrency for --parallel",
            example: "textlint --experimental --parallel --maxConcurrency 4"
        }
    ]
});


text:
package course.examples.viewpager;

import android.os.Bundle;
import android.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.View.OnClickListener;
import android.widget.ImageView;
import android.widget.Toast;

// Each instance holds one image to be displayed in the ViewPager
public class ImageHolderFragment extends Fragment {

    public static final String RES_ID = "res_id";
    public static final String NAME = "name";

    private String mName;

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {

        // Retrieve arguments
        final Bundle args = getArguments();
        mName = args.getString(NAME);
        int id = args.getInt(RES_ID);

        // Retrieve ImageView
        ImageView imageView = (ImageView) inflater.inflate(R.layout.page, container, false);

        // Set the Image for the ImageView
        imageView.setImageResource(id);

        // Set an setOnItemClickListener on the image
        imageView.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                // Display a Toast message indicate the selected item
                Toast.makeText(getActivity(), mName, Toast.LENGTH_SHORT).show();
            }
        });

        return imageView;
    }
}


text:
<title>
Piden apoyo a otras uniones
</title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<?php include "../../legacy-includes/Script.htmlf" ?>

<?php include "../../legacy-includes/TopLogo.htmlf" ?>

<?php include "../../legacy-includes/TopAd.htmlf" ?>

<?php include "../../legacy-includes/LeftButtons.htmlf" ?>

<?php include "../../legacy-includes/BodyInsert.htmlf" ?>

Sindicato arrecia su campaña en Cintas:

Piden apoyo a otras uniones

Por Lauren Fleer | 13 de junio de 2003 | Página 4

Chicago--Un grupo de manifestantes, uno disfrazado como una taza de café, se concentraron y marcharon a mediados de mayo para protestar el contrato recién firmado por Starbucks con Cintas, la gigantesca lavandería industrial.

Cintas emplea a 1,000 trabajadores en el área de Chicago y a 17,000 por todo el país. En semanas recientes, los manifestantes han protestado en ciudades a lo largo de EE.UU., como Nueva York, Las Vegas y San Francisco, como parte de una campaña nacional organizada por el sindicato UNITE.

Cintas es la lavandería industrial y la proveedora de uniformes rentados más grande de Norte América, y controla más del 30 por ciento del mercado. Tiene contratos nacionales lucrativos con corporaciones tales como Exxon, Firestone, Ford y UPS.  Más de 5 millones de trabajadores usan los uniformes de Cintas todos los días.

"Y son trabajadores dedicados, miembros bien pagados de sindicatos", observó el organizador de UNITE, Pete DeMay. "La etiqueta de Cintas le da una puñalada en la espalda. La compañía Cintas representa todo lo contrario de por lo que ellos han luchado".

UNITE le está pidiendo a los locales de los sindicatos a que presionen a sus patrones para que no renueven sus contratos con Cintas. Mientras que Cintas ahora tiene ingresos cinco veces mayores que 10 años atrás--los empleados de Cintas trabajan todavía  bajo condiciones peligrosas, ganan un sueldo miserable, y no les alcanza para pagar el plan médico de sus familias.

Los $234 millones en ganancias de la compañía, son buenos para darle a los ejecutivos salarios fabulosos. Pero los empleados de Cintas se ganan entre $6 y $11 por hora, y tienen que pagar hasta $180 al mes por el plan médico, con un deducible de $400. Se han presentado más de 40 demandas legales contra la compañía por su discriminación racial, sexual, por edad y por incapacidad.

La agencia federal que media las relacionas laborales, la NLRB (por sus siglas en inglés), ha radicado más de 25 cargos contra Cintas por sus violaciones a las leyes laborales federales. Y un pleito de $100 millones está actualmente pendiente contra Cintas porque le ha estafado el pago de horas extras--a sus trabajadores.

Pero hasta ahora Cintas ha salido ilesa de estos desafíos legales. Mientras que la compañía persiste en espiar a los trabajadores y ha recurrido a despidos para intimidar y obligarlos a que no se sindicalicen, UNITE arrecia la presión contra ésta.

<?php include "../../legacy-includes/BottomNavLinksObrero.htmlf" ?>

<?php include "../../legacy-includes/RightAdObrero.htmlf" ?>


text:
using System.Collections.Generic;
using Sketching.Common.Helper;
using Xamarin.Forms;

namespace Sketching.Common.Tools
{
	public class LineTool : StrokeToolBase
	{
		private int GridSize => Config.GridSize;

		/// <summary>
		/// LineTool with default values
		/// </summary>
		public LineTool() : this(ToolNames.LineTool, 1, 20, 8, string.Empty, null) { }

		/// <summary>
		/// Customized LineTool with default sizes
		/// </summary>
		public LineTool(string name, string customToolbarName, IEnumerable<KeyValuePair<string, Color>> customToolbarColors) : this(name, 1, 20, 8, customToolbarName, customToolbarColors) { }

		/// <summary>
		/// Custom made LineTool
		/// </summary>
		public LineTool(string name, double minSize, double maxSize, double startSize, string customToolbarName, IEnumerable<KeyValuePair<string, Color>> customToolbarColors)
		{
			CanUseFill = false;
			Name = name;
			Geometry.MinSize = minSize;
			Geometry.MaxSize = maxSize;
			Geometry.Size = startSize;
			Geometry.HighLight = false;
			CustomToolbarName = customToolbarName;
			CustomToolbarColors = customToolbarColors;
		}

		private void Snap(ref Point p)
		{
			if (GridSize < 0) return;
			var x = (int)((p.X + GridSize / 2.0) / GridSize) * GridSize;
			var y = (int)((p.Y + GridSize / 2.0) / GridSize) * GridSize;
			p.X = x;
			p.Y = y;

		}

		public override void TouchStart(Point p)
		{
			base.TouchStart(p);
			Snap(ref p);
			AddPoint(p);

		}

		public override void TouchMove(Point p)
		{
			base.TouchMove(p);
			Snap(ref p);
			AddPoint(p);

		}

		public override void TouchEnd(Point p)
		{
			base.TouchEnd(p);
			CreateNewGeometry();
		}

		private void AddPoint(Point p)
		{
			if (Geometry.Points.Count < 2)
			{
				Geometry.Points.Add(p);
			}
			else if (Geometry.Points.Count == 2)
			{
				Geometry.Points[1] = p;
			}
		}
	}
}