text:
package de.zib.gndms.neomodel.gorfx;

import de.zib.gndms.common.model.gorfx.types.FutureTime;
import de.zib.gndms.common.model.gorfx.types.Quote;
import de.zib.gndms.model.common.PermissionInfo;
import de.zib.gndms.model.common.PersistentContract;
import org.joda.time.Duration;

import java.io.Serializable;

/**
 * @author Maik Jorra
 * @email jorra@zib.de
 * @date 30.01.12  11:32
 *
 * @brief A container which stores all possible attributes required when submitting a task.
 *
 *
 */
public class TaskBuilder {

    private final static Quote DEFAULT_QUOTE;
    private final static PermissionInfo DEFAULT_PERMISSION_INFO;

    static {
        DEFAULT_QUOTE = new Quote();
        DEFAULT_QUOTE.setDeadline( FutureTime.atOffset( Duration.standardMinutes( 60 ) ) );
        DEFAULT_QUOTE.setResultValidity( FutureTime.atOffset( Duration.standardDays( 1 ) ) );

        DEFAULT_PERMISSION_INFO = new PermissionInfo( "default", "PermissionConfiglet" );
    }

    private Serializable order;
    private PersistentContract contract;
    private PermissionInfo permissionInfo;

    public Serializable getOrder() {

        return order;
    }

    public boolean hasOrder() {

        return order != null;
    }

    public PersistentContract getContract() {

        return contract;
    }

    public boolean hasContract() {

        return contract != null;
    }

    public PermissionInfo getPermissionInfo() {

        return permissionInfo;
    }

    public boolean hasPermissionInfo() {

        return permissionInfo != null;
    }

    public TaskBuilder setOrder( final Serializable order ) {

        this.order = order;
        return this;
    }

    public TaskBuilder setContract( final PersistentContract contract ) {

        this.contract = contract;
        return this;
    }

    public TaskBuilder setPermissionInfo( final PermissionInfo permissionInfo ) {

        this.permissionInfo = permissionInfo;
        return this;
    }

    public void applyToTask( Task task )  {

        if( hasContract( ) )
            task.setContract( getContract() );
        else
            try {
                task.setContract( PersistentContract.acceptQuoteNow( DEFAULT_QUOTE.clone() ));
            } catch ( CloneNotSupportedException e ) {
                // this can not happen, seriously
            }

        if( hasOrder() )
            task.setOrder(getOrder());

        if( hasPermissionInfo() )
            task.setPermissionInfo( getPermissionInfo() );
        else
            task.setPermissionInfo( new PermissionInfo( DEFAULT_PERMISSION_INFO ) );
    }
}


text:
package util;

public class YourOldJavaCodeUsingRunnable {
    public static void run(Runnable runnable) {
        runnable.run();
    }
}

redpajama_set_name: RedPajamaGithub


text:
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
package com.azure.resourcemanager.network.models;

import com.azure.core.annotation.Fluent;
import com.azure.resourcemanager.network.fluent.models.ExpressRouteCircuitStatsInner;
import com.azure.resourcemanager.resources.fluentcore.model.HasInnerModel;

/** Contains stats associated with the peering. */
@Fluent
public interface ExpressRouteCircuitStats extends HasInnerModel<ExpressRouteCircuitStatsInner> {
    /** @return inbound bytes through primary channel of the peering */
    long primaryBytesIn();

    /** @return outbound bytes through primary channel of the peering */
    long primaryBytesOut();

    /** @return inbound bytes through secondary channel of the peering */
    long secondaryBytesIn();

    /** @return outbound bytes through secondary channel of the peering */
    long secondaryBytesOut();
}


text:
using LNF.Ordering;
using RestSharp;
using System;
using System.Collections.Generic;

namespace OnlineServices.Api.Ordering
{
    public class PurchaseOrderItemRepository : ApiClient, IPurchaseOrderItemRepository
    {
        internal PurchaseOrderItemRepository(IRestClient rc) : base(rc) { }

        public IPurchaseOrderItem AddItem(string partNum, string description, double unitPrice, int inventoryItemId, int vendorId)
        {
            throw new NotImplementedException();
        }

        public IEnumerable<IPurchaseOrderDetail> GetDetails(int itemId)
        {
            throw new NotImplementedException();
        }

        public IPurchaseOrderItem UpdateItem(int itemId, string partNum, string description, double unitPrice, int inventoryItemId)
        {
            throw new NotImplementedException();
        }
    }
}


text:
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#ifndef NSTEXTFRAMETEXTRUNCACHE_H_
#define NSTEXTFRAMETEXTRUNCACHE_H_

#include "nscore.h"

/**
 * This is implemented by both nsTextFrame.cpp and nsTextFrameThebes.cpp. Which
 * implementation gets used depends on which file gets built.
 */
class nsTextFrameTextRunCache {
public:
  static void Init();
  static void Shutdown();
};

#endif


text:
package syntax

import (
	"bufio"
	"bytes"
	"fmt"
	"io"
	"strings"
	"time"
	"unicode"
)

// Token is the type of a lexical token in the query grammar.
type Token byte

const (
	TInvalid  = iota // invalid or unknown token
	TTag             // field tag: x.y
	TString          // string value: 'foo bar'
	TNumber          // number: 0, 15.5, 100
	TTime            // timestamp: TIME yyyy-mm-ddThh:mm:ss([-+]hh:mm|Z)
	TDate            // datestamp: DATE yyyy-mm-dd
	TAnd             // operator: AND
	TContains        // operator: CONTAINS
	TExists          // operator: EXISTS
	TEq              // operator: =
	TLt              // operator: <
	TLeq             // operator: <=
	TGt              // operator: >
	TGeq             // operator: >=

	// Do not reorder these values without updating the scanner code.
)

var tString = [...]string{
	TInvalid:  "invalid token",
	TTag:      "tag",
	TString:   "string",
	TNumber:   "number",
	TTime:     "timestamp",
	TDate:     "datestamp",
	TAnd:      "AND operator",
	TContains: "CONTAINS operator",
	TExists:   "EXISTS operator",
	TEq:       "= operator",
	TLt:       "< operator",
	TLeq:      "<= operator",
	TGt:       "> operator",
	TGeq:      ">= operator",
}

func (t Token) String() string {
	v := int(t)
	if v > len(tString) {
		return "unknown token type"
	}
	return tString[v]
}

const (
	// TimeFormat is the format string used for timestamp values.
	TimeFormat = time.RFC3339

	// DateFormat is the format string used for datestamp values.
	DateFormat = "2006-01-02"
)

// Scanner reads lexical tokens of the query language from an input stream.
// Each call to Next advances the scanner to the next token, or reports an
// error.
type Scanner struct {
	r   *bufio.Reader
	buf bytes.Buffer
	tok Token
	err error

	pos, last, end int
}

// NewScanner constructs a new scanner that reads from r.
func NewScanner(r io.Reader) *Scanner { return &Scanner{r: bufio.NewReader(r)} }

// Next advances s to the next token in the input, or reports an error.  At the
// end of input, Next returns io.EOF.
func (s *Scanner) Next() error {
	s.buf.Reset()
	s.pos = s.end
	s.tok = TInvalid
	s.err = nil

	for {
		ch, err := s.rune()
		if err != nil {
			return s.fail(err)
		}
		if unicode.IsSpace(ch) {
			s.pos = s.end
			continue // skip whitespace
		}
		if '0' <= ch && ch <= '9' {
			return s.scanNumber(ch)
		} else if isTagRune(ch) {
			return s.scanTagLike(ch)
		}
		switch ch {
		case '\'':
			return s.scanString(ch)
		case '<', '>', '=':
			return s.scanCompare(ch)
		default:
			return s.invalid(ch)
		}
	}
}

// Token returns the type of the current input token.
func (s *Scanner) Token() Token { return s.tok }

// Text returns the text of the current input token.
func (s *Scanner) Text() string { return s.buf.String() }

// Pos returns the start offset of the current token in the input.
func (s *Scanner) Pos() int { return s.pos }

// Err returns the last error reported by Next, if any.
func (s *Scanner) Err() error { return s.err }

// scanNumber scans for numbers with optional fractional parts.
// Examples: 0, 1, 3.14
func (s *Scanner) scanNumber(first rune) error {
	s.buf.WriteRune(first)
	if err := s.scanWhile(isDigit); err != nil {
		return err
	}

	ch, err := s.rune()
	if err != nil && err != io.EOF {
		return err
	}
	if ch == '.' {
		s.buf.WriteRune(ch)
		if err := s.scanWhile(isDigit); err != nil {
			return err
		}
	} else {
		s.unrune()
	}
	s.tok = TNumber
	return nil
}

func (s *Scanner) scanString(first rune) error {
	// discard opening quote
	for {
		ch, err := s.rune()
		if err != nil {
			return s.fail(err)
		} else if ch == first {
			// discard closing quote
			s.tok = TString
			return nil
		}
		s.buf.WriteRune(ch)
	}
}

func (s *Scanner) scanCompare(first rune) error {
	s.buf.WriteRune(first)
	switch first {
	case '=':
		s.tok = TEq
		return nil
	case '<':
		s.tok = TLt
	case '>':
		s.tok = TGt
	default:
		return s.invalid(first)
	}

	ch, err := s.rune()
	if err == io.EOF {
		return nil // the assigned token is correct
	} else if err != nil {
		return s.fail(err)
	}
	if ch == '=' {
		s.buf.WriteRune(ch)
		s.tok++ // depends on token order
		return nil
	}
	s.unrune()
	return nil
}

func (s *Scanner) scanTagLike(first rune) error {
	s.buf.WriteRune(first)
	var hasSpace bool
	for {
		ch, err := s.rune()
		if err == io.EOF {
			break
		} else if err != nil {
			return s.fail(err)
		}
		if !isTagRune(ch) {
			hasSpace = ch == ' ' // to check for TIME, DATE
			break
		}
		s.buf.WriteRune(ch)
	}

	text := s.buf.String()
	switch text {
	case "TIME":
		if hasSpace {
			return s.scanTimestamp()
		}
		s.tok = TTag
	case "DATE":
		if hasSpace {
			return s.scanDatestamp()
		}
		s.tok = TTag
	case "AND":
		s.tok = TAnd
	case "EXISTS":
		s.tok = TExists
	case "CONTAINS":
		s.tok = TContains
	default:
		s.tok = TTag
	}
	s.unrune()
	return nil
}

func (s *Scanner) scanTimestamp() error {
	s.buf.Reset() // discard "TIME" label
	if err := s.scanWhile(isTimeRune); err != nil {
		return err
	}
	if ts, err := time.Parse(TimeFormat, s.buf.String()); err != nil {
		return s.fail(fmt.Errorf("invalid TIME value: %w", err))
	} else if y := ts.Year(); y < 1900 || y > 2999 {
		return s.fail(fmt.Errorf("timestamp year %d out of range", ts.Year()))
	}
	s.tok = TTime
	return nil
}

func (s *Scanner) scanDatestamp() error {
	s.buf.Reset() // discard "DATE" label
	if err := s.scanWhile(isDateRune); err != nil {
		return err
	}
	if ts, err := time.Parse(DateFormat, s.buf.String()); err != nil {
		return s.fail(fmt.Errorf("invalid DATE value: %w", err))
	} else if y := ts.Year(); y < 1900 || y > 2999 {
		return s.fail(fmt.Errorf("datestamp year %d out of range", ts.Year()))
	}
	s.tok = TDate
	return nil
}

func (s *Scanner) scanWhile(ok func(rune) bool) error {
	for {
		ch, err := s.rune()
		if err == io.EOF {
			return nil
		} else if err != nil {
			return s.fail(err)
		} else if !ok(ch) {
			s.unrune()
			return nil
		}
		s.buf.WriteRune(ch)
	}
}

func (s *Scanner) rune() (rune, error) {
	ch, nb, err := s.r.ReadRune()
	s.last = nb
	s.end += nb
	return ch, err
}

func (s *Scanner) unrune() {
	_ = s.r.UnreadRune()
	s.end -= s.last
}

func (s *Scanner) fail(err error) error {
	s.err = err
	return err
}

