text:
require 'aws-sdk'
Aws.use_bundled_cert!
require_relative 'zenv'

module Smash
  module CloudPowers
    # Provides authentication to cloud resources, e.g. AWS
    module Auth
      extend Smash::CloudPowers::Zenv

      # This method is usable before an object is instantiated in order
      # to provide an <tt>Aws::Credentials</tt> object that will allow access to all the
      # resources in the account that zfind searches for, using the <tt>ACCOUNT_NUMBER</tt>
      # key.
      #
      # Returns
      # <tt>Aws::Credentials</tt>
      #
      # Example
      #   Auth.creds
      #   => Aws::Credentials # can be used to authenticate to AWS
      #
      # Notes
      # * This method relies on +#zfind()+ to locate the key/secret strings
      # * See +Smash::CloudPowers::Zenv#zfind()+
      def self.creds
        @creds ||= Aws::Credentials.new(
          zfind(:aws_access_key_id),
          zfind(:aws_secret_access_key)
        )
      end

      # This method is able to be called before an object is instantiated in order
      # to provide a region in AWS-landia.
      #
      # Returns
      # The region set in configuration or a <tt>'us-west-2'</tt> default <tt>String</tt>
      #
      # Example
      #   Auth.region
      #   => 'us-east-1'
      def self.region
        zfind(:aws_region) || 'us-west-2'
      end
    end
  end
end

redpajama_set_name: RedPajamaGithub


text:
ccui.getLayoutManager = function (type) {
    switch (type) {
        case ccui.Layout.LINEAR_VERTICAL:
            return ccui.linearVerticalLayoutManager;
        case ccui.Layout.LINEAR_HORIZONTAL:
            return ccui.linearHorizontalLayoutManager;
        case ccui.Layout.RELATIVE:
            return ccui.relativeLayoutManager;
    }
    return null;
};

ccui.linearVerticalLayoutManager = {
    _doLayout: function(layout){
        var layoutSize = layout._getLayoutContentSize();
        var container = layout._getLayoutElements();
        var topBoundary = layoutSize.height;

        for (var i = 0, len = container.length; i < len; i++) {
            var child = container[i];
            if (child) {
                var layoutParameter = child.getLayoutParameter();

                if (layoutParameter){
                    var childGravity = layoutParameter.getGravity();
                    var ap = child.getAnchorPoint();
                    var cs = child.getContentSize();
                    var finalPosX = ap.x * cs.width;
                    var finalPosY = topBoundary - ((1.0-ap.y) * cs.height);
                    switch (childGravity){
                        case ccui.LinearLayoutParameter.NONE:
                        case ccui.LinearLayoutParameter.LEFT:
                            break;
                        case ccui.LinearLayoutParameter.RIGHT:
                            finalPosX = layoutSize.width - ((1.0 - ap.x) * cs.width);
                            break;
                        case ccui.LinearLayoutParameter.CENTER_HORIZONTAL:
                            finalPosX = layoutSize.width / 2.0 - cs.width * (0.5-ap.x);
                            break;
                        default:
                            break;
                    }
                    var mg = layoutParameter.getMargin();
                    finalPosX += mg.left;
                    finalPosY -= mg.top;
                    child.setPosition(finalPosX, finalPosY);
                    topBoundary = child.getPositionY() - child.getAnchorPoint().y * child.getContentSize().height - mg.bottom;
                }
            }
        }
    }
};

ccui.linearHorizontalLayoutManager = {
    _doLayout: function(layout){
        var layoutSize = layout._getLayoutContentSize();
        var container = layout._getLayoutElements();
        var leftBoundary = 0.0;
        for (var i = 0, len = container.length;  i < len; i++) {
            var child = container[i];
            if (child) {
                var layoutParameter = child.getLayoutParameter();
                if (layoutParameter){
                    var childGravity = layoutParameter.getGravity();
                    var ap = child.getAnchorPoint();
                    var cs = child.getSize();
                    var finalPosX = leftBoundary + (ap.x * cs.width);
                    var finalPosY = layoutSize.height - (1.0 - ap.y) * cs.height;
                    switch (childGravity){
                        case ccui.LinearLayoutParameter.NONE:
                        case ccui.LinearLayoutParameter.TOP:
                            break;
                        case ccui.LinearLayoutParameter.BOTTOM:
                            finalPosY = ap.y * cs.height;
                            break;
                        case ccui.LinearLayoutParameter.CENTER_VERTICAL:
                            finalPosY = layoutSize.height / 2.0 - cs.height * (0.5 - ap.y);
                            break;
                        default:
                            break;
                    }
                    var mg = layoutParameter.getMargin();
                    finalPosX += mg.left;
                    finalPosY -= mg.top;
                    child.setPosition(finalPosX, finalPosY);
                    leftBoundary = child.getRightBoundary() + mg.right;
                }
            }
        }
    }
};

