text:
      kudu::ScopedDisableRedaction s;                \
      return (expr);                                 \
    })()

// Evaluates to 'true' if the caller should redact any user data in the current scope.
// Most callers should instead use KUDU_REDACT(...) defined below, but this can be useful
// to short-circuit expensive logic.
#define KUDU_SHOULD_REDACT() ((kudu::g_should_redact == kudu::RedactContext::ALL ||    \
  kudu::g_should_redact == kudu::RedactContext::LOG) && kudu::tls_redact_user_data)

// Either evaluate and return 'expr', or return the string "<redacted>", depending on whether
// redaction is enabled in the current scope.
#define KUDU_REDACT(expr) \
  (KUDU_SHOULD_REDACT() ? kRedactionMessage : (expr))

// Like the above, but with the additional condition that redaction will only
// be performed if 'cond' must be true.
#define KUDU_MAYBE_REDACT_IF(cond, expr) \
  ((KUDU_SHOULD_REDACT() && (cond)) ? kudu::kRedactionMessage : (expr))

////////////////////////////////////////
// Redaction implementation details follow.
////////////////////////////////////////

namespace kudu {

// Flag which allows redaction to be enabled or disabled for a thread context.
// Defaults to enabling redaction, since it's the safer default with respect to
// leaking user data, and it's easier to identify when data is over-redacted
// than vice-versa.
extern __thread bool tls_redact_user_data;

// Redacted log messages are replaced with this constant.
extern const char* const kRedactionMessage;

enum class RedactContext {
  ALL,
  LOG,
  NONE
};

// Flag to indicate which redaction context is enabled.
extern kudu::RedactContext g_should_redact;

class ScopedDisableRedaction {
 public:
  ScopedDisableRedaction()
      : old_val_(tls_redact_user_data) {
    tls_redact_user_data = false;
  }

  ~ScopedDisableRedaction() {
    tls_redact_user_data = old_val_;
  }

 private:
  bool old_val_;
};

} // namespace kudu

////////////////////////////////////////////////////////////////////////////////
// Throttled logging support
////////////////////////////////////////////////////////////////////////////////

// Logs a message throttled to appear at most once every 'n_secs' seconds to
// the given severity.
//
// The log message may include the special token 'THROTTLE_MSG' which expands
// to either an empty string or ' [suppressed <n> similar messages]'.
//
// Example usage:
//   KLOG_EVERY_N_SECS(WARNING, 1) << "server is low on memory" << THROTTLE_MSG;
//
//
// Advanced per-instance throttling
// -----------------------------------
// For cases where the throttling should be scoped to a given class instance,
// you may define a logging::LogThrottler object and pass it to the
// KLOG_EVERY_N_SECS_THROTTLER(...) macro. In addition, you must pass a "tag".
// Only log messages with equal tags (by pointer equality) will be throttled.
// For example:
//
//    struct MyThing {
//      string name;
//      LogThrottler throttler;
//    };
//
//    if (...) {
//      LOG_EVERY_N_SECS_THROTTLER(INFO, 1, my_thing->throttler, "coffee") <<
//        my_thing->name << " needs coffee!";
//    } else {
//      LOG_EVERY_N_SECS_THROTTLER(INFO, 1, my_thing->throttler, "wine") <<
//        my_thing->name << " needs wine!";
//    }
//
// In this example, the "coffee"-related message will be collapsed into other
// such messages within the prior one second; however, if the state alternates
// between the "coffee" message and the "wine" message, then each such alternation
// will yield a message.

#define KLOG_EVERY_N_SECS_THROTTLER(severity, n_secs, throttler, tag) \
  int VARNAME_LINENUM(num_suppressed) = 0;                            \
  if ((throttler).ShouldLog(n_secs, tag, &VARNAME_LINENUM(num_suppressed)))  \
    google::LogMessage( \
      __FILE__, __LINE__, google::GLOG_ ## severity, VARNAME_LINENUM(num_suppressed), \
      &google::LogMessage::SendToLog).stream()

#define KLOG_EVERY_N_SECS(severity, n_secs) \
  static logging::LogThrottler LOG_THROTTLER;  \
  KLOG_EVERY_N_SECS_THROTTLER(severity, n_secs, LOG_THROTTLER, "no-tag")

namespace kudu {
enum PRIVATE_ThrottleMsg {THROTTLE_MSG};
} // namespace kudu

////////////////////////////////////////////////////////////////////////////////
// Versions of glog macros for "LOG_EVERY" and "LOG_FIRST" that annotate the
// benign races on their internal static variables.
////////////////////////////////////////////////////////////////////////////////

// The "base" macros.
#define KUDU_SOME_KIND_OF_LOG_EVERY_N(severity, n, what_to_do) \
  static int LOG_OCCURRENCES = 0, LOG_OCCURRENCES_MOD_N = 0; \
  ANNOTATE_BENIGN_RACE(&LOG_OCCURRENCES, "Logging every N is approximate"); \
  ANNOTATE_BENIGN_RACE(&LOG_OCCURRENCES_MOD_N, "Logging every N is approximate"); \
  ++LOG_OCCURRENCES; \
  if (++LOG_OCCURRENCES_MOD_N > n) LOG_OCCURRENCES_MOD_N -= n; \
  if (LOG_OCCURRENCES_MOD_N == 1) \
    google::LogMessage( \
        __FILE__, __LINE__, google::GLOG_ ## severity, LOG_OCCURRENCES, \
        &what_to_do).stream()

#define KUDU_SOME_KIND_OF_LOG_IF_EVERY_N(severity, condition, n, what_to_do) \
  static int LOG_OCCURRENCES = 0, LOG_OCCURRENCES_MOD_N = 0; \
  ANNOTATE_BENIGN_RACE(&LOG_OCCURRENCES, "Logging every N is approximate"); \
  ANNOTATE_BENIGN_RACE(&LOG_OCCURRENCES_MOD_N, "Logging every N is approximate"); \
  ++LOG_OCCURRENCES; \
  if (condition && \
      ((LOG_OCCURRENCES_MOD_N=(LOG_OCCURRENCES_MOD_N + 1) % n) == (1 % n))) \
    google::LogMessage( \
        __FILE__, __LINE__, google::GLOG_ ## severity, LOG_OCCURRENCES, \
                 &what_to_do).stream()

#define KUDU_SOME_KIND_OF_PLOG_EVERY_N(severity, n, what_to_do) \
  static int LOG_OCCURRENCES = 0, LOG_OCCURRENCES_MOD_N = 0; \
  ANNOTATE_BENIGN_RACE(&LOG_OCCURRENCES, "Logging every N is approximate"); \
  ANNOTATE_BENIGN_RACE(&LOG_OCCURRENCES_MOD_N, "Logging every N is approximate"); \
  ++LOG_OCCURRENCES; \
  if (++LOG_OCCURRENCES_MOD_N > n) LOG_OCCURRENCES_MOD_N -= n; \
  if (LOG_OCCURRENCES_MOD_N == 1) \
    google::ErrnoLogMessage( \
        __FILE__, __LINE__, google::GLOG_ ## severity, LOG_OCCURRENCES, \
        &what_to_do).stream()

#define KUDU_SOME_KIND_OF_LOG_FIRST_N(severity, n, what_to_do) \
  static uint64_t LOG_OCCURRENCES = 0; \
  ANNOTATE_BENIGN_RACE(&LOG_OCCURRENCES, "Logging the first N is approximate"); \
  if (LOG_OCCURRENCES++ < n) \
    google::LogMessage( \
      __FILE__, __LINE__, google::GLOG_ ## severity, LOG_OCCURRENCES, \
      &what_to_do).stream()

// The direct user-facing macros.
#define KLOG_EVERY_N(severity, n) \
  GOOGLE_GLOG_COMPILE_ASSERT(google::GLOG_ ## severity < \
                             google::NUM_SEVERITIES, \
                             INVALID_REQUESTED_LOG_SEVERITY); \
  KUDU_SOME_KIND_OF_LOG_EVERY_N(severity, (n), google::LogMessage::SendToLog)

#define KSYSLOG_EVERY_N(severity, n) \
  KUDU_SOME_KIND_OF_LOG_EVERY_N(severity, (n), google::LogMessage::SendToSyslogAndLog)

#define KPLOG_EVERY_N(severity, n) \
  KUDU_SOME_KIND_OF_PLOG_EVERY_N(severity, (n), google::LogMessage::SendToLog)

#define KLOG_FIRST_N(severity, n) \
  KUDU_SOME_KIND_OF_LOG_FIRST_N(severity, (n), google::LogMessage::SendToLog)

#define KLOG_IF_EVERY_N(severity, condition, n) \
  KUDU_SOME_KIND_OF_LOG_IF_EVERY_N(severity, (condition), (n), google::LogMessage::SendToLog)

// We also disable the un-annotated glog macros for anyone who includes this header.
#undef LOG_EVERY_N
#define LOG_EVERY_N(severity, n) \
  GOOGLE_GLOG_COMPILE_ASSERT(false, "LOG_EVERY_N is deprecated. Please use KLOG_EVERY_N.")

#undef SYSLOG_EVERY_N
#define SYSLOG_EVERY_N(severity, n) \
  GOOGLE_GLOG_COMPILE_ASSERT(false, "SYSLOG_EVERY_N is deprecated. Please use KSYSLOG_EVERY_N.")

#undef PLOG_EVERY_N
#define PLOG_EVERY_N(severity, n) \
  GOOGLE_GLOG_COMPILE_ASSERT(false, "PLOG_EVERY_N is deprecated. Please use KPLOG_EVERY_N.")

#undef LOG_FIRST_N
#define LOG_FIRST_N(severity, n) \
  GOOGLE_GLOG_COMPILE_ASSERT(false, "LOG_FIRST_N is deprecated. Please use KLOG_FIRST_N.")

#undef LOG_IF_EVERY_N
#define LOG_IF_EVERY_N(severity, condition, n) \
  GOOGLE_GLOG_COMPILE_ASSERT(false, "LOG_IF_EVERY_N is deprecated. Please use KLOG_IF_EVERY_N.")

namespace kudu {

class Env;

// glog doesn't allow multiple invocations of InitGoogleLogging. This method conditionally
// calls InitGoogleLogging only if it hasn't been called before.
//
// It also takes care of installing the google failure signal handler and
// setting the signal handler for SIGPIPE to SIG_IGN.
void InitGoogleLoggingSafe(const char* arg);

// Like InitGoogleLoggingSafe() but stripped down: no signal handlers are
// installed, regular logging is disabled, and log events of any severity
// will be written to stderr.
//
// These properties make it attractive for us in libraries.
void InitGoogleLoggingSafeBasic(const char* arg);

// Demotes stderr logging to ERROR or higher and registers 'cb' as the
// recipient for all log events.
//
// Subsequent calls to RegisterLoggingCallback no-op (until the callback
// is unregistered with UnregisterLoggingCallback()).
void RegisterLoggingCallback(const LoggingCallback& cb);

// Unregisters a callback previously registered with
// RegisterLoggingCallback() and promotes stderr logging back to all
// severities.
//
// If no callback is registered, this is a no-op.
void UnregisterLoggingCallback();

// Returns the full pathname of the symlink to the most recent log
// file corresponding to this severity
void GetFullLogFilename(google::LogSeverity severity, std::string* filename);

// Format a timestamp in the same format as used by GLog.
std::string FormatTimestampForLog(MicrosecondsInt64 micros_since_epoch);

// Shuts down the google logging library. Call before exit to ensure that log files are
// flushed.
void ShutdownLoggingSafe();

// Deletes excess rotated log files.
//
// Keeps at most 'FLAG_max_log_files' of the most recent log files at every
// severity level, using the file's modified time to determine recency.
Status DeleteExcessLogFiles(Env* env);

namespace logging {

// A LogThrottler instance tracks the throttling state for a particular
// log message.
//
// This is used internally by KLOG_EVERY_N_SECS, but can also be used
// explicitly in conjunction with KLOG_EVERY_N_SECS_THROTTLER. See the
// macro descriptions above for details.
class LogThrottler {
 public:
  LogThrottler() : num_suppressed_(0), last_ts_(0), last_tag_(nullptr) {
    ANNOTATE_BENIGN_RACE_SIZED(this, sizeof(*this), "OK to be sloppy with log throttling");
  }