func (s *Scanner) invalid(ch rune) error {
	return s.fail(fmt.Errorf("invalid input %c at offset %d", ch, s.end))
}

func isDigit(r rune) bool { return '0' <= r && r <= '9' }

func isTagRune(r rune) bool {
	return r == '.' || r == '_' || unicode.IsLetter(r) || unicode.IsDigit(r)
}

func isTimeRune(r rune) bool {
	return strings.ContainsRune("-T:+Z", r) || isDigit(r)
}

func isDateRune(r rune) bool { return isDigit(r) || r == '-' }


text:
package ti.modules.titanium.network;

import org.appcelerator.kroll.common.Log;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;

/**
 * A wrapper for a broadcast receiver that provides network connectivity
 * state information, independent of network type (mobile, Wi-Fi, etc.).
 * {@hide}
 */
public class TiNetworkListener {
    private static final String TAG = "TiNetListener";

    public static final String EXTRA_CONNECTED = "connected";
    public static final String EXTRA_NETWORK_TYPE = "networkType";
    public static final String EXTRA_NETWORK_TYPE_NAME = "networkTypeName";
    public static final String EXTRA_FAILOVER = "failover";
    public static final String EXTRA_REASON = "reason";

    private IntentFilter connectivityIntentFilter;
    private ConnectivityBroadcastReceiver receiver;

    private Handler messageHandler;
    private Context context; // null on release, might need to be softRef.
    private boolean listening;

    private class ConnectivityBroadcastReceiver extends BroadcastReceiver {
        @Override
        public void onReceive(Context context, Intent intent)
        {
            String action = intent.getAction();

            if (!action.equals(ConnectivityManager.CONNECTIVITY_ACTION)) {
                 return;
            }

            if (messageHandler == null) {
            	Log.w(TAG, "Network receiver is active but no handler has been set.");
            	return;
            }

           boolean noConnectivity =
            	intent.getBooleanExtra(ConnectivityManager.EXTRA_NO_CONNECTIVITY, false);
            NetworkInfo networkInfo = (NetworkInfo)
            	intent.getParcelableExtra(ConnectivityManager.EXTRA_NETWORK_INFO);
            NetworkInfo otherNetworkInfo = (NetworkInfo)
                intent.getParcelableExtra(ConnectivityManager.EXTRA_OTHER_NETWORK_INFO);

            String reason = intent.getStringExtra(ConnectivityManager.EXTRA_REASON);
            boolean failover =
                intent.getBooleanExtra(ConnectivityManager.EXTRA_IS_FAILOVER, false);

                Log.d(TAG, "onReceive(): mNetworkInfo=" + networkInfo +  " mOtherNetworkInfo = "
                        + (otherNetworkInfo == null ? "[none]" : otherNetworkInfo +
                        " noConn=" + noConnectivity), Log.DEBUG_MODE);

        	Message message = Message.obtain(messageHandler);

        	Bundle b = message.getData();
        	b.putBoolean(EXTRA_CONNECTED, !noConnectivity);
        	b.putInt(EXTRA_NETWORK_TYPE, networkInfo.getType());
        	if (noConnectivity) {
        		b.putString(EXTRA_NETWORK_TYPE_NAME, "NONE");
        	} else {
           		b.putString(EXTRA_NETWORK_TYPE_NAME, networkInfo.getTypeName());
           	}
        	b.putBoolean(EXTRA_FAILOVER, failover);
        	b.putString(EXTRA_REASON, reason);

        	message.sendToTarget();
        }
    };

    /**
     * Create a new TitaniumNetworkListener.
     */
    public TiNetworkListener(Handler messageHandler) {
        this.receiver = new ConnectivityBroadcastReceiver();
        this.messageHandler = messageHandler;
        this.connectivityIntentFilter = new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION);
    }

    public void attach(Context context) {
    	if (!listening) {
    		if (this.context == null) {
    			this.context = context;
    		} else {
    			throw new IllegalStateException("Context was not cleaned up from last release.");
    		}
    		context.registerReceiver(receiver, connectivityIntentFilter);
    		listening = true;
    	} else {
    		Log.w(TAG, "Connectivity listener is already attached");
    	}
    }

    public void detach() {
    	if (listening) {
			context.unregisterReceiver(receiver);
			context = null;
			listening = false;
    	}
    }
}


text:
      <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-2">
        Toggle navigation

      </button>

        {% for link in linklists.main_menu.links %}
	      	{% if link.type == 'collection_link' and link.object.tags.size > 0 %}

	          {{ link.title }}

	          	{% for tag in link.object.tags %}

{{ tag }}

	            {% endfor %}

			{% else %}

{{ link.title }}

			{% endif %}
		{% endfor %}

      <form class="navbar-form navbar-right searchbox" role="search" action="/search">

          <input type="text" placeholder="搜尋商品..." name="q" {% if q %}value="{{ q }}"{% endif %} />

        <button type="submit"></button>

      </form>


text:
//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:4.0.30319.42000
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

namespace Microsoft.Azure.Commands.Profile.Properties {
    using System;

    /// <summary>
    ///   A strongly-typed resource class, for looking up localized strings, etc.
    /// </summary>
    // This class was auto-generated by the StronglyTypedResourceBuilder
    // class via a tool like ResGen or Visual Studio.
    // To add or remove a member, edit your .ResX file then rerun ResGen
    // with the /str option, or rebuild your VS project.
    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
    internal class Resources {

        private static global::System.Resources.ResourceManager resourceMan;

        private static global::System.Globalization.CultureInfo resourceCulture;

        [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
        internal Resources() {
        }

        /// <summary>
        ///   Returns the cached ResourceManager instance used by this class.
        /// </summary>
        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
        internal static global::System.Resources.ResourceManager ResourceManager {
            get {
                if (object.ReferenceEquals(resourceMan, null)) {
                    global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.Azure.Commands.Profile.Properties.Resources", typeof(Resources).Assembly);
                    resourceMan = temp;
                }
                return resourceMan;
            }
        }

        /// <summary>
        ///   Overrides the current thread's CurrentUICulture property for all
        ///   resource lookups using this strongly typed resource class.
        /// </summary>
        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
        internal static global::System.Globalization.CultureInfo Culture {
            get {
                return resourceCulture;
            }
            set {
                resourceCulture = value;
            }
        }

        /// <summary>
        ///   Looks up a localized string similar to AccountId must be provided to use an AccessToken credential..
        /// </summary>
        internal static string AccessTokenRequiresAccount {
            get {
                return ResourceManager.GetString("AccessTokenRequiresAccount", resourceCulture);
            }
        }

        /// <summary>
        ///   Looks up a localized string similar to Account ID '{0}' for tenant '{1}' does not match home Account ID '{2}'.
        /// </summary>
        internal static string AccountIdMismatch {
            get {
                return ResourceManager.GetString("AccountIdMismatch", resourceCulture);
            }
        }

        /// <summary>
        ///   Looks up a localized string similar to Access token credentials must provide the AccountId parameter..
        /// </summary>
        internal static string AccountIdRequired {
            get {
                return ResourceManager.GetString("AccountIdRequired", resourceCulture);
            }
        }

        /// <summary>
        ///   Looks up a localized string similar to Selected profile must not be null..
        /// </summary>
        internal static string AzureProfileMustNotBeNull {
            get {
                return ResourceManager.GetString("AzureProfileMustNotBeNull", resourceCulture);
            }
        }

        /// <summary>
        ///   Looks up a localized string similar to Please provide either a subscription ID or a subscription name..
        /// </summary>
        internal static string BothSubscriptionIdAndNameProvided {
            get {
                return ResourceManager.GetString("BothSubscriptionIdAndNameProvided", resourceCulture);
            }
        }

        /// <summary>
        ///   Looks up a localized string similar to Could not authenticate your user account {0} with the common tenant. Please login again using Login-AzureRmAccount..
        /// </summary>
        internal static string CommonTenantAuthFailed {
            get {
                return ResourceManager.GetString("CommonTenantAuthFailed", resourceCulture);
            }
        }

        /// <summary>
        ///   Looks up a localized string similar to Current tenant with Id '{0}' will be used..
        /// </summary>
        internal static string CurrentTenantInUse {
            get {
                return ResourceManager.GetString("CurrentTenantInUse", resourceCulture);
            }
        }

        /// <summary>
        ///   Looks up a localized string similar to Cannot find file '{0}'.
        /// </summary>
        internal static string FileNotFound {
            get {
                return ResourceManager.GetString("FileNotFound", resourceCulture);
            }
        }

        /// <summary>
        ///   Looks up a localized string similar to The provided subscription ID "{0}" is not a valid Guid..
        /// </summary>
        internal static string InvalidSubscriptionId {
            get {
                return ResourceManager.GetString("InvalidSubscriptionId", resourceCulture);
            }
        }

        /// <summary>
        ///   Looks up a localized string similar to (no account provided).
        /// </summary>
        internal static string NoAccountProvided {
            get {
                return ResourceManager.GetString("NoAccountProvided", resourceCulture);
            }
        }

        /// <summary>
        ///   Looks up a localized string similar to Please provide a valid tenant Id on the command line or execute Login-AzureRmAccount..
        /// </summary>
        internal static string NoValidTenant {
            get {
                return ResourceManager.GetString("NoValidTenant", resourceCulture);
            }
        }

        /// <summary>
        ///   Looks up a localized string similar to Selected subscription is in '{0}' state. .
        /// </summary>
        internal static string SelectedSubscriptionNotActive {
            get {
                return ResourceManager.GetString("SelectedSubscriptionNotActive", resourceCulture);
            }
        }

        /// <summary>
        ///   Looks up a localized string similar to Please provide either a subscription ID, subscription name, tenant Id or domain..
        /// </summary>
        internal static string SetAzureRmContextNoParameterSet {
            get {
                return ResourceManager.GetString("SetAzureRmContextNoParameterSet", resourceCulture);
            }
        }

        /// <summary>
        ///   Looks up a localized string similar to Unable to find subscription with name '{0}'..
        /// </summary>
        internal static string SubscriptionNameNotFoundError {
            get {
                return ResourceManager.GetString("SubscriptionNameNotFoundError", resourceCulture);
            }
        }

        /// <summary>
        ///   Looks up a localized string similar to Subscription {0} was not found in tenant {1}. Please verify that the subscription exists in this tenant..
        /// </summary>
        internal static string SubscriptionNotFoundError {
            get {
                return ResourceManager.GetString("SubscriptionNotFoundError", resourceCulture);
            }
        }

        /// <summary>
        ///   Looks up a localized string similar to Could not authenticate with tenant {0}. Please ensure that your account has access to this tenant and log in with Login-AzureRmAccount.
        /// </summary>
        internal static string TenantAuthFailed {
            get {
                return ResourceManager.GetString("TenantAuthFailed", resourceCulture);
            }
        }

        /// <summary>
        ///   Looks up a localized string similar to Unable to find tenant '{0}'..
        /// </summary>
        internal static string TenantIdNotFound {
            get {
                return ResourceManager.GetString("TenantIdNotFound", resourceCulture);
            }
        }

        /// <summary>
        ///   Looks up a localized string similar to To create an access token credential, you must provide an access token account..
        /// </summary>
        internal static string TypeNotAccessToken {
            get {
                return ResourceManager.GetString("TypeNotAccessToken", resourceCulture);
            }
        }

        /// <summary>
        ///   Looks up a localized string similar to Unable to acquire token for tenant '{0}'.
        /// </summary>
        internal static string UnableToAqcuireToken {
            get {
                return ResourceManager.GetString("UnableToAqcuireToken", resourceCulture);
            }
        }

        /// <summary>
        ///   Looks up a localized string similar to Could not authenticate user account '{0}' with tenant '{1}'. Subscriptions in this tenant will not be listed. Please login again using Login-AzureRmAccount to view the subscriptions in this tenant..
        /// </summary>
        internal static string UnableToLogin {
            get {
                return ResourceManager.GetString("UnableToLogin", resourceCulture);
            }
        }

        /// <summary>
        ///   Looks up a localized string similar to Unable to find environment with name '{0}'.
        /// </summary>
        internal static string UnknownEnvironment {
            get {
                return ResourceManager.GetString("UnknownEnvironment", resourceCulture);
            }
        }
    }
}


text:
package com.facebook.buck.util;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

import java.io.ByteArrayOutputStream;
import java.io.FilterOutputStream;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.nio.charset.StandardCharsets;
import org.junit.Test;

public class TeeOutputStreamTest {
  @Test
  public void delegates() throws Exception {
    CloseRecordingByteArrayOutputStream one = new CloseRecordingByteArrayOutputStream();
    CloseRecordingByteArrayOutputStream two = new CloseRecordingByteArrayOutputStream();
    TeeOutputStream teeOutputStream = new TeeOutputStream(one, two);
    teeOutputStream.write("foo".getBytes(StandardCharsets.UTF_8));
    teeOutputStream.flush();
    assertEquals("foo", one.toUtf8String());
    assertEquals("foo", two.toUtf8String());

    teeOutputStream.close();
    assertTrue(one.isClosed());
    assertTrue(two.isClosed());
  }