ccui.relativeLayoutManager = {
    _unlayoutChildCount: 0,
    _widgetChildren: [],
    _widget: null,
    _finalPositionX:0,
    _finalPositionY:0,
    _relativeWidgetLP:null,

    _doLayout: function(layout){
        this._widgetChildren = this._getAllWidgets(layout);

        var locChildren = this._widgetChildren;
        while (this._unlayoutChildCount > 0) {
            for (var i = 0, len = locChildren.length;  i < len; i++) {
                this._widget = locChildren[i];

                var layoutParameter = this._widget.getLayoutParameter();
                if (layoutParameter){
                    if (layoutParameter._put)
                        continue;

                    var ret = this._calculateFinalPositionWithRelativeWidget(layout);
                    if (!ret)
                        continue;

                    this._calculateFinalPositionWithRelativeAlign();

                    this._widget.setPosition(this._finalPositionX, this._finalPositionY);
                    layoutParameter._put = true;
                }
            }
            this._unlayoutChildCount--;
        }
        this._widgetChildren.length = 0;
    },

    _getAllWidgets: function(layout){
        var container = layout._getLayoutElements();
        var locWidgetChildren = this._widgetChildren;
        locWidgetChildren.length = 0;
        for (var i = 0, len = container.length; i < len; i++){
            var child = container[i];
            if (child) {
                var layoutParameter = child.getLayoutParameter();
                layoutParameter._put = false;
                this._unlayoutChildCount++;
                locWidgetChildren.push(child);
            }
        }
        return locWidgetChildren;
    },

    _getRelativeWidget: function(widget){
        var relativeWidget = null;
        var layoutParameter = widget.getLayoutParameter();
        var relativeName = layoutParameter.getRelativeToWidgetName();

        if (relativeName && relativeName.length != 0) {
            var locChildren =  this._widgetChildren;
            for(var i = 0, len = locChildren.length;  i  < len; i++){
                var child = locChildren[i];
                if (child){
                    var rlayoutParameter = child.getLayoutParameter();
                    if (rlayoutParameter &&  rlayoutParameter.getRelativeName() == relativeName) {
                        relativeWidget = child;
                        this._relativeWidgetLP = rlayoutParameter;
                        break;
                    }
                }
            }
        }
        return relativeWidget;
    },

    _calculateFinalPositionWithRelativeWidget: function(layout){
        var locWidget = this._widget;
        var ap = locWidget.getAnchorPoint();
        var cs = locWidget.getContentSize();

        this._finalPositionX = 0.0;
        this._finalPositionY = 0.0;

        var relativeWidget = this._getRelativeWidget(locWidget);
        var layoutParameter = locWidget.getLayoutParameter();
        var align = layoutParameter.getAlign();
        var layoutSize = layout._getLayoutContentSize();

        switch (align) {
            case ccui.RelativeLayoutParameter.NONE:
            case ccui.RelativeLayoutParameter.PARENT_TOP_LEFT:
                this._finalPositionX = ap.x * cs.width;
                this._finalPositionY = layoutSize.height - ((1.0 - ap.y) * cs.height);
                break;
            case ccui.RelativeLayoutParameter.PARENT_TOP_CENTER_HORIZONTAL:
                this._finalPositionX = layoutSize.width * 0.5 - cs.width * (0.5 - ap.x);
                this._finalPositionY = layoutSize.height - ((1.0 - ap.y) * cs.height);
                break;
            case ccui.RelativeLayoutParameter.PARENT_TOP_RIGHT:
                this._finalPositionX = layoutSize.width - ((1.0 - ap.x) * cs.width);
                this._finalPositionY = layoutSize.height - ((1.0 - ap.y) * cs.height);
                break;
            case ccui.RelativeLayoutParameter.PARENT_LEFT_CENTER_VERTICAL:
                this._finalPositionX = ap.x * cs.width;
                this._finalPositionY = layoutSize.height * 0.5 - cs.height * (0.5 - ap.y);
                break;
            case ccui.RelativeLayoutParameter.CENTER_IN_PARENT:
                this._finalPositionX = layoutSize.width * 0.5 - cs.width * (0.5 - ap.x);
                this._finalPositionY = layoutSize.height * 0.5 - cs.height * (0.5 - ap.y);
                break;
            case ccui.RelativeLayoutParameter.PARENT_RIGHT_CENTER_VERTICAL:
                this._finalPositionX = layoutSize.width - ((1.0 - ap.x) * cs.width);
                this._finalPositionY = layoutSize.height * 0.5 - cs.height * (0.5 - ap.y);
                break;
            case ccui.RelativeLayoutParameter.PARENT_LEFT_BOTTOM:
                this._finalPositionX = ap.x * cs.width;
                this._finalPositionY = ap.y * cs.height;
                break;
            case ccui.RelativeLayoutParameter.PARENT_BOTTOM_CENTER_HORIZONTAL:
                this._finalPositionX = layoutSize.width * 0.5 - cs.width * (0.5 - ap.x);
                this._finalPositionY = ap.y * cs.height;
                break;
            case ccui.RelativeLayoutParameter.PARENT_RIGHT_BOTTOM:
                this._finalPositionX = layoutSize.width - ((1.0 - ap.x) * cs.width);
                this._finalPositionY = ap.y * cs.height;
                break;

            case ccui.RelativeLayoutParameter.LOCATION_ABOVE_LEFTALIGN:
                if (relativeWidget){
                    if (this._relativeWidgetLP && !this._relativeWidgetLP._put)
                        return false;
                    this._finalPositionY = relativeWidget.getTopBoundary() + ap.y * cs.height;
                    this._finalPositionX = relativeWidget.getLeftBoundary() + ap.x * cs.width;
                }
                break;
            case ccui.RelativeLayoutParameter.LOCATION_ABOVE_CENTER:
                if (relativeWidget){
                    if (this._relativeWidgetLP && !this._relativeWidgetLP._put)
                        return false;
                    var rbs = relativeWidget.getContentSize();
                    this._finalPositionY = relativeWidget.getTopBoundary() + ap.y * cs.height;
                    this._finalPositionX = relativeWidget.getLeftBoundary() + rbs.width * 0.5 + ap.x * cs.width - cs.width * 0.5;
                }
                break;
            case ccui.RelativeLayoutParameter.LOCATION_ABOVE_RIGHTALIGN:
                if (relativeWidget) {
                    if (this._relativeWidgetLP && !this._relativeWidgetLP._put)
                        return false;
                    this._finalPositionY = relativeWidget.getTopBoundary() + ap.y * cs.height;
                    this._finalPositionX = relativeWidget.getRightBoundary() - (1.0 - ap.x) * cs.width;
                }
                break;
            case ccui.RelativeLayoutParameter.LOCATION_LEFT_OF_TOPALIGN:
                if (relativeWidget){
                    if (this._relativeWidgetLP && !this._relativeWidgetLP._put)
                        return false;
                    this._finalPositionY = relativeWidget.getTopBoundary() - (1.0 - ap.y) * cs.height;
                    this._finalPositionX = relativeWidget.getLeftBoundary() - (1.0 - ap.x) * cs.width;
                }
                break;
            case ccui.RelativeLayoutParameter.LOCATION_LEFT_OF_CENTER:
                if (relativeWidget) {
                    if (this._relativeWidgetLP && !this._relativeWidgetLP._put)
                        return false;
                    var rbs = relativeWidget.getContentSize();
                    this._finalPositionX = relativeWidget.getLeftBoundary() - (1.0 - ap.x) * cs.width;
                    this._finalPositionY = relativeWidget.getBottomBoundary() + rbs.height * 0.5 + ap.y * cs.height - cs.height * 0.5;
                }
                break;
            case ccui.RelativeLayoutParameter.LOCATION_LEFT_OF_BOTTOMALIGN:
                if (relativeWidget) {
                    if (this._relativeWidgetLP && !this._relativeWidgetLP._put)
                        return false;
                    this._finalPositionY = relativeWidget.getBottomBoundary() + ap.y * cs.height;
                    this._finalPositionX = relativeWidget.getLeftBoundary() - (1.0 - ap.x) * cs.width;
                }
                break;
            case ccui.RelativeLayoutParameter.LOCATION_RIGHT_OF_TOPALIGN:
                if (relativeWidget){
                    if (this._relativeWidgetLP && !this._relativeWidgetLP._put)
                        return false;
                    this._finalPositionY = relativeWidget.getTopBoundary() - (1.0 - ap.y) * cs.height;
                    this._finalPositionX = relativeWidget.getRightBoundary() + ap.x * cs.width;
                }
                break;
            case ccui.RelativeLayoutParameter.LOCATION_RIGHT_OF_CENTER:
                if (relativeWidget){
                    if (this._relativeWidgetLP && !this._relativeWidgetLP._put)
                        return false;
                    var rbs = relativeWidget.getContentSize();
                    var locationRight = relativeWidget.getRightBoundary();
                    this._finalPositionX = locationRight + ap.x * cs.width;
                    this._finalPositionY = relativeWidget.getBottomBoundary() + rbs.height * 0.5 + ap.y * cs.height - cs.height * 0.5;
                }
                break;
            case ccui.RelativeLayoutParameter.LOCATION_RIGHT_OF_BOTTOMALIGN:
                if (relativeWidget){
                    if (this._relativeWidgetLP && !this._relativeWidgetLP._put)
                        return false;
                    this._finalPositionY = relativeWidget.getBottomBoundary() + ap.y * cs.height;
                    this._finalPositionX = relativeWidget.getRightBoundary() + ap.x * cs.width;
                }
                break;
            case ccui.RelativeLayoutParameter.LOCATION_BELOW_LEFTALIGN:
                if (relativeWidget){
                    if (this._relativeWidgetLP && !this._relativeWidgetLP._put)
                        return false;
                    this._finalPositionY =  relativeWidget.getBottomBoundary() - (1.0 - ap.y) * cs.height;
                    this._finalPositionX = relativeWidget.getLeftBoundary() + ap.x * cs.width;
                }
                break;
            case ccui.RelativeLayoutParameter.LOCATION_BELOW_CENTER:
                if (relativeWidget) {
                    if (this._relativeWidgetLP && !this._relativeWidgetLP._put)
                        return false;
                    var rbs = relativeWidget.getContentSize();
                    this._finalPositionY = relativeWidget.getBottomBoundary() - (1.0 - ap.y) * cs.height;
                    this._finalPositionX = relativeWidget.getLeftBoundary() + rbs.width * 0.5 + ap.x * cs.width - cs.width * 0.5;
                }
                break;
            case ccui.RelativeLayoutParameter.LOCATION_BELOW_RIGHTALIGN:
                if (relativeWidget) {
                    if (this._relativeWidgetLP && !this._relativeWidgetLP._put)
                        return false;
                    this._finalPositionY = relativeWidget.getBottomBoundary() - (1.0 - ap.y) * cs.height;
                    this._finalPositionX = relativeWidget.getRightBoundary() - (1.0 - ap.x) * cs.width;
                }
                break;
            default:
                break;
        }
        return true;
    },

    _calculateFinalPositionWithRelativeAlign: function(){
        var layoutParameter = this._widget.getLayoutParameter();

        var mg = layoutParameter.getMargin();
        var align = layoutParameter.getAlign();

        //handle margin
        switch (align) {
            case ccui.RelativeLayoutParameter.NONE:
            case ccui.RelativeLayoutParameter.PARENT_TOP_LEFT:
                this._finalPositionX += mg.left;
                this._finalPositionY -= mg.top;
                break;
            case ccui.RelativeLayoutParameter.PARENT_TOP_CENTER_HORIZONTAL:
                this._finalPositionY -= mg.top;
                break;
            case ccui.RelativeLayoutParameter.PARENT_TOP_RIGHT:
                this._finalPositionX -= mg.right;
                this._finalPositionY -= mg.top;
                break;
            case ccui.RelativeLayoutParameter.PARENT_LEFT_CENTER_VERTICAL:
                this._finalPositionX += mg.left;
                break;
            case ccui.RelativeLayoutParameter.CENTER_IN_PARENT:
                break;
            case ccui.RelativeLayoutParameter.PARENT_RIGHT_CENTER_VERTICAL:
                this._finalPositionX -= mg.right;
                break;
            case ccui.RelativeLayoutParameter.PARENT_LEFT_BOTTOM:
                this._finalPositionX += mg.left;
                this._finalPositionY += mg.bottom;
                break;
            case ccui.RelativeLayoutParameter.PARENT_BOTTOM_CENTER_HORIZONTAL:
                this._finalPositionY += mg.bottom;
                break;
            case ccui.RelativeLayoutParameter.PARENT_RIGHT_BOTTOM:
                this._finalPositionX -= mg.right;
                this._finalPositionY += mg.bottom;
                break;
            case ccui.RelativeLayoutParameter.LOCATION_ABOVE_LEFTALIGN:
                this._finalPositionY += mg.bottom;
                this._finalPositionX += mg.left;
                break;
            case ccui.RelativeLayoutParameter.LOCATION_ABOVE_RIGHTALIGN:
                this._finalPositionY += mg.bottom;
                this._finalPositionX -= mg.right;
                break;
            case ccui.RelativeLayoutParameter.LOCATION_ABOVE_CENTER:
                this._finalPositionY += mg.bottom;
                break;
            case ccui.RelativeLayoutParameter.LOCATION_LEFT_OF_TOPALIGN:
                this._finalPositionX -= mg.right;
                this._finalPositionY -= mg.top;
                break;
            case ccui.RelativeLayoutParameter.LOCATION_LEFT_OF_BOTTOMALIGN:
                this._finalPositionX -= mg.right;
                this._finalPositionY += mg.bottom;
                break;
            case ccui.RelativeLayoutParameter.LOCATION_LEFT_OF_CENTER:
                this._finalPositionX -= mg.right;
                break;
            case ccui.RelativeLayoutParameter.LOCATION_RIGHT_OF_TOPALIGN:
                this._finalPositionX += mg.left;
                this._finalPositionY -= mg.top;
                break;
            case ccui.RelativeLayoutParameter.LOCATION_RIGHT_OF_BOTTOMALIGN:
                this._finalPositionX += mg.left;
                this._finalPositionY += mg.bottom;
                break;
            case ccui.RelativeLayoutParameter.LOCATION_RIGHT_OF_CENTER:
                this._finalPositionX += mg.left;
                break;
            case ccui.RelativeLayoutParameter.LOCATION_BELOW_LEFTALIGN:
                this._finalPositionY -= mg.top;
                this._finalPositionX += mg.left;
                break;
            case ccui.RelativeLayoutParameter.LOCATION_BELOW_RIGHTALIGN:
                this._finalPositionY -= mg.top;
                this._finalPositionX -= mg.right;
                break;
            case ccui.RelativeLayoutParameter.LOCATION_BELOW_CENTER:
                this._finalPositionY -= mg.top;
                break;
            default:
                break;
        }
    }
};


text:
layout: page
title: Sphere Orb Air Executive Retreat
date: 2016-05-24
author: Danielle Lynch
tags: weekly links, java
status: published
summary: Nulla mattis accumsan posuere. Ut.
banner: images/banner/wedding.jpg
booking:
  startDate: 09/10/2016
  endDate: 09/13/2016
  ctyhocn: CHITDHX
  groupCode: SOAER
published: true
---
Maecenas vitae est sit amet magna varius fermentum in sed urna. Aliquam efficitur convallis pellentesque. Donec malesuada faucibus libero a vehicula. Mauris pretium hendrerit erat, at convallis elit blandit sit amet. Donec et blandit metus. Praesent eros turpis, tristique vel sem id, pellentesque cursus libero. Maecenas enim risus, ultricies efficitur massa et, consectetur faucibus quam. Vestibulum metus nunc, rhoncus eget imperdiet non, porttitor a dolor. Aenean id purus vel ex posuere facilisis sed eu dolor. Integer convallis, nisi at fringilla dictum, ipsum massa scelerisque arcu, eget scelerisque arcu nulla ut urna.

1 In volutpat sapien ac diam blandit bibendum
1 Suspendisse tempor ipsum tristique nibh tristique maximus
1 Integer sagittis dui vitae malesuada mattis
1 Pellentesque non enim ac velit iaculis luctus
1 Nullam vulputate sem facilisis aliquam fermentum.

Morbi turpis erat, volutpat dictum nisl in, blandit auctor arcu. Etiam consectetur congue massa id egestas. Duis est nisl, viverra ac urna a, sagittis aliquam odio. Nullam id ligula eleifend, pulvinar eros in, laoreet ipsum. Morbi iaculis, justo sed porta tincidunt, lorem lacus posuere ligula, nec cursus arcu neque et diam. Praesent posuere urna accumsan, iaculis lectus id, mollis lacus. Donec quis facilisis quam.


text:
if ( [ -z "$GHA2DB_PROJECT" ] || [ -z "$PG_DB" ] || [ -z "$PG_PASS" ] )
then
  echo "$0: you need to set GHA2DB_PROJECT, PG_DB and PG_PASS env variables to use this script"
  exit 1
fi
proj=$GHA2DB_PROJECT
echo "Setting up $proj repository groups"
./runq "scripts/$proj/repo_groups.sql"


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

namespace MinimalisticTelnet
{
    enum Verbs {
        WILL = 251,
        WONT = 252,
        DO = 253,
        DONT = 254,
        IAC = 255
    }

    enum Options
    {
        SGA = 3
    }

    class TelnetConnection
    {
        TcpClient tcpSocket;

        int TimeOutMs = 100;

        public TelnetConnection(string Hostname, int Port)
        {
            tcpSocket = new TcpClient(Hostname, Port);

        }

        public TelnetConnection()
        {

        }

        public bool Connect(string Hostname, string Port)
        {
            int intPort;

            try
            {
                intPort = int.Parse(Port);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error Port '" + Port + "': " + ex.Message + "\r");

                return false;
            }

            try
            {
                tcpSocket = new TcpClient(Hostname, intPort);

                return IsConnected;
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error connecting: " + ex.Message + "\r");

                return false;
            }
        }

        public string Login(string Username,string Password,int LoginTimeOutMs)
        {
            int oldTimeOutMs = TimeOutMs;
            TimeOutMs = LoginTimeOutMs;
            string s = Read();
            if (!s.TrimEnd().EndsWith(":"))
               throw new Exception("Failed to connect : no login prompt");
            WriteLine(Username);

            s += Read();
            if (!s.TrimEnd().EndsWith(":"))
                throw new Exception("Failed to connect : no password prompt");
            WriteLine(Password);

            s += Read();
            TimeOutMs = oldTimeOutMs;
            return s;
        }

        public void WriteLine(string cmd)
        {
            Write(cmd + "\n");
        }

        public void Write(string cmd)
        {
            if (!tcpSocket.Connected) return;
            byte[] buf = System.Text.ASCIIEncoding.ASCII.GetBytes(cmd.Replace("\0xFF","\0xFF\0xFF"));
            tcpSocket.GetStream().Write(buf, 0, buf.Length);
        }

        public string Read()
        {
            if (!tcpSocket.Connected) return null;
            StringBuilder sb=new StringBuilder();
            do
            {
                ParseTelnet(sb);
                System.Threading.Thread.Sleep(TimeOutMs);
            } while (tcpSocket.Available > 0);
            return sb.ToString();
        }