  bool ShouldLog(int n_secs, const char* tag, int* num_suppressed) {
    MicrosecondsInt64 ts = GetMonoTimeMicros();

    // When we switch tags, we should not show the "suppressed" messages, because
    // in fact it's a different message that we skipped. So, reset it to zero,
    // and always log the new message.
    if (tag != last_tag_) {
      *num_suppressed = num_suppressed_ = 0;
      last_tag_ = tag;
      last_ts_ = ts;
      return true;
    }

    if (ts - last_ts_ < n_secs * 1000000) {
      *num_suppressed = base::subtle::NoBarrier_AtomicIncrement(&num_suppressed_, 1);
      return false;
    }
    last_ts_ = ts;
    *num_suppressed = base::subtle::NoBarrier_AtomicExchange(&num_suppressed_, 0);
    return true;
  }
 private:
  Atomic32 num_suppressed_;
  MicrosecondsInt64 last_ts_;
  const char* last_tag_;
};
} // namespace logging

std::ostream& operator<<(std::ostream &os, const PRIVATE_ThrottleMsg&);

// Convenience macros to prefix log messages with some prefix, these are the unlocked
// versions and should not obtain a lock (if one is required to obtain the prefix).
// There must be a LogPrefixUnlocked()/LogPrefix() method available in the current
// scope in order to use these macros.
#define LOG_WITH_PREFIX_UNLOCKED(severity) LOG(severity) << LogPrefixUnlocked()
#define VLOG_WITH_PREFIX_UNLOCKED(verboselevel) LOG_IF(INFO, VLOG_IS_ON(verboselevel)) \
  << LogPrefixUnlocked()

// Same as the above, but obtain the lock.
#define LOG_WITH_PREFIX(severity) LOG(severity) << LogPrefix()
#define VLOG_WITH_PREFIX(verboselevel) LOG_IF(INFO, VLOG_IS_ON(verboselevel)) \
  << LogPrefix()

} // namespace kudu

#endif // KUDU_UTIL_LOGGING_H


text:
import prefix from 'inline-style-prefixer/static'
import buildDeclarations from './build-declarations'
import {isPseudoSelector, isMediaQuery} from './helpers'

/**
 * Build a css rule.
 * @param {string} selector - A class name.
 * @param {Object} declarations - CSS declarations.
 * @returns {string} formated css rule.
 * @example
 * // returns '.button{border-radius-2px;}'
 * buildDeclarations('button', {borderRadius:'2px'})
 */
export const buildRule = (selector, declarations, globalSelector = false) => {
  return `${globalSelector ? '' : '.'}${selector}{${buildDeclarations(
    prefix(declarations)
  )}}`
}

/**
 * Build a css rule for pseudo selectors.
 * @param {string} selector - A class name.
 * @param {Object} declarations - CSS declarations.
 * @returns {string} formated css rule.
 * @example
 * // returns '.button:before{border-radius-2px;}'
 * buildDeclarations('button', {':before': {borderRadius:'2px'})
 */
export const buildPseudoRule = (
  selector,
  declarations,
  globalSelector = false
) => {
  return Object.keys(declarations)
    .filter(isPseudoSelector)
    .map(declaration =>
      buildRule(
        `${selector}${declaration}`,
        declarations[declaration],
        globalSelector
      )
    )
    .reduce((previous, current) => previous + current, '')
}

/**
 * Build a css rule for a media query.
 * @param {string} selector - A class name.
 * @param {Object} declarations - CSS declarations.
 * @returns {string} formated css rule.
 * @example
 * // returns @media (min-width: 700px){app{color:blue;}}
 * buildMediaQueryRule('app', {'@media (min-width: 700px)': {color: 'blue'}})
 */
export const buildMediaQueryRule = (
  selector,
  declarations,
  globalSelector = false
) => {
  return Object.keys(declarations)
    .filter(isMediaQuery)
    .map(
      declaration =>
        `${declaration}{${buildRule(
          selector,
          declarations[declaration],
          globalSelector
        )}${buildPseudoRule(
          selector,
          declarations[declaration],
          globalSelector
        )}}`
    )
    .reduce((previous, current) => previous + current, '')
}

redpajama_set_name: RedPajamaGithub


text:
using System;
using System.Collections.Generic;
using SharpKit.JavaScript;
namespace Y_
{
    ///
    /// The CustomEvent class lets you define events for your application
    /// that can be subscribed to by one or more independent component.
    ///
    public partial class CustomEvent
    {
        ///
        /// Notify a single subscriber
        ///
        protected void _notify(Subscriber s, Y_.Array args){}
        ///
        /// Create the Subscription for subscribing function, context, and bound
        /// arguments.  If this is a fireOnce event, the subscriber is immediately
        /// notified.
        ///
        protected EventHandle _on(JsAction fn){return null;}
        ///
        /// Create the Subscription for subscribing function, context, and bound
        /// arguments.  If this is a fireOnce event, the subscriber is immediately
        /// notified.
        ///
        protected EventHandle _on(JsAction fn, Y_.Array args){return null;}
        ///
        /// Create the Subscription for subscribing function, context, and bound
        /// arguments.  If this is a fireOnce event, the subscriber is immediately
        /// notified.
        ///
        protected EventHandle _on(JsAction fn, Y_.Array args, object when){return null;}
        ///
        /// Create the Subscription for subscribing function, context, and bound
        /// arguments.  If this is a fireOnce event, the subscriber is immediately
        /// notified.
        ///
        protected EventHandle _on(JsAction fn, object when){return null;}
        ///
        /// Create the Subscription for subscribing function, context, and bound
        /// arguments.  If this is a fireOnce event, the subscriber is immediately
        /// notified.
        ///
        protected EventHandle _on(JsAction fn, object context, Y_.Array args){return null;}
        ///
        /// Create the Subscription for subscribing function, context, and bound
        /// arguments.  If this is a fireOnce event, the subscriber is immediately
        /// notified.
        ///
        protected EventHandle _on(JsAction fn, object context, Y_.Array args, object when){return null;}
        ///
        /// Create the Subscription for subscribing function, context, and bound
        /// arguments.  If this is a fireOnce event, the subscriber is immediately
        /// notified.
        ///
        protected EventHandle _on(JsAction fn, object context, object when){return null;}
        ///
        /// Listen for this event after the normal subscribers have been notified and
        /// the default behavior has been applied.  If a normal subscriber prevents the
        /// default behavior, it also prevents after listeners from firing.
        ///
        public EventHandle after(JsAction fn, object context, object arg){return null;}
        ///
        /// Apply configuration properties.  Only applies the CONFIG whitelist
        ///
        public void applyConfig(object o, object force){}
        ///
        /// Detach listeners.
        ///
        public object detach(JsAction fn, object context){return null;}
        ///
        /// Removes all listeners
        ///
        public object detachAll(){return null;}
        ///
        /// Notifies the subscribers.  The callback functions will be executed
        /// from the context specified when the event was created, and with the
        /// following parameters:
        ///

        ///
The type of event

        ///
All of the arguments fire() was executed with as an array

        ///
The custom object (if any) that was passed into the subscribe()
        /// method

        ///

        ///
        public object fire(object arguments){return null;}
        ///
        /// Set up for notifying subscribers of non-emitFacade events.
        ///
        protected object fireSimple(Y_.Array args){return null;}
        ///
        /// Get all of the subscribers to this event and any sibling event
        ///
        public Y_.Array getSubs(){return null;}
        ///
        /// Stops the event propagation and prevents the default
        /// event behavior.
        ///
        public void halt(object immediate){}
        ///
        /// Returns the number of subscribers for this event as the sum of the on()
        /// subscribers and after() subscribers.
        ///
        public Y_.DataType_.Number hasSubs(){return null;}
        ///
        /// Logger abstraction to centralize the application of the silent flag
        ///
        public void log(object msg, object cat){}
        ///
        /// Monitor the event state for the subscribed event.  The first parameter
        /// is what should be monitored, the rest are the normal parameters when
        /// subscribing to an event.
        ///
        public EventHandle monitor(object what){return null;}
        ///
        /// Listen for this event
        ///
        public EventHandle on(JsAction fn, object context, object arg){return null;}
        ///
        /// Prevents the execution of this event's defaultFn
        ///
        public void preventDefault(){}
        ///
        /// Stops propagation to bubble targets, and prevents any remaining
        /// subscribers on the current target from executing.
        ///
        public void stopImmediatePropagation(){}
        ///
        /// Stop propagation to bubble targets
        ///
        public void stopPropagation(){}
        ///
        /// Listen for this event
        ///
        public EventHandle subscribe(JsAction fn){return null;}
        ///
        /// Detach listeners.
        ///
        public object unsubscribe(JsAction fn, object context){return null;}
        ///
        /// Removes all listeners
        ///
        public object unsubscribeAll(){return null;}
        ///
        /// If 0, this event does not broadcast.  If 1, the YUI instance is notified
        /// every time this event fires.  If 2, the YUI instance and the YUI global
        /// (if event is enabled on the global) are notified every time this event
        /// fires.
        ///
        public int broadcast{get;set;}
        ///
        /// The context the the event will fire from by default.  Defaults to the YUI
        /// instance.
        ///
        public object context{get;set;}
        ///
        /// The default function to execute after event listeners
        /// have fire, but only if the default action was not
        /// prevented.
        ///
        public JsAction defaultFn{get;set;}
        ///
        /// An array containing the arguments the custom event
        /// was last fired with.
        ///
        public Y_.Array firedWith{get;set;}
        ///
        /// Specifies the host for this custom event.  This is used
        /// to enable event bubbling
        ///
        public Y_.EventTarget host{get;set;}
        ///
        /// Flag for preventDefault that is modified during fire().
        /// if it is not 0, the default behavior for this event
        ///
        public int prevented{get;set;}
        ///
        /// The function to execute if a subscriber calls
        /// preventDefault
        ///
        public JsAction preventedFn{get;set;}
        ///
        /// Supports multiple options for listener signatures in order to
        /// port YUI 2 apps.
        ///
        public int signature{get;set;}
        ///
        /// Flag for stopPropagation that is modified during fire()
        /// 1 means to stop propagation to bubble targets.  2 means
        /// to also stop additional subscribers on this target.
        ///
        public int stopped{get;set;}
        ///
        /// The function to execute if a subscriber calls
        /// stopPropagation or stopImmediatePropagation
        ///
        public JsAction stoppedFn{get;set;}
        ///
        /// The type of event, returned to subscribers when the event fires
        ///
        public string type{get;set;}
    }
}


text:
package jire.logging;

import java.util.BitSet;

public abstract class AbstractLogger implements Logger {

	private final BitSet bitSet = new BitSet(Type.values().length);

	protected AbstractLogger() {
		configure(Type.MESSAGE, true);
		configure(Type.WARNING, true);
		configure(Type.ERROR, true);
	}

	@Override
	public final Logger log(String content, Type type, Format format) {
		if (isConfigured(type))
			showLog(content, type, format);
		return this;
	}

	protected abstract void showLog(String content, Type type, Format format);

	@Override
	public final Logger message(String content, Format format) {
		return log(content, Type.MESSAGE, format);
	}

	@Override
	public final Logger message(String content) {
		return message(content, DEFAULT_FORMAT);
	}

	@Override
	public final Logger warning(String content, Format format) {
		return log(content, Type.WARNING, format);
	}

	@Override
	public final Logger warning(String content) {
		return warning(content, DEFAULT_FORMAT);
	}

	@Override
	public final Logger error(String content, Format format) {
		return log(content, Type.ERROR, format);
	}

	@Override
	public final Logger error(String content) {
		return error(content, DEFAULT_FORMAT);
	}