  static class CloseRecordingByteArrayOutputStream extends FilterOutputStream {
    private final ByteArrayOutputStream delegate;

    public CloseRecordingByteArrayOutputStream() {
      this(new ByteArrayOutputStream());
    }

    private CloseRecordingByteArrayOutputStream(ByteArrayOutputStream delegate) {
      super(delegate);
      this.delegate = delegate;
    }

    private boolean isClosed = false;

    @Override
    public void close() throws IOException {
      isClosed = true;
    }

    public boolean isClosed() {
      return isClosed;
    }

    public String toUtf8String() {
      try {
        return delegate.toString(StandardCharsets.UTF_8.toString());
      } catch (UnsupportedEncodingException e) {
        throw new IllegalStateException(e);
      }
    }
  }
}


text:
> ######  DEV BUILD

## Express Bookshelf Postgres ES6
Express, Bookshelf.js & Postgres. ES6 style using Babel.

### Main Components:
 - Grunt
 - Babel Compiler
 - Express
 - Bookshelf.js
 - SASS
 - BrowserSync

### Usage

```sh
# clone a copy
git clone https://github.com/kurtisdunn/Express-Bookshelf-Postgres-ES6.git
cd ES6-ExpressJS-Starter

# get it going:
npm install

# run it
node dist/server.js

```

### Development Stuff
```sh
# Compile ES6 to ES5
grunt compile

# run up a development version:
grunt dev

```

### DB Persistence:
This build uses Bookshelf.js to persist our data from postgresql, easily mapping table relations in a minimal promise based format.

```sh
# Model
const Make = Bookshelf.Model.extend({
  tableName: 'make',
  models: () => {
    return this.hasMany(Model);
  }
});

# Query
Make.where('id', req.params.id).fetch().then((make) => {
  res.json(make);
}).catch((err) => {
  console.error(err);
});

```

###Endpoints

 - `GET /api` - Returns nothing
 - `GET /api/make/:id` - Fetch make by id
 - `GET /api/make/:id/models` - Fetch models by make
 - `GET /api/models/:id` - Query model by model name


text:
/*
mysql_query() cannot be used for statements that contain binary data; you must use mysql_real_query() instead.
(Binary data may contain the "\0" character, which mysql_query() interprets as the end of the statement string.)
In addition, mysql_real_query() is faster than mysql_query() because it does not call strlen() on the statement string.
*/

// Load configuration
var cfg = require("../config");

exports.Issue83Query = function (test) {
  test.expect(3);

  var conn = cfg.mysql_libmysqlclient.createConnectionSync(cfg.host, cfg.user, cfg.password, cfg.database);

  res = conn.query("SELECT '1\u00002345\0' AS a;", function (err, res) {
    test.ok(res instanceof cfg.mysql_bindings.MysqlResult, "Result is defined");
    test.ok(err === null, "Error object is not present");

    rows = res.fetchAllSync();
    test.same(rows, [{a: "1\u00002345\0"}], "conn.querySync('SELECT ...').fetchAllSync()");

    conn.closeSync();

    test.done();
  });
};

exports.Issue83QuerySync = function (test) {
  test.expect(2);

  var
    conn = cfg.mysql_libmysqlclient.createConnectionSync(cfg.host, cfg.user, cfg.password, cfg.database),
    res;

  res = conn.querySync("SELECT '1\u00002345\0' AS a;");
  test.ok(res instanceof cfg.mysql_bindings.MysqlResult, "SELECT '1\u00002345\0' AS a;");

  rows = res.fetchAllSync();
  test.same(rows, [{a: "1\u00002345\0"}], "conn.querySync('SELECT ...').fetchAllSync()");

  conn.closeSync();

  test.done();
};

exports.Issue83RealQuerySync = function (test) {
  test.expect(2);

  var
    conn = cfg.mysql_libmysqlclient.createConnectionSync(cfg.host, cfg.user, cfg.password, cfg.database),
    res;

  conn.realQuerySync("SELECT '1\u00002345\0' AS a;");
  res = conn.storeResultSync();

  test.ok(res instanceof cfg.mysql_bindings.MysqlResult, "SELECT '1\u00002345\0' AS a;");

  rows = res.fetchAllSync();
  test.same(rows, [{a: "1\u00002345\0"}], "conn.querySync('SELECT ...').fetchAllSync()");

  conn.closeSync();

  test.done();
};

exports.Issue83MultyQuerySync = function (test) {
  test.expect(5);

  var
    conn = cfg.mysql_libmysqlclient.createConnectionSync(cfg.host, cfg.user, cfg.password, cfg.database),
    res;

  conn.multiRealQuerySync("SELECT '1\u00002345\0' AS a; SELECT 'q\u0000werty\0' AS b;");
  res = conn.storeResultSync();
  test.ok(res instanceof cfg.mysql_bindings.MysqlResult, "SELECT '1\u00002345\0' AS a;");

  rows = res.fetchAllSync();
  test.same(rows, [{a: "1\u00002345\0"}], "conn.querySync('SELECT ...').fetchAllSync()");

  test.ok(conn.multiMoreResultsSync(), "conn.multiMoreResultsSync()");

  conn.multiNextResultSync();
  res = conn.storeResultSync();
  test.ok(res instanceof cfg.mysql_bindings.MysqlResult, "SELECT 'q\u0000werty\0' AS b;");

  rows = res.fetchAllSync();
  test.same(rows, [{b: "q\u0000werty\0"}], "conn.querySync('SELECT ...').fetchAllSync()");

  conn.closeSync();

  test.done();
};


text:
package ru.job4j.bomberman;

import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.ReentrantLock;

/**
 * Created by vvryazanov on 13.12.2017.
 */
public class Block{
    /**
     * X coordinate of this unit on the board
     */
    private int xCoord;
    /**
     * Y coordinate of this unit on the board
     */
    private int yCoord;

    public Block(int xCoord, int yCoord) {
        this.xCoord = xCoord;
        this.yCoord = yCoord;
    }
    /**
     * Return x coordanate of the unit.
     *
     * @return x coordanate of the unit
     */
    public int getxCoord() {
        return xCoord;
    }