        public bool IsConnected
        {
            get { return tcpSocket.Connected; }
        }

        public void Close()
        {
            if (IsConnected)
            {
                tcpSocket.Close();
            }
        }

        void ParseTelnet(StringBuilder sb)
        {
            while (tcpSocket.Available > 0)
            {
                int input = tcpSocket.GetStream().ReadByte();
                switch (input)
                {
                    case -1 :
                        break;
                    case (int)Verbs.IAC:
                        // interpret as command
                        int inputverb = tcpSocket.GetStream().ReadByte();
                        if (inputverb == -1) break;
                        switch (inputverb)
                        {
                            case (int)Verbs.IAC:
                                //literal IAC = 255 escaped, so append char 255 to string
                                sb.Append(inputverb);
                                break;
                            case (int)Verbs.DO:
                            case (int)Verbs.DONT:
                            case (int)Verbs.WILL:
                            case (int)Verbs.WONT:
                                // reply to all commands with "WONT", unless it is SGA (suppres go ahead)
                                int inputoption = tcpSocket.GetStream().ReadByte();
                                if (inputoption == -1) break;
                                tcpSocket.GetStream().WriteByte((byte)Verbs.IAC);
                                if (inputoption == (int)Options.SGA )
                                    tcpSocket.GetStream().WriteByte(inputverb == (int)Verbs.DO ? (byte)Verbs.WILL:(byte)Verbs.DO);
                                else
                                    tcpSocket.GetStream().WriteByte(inputverb == (int)Verbs.DO ? (byte)Verbs.WONT : (byte)Verbs.DONT);
                                tcpSocket.GetStream().WriteByte((byte)inputoption);
                                break;
                            default:
                                break;
                        }
                        break;
                    default:
                        sb.Append( (char)input );
                        break;
                }
            }
        }
    }
}


text:
package net.lifove.research.weka.lpuutil;

public class InstanceItem {
	int idx;
	int value;
	public InstanceItem(int idx, int value) {
		super();
		this.idx = idx;
		this.value = value;
	}
	public InstanceItem(String[] content) {
		super();
		if (content.length != 2)
			return;

		this.idx = Integer.parseInt(content[0]);
		this.value = Integer.parseInt(content[1]);
	}

	public int getIdx() {
		return idx;
	}
	public void setIdx(int idx) {
		this.idx = idx;
	}
	public int getValue() {
		return value;
	}
	public void setValue(int value) {
		this.value = value;
	}
}


text:
using Microsoft.Build.Construction;
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using System.Xml.Linq;

namespace Microsoft.DotNet.Build.Tasks
{
    // The BinInspect tool we use for signing validation does not support
    // baselining, this task is used to inspect the results and determine
    // if there is an actual failure we care about.
    public class ValidateBinInspectResults : BuildTask
    {
        private static readonly string s_RootElement = "DATA";
        private static readonly string s_RowElement = "ROW";
        private static readonly string s_ErrorElement = "Err";
        private static readonly string s_NameElement = "Full";
        private static readonly string s_ResultElement = "Pass";

        [Required]
        public string ResultsXml { get; set; }

        // list of Regex's to ignore
        public ITaskItem [] BaselineFiles { get; set; }

        [Output]
        public ITaskItem[] ErrorResults { get; set; }

        public override bool Execute()
        {
            XDocument xdoc = XDocument.Load(ResultsXml);

            var rows = xdoc.Descendants(s_RootElement).Descendants(s_RowElement);

            List<ITaskItem> reportedFailures = new List<ITaskItem>();

            // Gather all of the rows with error results
            IEnumerable<XElement> errorRows = from descendant in rows
                            where descendant.Descendants().FirstOrDefault(f => f.Name == s_ResultElement).Value == "False"
                            select descendant;

            // Filter out baselined files which are stored as regex patterns
            HashSet<XElement> baselineExcludeElements = new HashSet<XElement>();
            if(BaselineFiles != null)
            {
                foreach(var baselineFile in BaselineFiles)
                {
                    IEnumerable<XElement> baselineExcluded = errorRows.Where(f => Regex.IsMatch(f.Descendants(s_NameElement).First().Value, baselineFile.ItemSpec, RegexOptions.IgnoreCase));
                    foreach(var baselineExclude in baselineExcluded)
                    {
                        baselineExcludeElements.Add(baselineExclude);
                    }
                }
            }
            // Gather the results with baselined files filtered out
            IEnumerable<XElement> baselinedRows = errorRows.Except(baselineExcludeElements);

            foreach (var filteredRow in baselinedRows)
            {
                ITaskItem item = new TaskItem(filteredRow.Descendants(s_NameElement).First().Value);
                item.SetMetadata("Error", filteredRow.Descendants(s_ErrorElement).First().Value);
                reportedFailures.Add(item);
            }

            ErrorResults = reportedFailures.ToArray();
            foreach(var result in ErrorResults)
            {
                Log.LogError($"{result.ItemSpec} failed with error {result.GetMetadata("Error")}");
            }
            return !Log.HasLoggedErrors;
        }
    }
}


text:
// Original can be found at:  https://bitbucket.org/lindenlab/llsd
// Modifications by Joshua Bell inexorabletash@gmail.com
//  * Restructure the creation of types and exporting to global namespace
//  * Allow no arguments to DataView constructor
//  * Work cross-frame with native arrays/shimmed DataView
//  * Corrected Object.defineProperty shim for IE8
//  * Correct offset when taking subarray of subarray

// ES3/ES5 implementation of the Krhonos TypedArray Working Draft (work in progress):
//   Ref: https://cvs.khronos.org/svn/repos/registry/trunk/public/webgl/doc/spec/TypedArray-spec.html
//   Date: 2011-02-01
//
// Variations:
//  * Float/Double -> Float32/Float64, per WebGL-Public mailing list conversations (post 5/17)
//  * Allows typed_array.get/set() as alias for subscripts (typed_array[])