	@Override
	public final Logger debug(String content, Format format) {
		return log(content, Type.DEBUG, format);
	}

	@Override
	public final Logger debug(String content) {
		return debug(content, DEFAULT_FORMAT);
	}

	@Override
	public final Logger configure(Type type, boolean on) {
		bitSet.set(type.ordinal(), on);
		return this;
	}

	@Override
	public final boolean isConfigured(Type type) {
		return bitSet.get(type.ordinal());
	}

}


text:
'use strict';

angular.module('upsConsole').controller('DetailController',
  function($rootScope, $routeParams, $location, $modal, $http, applicationsEndpoint, variantsEndpoint,
    importerEndpoint, exporterEndpoint, Notifications, breadcrumbs, application, counts, ContextProvider,
    metricsEndpoint, pushConfigGenerator) {

  var $scope = this;

  /*
   * INITIALIZATION
   */
  $scope.application = application;
  $rootScope.application = application;
  $scope.counts = counts;
  breadcrumbs.generateBreadcrumbs();
  $scope.currentLocation = ContextProvider.contextPath();

  metricsEndpoint.application({id: $routeParams.applicationId}, function(data) {
    angular.forEach(data, function (warning) {
      angular.forEach(application.variants, function (variant) {
        if (warning.variantInformations.length &&
            variant.variantID === warning.variantInformations[0].variantID &&
            !warning.variantInformations[0].deliveryStatus) {
          variant.hasError = true;
          variant.error = warning.variantInformations[0].reason;
        }
      });
    });
  });

  /*
   * PUBLIC METHODS
   */

  $scope.addVariant = function (variant) {
    var modalInstance = show('create-variant.html', {
      variant: function () { return variant; }
    });
    modalInstance.result.then(function (result) {
      var variantData = variantProperties(result.variant);
      var params = angular.extend({}, {
        appId: $scope.application.pushApplicationID,
        variantType: result.variant.type
      });

      var createFunction = (variantData instanceof FormData) ? variantsEndpoint.createWithFormData : variantsEndpoint.create;

      createFunction(params, variantData, function (newVariant) {
        var length = application.variants.length;
        for (var i = 0; i < length; i++) {
          if (newVariant.type === application.variants[i].type) {
            break;
          }
        }
        $scope.application.variants.splice(i, 0, newVariant);
        Notifications.success('Successfully created variant');
      }, function () {
        Notifications.error('Unable to add the variant...');
      });
    });
  };

  $scope.editVariant = function (variant) {
    variant.protocolType = variant.type.split('windows_')[1];
    var modalInstance = show('create-variant.html', {
      variant: function () { return variant; }
    });
    modalInstance.result.then(function (result) {
      var variantDataUpdate = variantProperties(variant);
      var params = angular.extend({}, {
        appId: $scope.application.pushApplicationID,
        variantType: result.variant.type,
        variantId: result.variant.variantID
      });

      var successCallback = function () {
        Notifications.success('Successfully modified variant');
      };
      var failureCallback = function () {
        Notifications.error('Unable to save the variant...');
      };

      if (variant.type !== 'ios') {
        variantsEndpoint.update(params, variantDataUpdate, successCallback, failureCallback);
      } else {
        if (variant.certificate) {
          variantsEndpoint.updateWithFormData(params, variantDataUpdate, successCallback, failureCallback);
        } else {
          variantsEndpoint.patch(params, { name: variant.name, description: variant.description}, successCallback, failureCallback);
        }
      }
    });
  };

  $scope.removeVariant = function (variant) {
    var modalInstance = show('remove-variant.html', {
      variant: function () { return variant; }
    });
    modalInstance.result.then(function (result) {
      var params = angular.extend({}, {
        appId: $scope.application.pushApplicationID,
        variantType: result.variant.type,
        variantId: result.variant.variantID
      });
      variantsEndpoint.remove(params, function () {
        var osVariantsEndpoint = $scope.application.variants;
        osVariantsEndpoint.splice(osVariantsEndpoint.indexOf(variant), 1);
        updateCounts();
        Notifications.success('Successfully removed variant');
      }, function () {
        Notifications.error('Unable to remove the variant...');
      });
    });
  };

  $scope.renewMasterSecret = function () {
    var modalInstance = show('renew-master-secret.html', {});
    modalInstance.result.then(function () {
      var app = $scope.application;
      applicationsEndpoint.reset({appId: app.pushApplicationID}, function (application) {
        $scope.application.masterSecret = application.masterSecret;
        Notifications.success('Successfully renewed master secret for "' + app.name + '"');
      });
    });
  };

  $scope.renewVariantSecretEndpoint = function (variant) {
    var modalInstance = show('renew-variant-secret.html', {});
    modalInstance.result.then(function () {
      var app = $scope.application;
      var params = {
        appId: app.pushApplicationID,
        variantType: variant.type,
        variantId: variant.variantID
      };
      variantsEndpoint.reset(params, function (updatedVariant) {
        variant.secret = updatedVariant.secret;
        Notifications.success('Successfully renewed secret for variant "' + updatedVariant.name + '"');
      });
    });
  };

  $scope.exportInstallations = function (variant) {
    variant.total = counts[variant.type];
    var modalInstance = show('export-installations.html', {
      variant: function () { return variant; }
    });
    modalInstance.result.then(function () {
      var params = {
        variantId: variant.variantID
      };
      exporterEndpoint.export(params, function (content) {
        var hiddenElement = document.createElement('a');

        hiddenElement.href = 'data:attachment/json,' + encodeURI(JSON.stringify(content));
        hiddenElement.target = '_blank';
        hiddenElement.download = variant.variantID + '.json';
        hiddenElement.click();

        Notifications.success('Successfully exported installations');
      });
    });
  };

  $scope.importInstallations = function (variant) {
    variant.installations = [];
    var modalInstance = show('import-installations.html', {
      variant: function () { return variant; }
    });
    modalInstance.result.then(function (result) {
      $rootScope.isViewLoading = true;
      var fd = new FormData();
      fd.append('file', result.variant.installations[0]);
      $http.defaults.headers.common.Authorization = 'Basic ' + btoa(variant.variantID+
      ':' + variant.secret);
      importerEndpoint.import(null,fd,function(){
        $rootScope.isViewLoading = false;
        Notifications.success('Import process has started"');
        updateCounts();
      });
    });
  };

  $scope.generatePushConfigDialog = function() {
    var application = $scope.application;
    show('generate-push-config.html', {
      application: function () { return application; }
    });
  };

  /*
   * PRIVATE FUNCTIONS
   */

  function updateCounts() {
    $scope.counts =applicationsEndpoint.count({appId: $scope.application.pushApplicationID});
  }

  function modalController($scope, $modalInstance, variant) {
    $scope.variant = variant;
    if (!$scope.variant) {
      $scope.variant = {};
    }
    $scope.variant.certificates = [];

    $scope.ok = function (variant) {
      $modalInstance.close({
        variant: variant
      });
    };

    $scope.cancel = function () {
      $modalInstance.dismiss('cancel');
    };

    //preview function for the import
    $scope.previewImport = function() {
      if (window.File && window.FileList && window.FileReader) {
        var importFiles = variant.installations[0];
        var fileReader = new FileReader();
        fileReader.readAsText(importFiles);
        fileReader.onload = function(e) {
          try {
            $scope.importPreview = JSON.parse(e.target.result).length;
            $scope.incorrectFormat = false;
          }
          catch(e) {
            $scope.importPreview = null;
            $scope.incorrectFormat = true;
          }

        };
      }
    };

    // generatePushConfig dialog
    $scope.variantSelection = {};
    $scope.toggleSelection = function toggleSelection( variant ) {
      $scope.variantSelection[variant.type] = variant;
    };
    $scope.generatePushConfig = function() {
      var selectedVariants = Object.keys($scope.variantSelection).map(function (type) {
        return $scope.variantSelection[type];
      });
      return pushConfigGenerator.generate(selectedVariants);
    };
    $scope.downloadPushConfig = function() {
      var pushConfig = $scope.generatePushConfig();
      var pom = document.createElement('a');
      pom.setAttribute('href', 'data:application/json;charset=utf-8,' + encodeURIComponent(pushConfig));
      pom.setAttribute('download', 'push-config.json');
      pom.click();
      $scope.cancel();
    };
  }

  function show(template, resolve) {
    return $modal.open({
      templateUrl: 'views/dialogs/' + template,
      controller: modalController,
      resolve: angular.extend({ // mix-in some defaults
        variant: function() { return null; }
      }, resolve)
    });
  }

  function variantProperties(variant) {
    var properties = ['name', 'description'], result = {};
    switch (variant.type) {
    case 'android':
      properties = properties.concat(['projectNumber', 'googleKey']);
      break;
    case 'simplePush':
      properties = properties.concat([]);
      break;
    case 'ios':
      if (variant.certificates && variant.certificates.length) {
        variant.certificate = variant.certificates[0];
      }
      properties = properties.concat(['production', 'passphrase', 'certificate']);
      var formData = new FormData();
      properties.forEach(function (property) {
        formData.append(property, variant[property] || '');
      });
      return formData;
    case 'windows':
      variant.type = variant.type + '_' + variant.protocolType;
      properties = properties.concat(['sid', 'clientSecret', 'protocolType']);
      break;
    case 'windows_wns':
      result.protocolType = 'wns';
      properties = properties.concat(['sid', 'clientSecret']);
      break;
    case 'windows_mpns':
      result.protocolType = 'mpns';
      properties = properties.concat([]);
      break;
    case 'adm':
      properties = properties.concat(['clientId','clientSecret']);
      break;
    default:
      Notifications.error('Unknown variant type ' + variant.type);
    }

    properties.forEach(function (property) {
      result[property] = variant[property];
    });
    return result;
  }

});


text:
<?php

namespace Bravesheep\PhpspecExtraMatchers\Matcher\Mink;

use Behat\Mink\Session;
use Bravesheep\PhpspecExtraMatchers\Matcher\SimpleMatcher;
use PhpSpec\Exception\Example\FailureException;

class UrlMatcher extends SimpleMatcher
{
    /**
     * {@inheritdoc}
     */
    protected function matches($subject, array $arguments)
    {
        /** @var Session $session */
        $session = $subject;
        $expectedAddress = $this->cleanPath($arguments[0]);
        $currentAddress = $this->cleanPath($session->getCurrentUrl());

        return $expectedAddress === $currentAddress;
    }

    /**
     * @param string $name
     * @param Session  $subject
     * @param array  $arguments
     *
     * @return FailureException
     */
    protected function getFailureException($name, $subject, array $arguments)
    {
        return new FailureException(sprintf(
            'Expected %s to be %s, but it is not.',
            $this->presenter->presentString($this->cleanPath($subject->getCurrentUrl())),
            $this->presenter->presentString($this->cleanPath($arguments[0]))
        ));
    }

    /**
     * @param string $name
     * @param Session  $subject
     * @param array  $arguments
     *
     * @return FailureException
     */
    protected function getNegativeFailureException($name, $subject, array $arguments)
    {
        return new FailureException(sprintf(
            'Expected %s not to be %s, but it is.',
            $this->presenter->presentString($this->cleanPath($subject->getCurrentUrl())),
            $this->presenter->presentString($this->cleanPath($arguments[0]))
        ));
    }

    /**
     * {@inheritdoc}
     */
    protected function getNames()
    {
        return [
            'haveAddress',
            'beAtAddress',
            'haveUrl',
            'beAtUrl',
        ];
    }

    /**
     * {@inheritdoc}
     */
    protected function getRequiredArgumentCount()
    {
        return 1;
    }

    /**
     * {@inheritdoc}
     */
    protected function supportsSubject($subject)
    {
        return $subject instanceof Session;
    }

    /**
     * Retrieves path from url and trims scriptname from the URL.
     * @param string $path
     * @return string
     */
    protected function cleanPath($path)
    {
        return parse_url(preg_replace('/^\/[^\.\/]+\.php/', '', $path), PHP_URL_PATH);
    }
}