    /**
     * Return y coordanate of the unit.
     *
     * @return y coordanate of the unit
     */
    public int getyCoord() {
        return yCoord;
    }
}


text:
const Label = require('../label.js');
const util = require('../util.js');

module.exports = async ({vGraph, id}) => {
  return util.checkNode({
    vGraph,
    id,
    label: Label.PERSON,
  });
};


text:
extern HINSTANCE hInst;
extern C_Handler *gMainHandler;

static HWND mywin;

long CurrentChar=-1;
long CurrentFontID=1;
void DeleteGroupList(long ID);

long ItemID=1;
char FontList[200][32];
LOGFONT fontlog[200];

LOGFONT CreatedLogFont;
C_Fontmgr *CreatedFont=NULL;

void ChooseFontCB(long ID,short hittype, C_Base *control);

static long LF_TRUE_FALSE[]=
{
	0,
	0,
	1,
	-5551212,
};

static long LF_CHARSET[]=
{
	0,
	ANSI_CHARSET,
	OEM_CHARSET,
	SYMBOL_CHARSET,
	-5551212,
};

static long LF_OUT_PRECISION[]=
{
	0,
	OUT_CHARACTER_PRECIS,
	OUT_DEFAULT_PRECIS,
	OUT_STRING_PRECIS,
	OUT_STROKE_PRECIS,
	-5551212,
};

static long LF_CLIP_PRECISION[]=
{
	0,
	CLIP_CHARACTER_PRECIS,
	CLIP_DEFAULT_PRECIS,
	CLIP_STROKE_PRECIS,
	-5551212,
};

static long LF_QUALITY[]=
{
	0,
	DEFAULT_QUALITY,
	DRAFT_QUALITY,
	PROOF_QUALITY,
	-5551212,
};

static long LF_PITCH[]=
{
	0,
	DEFAULT_PITCH,
	FIXED_PITCH,
	VARIABLE_PITCH,
	-5551212,
};

static long LF_FAMILY[]=
{
	0,
	FF_DECORATIVE,
	FF_DONTCARE,
	FF_MODERN,
	FF_ROMAN,
	FF_SCRIPT,
	FF_SWISS,
	-5551212,
};

long SearchList(long val,long list[])
{
	int i;

	for(i=1;list[i] != -5551212;i++)
		if(list[i] == val)
			return(i);
	return(0);
}

void SetWindowLOGFONT(LOGFONT *log)
{
	C_Window *win;
	C_EditBox *ebox;
	C_ListBox *lbox;

	if(!log)
		return;

	win=gMainHandler->FindWindow(LOGFONT_WIN);
	if(win)
	{
		ebox=(C_EditBox*)win->FindControl(EB_HEIGHT);
		if(ebox)
		{
			ebox->SetInteger(log->lfHeight);
		}
		ebox=(C_EditBox*)win->FindControl(EB_WIDTH);
		if(ebox)
		{
			ebox->SetInteger(log->lfWidth);
		}
		ebox=(C_EditBox*)win->FindControl(EB_ESCAPEMENT);
		if(ebox)
		{
			ebox->SetInteger(log->lfEscapement);
		}
		ebox=(C_EditBox*)win->FindControl(EB_ORIENTATION);
		if(ebox)
		{
			ebox->SetInteger(log->lfOrientation);
		}
		ebox=(C_EditBox*)win->FindControl(EB_WEIGHT);
		if(ebox)
		{
			ebox->SetInteger(log->lfWeight);
		}
		lbox=(C_ListBox*)win->FindControl(LB_ITALIC);
		if(lbox)
		{
			lbox->SetValue(SearchList(log->lfItalic,LF_TRUE_FALSE));
		}
		lbox=(C_ListBox*)win->FindControl(LB_UNDERLINE);
		if(lbox)
		{
			lbox->SetValue(SearchList(log->lfUnderline,LF_TRUE_FALSE));
		}
		lbox=(C_ListBox*)win->FindControl(LB_STRIKEOUT);
		if(lbox)
		{
			lbox->SetValue(SearchList(log->lfStrikeOut,LF_TRUE_FALSE));
		}
		lbox=(C_ListBox*)win->FindControl(LB_CHARSET);
		if(lbox)
		{
			lbox->SetValue(SearchList(log->lfCharSet,LF_CHARSET));
		}
		lbox=(C_ListBox*)win->FindControl(LB_OUTPRECISION);
		if(lbox)
		{
			lbox->SetValue(SearchList(log->lfOutPrecision,LF_OUT_PRECISION));
		}
		lbox=(C_ListBox*)win->FindControl(LB_CLIPPRECISION);
		if(lbox)
		{
			lbox->SetValue(SearchList(log->lfClipPrecision,LF_OUT_PRECISION));
		}
		lbox=(C_ListBox*)win->FindControl(LB_QUALITY);
		if(lbox)
		{
			lbox->SetValue(SearchList(log->lfQuality,LF_QUALITY));
		}
		lbox=(C_ListBox*)win->FindControl(LB_PITCH);
		if(lbox)
		{
			lbox->SetValue(SearchList(log->lfPitchAndFamily & 3,LF_PITCH));
		}
		lbox=(C_ListBox*)win->FindControl(LB_FAMILY);
		if(lbox)
		{
			lbox->SetValue(SearchList(log->lfPitchAndFamily & 0xfc,LF_FAMILY));
		}
		ebox=(C_EditBox*)win->FindControl(EB_FACENAME);
		if(ebox)
		{
			ebox->SetText(log->lfFaceName);
		}
		win->update_ |= C_DRAW_REFRESHALL;
		win->RefreshWindow();
	}
}

void GetWindowLOGFONT(LOGFONT *log)
{
	C_Window *win;
	C_EditBox *ebox;
	C_ListBox *lbox;

	if(!log)
		return;

	win=gMainHandler->FindWindow(LOGFONT_WIN);
	if(win)
	{
		ebox=(C_EditBox*)win->FindControl(EB_HEIGHT);
		if(ebox)
		{
			log->lfHeight=ebox->GetInteger();
		}
		ebox=(C_EditBox*)win->FindControl(EB_WIDTH);
		if(ebox)
		{
			log->lfWidth=ebox->GetInteger();
		}
		ebox=(C_EditBox*)win->FindControl(EB_ESCAPEMENT);
		if(ebox)
		{
			log->lfEscapement=ebox->GetInteger();
		}
		ebox=(C_EditBox*)win->FindControl(EB_ORIENTATION);
		if(ebox)
		{
			log->lfOrientation=ebox->GetInteger();
		}
		ebox=(C_EditBox*)win->FindControl(EB_WEIGHT);
		if(ebox)
		{
			log->lfWeight=ebox->GetInteger();
		}
		lbox=(C_ListBox*)win->FindControl(LB_ITALIC);
		if(lbox)
		{
			log->lfItalic=static_cast<BYTE>(LF_TRUE_FALSE[lbox->GetTextID()]);
		}
		lbox=(C_ListBox*)win->FindControl(LB_UNDERLINE);
		if(lbox)
		{
			log->lfUnderline=static_cast<BYTE>(LF_TRUE_FALSE[lbox->GetTextID()]);
		}
		lbox=(C_ListBox*)win->FindControl(LB_STRIKEOUT);
		if(lbox)
		{
			log->lfStrikeOut=static_cast<BYTE>(LF_TRUE_FALSE[lbox->GetTextID()]);
		}
		lbox=(C_ListBox*)win->FindControl(LB_CHARSET);
		if(lbox)
		{
			log->lfCharSet=static_cast<BYTE>(LF_CHARSET[lbox->GetTextID()]);
		}
		lbox=(C_ListBox*)win->FindControl(LB_OUTPRECISION);
		if(lbox)
		{
			log->lfOutPrecision=static_cast<BYTE>(LF_OUT_PRECISION[lbox->GetTextID()]);
		}
		lbox=(C_ListBox*)win->FindControl(LB_CLIPPRECISION);
		if(lbox)
		{
			log->lfClipPrecision=static_cast<BYTE>(LF_CLIP_PRECISION[lbox->GetTextID()]);
		}
		lbox=(C_ListBox*)win->FindControl(LB_QUALITY);
		if(lbox)
		{
			log->lfQuality=static_cast<BYTE>(LF_QUALITY[lbox->GetTextID()]);
		}
		log->lfPitchAndFamily=0;
		lbox=(C_ListBox*)win->FindControl(LB_PITCH);
		if(lbox)
		{
			log->lfPitchAndFamily |= LF_PITCH[lbox->GetTextID()];
		}
		lbox=(C_ListBox*)win->FindControl(LB_FAMILY);
		if(lbox)
		{
			log->lfPitchAndFamily |= LF_FAMILY[lbox->GetTextID()];
		}
		ebox=(C_EditBox*)win->FindControl(EB_FACENAME);
		if(ebox)
		{
			strcpy(log->lfFaceName,ebox->GetText());
		}
	}
}

// Enumerated fonts
int CALLBACK testme(CONST LOGFONTA *logfnt, CONST TEXTMETRICA *metrics, DWORD, LPARAM)
{
	if(ItemID < 200)
	{
		if(metrics->tmPitchAndFamily & TMPF_TRUETYPE)
		{
			memcpy(&fontlog[ItemID],logfnt,sizeof(LOGFONT));
			strcpy(FontList[ItemID],logfnt->lfFaceName);
			ItemID++;
		}
	}
	return(1);
}

void GetAllFonts(HDC hdc,char *facename)
{
	EnumFonts(hdc,facename,testme,0);
}

#define SCREEN_SIZE (500)

C_Fontmgr *FontToBFT(long ID,LOGFONT *logfont)
{
	FONTLIST *font;
	char buffer[100];
	long firstchar;
	long lastchar;
	long numchars;
	long DataSize;
	long KernSize;
	long xoff,yoff;
	long i,j,x,y;
	long charw,charh;
	long bytesperline;
	unsigned char *CharData,*CharPtr;
	HDC hdc;
	KERNINGPAIR *kerns;
	KerningStr *mykerns;
	ABC *ABCList;
	CharStr *MyChars;
	C_Fontmgr *newfont;

//	surface=UI95_CreateDDSurface(gMainDDraw,SCREEN_SIZE,SCREEN_SIZE);
//	if(!surface)
//	{
//		MonoPrint("Can't create DDSurface for Font conversion to BFT\n");
//		return(NULL);
//	}

	font=new FONTLIST;
	font->Font_=CreateFontIndirect(logfont);
	if(font->Font_ == NULL)
	{
		delete font;
		return(NULL);
	}

	font->ID_=ID;
	hdc=GetDC(mywin);
	SelectObject(hdc,font->Font_);
	GetTextFace(hdc,99,buffer);
	GetTextMetrics(hdc,&font->Metrics_);
	ReleaseDC(mywin,hdc);

// Get Kerning tables
	kerns=new KERNINGPAIR[256*256];
	mykerns=new KerningStr[256*256];
	ABCList=new ABC[256];

	hdc=GetDC(mywin);
	SelectObject(hdc,font->Font_);
	KernSize=GetKerningPairs(hdc,65536,kerns);
	GetCharABCWidths(hdc,font->Metrics_.tmFirstChar,font->Metrics_.tmLastChar,ABCList);
	ReleaseDC(mywin,hdc);

	for(i=0;i<KernSize;i++)
	{
		mykerns[i].first  = kerns[i].wFirst;
		mykerns[i].second = kerns[i].wSecond;
		mykerns[i].add    = static_cast<short>(kerns[i].iKernAmount);
	}

	delete kerns;
	// Generate font table

	firstchar=font->Metrics_.tmFirstChar;
	lastchar=font->Metrics_.tmLastChar;
	numchars=lastchar-firstchar+1;

	MyChars=new CharStr[numchars];
	memset(MyChars,0,sizeof(CharStr)*numchars);

	// Check All Kerning
	for(j=0;j<KernSize;j++)
	{
		for(i=0;i<numchars;i++)
			if((firstchar+i) == mykerns[i].first)
				MyChars[i].flags=_FNT_CHECK_KERNING_;
	}

	for(i=0;i<numchars;i++)
	{
		MyChars[i].lead=static_cast<char>(ABCList[i].abcA);
		MyChars[i].w=static_cast<BYTE>(ABCList[i].abcB);
		MyChars[i].trail=static_cast<char>(ABCList[i].abcC);
	}

	delete ABCList;

	// Create Font Resource

	newfont=new C_Fontmgr;
	newfont->SetID(ID);
	newfont->SetName(buffer);
	newfont->SetHeight(font->Metrics_.tmHeight);
	bytesperline=font->Metrics_.tmMaxCharWidth / 8 + 1;
	newfont->SetBPL(bytesperline);
	newfont->SetRange(firstchar,lastchar);
	newfont->SetTable(numchars,MyChars);
	newfont->SetKerning(KernSize,mykerns);
	CharData=new unsigned char[bytesperline * font->Metrics_.tmHeight * numchars];
	DataSize=numchars * font->Metrics_.tmHeight * bytesperline;
	newfont->SetData(DataSize,(char *)CharData);
	memset(CharData,0,DataSize);

	CharPtr=CharData;

	buffer[0]=0;
	buffer[1]=0;
	hdc=GetDC(mywin);
	// Clear surface
	for(y=0;y<SCREEN_SIZE;y++)
		for(x=0;x<SCREEN_SIZE;x++)
			SetPixel(hdc,x,y,0);

	for(i=0;i<numchars;i++)
	{
		xoff=10;
		yoff=10;

		SelectObject(hdc,font->Font_);
		SetBkMode(hdc,TRANSPARENT);
		SetTextColor(hdc,0xffffff);

		buffer[0]=static_cast<char>(firstchar + i);

		if(!TextOut(hdc,xoff,yoff,buffer,1))
			MonoPrint("Failed to display character (%1d)\n",buffer[0]);

		xoff+=MyChars[i].lead;
		charw=MyChars[i].w;
		charh=font->Metrics_.tmHeight;

		// Copy pixels that have been set
		// Use GetPixel(x,y) instead
		for(y=0;y<charh;y++)
			for(x=0;x<charw;x++)
				if(GetPixel(hdc,xoff+x,yoff+y))
				{
					CharPtr[y * bytesperline + x/8]|=1 << (x % 8);
					SetPixel(hdc,xoff+x,yoff+y,0);
				}

		CharPtr+=bytesperline * font->Metrics_.tmHeight;
	}
	ReleaseDC(mywin,hdc);

	return(newfont);
}

void ChoosePairCB(long,short hittype,C_Base *control)
{
	if(hittype != C_TYPE_LMOUSEUP)
		return;

	control->Refresh();
}

void PrintPairs(C_Window *win,long FontID)
{
	C_Button *btn;
	_TCHAR buffer[10];
	long i,j,numchars,startchar;
	C_Fontmgr *curfont;
	long charw,btnid;
	long x,y,numperline;

	curfont=gFontList->Find(FontID);
	if(!curfont)
		return;

	startchar=curfont->First();
	numchars=curfont->Last() - startchar;
	charw=curfont->Width("M");
	numperline=(win->ClientArea_[2].right - win->ClientArea_[2].left) / (charw*4);

	x=5;
	y=5;

	btnid=KERN_CHAR_BASE+startchar;

	for(i=0;i<numchars;i++)
		win->RemoveControl(btnid+i);

	j=0;
	for(i=0;i<numchars;i++)
	{
		buffer[0]=static_cast<char>(CurrentChar);
		buffer[1]=static_cast<char>(startchar+i);
		buffer[2]=0;

		btn=new C_Button;
		btn->Setup(btnid+i,C_TYPE_RADIO,x,y);
		btn->SetGroup(-100);
		btn->SetFont(FontID);
		btn->SetText(C_STATE_0,gStringMgr->GetText(gStringMgr->AddText(buffer)));
		btn->SetText(C_STATE_1,gStringMgr->GetText(gStringMgr->AddText(buffer)));
		btn->SetColor(C_STATE_0,0xcccccc);
		btn->SetColor(C_STATE_1,0x00ff00);
		btn->SetClient(2);
		btn->SetCallback(ChoosePairCB);
		btn->SetUserNumber(_UI95_DELGROUP_SLOT_,_UI95_DELGROUP_ID_);

		win->AddControl(btn);

		x+=charw*4;
		j++;
		if(j >= numperline)
		{
			x=5;
			y+=curfont->Height()+5;
			j=0;
		}
	}
}

void IncreaseLead(long,short hittype,C_Base *control)
{
	C_Fontmgr *cur;
	CharStr *chr;
	C_Text *txt;
	char buffer[10];

	if(hittype != C_TYPE_LMOUSEUP)
		return;

	cur=gFontList->Find(CurrentFontID);
	if(cur)
	{
		if(CurrentChar >= cur->First() && CurrentChar <= cur->Last())
		{
			txt=(C_Text*)control->Parent_->FindControl(REFUEL_1);
			if(txt)
			{
				chr=cur->GetChar(static_cast<char>(CurrentChar));
				chr->lead++;
				sprintf(buffer,"%1d",chr->lead);
				txt->SetText(buffer);
				txt->Refresh();
			}
			control->Parent_->update_ |= C_DRAW_REFRESHALL;
			control->Parent_->RefreshWindow();
		}
	}
}

void DecreaseLead(long ,short hittype,C_Base *control)
{
	C_Fontmgr *cur;
	CharStr *chr;
	C_Text *txt;
	char buffer[10];

	if(hittype != C_TYPE_LMOUSEUP)
		return;

	cur=gFontList->Find(CurrentFontID);
	if(cur)
	{
		if(CurrentChar >= cur->First() && CurrentChar <= cur->Last())
		{
			txt=(C_Text*)control->Parent_->FindControl(REFUEL_1);
			if(txt)
			{
				chr=cur->GetChar(static_cast<short>(CurrentChar));
				chr->lead--;
				sprintf(buffer,"%1d",chr->lead);
				txt->SetText(buffer);
				txt->Refresh();
			}
			control->Parent_->update_ |= C_DRAW_REFRESHALL;
			control->Parent_->RefreshWindow();
		}
	}
}

void IncreaseTrail(long,short hittype,C_Base *control)
{
	C_Fontmgr *cur;
	CharStr *chr;
	C_Text *txt;
	char buffer[10];

	if(hittype != C_TYPE_LMOUSEUP)
		return;

	cur=gFontList->Find(CurrentFontID);
	if(cur)
	{
		if(CurrentChar >= cur->First() && CurrentChar <= cur->Last())
		{
			txt=(C_Text*)control->Parent_->FindControl(REFUEL_3);
			if(txt)
			{
				chr=cur->GetChar(static_cast<short>(CurrentChar));
				chr->trail++;
				sprintf(buffer,"%1d",chr->trail);
				txt->SetText(buffer);
				txt->Refresh();
			}
			control->Parent_->update_ |= C_DRAW_REFRESHALL;
			control->Parent_->RefreshWindow();
		}
	}
}

void DecreaseTrail(long,short hittype,C_Base *control)
{
	C_Fontmgr *cur;
	CharStr *chr;
	C_Text *txt;
	char buffer[10];

	if(hittype != C_TYPE_LMOUSEUP)
		return;

	cur=gFontList->Find(CurrentFontID);
	if(cur)
	{
		if(CurrentChar >= cur->First() && CurrentChar <= cur->Last())
		{
			txt=(C_Text*)control->Parent_->FindControl(REFUEL_3);
			if(txt)
			{
				chr=cur->GetChar(static_cast<short>(CurrentChar));
				chr->trail--;
				sprintf(buffer,"%1d",chr->trail);
				txt->SetText(buffer);
				txt->Refresh();
			}
			control->Parent_->update_ |= C_DRAW_REFRESHALL;
			control->Parent_->RefreshWindow();
		}
	}
}

void IncreaseWidth(long,short hittype,C_Base *control)
{
	C_Fontmgr *cur;
	CharStr *chr;
	C_Text *txt;
	char buffer[10];

	if(hittype != C_TYPE_LMOUSEUP)
		return;

	cur=gFontList->Find(CurrentFontID);
	if(cur)
	{
		if(CurrentChar >= cur->First() && CurrentChar <= cur->Last())
		{
			txt=(C_Text*)control->Parent_->FindControl(REFUEL_2);
			if(txt)
			{
				chr=cur->GetChar(static_cast<short>(CurrentChar));
				chr->w++;
				sprintf(buffer,"%1d",chr->w);
				txt->SetText(buffer);
				txt->Refresh();
			}
			control->Parent_->update_ |= C_DRAW_REFRESHALL;
			control->Parent_->RefreshWindow();
		}
	}
}

void DecreaseWidth(long,short hittype,C_Base *control)
{
	C_Fontmgr *cur;
	CharStr *chr;
	C_Text *txt;
	char buffer[10];

	if(hittype != C_TYPE_LMOUSEUP)
		return;

	cur=gFontList->Find(CurrentFontID);
	if(cur)
	{
		if(CurrentChar >= cur->First() && CurrentChar <= cur->Last())
		{
			txt=(C_Text*)control->Parent_->FindControl(REFUEL_2);
			if(txt)
			{
				chr=cur->GetChar(static_cast<short>(CurrentChar));
				chr->w--;
				sprintf(buffer,"%1d",chr->w);
				txt->SetText(buffer);
				txt->Refresh();
			}
			control->Parent_->update_ |= C_DRAW_REFRESHALL;
			control->Parent_->RefreshWindow();
		}
	}
}

void IncreaseKern(long,short hittype,C_Base *)
{
	if(hittype != C_TYPE_LMOUSEUP)
		return;
}

void DecreaseKern(long, short hittype,C_Base *)
{
	if(hittype != C_TYPE_LMOUSEUP)
		return;
}

void ChooseCharCB(long ID,short hittype,C_Base *control)
{
	C_Fontmgr *fnt;
	CharStr   *chr;
	C_Text *txt;
	char buffer[10];
	if(hittype != C_TYPE_LMOUSEUP)
		return;

	CurrentChar=ID-FONT_CHAR_BASE;
	PrintPairs(control->Parent_,CurrentFontID);
	control->Refresh();
	fnt=gFontList->Find(CurrentFontID);
	if(fnt && CurrentChar  > 0)
	{
		chr=fnt->GetChar(static_cast<short>(CurrentChar));
		if(chr)
		{
			sprintf(buffer,"%1d",chr->lead);
			txt=(C_Text*)control->Parent_->FindControl(REFUEL_1);
			if(txt)
			{
				txt->SetText(buffer);
				txt->Refresh();
			}
			sprintf(buffer,"%1d",chr->w);
			txt=(C_Text*)control->Parent_->FindControl(REFUEL_2);
			if(txt)
			{
				txt->SetText(buffer);
				txt->Refresh();
			}
			sprintf(buffer,"%1d",chr->trail);
			txt=(C_Text*)control->Parent_->FindControl(REFUEL_3);
			if(txt)
			{
				txt->SetText(buffer);
				txt->Refresh();
			}
		}
		else
		{
			txt=(C_Text*)control->Parent_->FindControl(REFUEL_1);
			if(txt)
			{
				txt->SetText(" ");
				txt->Refresh();
			}
			txt=(C_Text*)control->Parent_->FindControl(REFUEL_2);
			if(txt)
			{
				txt->SetText(" ");
				txt->Refresh();
			}
			txt=(C_Text*)control->Parent_->FindControl(REFUEL_3);
			if(txt)
			{
				txt->SetText(" ");
				txt->Refresh();
			}
		}
	}
	else
	{
		txt=(C_Text*)control->Parent_->FindControl(REFUEL_1);
		if(txt)
		{
			txt->SetText(" ");
			txt->Refresh();
		}
		txt=(C_Text*)control->Parent_->FindControl(REFUEL_2);
		if(txt)
		if(txt)
		{
			txt->SetText(" ");
			txt->Refresh();
		}
		txt=(C_Text*)control->Parent_->FindControl(REFUEL_3);
		if(txt)
		if(txt)
		{
			txt->SetText(" ");
			txt->Refresh();
		}
	}
}

void MakeFontList(long FontID)
{
	C_Window *win;
	C_EditBox *ebox;
	long i,j,x,y;
	long startchar,numchars;
	long charw;
	long btnid;
	C_Fontmgr *curfont;
	_TCHAR buffer[120];
	long numperline;
	C_Button *btn;
	C_Text *txt;
	F4CSECTIONHANDLE *Leave;

	win=gMainHandler->FindWindow(FONT_ED_WIN);
	if(!win || !FontID)
		return;

	curfont=gFontList->Find(FontID);
	if(!curfont)
		return;

	Leave=UI_Enter(win);

	ebox=(C_EditBox*)win->FindControl(FONT_NAME_BOX);
	if(ebox)
		ebox->SetFont(FontID);

	DeleteGroupList(FONT_ED_WIN);

	charw=curfont->Width("M");
	numperline=(win->ClientArea_[1].right - win->ClientArea_[1].left) / (charw + 60);
	startchar=curfont->First();
	numchars=curfont->Last() - startchar;

	if(CurrentChar < startchar)
		CurrentChar=startchar;

	if(CurrentChar >= (startchar-numchars))
		CurrentChar=startchar;

	txt=(C_Text*)win->FindControl(FONT_NAME);
	if(txt)
	{
		txt->SetText(curfont->GetName());
		txt->Refresh();
	}

	_stprintf(buffer,"%1ld",curfont->Height());
	txt=(C_Text*)win->FindControl(PITCH_SIZE);
	if(txt)
	{
		txt->SetText(buffer);
		txt->Refresh();
	}

	x=5;
	y=5;

	btnid=FONT_CHAR_BASE+startchar;

	j=0;
	for(i=0;i<numchars;i++)
	{
		buffer[0]=static_cast<char>(startchar+i);
		buffer[1]=0;

		btn=new C_Button;
		btn->Setup(btnid+i,C_TYPE_RADIO,x,y);
		btn->SetGroup(-100);
		btn->SetFont(FontID);
		btn->SetText(C_STATE_0,gStringMgr->GetText(gStringMgr->AddText(buffer)));
		btn->SetText(C_STATE_1,gStringMgr->GetText(gStringMgr->AddText(buffer)));
		sprintf(buffer,"[%1ld]",startchar+i);
		btn->SetAllLabel(gStringMgr->GetText(gStringMgr->AddText(buffer)));
		btn->SetLabelOffset(C_STATE_0,charw+5,0);
		btn->SetLabelOffset(C_STATE_1,charw+5,0);
		btn->SetColor(C_STATE_0,0xcccccc);
		btn->SetColor(C_STATE_1,0x00ff00);
		btn->SetClient(1);
		btn->SetCallback(ChooseCharCB);
		btn->SetUserNumber(_UI95_DELGROUP_SLOT_,_UI95_DELGROUP_ID_);

		win->AddControl(btn);

		x+=charw + charw*6;
		if(x >= win->ClientArea_[1].right-charw*4)
		{
			x=5;
			y+=curfont->Height()+5;
		}
	}

	PrintPairs(win,FontID);

	UI_Leave(Leave);
	win->ScanClientAreas();
	win->update_ |= C_DRAW_REFRESHALL;
	win->RefreshWindow();
}

void CreateTheFontCB(long,short hittype,C_Base *)
{
	if(hittype != C_TYPE_LMOUSEUP)
		return;

	if(CreatedFont)
	{
		if(CreatedFont->GetID() == 100)
			gFontList->GetHash()->Remove(100);
		CreatedFont=NULL;
	}
	GetWindowLOGFONT(&CreatedLogFont);
	CreatedFont=FontToBFT(100,&CreatedLogFont);
	if(CreatedFont)
	{
		gFontList->GetHash()->Add(100,CreatedFont);
		ChooseFontCB(100,C_TYPE_SELECT,NULL);
	}
}

void CreateFontCB(long,short hittype,C_Base *)
{
	if(hittype != C_TYPE_LMOUSEUP)
		return;

	gMainHandler->EnableWindowGroup(-200);
}

void SaveFontCB(long,short hittype,C_Base *control)
{
	if(hittype != C_TYPE_LMOUSEUP)
		return;

	C_Window *win;
	C_EditBox *ebox;
	if(hittype != C_TYPE_LMOUSEUP)
		return;

	win=control->Parent_;
	if(win)
	{
		ebox=(C_EditBox*)win->FindControl(FONT_NAME_BOX);
		if(ebox)
		{
			if(CreatedFont)
				CreatedFont->Save(ebox->GetText());
		}
	}
}

void ChooseFontCB(long ID,short hittype, C_Base *control)
{
	C_ListBox *lbox;
	if(hittype != C_TYPE_SELECT)
		return;

	if(control)
	{
		lbox=(C_ListBox*)control;
		CurrentFontID=lbox->GetTextID();
	}
	else
		CurrentFontID=ID;
	MakeFontList(CurrentFontID);
}

void ChooseAvailableFontCB(long,short hittype, C_Base *control)
{
	int idx;

	if(hittype != C_TYPE_SELECT)
		return;

	idx=((C_ListBox*)control)->GetTextID();
	memcpy(&CreatedLogFont,&fontlog[idx],sizeof(LOGFONT));
	SetWindowLOGFONT(&CreatedLogFont);
}

void InitFontTool()
{
	C_Window *win;
	C_ListBox *lbox;
	HDC hdc;
	int i;
	WNDCLASSEX myclass;
	static char FontWinName[]="Font Window";

	myclass.cbSize=sizeof(myclass);
	myclass.style=CS_HREDRAW|CS_VREDRAW;
	myclass.lpfnWndProc=NULL;
	myclass.cbClsExtra=0;
	myclass.cbWndExtra=0;
	myclass.hInstance=hInst;
	myclass.hIcon=LoadIcon(NULL,IDI_APPLICATION);
	myclass.hCursor=LoadCursor(NULL,IDC_ARROW);
	myclass.hbrBackground=(HBRUSH)GetStockObject(BLACK_BRUSH);
	myclass.lpszMenuName=NULL;
	myclass.hIconSm=LoadIcon(NULL,IDI_APPLICATION);

	RegisterClassEx(&myclass);
	mywin=CreateWindow(FontWinName,"Font Window",
		WS_OVERLAPPEDWINDOW,
		300,
		300,
		SCREEN_SIZE,
		SCREEN_SIZE,
		NULL,
		NULL,
		hInst,
		NULL);

	ShowWindow(mywin,0);
	UpdateWindow(mywin);

	win=gMainHandler->FindWindow(LOGFONT_WIN);
	if(win)
	{
		ItemID=1;
		hdc=GetDC(mywin);
		GetAllFonts(hdc,NULL);
		ReleaseDC(mywin,hdc);

		lbox=(C_ListBox *)win->FindControl(LB_ENUM_FONTS);
		if(lbox)
		{
			lbox->RemoveAllItems();
			lbox->SetCallback(ChooseAvailableFontCB);
			for(i=1;i<ItemID;i++)
				lbox->AddItem(i,C_TYPE_ITEM,FontList[i]);
		}
	}
	ChooseFontCB(1,C_TYPE_SELECT,NULL);
}


text:
package command

import (
	"testing"

	"github.com/stretchr/testify/assert"

	"github.com/quilt/quilt/api/client"
	"github.com/quilt/quilt/api/client/mocks"
	"github.com/quilt/quilt/connection"
)

func TestSetupClient(t *testing.T) {
	t.Parallel()

	// Test that we obtain a client, and properly save it.
	expClient := &mocks.Client{}
	newClient := func(host string, _ connection.Credentials) (client.Client, error) {
		assert.Equal(t, "host", host)
		return expClient, nil
	}
	cmd := connectionHelper{
		connectionFlags: connectionFlags{
			host: "host",
		},
	}
	err := cmd.setupClient(newClient)
	assert.NoError(t, err)
	assert.Equal(t, expClient, cmd.client)

	// Test that errors obtaining a client are properly propagated.
	newClient = func(host string, _ connection.Credentials) (client.Client, error) {
		assert.Equal(t, "host", host)
		return nil, assert.AnError
	}
	cmd = connectionHelper{
		connectionFlags: connectionFlags{
			host: "host",
		},
	}
	err = cmd.setupClient(newClient)
	assert.NotNil(t, err)
}


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

<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>RakNet: DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction > Class Template Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>

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

RakNet
    4.0

Main Page

Related Pages

Modules

Namespaces

Classes

Files

Class List

Class Index

Class Hierarchy

Class Members

DataStructures

Hash

Public Member Functions |
List of all members

DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction > Class Template Reference

Using a string as a identifier for a node, store an allocated pointer to that node.
 More...

#include <DS_Hash.h>

Public Member Functions