(function (global) {
  "use strict";

  var USE_NATIVE_IF_AVAILABLE = true;

  // Approximations of internal ECMAScript conversion functions
  var ECMAScript = (function () {
    // Stash a copy in case other scripts modify these
    var opts = Object.prototype.toString,
        ophop = Object.prototype.hasOwnProperty;

    return {
      // Class returns internal [[Class]] property, used to avoid cross-frame instanceof issues:
      Class: function(v) { return opts.call(v).replace(/^\[object *|\]$/g, ''); },
      HasProperty: function(o, p) { return p in o; },
      HasOwnProperty: function(o, p) { return ophop.call(o, p); },
      IsCallable: function(o) { return typeof o === 'function'; },
      ToInt32: function (v) { return v >> 0; },
      ToUint32: function (v) { return v >>> 0; }
    };
  }());

  // Create an INDEX_SIZE_ERR event - intentionally induces a DOM error if possible
  function new_INDEX_SIZE_ERR() {
    try {
      if (document) {
        // raises DOMException(INDEX_SIZE_ERR)
        document.createTextNode("").splitText(1);
      }
      return new RangeError("INDEX_SIZE_ERR");
    } catch (e) {
      return e;
    }
  }

  // ES5: lock down object properties
  function configureProperties(obj) {
    if (Object.getOwnPropertyNames && Object.defineProperty) {
      var props = Object.getOwnPropertyNames(obj), i;
      for (i = 0; i < props.length; i += 1) {
        Object.defineProperty(obj, props[i], {
          value: obj[props[i]],
          writable: false,
          enumerable: false,
          configurable: false
        });
      }
    }
  }

  // emulate ES5 getter/setter API using legacy APIs
  // http://blogs.msdn.com/b/ie/archive/2010/09/07/transitioning-existing-code-to-the-es5-getter-setter-apis.aspx
  // (second clause tests for Object.defineProperty() in IE<9 that only supports extending DOM prototypes, but
  // note that IE<9 does not support __defineGetter__ or __defineSetter__ so it just renders the method harmless)
  if (!Object.defineProperty ||
       !(function () { try { Object.defineProperty({}, 'x', {}); return true; } catch (e) { return false; } } ())) {
    Object.defineProperty = function (o, p, desc) {
      if (!o === Object(o)) { throw new TypeError("Object.defineProperty called on non-object"); }
      if (ECMAScript.HasProperty(desc, 'get') && Object.prototype.__defineGetter__) { Object.prototype.__defineGetter__.call(o, p, desc.get); }
      if (ECMAScript.HasProperty(desc, 'set') && Object.prototype.__defineSetter__) { Object.prototype.__defineSetter__.call(o, p, desc.set); }
      if (ECMAScript.HasProperty(desc, 'value')) { o[p] = desc.value; }
      return o;
    };
  }

  if (!Object.getOwnPropertyNames) {
    Object.getOwnPropertyNames = function getOwnPropertyNames(o) {
      if (o !== Object(o)) { throw new TypeError("Object.getOwnPropertyNames called on non-object"); }
      var props = [], p;
      for (p in o) {
        if (ECMAScript.HasOwnProperty(o, p)) {
          props.push(p);
        }
      }
      return props;
    };
  }

  // ES5: Make obj[index] an alias for obj._getter(index)/obj._setter(index, value)
  // for index in 0 ... obj.length
  function makeArrayAccessors(obj) {
    if (!Object.defineProperty) { return; }

    function makeArrayAccessor(index) {
      Object.defineProperty(obj, index, {
        'get': function () { return obj._getter(index); },
        'set': function (v) { obj._setter(index, v); },
        enumerable: true,
        configurable: false
      });
    }

    var i;
    for (i = 0; i < obj.length; i += 1) {
      makeArrayAccessor(i);
    }
  }

  // Internal conversion functions:
  //    pack<Type>()   - take a number (interpreted as Type), output a byte array
  //    unpack<Type>() - take a byte array, output a Type-like number

  function as_signed(value, bits) { var s = 32 - bits; return (value << s) >> s; }
  function as_unsigned(value, bits) { var s = 32 - bits; return (value << s) >>> s; }

  function packInt8(n) { return [n & 0xff]; }
  function unpackInt8(bytes) { return as_signed(bytes[0], 8); }

  function packUint8(n) { return [n & 0xff]; }
  function unpackUint8(bytes) { return as_unsigned(bytes[0], 8); }

  function packUint8Clamped(n) { n = Math.round(Number(n)); return [n < 0 ? 0 : n > 0xff ? 0xff : n & 0xff]; }

  function packInt16(n) { return [(n >> 8) & 0xff, n & 0xff]; }
  function unpackInt16(bytes) { return as_signed(bytes[0] << 8 | bytes[1], 16); }

  function packUint16(n) { return [(n >> 8) & 0xff, n & 0xff]; }
  function unpackUint16(bytes) { return as_unsigned(bytes[0] << 8 | bytes[1], 16); }

  function packInt32(n) { return [(n >> 24) & 0xff, (n >> 16) & 0xff, (n >> 8) & 0xff, n & 0xff]; }
  function unpackInt32(bytes) { return as_signed(bytes[0] << 24 | bytes[1] << 16 | bytes[2] << 8 | bytes[3], 32); }

  function packUint32(n) { return [(n >> 24) & 0xff, (n >> 16) & 0xff, (n >> 8) & 0xff, n & 0xff]; }
  function unpackUint32(bytes) { return as_unsigned(bytes[0] << 24 | bytes[1] << 16 | bytes[2] << 8 | bytes[3], 32); }

  function packIEEE754(v, ebits, fbits) {

    var bias = (1 << (ebits - 1)) - 1,
        s, e, f, ln,
        i, bits, str, bytes;

    // Compute sign, exponent, fraction
    if (v !== v) {
      // NaN
      // http://dev.w3.org/2006/webapi/WebIDL/#es-type-mapping
      e = (1 << bias) - 1; f = Math.pow(2, fbits - 1); s = 0;
    } else if (v === Infinity || v === -Infinity) {
      e = (1 << bias) - 1; f = 0; s = (v < 0) ? 1 : 0;
    } else if (v === 0) {
      e = 0; f = 0; s = (1 / v === -Infinity) ? 1 : 0;
    } else {
      s = v < 0;
      v = Math.abs(v);

      if (v >= Math.pow(2, 1 - bias)) {
        // Normalized
        ln = Math.min(Math.floor(Math.log(v) / Math.LN2), bias);
        e = ln + bias;
        f = Math.round(v * Math.pow(2, fbits - ln) - Math.pow(2, fbits));
      } else {
        // Denormalized
        e = 0;
        f = Math.round(v / Math.pow(2, 1 - bias - fbits));
      }
    }

    // Pack sign, exponent, fraction
    bits = [];
    for (i = fbits; i; i -= 1) { bits.push(f % 2 ? 1 : 0); f = Math.floor(f / 2); }
    for (i = ebits; i; i -= 1) { bits.push(e % 2 ? 1 : 0); e = Math.floor(e / 2); }
    bits.push(s ? 1 : 0);
    bits.reverse();
    str = bits.join('');

    // Bits to bytes
    bytes = [];
    while (str.length) {
      bytes.push(parseInt(str.substring(0, 8), 2));
      str = str.substring(8);
    }
    return bytes;
  }

  function unpackIEEE754(bytes, ebits, fbits) {

    // Bytes to bits
    var bits = [], i, j, b, str,
        bias, s, e, f;

    for (i = bytes.length; i; i -= 1) {
      b = bytes[i - 1];
      for (j = 8; j; j -= 1) {
        bits.push(b % 2 ? 1 : 0); b = b >> 1;
      }
    }
    bits.reverse();
    str = bits.join('');

    // Unpack sign, exponent, fraction
    bias = (1 << (ebits - 1)) - 1;
    s = parseInt(str.substring(0, 1), 2) ? -1 : 1;
    e = parseInt(str.substring(1, 1 + ebits), 2);
    f = parseInt(str.substring(1 + ebits), 2);

    // Produce number
    if (e === (1 << ebits) - 1) {
      return f !== 0 ? NaN : s * Infinity;
    } else if (e > 0) {
      // Normalized
      return s * Math.pow(2, e - bias) * (1 + f / Math.pow(2, fbits));
    } else if (f !== 0) {
      // Denormalized
      return s * Math.pow(2, -(bias - 1)) * (f / Math.pow(2, fbits));
    } else {
      return s < 0 ? -0 : 0;
    }
  }

  function unpackFloat64(b) { return unpackIEEE754(b, 11, 52); }
  function packFloat64(v) { return packIEEE754(v, 11, 52); }
  function unpackFloat32(b) { return unpackIEEE754(b, 8, 23); }
  function packFloat32(v) { return packIEEE754(v, 8, 23); }

  //
  // 3 The ArrayBuffer Type
  //

  (function () {

    /** @constructor */
    var ArrayBuffer = function ArrayBuffer(length) {
      length = ECMAScript.ToInt32(length);
      if (length < 0) { throw new RangeError('ArrayBuffer size is not a small enough positive integer.'); }

      this.byteLength = length;
      this._bytes = [];
      this._bytes.length = length;

      var i;
      for (i = 0; i < this.byteLength; i += 1) {
        this._bytes[i] = 0;
      }

      configureProperties(this);
    };

    //
    // 4 The ArrayBufferView Type
    //

    // NOTE: this constructor is not exported
    /** @constructor */
    var ArrayBufferView = function ArrayBufferView() {
      //this.buffer = null;
      //this.byteOffset = 0;
      //this.byteLength = 0;
    };

    //
    // 5 The Typed Array View Types
    //

    function makeTypedArrayConstructor(bytesPerElement, pack, unpack) {
      // Each TypedArray type requires a distinct constructor instance with
      // identical logic, which this produces.

      var ctor;
      ctor = function (buffer, byteOffset, length) {
        var array, sequence, i, s;

        if (!arguments.length || typeof arguments[0] === 'number') {
          // Constructor(unsigned long length)
          this.length = ECMAScript.ToInt32(arguments[0]);
          if (length < 0) { throw new RangeError('ArrayBufferView size is not a small enough positive integer.'); }

          this.byteLength = this.length * this.BYTES_PER_ELEMENT;
          this.buffer = new ArrayBuffer(this.byteLength);
          this.byteOffset = 0;
        } else if (typeof arguments[0] === 'object' && arguments[0].constructor === ctor) {
          // Constructor(TypedArray array)
          array = arguments[0];

          this.length = array.length;
          this.byteLength = this.length * this.BYTES_PER_ELEMENT;
          this.buffer = new ArrayBuffer(this.byteLength);
          this.byteOffset = 0;

          for (i = 0; i < this.length; i += 1) {
            this._setter(i, array._getter(i));
          }
        } else if (typeof arguments[0] === 'object' &&
                   !(arguments[0] instanceof ArrayBuffer || ECMAScript.Class(arguments[0]) === 'ArrayBuffer')) {
          // Constructor(sequence<type> array)
          sequence = arguments[0];

          this.length = ECMAScript.ToUint32(sequence.length);
          this.byteLength = this.length * this.BYTES_PER_ELEMENT;
          this.buffer = new ArrayBuffer(this.byteLength);
          this.byteOffset = 0;

          for (i = 0; i < this.length; i += 1) {
            s = sequence[i];
            this._setter(i, Number(s));
          }
        } else if (typeof arguments[0] === 'object' &&
                   (arguments[0] instanceof ArrayBuffer || ECMAScript.Class(arguments[0]) === 'ArrayBuffer')) {
          // Constructor(ArrayBuffer buffer,
          //             optional unsigned long byteOffset, optional unsigned long length)
          this.buffer = buffer;

          this.byteOffset = ECMAScript.ToUint32(byteOffset);
          if (this.byteOffset > this.buffer.byteLength) {
            throw new_INDEX_SIZE_ERR(); // byteOffset out of range
          }

          if (this.byteOffset % this.BYTES_PER_ELEMENT) {
            // The given byteOffset must be a multiple of the element
            // size of the specific type, otherwise an exception is raised.
            //throw new_INDEX_SIZE_ERR();
            throw new RangeError("ArrayBuffer length minus the byteOffset is not a multiple of the element size.");
          }

          if (arguments.length < 3) {
            this.byteLength = this.buffer.byteLength - this.byteOffset;

            if (this.byteLength % this.BYTES_PER_ELEMENT) {
              throw new_INDEX_SIZE_ERR(); // length of buffer minus byteOffset not a multiple of the element size
            }
            this.length = this.byteLength / this.BYTES_PER_ELEMENT;
          } else {
            this.length = ECMAScript.ToUint32(length);
            this.byteLength = this.length * this.BYTES_PER_ELEMENT;
          }

          if ((this.byteOffset + this.byteLength) > this.buffer.byteLength) {
            throw new_INDEX_SIZE_ERR(); // byteOffset and length reference an area beyond the end of the buffer
          }
        } else {
          throw new TypeError("Unexpected argument type(s)");
        }

        this.constructor = ctor;

        configureProperties(this);
        makeArrayAccessors(this);
      };

      ctor.prototype = new ArrayBufferView();
      ctor.prototype.BYTES_PER_ELEMENT = bytesPerElement;
      ctor.prototype._pack = pack;
      ctor.prototype._unpack = unpack;
      ctor.BYTES_PER_ELEMENT = bytesPerElement;

      // getter type (unsigned long index);
      ctor.prototype._getter = function (index) {
        if (arguments.length < 1) { throw new SyntaxError("Not enough arguments"); }

        index = ECMAScript.ToUint32(index);
        if (index >= this.length) {
          //throw new_INDEX_SIZE_ERR(); // Array index out of range
          return (void 0); // undefined
        }

        var bytes = [], i, o;
        for (i = 0, o = this.byteOffset + index * this.BYTES_PER_ELEMENT;
             i < this.BYTES_PER_ELEMENT;
             i += 1, o += 1) {
          bytes.push(this.buffer._bytes[o]);
        }
        return this._unpack(bytes);
      };

      // NONSTANDARD: convenience alias for getter: type get(unsigned long index);
      ctor.prototype.get = ctor.prototype._getter;

      // setter void (unsigned long index, type value);
      ctor.prototype._setter = function (index, value) {
        if (arguments.length < 2) { throw new SyntaxError("Not enough arguments"); }

        index = ECMAScript.ToUint32(index);
        if (index >= this.length) {
          //throw new_INDEX_SIZE_ERR(); // Array index out of range
          return;
        }

        var bytes = this._pack(value), i, o;
        for (i = 0, o = this.byteOffset + index * this.BYTES_PER_ELEMENT;
             i < this.BYTES_PER_ELEMENT;
             i += 1, o += 1) {
          this.buffer._bytes[o] = bytes[i];
        }
      };

      // void set(TypedArray array, optional unsigned long offset);
      // void set(sequence<type> array, optional unsigned long offset);
      ctor.prototype.set = function (index, value) {
        if (arguments.length < 1) { throw new SyntaxError("Not enough arguments"); }
        var array, sequence, offset, len,
            i, s, d,
            byteOffset, byteLength, tmp;

        if (typeof arguments[0] === 'object' && arguments[0].constructor === this.constructor) {
          // void set(TypedArray array, optional unsigned long offset);
          array = arguments[0];
          offset = ECMAScript.ToUint32(arguments[1]);

          if (offset + array.length > this.length) {
            throw new_INDEX_SIZE_ERR(); // Offset plus length of array is out of range
          }

          byteOffset = this.byteOffset + offset * this.BYTES_PER_ELEMENT;
          byteLength = array.length * this.BYTES_PER_ELEMENT;

          if (array.buffer === this.buffer) {
            tmp = [];
            for (i = 0, s = array.byteOffset; i < byteLength; i += 1, s += 1) {
              tmp[i] = array.buffer._bytes[s];
            }
            for (i = 0, d = byteOffset; i < byteLength; i += 1, d += 1) {
              this.buffer._bytes[d] = tmp[i];
            }
          } else {
            for (i = 0, s = array.byteOffset, d = byteOffset;
                 i < byteLength; i += 1, s += 1, d += 1) {
              this.buffer._bytes[d] = array.buffer._bytes[s];
            }
          }
        } else if (typeof arguments[0] === 'object' && typeof arguments[0].length !== 'undefined') {
          // void set(sequence<type> array, optional unsigned long offset);
          sequence = arguments[0];
          len = ECMAScript.ToUint32(sequence.length);
          offset = ECMAScript.ToUint32(arguments[1]);

          if (offset + len > this.length) {
            throw new_INDEX_SIZE_ERR(); // Offset plus length of array is out of range
          }

          for (i = 0; i < len; i += 1) {
            s = sequence[i];
            this._setter(offset + i, Number(s));
          }
        } else {
          throw new TypeError("Unexpected argument type(s)");
        }
      };

      // TypedArray subarray(long begin, optional long end);
      ctor.prototype.subarray = function (start, end) {
        function clamp(v, min, max) { return v < min ? min : v > max ? max : v; }

        start = ECMAScript.ToInt32(start);
        end = ECMAScript.ToInt32(end);

        if (arguments.length < 1) { start = 0; }
        if (arguments.length < 2) { end = this.length; }

        if (start < 0) { start = this.length + start; }
        if (end < 0) { end = this.length + end; }

        start = clamp(start, 0, this.length);
        end = clamp(end, 0, this.length);

        var len = end - start;
        if (len < 0) {
          len = 0;
        }

        return new this.constructor(
          this.buffer, this.byteOffset + start * this.BYTES_PER_ELEMENT, len);
      };

      return ctor;
    }

    var Int8Array = makeTypedArrayConstructor(1, packInt8, unpackInt8);
    var Uint8Array = makeTypedArrayConstructor(1, packUint8, unpackUint8);
    var Uint8ClampedArray = makeTypedArrayConstructor(1, packUint8Clamped, unpackUint8);
    var Int16Array = makeTypedArrayConstructor(2, packInt16, unpackInt16);
    var Uint16Array = makeTypedArrayConstructor(2, packUint16, unpackUint16);
    var Int32Array = makeTypedArrayConstructor(4, packInt32, unpackInt32);
    var Uint32Array = makeTypedArrayConstructor(4, packUint32, unpackUint32);
    var Float32Array = makeTypedArrayConstructor(4, packFloat32, unpackFloat32);
    var Float64Array = makeTypedArrayConstructor(8, packFloat64, unpackFloat64);

    if (USE_NATIVE_IF_AVAILABLE) {
      global.ArrayBuffer = global.ArrayBuffer || ArrayBuffer;
      global.Int8Array = global.Int8Array || Int8Array;
      global.Uint8Array = global.Uint8Array || Uint8Array;
      global.Uint8ClampedArray = global.Uint8ClampedArray || Uint8ClampedArray;
      global.Int16Array = global.Int16Array || Int16Array;
      global.Uint16Array = global.Uint16Array || Uint16Array;
      global.Int32Array = global.Int32Array || Int32Array;
      global.Uint32Array = global.Uint32Array || Uint32Array;
      global.Float32Array = global.Float32Array || Float32Array;
      global.Float64Array = global.Float64Array || Float64Array;
    } else {
      global.ArrayBuffer = ArrayBuffer;
      global.Int8Array = Int8Array;
      global.Uint8Array = Uint8Array;
      global.Uint8ClampedArray = Uint8ClampedArray;
      global.Int16Array = Int16Array;
      global.Uint16Array = Uint16Array;
      global.Int32Array = Int32Array;
      global.Uint32Array = Uint32Array;
      global.Float32Array = Float32Array;
      global.Float64Array = Float64Array;
    }
  } ());

  //
  // 6 The DataView View Type
  //

  (function () {
    function r(array, index) {
      return ECMAScript.IsCallable(array.get) ? array.get(index) : array[index];
    }

    var IS_BIG_ENDIAN = (function () {
      var u16array = new Uint16Array([0x1234]),
          u8array = new Uint8Array(u16array.buffer);
      return r(u8array, 0) === 0x12;
    } ());

    // Constructor(ArrayBuffer buffer,
    //             optional unsigned long byteOffset,
    //             optional unsigned long byteLength)
    /** @constructor */
    var DataView = function DataView(buffer, byteOffset, byteLength) {
      if (arguments.length === 0) {
        buffer = new ArrayBuffer(0);
      } else if (!(buffer instanceof ArrayBuffer || ECMAScript.Class(buffer) === 'ArrayBuffer')) {
        throw new TypeError("TypeError");
      }

      this.buffer = buffer || new ArrayBuffer(0);

      this.byteOffset = ECMAScript.ToUint32(byteOffset);
      if (this.byteOffset > this.buffer.byteLength) {
        throw new_INDEX_SIZE_ERR(); // byteOffset out of range
      }

      if (arguments.length < 3) {
        this.byteLength = this.buffer.byteLength - this.byteOffset;
      } else {
        this.byteLength = ECMAScript.ToUint32(byteLength);
      }

      if ((this.byteOffset + this.byteLength) > this.buffer.byteLength) {
        throw new_INDEX_SIZE_ERR(); // byteOffset and length reference an area beyond the end of the buffer
      }

      configureProperties(this);
    };

    // TODO: Reintroduce this to get correct hierarchy
    //if (typeof ArrayBufferView === 'function') {
    //  DataView.prototype = new ArrayBufferView();
    //}

    function makeDataView_getter(arrayType) {
      return function (byteOffset, littleEndian) {

        byteOffset = ECMAScript.ToUint32(byteOffset);

        if (byteOffset + arrayType.BYTES_PER_ELEMENT > this.byteLength) {
          throw new_INDEX_SIZE_ERR(); // Array index out of range
        }
        byteOffset += this.byteOffset;

        var uint8Array = new Uint8Array(this.buffer, byteOffset, arrayType.BYTES_PER_ELEMENT),
            bytes = [], i;
        for (i = 0; i < arrayType.BYTES_PER_ELEMENT; i += 1) {
          bytes.push(r(uint8Array, i));
        }

        if (Boolean(littleEndian) === Boolean(IS_BIG_ENDIAN)) {
          bytes.reverse();
        }

        return r(new arrayType(new Uint8Array(bytes).buffer), 0);
      };
    }

    DataView.prototype.getUint8 = makeDataView_getter(Uint8Array);
    DataView.prototype.getInt8 = makeDataView_getter(Int8Array);
    DataView.prototype.getUint16 = makeDataView_getter(Uint16Array);
    DataView.prototype.getInt16 = makeDataView_getter(Int16Array);
    DataView.prototype.getUint32 = makeDataView_getter(Uint32Array);
    DataView.prototype.getInt32 = makeDataView_getter(Int32Array);
    DataView.prototype.getFloat32 = makeDataView_getter(Float32Array);
    DataView.prototype.getFloat64 = makeDataView_getter(Float64Array);

    function makeDataView_setter(arrayType) {
      return function (byteOffset, value, littleEndian) {

        byteOffset = ECMAScript.ToUint32(byteOffset);
        if (byteOffset + arrayType.BYTES_PER_ELEMENT > this.byteLength) {
          throw new_INDEX_SIZE_ERR(); // Array index out of range
        }

        // Get bytes
        var typeArray = new arrayType([value]),
            byteArray = new Uint8Array(typeArray.buffer),
            bytes = [], i, byteView;

        for (i = 0; i < arrayType.BYTES_PER_ELEMENT; i += 1) {
          bytes.push(r(byteArray, i));
        }

        // Flip if necessary
        if (Boolean(littleEndian) === Boolean(IS_BIG_ENDIAN)) {
          bytes.reverse();
        }

        // Write them
        byteView = new Uint8Array(this.buffer, byteOffset, arrayType.BYTES_PER_ELEMENT);
        byteView.set(bytes);
      };
    }

    DataView.prototype.setUint8 = makeDataView_setter(Uint8Array);
    DataView.prototype.setInt8 = makeDataView_setter(Int8Array);
    DataView.prototype.setUint16 = makeDataView_setter(Uint16Array);
    DataView.prototype.setInt16 = makeDataView_setter(Int16Array);
    DataView.prototype.setUint32 = makeDataView_setter(Uint32Array);
    DataView.prototype.setInt32 = makeDataView_setter(Int32Array);
    DataView.prototype.setFloat32 = makeDataView_setter(Float32Array);
    DataView.prototype.setFloat64 = makeDataView_setter(Float64Array);

    if (USE_NATIVE_IF_AVAILABLE) {
      global.DataView = global.DataView || DataView;
    } else {
      global.DataView = DataView;
    }

  } ());

} (this));