text:
package uk.ac.brighton.ci360.bigarrow;

import java.io.IOException;
import java.net.Socket;
import java.net.UnknownHostException;
import java.security.KeyManagementException;
import java.security.KeyStore;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.security.UnrecoverableKeyException;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Properties;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;

import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.StatusLine;
import org.apache.http.client.HttpClient;
import org.apache.http.client.HttpResponseException;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpUriRequest;
import org.apache.http.conn.ClientConnectionManager;
import org.apache.http.conn.scheme.Scheme;
import org.apache.http.conn.scheme.SchemeRegistry;
import org.apache.http.conn.ssl.SSLSocketFactory;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.util.EntityUtils;

import uk.ac.brighton.ci360.bigarrow.PlaceSearchRequester.SearchEstab;
import uk.ac.brighton.ci360.bigarrow.PlaceSearchRequester.SearchType;
import uk.ac.brighton.ci360.bigarrow.places.Place;
import uk.ac.brighton.ci360.bigarrow.places.Place.Photo;
import uk.ac.brighton.ci360.bigarrow.places.PlaceDetails;
import uk.ac.brighton.ci360.bigarrow.places.PlacesList;
import android.annotation.SuppressLint;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.location.Location;
import android.os.AsyncTask;
import android.util.Log;

import com.google.api.client.googleapis.GoogleHeaders;
import com.google.api.client.http.GenericUrl;
import com.google.api.client.http.HttpRequest;
import com.google.api.client.http.HttpRequestFactory;
import com.google.api.client.http.HttpRequestInitializer;
import com.google.api.client.http.HttpTransport;
import com.google.api.client.http.apache.ApacheHttpTransport;
import com.google.api.client.http.json.JsonHttpParser;
import com.google.api.client.json.jackson.JacksonFactory;

@SuppressLint("DefaultLocale")
public class PlacesAPISearch {

	private Location location;
	private String estabType;
	private String detailsReference;
	private SearchType searchType;

	private static final String TAG = "PubSearch";
	private PlaceSearchRequester requester;
	private String apiKey;
	private String placesSearchURL;
	private String placesDetailsURL;
	private String placesPhotoURL;
	private ArrayList<Photo> photoRefs;
	//private ArrayList<Bitmap> photoResults;
	private CopyOnWriteArrayList<Bitmap> photoResults;

	private ExecutorService executorService;

	private Cache<PlacesList> placesListCache;
	private Cache<PlaceDetails> placeDetailsCache;

	public PlacesAPISearch(PlaceSearchRequester requester) {
		this.requester = requester;
		Properties prop = new Properties();

		placesListCache = new Cache<PlacesList>(new Formatter() {
		    @Override
		    public String formatKey(String queryString) {
		        String location = queryString.substring(queryString.indexOf("location=")+9);
		        location = location.substring(0, location.indexOf("&"));
		        String lat = location.substring(0, location.indexOf(","));
		        String lng = location.substring(location.indexOf(",") + 1);

		        lat = String.format("%.3f", Double.parseDouble(lat));
		        lng = String.format("%.3f", Double.parseDouble(lng));

		        String type = queryString.substring(queryString.indexOf("types=")+6);
		        // "type1,type2&latitude,longitude"
		        return type + "&" + lat + "," + lng;
		    }
		});

		placeDetailsCache = new Cache<PlaceDetails>(new Formatter() {
		    @Override
		    public String formatKey(String key) {
		        return key.substring(key.indexOf("reference=") + 10, key.indexOf("&sensor"));
		    }
		});

		try {
			prop.load(PlacesAPISearch.class.getClassLoader()
					.getResourceAsStream("config.properties"));
			apiKey = prop.getProperty("apikey_places");
			placesSearchURL = prop.getProperty("places_endpoint_search");
			placesDetailsURL = prop.getProperty("places_endpoint_details");
			placesPhotoURL = prop.getProperty("places_endpoint_photo");
			Log.d(TAG, apiKey);
		} catch (IOException ex) {
			ex.printStackTrace();
		}
	}

	public void search(Location l, SearchEstab[] estabs, SearchType searchType) {
		this.location = l;
		StringBuffer estabsStr = new StringBuffer();
		int i = 0;
		for (; i < estabs.length - 1; i++) {
			estabsStr.append(estabs[i].label());
			estabsStr.append(",");
		}
		estabsStr.append(estabs[i]);
		this.estabType = estabsStr.toString();
		this.searchType = searchType;
		new PlaceSearchTask().execute();
	}

	public void getDetail(String reference) {
		this.detailsReference = reference;
		this.searchType = SearchType.DETAIL;
		new PlaceDetailsTask().execute();
	}

	class PlaceSearchTask extends AsyncTask<String, Void, PlacesList> {
		final SearchType st = searchType;

		protected PlacesList doInBackground(String... urls) {
			PlacesList places = new PlacesList();
			try {
				HttpTransport transport = new ApacheHttpTransport();
				HttpRequestFactory httpRequestFactory = createRequestFactory(transport);
				HttpRequest request = httpRequestFactory
						.buildGetRequest(new GenericUrl(placesSearchURL));
				// request.getUrl().setPort(443);
				request.getUrl().put("key", apiKey);
				request.getUrl().put("location",
						location.getLatitude() + "," + location.getLongitude());
				request.getUrl().put("rankby", "distance"); // in meters
				request.getUrl().put("sensor", "true");
				if (estabType != null)
					request.getUrl().put("types", estabType.toLowerCase());

				String query = request.getUrl().toString();
				Log.d(TAG, query);

				if (placesListCache.contains(query)) {
				    places = placesListCache.get(query);
				    Log.d(TAG, "retrieved from cache");
				}
				else {
				    places = request.execute().parseAs(PlacesList.class);
				    // we really should do some data validation before storing
	                placesListCache.store(query, places);
				}

				// Check log cat for places response status
				Log.d(TAG, "" + places.status);

				return places;
			} catch (HttpResponseException e) {
				Log.e("Error:", e.getMessage());
				returnNoResult();
				return null;
			} catch (IOException e) {
				returnNoResult();
				e.printStackTrace();
				return null;
			}
		}

		protected void onPostExecute(PlacesList places) {
			Log.d(TAG, "AsyncTask is done");
			Log.d(TAG, "SearchType: " + searchType);
			if (places != null && places.results != null) {
				if (places.results.size() > 0) {
					if (this.st == SearchType.MANY) {
						requester.updateNearestPlaces(places);
					} else {
						Place p = places.results.get(0);
						Location l = new Location(p.name);
						l.setLatitude(p.geometry.location.lat);
						l.setLongitude(p.geometry.location.lng);
						Log.d(TAG, "Nearest pub:" + p.name);
						Log.d(TAG, "Distance:" + location.distanceTo(l));
						requester.updateNearestPlace(p, l,
								location.distanceTo(l));
					}
				} else {
					returnNoResult();
				}
			} else {
				returnNoResult();
			}
		}
	}

	class PlaceDetailsTask extends AsyncTask<String, Void, PlaceDetails> {

		protected PlaceDetails doInBackground(String... urls) {
			PlaceDetails details = new PlaceDetails();
			try {
				HttpTransport transport = new ApacheHttpTransport();
				HttpRequestFactory httpRequestFactory = createRequestFactory(transport);
				HttpRequest request = httpRequestFactory
						.buildGetRequest(new GenericUrl(placesDetailsURL));
				// request.getUrl().setPort(443);
				request.getUrl().put("key", apiKey);
				request.getUrl().put("reference", detailsReference);
				request.getUrl().put("sensor", "true");

				String query = request.getUrl().toString();
                Log.d(TAG, query);

                if (placeDetailsCache.contains(query)) {
                    details = placeDetailsCache.get(query);
                    Log.d(TAG, "retrieved from cache");
                }
                else {
                    details = request.execute().parseAs(PlaceDetails.class);
                    // we really should do some data validation before storing
                    placeDetailsCache.store(query, details);
                }

                // Check log cat for places response status
                Log.d(TAG, "" + details.status);

				return details;
			} catch (HttpResponseException e) {
				Log.e("Error:", e.getMessage());
				returnNoResult();
				return null;
			} catch (IOException e) {
				returnNoResult();
				e.printStackTrace();
				return null;
			}
		}

		protected void onPostExecute(PlaceDetails details) {
			Log.d(TAG, "AsyncTask is done");
			Log.d(TAG, "places is null?: " + (details == null));
			if (details != null) {
				requester.updatePlaceDetails(details);
			} else {
				returnNoResult();
			}
		}
	}

	public void getPhotos(Photo[] photoRefsArr) {
	    executorService = Executors.newFixedThreadPool(5);
		photoRefs = new ArrayList<Photo>(Arrays.asList(photoRefsArr));
		photoResults = new CopyOnWriteArrayList<Bitmap>();
		for (Photo p : photoRefs) {
		    executorService.execute(new PhotoTask(p.photo_reference));
		}
	}

	class PhotoTask implements Runnable {

	    private final String photoRef;

        PhotoTask(String photoRef) {
            this.photoRef = photoRef;
        }

        private Bitmap getBitmap() {
            try {
                StringBuilder url = new StringBuilder(placesPhotoURL);
                url.append("maxwidth=400");
                url.append("&photoreference=").append(photoRef);
                url.append("&sensor=true");
                url.append("&key=").append(apiKey);

                HttpUriRequest request = new HttpGet(url.toString());
                HttpClient httpClient = new DefaultHttpClient();
                HttpResponse response = httpClient.execute(request);

                StatusLine statusLine = response.getStatusLine();
                int statusCode = statusLine.getStatusCode();
                if (statusCode == 200) {
                    HttpEntity entity = response.getEntity();
                    byte[] bytes = EntityUtils.toByteArray(entity);

                    Bitmap bitmap = BitmapFactory.decodeByteArray(bytes, 0,
                            bytes.length);
                    return bitmap;
                } else {
                    throw new IOException("Download failed, HTTP response code "
                            + statusCode + " - " + statusLine.getReasonPhrase());
                }
            } catch (HttpResponseException e) {
                Log.e("Error:", e.getMessage());
                returnNoResult();
                return null;
            } catch (IOException e) {
                returnNoResult();
                e.printStackTrace();
                return null;
            }
        }

        @Override
        public void run() {
            photoResults.add(getBitmap());
            if (photoRefs.size() == photoResults.size()) {
                requester.updatePhotos(new ArrayList<Bitmap>(photoResults));
            }
        }

	}

	public void getPlaceDetails(String reference) throws Exception {
		detailsReference = reference;
		new PlaceDetailsTask().execute();
	}

	private void returnNoResult() {
		Log.d(TAG, "NO RESULT");
		if (searchType == SearchType.MANY) {
			requester.updateNearestPlaces(new PlacesList());
		} else {
			Place p = new Place();
			p.name = "No results";
			p.id = Place.NO_RESULT;
			requester.updateNearestPlace(p, null, 0f);
		}
	}

	private static HttpRequestFactory createRequestFactory(
			final HttpTransport transport) {
		return transport.createRequestFactory(new HttpRequestInitializer() {
			public void initialize(HttpRequest request) {
				GoogleHeaders headers = new GoogleHeaders();
				headers.setApplicationName("BigArrow");
				request.setHeaders(headers);
				JsonHttpParser parser = new JsonHttpParser(new JacksonFactory());
				request.addParser(parser);
			}
		});
	}