 	Hash ()

 	Default constructor.

void 	Clear (const char *file, unsigned int line)

 	Clear the list.

Detailed Description

template<class key_type, class data_type, unsigned int HASH_SIZE, unsigned long(*)(const key_type &) hashFunction>

class DataStructures::Hash< key_type, data_type, HASH_SIZE, hashFunction >

Using a string as a identifier for a node, store an allocated pointer to that node.

The documentation for this class was generated from the following file:

D:/temp/RakNet_PC/Source/DS_Hash.h

<address class="footer">
Generated on Mon Jun 2 2014 20:10:28 for RakNet by

 1.8.2
</address>


text:
echo Taking a snapshot of all key spaces
nodetool -h localhost -p 7199 snapshot


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
null

#### Original name
Botrytis elegans Corda

### Remarks
null


text:
package org.motechproject.metrics.web;

import com.codahale.metrics.Counting;
import com.codahale.metrics.Metered;
import com.codahale.metrics.Metric;
import com.codahale.metrics.MetricFilter;
import com.codahale.metrics.MetricRegistry;
import org.motechproject.metrics.exception.MetricNotFoundException;
import org.motechproject.metrics.web.dto.MetricDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.function.Supplier;

/**
 * Helper component that maps a metric, as described by settings collected from the user interface,
 * to a function accepted by {@link org.motechproject.metrics.service.MetricRegistryService#registerRatioGauge(String, Supplier, Supplier)}
 */
@Component
public class MetricDtoToSupplierConverter {
    private final MetricRegistry metricRegistry;