text:
package cmdns

import (
	"fmt"
	"testing"

	"github.com/spf13/cobra"
)

var helpFunc = func(cmd *cobra.Command, args []string) { cmd.Help() }
var runFunc = func(cmd *cobra.Command, args []string) { fmt.Println("run", cmd.Name()) }

func TestNamespace(t *testing.T) {
	ovrclk := &cobra.Command{Use: "ovrclk"}
	apps := &cobra.Command{Use: "apps"}
	apps.AddCommand(&cobra.Command{Use: "info", Run: runFunc})
	ovrclk.AddCommand(apps)

	// Enable namespacing
	Namespace(ovrclk)
	for _, c := range ovrclk.Commands() {
		if c.Name() == "apps:info" {
			return
		}
	}
	t.Fatalf("expected", "apps:info", "in", ovrclk.Commands())
}


text:
package org.apache.camel.component.jms;

import javax.jms.ConnectionFactory;

import org.apache.camel.CamelContext;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.test.junit5.CamelTestSupport;
import org.junit.jupiter.api.Test;

import static org.apache.camel.component.jms.JmsComponent.jmsComponentAutoAcknowledge;
import static org.junit.jupiter.api.Assertions.assertEquals;

public class SimpleJmsRequestReplyTest extends CamelTestSupport {

    @Test
    public void testJmsRequestReply() {
        assertEquals("Hello A", template.requestBody("activemq:queue:foo?replyToConsumerType=Simple", "A"));
        assertEquals("Hello B", template.requestBody("activemq:queue:foo?replyToConsumerType=Simple", "B"));
        assertEquals("Hello C", template.requestBody("activemq:queue:foo?replyToConsumerType=Simple", "C"));
        assertEquals("Hello D", template.requestBody("activemq:queue:foo?replyToConsumerType=Simple", "D"));
        assertEquals("Hello E", template.requestBody("activemq:queue:foo?replyToConsumerType=Simple", "E"));
    }

    @Override
    protected CamelContext createCamelContext() throws Exception {
        CamelContext camelContext = super.createCamelContext();
        ConnectionFactory connectionFactory = CamelJmsTestHelper.createConnectionFactory();
        camelContext.addComponent("activemq", jmsComponentAutoAcknowledge(connectionFactory));
        return camelContext;
    }

    @Override
    protected RouteBuilder createRouteBuilder() {
        return new RouteBuilder() {
            @Override
            public void configure() {
                from("activemq:queue:foo")
                        .transform(body().prepend("Hello "));
            }
        };
    }
}


text:
'use strict'

var chai = require('chai');
var expect = chai.expect;

var Hackerify = require('../index');
Hackerify(arguments, {
  './A': 'H.a.c.k.e.r.f.y',
  './B': {
    what: 'A node module.',
    description: function() {
      return 'My job is stubbing required modules within Browserify.';
    }
  },
  './D': {
    loc: function() {
      return 24;
    }
  }
});

describe('Given a browserify bundle', function() {

  it('With stubbing', function(done) {
    var app = require('./data/app');
    expect(app()).to.be.equal('I am H.a.c.k.e.r.f.y. A node module. My job is stubbing required modules within Browserify. LOC: 24');
    done();
  });

});


text:
This is the Swift support UIAlertView and UIAlertController version of third-party libraries(这是支持UIAlertView和UIAlertController 的Swift 版本的第三方库)

支持 Cocoapods(Support Cocoapods)
```swift
pod 'SwiftAlertController'
```

使用(use)

```swift
var alertStyle = SwiftAlertControllerStyle.alertView
// 设置为actionSheet
alertStyle = SwiftAlertControllerStyle.actionSheet
let alert:SwiftAlertController = SwiftAlertController(style: alertStyle, title: nil, message: "alert", otherButtons: ["Other"])
 alert.showAlertController(self, complete: nil)
```