	@SuppressWarnings("unused")
	private HttpClient sslClient(HttpClient client) {
		try {
			X509TrustManager tm = new X509TrustManager() {
				public void checkClientTrusted(X509Certificate[] xcs,
						String string) throws CertificateException {
				}

				public void checkServerTrusted(X509Certificate[] xcs,
						String string) throws CertificateException {
				}

				public X509Certificate[] getAcceptedIssuers() {
					return null;
				}
			};
			SSLContext ctx = SSLContext.getInstance("TLS");
			ctx.init(null, new TrustManager[] { tm }, null);
			SSLSocketFactory ssf = new MySSLSocketFactory(ctx);
			ssf.setHostnameVerifier(SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
			ClientConnectionManager ccm = client.getConnectionManager();
			SchemeRegistry sr = ccm.getSchemeRegistry();
			sr.register(new Scheme("https", ssf, 443));
			return new DefaultHttpClient(ccm, client.getParams());
		} catch (Exception ex) {
			return null;
		}
	}

	public class MySSLSocketFactory extends SSLSocketFactory {
		SSLContext sslContext = SSLContext.getInstance("TLS");

		public MySSLSocketFactory(KeyStore truststore)
				throws NoSuchAlgorithmException, KeyManagementException,
				KeyStoreException, UnrecoverableKeyException {
			super(truststore);

			TrustManager tm = new X509TrustManager() {
				public void checkClientTrusted(X509Certificate[] chain,
						String authType) throws CertificateException {
				}

				public void checkServerTrusted(X509Certificate[] chain,
						String authType) throws CertificateException {
				}

				public X509Certificate[] getAcceptedIssuers() {
					return null;
				}
			};

			sslContext.init(null, new TrustManager[] { tm }, null);
		}

		public MySSLSocketFactory(SSLContext context)
				throws KeyManagementException, NoSuchAlgorithmException,
				KeyStoreException, UnrecoverableKeyException {
			super(null);
			sslContext = context;
		}

		@Override
		public Socket createSocket(Socket socket, String host, int port,
				boolean autoClose) throws IOException, UnknownHostException {
			return sslContext.getSocketFactory().createSocket(socket, host,
					port, autoClose);
		}

		@Override
		public Socket createSocket() throws IOException {
			return sslContext.getSocketFactory().createSocket();
		}
	}

}


text:
import sbt._
import Keys._
import java.io.File
import com.joshcough.minecraft.Plugin._
import sbtassembly.Plugin._
import AssemblyKeys._

object build extends Build {

  val projectUrl = "https://github.com/joshcough/NetLogoMinecraft"

  lazy val standardSettings = join(
    Defaults.defaultSettings,
    bintray.Plugin.bintraySettings,
    libDeps(
      "javax.servlet"      % "servlet-api" % "2.5"        % "provided->default",
      "org.scalacheck"    %% "scalacheck"  % "1.11.3"     % "test",
      "org.bukkit"         % "bukkit" % "1.7.2-R0.2",
      "com.joshcough"     %% "scala-minecraft-plugin-api" % "0.3.3"
    ),
    Seq(
      organization := "com.joshcough",
      version := "0.3.3",
      scalaVersion := "2.11.0",
      licenses <++= version(v => Seq("MIT" -> url(projectUrl + "/blob/%s/LICENSE".format(v)))),
      publishMavenStyle := true,
      resolvers += Resolver.sonatypeRepo("snapshots"),
      resolvers += "Bukkit" at "http://repo.bukkit.org/content/repositories/releases"
    )
  )

  // this is the main project, that builds all subprojects.
  // it doesnt contain any code itself.
  lazy val all = Project(
    id = "all",
    base = file("."),
    settings = standardSettings,
    aggregate = Seq(netlogoPlugin, netlogoLibPlugin)
  )

  lazy val npcLib = "com.joshcough" %% "remote-entities" % "1.7.2-R0.2_0.3.3"
  lazy val netlogoRepo = bintray.Opts.resolver.repo("netlogo", "NetLogoHeadless")
  lazy val remoteEntitiesRepo = bintray.Opts.resolver.repo("joshcough", "remote-entities")

  lazy val netlogoPlugin = Project(
    id = "netLogoPlugin",
    base = file("netlogoPlugin"),
    settings = join(
      standardSettings,
      copyPluginToBukkitSettings(None),
      pluginYmlSettings("com.joshcough.minecraft.NetLogoPlugin", "JoshCough"),
      libDeps(
        "org.nlogo" % "netlogoheadless" % "5.2.0-439e6c4",
        npcLib
      ),
      Seq(resolvers ++= Seq(netlogoRepo, remoteEntitiesRepo))
    )
  )

  lazy val netlogoLibPlugin = Project(
    id = "netLogoLibPlugin",
    base = file("netlogoLibPlugin"),
    settings = join(
      standardSettings,
      assemblySettings,
      mergeStrategy in assembly <<= (mergeStrategy in assembly) { old => {
        case "plugin.yml" => MergeStrategy.first
        case x => old(x)
      }},
      named("netlogo-lib-plugin"),
      copyPluginToBukkitSettings(Some("assembly")),
      libDeps(
        "org.nlogo" % "netlogoheadless" % "5.2.0-439e6c4",
        "asm" % "asm-all" % "3.3.1",
        "org.picocontainer" % "picocontainer" % "2.13.6",
        "org.scala-lang.modules" %% "scala-parser-combinators" % "1.0.1"
      ),
      resolvers += netlogoRepo
    )
  )
}


text:
package uk.ac.ox.oucs.vle;

import java.util.Set;

/**
 * Created by buckett on 24/09/15.
 */
public class CourseDepartmentImpl implements CourseDepartment {

    private String code;
    private boolean approvalRequired;
    private Set<String> approvers;

    public CourseDepartmentImpl(String code, boolean approvalRequired, Set<String> approvers) {
        this.code = code;
        this.approvalRequired = approvalRequired;
        this.approvers = approvers;
    }

    @Override
    public String getCode() {
        return code;
    }

    @Override
    public boolean isApprovalRequired() {
        return approvalRequired;
    }

    @Override
    public Set<String> getApprovers() {
        return approvers;
    }
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;
using CookComputing.XmlRpc;
using System.Reflection;
using System.ComponentModel;
using System.Threading;
using Microsoft.Phone.Shell;
using System.IO.IsolatedStorage;
using System.Globalization;
using System.Threading;

namespace SvP_Mobile_Client
{
    public enum PrivatemsgFolder
    {
        inbox,
        sent
    }

    public partial class svpPanorama : PhoneApplicationPage
    {
        private System.Windows.Controls.Primitives.Popup popup;
        private BackgroundWorker backroungWorker;

        PrivatemsgFolder currentFolder = PrivatemsgFolder.inbox;

        private IsolatedStorageSettings iSettings = IsolatedStorageSettings.ApplicationSettings;

        string culture = "en-US";
        CultureInfo newCulture = null;

        int users = 0;

        public svpPanorama()
        {
            InitializeComponent();

            try
            {
                culture = iSettings["culture"] as string;
                newCulture = new CultureInfo(culture);
            }
            catch
            {
                try
                {
                    switch (Thread.CurrentThread.CurrentCulture.ToString())
                    {
                        case "cs-CZ":
                            newCulture = new CultureInfo("cs-CZ");
                            break;
                        case "en-US":
                        default:
                            newCulture = new CultureInfo(culture);
                            break;
                    }

                }
                catch
                {
                    newCulture = new CultureInfo(culture);
                }
            }
            Thread.CurrentThread.CurrentCulture = newCulture;
            Thread.CurrentThread.CurrentUICulture = newCulture;

            this.ReloadStrings();

            ShowSplash();
        }

        private void ShowSplash()
        {
            this.popup = new System.Windows.Controls.Primitives.Popup();
            this.popup.Child = new CustomSplashScreen();
            this.popup.IsOpen = true;
            StartLoadingData();
        }

        private void StartLoadingData()
        {
            backroungWorker = new BackgroundWorker();
            backroungWorker.DoWork += new DoWorkEventHandler(backroungWorker_DoWork);
            backroungWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(backroungWorker_RunWorkerCompleted);
            backroungWorker.RunWorkerAsync();
        }

        void backroungWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            this.Dispatcher.BeginInvoke(() =>
            {
                this.popup.IsOpen = false;
                this.NavigationService.Navigate(new Uri("/LoginPage.xaml", UriKind.Relative));
            }
            );
        }

        void backroungWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            Thread.Sleep(3500);
        }

        private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e)
        {

        }

        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            if (culture != Thread.CurrentThread.CurrentCulture.ToString())
            {
                this.ReloadStrings();
                this.culture = Thread.CurrentThread.CurrentCulture.ToString();
            }

            if (this.popup.IsOpen == false)
            {
                this.ApplicationBar.IsVisible = true;

                if (DrupalConnection.GetInstance().LoggedIn == false)
                {
                    this.NavigationService.Navigate(new Uri("/LoginPage.xaml", UriKind.Relative));
                }

                if (DrupalConnection.GetInstance().LoggedIn == true)
                {
                    this.progressBarMessageLoading.Visibility = System.Windows.Visibility.Visible;
                    this.GetUnreadCount();
                    this.PrivatemsgGet();
                }
            }