    @Autowired
    public MetricDtoToSupplierConverter(MetricRegistry metricRegistry) {
        this.metricRegistry = metricRegistry;
    }

    /**
     * Returns the appropriate function depending on configuration sent from the user interface.
     *
     * @param dto an object describing the type of function to create
     * @return a function that yields a number
     */
    public Supplier<Number> convert(MetricDto dto) {
        Metric metric = getMetric(dto);
        Supplier<Number> ret = null;

        switch (dto.getValue()) {
            case COUNT:
                ret = new Supplier<Number>() {
                    @Override
                    public Long get() {
                        return ((Counting) metric).getCount();
                    }
                };
                break;
            case MEAN:
                ret = new Supplier<Number>() {
                    @Override
                    public Double get() {
                        return ((Metered) metric).getMeanRate();
                    }
                };
                break;
            case ONE_MINUTE:
                ret = new Supplier<Number>() {
                    @Override
                    public Double get() {
                        return ((Metered) metric).getOneMinuteRate();
                    }
                };
                break;
            case FIVE_MINUTE:
                ret = new Supplier<Number>() {
                    @Override
                    public Double get() {
                        return ((Metered) metric).getFiveMinuteRate();
                    }
                };
                break;
            case FIFTEEN_MINUTE:
                ret = new Supplier<Number>() {
                    @Override
                    public Double get() {
                        return ((Metered) metric).getFifteenMinuteRate();
                    }
                };
                break;
        }

        return ret;
    }

    /**
     * Queries the metric registry for the metric matching the type and name of the data transfer object. If a metric
     * is not found, throws a {@link MetricNotFoundException}
     *
     * @param dto an object describing the type of metric to retrieve
     * @return a metric from the registry
     */
    private Metric getMetric(MetricDto dto) {
        Metric ret = null;

        switch (dto.getType()) {
            case COUNTER:
                ret = metricRegistry.getCounters(new MetricFilter() {
                    @Override
                    public boolean matches(String name, Metric metric) {
                        return name.equals(dto.getName());
                    }
                }).get(dto.getName());
                break;
            case GAUGE:
                ret = metricRegistry.getGauges(new MetricFilter() {
                    @Override
                    public boolean matches(String name, Metric metric) {
                        return name.equals(dto.getName());
                    }
                }).get(dto.getName());
            case HISTOGRAM:
                ret = metricRegistry.getHistograms(new MetricFilter() {
                    @Override
                    public boolean matches(String name, Metric metric) {
                        return name.equals(dto.getName());
                    }
                }).get(dto.getName());
                break;
            case METER:
                ret = metricRegistry.getMeters(new MetricFilter() {
                    @Override
                    public boolean matches(String name, Metric metric) {
                        return name.equals(dto.getName());
                    }
                }).get(dto.getName());
                break;
            case TIMER:
                ret = metricRegistry.getTimers(new MetricFilter() {
                    @Override
                    public boolean matches(String name, Metric metric) {
                        return name.equals(dto.getName());
                    }
                }).get(dto.getName());
                break;
        }

        if (ret == null) {
            String msg = String.format("Unable to find metric of type %s with name: %s", dto.getType(), dto.getName());
            throw new MetricNotFoundException(msg);
        }

        return ret;
    }
}


text:
namespace P00.Exampe01
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;

    public class StartUp
    {
        public static void Main(string[] args)
        {
            List<string> names = new List<string>();

            names.Add("Sofia");
            names.Add("Parish");

            for (int i = 0; i < names.Count; i++)
            {
                string name = names[i];
                Console.WriteLine(name);
            }

            Console.WriteLine("---");
            names.Insert(1, "Berling");
            names.IndexOf("Berling");

            Console.WriteLine(names.IndexOf("Berling"));

            names.RemoveAt(0);

            foreach (string name in names)
            {
                Console.WriteLine(names[0]);
            }
        }
    }
}


text:
package br.edu.ifmt.cba.java;
import java.util.Date;

import javax.swing.JOptionPane;

public class Main {

	public static void main(String[] args) {
		Cliente c=null;
		try {
			c = new Cliente(null, null);
		} catch (PessoaFisicaException e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
		}
		try {
			c.setNome("asd");
			c.setCpf("");

		}catch (PessoaFisicaException e) {
			e.printStackTrace();
			JOptionPane.showMessageDialog(null, e.getMessage());
		}catch (PessoaException e) {
			e.printStackTrace();
			JOptionPane.showMessageDialog(null, e.getMessage());
		} catch(Exception e){
			//Faço outra coisa se for uma exceção não planejada
			e.printStackTrace();
		}
		catch(Throwable e){
			//Faço outra coisa se for um erro
			e.printStackTrace();
		} finally {
			c.setDataNascimento(new Date());
		}
		System.out.println(c);
	}

}


text:
package com.javadeobfuscator.deobfuscator.analyzer.frame;

import java.util.Arrays;
import java.util.List;

public class DupFrame extends Frame {
    private List<Frame> targets;

    public DupFrame(int opcode, Frame... targets) {
        super(opcode);
        this.targets = Arrays.asList(targets);
        for (Frame target : this.targets) {
            target.getChildren().add(this);
        }
        this.parents.addAll(this.targets);
    }

    public List<Frame> getTargets() {
        return targets;
    }
}


text:
package net.authorize.sampleapplication.models;

import android.os.Parcel;
import android.os.Parcelable;

/**
 * Parcelable object that stores credit card information that was manually entered.
 */
public class CreditCardObject implements Parcelable {
    private String cardNumber;
    private String securityCode;
    private String expMonth;
    private String expYear;

    public CreditCardObject(String cardNumber, String securityCode, String expMonth, String expYear) {
        this.cardNumber = cardNumber;
        this.securityCode = securityCode;
        this.expMonth = expMonth;
        this.expYear = expYear;
    }

    public CreditCardObject(Parcel pc){
        cardNumber = pc.readString();
        securityCode = pc.readString();
        expMonth = pc.readString();
        expYear = pc.readString();
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(cardNumber);
        dest.writeString(securityCode);
        dest.writeString(expMonth);
        dest.writeString(expYear);
    }

    public static final Parcelable.Creator<CreditCardObject> CREATOR
            = new Parcelable.Creator<CreditCardObject>() {

        @Override
        public CreditCardObject createFromParcel(Parcel in) {
            return new CreditCardObject(in);
        }

        @Override
        public CreditCardObject[] newArray(int size) {
            return new CreditCardObject[size];
        }
    };

    public String getExpYear() {
        return expYear;
    }

    public String getExpMonth() {
        return expMonth;
    }

    public String getCardNumber() {
        return cardNumber;
    }

    public String getSecurityCode() {
        return securityCode;
    }

    @Override
    public int describeContents() {
        return 0;
    }
}


text:
'use strict';

const path = require('path');
const markdownMagic = require('markdown-magic');

const config = {
	transforms: {
		PKGJSON: require('.')
	}
};

markdownMagic(path.join(__dirname, 'README.md'), config);


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="#ddd"
    android:gravity="center">

    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_horizontal"
        android:src="@anim/listview_pull_refresh_loading" />
</LinearLayout>


text:
package com.sun.security.sasl.gsskerb;

import javax.security.sasl.*;
import java.io.*;
import java.util.Map;
import java.util.logging.Level;

// JAAS
import javax.security.auth.callback.*;

// JGSS
import org.ietf.jgss.*;