备注:因为Cocoapods 推送里面的API必须在IOS8以上 所以改成了IOS8以上 如果想要支持IOS8之前的请下载[relase1.0.0](https://github.com/15038777234/SwiftAlertController/releases/tag/1.0.0)版本

Note: because Cocoapods push the API must be above IOS8 inside So changed to IOS8 above If you want to support before IOS8 relase1.0.0 version, please download


text: A Java secret container


text:
namespace uWebshop.Domain.Interfaces
{
	/// <summary>
	///
	/// </summary>
	public interface IShippingProviderUpdateService
	{
		/// <summary>
		/// Updates the specified shipping provider method.
		/// </summary>
		/// <param name="shippingProviderMethod">The shipping provider method.</param>
		void Update(ShippingProviderMethod shippingProviderMethod, OrderInfo order);
	}
}


text:
%!TEX root = mariakakis_cv.tex
\textbf{University of Washington}
\begin{center}\begin{tabular*}{6.6in}{l@{\extracolsep{\fill}}r}
	\dottedrow{EE PMP 590 A: Advanced Topics in Digital Computers}{Spring 2018}
	\dottedrow{CSE 331: Software Design and Implementation (TA)}{Fall 2013, Winter 2013, Spring 2014}
	\vphantom{E}
\end{tabular*}
\end{center}\vspace*{-16pt}
\vspace{7pt}

\textbf{Online Courses}
\begin{center}\begin{tabular*}{6.6in}{l@{\extracolsep{\fill}}r}
	\dottedrow{Microsoft edX: Introduction to Device Programming (Module 2)}{2017}
	\vphantom{E}
\end{tabular*}
\end{center}\vspace*{-16pt}
\vspace{7pt}

\textbf{Duke University}
\begin{center}\begin{tabular*}{6.6in}{l@{\extracolsep{\fill}}r}
	\dottedrow{ECE 559: Advanced Digital System Design (TA)}{Spring 2013}
	\dottedrow{ECE 54/280: Introduction to Signals and System (TA)}{Spring 2011, Spring 2012, Fall 2012}
	\dottedrow{ECE 52: Introduction to Digital Systems (TA)}{Fall 2011}
	\dottedrow{EGR 224: Electrical Fundamentals of Mechatronics (TA)}{Spring 2013}
	\dottedrow{EGR 53/103: Computational Methods in Engineering (TA)}{Fall 2010, Fall 2011, Fall 2012}
	\vphantom{E}
\end{tabular*}
\end{center}\vspace*{-16pt}


text:
package io.hgeg.cloudboard;

import android.app.Activity;
import android.content.ClipboardManager;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.AsyncTask;
import android.widget.TextView;
import android.widget.Toast;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.HttpURLConnection;
import java.net.URL;
import java.security.MessageDigest;

/**
 * Created by can on 9/30/13.
 */
public class Synchronize extends AsyncTask<Void, Void, String> {

    private boolean exception;
    private Activity context;
    private ClipboardManager clipboard;

    protected String doInBackground(Void... none) {
        this.context = MainActivity.model;
        this.clipboard = MainActivity.clipboard;
        HttpURLConnection connection;
        OutputStreamWriter request = null;

        URL url = null;
        String response = null;
        long timestamp = System.currentTimeMillis()/1000;
        String raw_sig = timestamp+"&"+md5("sokoban")+"&"+"UZepT6F8abA80DK1ilCz";
        String parameters = "user=Hgeg&timestamp="+timestamp+"&key=H4vlwkm8tvO8&signature="+md5(raw_sig);

        try
        {
            url = new URL("http://hgeg.io/cloudboard/get/");
            connection = (HttpURLConnection) url.openConnection();
            connection.setDoOutput(true);
            connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
            connection.setRequestMethod("POST");

            request = new OutputStreamWriter(connection.getOutputStream());
            request.write(parameters);
            request.flush();
            request.close();
            String line = "";
            InputStreamReader isr = new InputStreamReader(connection.getInputStream());
            BufferedReader reader = new BufferedReader(isr);
            StringBuilder sb = new StringBuilder();
            while ((line = reader.readLine()) != null)
            {
                sb.append(line + "\n");
            }
            // Response from server after login process will be stored in response variable.
            response = sb.toString();
            // You can perform UI operations here
            isr.close();
            reader.close();
            this.exception = false;
            return response;
        } catch(Exception e) {
            this.exception = true;
            return e.toString();
        }
    }

    public static String md5(String message) {
        String digest = null;
        try {
            MessageDigest md = MessageDigest.getInstance("MD5"); byte[] hash = md.digest(message.getBytes("UTF-8"));
            //converting byte array to Hexadecimal
            StringBuilder sb = new StringBuilder(2*hash.length);
            for(byte b : hash){ sb.append(String.format("%02x", b&0xff)); }
            digest = sb.toString();
        } catch (Exception e) {}
        return digest;
    }

    protected void onPostExecute(String data) {
        TextView clipView = (TextView) this.context.findViewById(R.id.clipView);
        if(!this.exception) {

            SharedPreferences prefs = this.context.getSharedPreferences("clip", Context.MODE_PRIVATE);

            if(!prefs.getString("data","").equals(data)) {
                clipView.setText(data);
                MainActivity.setClipText(data);
                SharedPreferences.Editor editor = prefs.edit();
                editor.putString("data",data);
                editor.commit();
                Toast.makeText(this.context, "Clipboard updated!", Toast.LENGTH_LONG).show();
            }
        }else {
            clipView.setText("");
            Toast.makeText(this.context, "Error!", Toast.LENGTH_LONG).show();
        }

    }
}


text:
package com.insync.service;

import java.util.List;

import com.insync.model.CountryName;
import com.insync.model.Login;
import com.insync.model.OilPrice;

public interface LoginService {

	public int getLogin(Login login);

	public List<CountryName> getCountry();

	public List<CountryName> getCountry(OilPrice oilPrice);

	public List<OilPrice> editCountry(OilPrice oilPrice);

	public int updateCountry(OilPrice oilPrice);
}


text:
<?php

// @codingStandardsIgnoreFile

namespace Magento\AdminNotification\Block\Grid\Renderer;

class Actions extends \Magento\Backend\Block\Widget\Grid\Column\Renderer\AbstractRenderer
{
    /**
     * @var \Magento\Framework\Url\Helper\Data
     */
    protected $_urlHelper;

    /**
     * @param \Magento\Backend\Block\Context $context
     * @param \Magento\Framework\Url\Helper\Data $urlHelper
     * @param array $data
     */
    public function __construct(
        \Magento\Backend\Block\Context $context,
        \Magento\Framework\Url\Helper\Data $urlHelper,
        array $data = []
    ) {
        $this->_urlHelper = $urlHelper;
        parent::__construct($context, $data);
    }

    /**
     * Renders grid column
     *
     * @param   \Magento\Framework\DataObject $row
     * @return  string
     */
    public function render(\Magento\Framework\DataObject $row)
    {
        $readDetailsHtml = $row->getUrl() ? 'getUrl() . '">' . __(
            'Read Details'
        ) . ' | ' : '';

        $markAsReadHtml = !$row->getIsRead() ? 'getUrl(
            '*/*/markAsRead/',
            ['_current' => true, 'id' => $row->getId()]
        ) . '">' . __(
            'Mark as Read'
        ) . ' | ' : '';

        $encodedUrl = $this->_urlHelper->getEncodedUrl();
        return sprintf(
            '%s%s%s',
            $readDetailsHtml,
            $markAsReadHtml,
            $this->getUrl(
                '*/*/remove/',
                [
                    '_current' => true,
                    'id' => $row->getId(),
                    \Magento\Framework\App\ActionInterface::PARAM_NAME_URL_ENCODED => $encodedUrl
                ]
            ),
            __('Are you sure?'),
            __('Remove')
        );
    }
}


text:
var nodeunit = require('nodeunit');

var aes = require('../index');

function bufferEquals(a, b) {
    if (a.length != b.length) { return false; }
    for (var i = 0; i < a.length; i++) {
        if (a[i] != b[i]) { return false; }
    }
    return true;
}

function makeTest(options) {

    var modeOfOperation = options.modeOfOperation;
    var mo = aes.ModeOfOperation[modeOfOperation];

    var plaintext = [];
    for (var i = 0; i < options.plaintext.length; i++) {
        plaintext.push(Buffer.from(options.plaintext[i]));
    }

    var key = Buffer.from(options.key);

    var iv = null;
    if (options.iv) { iv = Buffer.from(options.iv); }

    var segmentSize = 0;
    if (options.segmentSize) { segmentSize = options.segmentSize; }

    var ciphertext = [];
    for (var i = 0; i < options.encrypted.length; i++) {
        ciphertext.push(Buffer.from(options.encrypted[i]));
    }

    return function (test) {
        var func;
        switch (modeOfOperation) {
            case 'ecb':
                func = function() { return new mo(key); }
                break;
            case 'cfb':
                func = function() { return new mo(key, iv, segmentSize); }
                break;
            case 'ofb':
            case 'cbc':
                func = function() { return new mo(key, iv); }
                break;
            case 'ctr':
                func = function() { return new mo(key, new aes.Counter(0)); }
                break;
            default:
                throw new Error('unknwon mode of operation')
        }

        var encrypter = func(), decrypter = func();
        var totalDiffers = 0;
        for (var i = 0; i < plaintext.length; i++) {
            var ciphertext2 = encrypter.encrypt(plaintext[i]);
            test.ok(bufferEquals(ciphertext2, ciphertext[i]), "encrypt failed to match test vector");

            var plaintext2 = decrypter.decrypt(ciphertext2);
            test.ok(bufferEquals(plaintext2, plaintext[i]), "decrypt failed to match original text");
        }

        test.done();
    };
};

var testVectors = require('./test-vectors.json');

var Tests = {};
var counts = {}
for (var i = 0; i < testVectors.length; i++) {
    var test = testVectors[i];
    name = test.modeOfOperation + '-' + test.key.length;
    counts[name] = (counts[name] || 0) + 1;
    Tests['test-' + name + '-' + counts[name]] = makeTest(test);
}

module.exports = Tests;


text:
'use strict';

/* jshint -W030 */
var chai = require('chai')
  , expect = chai.expect
  , config = require(__dirname + '/../config/config')
  , Support = require(__dirname + '/support')
  , dialect = Support.getTestDialect()
  , Sequelize = Support.Sequelize
  , sqlite3 = require('sqlite3')
  , fs = require('fs')
  , path = require('path');