            base.OnNavigatedTo(e);
        }

        private void button3_Click(object sender, RoutedEventArgs e)
        {

        }

        public void GetUnreadCount()
        {
            DrupalConnection.GetInstance().GetProxy().BeginPrivatemsgUnreadCount(DrupalConnection.GetInstance().UID, asr =>
            {
                Dispatcher.BeginInvoke(delegate()
                {
                    try
                    {
                        var unreadCountResponse = DrupalConnection.GetInstance().GetProxy().EndPrivatemsgUnreadCount(asr);
                        this.labelMessagesTitle.Text = AppResources.Messages + " (" + unreadCountResponse.ToString() + ")";
                    }
                    catch (XmlRpcFaultException fex)
                    {
                        textBlock1.Text = fex.Message;
                    }
                    catch (Exception ex)
                    {
                        if (ex.Message == "Unauthorized: Access denied for user 0 \"anonymous\"")
                        {
                        }
                        textBlock1.Text = ex.Message;
                    }
                });
            });
        }

        public void PrivatemsgGet()
        {
            DrupalConnection.GetInstance().GetProxy().BeginPrivatemsgGet(this.currentFolder.ToString(), false, 0, 10, DrupalConnection.GetInstance().UID, asr =>
            {
                Dispatcher.BeginInvoke(delegate()
                {
                    try
                    {
                        var getThreadResponse = DrupalConnection.GetInstance().GetProxy().EndPrivatemsgGet(asr);
                        if (getThreadResponse.Length == 0)
                        {
                            this.listBox1.Items.Clear();
                            textBlock1.Text = AppResources.NoAnyMessages;
                        }
                        else
                        {
                            this.listBox1.Items.Clear();
                            //textBlock1.Text = AppResources.Messages + ":\r\n\r\n";
                            foreach (XmlRpcStruct item in getThreadResponse)
                            {
                                PrivatemsgItem msgItem = new PrivatemsgItem();

                                try
                                {
                                    foreach (XmlRpcStruct pUser in (XmlRpcStruct[])item["participants"])
                                    {
                                        if (msgItem.From == string.Empty)
                                        {
                                            if (this.currentFolder == PrivatemsgFolder.inbox)
                                            {
                                                msgItem.From = AppResources.From_ + pUser["name"].ToString();
                                            }
                                            else if (this.currentFolder == PrivatemsgFolder.sent)
                                            {
                                                msgItem.From = AppResources.To_ + pUser["name"].ToString();
                                            }
                                        }
                                        else
                                        {
                                            msgItem.From += ", " + pUser["name"].ToString();
                                        }
                                    }
                                }
                                catch (Exception ex)
                                {
                                    if (this.currentFolder == PrivatemsgFolder.inbox)
                                    {
                                        msgItem.From = AppResources.From_ + DrupalConnection.GetInstance().Username;
                                    }
                                    else if (this.currentFolder == PrivatemsgFolder.sent)
                                    {
                                        msgItem.From = AppResources.To_ + DrupalConnection.GetInstance().Username;
                                    }
                                }

                                if (item["is_new"].ToString() == "0")
                                {
                                    msgItem.Subject = item["subject"].ToString();
                                }
                                else
                                {
                                    msgItem.Subject = AppResources.NewMessageInbox + item["subject"].ToString();
                                    msgItem.SubjectWeight = FontWeights.Bold;
                                }
                                msgItem.ThreadId = item["thread_id"].ToString();
                                this.listBox1.Items.Add(msgItem);
                                this.progressBarMessageLoading.Visibility = System.Windows.Visibility.Collapsed;
                                ((ApplicationBarIconButton)this.ApplicationBar.Buttons[0]).IsEnabled = true;
                                ((ApplicationBarIconButton)this.ApplicationBar.Buttons[1]).IsEnabled = true;
                                ((ApplicationBarIconButton)this.ApplicationBar.Buttons[2]).IsEnabled = true;
                                ((ApplicationBarIconButton)this.ApplicationBar.Buttons[3]).IsEnabled = true;
                            }
                        }
                    }
                    catch (XmlRpcFaultException fex)
                    {
                        //textBlock1.Text = fex.Message;
                    }
                    catch (Exception ex)
                    {
                        //textBlock1.Text = ex.Message;
                    }
                });
            });
        }

        /// <summary>
        /// Get Users
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void cmdGetUsers(object sender, RoutedEventArgs e)
        {

            DrupalConnection.GetInstance().GetProxy().BeginSvPUserCount(true, asr =>
            {
                Dispatcher.BeginInvoke(delegate()
                {
                    try
                    {
                        var getThreadResponse = DrupalConnection.GetInstance().GetProxy().EndSvPUserCount(asr);
                        this.txtUsers.Text = ((XmlRpcStruct)getThreadResponse)["count"].ToString();
                        users = int.Parse(((XmlRpcStruct)getThreadResponse)["count"].ToString());
                    }
                    catch (Exception ex)
                    {
                        this.txtUsers.Text = ex.Message;
                    }
                });
            }
            );
        }

        private void listBox1_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            ListBox myList = (ListBox)sender;
            if (myList.SelectedIndex != -1)
            {
                this.NavigationService.Navigate(new Uri(string.Format("/viewMessage.xaml?threadid={0}", ((PrivatemsgItem)myList.SelectedItem).ThreadId), UriKind.Relative));
            }
            this.listBox1.SelectedIndex = -1;
        }

        private void Panorama_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {

        }

        private void appBarRefresh_Click(object sender, EventArgs e)
        {
            ((ApplicationBarIconButton)this.ApplicationBar.Buttons[0]).IsEnabled = false;
            ((ApplicationBarIconButton)this.ApplicationBar.Buttons[1]).IsEnabled = false;
            ((ApplicationBarIconButton)this.ApplicationBar.Buttons[2]).IsEnabled = false;
            ((ApplicationBarIconButton)this.ApplicationBar.Buttons[3]).IsEnabled = false;
            this.progressBarMessageLoading.Visibility = System.Windows.Visibility.Visible;
            this.GetUnreadCount();
            this.PrivatemsgGet();
        }

        private void ApplicationBarIconButton_Click(object sender, EventArgs e)
        {
            this.NavigationService.Navigate(new Uri("/sendMessage.xaml", UriKind.Relative));
        }

        private void appBarFolder_Click(object sender, EventArgs e)
        {
            switch (this.currentFolder)
            {
                case PrivatemsgFolder.inbox:
                    this.progressBarMessageLoading.Visibility = System.Windows.Visibility.Visible;
                    ((ApplicationBarIconButton)this.ApplicationBar.Buttons[0]).IsEnabled = false;
                    ((ApplicationBarIconButton)this.ApplicationBar.Buttons[1]).IsEnabled = false;
                    ((ApplicationBarIconButton)this.ApplicationBar.Buttons[2]).IsEnabled = false;
                    ((ApplicationBarIconButton)this.ApplicationBar.Buttons[3]).IsEnabled = false;
                    ((ApplicationBarIconButton)this.ApplicationBar.Buttons[2]).Text = AppResources.appbarInbox;
                    this.labelFolderTitle.Text = AppResources.Sent;
                    this.currentFolder = PrivatemsgFolder.sent;
                    this.PrivatemsgGet();
                    break;
                case PrivatemsgFolder.sent:
                    this.progressBarMessageLoading.Visibility = System.Windows.Visibility.Visible;
                    ((ApplicationBarIconButton)this.ApplicationBar.Buttons[0]).IsEnabled = false;
                    ((ApplicationBarIconButton)this.ApplicationBar.Buttons[1]).IsEnabled = false;
                    ((ApplicationBarIconButton)this.ApplicationBar.Buttons[2]).IsEnabled = false;
                    ((ApplicationBarIconButton)this.ApplicationBar.Buttons[3]).IsEnabled = false;
                    ((ApplicationBarIconButton)this.ApplicationBar.Buttons[2]).Text = AppResources.appbarSent;
                    this.labelFolderTitle.Text = AppResources.Inbox;
                    this.currentFolder = PrivatemsgFolder.inbox;
                    this.PrivatemsgGet();
                    break;
                default:
                    break;
            }
        }

        private void appBarSettings_Click(object sender, EventArgs e)
        {
            this.NavigationService.Navigate(new Uri("/settings.xaml", UriKind.Relative));
        }

        private void ReloadStrings()
        {
            ((ApplicationBarIconButton)this.ApplicationBar.Buttons[0]).Text = AppResources.appbarRefresh;
            ((ApplicationBarIconButton)this.ApplicationBar.Buttons[1]).Text = AppResources.appbarNew;
            ((ApplicationBarIconButton)this.ApplicationBar.Buttons[2]).Text = AppResources.appbarSent;
            ((ApplicationBarIconButton)this.ApplicationBar.Buttons[3]).Text = AppResources.appbarSettings;

            labelFolderTitle.Text = AppResources.Inbox;
            labelEvents.Text = AppResources.Events;
            labelBlogs.Text = AppResources.Blogs;
            labelMessagesTitle.Text = AppResources.Messages;
            labelUsers.Text = AppResources.Users;
        }

        private void button2_Click(object sender, RoutedEventArgs e)
        {
            DrupalConnection.GetInstance().GetProxy().BeginSvPUserIndex(asr =>
            {
                Dispatcher.BeginInvoke(delegate()
                {
                    this.txtUsers.Text = "";
                    try
                    {
                        var getThreadResponse = DrupalConnection.GetInstance().GetProxy().EndSvPUserIndex(asr);
                        foreach (XmlRpcStruct item in ((XmlRpcStruct[])getThreadResponse))
                        {
                            this.txtUsers.Text = this.txtUsers.Text + item["name"] + "\r\n";
                        }
                        this.txtUsers.Text = "DONEEEEEEEEE\r\n" + this.txtUsers.Text;
                    }
                    catch (Exception ex)
                    {
                        this.txtUsers.Text = ex.Message;
                    }
                });
            }
            );

        }

        private void testEventsList_Click_1(object sender, RoutedEventArgs e)
        {
            DrupalConnection.GetInstance().GetProxy().BeginSvPEventsList(asr =>
            {
                Dispatcher.BeginInvoke(delegate()
                {
                    try
                    {
                        var getThreadResponse = DrupalConnection.GetInstance().GetProxy().EndSvPEventsList(asr);
                        this.eventstext.Text = getThreadResponse.ToString();
                    }
                    catch (InvalidCastException)
                    {
                        this.eventstext.Text = "ziadna akcia v dohlade";
                    }
                    catch (Exception ex)
                    {
                        this.eventstext.Text = ex.Message;
                    }
                });
            }
            );
        }

        private void button4_Click(object sender, RoutedEventArgs e)
        {
            DrupalConnection.GetInstance().GetProxy().BeginSvPEventSign(10148, 85802, "EskiMag", asr =>
            {
                Dispatcher.BeginInvoke(delegate()
                {
                    try
                    {
                        var getThreadResponse = DrupalConnection.GetInstance().GetProxy().EndSvPEventSign(asr);
                        this.eventstext.Text = getThreadResponse.ToString();
                    }
                    catch (InvalidCastException)
                    {
                        this.eventstext.Text = "tralala";
                    }
                    catch (Exception ex)
                    {
                        this.eventstext.Text = ex.Message;
                    }
                });
            }
        );
        }
    }

    public class PrivatemsgItem
    {
        public PrivatemsgItem()
        {
            this.From = string.Empty;
        }
        public string Subject { get; set; }
        public FontWeight SubjectWeight { get; set; }
        public string From { get; set; }
        public string IsNew { get; set; }
        public string ThreadId { get; set; }
    }
}


text:
module.exports = ErrorBanner;

const { epc } = require('../ui.js');

function ErrorBanner(props) {
  return epc('div', {className: 'error-banner'}, props.message);
}


text:
package org.seasar.doma.it.entity;

import org.seasar.doma.Entity;
import org.seasar.doma.GeneratedValue;
import org.seasar.doma.GenerationType;
import org.seasar.doma.Id;
import org.seasar.doma.OriginalStates;
import org.seasar.doma.SequenceGenerator;
import org.seasar.doma.Table;

@Entity
@Table(name = "SEQUENCE_STRATEGY")
public class SequenceStrategy {

  @Id
  @GeneratedValue(strategy = GenerationType.SEQUENCE)
  @SequenceGenerator(sequence = "SEQUENCE_STRATEGY_ID", allocationSize = 50)
  Integer id;

  String value;

  @OriginalStates SequenceStrategy originalStates;

  public Integer getId() {
    return id;
  }

  public void setId(Integer id) {
    this.id = id;
  }

  public String getValue() {
    return value;
  }

  public void setValue(String value) {
    this.value = value;
  }
}


text:
/**
 *  @file Elements.cpp
 *  This file contains a database of atomic weights.
 */

//  Copyright 2003  California Institute of Technology

#include "cantera/thermo/Elements.h"
#include "cantera/base/ctml.h"
#include "cantera/base/stringUtils.h"

using namespace ctml;
using namespace std;