/**
  * Implements the GSSAPI SASL server mechanism for Kerberos V5.
  * (RFC 2222,
  * draft-ietf-cat-sasl-gssapi-00.txt).
  *
  * Expects thread's Subject to contain server's Kerberos credentials
  * - If not, underlying KRB5 mech will attempt to acquire Kerberos creds
  *   by logging into Kerberos (via default TextCallbackHandler).
  * - These creds will be used for exchange with client.
  *
  * Required callbacks:
  * - AuthorizeCallback
  *      handler must verify that authid/authzids are allowed and set
  *      authorized ID to be the canonicalized authzid (if applicable).
  *
  * Environment properties that affect behavior of implementation:
  *
  * javax.security.sasl.qop
  * - quality of protection; list of auth, auth-int, auth-conf; default is "auth"
  * javax.security.sasl.maxbuf
  * - max receive buffer size; default is 65536
  * javax.security.sasl.sendmaxbuffer
  * - max send buffer size; default is 65536; (min with client max recv size)
  *
  * @author Rosanna Lee
  */
final class GssKrb5Server extends GssKrb5Base implements SaslServer {
    private static final String MY_CLASS_NAME = GssKrb5Server.class.getName();

    private int handshakeStage = 0;
    private String peer;
    private String me;
    private String authzid;
    private CallbackHandler cbh;

    // When serverName is null, the server will be unbound. We need to save and
    // check the protocol name after the context is established. This value
    // will be null if serverName is not null.
    private final String protocolSaved;
    /**
     * Creates a SASL mechanism with server credentials that it needs
     * to participate in GSS-API/Kerberos v5 authentication exchange
     * with the client.
     */
    GssKrb5Server(String protocol, String serverName,
        Map<String, ?> props, CallbackHandler cbh) throws SaslException {

        super(props, MY_CLASS_NAME);

        this.cbh = cbh;

        String service;
        if (serverName == null) {
            protocolSaved = protocol;
            service = null;
        } else {
            protocolSaved = null;
            service = protocol + "@" + serverName;
        }

        logger.log(Level.FINE, "KRB5SRV01:Using service name: {0}", service);

        try {
            GSSManager mgr = GSSManager.getInstance();

            // Create the name for the requested service entity for Krb5 mech
            GSSName serviceName = service == null ? null:
                    mgr.createName(service, GSSName.NT_HOSTBASED_SERVICE, KRB5_OID);

            GSSCredential cred = mgr.createCredential(serviceName,
                GSSCredential.INDEFINITE_LIFETIME,
                KRB5_OID, GSSCredential.ACCEPT_ONLY);

            // Create a context using the server's credentials
            secCtx = mgr.createContext(cred);

            if ((allQop&INTEGRITY_ONLY_PROTECTION) != 0) {
                // Might need integrity
                secCtx.requestInteg(true);
            }

            if ((allQop&PRIVACY_PROTECTION) != 0) {
                // Might need privacy
                secCtx.requestConf(true);
            }
        } catch (GSSException e) {
            throw new SaslException("Failure to initialize security context", e);
        }
        logger.log(Level.FINE, "KRB5SRV02:Initialization complete");
    }

    /**
     * Processes the response data.
     *
     * The client sends response data to which the server must
     * process using GSS_accept_sec_context.
     * As per RFC 2222, the GSS authenication completes (GSS_S_COMPLETE)
     * we do an extra hand shake to determine the negotiated security protection
     * and buffer sizes.
     *
     * @param responseData A non-null but possible empty byte array containing the
     * response data from the client.
     * @return A non-null byte array containing the challenge to be
     * sent to the client, or null when no more data is to be sent.
     */
    public byte[] evaluateResponse(byte[] responseData) throws SaslException {
        if (completed) {
            throw new SaslException(
                "SASL authentication already complete");
        }

        if (logger.isLoggable(Level.FINER)) {
            traceOutput(MY_CLASS_NAME, "evaluateResponse",
                "KRB5SRV03:Response [raw]:", responseData);
        }

        switch (handshakeStage) {
        case 1:
            return doHandshake1(responseData);

        case 2:
            return doHandshake2(responseData);

        default:
            // Security context not established yet; continue with accept

            try {
                byte[] gssOutToken = secCtx.acceptSecContext(responseData,
                    0, responseData.length);

                if (logger.isLoggable(Level.FINER)) {
                    traceOutput(MY_CLASS_NAME, "evaluateResponse",
                        "KRB5SRV04:Challenge: [after acceptSecCtx]", gssOutToken);
                }

                if (secCtx.isEstablished()) {
                    handshakeStage = 1;

                    peer = secCtx.getSrcName().toString();
                    me = secCtx.getTargName().toString();

                    logger.log(Level.FINE,
                            "KRB5SRV05:Peer name is : {0}, my name is : {1}",
                            new Object[]{peer, me});

                    // me might take the form of proto@host or proto/host
                    if (protocolSaved != null &&
                            !protocolSaved.equalsIgnoreCase(me.split("[/@]")[0])) {
                        throw new SaslException(
                                "GSS context targ name protocol error: " + me);
                    }

                    if (gssOutToken == null) {
                        return doHandshake1(EMPTY);
                    }
                }

                return gssOutToken;
            } catch (GSSException e) {
                throw new SaslException("GSS initiate failed", e);
            }
        }
    }

    private byte[] doHandshake1(byte[] responseData) throws SaslException {
        try {
            // Security context already established. responseData
            // should contain no data
            if (responseData != null && responseData.length > 0) {
                throw new SaslException(
                    "Handshake expecting no response data from server");
            }

            // Construct 4 octets of data:
            // First octet contains bitmask specifying protections supported
            // 2nd-4th octets contains max receive buffer of server

            byte[] gssInToken = new byte[4];
            gssInToken[0] = allQop;
            intToNetworkByteOrder(recvMaxBufSize, gssInToken, 1, 3);

            if (logger.isLoggable(Level.FINE)) {
                logger.log(Level.FINE,
                    "KRB5SRV06:Supported protections: {0}; recv max buf size: {1}",
                    new Object[]{new Byte(allQop),
                                 new Integer(recvMaxBufSize)});
            }

            handshakeStage = 2;  // progress to next stage

            if (logger.isLoggable(Level.FINER)) {
                traceOutput(MY_CLASS_NAME, "doHandshake1",
                    "KRB5SRV07:Challenge [raw]", gssInToken);
            }

            byte[] gssOutToken = secCtx.wrap(gssInToken, 0, gssInToken.length,
                new MessageProp(0 /* gop */, false /* privacy */));

            if (logger.isLoggable(Level.FINER)) {
                traceOutput(MY_CLASS_NAME, "doHandshake1",
                    "KRB5SRV08:Challenge [after wrap]", gssOutToken);
            }
            return gssOutToken;

        } catch (GSSException e) {
            throw new SaslException("Problem wrapping handshake1", e);
        }
    }

    private byte[] doHandshake2(byte[] responseData) throws SaslException {
        try {
            // Expecting 4 octets from client selected protection
            // and client's receive buffer size
            byte[] gssOutToken = secCtx.unwrap(responseData, 0,
                responseData.length, new MessageProp(0, false));

            if (logger.isLoggable(Level.FINER)) {
                traceOutput(MY_CLASS_NAME, "doHandshake2",
                    "KRB5SRV09:Response [after unwrap]", gssOutToken);
            }

            // First octet is a bit-mask specifying the selected protection
            byte selectedQop = gssOutToken[0];
            if ((selectedQop&allQop) == 0) {
                throw new SaslException("Client selected unsupported protection: "
                    + selectedQop);
            }
            if ((selectedQop&PRIVACY_PROTECTION) != 0) {
                privacy = true;
                integrity = true;
            } else if ((selectedQop&INTEGRITY_ONLY_PROTECTION) != 0) {
                integrity = true;
            }

            // 2nd-4th octets specifies maximum buffer size expected by
            // client (in network byte order). This is the server's send
            // buffer maximum.
            int clntMaxBufSize = networkByteOrderToInt(gssOutToken, 1, 3);

            // Determine the max send buffer size based on what the
            // client is able to receive and our specified max
            sendMaxBufSize = (sendMaxBufSize == 0) ? clntMaxBufSize :
                Math.min(sendMaxBufSize, clntMaxBufSize);

            // Update context to limit size of returned buffer
            rawSendSize = secCtx.getWrapSizeLimit(JGSS_QOP, privacy,
                sendMaxBufSize);

            if (logger.isLoggable(Level.FINE)) {
                logger.log(Level.FINE,
            "KRB5SRV10:Selected protection: {0}; privacy: {1}; integrity: {2}",
                    new Object[]{new Byte(selectedQop),
                                 Boolean.valueOf(privacy),
                                 Boolean.valueOf(integrity)});
                logger.log(Level.FINE,
"KRB5SRV11:Client max recv size: {0}; server max send size: {1}; rawSendSize: {2}",
                    new Object[] {new Integer(clntMaxBufSize),
                                  new Integer(sendMaxBufSize),
                                  new Integer(rawSendSize)});
            }

            // Get authorization identity, if any
            if (gssOutToken.length > 4) {
                try {
                    authzid = new String(gssOutToken, 4,
                        gssOutToken.length - 4, "UTF-8");
                } catch (UnsupportedEncodingException uee) {
                    throw new SaslException ("Cannot decode authzid", uee);
                }
            } else {
                authzid = peer;
            }
            logger.log(Level.FINE, "KRB5SRV12:Authzid: {0}", authzid);

            AuthorizeCallback acb = new AuthorizeCallback(peer, authzid);

            // In Kerberos, realm is embedded in peer name
            cbh.handle(new Callback[] {acb});
            if (acb.isAuthorized()) {
                authzid = acb.getAuthorizedID();
                completed = true;
            } else {
                // Authorization failed
                throw new SaslException(peer +
                    " is not authorized to connect as " + authzid);
            }

            return null;
        } catch (GSSException e) {
            throw new SaslException("Final handshake step failed", e);
        } catch (IOException e) {
            throw new SaslException("Problem with callback handler", e);
        } catch (UnsupportedCallbackException e) {
            throw new SaslException("Problem with callback handler", e);
        }
    }

    public String getAuthorizationID() {
        if (completed) {
            return authzid;
        } else {
            throw new IllegalStateException("Authentication incomplete");
        }
    }

    public Object getNegotiatedProperty(String propName) {
        if (!completed) {
            throw new IllegalStateException("Authentication incomplete");
        }

        Object result;
        switch (propName) {
            case Sasl.BOUND_SERVER_NAME:
                try {
                    // me might take the form of proto@host or proto/host
                    result = me.split("[/@]")[1];
                } catch (Exception e) {
                    result = null;
                }
                break;
            default:
                result = super.getNegotiatedProperty(propName);
        }
        return result;
    }
}


text:
package kmodes;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import java.util.ArrayList;

import org.apache.hadoop.io.Writable;

public class ClusterArrayList extends ArrayList<Cluster> implements Writable {

	private static final long serialVersionUID = 1976555646037505629L;

	//dissimilarity
	public int d= 0;

	@Override
	public void readFields(DataInput in) throws IOException {
		int size = in.readInt();
		for (int i = 0; i < size; i++) {
			Cluster c  = new Cluster();
			c.readFields(in);
			this.add(c);
		}
	}

	@Override
	public void write(DataOutput out) throws IOException {
		out.writeInt(super.size());
		for (int i = 0; i < super.size(); i++) {
			this.get(i).write(out);
		}
	}

	public void merge(ClusterArrayList clusters){
		if(this.size()==0)
			this.addAll(clusters);
		else{
			for(int i = 0;i<this.size();i++){
				this.get(i).merge(clusters.get(i));
			}
		}

	}

	public int renew(){
		for(int i = 0;i<this.size();i++){
			this.d+=this.get(i).renew();
		}
		return this.d;
	}

}


text:
<?xml version="1.0" encoding="UTF-8"?>
<!--
  Copyright 2016 SteelBridge Laboratories, LLC.

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.

  For more information: http://steelbridgelabs.com
-->
<FindBugsFilter
    xmlns="https://github.com/spotbugs/filter/3.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="https://github.com/spotbugs/filter/3.0.0 https://raw.githubusercontent.com/spotbugs/spotbugs/3.1.0/spotbugs/etc/findbugsfilter.xsd">

    <Match>
        <Bug pattern="RCN_REDUNDANT_NULLCHECK_WOULD_HAVE_BEEN_A_NPE" />
    </Match>