describe(Support.getTestDialectTeaser('Configuration'), function() {
  describe('Connections problems should fail with a nice message', function() {
    it('when we don\'t have the correct server details', function() {
      if (dialect === 'mariadb') {
        console.log('This dialect doesn\'t support me :(');
        expect(true).to.be.true; // Silence Buster
        return;
      }

      var seq = new Sequelize(config[dialect].database, config[dialect].username, config[dialect].password, {storage: '/path/to/no/where/land', logging: false, host: '0.0.0.1', port: config[dialect].port, dialect: dialect});
      if (dialect === 'sqlite') {
        // SQLite doesn't have a breakdown of error codes, so we are unable to discern between the different types of errors.
        return expect(seq.query('select 1 as hello')).to.eventually.be.rejectedWith(seq.ConnectionError, 'SQLITE_CANTOPEN: unable to open database file');
      } else {
        return expect(seq.query('select 1 as hello')).to.eventually.be.rejectedWith([seq.HostNotReachableError, seq.InvalidConnectionError]);
      }
    });

    it('when we don\'t have the correct login information', function() {
      if (dialect === 'mariadb') {
        console.log('This dialect doesn\'t support me :(');
        expect(true).to.be.true; // Silence Buster
        return;
      }

      if (dialect === 'mssql') {
        // NOTE: Travis seems to be having trouble with this test against the
        //       AWS instance. Works perfectly fine on a local setup.
        expect(true).to.be.true;
        return;
      }

      var seq = new Sequelize(config[dialect].database, config[dialect].username, 'fakepass123', {logging: false, host: config[dialect].host, port: 1, dialect: dialect});
      if (dialect === 'sqlite') {
        // SQLite doesn't require authentication and `select 1 as hello` is a valid query, so this should be fulfilled not rejected for it.
        return expect(seq.query('select 1 as hello')).to.eventually.be.fulfilled;
      } else {
        return expect(seq.query('select 1 as hello')).to.eventually.be.rejectedWith(seq.ConnectionRefusedError, 'connect ECONNREFUSED');
      }
    });

    it('when we don\'t have a valid dialect.', function() {
      expect(function() {
        new Sequelize(config[dialect].database, config[dialect].username, config[dialect].password, {host: '0.0.0.1', port: config[dialect].port, dialect: undefined});
      }).to.throw(Error, 'The dialect undefined is not supported.');
    });
  });

  describe('Instantiation with a URL string', function() {
    it('should accept username, password, host, port, and database', function() {
      var sequelize = new Sequelize('mysql://user:pass@example.com:9821/dbname');
      var config = sequelize.config;
      var options = sequelize.options;

      expect(options.dialect).to.equal('mysql');

      expect(config.database).to.equal('dbname');
      expect(config.host).to.equal('example.com');
      expect(config.username).to.equal('user');
      expect(config.password).to.equal('pass');
      expect(config.port).to.equal('9821');
    });

    it('should work with no authentication options', function() {
      var sequelize = new Sequelize('mysql://example.com:9821/dbname');
      var config = sequelize.config;

      expect(config.username).to.not.be.ok;
      expect(config.password).to.be.null;
    });

    it('should work with no authentication options and passing additional options', function() {
      var sequelize = new Sequelize('mysql://example.com:9821/dbname', {});
      var config = sequelize.config;

      expect(config.username).to.not.be.ok;
      expect(config.password).to.be.null;
    });

    it('should use the default port when no other is specified', function() {
      var sequelize = new Sequelize('dbname', 'root', 'pass', {
          dialect: dialect
        })
        , config = sequelize.config
        , port;

      if (Support.dialectIsMySQL()) {
        port = 3306;
      } else if (dialect === 'postgres' || dialect === 'postgres-native') {
        port = 5432;
      } else {
        // sqlite has no concept of ports when connecting
        return;
      }

      expect(config.port).to.equal(port);
    });
  });

  describe('Instantiation with arguments', function() {
    it('should accept two parameters (database, username)', function() {
      var sequelize = new Sequelize('dbname', 'root');
      var config = sequelize.config;

      expect(config.database).to.equal('dbname');
      expect(config.username).to.equal('root');
    });

    it('should accept three parameters (database, username, password)', function() {
      var sequelize = new Sequelize('dbname', 'root', 'pass');
      var config = sequelize.config;

      expect(config.database).to.equal('dbname');
      expect(config.username).to.equal('root');
      expect(config.password).to.equal('pass');
    });

    it('should accept four parameters (database, username, password, options)', function() {
      var sequelize = new Sequelize('dbname', 'root', 'pass', {
        port: 999,
        dialectOptions: {
          supportBigNumbers: true,
          bigNumberStrings: true
        }
      });
      var config = sequelize.config;

      expect(config.database).to.equal('dbname');
      expect(config.username).to.equal('root');
      expect(config.password).to.equal('pass');
      expect(config.port).to.equal(999);
      expect(config.dialectOptions.supportBigNumbers).to.be.true;
      expect(config.dialectOptions.bigNumberStrings).to.be.true;
    });

    if (dialect === 'sqlite') {
      it('should respect READONLY / READWRITE connection modes', function() {
        var p = path.join(__dirname, '../tmp', 'foo.sqlite');
        var createTableFoo = 'CREATE TABLE foo (faz TEXT);';
        var createTableBar = 'CREATE TABLE bar (baz TEXT);';

        var testAccess = Sequelize.Promise.method(function() {
          if (fs.access) {
            return Sequelize.Promise.promisify(fs.access)(p, fs.R_OK | fs.W_OK);
          } else { // Node v0.10 and older don't have fs.access
            return Sequelize.Promise.promisify(fs.open)(p, 'r+')
            .then(function(fd) {
              return Sequelize.Promise.promisify(fs.close)(fd);
            });
          }
        });

        return Sequelize.Promise.promisify(fs.unlink)(p)
        .catch(function(err) {
          expect(err.code).to.equal('ENOENT');
        })
        .then(function() {
          var sequelizeReadOnly = new Sequelize('sqlite://foo', {
            storage: p,
            dialectOptions: {
              mode: sqlite3.OPEN_READONLY
            }
          });
          var sequelizeReadWrite = new Sequelize('sqlite://foo', {
            storage: p,
            dialectOptions: {
              mode: sqlite3.OPEN_READWRITE
            }
          });

          expect(sequelizeReadOnly.config.dialectOptions.mode).to.equal(sqlite3.OPEN_READONLY);
          expect(sequelizeReadWrite.config.dialectOptions.mode).to.equal(sqlite3.OPEN_READWRITE);

          return Sequelize.Promise.join(
            sequelizeReadOnly.query(createTableFoo)
              .should.be.rejectedWith(Error, 'SQLITE_CANTOPEN: unable to open database file'),
            sequelizeReadWrite.query(createTableFoo)
              .should.be.rejectedWith(Error, 'SQLITE_CANTOPEN: unable to open database file')
          );
        })
        .then(function() {
          // By default, sqlite creates a connection that's READWRITE | CREATE
          var sequelize = new Sequelize('sqlite://foo', {
            storage: p
          });
          return sequelize.query(createTableFoo);
        })
        .then(testAccess)
        .then(function() {
          var sequelizeReadOnly = new Sequelize('sqlite://foo', {
            storage: p,
            dialectOptions: {
              mode: sqlite3.OPEN_READONLY
            }
          });
          var sequelizeReadWrite = new Sequelize('sqlite://foo', {
            storage: p,
            dialectOptions: {
              mode: sqlite3.OPEN_READWRITE
            }
          });

          return Sequelize.Promise.join(
            sequelizeReadOnly.query(createTableBar)
              .should.be.rejectedWith(Error, 'SQLITE_READONLY: attempt to write a readonly database'),
            sequelizeReadWrite.query(createTableBar)
          );
        })
        .finally(function() {
          return Sequelize.Promise.promisify(fs.unlink)(p);
        });
      });
    }
  });

});


text:
@interface PKLocalScope : PKBaseScope

@end


text:
<resourcesDefinition xmlns="http://thotti/ec2/configuration/1.0"
                     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                     xsi:schemaLocation="http://thotti/ec2/configuration/1.0
                                         ../../../../../main/resources/schemas/ec2-configuration-v1.xsd"
                     version="1">

    <region availibleZone="default" name="region">
        <serverRequest amiID="amazonMachineImageID0001"
                       instanceType="m2.2xlarge"
                       keyPair="aArbitraryKeyPairName"
                       maxInstances="1"
                       minInstances="1"
                       onShutdown="terminate"/>
    </region>

</resourcesDefinition>


text:
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information

namespace DotNetNuke.Services.FileSystem.Internal
{
    using System;

    using DotNetNuke.Common.Utilities;
    using DotNetNuke.Data;
    using DotNetNuke.Entities.Content.Common;
    using DotNetNuke.Framework;
    using DotNetNuke.Instrumentation;

    using Localization = DotNetNuke.Services.Localization.Localization;

    public class FileDeletionController : ServiceLocator<IFileDeletionController, FileDeletionController>, IFileDeletionController
    {
        private static readonly ILog Logger = LoggerSource.Instance.GetLogger(typeof(FileDeletionController));

        public void DeleteFile(IFileInfo file)
        {
            string lockReason;
            if (FileLockingController.Instance.IsFileLocked(file, out lockReason))
            {
                throw new FileLockedException(Localization.GetExceptionMessage(lockReason, "File locked. The file cannot be updated. Reason: " + lockReason));
            }

            FileVersionController.Instance.DeleteAllUnpublishedVersions(file, false);
            try
            {
                var folderMapping = FolderMappingController.Instance.GetFolderMapping(file.PortalId, file.FolderMappingID);
                FolderProvider.Instance(folderMapping.FolderProviderType).DeleteFile(file);
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
                throw new FolderProviderException(Localization.GetExceptionMessage("DeleteFileUnderlyingSystemError", "The underlying system threw an exception. The file has not been deleted."), ex);
            }

            this.DeleteFileData(file);

            DataCache.RemoveCache("GetFileById" + file.FileId);
        }

        public void UnlinkFile(IFileInfo file)
        {
            string lockReason;
            if (FileLockingController.Instance.IsFileLocked(file, out lockReason))
            {
                throw new FileLockedException(Localization.GetExceptionMessage(lockReason, "File locked. The file cannot be updated. Reason: " + lockReason));
            }

            FileVersionController.Instance.DeleteAllUnpublishedVersions(file, false);

            this.DeleteFileData(file);
        }

        public void DeleteFileData(IFileInfo file)
        {
            DataProvider.Instance().DeleteFile(file.PortalId, file.FileName, file.FolderId);
            this.DeleteContentItem(file.ContentItemID);
        }

        protected override Func<IFileDeletionController> GetFactory()
        {
            return () => new FileDeletionController();
        }

        private void DeleteContentItem(int contentItemId)
        {
            if (contentItemId == Null.NullInteger)
            {
                return;
            }

            Util.GetContentController().DeleteContentItem(contentItemId);
        }
    }
}


text:
package com.dolzzo.twelve.provider;

import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;

import com.dolzzo.twelve.utils.MusicUtils;

import java.lang.ref.WeakReference;

/**
 * This db stores the details to generate the playlist artwork including when it was
 * last updated and the # of songs in the playlist when it last updated
 */
public class PlaylistArtworkStore {
    private static final long ONE_DAY_IN_MS = 1000 * 60 * 60 * 24;

    private static WeakReference<PlaylistArtworkStore> sInstance = null;
    private final Context mContext;
    private MusicDB mMusicDatabase = null;

    /**
     * Constructor of RecentStore
     *
     * @param context The {@link android.content.Context} to use
     */
    public PlaylistArtworkStore(final Context context) {
        mMusicDatabase = MusicDB.getInstance(context);

        mContext = context;
    }

    /**
     * @param context The {@link android.content.Context} to use
     * @return A new instance of this class.
     */
    public static synchronized PlaylistArtworkStore getInstance(final Context context) {
        if (sInstance != null) {
            PlaylistArtworkStore ref = sInstance.get();
            if (ref != null) {
                return ref;
            }
        }

        PlaylistArtworkStore ref = new PlaylistArtworkStore(context.getApplicationContext());
        sInstance = new WeakReference<PlaylistArtworkStore>(ref);
        return ref;
    }

    /**
     * @param playlistId playlist identifier
     * @return the key used for the imagae cache for the cover art
     */
    public static String getCoverCacheKey(final long playlistId) {
        return "playlist_cover_" + playlistId;
    }

    /**
     * @param playlistId playlist identifier
     * @return the key used for the imagae cache for the top artist image
     */
    public static String getArtistCacheKey(final long playlistId) {
        return "playlist_artist_" + playlistId;
    }

    public void onCreate(final SQLiteDatabase db) {
        // create the table
        String builder = "CREATE TABLE IF NOT EXISTS " +
                PlaylistArtworkStoreColumns.NAME +
                "(" +
                PlaylistArtworkStoreColumns.ID +
                " INT UNIQUE," +
                PlaylistArtworkStoreColumns.LAST_UPDATE_ARTIST +
                " LONG DEFAULT 0," +
                PlaylistArtworkStoreColumns.NUM_SONGS_LAST_UPDATE_ARTIST +
                " INT DEFAULT 0," +
                PlaylistArtworkStoreColumns.LAST_UPDATE_COVER +
                " LONG DEFAULT 0," +
                PlaylistArtworkStoreColumns.NUM_SONGS_LAST_UPDATE_COVER +
                " INT DEFAULT 0);";

        db.execSQL(builder);
    }

    public void onUpgrade(final SQLiteDatabase db, final int oldVersion, final int newVersion) {
        // No upgrade path needed yet
    }

    public void onDowngrade(SQLiteDatabase db, int oldVersion, int newVersion) {
        // If we ever have downgrade, drop the table to be safe
        db.execSQL("DROP TABLE IF EXISTS " + PlaylistArtworkStoreColumns.NAME);
        onCreate(db);
    }

    /**
     * @param playlistId playlist identifier
     * @return true if the artist artwork should be updated based on time since last update and
     * whether the # of songs for the playlist has changed
     */
    public boolean needsArtistArtUpdate(final long playlistId) {
        return needsUpdate(playlistId, PlaylistArtworkStoreColumns.LAST_UPDATE_ARTIST,
                PlaylistArtworkStoreColumns.NUM_SONGS_LAST_UPDATE_ARTIST);
    }

    /**
     * @param playlistId playlist identifier
     * @return true if the cover artwork should be updated based on time since last update and
     * whether the # of songs for the playlist has changed
     */
    public boolean needsCoverArtUpdate(final long playlistId) {
        return needsUpdate(playlistId, PlaylistArtworkStoreColumns.LAST_UPDATE_COVER,
                PlaylistArtworkStoreColumns.NUM_SONGS_LAST_UPDATE_COVER);
    }

    /**
     * Updates the time and the # of songs in the db for the artist section of the table
     *
     * @param playlistId playlist identifier
     */
    public void updateArtistArt(final long playlistId) {
        updateOrInsertTime(playlistId, PlaylistArtworkStoreColumns.LAST_UPDATE_ARTIST,
                PlaylistArtworkStoreColumns.NUM_SONGS_LAST_UPDATE_ARTIST);
    }