namespace Cantera
{

/*! Database for atomic molecular weights
 *  Values are taken from the 1989 Standard Atomic Weights, CRC
 *
 *  awTable[] is a static function with scope limited to this file.
 *  It can only be referenced via the LookupWtElements() function.
 *
 *  units = kg / kg-mol (or equivalently gm / gm-mol)
 *
 * This structure was picked because it's simple, compact, and extensible.
 */
struct awData {
    char name[4];         //!< Null Terminated name, First letter capitalized
    double atomicWeight;  //!< atomic weight in kg / kg-mol
};

/*!
 *  @var static struct awData aWTable[]
 *  \brief aWTable is a vector containing the atomic weights database.
 *
 *  The size of the table is given by the initial instantiation.
 */
static struct awData aWTable[] = {
    {"H",    1.00794},
    {"D",    2.0    },
    {"Tr",   3.0    },
    {"He",   4.002602},
    {"Li",   6.941  },
    {"Be",   9.012182},
    {"B",   10.811  },
    {"C",   12.011  },
    {"N",   14.00674},
    {"O",   15.9994 },
    {"F",   18.9984032},
    {"Ne",  20.1797 },
    {"Na",  22.98977},
    {"Mg",  24.3050 },
    {"Al",  26.98154},
    {"Si",  28.0855 },
    {"P",   30.97376},
    {"S",   32.066  },
    {"Cl",  35.4527 },
    {"Ar",  39.948  },
    {"K",   39.0983 },
    {"Ca",  40.078  },
    {"Sc",  44.95591},
    {"Ti",  47.88   },
    {"V",   50.9415 },
    {"Cr",  51.9961 },
    {"Mn",  54.9381 },
    {"Fe",  55.847  },
    {"Co",  58.9332 },
    {"Ni",  58.69   },
    {"Cu",  63.546  },
    {"Zn",  65.39   },
    {"Ga",  69.723  },
    {"Ge",  72.61   },
    {"As",  74.92159},
    {"Se",  78.96   },
    {"Br",  79.904  },
    {"Kr",  83.80   },
    {"Rb",  85.4678 },
    {"Sr",  87.62   },
    {"Y",   88.90585},
    {"Zr",  91.224  },
    {"Nb",  92.90638},
    {"Mo",  95.94   },
    {"Tc",  97.9072 },
    {"Ru", 101.07   },
    {"Rh", 102.9055 },
    {"Pd", 106.42   },
    {"Ag", 107.8682 },
    {"Cd", 112.411  },
    {"In", 114.82   },
    {"Sn", 118.710  },
    {"Sb", 121.75   },
    {"Te", 127.6    },
    {"I",  126.90447},
    {"Xe", 131.29   },
    {"Cs", 132.90543},
    {"Ba", 137.327  },
    {"La", 138.9055 },
    {"Ce", 140.115  },
    {"Pr", 140.90765},
    {"Nd", 144.24   },
    {"Pm", 144.9127 },
    {"Sm", 150.36   },
    {"Eu", 151.965  },
    {"Gd", 157.25   },
    {"Tb", 158.92534},
    {"Dy", 162.50   },
    {"Ho", 164.93032},
    {"Er", 167.26   },
    {"Tm", 168.93421},
    {"Yb", 173.04   },
    {"Lu", 174.967  },
    {"Hf", 178.49   },
    {"Ta", 180.9479 },
    {"W",  183.85   },
    {"Re", 186.207  },
    {"Os", 190.2    },
    {"Ir", 192.22   },
    {"Pt", 195.08   },
    {"Au", 196.96654},
    {"Hg", 200.59   },
    {"Ti", 204.3833 },
    {"Pb", 207.2    },
    {"Bi", 208.98037},
    {"Po", 208.9824 },
    {"At", 209.9871 },
    {"Rn", 222.0176 },
    {"Fr", 223.0197 },
    {"Ra", 226.0254 },
    {"Ac", 227.0279 },
    {"Th", 232.0381 },
    {"Pa", 231.03588},
    {"U",  238.0508 },
    {"Np", 237.0482 },
    {"Pu", 244.0482 }
};

//  Static function to look up an atomic weight
/*
 *   This static function looks up the argument string in the
 *   database above and returns the associated molecular weight.
 *   The data are from the periodic table.
 *
 *  Note: The idea behind this function is to provide a unified
 *        source for the element atomic weights. This helps to
 *        ensure that mass is conserved.
 *
 *  @param s  String, Only the first 3 characters are significant
 *
 *  @return
 *    Return value contains the atomic weight of the element
 *    If a match for the string is not found, a value of -1.0 is
 *    returned.
 *
 *  @exception CanteraError
 *    If a match is not found, a CanteraError is thrown as well
 */
doublereal Elements::LookupWtElements(const std::string& ename)
{
    int num = sizeof(aWTable) / sizeof(struct awData);
    string s3 = ename.substr(0,3);
    for (int i = 0; i < num; i++) {
        if (s3 == aWTable[i].name) {
            return aWTable[i].atomicWeight;
        }
    }
    throw CanteraError("LookupWtElements", "element not found");
    return -1.0;
}

doublereal LookupWtElements(const std::string& ename)
{
    int num = sizeof(aWTable) / sizeof(struct awData);
    string s3 = ename.substr(0,3);
    for (int i = 0; i < num; i++) {
        if (s3 == aWTable[i].name) {
            return aWTable[i].atomicWeight;
        }
    }
    throw CanteraError("LookupWtElements", "element not found");
    return -1.0;
}

//!  Exception class to indicate a fixed set of elements.
/*!
 *   This class is used to warn the user when the number of elements
 *   are changed after at least one species is defined.
 */
class ElementsFrozen : public CanteraError
{
public:
    //! Constructor for class
    /*!
     * @param func Function where the error occurred.
     */
    ElementsFrozen(string func)
        : CanteraError(func,
                       "elements cannot be added after species.") {}
};

/*
 *  Elements Class Constructor
 *    We initialize all internal variables to zero here.
 */
Elements::Elements() :
    m_mm(0),
    m_elementsFrozen(false),
    m_elem_type(0),
    numSubscribers(0)
{
    warn_deprecated("class Elements",
        "Functionality is now part of class Phase. "
        "To be removed after Cantera 2.2.");
}

/*
 * Elements Class Destructor
 *   If the number of subscribers is not zero, through an error.
 *   A logic problem has occurred.
 *
 *  @exception CanteraError
 */
Elements::~Elements()
{
    if (numSubscribers != 0) {
        throw CanteraError("~Elements", "numSubscribers not zero");
    }
}

Elements::Elements(const Elements& right) :
    m_mm(0),
    m_elementsFrozen(false),
    numSubscribers(0)
{
    *this = right;
}

Elements& Elements::operator=(const Elements& right)
{
    if (&right == this) {
        return *this;
    }

    m_mm             = right.m_mm;
    m_elementsFrozen = right.m_elementsFrozen;
    m_atomicWeights  = right.m_atomicWeights;
    m_atomicNumbers  = right.m_atomicNumbers;
    m_elementNames   = right.m_elementNames;
    m_entropy298     = right.m_entropy298;
    m_elem_type      = right.m_elem_type;
    numSubscribers = 0;

    return *this;
}

/*
 * freezeElements():
 *
 *   Set the freeze flag. This is a prerequesite to other
 *   activivities, i.e., this is done before species are defined.
 */
void Elements::freezeElements()
{
    m_elementsFrozen = true;
}

/*
 * elementIndex():
 *
 * Index of element named \c name. The index is an integer
 * assigned to each element in the order it was added,
 * beginning with 0 for the first element.  If \c name is not
 * the name of an element in the set, then the value -1 is
 * returned.
 *
 */
int Elements::elementIndex(const std::string& name) const
{
    for (int i = 0; i < m_mm; i++) {
        if (m_elementNames[i] == name) {
            return i;
        }
    }
    return -1;
}

/*
 *
 * Name of the element with index \c m.  @param m Element
 * index. If m < 0 or m >= nElements() an exception is thrown.
 */
string Elements::elementName(int m) const
{
    if (m < 0 || m >= nElements()) {
        throw CanteraError("Elements::elementName()", "out of bounds: " + int2str(m) + " " + int2str(nElements()));
    }
    return m_elementNames[m];
}

doublereal Elements::entropyElement298(int m) const
{
    AssertThrowMsg(m_entropy298[m] != ENTROPY298_UNKNOWN,
                   "Elements::entropy298",
                   "Entropy at 298 K of element is unknown");
    AssertTrace(m >= 0 && m < m_mm);
    return m_entropy298[m];
}
//====================================================================================================================
//! Return the element constraint type
/*!
 * Possible types include:
 *
 * CT_ELEM_TYPE_TURNEDOFF         -1
 * CT_ELEM_TYPE_ABSPOS           0
 * CT_ELEM_TYPE_ELECTRONCHARGE   1
 * CT_ELEM_TYPE_CHARGENEUTRALITY 2
 * CT_ELEM_TYPE_LATTICERATIO 3
 * CT_ELEM_TYPE_KINETICFROZEN 4
 * CT_ELEM_TYPE_SURFACECONSTRAINT 5
 * CT_ELEM_TYPE_OTHERCONSTRAINT  6
 *
 * The default is  CT_ELEM_TYPE_ABSPOS
 */
int Elements::elementType(int m) const
{
    return m_elem_type[m];
}
//====================================================================================================================
// Change the element type of the mth constraint
/*
 *  Reassigns an element type
 *
 *  @param m  Element index
 *  @param elem_type New elem type to be assigned
 *
 *  @return Returns the old element type
 */
int Elements::changeElementType(int m, int elem_type)
{
    int old =  m_elem_type[m];
    m_elem_type[m] = elem_type;
    return old;
}
//====================================================================================================================
/*
 *
 * Add an element to the current set of elements in the current object.
 * @param symbol  symbol string
 * @param weight  atomic weight in kg/kmol.
 *
 *  The default weight is a special value, which will cause the
 *  routine to look up the actual weight via a string lookup.
 *
 *  There are two interfaces to this routine. The XML interface
 *  looks up the required parameters for the regular interface
 *  and then calls the base routine.
 */
void Elements::addElement(const std::string& symbol, doublereal weight)
{
    if (weight == -12345.0) {
        weight = LookupWtElements(symbol);
        if (weight < 0.0) {
            throw ElementsFrozen("addElement");
        }
    }
    if (m_elementsFrozen) {
        throw ElementsFrozen("addElement");
        return;
    }
    m_atomicWeights.push_back(weight);
    m_elementNames.push_back(symbol);
    if (symbol == "E") {
        m_elem_type.push_back(CT_ELEM_TYPE_ELECTRONCHARGE);
    } else {
        m_elem_type.push_back(CT_ELEM_TYPE_ABSPOS);
    }

    m_mm++;
}
//===========================================================================================================
void Elements::addElement(const XML_Node& e)
{
    doublereal weight = fpValue(e["atomicWt"]);
    string symbol = e["name"];
    addElement(symbol, weight);
}
//===========================================================================================================
/*
 *  addUniqueElement():
 *
 * Add a unique element to the set. This routine will not allow
 * duplicate elements to be input.
 *
 * @param symbol  symbol string
 * @param weight  atomic weight in kg/kmol.
 *
 *
 *  The default weight is a special value, which will cause the
 *  routine to look up the actual weight via a string lookup.
 */
void Elements::addUniqueElement(const std::string& symbol, doublereal weight,
                                int atomicNumber_, doublereal entropy298,
                                int elem_type)
{
    if (weight == -12345.0) {
        weight =  LookupWtElements(symbol);
        if (weight < 0.0) {
            throw ElementsFrozen("addElement");
        }
    }
    /*
     * First decide if this element has been previously added
     * by conducting a string search. If it unique, add it to
     * the list.
     */
    int ifound = 0;
    int i = 0;
    for (vector<string>::const_iterator it = m_elementNames.begin();
            it < m_elementNames.end(); ++it, ++i) {
        if (*it == symbol) {
            ifound = 1;
            break;
        }
    }
    if (!ifound) {
        if (m_elementsFrozen) {
            throw ElementsFrozen("addElement");
            return;
        }
        m_atomicWeights.push_back(weight);
        m_elementNames.push_back(symbol);
        m_atomicNumbers.push_back(atomicNumber_);
        m_entropy298.push_back(entropy298);
        if (symbol == "E") {
            m_elem_type.push_back(CT_ELEM_TYPE_ELECTRONCHARGE);
        } else {
            m_elem_type.push_back(elem_type);
        }
        m_mm++;
    } else {
        if (m_atomicWeights[i] != weight) {
            throw CanteraError("AddUniqueElement",
                               "Duplicate Elements (" + symbol + ") have different weights");
        }
    }
}

/*
 * @todo call addUniqueElement(symbol, weight) instead of
 * addElement.
 */
void Elements::addUniqueElement(const XML_Node& e)
{
    doublereal weight = 0.0;
    if (e.hasAttrib("atomicWt")) {
        weight = fpValue(stripws(e["atomicWt"]));
    }
    int anum = 0;
    if (e.hasAttrib("atomicNumber")) {
        anum = atoi(stripws(e["atomicNumber"]).c_str());
    }
    string symbol = e["name"];
    doublereal entropy298 = ENTROPY298_UNKNOWN;
    if (e.hasChild("entropy298")) {
        XML_Node& e298Node = e.child("entropy298");
        if (e298Node.hasAttrib("value")) {
            entropy298 = fpValueCheck(stripws(e298Node["value"]));
        }
    }
    if (weight != 0.0) {
        addUniqueElement(symbol, weight, anum, entropy298);
    } else {
        addUniqueElement(symbol);
    }
}

// True if freezeElements has been called.
bool Elements::elementsFrozen() const
{
    return m_elementsFrozen;
}

/*
 * clear()
 *
 *   Remove all elements from the structure.
 */
void Elements::clear()
{
    m_mm = 0;
    m_atomicWeights.resize(0);
    m_elementNames.resize(0);
    m_entropy298.resize(0);
    m_elem_type.resize(0);
    m_elementsFrozen = false;
}

/*
 * ready():
 *
 * True if the elements have been frozen
 */
bool Elements::ready() const
{
    return m_elementsFrozen;
}

void Elements::addElementsFromXML(const XML_Node& phase)
{

    // get the declared element names
    if (! phase.hasChild("elementArray")) {
        throw CanteraError("Elements::addElementsFromXML",
                           "phase xml node doesn't have \"elementArray\" XML Node");
    }
    XML_Node& elements = phase.child("elementArray");
    vector<string> enames;
    getStringArray(elements, enames);

    // // element database defaults to elements.xml
    string element_database = "elements.xml";
    if (elements.hasAttrib("datasrc")) {
        element_database = elements["datasrc"];
    }

    XML_Node* doc = get_XML_File(element_database);
    XML_Node* dbe = &doc->child("ctml/elementData");

    XML_Node& root = phase.root();
    XML_Node* local_db = 0;
    if (root.hasChild("ctml")) {
        if (root.child("ctml").hasChild("elementData")) {
            local_db = &root.child("ctml/elementData");
        }
    }

    int nel = static_cast<int>(enames.size());
    int i;
    string enm;
    XML_Node* e = 0;
    for (i = 0; i < nel; i++) {
        e = 0;
        if (local_db) {
            e = local_db->findByAttr("name",enames[i]);
        }
        if (!e) {
            e = dbe->findByAttr("name",enames[i]);
        }
        if (e) {
            addUniqueElement(*e);
        } else {
            throw CanteraError("addElementsFromXML","no data for element "
                               +enames[i]);
        }
    }

}

/*
 *  subscribe(), unsubscribe(), and reportSubscriptions():
 *
 *   Handles setting and reporting the number of subscriptions to this
 *   object.
 */
void Elements::subscribe()
{
    ++numSubscribers;
}
int Elements::unsubscribe()
{
    --numSubscribers;
    return numSubscribers;
}
int Elements::reportSubscriptions() const
{
    return numSubscribers;
}

/********************* GLOBAL STATIC SECTION **************************/
/*
 *  We keep track of a vector of pointers to element objects.
 *  Initially there are no Elements objects. Whenever one is created,
 *  the pointer to that object is added onto this list.
 */
vector<Elements*> Elements::Global_Elements_List;
/***********************************************************************/
}