</FindBugsFilter>


text:
Haxe extern for Material UI

- Haxe http://haxe.org/
- React http://facebook.github.io/react/index.html
- Material UI http://material-ui.com/
- hxReact https://github.com/belliture/hxReact


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

namespace Trigrad.Renderers
{
    public class CenterFill : IFill
    {
        public void Fill(SampleTri t, PixelMap map)
        {
            foreach (var drawPoint in t.Points)
            {
                Pixel gradedColor = t.CenterColor;

                map[drawPoint.Point] = gradedColor;
            }
        }
    }
}


text:
<?php

namespace BSP\AdyenBundle\Event;

use Symfony\Component\EventDispatcher\Event;

class ChargeEvent extends Event
{
    protected $transaction;
    protected $account;
    protected $email;
    protected $amount;
    protected $currency;
    protected $success = false;

    public function __construct( $transaction, $account, $email, $amount, $currency, $success )
    {
        $this->transaction = $transaction;
        $this->account = $account;
        $this->email = $email;
        $this->amount = $amount;
        $this->currency = $currency;
        $this->success = (bool) $success;
    }

    public function getTransaction()
    {
        return $this->transaction;
    }

    public function getAccount()
    {
        return $this->account;
    }

    public function getEmail()
    {
        return $this->email;
    }

    public function getAmount()
    {
        return $this->amount;
    }

    public function getCurrency()
    {
        return $this->currency;
    }

    public function isSucces()
    {
        return $this->success;
    }
}


text:
package at.ac.uibk.igwee.metadata.gnd;

import at.ac.uibk.igwee.metadata.query.QueryService;
import at.ac.uibk.igwee.metadata.vocabulary.VocabularyType;

public interface GndQueryService extends QueryService {

	public static final int DEFAULT_MAX_ROWS = 30;
	public static final int DEFAULT_START_ROW = 1;

	public GndQueryResult query(String queryString, VocabularyType type,
			int startRow, int maxRows) throws GndException;

	default public GndQueryResult query(String queryString, VocabularyType type) throws GndException {
		return query(queryString, type, DEFAULT_START_ROW, DEFAULT_MAX_ROWS);
	}

	default public GndQueryResult queryForAll(String queryString) throws GndException {
		return query(queryString, VocabularyType.UNKNOWN);
	}

	default public GndQueryResult queryForPerson(String name) throws GndException {
		return query(name, VocabularyType.PERSONAL_NAME);
	}

	default public GndQueryResult queryForPlace(String loc) throws GndException {
		return query(loc, VocabularyType.PLACE_NAME);
	}

	default public GndQueryResult queryForCorporate(String inst) throws GndException {
		return query(inst, VocabularyType.INSTITUTION_NAME);
	}

}


text:
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');

const pkg = require('../package.json');

module.exports = {
  entry: {
    manager: './src/webview/manager.js'
  },
  output: {
    path: path.join(process.cwd(), pkg.skpm.main, 'Contents'),
    filename: 'Resources/webview/[name].js',
    publicPath: '/'
  },
  resolve: {
    extensions: ['.js', '.vue'],
    alias: {
      'vue$': 'vue/dist/vue.min.js'
    }
  },
  module: {
    rules: [
      {
        test: /\.(vue|js)$/,
        enforce: 'pre',
        include: path.join(process.cwd(), './src/webview'),
        loader: 'eslint-loader',
        options: {
          formatter: require('eslint-friendly-formatter')
        }
      },
      {
        test: /\.js$/,
        include: path.join(process.cwd(), './src/webview'),
        loader: 'babel-loader',
        options: {
          forceEnv: 'webview'
        }
      },
      {
        test: /\.vue$/,
        loader: 'vue-loader',
        options: {
          postcss: [require('autoprefixer')]
        }
      },
      {
        test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
        loader: 'url-loader',
        options: {
          limit: 10000,
          name: 'Resources/[name].[hash:7].[ext]'
        }
      }
    ]
  },
  plugins: [
    new HtmlWebpackPlugin({
      filename: 'Resources/webview/manager.html',
      template: './src/webview/index.html',
      chunks: ['manager']
    })
  ]
};

if (process.env.NODE_ENV === 'production') {
  module.exports.output.filename = 'Resources/webview/[name]_[chunkhash:7].js';
  module.exports.output.publicPath = '../../';
}


text:
import 'vs/css!./countBadge';
import { $, append } from 'vs/base/browser/dom';
import { format } from 'vs/base/common/strings';
import { Color } from 'vs/base/common/color';
import { mixin } from 'vs/base/common/objects';

export interface ICountBadgeOptions extends ICountBadgetyles {
	count?: number;
	countFormat?: string;
	titleFormat?: string;
}

export interface ICountBadgetyles {
	badgeBackground?: Color;
	badgeForeground?: Color;
	badgeBorder?: Color;
}

const defaultOpts = {
	badgeBackground: Color.fromHex('#4D4D4D'),
	badgeForeground: Color.fromHex('#FFFFFF')
};

export class CountBadge {

	private element: HTMLElement;
	private count: number;
	private countFormat: string;
	private titleFormat: string;

	private badgeBackground: Color;
	private badgeForeground: Color;
	private badgeBorder: Color;

	private options: ICountBadgeOptions;

	constructor(container: HTMLElement, options?: ICountBadgeOptions) {
		this.options = options || Object.create(null);
		mixin(this.options, defaultOpts, false);

		this.badgeBackground = this.options.badgeBackground;
		this.badgeForeground = this.options.badgeForeground;
		this.badgeBorder = this.options.badgeBorder;

		this.element = append(container, $('.monaco-count-badge'));
		this.countFormat = this.options.countFormat || '{0}';
		this.titleFormat = this.options.titleFormat || '';
		this.setCount(this.options.count || 0);
	}

	setCount(count: number) {
		this.count = count;
		this.render();
	}

	setCountFormat(countFormat: string) {
		this.countFormat = countFormat;
		this.render();
	}

	setTitleFormat(titleFormat: string) {
		this.titleFormat = titleFormat;
		this.render();
	}

	private render() {
		this.element.textContent = format(this.countFormat, this.count);
		this.element.title = format(this.titleFormat, this.count);

		this.applyStyles();
	}

	style(styles: ICountBadgetyles): void {
		this.badgeBackground = styles.badgeBackground;
		this.badgeForeground = styles.badgeForeground;
		this.badgeBorder = styles.badgeBorder;

		this.applyStyles();
	}

	private applyStyles(): void {
		if (this.element) {
			const background = this.badgeBackground ? this.badgeBackground.toString() : null;
			const foreground = this.badgeForeground ? this.badgeForeground.toString() : null;
			const border = this.badgeBorder ? this.badgeBorder.toString() : null;

			this.element.style.backgroundColor = background;
			this.element.style.color = foreground;

			this.element.style.borderWidth = border ? '1px' : null;
			this.element.style.borderStyle = border ? 'solid' : null;
			this.element.style.borderColor = border;
		}
	}
}


text:
{{template "meta.html" .}}

    {{template "sidebar.html" .}}

{{.Post.Title}}

                    {{.Post.Created.Year}}-{{printf "%0d" .Post.Created.Month}}-{{.Post.Created.Day}}

{{.Post.ContentHTML}}

            {{template "embed/comment.html" .}}

        {{template "footer.html" .}}

{{template "footer_js.html" .}}


text:
require 'pathname'
require 'listen/adapter'
require 'listen/change'
require 'listen/record'
require 'listen/silencer'

module Listen
  class Listener
    attr_accessor :options, :directories, :paused, :changes, :block, :stopping
    attr_accessor :registry, :supervisor

    RELATIVE_PATHS_WITH_MULTIPLE_DIRECTORIES_WARNING_MESSAGE = "The relative_paths option doesn't work when listening to multiple diretories."

    # Initializes the directories listener.
    #
    # @param [String] directory the directories to listen to
    # @param [Hash] options the listen options (see Listen::Listener::Options)
    #
    # @yield [modified, added, removed] the changed files
    # @yieldparam [Array<String>] modified the list of modified files
    # @yieldparam [Array<String>] added the list of added files
    # @yieldparam [Array<String>] removed the list of removed files
    #
    def initialize(*args, &block)
      @options     = _init_options(args.last.is_a?(Hash) ? args.pop : {})
      @directories = args.flatten.map { |path| Pathname.new(path).realpath }
      @changes     = []
      @block       = block
      @registry    = Celluloid::Registry.new
      _init_debug
    end

    # Starts the listener by initializing the adapter and building
    # the directory record concurrently, then it starts the adapter to watch
    # for changes. The current thread is not blocked after starting.
    #
    def start
      _init_actors
      unpause
      @stopping = false
      registry[:adapter].async.start
      Thread.new { _wait_for_changes }
    end

    # Terminates all Listen actors and kill the adapter.
    #
    def stop
      @stopping = true
      supervisor.terminate
    end

    # Pauses listening callback (adapter still running)
    #
    def pause
      @paused = true
    end

    # Unpauses listening callback
    #
    def unpause
      registry[:record].build
      @paused = false
    end

    # Returns true if Listener is paused
    #
    # @return [Boolean]
    #
    def paused?
      @paused == true
    end

    # Returns true if Listener is neither paused nor stopped
    #
    # @return [Boolean]
    #
    def listen?
      @paused == false && @stopping == false
    end

    # Adds ignore patterns to the existing one (See DEFAULT_IGNORED_DIRECTORIES and DEFAULT_IGNORED_EXTENSIONS in Listen::Silencer)
    #
    # @param [Regexp, Array<Regexp>] new ignoring patterns.
    #
    def ignore(regexps)
      @options[:ignore] = [options[:ignore], regexps]
      registry[:silencer] = Silencer.new(self)
    end

    # Overwrites ignore patterns (See DEFAULT_IGNORED_DIRECTORIES and DEFAULT_IGNORED_EXTENSIONS in Listen::Silencer)
    #
    # @param [Regexp, Array<Regexp>] new ignoring patterns.
    #
    def ignore!(regexps)
      @options.delete(:ignore)
      @options[:ignore!] = regexps
      registry[:silencer] = Silencer.new(self)
    end

    # Sets only patterns, to listen only to specific regexps
    #
    # @param [Regexp, Array<Regexp>] new ignoring patterns.
    #
    def only(regexps)
      @options[:only] = regexps
      registry[:silencer] = Silencer.new(self)
    end

    private

    def _init_options(options = {})
      { debug: false,
        latency: nil,
        wait_for_delay: 0.1,
        force_polling: false,
        polling_fallback_message: nil }.merge(options)
    end

    def _init_debug
      if options[:debug]
        Celluloid.logger.level = Logger::INFO
      else
        Celluloid.logger = nil
      end
    end

    def _init_actors
      @supervisor = Celluloid::SupervisionGroup.run!(registry)
      supervisor.add(Silencer, as: :silencer, args: self)
      supervisor.add(Record, as: :record, args: self)
      supervisor.pool(Change, as: :change_pool, args: self)

      adapter_class = Adapter.select(options)
      supervisor.add(adapter_class, as: :adapter, args: self)
    end

    def _wait_for_changes
      loop do
        break if @stopping

        changes = []
        begin
          sleep options[:wait_for_delay] # wait for changes to accumulate
          new_changes = _pop_changes
          changes += new_changes
        end until new_changes.empty?
        unless changes.empty?
          hash = _smoosh_changes(changes)
          block.call(hash[:modified], hash[:added], hash[:removed])
        end
      end
    rescue => ex
      Kernel.warn "[Listen warning]: Change block raised an exception: #{$!}"
      Kernel.warn "Backtrace:\n\t#{ex.backtrace.join("\n\t")}"
    end

    def _pop_changes
      popped = []
      popped << @changes.pop until @changes.empty?
      popped
    end

    def _smoosh_changes(changes)
      smooshed = { modified: [], added: [], removed: [] }
      changes.each { |h| type = h.keys.first; smooshed[type] << h[type].to_s }
      smooshed.each { |_, v| v.uniq! }
      smooshed
    end
  end
end