    /**
     * Updates the time and the # of songs in the db for the cover art of the table
     *
     * @param playlistId playlist identifier
     */
    public void updateCoverArt(final long playlistId) {
        updateOrInsertTime(playlistId, PlaylistArtworkStoreColumns.LAST_UPDATE_COVER,
                PlaylistArtworkStoreColumns.NUM_SONGS_LAST_UPDATE_COVER);
    }

    /**
     * Internal function to update the entry for the columns passed in
     *
     * @param playlistId      playlist identifier
     * @param columnName      the column to update to the current time
     * @param countColumnName the column to set the # of songs to based on the playlist
     */
    private void updateOrInsertTime(final long playlistId, final String columnName, final String countColumnName) {
        SQLiteDatabase database = mMusicDatabase.getWritableDatabase();

        database.beginTransaction();

        // gets the existing values for the entry if it exists
        ContentValues values = getExistingContentValues(playlistId);
        boolean existingEntry = values.size() > 0;
        // update the values
        values.put(PlaylistArtworkStoreColumns.ID, playlistId);
        values.put(columnName, System.currentTimeMillis());
        values.put(countColumnName, MusicUtils.getSongCountForPlaylist(mContext, playlistId));

        // if it is an existing entry, update, otherwise insert
        if (existingEntry) {
            database.update(PlaylistArtworkStoreColumns.NAME, values,
                    PlaylistArtworkStoreColumns.ID + "=" + playlistId, null);
        } else {
            database.insert(PlaylistArtworkStoreColumns.NAME, null, values);
        }

        database.setTransactionSuccessful();
        database.endTransaction();
    }

    /**
     * Internal function to get the existing values for a playlist entry
     *
     * @param playlistId playlist identifier
     * @return the content values
     */
    private ContentValues getExistingContentValues(final long playlistId) {
        ContentValues values = new ContentValues(4);
        Cursor c = getEntry(playlistId);
        if (c != null && c.moveToFirst()) {
            values.put(PlaylistArtworkStoreColumns.ID, c.getLong(0));
            values.put(PlaylistArtworkStoreColumns.LAST_UPDATE_ARTIST, c.getLong(1));
            values.put(PlaylistArtworkStoreColumns.NUM_SONGS_LAST_UPDATE_ARTIST, c.getInt(2));
            values.put(PlaylistArtworkStoreColumns.LAST_UPDATE_COVER, c.getLong(3));
            values.put(PlaylistArtworkStoreColumns.NUM_SONGS_LAST_UPDATE_COVER, c.getInt(4));
            c.close();
            c = null;
        }

        return values;
    }

    /**
     * Internal function to return whether the columns show that this needs an update
     *
     * @param playlistId      playlist identifier
     * @param columnName      the column to inspect
     * @param countColumnName the column count to inspect
     * @return
     */
    private boolean needsUpdate(final long playlistId, final String columnName, final String countColumnName) {
        // get the entry
        Cursor c = getEntry(playlistId);

        if (c != null && c.moveToFirst()) {
            final long lastUpdate = c.getLong(c.getColumnIndex(columnName));
            final long msSinceEpoch = System.currentTimeMillis();
            final int songCount = MusicUtils.getSongCountForPlaylist(mContext, playlistId);
            final int lastUpdatedSongCount = c.getInt(c.getColumnIndex(countColumnName));

            c.close();
            c = null;

            // if the elapsed time since our last update is less than a day and the
            // number of songs in the playlist hasn't changed, then don't update
            if (msSinceEpoch - lastUpdate < ONE_DAY_IN_MS &&
                    songCount == lastUpdatedSongCount) {
                return false;
            }
        }

        return true;
    }

    /**
     * Internal function to get the cursor entry for the playlist
     *
     * @param playlistId playlist identifier
     * @return cursor
     */
    private Cursor getEntry(final long playlistId) {
        SQLiteDatabase db = mMusicDatabase.getReadableDatabase();
        return db.query(PlaylistArtworkStoreColumns.NAME, null,
                PlaylistArtworkStoreColumns.ID + "=" + playlistId, null, null, null, null);
    }

    public interface PlaylistArtworkStoreColumns {
        /* Table name */
        public static final String NAME = "playlist_details";

        /* Playlist ID column */
        public static final String ID = "playlistid";

        /* When the top artist was last updated */
        public static final String LAST_UPDATE_ARTIST = "last_updated_artist";

        /* The number of songs when we last updated the artist */
        public static final String NUM_SONGS_LAST_UPDATE_ARTIST = "num_songs_last_updated_artist";

        /* When the cover art was last updated */
        public static final String LAST_UPDATE_COVER = "last_updated_cover";

        /* The number of songs when we last updated the cover */
        public static final String NUM_SONGS_LAST_UPDATE_COVER = "num_songs_last_updated_cover";
    }
}


text:
require 'stdlib/event/event'
require 'stdlib/defines/time'

Event.Time = {}

--All times are offset by 0.5
--This is because both EvoGUI and MoWeather already apply that offset.
--Following the precedent to remain consistent.
--Actually, this little snippet is even borrowed from EvoGUI.
local get_day_time
if remote.interfaces.MoWeather then
    -- assume MoWeather's getdaytime is sane
    get_day_time = function (surface_name_or_index) return remote.call("MoWeather", "getdaytime", surface_name_or_index) end
else
    -- 0.5 is midnight; let's make days *start* at midnight instead.
    get_day_time = function (surface_name_or_index) return game.surfaces[surface_name_or_index].daytime + 0.5 end
end

--- @field Fires whenever it becomes midday/noon on a surface
Event.Time.midday = script.generate_event_name()
--- @field Fires whenever it becomes midnight on a surface
Event.Time.midnight = script.generate_event_name()
--- @field Fires whenever the sunrises on a surface
Event.Time.sunrise = script.generate_event_name()
--- @field Fires whenever the sunsets on a surface
Event.Time.sunset = script.generate_event_name()
--- @field Fires every hour for a surface
Event.Time.hourly = script.generate_event_name()
--- @field Fires every minute for a surface
Event.Time.minutely = script.generate_event_name()
--- @field Fires every day for a surface
Event.Time.daily = script.generate_event_name()

Event.register(defines.events.on_tick,
    function()
        for idx, surface in pairs(game.surfaces) do
            if not surface.freeze_daytime then
                local day_time = math.fmod(get_day_time(idx), 1)
                local day_time_minutes = math.floor(day_time * 1440)  -- 24 * 60

                if day_time_minutes ~= global._surface_time[idx] then
                    global._surface_time[idx] = day_time_minutes
                    script.raise_event(Event.Time.minutely, {surface = surface})

                    if day_time_minutes % 60 == 0 then
                        script.raise_event(Event.Time.hourly, {surface = surface})
                    end

                    if day_time_minutes == 0 then
                        script.raise_event(Event.Time.daily, {surface = surface})
                        script.raise_event(Event.Time.midnight, {surface = surface})
                    end

                    -- These are not 100% accurate but within 5-10 Nauvis minutes of the real thing.
                    -- 105 (1:45AM) Brightness starts to increase
                    -- 265 (4:25AM) Flashlight clicks off
                    if day_time_minutes == 265 then
                        script.raise_event(Event.Time.sunrise, {surface = surface})
                    end

                    if day_time_minutes == 720 then
                        script.raise_event(Event.Time.midday, {surface = surface})
                    end

                    -- These are not 100% accurate but within 5-10 Nauvis minutes of the real thing.
                    -- 1070 (5:50PM) Brightness starts to decrease
                    -- 1160 (7:20PM) Flashlight clicks on
                    if day_time_minutes == 1160 then
                        script.raise_event(Event.Time.sunset, {surface = surface})
                    end
                end
            end
        end
    end
)

--- Get the current surface time adjusted
-- @function get_day_time
-- @tparam LuaSurface surface
-- @treturn double [0-1] the current surface time
Event.Time.get_day_time = get_day_time

-- When the mod is initialized the first time
Event.register(Event.core_events.init, function() global._surface_time = {} end)
Event.register(Event.core_events.configuration_changed, function() global._surface_time = global._surface_time or {} end)

return Event.Time


text:
ACCEPTED

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Pittonia 4:46. 1899

#### Original name
Verbena nodiflora Petagn. ex Spreng.

### Remarks
null


text:
package com.longluo.demo.widget.imgcard;

import android.content.Context;
import android.util.AttributeSet;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.longluo.demo.R;
import com.longluo.demo.activitycard.bean.DayActivityInfo;
import com.longluo.demo.activitycard.bean.MonthActivityInfo;

import java.util.ArrayList;

/**
 * MonthActivityCard
 *
 * @author luolong
 * @Date 2015-6-26 4:32:55
 */
public class MonthActivityCard extends RelativeLayout {
    private static final String TAG = MonthActivityCard.class.getSimpleName();

    private Context mContext;
    private LayoutInflater mLayoutInflater;

    private TextView mCardTitle;
    private LinearLayout mCardGrid;

    private int mItemLayout = R.layout.image_card_item;
    private ArrayList<ImageCellLayout> mCells = new ArrayList<ImageCellLayout>();
    //    private ArrayList<RelativeLayout> mCells = new ArrayList<RelativeLayout>();
    private MonthActivityInfo mMonthActivityInfo = new MonthActivityInfo();
    private ArrayList<DayActivityInfo> mActivityInfos = new ArrayList<DayActivityInfo>();

    public MonthActivityCard(Context context) {
        super(context);
        mContext = context;
        init();
    }

    public MonthActivityCard(Context context, AttributeSet attrs) {
        super(context, attrs);
        mContext = context;
//        init();
    }

    public MonthActivityCard(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
        mContext = context;
//        init();
    }

    public void init() {
        if (isInEditMode()) {
            return;
        }

        mLayoutInflater = LayoutInflater.from(mContext);

        View layout = LayoutInflater.from(mContext).inflate(R.layout.image_card_view, null, false);

        mCardTitle = (TextView) layout.findViewById(R.id.cardTitle);
        mCardGrid = (LinearLayout) layout.findViewById(R.id.cardGrid);

        addView(layout);
        updateCells();
    }

    public void initData(MonthActivityInfo monthInfo) {
        mMonthActivityInfo = monthInfo;
        mActivityInfos = monthInfo.mDayActivityInfos;
    }

    public void updateCells() {
        Log.d("luolong", TAG + ",updateCells, " + mActivityInfos.size());

        int index = 0;

        for (int y = 0; y < mCardGrid.getChildCount(); y++) {
            LinearLayout row = (LinearLayout) mCardGrid.getChildAt(y);

            for (int x = 0; x < row.getChildCount() && index < mActivityInfos.size(); x++) {
                ImageCellLayout cell = (ImageCellLayout) row.getChildAt(x);
//                RelativeLayout cell = (RelativeLayout) row.getChildAt(x);

                ImageView cellContent = (ImageView) mLayoutInflater.inflate(mItemLayout, cell, false);
                cellContent.setImageLevel(mActivityInfos.get(index).mActivityLevel);
                index++;
                cell.addView(cellContent);
                mCells.add(cell);
            }
        }
    }

    @Override
    protected void onLayout(boolean changed, int l, int t, int r, int b) {
        super.onLayout(changed, l, t, r, b);

        Log.d("luolong", TAG + ",changed=" + changed + " l=" + l + ",t=" + t + ",r=" + r + ",b=" + b);

        if (changed && mCells.size() > 0) {
            int size = (r - l) / 16;
            for (ImageCellLayout cell : mCells) {
                cell.getLayoutParams().height = size;
            }

            Log.d("luolong", TAG + "," + mCells.size() + ",size=" + size);
        }
    }

    public void setCardTitle() {
        mCardTitle.setText(String.valueOf(mMonthActivityInfo.mMonth) + getResources().getString(R.string.month));
    }

    public int getItemLayout() {
        return mItemLayout;
    }

    public void setItemLayout(int itemLayout) {
        this.mItemLayout = itemLayout;
    }

    /**
     * call after change any input data - to refresh view
     */
    public void notifyChanges() {
        updateCells();
    }

}