text:
@interface ArtTransformViewController : UIViewController

@end


text:
import glCore from 'pixi-gl-core';
import createIndicesForQuads from '../../../utils/createIndicesForQuads';

/**
 * Helper class to create a quad
 *
 * @class
 * @memberof PIXI
 */
export default class Quad
{
    /**
     * @param {WebGLRenderingContext} gl - The gl context for this quad to use.
     * @param {object} state - TODO: Description
     */
    constructor(gl, state)
    {
        /*
         * the current WebGL drawing context
         *
         * @member {WebGLRenderingContext}
         */
        this.gl = gl;

        /**
         * An array of vertices
         *
         * @member {Float32Array}
         */
        this.vertices = new Float32Array([
            -1, -1,
            1, -1,
            1, 1,
            -1, 1,
        ]);

        /**
         * The Uvs of the quad
         *
         * @member {Float32Array}
         */
        this.uvs = new Float32Array([
            0, 0,
            1, 0,
            1, 1,
            0, 1,
        ]);

        this.interleaved = new Float32Array(8 * 2);

        for (let i = 0; i < 4; i++)
        {
            this.interleaved[i * 4] = this.vertices[(i * 2)];
            this.interleaved[(i * 4) + 1] = this.vertices[(i * 2) + 1];
            this.interleaved[(i * 4) + 2] = this.uvs[i * 2];
            this.interleaved[(i * 4) + 3] = this.uvs[(i * 2) + 1];
        }

        /*
         * @member {Uint16Array} An array containing the indices of the vertices
         */
        this.indices = createIndicesForQuads(1);

        /*
         * @member {glCore.GLBuffer} The vertex buffer
         */
        this.vertexBuffer = glCore.GLBuffer.createVertexBuffer(gl, this.interleaved, gl.STATIC_DRAW);

        /*
         * @member {glCore.GLBuffer} The index buffer
         */
        this.indexBuffer = glCore.GLBuffer.createIndexBuffer(gl, this.indices, gl.STATIC_DRAW);

        /*
         * @member {glCore.VertexArrayObject} The index buffer
         */
        this.vao = new glCore.VertexArrayObject(gl, state);
    }

    /**
     * Initialises the vaos and uses the shader.
     *
     * @param {PIXI.Shader} shader - the shader to use
     */
    initVao(shader)
    {
        this.vao.clear()
        .addIndex(this.indexBuffer)
        .addAttribute(this.vertexBuffer, shader.attributes.aVertexPosition, this.gl.FLOAT, false, 4 * 4, 0)
        .addAttribute(this.vertexBuffer, shader.attributes.aTextureCoord, this.gl.FLOAT, false, 4 * 4, 2 * 4);
    }

    /**
     * Maps two Rectangle to the quad.
     *
     * @param {PIXI.Rectangle} targetTextureFrame - the first rectangle
     * @param {PIXI.Rectangle} destinationFrame - the second rectangle
     * @return {PIXI.Quad} Returns itself.
     */
    map(targetTextureFrame, destinationFrame)
    {
        let x = 0; // destinationFrame.x / targetTextureFrame.width;
        let y = 0; // destinationFrame.y / targetTextureFrame.height;

        this.uvs[0] = x;
        this.uvs[1] = y;

        this.uvs[2] = x + (destinationFrame.width / targetTextureFrame.width);
        this.uvs[3] = y;

        this.uvs[4] = x + (destinationFrame.width / targetTextureFrame.width);
        this.uvs[5] = y + (destinationFrame.height / targetTextureFrame.height);

        this.uvs[6] = x;
        this.uvs[7] = y + (destinationFrame.height / targetTextureFrame.height);

        x = destinationFrame.x;
        y = destinationFrame.y;

        this.vertices[0] = x;
        this.vertices[1] = y;

        this.vertices[2] = x + destinationFrame.width;
        this.vertices[3] = y;

        this.vertices[4] = x + destinationFrame.width;
        this.vertices[5] = y + destinationFrame.height;

        this.vertices[6] = x;
        this.vertices[7] = y + destinationFrame.height;

        return this;
    }

    /**
     * Binds the buffer and uploads the data
     *
     * @return {PIXI.Quad} Returns itself.
     */
    upload()
    {
        for (let i = 0; i < 4; i++)
        {
            this.interleaved[i * 4] = this.vertices[(i * 2)];
            this.interleaved[(i * 4) + 1] = this.vertices[(i * 2) + 1];
            this.interleaved[(i * 4) + 2] = this.uvs[i * 2];
            this.interleaved[(i * 4) + 3] = this.uvs[(i * 2) + 1];
        }

        this.vertexBuffer.upload(this.interleaved);

        return this;
    }

    /**
     * Removes this quad from WebGL
     */
    destroy()
    {
        const gl = this.gl;

        gl.deleteBuffer(this.vertexBuffer);
        gl.deleteBuffer(this.indexBuffer);
    }
}


text:
<?php
/*---------------------------------------------------------------------------
  网络民兵指挥管理系统 - 让工作更轻松快乐

  Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )

  Author:

  Support:
 -------------------------------------------------------------------------*/

namespace Home\Model;
use Think\Model\ViewModel;

class  InfoViewModel extends ViewModel {
	public $viewFields=array(
		'Info'=>array('*'),
		'SystemFolder'=>array('name'=>'folder_name','_on'=>'Info.folder=SystemFolder.id')
		);
}
?>


text:
require "stubs/user"

class TestConnection
  attr_reader :identifiers, :logger, :current_user, :server, :transmissions

  delegate :pubsub, to: :server

  def initialize(user = User.new("lifo"), coder: ActiveSupport::JSON, subscription_adapter: SuccessAdapter)
    @coder = coder
    @identifiers = [ :current_user ]

    @current_user = user
    @logger = ActiveSupport::TaggedLogging.new ActiveSupport::Logger.new(StringIO.new)
    @server = TestServer.new(subscription_adapter: subscription_adapter)
    @transmissions = []
  end

  def transmit(cable_message)
    @transmissions << encode(cable_message)
  end

  def last_transmission
    decode @transmissions.last if @transmissions.any?
  end

  def decode(websocket_message)
    @coder.decode websocket_message
  end

  def encode(cable_message)
    @coder.encode cable_message
  end
end


text:
<!DOCTYPE html>

    <meta charset="UTF-8"/>
    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"/>
    <link rel="stylesheet" href="css/styles.css"/>
    <link rel="stylesheet" href="css/tooltipster.css"/>

    <title></title>

	<?php
		include "config.php";

		$conexion=mysqli_connect($host,$username,$password,$db_name) or die("Problemas con la conexión");
		$acentos = $conexion->query("SET NAMES 'utf8'");

		$registrosComuna = mysqli_query($conexion,"SELECT * FROM comuna ORDER BY comuna_nombre asc;") or die("Problemas en el select de comuna".mysqli_error($conexion));

	?>

			<?php
				include "menu.php";
			?>

AL PARTICIPAR PODRÁS GANAR CIENTOS DE GIFTCARDS

Para comenzar ingresa tus datos

          <form id="dale" class="ed-container" method="post" action="validar-nro-factura.php">

              Nombre
              <input type="text" name="nombre" required />

              Apellido
              <input type="text" name="apellido" required />

              Mail
              Teléfono
              <input type="text" class="half righ-margin" name="email" id="mail" required />
              <input type="text" class="half" id="telefono" name="telefono" required />

              Selecciona tu comuna
              <select name="comuna">
				<?php
					while($reg=mysqli_fetch_array($registrosComuna)){
						$nombreComuna = $reg['comuna_nombre'];
						echo "<option value=\"$nombreComuna\">$nombreComuna</option>";
					}
				?>
              </select>

              Ingresa tu número de factura
              <input type="text" name="nro_factura" />

              Ingresa el número de gift card
              <input type="text" name="nro_gift_card" />

              <input type="submit" value="Ir al juego"/>

          </form>


text:
package cz.muni.ics.phil.bis.api;

import cz.muni.ics.phil.bis.api.domain.ResultTypeDTO;
import java.util.List;

/**
 *
 * @author Dominik Szalai - emptulik at gmail.com
 */
public interface ResultTypeService
{

    void createResultType(ResultTypeDTO resultType) throws IllegalArgumentException;

    void updateResultType(ResultTypeDTO resultType) throws IllegalArgumentException;

    void deleteResultType(ResultTypeDTO resultType) throws IllegalArgumentException;

    ResultTypeDTO getResultTypeByID(Long id) throws IllegalArgumentException;

    ResultTypeDTO getResultTypeByTitle(String title) throws IllegalArgumentException;

    List<ResultTypeDTO> getAllResultTypes();

}


text:
// Copyright 2009 the Sputnik authors.  All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/**
 * @name: S15.2.4_A1_T2;
 * @section: 15.2.4, 8.6.2;
 * @assertion: Object prototype object has not prototype;
 * @description: Since the Object prototype object has not prototype, deleted toString method can not be found in prototype chain;
*/

//CHECK#1
if (Object.prototype.toString() == false) {
  $ERROR('#1: Object prototype object has not prototype');
}

delete Object.prototype.toString;

// CHECK#2
try {
  Object.prototype.toString();
  $ERROR('#2: Object prototype object has not prototype');
} catch (e) {
  if ((e instanceof TypeError) !== true) {
    $ERROR('#1.1: delete Object.prototype.toString; Object.prototype.toString() throw a TypeError. Actual: ' + (e));
  }
}
//


text:
package org.conqat.engine.commons.defs;

import org.conqat.engine.core.core.AConQATProcessor;

/**
 * {@ConQAT.Doc}
 *
 * @author $Author: deissenb $
 * @version $Rev: 37510 $
 * @ConQAT.Rating GREEN Hash: D65D480061F2558FC1716EB2C8875A53
 */
@AConQATProcessor(description = ConstantBase.DOC)
public class BooleanConstant extends ConstantBase<Boolean> {
	// nothing to implement
}