text:
package exercise.task3_barracksWars_aNewFactory.contracts;

public interface CommandInterpreter {

	Executable interpretCommand(String[] data, String commandName);
}

redpajama_set_name: RedPajamaGithub


text:
svgplot
=========

[![Gem Version](https://img.shields.io/gem/v/svgplot.svg)](https://rubygems.org/gems/svgplot)
[![Dependency Status](https://img.shields.io/gemnasium/akerl/svgplot.svg)](https://gemnasium.com/akerl/svgplot)
[![Code Climate](https://img.shields.io/codeclimate/github/akerl/svgplot.svg)](https://codeclimate.com/github/akerl/svgplot)
[![Coverage Status](https://img.shields.io/coveralls/akerl/svgplot.svg)](https://coveralls.io/r/akerl/svgplot)
[![Build Status](https://img.shields.io/travis/akerl/svgplot.svg)](https://travis-ci.org/akerl/svgplot)
[![MIT Licensed](https://img.shields.io/badge/license-MIT-green.svg)](https://tldrlegal.com/license/mit-license)

SVG creation library forked from [xytis's Rasem fork](https://github.com/xytis/rasem).

## Usage

## Installation

    gem install svgplot

## License

svgplot is released under the MIT License. See the bundled LICENSE file for details.


text:
import { NgModule } from "@angular/core";
import { CommonModule } from "@angular/common";
import { JigsawButtonModule, JigsawNumericInputModule, JigsawDialogModule, JigsawSwitchModule, JigsawRadioModule, JigsawInputModule } from "jigsaw/public_api";
import { DemoTemplateModule } from '../../template/demo-template/demo-template';
import { DocTemplateModule } from '../../template/doc-template/doc-template';
import { DocFooterTemplateModule } from '../../template/doc-footer-template/doc-footer-template';
import { DemoNavigationModule } from '../../template/demo-navigation/demo-navigation';
import { JigsawMarkdownModule } from "../../../libs/markdown/markdown";
import { DialogBasicDemoComponent } from "./basic/demo.component";
import { DialogModalDemoComponent } from "./modal/demo.component";
import { DialogInDomDemoComponent } from "./in-dom/demo.component";
import { DialogPointDemoComponent } from "./point/demo.component";
import { UserDialog2Component } from "./point/user-dialog/user-dialog";
import { DialogTemplateDemoComponent } from "./template/demo.component";
import { DialogCustomizeDemoComponent } from "./customize/demo.component";
import { DialogTopOffSetDemoComponent } from "./top-offset/demo.component";
import { DialogPopupOptionDemoComponent } from "./popup-option/demo.component";
import { DialogComponentDemoComponent } from "./component/demo.component";
import { UserDialogComponent } from "./component/user-dialog/user-dialog";
import { DialogDemoComponent } from "./demo.component";

@NgModule({
    declarations: [
        DialogDemoComponent,
        DialogBasicDemoComponent,
        DialogModalDemoComponent,
        DialogInDomDemoComponent,
        UserDialogComponent,
        DialogComponentDemoComponent,
        UserDialog2Component,
        DialogPointDemoComponent,
        DialogTemplateDemoComponent,
        DialogCustomizeDemoComponent,
        DialogTopOffSetDemoComponent,
        DialogPopupOptionDemoComponent
    ],
    imports: [
        JigsawDialogModule,
        JigsawButtonModule,
        JigsawNumericInputModule,
        JigsawSwitchModule,
        JigsawRadioModule,
        CommonModule,
        DemoTemplateModule,
        DocTemplateModule,
        DocFooterTemplateModule,
        DemoNavigationModule,
        JigsawMarkdownModule,
        JigsawDialogModule,
        JigsawInputModule
    ]
})
export class DialogDemoModule {
}


text:
System Info

{{ browser | json : spacing}}

supported: {{checkSupported}}


text:
/****************************************************************************
 * Included Files
 ****************************************************************************/
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <tinyara/clock.h>
#include <tinyara/ttrace.h>
#include <tinyara/sched.h>

/****************************************************************************
 * Pre-processor Definitions
 ****************************************************************************/
#define TTRACE_EVENT_TYPE_BEGIN    'b'
#define TTRACE_EVENT_TYPE_END      'e'
#define TTRACE_EVENT_TYPE_SCHED    's'

/****************************************************************************
 * Private Type Declarations
 ****************************************************************************/

/****************************************************************************
 * Private Function Prototypes
 ****************************************************************************/

/****************************************************************************
 * Global Function Prototypes
 ****************************************************************************/

/****************************************************************************
 * Global Constant Data
 ****************************************************************************/

/****************************************************************************
 * Global Variables
 ****************************************************************************/
int fd = -1;

/****************************************************************************
 * Private Constant Data
 ****************************************************************************/

/****************************************************************************
 * Private Data
 ****************************************************************************/

/****************************************************************************
 * Private Functions
 ****************************************************************************/
static int is_fd_available(void)
{
	if (fd < 0) {
		fd = open("/dev/ttrace", O_WRONLY);
	}

	return fd;
}

static bool is_tag_available(int tag)
{
	int ret;

	ret = ioctl(fd, TTRACE_FUNC_TAG, tag);
	if (!(ret & tag)) {
		return false;
	}

	return true;
}

#ifdef CONFIG_DEBUG_TTRACE
static void show_packet(struct trace_packet *packet)
{
	int uid;
	int size;

	if (packet->event_type == TTRACE_EVENT_TYPE_SCHED) {
		ttdbg("[%06d:%06d] %03d: %c|prev_comm=%s prev_pid=%u prev_prio=%u prev_state=%u ==> next_comm=%s next_pid=%u next_prio=%u\r\n",
			packet->ts.tv_sec, packet->ts.tv_usec,
			packet->pid,
			(char)packet->event_type,
			packet->msg.sched_msg.prev_comm,
			packet->msg.sched_msg.prev_pid,
			packet->msg.sched_msg.prev_prio,
			packet->msg.sched_msg.prev_state,
			packet->msg.sched_msg.next_comm,
			packet->msg.sched_msg.next_pid,
			packet->msg.sched_msg.next_prio);
		size = sizeof(struct trace_packet);
	} else {
		ttdbg("time: %06d.%06d\r\n", packet->ts.tv_sec, packet->ts.tv_usec);
		ttdbg("event_type: %c, %d\r\n", packet->event_type, packet->event_type);
		ttdbg("pid: %d\r\n", packet->pid);
		ttdbg("codelen: %d\r\n", packet->codelen);

		uid = (packet->codelen & TTRACE_CODE_UNIQUE) >> 7;
		ttdbg("unique code? %d\r\n", uid);
		if (uid == TRUE) {
			ttdbg("uid: %d\r\n", (packet->codelen & ~TTRACE_CODE_UNIQUE));
			size = sizeof(struct trace_packet) - TTRACE_MSG_BYTES;
		} else {
			ttdbg("message: %s\r\n", packet->msg.message);
			size = sizeof(struct trace_packet);
		}
	}

	ttdbg("packet size: %d\r\n", size);
}
#endif

static int send_packet_sched(struct trace_packet *packet)
{
	int ret = 0;
	ret = write(fd, packet, sizeof(struct trace_packet));
	return ret;
}

static int create_packet_sched(struct trace_packet *packet, struct tcb_s *prev, struct tcb_s *next)
{
	int ret = TTRACE_VALID;
	int msg_len = sizeof(struct sched_message);

	gettimeofday(&(packet->ts), NULL);
	packet->event_type = TTRACE_EVENT_TYPE_SCHED;
	packet->pid = getpid();
	packet->codelen = TTRACE_CODE_VARIABLE | msg_len;

	packet->msg.sched_msg.pad = -1;

	if (prev != NULL) {
		memcpy(packet->msg.sched_msg.prev_comm, prev->name, TTRACE_COMM_BYTES);
		packet->msg.sched_msg.prev_pid = prev->pid;
		packet->msg.sched_msg.prev_prio = prev->sched_priority;
		packet->msg.sched_msg.prev_state = prev->task_state;
	} else {
		memcpy(packet->msg.sched_msg.prev_comm, "Idle Task", TTRACE_COMM_BYTES);
		packet->msg.sched_msg.prev_pid = 0;
		packet->msg.sched_msg.prev_prio = 0;
		packet->msg.sched_msg.prev_state = 3;
	}

	if (next != NULL) {
		memcpy(packet->msg.sched_msg.next_comm, next->name, TTRACE_COMM_BYTES);
		packet->msg.sched_msg.next_pid = next->pid;
		packet->msg.sched_msg.next_prio = next->sched_priority;
	} else {
		memcpy(packet->msg.sched_msg.next_comm, "Idle Task", TTRACE_COMM_BYTES);
		packet->msg.sched_msg.next_pid = 0;
		packet->msg.sched_msg.next_prio = 0;
	}

	packet->msg.sched_msg.prev_comm[TTRACE_COMM_BYTES - 1] = '\0';
	packet->msg.sched_msg.next_comm[TTRACE_COMM_BYTES - 1] = '\0';

	return ret;
}

static int send_packet(struct trace_packet *packet)
{
	int ret = 0;

	if (packet->codelen & TTRACE_CODE_UNIQUE) {
		ret = write(fd, packet, sizeof(struct trace_packet) - TTRACE_MSG_BYTES);
	} else {
		ret = write(fd, packet, sizeof(struct trace_packet));
	}

	return ret;
}

static int create_packet(struct trace_packet *packet, char type, char *str, va_list valist)
{
	int ret = TTRACE_VALID;
	int msg_len = strlen(str);
	int div = msg_len / TTRACE_BYTE_ALIGN;
	msg_len = div * TTRACE_BYTE_ALIGN + TTRACE_BYTE_ALIGN;
	if (msg_len > TTRACE_MSG_BYTES) {
		msg_len = TTRACE_MSG_BYTES;
	}

	gettimeofday(&(packet->ts), NULL);
	packet->event_type = (int8_t)type;
	packet->pid = getpid();
	packet->codelen = TTRACE_CODE_VARIABLE | msg_len;

	vsnprintf(packet->msg.message, msg_len, str, valist);

	return ret;
}

static int create_packet_u(struct trace_packet *packet, char type, int8_t uid)
{
	int ret = 0;
	gettimeofday(&(packet->ts), NULL);
	packet->event_type = type;
	packet->pid = getpid();
	packet->codelen = TTRACE_CODE_UNIQUE | uid;

	return ret;
}

/****************************************************************************
 * Public Functions
 ****************************************************************************/
int trace_sched(struct tcb_s *prev_tcb, struct tcb_s *next_tcb)
{
	int ret = TTRACE_VALID;
	int tag = TTRACE_TAG_TASK;
	struct trace_packet packet;

	if (is_fd_available() < 0) {
		return TTRACE_INVALID;
	}

	if (is_tag_available(tag) == TTRACE_INVALID) {
		return TTRACE_INVALID;
	}

	ret = create_packet_sched(&packet, prev_tcb, next_tcb);
	if (ret == TTRACE_INVALID) {
		assert(0);
	}

#ifdef CONFIG_DEBUG_TTRACE
	show_packet(&packet);
#endif

	ret = send_packet_sched(&packet);
	return ret;

}

/****************************************************************************
 * Name: trace_begin
 *
 * Description:
 *   The function trace_begin() performs the same task as trace(_begin() with
 *   the difference that it takes a set of arguments which have been obtained
 *   using the stdarg variable argument list macros.
 *
 ****************************************************************************/
int trace_begin(int tag, char *str, ...)
{
	int ret = TTRACE_VALID;
	struct trace_packet packet;
	va_list ap;

	if (is_fd_available() < 0) {
		return TTRACE_INVALID;
	}

	if (is_tag_available(tag) == TTRACE_INVALID) {
		return TTRACE_INVALID;
	}

	va_start(ap, str);
	ret = create_packet(&packet, TTRACE_EVENT_TYPE_BEGIN, str, ap);
	va_end(ap);
	if (ret == TTRACE_INVALID) {
		assert(0);
	}

#ifdef CONFIG_DEBUG_TTRACE
	show_packet(&packet);
#endif

	ret = send_packet(&packet);
	return ret;
}

int trace_begin_u(int tag, int8_t uid)
{
	int ret = TTRACE_VALID;
	struct trace_packet packet;

	if (is_fd_available() < 0) {
		return TTRACE_INVALID;
	}

	if (is_tag_available(tag) == TTRACE_INVALID) {
		return TTRACE_INVALID;
	}

	ret = create_packet_u(&packet, TTRACE_EVENT_TYPE_BEGIN, uid);
	if (ret == TTRACE_INVALID) {
		assert(0);
	}

#ifdef CONFIG_DEBUG_TTRACE
	show_packet(&packet);
#endif

	ret = send_packet(&packet);
	return ret;
}

/****************************************************************************
 * Name: trace_end
 *
 * Description:
 *   The function trace_end() performs the same task as trace(_begin() with
 *   the difference that it takes a set of arguments which have been obtained
 *   using the stdarg variable argument list macros.
 *
 ****************************************************************************/

int trace_end(int tag)
{
	int ret = TTRACE_VALID;
	struct trace_packet packet;

	if (is_fd_available() < 0) {
		return TTRACE_INVALID;
	}

	if (is_tag_available(tag) == TTRACE_INVALID) {
		return TTRACE_INVALID;
	}

	ret = create_packet_u(&packet, TTRACE_EVENT_TYPE_END, 0);
	if (ret == TTRACE_INVALID) {
		assert(0);
	}

#ifdef CONFIG_DEBUG_TTRACE
	show_packet(&packet);
#endif

	ret = send_packet(&packet);
	return ret;
}

int trace_end_u(int tag)
{
	return trace_end(tag);
}


text:
namespace {
typedef std::pair<int, int> GuestViewID;
typedef std::map<GuestViewID, extensions::GuestViewContainer*>
    GuestViewContainerMap;
static base::LazyInstance<GuestViewContainerMap> g_guest_view_container_map =
    LAZY_INSTANCE_INITIALIZER;
}  // namespace

namespace extensions {

GuestViewContainer::GuestViewContainer(
    content::RenderFrame* render_frame,
    const std::string& mime_type)
    : content::BrowserPluginDelegate(render_frame, mime_type),
      content::RenderFrameObserver(render_frame),
      mime_type_(mime_type),
      element_instance_id_(guestview::kInstanceIDNone),
      render_view_routing_id_(render_frame->GetRenderView()->GetRoutingID()),
      attached_(false),
      attach_pending_(false),
      isolate_(NULL) {
}

GuestViewContainer::~GuestViewContainer() {
  if (element_instance_id_ != guestview::kInstanceIDNone) {
    g_guest_view_container_map.Get().erase(
        GuestViewID(render_view_routing_id_, element_instance_id_));
  }
}

GuestViewContainer* GuestViewContainer::FromID(int render_view_routing_id,
                                               int element_instance_id) {
  GuestViewContainerMap* guest_view_containers =
      g_guest_view_container_map.Pointer();
  GuestViewContainerMap::iterator it = guest_view_containers->find(
      GuestViewID(render_view_routing_id, element_instance_id));
  return it == guest_view_containers->end() ? NULL : it->second;
}

void GuestViewContainer::AttachGuest(int element_instance_id,
                                     int guest_instance_id,
                                     scoped_ptr<base::DictionaryValue> params,
                                     v8::Handle<v8::Function> callback,
                                     v8::Isolate* isolate) {
  // GuestViewContainer supports reattachment (i.e. attached_ == true) but not
  // while a current attach process is pending.
  if (attach_pending_)
    return;

  // Step 1, send the attach params to chrome/.
  render_frame()->Send(new ExtensionHostMsg_AttachGuest(render_view_routing_id_,
                                                        element_instance_id,
                                                        guest_instance_id,
                                                        *params));

  // Step 2, attach plugin through content/.
  render_frame()->AttachGuest(element_instance_id);

  callback_.reset(callback);
  isolate_ = isolate;
  attach_pending_ = true;
}

void GuestViewContainer::SetElementInstanceID(int element_instance_id) {
  GuestViewID guest_view_id(render_view_routing_id_, element_instance_id);
  DCHECK_EQ(element_instance_id_, guestview::kInstanceIDNone);
  DCHECK(g_guest_view_container_map.Get().find(guest_view_id) ==
            g_guest_view_container_map.Get().end());
  element_instance_id_ = element_instance_id;
  g_guest_view_container_map.Get().insert(std::make_pair(guest_view_id, this));
}

void GuestViewContainer::DidFinishLoading() {
  if (mime_type_.empty())
    return;

  DCHECK_NE(element_instance_id_, guestview::kInstanceIDNone);
  render_frame()->Send(new ExtensionHostMsg_CreateMimeHandlerViewGuest(
      routing_id(), html_string_, mime_type_, element_instance_id_));
}

void GuestViewContainer::DidReceiveData(const char* data, int data_length) {
  std::string value(data, data_length);
  html_string_ += value;
}

void GuestViewContainer::OnDestruct() {
  // GuestViewContainer's lifetime is managed by BrowserPlugin so don't let
  // RenderFrameObserver self-destruct here.
}

bool GuestViewContainer::OnMessageReceived(const IPC::Message& message) {
  if (!ShouldHandleMessage(message))
    return false;

  DCHECK_NE(element_instance_id_, guestview::kInstanceIDNone);
  int element_instance_id = guestview::kInstanceIDNone;
  PickleIterator iter(message);
  bool success = iter.ReadInt(&element_instance_id);
  DCHECK(success);
  if (element_instance_id != element_instance_id_)
    return false;

  bool handled = true;
  IPC_BEGIN_MESSAGE_MAP(GuestViewContainer, message)
    IPC_MESSAGE_HANDLER(ExtensionMsg_CreateMimeHandlerViewGuestACK,
                        OnCreateMimeHandlerViewGuestACK)
    IPC_MESSAGE_HANDLER(ExtensionMsg_GuestAttached, OnGuestAttached)
    IPC_MESSAGE_UNHANDLED(handled = false)
  IPC_END_MESSAGE_MAP()
  return handled;
}

void GuestViewContainer::OnCreateMimeHandlerViewGuestACK(
    int element_instance_id) {
  DCHECK_NE(element_instance_id_, guestview::kInstanceIDNone);
  DCHECK_EQ(element_instance_id_, element_instance_id);
  DCHECK(!mime_type_.empty());
  render_frame()->AttachGuest(element_instance_id);
}

void GuestViewContainer::OnGuestAttached(int element_instance_id,
                                         int guest_routing_id) {
  attached_ = true;
  attach_pending_ = false;

  // If we don't have a callback then there's nothing more to do.
  if (callback_.IsEmpty())
    return;

  content::RenderView* guest_proxy_render_view =
      content::RenderView::FromRoutingID(guest_routing_id);
  // TODO(fsamuel): Should we be reporting an error to JavaScript or DCHECKing?
  if (!guest_proxy_render_view)
    return;

  v8::HandleScope handle_scope(isolate_);
  v8::Handle<v8::Function> callback = callback_.NewHandle(isolate_);
  v8::Handle<v8::Context> context = callback->CreationContext();
  if (context.IsEmpty())
    return;

  blink::WebFrame* frame = guest_proxy_render_view->GetWebView()->mainFrame();
  v8::Local<v8::Value> window = frame->mainWorldScriptContext()->Global();

  const int argc = 1;
  v8::Handle<v8::Value> argv[argc] = { window };

  v8::Context::Scope context_scope(context);
  blink::WebScopedMicrotaskSuppression suppression;

  // Call the AttachGuest API's callback with the guest proxy as the first
  // parameter.
  callback->Call(context->Global(), argc, argv);
  callback_.reset();
}

// static
bool GuestViewContainer::ShouldHandleMessage(const IPC::Message& message) {
  switch (message.type()) {
    case ExtensionMsg_CreateMimeHandlerViewGuestACK::ID:
    case ExtensionMsg_GuestAttached::ID:
      return true;
    default:
      break;
  }
  return false;
}

}  // namespace extensions


text:
package org.apache.camel;

/**
 * An exception thrown if an InOut exchange times out receiving the OUT message
 *
 * @version
 */
public class ExchangeTimedOutException extends CamelExchangeException {
    private static final long serialVersionUID = -7899162905421788853L;

    private final long timeout;

    public ExchangeTimedOutException(Exchange exchange, long timeout) {
        super("The OUT message was not received within: " + timeout + " millis", exchange);
        this.timeout = timeout;
    }

    /**
     * Return the timeout which expired in milliseconds
     */
    public long getTimeout() {
        return timeout;
    }
}


text:
@interface SimpleAuthDropboxWebProvider : SimpleAuthProvider

@end


text:
using System;
using System.Linq;
using System.Reflection;
using System.Web.Http.Filters;
using Abp.Application.Services;
using Abp.Dependency;
using Abp.Extensions;
using Abp.Reflection.Extensions;

namespace Abp.WebApi.Controllers.Dynamic.Builders
{
    /// <summary>
    /// This interface is used to define a dynamic api controllers.
    /// </summary>
    /// <typeparam name="T">Type of the proxied object</typeparam>
    internal class BatchApiControllerBuilder<T> : IBatchApiControllerBuilder<T>
    {
        private readonly string _servicePrefix;
        private readonly Assembly _assembly;
        private IFilter[] _filters;
        private Func<Type, string> _serviceNameSelector;
        private Func<Type, bool> _typePredicate;
        private bool _conventionalVerbs;
        private Action<IApiControllerActionBuilder<T>> _forMethodsAction;

        public BatchApiControllerBuilder(Assembly assembly, string servicePrefix)
        {
            _assembly = assembly;
            _servicePrefix = servicePrefix;
        }

        public IBatchApiControllerBuilder<T> Where(Func<Type, bool> predicate)
        {
            _typePredicate = predicate;
            return this;
        }

        public IBatchApiControllerBuilder<T> WithFilters(params IFilter[] filters)
        {
            _filters = filters;
            return this;
        }

        public IBatchApiControllerBuilder<T> WithServiceName(Func<Type, string> serviceNameSelector)
        {
            _serviceNameSelector = serviceNameSelector;
            return this;
        }

        public IBatchApiControllerBuilder<T> ForMethods(Action<IApiControllerActionBuilder> action)
        {
            _forMethodsAction = action;
            return this;
        }

        public IBatchApiControllerBuilder<T> WithConventionalVerbs()
        {
            _conventionalVerbs = true;
            return this;
        }

        public void Build()
        {
            var types =
                from
                    type in _assembly.GetTypes()
                where
                    (type.IsPublic || type.IsNestedPublic) &&
                    type.IsInterface &&
                    typeof(T).IsAssignableFrom(type) &&
                    IocManager.Instance.IsRegistered(type) &&
                    !RemoteServiceAttribute.IsExplicitlyDisabledFor(type)
                select
                    type;

            if (_typePredicate != null)
            {
                types = types.Where(t => _typePredicate(t));
            }

            foreach (var type in types)
            {
                var serviceName = _serviceNameSelector != null
                    ? _serviceNameSelector(type)
                    : GetConventionalServiceName(type);

                if (!string.IsNullOrWhiteSpace(_servicePrefix))
                {
                    serviceName = _servicePrefix + "/" + serviceName;
                }

                var builder = typeof(DynamicApiControllerBuilder)
                    .GetMethod("For", BindingFlags.Public | BindingFlags.Static)
                    .MakeGenericMethod(type)
                    .Invoke(null, new object[] { serviceName });

                if (_filters != null)
                {
                    builder.GetType()
                        .GetMethod("WithFilters", BindingFlags.Public | BindingFlags.Instance)
                        .Invoke(builder, new object[] { _filters });
                }

                if (_conventionalVerbs)
                {
                    builder.GetType()
                       .GetMethod("WithConventionalVerbs", BindingFlags.Public | BindingFlags.Instance)
                       .Invoke(builder, new object[0]);
                }

                if (_forMethodsAction != null)
                {
                    builder.GetType()
                        .GetMethod("ForMethods", BindingFlags.Public | BindingFlags.Instance)
                        .Invoke(builder, new object[] { _forMethodsAction });
                }

                builder.GetType()
                        .GetMethod("Build", BindingFlags.Public | BindingFlags.Instance)
                        .Invoke(builder, new object[0]);
            }
        }

        public static string GetConventionalServiceName(Type type)
        {
            var typeName = type.Name;

            if (typeName.EndsWith("ApplicationService"))
            {
                typeName = typeName.Substring(0, typeName.Length - "ApplicationService".Length);
            }
            else if (typeName.EndsWith("AppService"))
            {
                typeName = typeName.Substring(0, typeName.Length - "AppService".Length);
            }
            else if (typeName.EndsWith("Service"))
            {
                typeName = typeName.Substring(0, typeName.Length - "Service".Length);
            }

            if (typeName.Length > 1 && typeName.StartsWith("I") && char.IsUpper(typeName, 1))
            {
                typeName = typeName.Substring(1);
            }

            return typeName.ToCamelCase();
        }
    }
}


text:
ADD_SENTENCE_TEMPLATE = """\

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

    <form action="/doaddsentence" method="post">

<textarea name="sentencechichar"        rows="2" cols="40"></textarea>

<textarea name="sentencepronunciation"  rows="2" cols="40"></textarea>

<textarea name="sentencetranslation"    rows="2" cols="40"></textarea>

<input type="submit" value="Add sentence">

    </form>
    <form action="/" method="get">

<input type="submit" value="Home">

    </form>
"""

LIST_SENTENCE_TEMPLATE = """\

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

Sentences list

    %s

    <form action="/" method="get">

<input type="submit" value="Home">

    </form>

"""

LOAD_SENTENCES = """\

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

    <form action="/loadsentences" method="post">

<textarea name="sentences" rows="10" cols="40"></textarea>

<input type="submit" value="Load sentences">

   </form>
"""

VIEW_SENTENCE_ADMIN_TEMPLATE = """\

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

%s

%s

%s

    %s

    <form action="/editsentence/%s" method="get">

<input type="submit" value="Edit">

    </form>

    <form action="/deletesentence/%s" method="post">

<input type="submit" value="Delete">

    </form>

    <form action="/addsentence" method="get">

<input type="submit" value="New">

    </form>

    <form action="/listsentences" method="get">

<input type="submit" value="List">

    </form>

    <form action="/" method="get">

<input type="submit" value="Home">

    </form>

"""

VIEW_SENTENCE_USER_TEMPLATE = """\

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

%s

%s

%s

    %s

    <form action="/" method="get">

<input type="submit" value="Home">

    </form>

    <form action="/listsentences" method="get">

<input type="submit" value="List">

    </form>

"""

STAT_SENTENCE_TEMPLATE = """\

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

Sentences Stats

    <form action="/" method="get">

<input type="submit" value="Home">

    </form>

    <form action="/listsentences" method="get">

<input type="submit" value="List">

    </form>

    Sentences number

    %s

    <form action="/" method="get">

<input type="submit" value="Home">

    </form>

    <form action="/listsentences" method="get">

<input type="submit" value="List">

    </form>

"""


text:
/* $NoKeywords: $ */
/*
//
// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved.
// OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert
// McNeel & Associates.
//
// THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
// ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
// MERCHANTABILITY ARE HEREBY DISCLAIMED.
//
// For complete openNURBS copyright information see <http://www.opennurbs.org>.
//
////////////////////////////////////////////////////////////////
*/

#if !defined(OPENNURBS_RANDOM_NUMBER_INC_)
#define OPENNURBS_RANDOM_NUMBER_INC_

ON_BEGIN_EXTERNC

struct ON_RANDOM_NUMBER_CONTEXT
{
  ON__UINT32 mti;     /* mti = 0xFFFFFFFF means mt[] is not initialized */
  ON__UINT32 mt[624]; /* the array for the state vector  */
};

/*
Description:
  Seed a context for on_random_number().
Parameters:
  s - [in]
  rand_context - [out] context to seed.

Remarks:
  on_random_number_seed() does not use any static memory.
Example:
          ON_RAND_CONTEXT rand_context;

          ON__UINT seed = 123;
          on_random_number_seed( seed, &rand_context );

          ON__UINT32 r1 = on_random_number( &rand_context );
          ON__UINT32 r2 = on_random_number( &rand_context );
          ON__UINT32 r3 = on_random_number( &rand_context );
*/
void on_random_number_seed(
        ON__UINT32 s,
        struct ON_RANDOM_NUMBER_CONTEXT* rand_context
        );

/*
Description:
  Get a random number.
Parameters:
  rand_context - [in/out]
    random number context.  The first time rand_context is
    used it must be either initialized by calling on_random_number_seed()
    or rand_context->mti must be set to 0xFFFFFFFF.  Otherwise do not
    modify randcontext between calls to on_random_number.
Returns:
  A random number.
Remarks:
  on_random_number() does not use any static memory.
Example:
          ON_RAND_CONTEXT rand_context;

          ON__UINT seed = 123;
          on_random_number_seed( seed, &rand_context );

          ON__UINT32 r1 = on_random_number( &rand_context );
          ON__UINT32 r2 = on_random_number( &rand_context );
          ON__UINT32 r3 = on_random_number( &rand_context );
*/
ON__UINT32 on_random_number(
        struct ON_RANDOM_NUMBER_CONTEXT* rand_context
        );

/*
Description:
  Seed the random number generator used by on_rand().
Parameters:
  s - [in]
Remarks:
  on_srand() is not thread safe.  It used static global memory
  that is modified by on_srand() and on_rand().
*/
void on_srand(ON__UINT32 s);

/*
Description:
  Get a random number.
Returns:
  A random number.
Remarks:
  on_rand() is not thread safe.  It used static global memory
  that is modified by on_srand() and on_rand().
*/
ON__UINT32 on_rand(void);

ON_END_EXTERNC

#if defined(ON_CPLUSPLUS)

class ON_CLASS ON_RandomNumberGenerator
{
public:
  ON_RandomNumberGenerator();

  /*
  Description:
    Seed the random number generator.
  Parameters:
    s - [in]
  */
  void Seed( ON__UINT32 s );

  /*
  Returns:
    32 bit unsigned random number [0,0xFFFFFFFF] [0,4294967295]
  */
  ON__UINT32 RandomNumber();

  /*
  Returns:
    double in the interval [0.0 and 1.0]
  */
  double RandomDouble();

  /*
  Returns:
    double in the interval [t0,t1]
  */
  double RandomDouble(double t0, double t1);

  /*
  Description:
    Perform a random permuation on an array.
  Parameters:
    base - [in/out]
      Array of element to permute
    nel - [in]
      number of elements in the array.
    sizeof_element
      size of an element in bytes.
  */
  void RandomPermutation(void* base, size_t nel, size_t sizeof_element );

private:
  struct ON_RANDOM_NUMBER_CONTEXT m_rand_context;
};

#endif

#endif


text:
#import <Security/Security.h>
#import "MWXKeychainSuite.h"

@interface MWXKeychainSuite ()
@property (nonatomic,retain) NSMutableDictionary *	items;
@property (nonatomic,retain) NSMutableDictionary *	query;
@end

@interface MWXKeychainSuite (Private)
-(void)setItem:(id)item forKey:(NSString *)key;
-(void)removeItemForKey:(NSString *)key;
-(NSArray *)allItems;
@end

@implementation MWXKeychainSuite

@synthesize	identifier	= _identifier;
@synthesize	accessGroup	= _accessGroup;
@synthesize	items		= _items;
@synthesize	query		= _query;

-(id)init
{
  return [self initWithIdentifier:[[NSBundle mainBundle] bundleIdentifier]
	       accessGroup:nil];
}

-(id)initWithIdentifier:(NSString *)identifier
{
  return [self initWithIdentifier:identifier accessGroup:nil];
}

-(id)initWithIdentifier:(NSString *)identifier
	accessGroup:(NSString *)accessGroup
{
  if ((self = [super init])) {
    _identifier	 = [identifier copy];
    _accessGroup = [accessGroup copy];

    NSMutableDictionary *	query;
    query = [[NSMutableDictionary alloc] init];
    [query setObject:(id)kSecClassGenericPassword forKey:(id)kSecClass];
    [query setObject:identifier forKey:(id)kSecAttrService];
    if (accessGroup != nil) {
#if	TARGET_IPHONE_SIMULATOR
      /*
       * Ignore the access group if running on the iPhone simulator.
       *
       * Apps that are built for the simulator aren't signed, so there's no
       * keychain access group for the simulator to check. This means that all
       * apps can see all keychain items when run on the simulator.
       *
       * If a SecItem contains an access group attribute, SecItemAdd and
       * SecItemUpdate on the simulator will return -25243
       * (errSecNoAccessForItem).
       */
#else
      [query setObject:accessGroup forKey:(id)kSecAttrAccessGroup];
#endif	// TARGET_IPHONE_SIMULATOR
    }
    self.query = query;
    [query release];

    query = [[NSMutableDictionary alloc] initWithDictionary:_query];
    [query setObject:(id)kSecMatchLimitAll forKey:(id)kSecMatchLimit];
    [query setObject:(id)kCFBooleanTrue forKey:(id)kSecReturnAttributes];
    [query setObject:(id)kCFBooleanTrue forKey:(id)kSecReturnData];

    _items = [[NSMutableDictionary alloc] init];
    NSArray *	result = nil;
    OSStatus	status = SecItemCopyMatching((CFDictionaryRef)query,
					     (CFTypeRef)&result);
    if (status == errSecSuccess) {
      for (NSDictionary * dval in result) {
	[_items setObject:[dval objectForKey:(id)kSecValueData]
		forKey:[dval objectForKey:(id)kSecAttrGeneric]];
      }
    }
    [result release];
    [query release];
  }

  return self;
}

-(void)dealloc
{
  [_identifier release],  _identifier  = nil;
  [_accessGroup release], _accessGroup = nil;
  [_items release], _items = nil;
  [_query release], _query = nil;
  [super dealloc];
}

/*****************************************************************************/

-(void)setObject:(id)object forKey:(NSString *)key
{
  if (!key) { return; }

  if (!object) {
    [self removeObjectForKey:key];
  }
  else {
    if ([object isKindOfClass:[NSString class]]) {
      [_items setObject:[object dataUsingEncoding:NSUTF8StringEncoding]
	      forKey:key];
    }
    else if ([object isKindOfClass:[NSData class]]) {
      [_items setObject:object forKey:key];
    }
    else {
      [_items setObject:[NSKeyedArchiver archivedDataWithRootObject:object]
	      forKey:key];
    }
  }
}

-(id)objectForKey:(NSString *)key
{
  id	object = [_items objectForKey:key];

  if (!object) {
    NSMutableDictionary *	query;
    query = [[NSMutableDictionary alloc] initWithDictionary:_query];
    [query setObject:(id)kSecMatchLimitOne forKey:(id)kSecMatchLimit];
    [query setObject:(id)kCFBooleanTrue forKey:(id)kSecReturnData];
    [query setObject:key forKey:(id)kSecAttrGeneric];
    [query setObject:key forKey:(id)kSecAttrAccount];
    NSData *	data   = nil;
    OSStatus	status = SecItemCopyMatching((CFDictionaryRef)query,
					     (CFTypeRef)&data);
    [query release];

    if (status == errSecSuccess) {
      return [data autorelease];
    }
  }

  return object;
}

-(BOOL)containsObjectForKey:(NSString *)key
{
  id	object = [self objectForKey:key];

  return (object != nil);
}

-(NSString *)stringForKey:(NSString *)key
{
  NSData *	data = [self objectForKey:key];
  if (data) {
    NSString *	sval = [[NSString alloc]
			initWithData:data encoding:NSUTF8StringEncoding];
    return [sval autorelease];
  }
  return nil;
}

-(NSNumber *)numberForKey:(NSString *)key
{
  NSData *	data = [self objectForKey:key];
  if (data) {
    return [NSKeyedUnarchiver unarchiveObjectWithData:data];
  }
  return nil;
}

-(NSArray *)arrayForKey:(NSString *)key
{
  NSData *	data = [self objectForKey:key];
  if (data) {
    return [NSKeyedUnarchiver unarchiveObjectWithData:data];
  }
  return nil;
}

-(NSDictionary *)dictionaryForKey:(NSString *)key
{
  NSData *	data = [self objectForKey:key];
  if (data) {
    return [NSKeyedUnarchiver unarchiveObjectWithData:data];
  }
  return nil;
}

-(NSData *)dataForKey:(NSString *)key
{
  return [self objectForKey:key];
}

-(void)setInteger:(NSInteger)value forKey:(NSString *)key
{
  [self setObject:[NSNumber numberWithInteger:value] forKey:key];
}

-(void)setFloat:(float)value forKey:(NSString *)key
{
  [self setObject:[NSNumber numberWithFloat:value] forKey:key];
}

-(void)setDouble:(double)value forKey:(NSString *)key
{
  [self setObject:[NSNumber numberWithDouble:value] forKey:key];
}

-(void)setBool:(BOOL)value forKey:(NSString *)key
{
  [self setObject:[NSNumber numberWithBool:value] forKey:key];
}

-(NSInteger)integerForKey:(NSString *)key
{
  NSNumber *	nval = [self numberForKey:key];

  return [nval integerValue];
}

-(float)floatForKey:(NSString *)key
{
  NSNumber *	nval = [self numberForKey:key];

  return [nval floatValue];
}

-(double)doubleForKey:(NSString *)key
{
  NSNumber *	nval = [self numberForKey:key];

  return [nval doubleValue];
}

-(BOOL)boolForKey:(NSString *)key
{
  NSNumber *	nval = [self numberForKey:key];

  return [nval boolValue];
}

-(void)removeObjectForKey:(NSString *)key
{
  if ([_items objectForKey:key]) {
    [_items removeObjectForKey:key];
  }
  [self removeItemForKey:key];
}

-(void)removeAllObjects
{
  NSArray *	items = [self allItems];
  for (NSDictionary * item in items) {
    NSMutableDictionary *	query;
    query = [[NSMutableDictionary alloc] initWithDictionary:item];
    [query setObject:(id)kSecClassGenericPassword forKey:(id)kSecClass];
    OSStatus	status = SecItemDelete((CFDictionaryRef)query);
    if (status != errSecSuccess) {
#if	DEBUG
      NSLog(@"DEBUG[SecItemDelete] item=%@ %s: error(%ld)", item, __func__, status);
#endif	// DEBUG
    }
    [query release];
  }

  [_items removeAllObjects];
}

-(void)synchronize
{
  [_items enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL * stop) {
    [self setItem:obj forKey:key];
  }];
}

/*****************************************************************************/

-(void)setItem:(id)item forKey:(NSString *)key
{
  if (!key) { return; }

  NSMutableDictionary *	query;
  query = [[NSMutableDictionary alloc] initWithDictionary:_query];
  [query setObject:(id)kSecMatchLimitOne forKey:(id)kSecMatchLimit];
  [query setObject:(id)kCFBooleanTrue forKey:(id)kSecReturnAttributes];
  [query setObject:key forKey:(id)kSecAttrGeneric];
  [query setObject:key forKey:(id)kSecAttrAccount];

  NSArray *	result = nil;
  OSStatus	status = SecItemCopyMatching((CFDictionaryRef)query,
					     (CFTypeRef)&result);
  [result release];

  // XXX: 登録/更新には、以下のキーは不要なので削除
  [query removeObjectForKey:(id)kSecMatchLimit];
  [query removeObjectForKey:(id)kSecReturnAttributes];

  if (status == errSecSuccess) {
    if (item) {
      NSMutableDictionary *	attrs;
      attrs = [[NSMutableDictionary alloc] init];
      [attrs setObject:item forKey:(id)kSecValueData];
      status = SecItemUpdate((CFDictionaryRef)query, (CFDictionaryRef)attrs);
      if (status != errSecSuccess) {
#if	DEBUG
       	NSLog(@"DEBUG[SecItemUpdate] key=%@ item=%@ %s: error(%ld)", key, item, __func__, status);
#endif	// DEBUG
      }
      [attrs release];
    }
    else {
      [self removeItemForKey:key];
    }
  }
  else if (status == errSecItemNotFound) {
    NSMutableDictionary *	attrs;
    attrs = [[NSMutableDictionary alloc] initWithDictionary:query];
    [attrs setObject:item forKey:(id)kSecValueData];
    status = SecItemAdd((CFDictionaryRef)attrs, NULL);
    if (status != errSecSuccess) {
#if	DEBUG
      NSLog(@"DEBUG[SecItemAdd] key=%@ item=%@ attrs=%@ %s: error(%ld)", key, item, attrs, __func__, status);
#endif	// DEBUG
    }
    [attrs release];
  }
  else {
  }
  [query release];
}

-(void)removeItemForKey:(NSString *)key
{
  NSMutableDictionary *	query;
  query = [[NSMutableDictionary alloc] initWithDictionary:_query];
  [query setObject:key forKey:(id)kSecAttrGeneric];
  [query setObject:key forKey:(id)kSecAttrAccount];
  OSStatus	status = SecItemDelete((CFDictionaryRef)query);
  if (status != errSecSuccess && status != errSecItemNotFound) {
#if	DEBUG
    NSLog(@"DEBUG[SecItemDelete] key=%@ %s: error(%ld)", key, __func__, status);
#endif	// DEBUG
  }
  [query release];
}

-(NSArray *)allItems
{
  NSMutableDictionary *	query;
  query = [[NSMutableDictionary alloc] initWithDictionary:_query];
  [query setObject:(id)kSecMatchLimitAll forKey:(id)kSecMatchLimit];
  [query setObject:(id)kCFBooleanTrue forKey:(id)kSecReturnAttributes];
  [query setObject:(id)kCFBooleanTrue forKey:(id)kSecReturnData];

  NSArray *	result = nil;
  OSStatus	status = SecItemCopyMatching((CFDictionaryRef)query,
					     (CFTypeRef)&result);
  [query release];

  if (status == errSecSuccess || status == errSecItemNotFound) {
    return [result autorelease];
  }

  return nil;
}

/*****************************************************************************
 *
 *	Singleton
 *
 *****************************************************************************/
static MWXKeychainSuite *	sharedInstanceKeychainSuite = nil;
static dispatch_queue_t	serialQueue = NULL;

+(MWXKeychainSuite *)sharedInstance
{
  static dispatch_once_t	onceQueue;

  dispatch_once(&onceQueue, ^{
    sharedInstanceKeychainSuite = [[MWXKeychainSuite alloc] init];
  });

  return sharedInstanceKeychainSuite;
}

+(id)allocWithZone:(NSZone *)zone
{
  static dispatch_once_t	onceQueue;

  dispatch_once(&onceQueue, ^{
    serialQueue = dispatch_queue_create("com.magickworx.class.keychainSuite.serialQueue", NULL);
    if (sharedInstanceKeychainSuite == nil) {
      sharedInstanceKeychainSuite = [super allocWithZone:zone];
    }
  });

  return sharedInstanceKeychainSuite;
}

-(id)copyWithZone:(NSZone *)zone
{
  return self;
}

-(id)retain
{
  return self;
}

-(unsigned)retainCount
{
  return UINT_MAX;	// denotes an object that cannot be released
}

-(oneway void)release
{
  // do nothing
}

-(id)autorelease
{
  return self;
}

@end


text:
package redfish

import (
	"encoding/json"
	"strings"
	"testing"

	"github.com/stmcginnis/gofish/common"
)

var accountServiceBody = `{
		"@odata.context": "/redfish/v1/$metadata#AccountService",
		"@odata.id": "/redfish/v1/AccountService",
		"@odata.type": "#AccountService.0.94.0.AccountService",
		"Id": "AccountService",
		"Name": "Account Service",
		"Description": "BMC User Accounts",
		"Modified": "2036-09-11T14:17:21+00:00",
		"AuthFailureLoggingThreshold": 3,
		"MinPasswordLength": 8,
		"Links": {
			"Accounts": {
				"@odata.id": "/redfish/v1/AccountService/Accounts"
			},
			"Roles": {
				"@odata.id": "/redfish/v1/AccountService/Roles"
			}
		}
	}`

// TestAccountService tests the parsing of AccountService objects.
func TestAccountService(t *testing.T) {
	var result AccountService
	err := json.NewDecoder(strings.NewReader(accountServiceBody)).Decode(&result)

	if err != nil {
		t.Errorf("Error decoding JSON: %s", err)
	}

	if result.ID != "AccountService" {
		t.Errorf("Received invalid ID: %s", result.ID)
	}

	if result.Name != "Account Service" {
		t.Errorf("Received invalid name: %s", result.Name)
	}

	if result.AuthFailureLoggingThreshold != 3 {
		t.Errorf("Received invalid authentication failure logging threshold: %d",
			result.AuthFailureLoggingThreshold)
	}

	if result.MinPasswordLength != 8 {
		t.Errorf("Received invalid minimum password length: %d", result.MinPasswordLength)
	}

	if result.accounts != "/redfish/v1/AccountService/Accounts" {
		t.Errorf("Received invalid Accounts: %s", result.accounts)
	}

	if result.roles != "/redfish/v1/AccountService/Roles" {
		t.Errorf("Received invalid Roles: %s", result.roles)
	}
}

// TestAccountServiceUpdate tests the Update call for the account service.
func TestAccountServiceUpdate(t *testing.T) {
	var result AccountService
	err := json.NewDecoder(strings.NewReader(accountServiceBody)).Decode(&result)

	if err != nil {
		t.Errorf("Error decoding JSON: %s", err)
	}

	testClient := &common.TestClient{}
	result.SetClient(testClient)

	orginalValue := result.AccountLockoutCounterResetEnabled
	result.AccountLockoutCounterResetEnabled = !orginalValue
	err = result.Update()

	if err != nil {
		t.Errorf("Error making Update call: %s", err)
	}

	calls := testClient.CapturedCalls()

	if len(calls) != 1 {
		t.Errorf("Expected one call to be made, captured: %v", calls)
	}

	if !strings.Contains(calls[0].Payload, "AccountLockoutCounterResetEnabled") {
		t.Errorf("Unexpected update payload: %s", calls[0].Payload)
	}
}


text:
import {
  Component,
  ElementRef,
  EventEmitter,
  Input,
  Output,
  NgModule,
  ViewEncapsulation,
  Inject,
  Optional,
} from '@angular/core';
import {ENTER, SPACE} from '../keyboard/keycodes';
import {coerceBooleanProperty} from '@angular/cdk';
import {MATERIAL_COMPATIBILITY_MODE} from '../../core/compatibility/compatibility';
import {MdOptgroup} from './optgroup';

/**
 * Option IDs need to be unique across components, so this counter exists outside of
 * the component definition.
 */
let _uniqueIdCounter = 0;

/** Event object emitted by MdOption when selected or deselected. */
export class MdOptionSelectionChange {
  constructor(public source: MdOption, public isUserInput = false) { }
}

/**
 * Single option inside of a `<md-select>` element.
 */
@Component({
  moduleId: module.id,
  selector: 'md-option, mat-option',
  host: {
    'role': 'option',
    '[attr.tabindex]': '_getTabIndex()',
    '[class.mat-selected]': 'selected',
    '[class.mat-option-multiple]': 'multiple',
    '[class.mat-active]': 'active',
    '[id]': 'id',
    '[attr.aria-selected]': 'selected.toString()',
    '[attr.aria-disabled]': 'disabled.toString()',
    '[class.mat-option-disabled]': 'disabled',
    '(click)': '_selectViaInteraction()',
    '(keydown)': '_handleKeydown($event)',
    'class': 'mat-option',
  },
  templateUrl: 'option.html',
  encapsulation: ViewEncapsulation.None
})
export class MdOption {
  private _selected: boolean = false;
  private _active: boolean = false;

  /** Whether the option is disabled.  */
  private _disabled: boolean = false;

  private _id: string = `md-option-${_uniqueIdCounter++}`;

  /** Whether the wrapping component is in multiple selection mode. */
  multiple: boolean = false;

  /** The unique ID of the option. */
  get id() { return this._id; }

  /** Whether or not the option is currently selected. */
  get selected(): boolean { return this._selected; }

  /** The form value of the option. */
  @Input() value: any;

  /** Whether the option is disabled. */
  @Input()
  get disabled() { return (this.group && this.group.disabled) || this._disabled; }
  set disabled(value: any) { this._disabled = coerceBooleanProperty(value); }

  /** Event emitted when the option is selected or deselected. */
  @Output() onSelectionChange = new EventEmitter<MdOptionSelectionChange>();

  constructor(
    private _element: ElementRef,
    @Optional() public readonly group: MdOptgroup,
    @Optional() @Inject(MATERIAL_COMPATIBILITY_MODE) public _isCompatibilityMode: boolean) {}

  /**
   * Whether or not the option is currently active and ready to be selected.
   * An active option displays styles as if it is focused, but the
   * focus is actually retained somewhere else. This comes in handy
   * for components like autocomplete where focus must remain on the input.
   */
  get active(): boolean {
    return this._active;
  }

  /**
   * The displayed value of the option. It is necessary to show the selected option in the
   * select's trigger.
   */
  get viewValue(): string {
    // TODO(kara): Add input property alternative for node envs.
    return (this._getHostElement().textContent || '').trim();
  }

  /** Selects the option. */
  select(): void {
    this._selected = true;
    this._emitSelectionChangeEvent();
  }

  /** Deselects the option. */
  deselect(): void {
    this._selected = false;
    this._emitSelectionChangeEvent();
  }

  /** Sets focus onto this option. */
  focus(): void {
    this._getHostElement().focus();
  }

  /**
   * This method sets display styles on the option to make it appear
   * active. This is used by the ActiveDescendantKeyManager so key
   * events will display the proper options as active on arrow key events.
   */
  setActiveStyles(): void {
    this._active = true;
  }

  /**
   * This method removes display styles on the option that made it appear
   * active. This is used by the ActiveDescendantKeyManager so key
   * events will display the proper options as active on arrow key events.
   */
  setInactiveStyles(): void {
    this._active = false;
  }

  /** Ensures the option is selected when activated from the keyboard. */
  _handleKeydown(event: KeyboardEvent): void {
    if (event.keyCode === ENTER || event.keyCode === SPACE) {
      this._selectViaInteraction();
    }
  }

  /**
   * Selects the option while indicating the selection came from the user. Used to
   * determine if the select's view -> model callback should be invoked.
   */
  _selectViaInteraction(): void {
    if (!this.disabled) {
      this._selected = this.multiple ? !this._selected : true;
      this._emitSelectionChangeEvent(true);
    }
  }

  /** Returns the correct tabindex for the option depending on disabled state. */
  _getTabIndex(): string {
    return this.disabled ? '-1' : '0';
  }

  /** Fetches the host DOM element. */
  _getHostElement(): HTMLElement {
    return this._element.nativeElement;
  }

  /** Emits the selection change event. */
  private _emitSelectionChangeEvent(isUserInput = false): void {
    this.onSelectionChange.emit(new MdOptionSelectionChange(this, isUserInput));
  }

}


text:
package me.devsaki.hentoid.enums;

import androidx.annotation.NonNull;

/**
 * Created by Robb on 2020/08
 */
public enum Grouping {

    FLAT(0, "Flat", false, false, false),
    ARTIST(1, "By artist", false, true, true),
    DL_DATE(2, "By download date", false, false, false),
    CUSTOM(98, "Custom", true, true, true),
    NONE(99, "None", false, false, false);

    private final int id;
    private final String name;
    private final boolean canReorderGroups;
    private final boolean canDeleteGroups;
    private final boolean canReorderBooks;

    Grouping(int id, @NonNull String name, boolean canReorderGroups, boolean canDeleteGroups, boolean canReorderBooks) {
        this.id = id;
        this.name = name;
        this.canReorderGroups = canReorderGroups;
        this.canDeleteGroups = canDeleteGroups;
        this.canReorderBooks = canReorderBooks;
    }

    public int getId() {
        return id;
    }

    public String getName() {
        return name;
    }

    public boolean canDeleteGroups() {
        return canDeleteGroups;
    }

    public boolean canReorderGroups() {
        return canReorderGroups;
    }

    public boolean canReorderBooks() {
        return canReorderBooks;
    }

    // Same as ValueOf with a fallback to NONE
    // (vital for forward compatibility)
    public static Grouping searchByName(String name) {
        for (Grouping s : values())
            if (s.name().equalsIgnoreCase(name)) return s;

        return NONE;
    }

    public static Grouping searchById(int id) {
        for (Grouping s : values())
            if (id == s.id) return s;

        return NONE;
    }
}


text:
package org.quattor.pan;

import static org.quattor.pan.CompilerLogging.LoggingType.MEMORY;
import static org.quattor.pan.tasks.TaskResult.ResultType.ANNOTATION;
import static org.quattor.pan.tasks.TaskResult.ResultType.COMPILED;
import static org.quattor.pan.tasks.TaskResult.ResultType.DEP;
import static org.quattor.pan.tasks.TaskResult.ResultType.XML;
import static org.quattor.pan.utils.MessageUtils.MSG_STATISTICS_TEMPLATE;

import java.lang.management.ManagementFactory;
import java.lang.management.MemoryMXBean;
import java.lang.management.MemoryUsage;
import java.util.Map;
import java.util.TreeMap;
import java.util.concurrent.atomic.AtomicLong;
import java.util.logging.Level;
import java.util.logging.Logger;

import org.quattor.pan.tasks.TaskResult.ResultType;
import org.quattor.pan.utils.MessageUtils;

/**
 * Provides statistics about a run of the pan compiler. These statistics can be
 * used to judge the performance of the compiler with different options.
 *
 * @author loomis
 *
 */
public class CompilerStatistics {

	private final static Logger memoryLogger = MEMORY.logger();

	private long buildTime;

	private long fileCount;

	private final AtomicLong heapUsed;

	private final AtomicLong heapTotal;

	private final AtomicLong nonHeapUsed;

	private final AtomicLong nonHeapTotal;

	private final Map<ResultType, AtomicLong> startedTasks;

	private final Map<ResultType, AtomicLong> doneTasks;

	/**
	 * Creates an object to keep track of statistics during the run of the pan
	 * compiler.
	 */
	public CompilerStatistics() {
		buildTime = -1L;

		// Create maps containing the counters for the types of tasks.
		startedTasks = new TreeMap<ResultType, AtomicLong>();
		doneTasks = new TreeMap<ResultType, AtomicLong>();

		// Initialize all of the counters to zero.
		for (ResultType t : ResultType.values()) {
			startedTasks.put(t, new AtomicLong(0));
			doneTasks.put(t, new AtomicLong(0));
		}

		heapUsed = new AtomicLong(-1);
		heapTotal = new AtomicLong(-1);
		nonHeapUsed = new AtomicLong(-1);
		nonHeapTotal = new AtomicLong(-1);

		// Update the memory information at least once so we don't leave the
		// default values.
		updateMemoryInfo();
	}

	/**
	 * Define the total (clock) time for a complete build in milliseconds.
	 *
	 * @param buildTime
	 *            wall-clock build time
	 */
	public void setBuildTime(long buildTime) {
		this.buildTime = buildTime;
	}

	/**
	 * The total number of files which were processed by the compiler.
	 *
	 * @param fileCount
	 *            number of processed files
	 */
	public void setFileCount(long fileCount) {
		this.fileCount = fileCount;
	}

	/**
	 * Increase the count of the number of tasks of the given type that have
	 * been started.
	 *
	 * @param type
	 *            type of task that was started
	 */
	public void incrementStartedTasks(ResultType type) {
		startedTasks.get(type).incrementAndGet();
	}

	/**
	 * Increase the count of the number of tasks of the given type that have
	 * finished successfully.
	 *
	 * @param type
	 *            type of task that finished
	 */
	public void incrementFinishedTasks(ResultType type) {
		doneTasks.get(type).incrementAndGet();
	}

	/**
	 * Take a snapshot of the current memory usage of the JVM and update the
	 * high-water marks.
	 */
	public void updateMemoryInfo() {

		MemoryMXBean meminfo = ManagementFactory.getMemoryMXBean();

		MemoryUsage usage = meminfo.getHeapMemoryUsage();
		long _heapUsed = usage.getUsed();
		updateMaximum(heapUsed, _heapUsed);
		updateMaximum(heapTotal, usage.getMax());

		usage = meminfo.getNonHeapMemoryUsage();
		updateMaximum(nonHeapUsed, usage.getUsed());
		updateMaximum(nonHeapTotal, usage.getMax());

		// Log the memory usage if requested. Check the log level before logging
		// to minimize object creation overheads during preparation of the call
		// parameters.
		if (memoryLogger.isLoggable(Level.INFO)) {
			memoryLogger.log(Level.INFO, "MEM", new Object[] { _heapUsed });
		}
	}

	/**
	 * Compares the current value against the value of the counter and updates
	 * the counter if the current value is greater. This is done in a way to
	 * ensure that no updates are lost.
	 *
	 * @param counter
	 *            AtomicLong counter to update
	 * @param currentValue
	 *            current value of the counter
	 */
	private static void updateMaximum(AtomicLong counter, long currentValue) {
		boolean unset = true;
		long counterValue = counter.get();
		while ((currentValue > counterValue) && unset) {
			unset = !counter.compareAndSet(counterValue, currentValue);
			counterValue = counter.get();
		}
	}

	/**
	 * Generates a terse String representation of the statistics.
	 *
         * @param totalErrors total number of errors that have occurred
	 * @return statistics as a String value
	 */
	public String getResults(long totalErrors) {

		Object[] info = { fileCount, doneTasks.get(COMPILED).get(),
				startedTasks.get(COMPILED).get(),
				doneTasks.get(ANNOTATION).get(),
				startedTasks.get(ANNOTATION).get(), doneTasks.get(XML).get(),
				startedTasks.get(XML).get(), doneTasks.get(DEP).get(),
				startedTasks.get(DEP).get(), totalErrors, buildTime,
				convertToMB(heapUsed.get()), convertToMB(heapTotal.get()),
				convertToMB(nonHeapUsed.get()), convertToMB(nonHeapTotal.get()) };

		return MessageUtils.format(MSG_STATISTICS_TEMPLATE, info);
	}

	private static Long convertToMB(long value) {
		return Long.valueOf(value >> 20);
	}
}


text:
/* tslint:disable:no-unused-variable */

import { TestBed, async, inject } from '@angular/core/testing';
import { RequestorService } from './requestor.service';

describe('RequestorService', () => {
  beforeEach(() => {
    TestBed.configureTestingModule({
      providers: [RequestorService]
    });
  });

  it('should ...', inject([RequestorService], (service: RequestorService) => {
    expect(service).toBeTruthy();
  }));
});


text:
// Copyright (c) 2010 Satoshi Nakamoto
// Copyright (c) 2009-2019 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#include <chainparams.h>

#include <chainparamsseeds.h>
#include <consensus/merkle.h>
#include <tinyformat.h>
#include <util/system.h>
#include <util/strencodings.h>
#include <versionbitsinfo.h>

#include <assert.h>

#include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/split.hpp>

static CBlock CreateGenesisBlock(const char* pszTimestamp, const CScript& genesisOutputScript, uint32_t nTime, uint32_t nNonce, uint32_t nBits, int32_t nVersion, const CAmount& genesisReward)
{
    CMutableTransaction txNew;
    txNew.nVersion = 1;
    txNew.vin.resize(1);
    txNew.vout.resize(1);
    txNew.vin[0].scriptSig = CScript() << 0 << CScriptNum(999) << std::vector<unsigned char>((const unsigned char*)pszTimestamp, (const unsigned char*)pszTimestamp + strlen(pszTimestamp));
    txNew.vout[0].nValue = genesisReward;
    txNew.vout[0].scriptPubKey = genesisOutputScript;

    CBlock genesis;
    genesis.nTime    = nTime;
    genesis.nBits    = nBits;
    genesis.nNonce   = nNonce;
    genesis.nVersion = nVersion;
    genesis.vtx.push_back(MakeTransactionRef(std::move(txNew)));
    genesis.hashPrevBlock.SetNull();
    genesis.hashMerkleRoot = BlockMerkleRoot(genesis);
    return genesis;
}

/**
 * Build the genesis block. Note that the output of its generation
 * transaction cannot be spent since it did not originally exist in the
 * database.
 *
 * CBlock(hash=000000000019d6, ver=1, hashPrevBlock=00000000000000, hashMerkleRoot=4a5e1e, nTime=1231006505, nBits=1d00ffff, nNonce=2083236893, vtx=1)
 *   CTransaction(hash=4a5e1e, ver=1, vin.size=1, vout.size=1, nLockTime=0)
 *     CTxIn(COutPoint(000000, -1), coinbase 04ffff001d0104455468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73)
 *     CTxOut(nValue=50.00000000, scriptPubKey=0x5F1DF16B2B704C8A578D0B)
 *   vMerkleTree: 4a5e1e
 */
static CBlock CreateGenesisBlock(uint32_t nTime, uint32_t nNonce, uint32_t nBits, int32_t nVersion, const CAmount& genesisReward)
{
    const char* pszTimestamp = "01/09/2014 Germany to Help in Disposal of Syrian Chemical Weapons";
    const CScript genesisOutputScript = CScript();
    return CreateGenesisBlock(pszTimestamp, genesisOutputScript, nTime, nNonce, nBits, nVersion, genesisReward);
}

/**
 * Main network
 */
class CMainParams : public CChainParams {
public:
    CMainParams() {
        strNetworkID = CBaseChainParams::MAIN;
        consensus.nSubsidyHalvingInterval = 840000;
        consensus.BIP16Height = 0;
        consensus.BIP34Height = 691488;
        consensus.BIP34Hash = uint256S("0x1d0446fe48fdebf4780f544f1de81c2527099da2d09465873475cefe96ab84a1");
        consensus.BIP65Height = 691488;
        consensus.BIP66Height = 691488;
        consensus.CSVHeight = 691488;
        consensus.SegwitHeight = 713664;
        consensus.MinBIP9WarningHeight = 715680; // segwit activation height + miner confirmation window

        // powLimit should not be too high to produce blocks 2.5 mins apart.
        consensus.powLimit = uint256S("0007ffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80");
        // Value for previous forks
        consensus.preVerthashPowLimit = uint256S("00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");

        consensus.nPowTargetTimespan = 3.5 * 24 * 60 * 60; // 3.5 days
        consensus.nPowTargetSpacing = 2.5 * 60;
        consensus.fPowAllowMinDifficultyBlocks = false;
        consensus.fPowNoRetargeting = false;
        consensus.nRuleChangeActivationThreshold = 1512; // 75% of 2016
        consensus.nMinerConfirmationWindow = 2016; // nPowTargetTimespan / nPowTargetSpacing

        // The best chain should have at least this much work.
        consensus.nMinimumChainWork = uint256S("0x000000000000000000000000000000000000000000000001796891f689605736");

        // By default assume that the signatures in ancestors of this block are valid.
        consensus.defaultAssumeValid = uint256S("0x13311f001ad833853d714d1b0425f76004373cb2286a4e5094a811b8a4246147"); //1172000

        /**
         * The message start string is designed to be unlikely to occur in normal data.
         * The characters are rarely used upper ASCII, not valid as UTF-8, and produce
         * a large 32-bit integer with any alignment.
         */
        pchMessageStart[0] = 0xfa;
        pchMessageStart[1] = 0xbf;
        pchMessageStart[2] = 0xb5;
        pchMessageStart[3] = 0xda;
        nDefaultPort = 5889;
        nPruneAfterHeight = 100000;
        m_assumed_blockchain_size = 5;
        m_assumed_chain_state_size = 1;

        genesis = CreateGenesisBlock(1389311371, 5749262, 0x1e0ffff0, 1, 50 * COIN);
        consensus.hashGenesisBlock = genesis.GetHash();
        assert(consensus.hashGenesisBlock == uint256S("0x4d96a915f49d40b1e5c2844d1ee2dccb90013a990ccea12c492d22110489f0c4"));
        assert(genesis.hashMerkleRoot == uint256S("0x4af38ca0e323c0a5226208a73b7589a52c030f234810cf51e13e3249fc0123e7"));

        vSeeds.emplace_back("useast1.vtconline.org"); // James Lovejoy
        vSeeds.emplace_back("vtc.gertjaap.org"); // Gert-Jaap Glasbergen
        vSeeds.emplace_back("vert.idzstad.pl"); // Jaroslaw (jk_14)
        vSeeds.emplace_back("dnsseed.vertcoin.cc"); // DB Keys

        base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1,71);
        base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char>(1,5);
        base58Prefixes[SECRET_KEY] =     std::vector<unsigned char>(1,128);
        base58Prefixes[EXT_PUBLIC_KEY] = {0x04, 0x88, 0xB2, 0x1E};
        base58Prefixes[EXT_SECRET_KEY] = {0x04, 0x88, 0xAD, 0xE4};

        bech32_hrp = "vtc";

        vFixedSeeds = std::vector<SeedSpec6>(pnSeed6_main, pnSeed6_main + ARRAYLEN(pnSeed6_main));

        fDefaultConsistencyChecks = false;
        fRequireStandard = true;
        m_is_test_chain = false;
        m_is_mockable_chain = false;

        checkpointData = {
              {
                {      0, uint256S("0x4d96a915f49d40b1e5c2844d1ee2dccb90013a990ccea12c492d22110489f0c4")},
                {  24200, uint256S("0xd7ed819858011474c8b0cae4ad0b9bdbb745becc4c386bc22d1220cc5a4d1787")},
                {  65000, uint256S("0x9e673a69c35a423f736ab66f9a195d7c42f979847a729c0f3cef2c0b8b9d0289")},
                {  84065, uint256S("0xa904170a5a98109b2909379d9bc03ef97a6b44d5dafbc9084b8699b0cba5aa98")},
                {  228023, uint256S("0x15c94667a9e941359d2ee6527e2876db1b5e7510a5ded3885ca02e7e0f516b51")},
                {  346992, uint256S("0xf1714fa4c7990f4b3d472eb22132891ccd3c7ad7208e2d1ab15bde68854fb0ee")},
                {  347269, uint256S("0xfa1e592b7ea2aa97c5f20ccd7c40f3aaaeb31d1232c978847a79f28f83b6c22a")},
                {  430000, uint256S("0x2f5703cf7b6f956b84fd49948cbf49dc164cfcb5a7b55903b1c4f53bc7851611")},
                {  516999, uint256S("0x572ed47da461743bcae526542053e7bc532de299345e4f51d77786f2870b7b28")},
	        {  627610, uint256S("0x6000a787f2d8bb77d4f491a423241a4cc8439d862ca6cec6851aba4c79ccfedc")},
	        {  1172000, uint256S("0x13311f001ad833853d714d1b0425f76004373cb2286a4e5094a811b8a4246147")},
		{  1474747, uint256S("0xedf23a98cc196888635a01ba4672680df0b7c16eb48146e706b6f2e669974934")},
            }
        };

        chainTxData = ChainTxData{
            // Data as of block 0000000000000000002d6cca6761c99b3c2e936f9a0e304b7c7651a993f461de (height 506081).
            1521857289, // * UNIX timestamp of last known number of transactions
            3071361,  // * total number of transactions between genesis and that timestamp
                        //   (the tx=... number in the SetBestChain debug.log lines)
            0.3         // * estimated number of transactions per second after that timestamp

        };

 /* data from merge with bitcoin. above data is from vertcoin. this block is from bitcoin
            // Data from rpc: getchaintxstats 4096 0000000000000000000f1c54590ee18d15ec70e68c8cd4cfbadb1b4f11697eee
            1550374134, // nTime
            383732546,  // nTxCount
            3.685496590998308 // dTxRate
 */
    }
};

/**
 * Testnet (v3)
 */
class CTestNetParams : public CChainParams {
public:
    CTestNetParams() {
        strNetworkID = CBaseChainParams::TESTNET;
        consensus.nSubsidyHalvingInterval = 840000;
        consensus.BIP16Height = 0;
        consensus.BIP34Height = 300;
        consensus.BIP34Hash = uint256S("0xd6be7cfec4fb1d6a8a94f0a423520a78c97fbdc766cd25f9512adc9249282c2a");
        consensus.BIP65Height = 300;
        consensus.BIP66Height = 300;
        consensus.CSVHeight = 300;
        consensus.SegwitHeight = 300;
        consensus.MinBIP9WarningHeight = 350; // segwit activation height + miner confirmation window

        // TODO Determine correct value based on average miner performance / expected nethash
        // powLimit should not be too high to produce blocks 2.5 mins apart.
        consensus.powLimit = uint256S("7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
        // Value for previous forks
        consensus.preVerthashPowLimit = uint256S("00000fffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
        consensus.nPowTargetTimespan = 3.5 * 24 * 60 * 60; // two weeks
        consensus.nPowTargetSpacing = 2.5 * 60;
        consensus.fPowAllowMinDifficultyBlocks = true;
        consensus.fPowNoRetargeting = false;
        consensus.nRuleChangeActivationThreshold = 26; // 75% for testchains
        consensus.nMinerConfirmationWindow = 50; // nPowTargetTimespan / nPowTargetSpacing

        // The best chain should have at least this much work.
        consensus.nMinimumChainWork = uint256S("0x0000000000000000000000000000000000000000000000000000000000100010");

        // By default assume that the signatures in ancestors of this block are valid.
        consensus.defaultAssumeValid = uint256S("0x69ab56f74d75afa90b65b1fe10df8adaf2769e2ba64df1e1dc99c4d6717e1a2a"); //9000

        pchMessageStart[0] = 'v';
        pchMessageStart[1] = 'e';
        pchMessageStart[2] = 'r';
        pchMessageStart[3] = 't';
        nDefaultPort = 15889;
        nPruneAfterHeight = 1000;
        m_assumed_blockchain_size = 40;
        m_assumed_chain_state_size = 2;

        genesis = CreateGenesisBlock(1481291250, 915027, 0x1e0ffff0, 1, 50 * COIN);
        consensus.hashGenesisBlock = genesis.GetHash();
        assert(consensus.hashGenesisBlock == uint256S("0xcee8f24feb7a64c8f07916976aa4855decac79b6741a8ec2e32e2747497ad2c9"));
        assert(genesis.hashMerkleRoot == uint256S("0x4af38ca0e323c0a5226208a73b7589a52c030f234810cf51e13e3249fc0123e7"));

        vFixedSeeds.clear();
        vSeeds.clear();
        // nodes with support for servicebits filtering should be at the top
        vSeeds.emplace_back("jlovejoy.mit.edu");
        vSeeds.emplace_back("gertjaap.ddns.net");
        vSeeds.emplace_back("fr1.vtconline.org");
        vSeeds.emplace_back("tvtc.vertcoin.org");

        base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1,74);
        base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char>(1,196);
        base58Prefixes[SECRET_KEY] =     std::vector<unsigned char>(1,239);
        base58Prefixes[EXT_PUBLIC_KEY] = {0x04, 0x35, 0x87, 0xCF};
        base58Prefixes[EXT_SECRET_KEY] = {0x04, 0x35, 0x83, 0x94};

        bech32_hrp = "tvtc";

        vFixedSeeds = std::vector<SeedSpec6>(pnSeed6_test, pnSeed6_test + ARRAYLEN(pnSeed6_test));

        fDefaultConsistencyChecks = false;
        fRequireStandard = false;
        m_is_test_chain = true;
        m_is_mockable_chain = false;

        checkpointData = {
            {
                {0, uint256S("cee8f24feb7a64c8f07916976aa4855decac79b6741a8ec2e32e2747497ad2c9")},
            }
        };

        chainTxData = ChainTxData{
            // Data as of block 00000000000001c200b9790dc637d3bb141fe77d155b966ed775b17e109f7c6c (height 1156179)
            1481291250,
            1,
            0.001
        };
    }
};

/**
 * Regression test
 */
class CRegTestParams : public CChainParams {
public:
    explicit CRegTestParams(const ArgsManager& args) {
        strNetworkID = CBaseChainParams::REGTEST;
        consensus.nSubsidyHalvingInterval = 150;
        consensus.BIP16Height = 0; // always enforce P2SH BIP16 on regtest
        consensus.BIP34Height = 100;
        consensus.BIP65Height = 100;
        consensus.BIP66Height = 100;
        consensus.CSVHeight = 100;
        consensus.SegwitHeight = 100;
        consensus.MinBIP9WarningHeight = 244; // segwit activation height + miner confirmation window
        consensus.powLimit = uint256S("7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");
        consensus.preVerthashPowLimit = consensus.powLimit;
        consensus.nPowTargetTimespan = 14 * 24 * 60 * 60; // two weeks
        consensus.nPowTargetSpacing = 10 * 60;
        consensus.fPowAllowMinDifficultyBlocks = true;
        consensus.fPowNoRetargeting = true;
        consensus.nRuleChangeActivationThreshold = 108; // 75% for testchains
        consensus.nMinerConfirmationWindow = 144; // Faster than normal for regtest (144 instead of 2016)
        consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].bit = 28;
        consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nStartTime = 0;
        consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;

        // The best chain should have at least this much work.
        consensus.nMinimumChainWork = uint256S("0x00");

        // By default assume that the signatures in ancestors of this block are valid.
        consensus.defaultAssumeValid = uint256S("0x00");

        pchMessageStart[0] = 0xfa;
        pchMessageStart[1] = 0xbe;
        pchMessageStart[2] = 0xb5;
        pchMessageStart[3] = 0xdb;
        nDefaultPort = 18444;
        nPruneAfterHeight = 1000;
        m_assumed_blockchain_size = 0;
        m_assumed_chain_state_size = 0;

        UpdateActivationParametersFromArgs(args);

        genesis = CreateGenesisBlock(1296688602, 2, 0x207fffff, 1, 50 * COIN);
        consensus.hashGenesisBlock = genesis.GetHash();
        assert(consensus.hashGenesisBlock == uint256S("0x2399c0b047ebbbd1650d66867206c97317027b1a1932bc6fc17ce833dc4a85ce"));
        assert(genesis.hashMerkleRoot == uint256S("0x4af38ca0e323c0a5226208a73b7589a52c030f234810cf51e13e3249fc0123e7"));

        vFixedSeeds.clear(); //!< Regtest mode doesn't have any fixed seeds.
        vSeeds.clear();      //!< Regtest mode doesn't have any DNS seeds.

        fDefaultConsistencyChecks = true;
        fRequireStandard = true;
        m_is_test_chain = true;
        m_is_mockable_chain = true;

        checkpointData = {
            {
                {0, uint256S("2399c0b047ebbbd1650d66867206c97317027b1a1932bc6fc17ce833dc4a85ce")},
            }
        };

        chainTxData = ChainTxData{
            0,
            0,
            0
        };

        base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1,74);
        base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char>(1,196);
        base58Prefixes[SECRET_KEY] =     std::vector<unsigned char>(1,239);
        base58Prefixes[EXT_PUBLIC_KEY] = {0x04, 0x35, 0x87, 0xCF};
        base58Prefixes[EXT_SECRET_KEY] = {0x04, 0x35, 0x83, 0x94};

        bech32_hrp = "rvtc";
    }

    /**
     * Allows modifying the Version Bits regtest parameters.
     */
    void UpdateVersionBitsParameters(Consensus::DeploymentPos d, int64_t nStartTime, int64_t nTimeout)
    {
        consensus.vDeployments[d].nStartTime = nStartTime;
        consensus.vDeployments[d].nTimeout = nTimeout;
    }
    void UpdateActivationParametersFromArgs(const ArgsManager& args);
};

void CRegTestParams::UpdateActivationParametersFromArgs(const ArgsManager& args)
{
    if (gArgs.IsArgSet("-segwitheight")) {
        int64_t height = gArgs.GetArg("-segwitheight", consensus.SegwitHeight);
        if (height < -1 || height >= std::numeric_limits<int>::max()) {
            throw std::runtime_error(strprintf("Activation height %ld for segwit is out of valid range. Use -1 to disable segwit.", height));
        } else if (height == -1) {
            LogPrintf("Segwit disabled for testing\n");
            height = std::numeric_limits<int>::max();
        }
        consensus.SegwitHeight = static_cast<int>(height);
    }

    if (!args.IsArgSet("-vbparams")) return;

    for (const std::string& strDeployment : args.GetArgs("-vbparams")) {
        std::vector<std::string> vDeploymentParams;
        boost::split(vDeploymentParams, strDeployment, boost::is_any_of(":"));
        if (vDeploymentParams.size() != 3) {
            throw std::runtime_error("Version bits parameters malformed, expecting deployment:start:end");
        }
        int64_t nStartTime, nTimeout;
        if (!ParseInt64(vDeploymentParams[1], &nStartTime)) {
            throw std::runtime_error(strprintf("Invalid nStartTime (%s)", vDeploymentParams[1]));
        }
        if (!ParseInt64(vDeploymentParams[2], &nTimeout)) {
            throw std::runtime_error(strprintf("Invalid nTimeout (%s)", vDeploymentParams[2]));
        }
        bool found = false;
        for (int j=0; j < (int)Consensus::MAX_VERSION_BITS_DEPLOYMENTS; ++j) {
            if (vDeploymentParams[0] == VersionBitsDeploymentInfo[j].name) {
                UpdateVersionBitsParameters(Consensus::DeploymentPos(j), nStartTime, nTimeout);
                found = true;
                LogPrintf("Setting version bits activation parameters for %s to start=%ld, timeout=%ld\n", vDeploymentParams[0], nStartTime, nTimeout);
                break;
            }
        }
        if (!found) {
            throw std::runtime_error(strprintf("Invalid deployment (%s)", vDeploymentParams[0]));
        }
    }
}

static std::unique_ptr<const CChainParams> globalChainParams;

const CChainParams &Params() {
    assert(globalChainParams);
    return *globalChainParams;
}

std::unique_ptr<const CChainParams> CreateChainParams(const std::string& chain)
{
    if (chain == CBaseChainParams::MAIN)
        return std::unique_ptr<CChainParams>(new CMainParams());
    else if (chain == CBaseChainParams::TESTNET)
        return std::unique_ptr<CChainParams>(new CTestNetParams());
    else if (chain == CBaseChainParams::REGTEST)
        return std::unique_ptr<CChainParams>(new CRegTestParams(gArgs));
    throw std::runtime_error(strprintf("%s: Unknown chain %s.", __func__, chain));
}

void SelectParams(const std::string& network)
{
    SelectBaseParams(network);
    globalChainParams = CreateChainParams(network);
}


text:
#if CASTLE
using Castle.DynamicProxy;
using WampSharp.Core.Message;

namespace WampSharp.Core.Proxy
{
    /// <summary>
    /// An interceptor that serializes requests and sends them to a
    /// <see cref="IWampOutgoingMessageHandler"/>.
    /// </summary>
    /// <typeparam name="TMessage"></typeparam>
    public class WampOutgoingInterceptor<TMessage> : IInterceptor
    {
        private readonly IWampOutgoingMessageHandler mOutgoingHandler;
        private readonly IWampOutgoingRequestSerializer mOutgoingSerializer;

        /// <summary>
        /// Initializes a new instance of <see cref="WampOutgoingInterceptor{TMessage}"/>.
        /// </summary>
        /// <param name="outgoingSerializer">The <see cref="IWampOutgoingRequestSerializer"/> to
        /// serialize method calls with.</param>
        /// <param name="outgoingHandler">The <see cref="IWampOutgoingMessageHandler"/>
        /// that will deal with the serialized method calls.</param>
        public WampOutgoingInterceptor(IWampOutgoingRequestSerializer outgoingSerializer,
                                       IWampOutgoingMessageHandler outgoingHandler)
        {
            mOutgoingSerializer = outgoingSerializer;
            mOutgoingHandler = outgoingHandler;
        }

        /// <summary>
        /// <see cref="IInterceptor.Intercept"/>
        /// </summary>
        public void Intercept(IInvocation invocation)
        {
            WampMessage<object> serialized =
                mOutgoingSerializer.SerializeRequest
                    (invocation.Method, invocation.Arguments);

            mOutgoingHandler.Handle(serialized);
        }
    }
}
#endif


text:
package com.fern.util;

import java.util.Map;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.HashSet;

public class Logger implements ILogger {
  private static final Map<Class<?>, ILogger> LOGGERS = new HashMap<>();
  private static final Level DEFAULT_LEVEL = Level.INFO;
  private static final Set<String> IGNORE_METHODS = new HashSet<>();
  static {
    IGNORE_METHODS.add("java.lang.Thread.getStackTrace");
    final StringBuilder sb = new StringBuilder();
    sb.append(Logger.class.getName()).append(".");
    final int sbRootLen = sb.length();
    for (Method method: ILogger.class.getDeclaredMethods()) {
      sb.setLength(sbRootLen);
      sb.append(method.getName());
      IGNORE_METHODS.add(sb.toString());
    }
  }

  public static final ILogger loggerFor(final Class<?> clazz) {
    ILogger logger = null;
    synchronized (LOGGERS) {
      logger = LOGGERS.get(clazz);
      if (logger == null) {
        LOGGERS.put(clazz, logger = new Logger());
      }
    }
    return logger;
  }

  private final AtomicReference<Level> level;

  private Logger() {
    this.level = new AtomicReference<>(DEFAULT_LEVEL);
  }

  @Override
  public void setLevel(final Level level) {
    this.level.set(level);
  }

  @Override
  public Level getLevel() {
    return this.level.get();
  }

  @Override
  public void log(final Level level, final String format, final Object... args) {
    if (args == null) {
      throw new IllegalArgumentException("args");
    }
    if (getLevel().order() >= level.order()) {
      String location = null;
      final StringBuilder method = new StringBuilder();
      for (StackTraceElement e: Thread.currentThread().getStackTrace()) {
        method.setLength(0);
        method.append(e.getClassName()).append(".").append(e.getMethodName());
        if (IGNORE_METHODS.contains(method.toString())) {
          continue;
        }
        location = method.append("(l:").append(e.getLineNumber()).append(")").toString();
        break;
      }
      System.out.printf("%-5s <%d> Thr(%s) %s -> %s\n",
          level,
          TimeUnit.NANOSECONDS.toMicros(System.nanoTime()),
          Thread.currentThread().getName(),
          location,
          String.format(format, args));
    }
  }

  @Override
  public final void debug(String format, Object... args) {
    log(Level.DEBUG, format, args);
  }

  @Override
  public final void info(String format, Object... args) {
    log(Level.INFO, format, args);
  }

  @Override
  public final void warn(String format, Object... args) {
    log(Level.WARN, format, args);
  }

  @Override
  public final void error(String format, Object... args) {
    log(Level.ERROR, format, args);
  }
}


text:
import React from 'react';
import withWidth from '@material-ui/core/withWidth';
import Typography from '@material-ui/core/Typography';
import { Breakpoint } from '@material-ui/core/styles/createBreakpoints';

type TagName = 'em' | 'u' | 'del';

const components: Partial<Record<Breakpoint, TagName>> = {
  sm: 'em',
  md: 'u',
  lg: 'del',
};

function WithWidth(props: { width: Breakpoint }) {
  const { width } = props;
  const Component = components[width] || 'span';

  return (
    <Typography>
      <Component>{`Current width: ${width}`}</Component>
    </Typography>
  );
}

export default withWidth()(WithWidth);


text:
=========================
bda.plone.shopviews
=========================

Views for bda.plone.shop

Views
============

-   @@products_view
-   @@productlist_view
-   @@productlisting_view
-   @@quicksand_view
-   @@productboxes_view
-   @@colorboxes_view
-   @@product_view
-   @@variations_view

Checking it out
===============

To test out the views you might want to install
bda.shoptypes, which contains 3 content types for bda.plone.shop:

1) Product ((bda.shoptypes.product) which contains two images and two rich text fields. The rich text fields will have their own tabs at the bottom
2) Productgroup (bda.shoptypes.productgroup)
3) Variation (bda.shoptypes.variation) that can be added inside a Productgroup folder. You should set the view of Productgroup to one of the Variation (in other words: the view of "Productgroup folder" should be one content item (the default Variation)

NB: None of the FOLDER views are enabled by default, but you can test them by adding /@@viewname to the url, like:

- http://mysite.com/product/@@product_view
- http://mysite.com/folder/productlist_view

Or just go to /portal_types and add those views you want to use.

Variation view
========================

The variation view is for use with a Productgroup.

Let's say you have a productgroup "T-shirt", and the following Variations: "Green", "Yellow", "Blue".

First, you add "Productgroup" (a folderish content type) "Cool T-shirt" and inside that you add Variations "Blue", "Yellow" and "Green".

Then you set the "Green" as default view for "Cool T-Shirt" and set to view on "Blue", "Yellow" and "Green" to "variations_view" (you probably want to do this in ZMI at /portal_types.
You SHOULD hide the "Buy viewlet" by CSS or by /@@manage-viewlets

The result will be something like this:
http://www.bmh.no/nettbutikk/platespillere/rega-rp1

Currently, the cart is only working with UIDs that are present before the javascript loads.
Because of that, all the Variations is loaded, which might be a bit slow.

(Suggestions on how to overcome this problem is welcome).

**The views are intended as a starting point for your own views,
but they can also be customized TTW or used as they are.**

Productview
============

- The producview is intended as a view for a "Product. The look is something like how the items here are presented (click on them):  http://www.bmh.no/nettbutikk/tilbehor
- Every Rich Text field will get its own tab.

The folder (listing) views
===========================
-
-   @@products_view
-   @@productlist_view
-   @@productlisting_view
-   @@productboxes_view

All these views are quite similar, for example

- http://www.bmh.no/nettbutikk/forsterkere
- http://www.bokstavogbilde.no/bokhandel
- http://www.bokstavogbilde.no/bokhandel/boker/productlisting_view

The "javascript" views
===========================
-  @@quicksand_view
-  @@productboxes_view
-  @@colorboxes_view

The two first views are just used for folders that contain "Products", and they will sort on Keywords/Tags.
Colorboxes will sort on "Colors"

TO DO
============
- Fix CSS classes so they never contain illegal charaters.
- make the quicksand view sortable on price, colors etc.
- make the quicksand view work with the cart ( the quicksandview is not playing well with the add to cart when new content is added to the DOM. )

Installation
============

Add ``bda.plone.shopviews`` to the eggs (in buildout.cfg) and install it as addon
in plone control panel.

Author
============

Espen Moe-Nilssen [espenmn]


text:
package org.zstack.header.vm;

import org.zstack.header.message.LocalEvent;

public class StrangerVmFoundEvent extends LocalEvent {
    private String vmIdentify;
    private String vmState;
    private String hostUuid;

    @Override
    public String getSubCategory() {
        return "StrangerVmFoundEvent";
    }

    public String getVmIdentify() {
        return vmIdentify;
    }

    public void setVmIdentify(String vmIdentify) {
        this.vmIdentify = vmIdentify;
    }

    public String getVmState() {
        return vmState;
    }

    public void setVmState(String vmState) {
        this.vmState = vmState;
    }

    public String getHostUuid() {
        return hostUuid;
    }

    public void setHostUuid(String hostUuid) {
        this.hostUuid = hostUuid;
    }
}


text:
#pragma once

#include <Param.hpp>
#include <common/complex.hpp>
#include <common/dispatch.hpp>
#include <common/kernel_cache.hpp>
#include <debug_opencl.hpp>
#include <kernel_headers/sp_sp_arith_csr.hpp>
#include <kernel_headers/sparse_arith_common.hpp>
#include <kernel_headers/sparse_arith_coo.hpp>
#include <kernel_headers/sparse_arith_csr.hpp>
#include <kernel_headers/ssarith_calc_out_nnz.hpp>
#include <math.hpp>
#include <traits.hpp>

#include <string>
#include <vector>

namespace opencl {
namespace kernel {

constexpr unsigned TX      = 32;
constexpr unsigned TY      = 8;
constexpr unsigned THREADS = TX * TY;

template<af_op_t op>
AF_CONSTEXPR const char *getOpString() {
    switch (op) {
        case af_add_t: return "ADD";
        case af_sub_t: return "SUB";
        case af_mul_t: return "MUL";
        case af_div_t: return "DIV";
        default: return "";  // kernel will fail to compile
    }
    return "";
}

template<typename T, af_op_t op>
auto fetchKernel(const std::string key, const common::Source &additionalSrc,
                 const std::vector<std::string> additionalOptions = {}) {
    constexpr bool IsComplex =
        std::is_same<T, cfloat>::value || std::is_same<T, cdouble>::value;

    std::array<TemplateArg, 2> tmpltArgs = {
        TemplateTypename<T>(),
        TemplateArg(op),
    };
    std::vector<std::string> options = {
        DefineKeyValue(T, dtype_traits<T>::getName()),
        DefineKeyValue(OP, getOpString<op>()),
        DefineKeyValue(IS_CPLX, (IsComplex ? 1 : 0)),
    };
    options.emplace_back(getTypeBuildDefinition<T>());
    options.insert(std::end(options), std::begin(additionalOptions),
                   std::end(additionalOptions));
    return common::getKernel(
        key, std::array{sparse_arith_common_cl_src, additionalSrc}, tmpltArgs,
        options);
}

template<typename T, af_op_t op>
void sparseArithOpCSR(Param out, const Param values, const Param rowIdx,
                      const Param colIdx, const Param rhs, const bool reverse) {
    auto sparseArithCSR =
        fetchKernel<T, op>("sparseArithCSR", sparse_arith_csr_cl_src);

    cl::NDRange local(TX, TY, 1);
    cl::NDRange global(divup(out.info.dims[0], TY) * TX, TY, 1);

    sparseArithCSR(cl::EnqueueArgs(getQueue(), global, local), *out.data,
                   out.info, *values.data, *rowIdx.data, *colIdx.data,
                   static_cast<int>(values.info.dims[0]), *rhs.data, rhs.info,
                   static_cast<int>(reverse));
    CL_DEBUG_FINISH(getQueue());
}

template<typename T, af_op_t op>
void sparseArithOpCOO(Param out, const Param values, const Param rowIdx,
                      const Param colIdx, const Param rhs, const bool reverse) {
    auto sparseArithCOO =
        fetchKernel<T, op>("sparseArithCOO", sparse_arith_coo_cl_src);

    cl::NDRange local(THREADS, 1, 1);
    cl::NDRange global(divup(values.info.dims[0], THREADS) * THREADS, 1, 1);

    sparseArithCOO(cl::EnqueueArgs(getQueue(), global, local), *out.data,
                   out.info, *values.data, *rowIdx.data, *colIdx.data,
                   static_cast<int>(values.info.dims[0]), *rhs.data, rhs.info,
                   static_cast<int>(reverse));
    CL_DEBUG_FINISH(getQueue());
}

template<typename T, af_op_t op>
void sparseArithOpCSR(Param values, Param rowIdx, Param colIdx, const Param rhs,
                      const bool reverse) {
    auto sparseArithCSR =
        fetchKernel<T, op>("sparseArithCSR2", sparse_arith_csr_cl_src);

    cl::NDRange local(TX, TY, 1);
    cl::NDRange global(divup(rhs.info.dims[0], TY) * TX, TY, 1);

    sparseArithCSR(cl::EnqueueArgs(getQueue(), global, local), *values.data,
                   *rowIdx.data, *colIdx.data,
                   static_cast<int>(values.info.dims[0]), *rhs.data, rhs.info,
                   static_cast<int>(reverse));
    CL_DEBUG_FINISH(getQueue());
}

template<typename T, af_op_t op>
void sparseArithOpCOO(Param values, Param rowIdx, Param colIdx, const Param rhs,
                      const bool reverse) {
    auto sparseArithCOO =
        fetchKernel<T, op>("sparseArithCOO2", sparse_arith_coo_cl_src);

    cl::NDRange local(THREADS, 1, 1);
    cl::NDRange global(divup(values.info.dims[0], THREADS) * THREADS, 1, 1);

    sparseArithCOO(cl::EnqueueArgs(getQueue(), global, local), *values.data,
                   *rowIdx.data, *colIdx.data,
                   static_cast<int>(values.info.dims[0]), *rhs.data, rhs.info,
                   static_cast<int>(reverse));
    CL_DEBUG_FINISH(getQueue());
}

static void csrCalcOutNNZ(Param outRowIdx, unsigned &nnzC, const uint M,
                          const uint N, uint nnzA, const Param lrowIdx,
                          const Param lcolIdx, uint nnzB, const Param rrowIdx,
                          const Param rcolIdx) {
    UNUSED(N);
    UNUSED(nnzA);
    UNUSED(nnzB);

    std::vector<TemplateArg> tmpltArgs = {
        TemplateTypename<uint>(),
    };

    auto calcNNZ = common::getKernel("csr_calc_out_nnz",
                                     std::array{ssarith_calc_out_nnz_cl_src},
                                     tmpltArgs, {});

    cl::NDRange local(256, 1);
    cl::NDRange global(divup(M, local[0]) * local[0], 1, 1);

    nnzC     = 0;
    auto out = memAlloc<unsigned>(1);
    getQueue().enqueueFillBuffer(*out, nnzC, 0, sizeof(unsigned));

    calcNNZ(cl::EnqueueArgs(getQueue(), global, local), *out, *outRowIdx.data,
            M, *lrowIdx.data, *lcolIdx.data, *rrowIdx.data, *rcolIdx.data,
            cl::Local(local[0] * sizeof(unsigned int)));
    getQueue().enqueueReadBuffer(*out, CL_TRUE, 0, sizeof(unsigned), &nnzC);
    CL_DEBUG_FINISH(getQueue());
}

template<typename T, af_op_t op>
void ssArithCSR(Param oVals, Param oColIdx, const Param oRowIdx, const uint M,
                const uint N, unsigned nnzA, const Param lVals,
                const Param lRowIdx, const Param lColIdx, unsigned nnzB,
                const Param rVals, const Param rRowIdx, const Param rColIdx) {
    const T iden_val =
        (op == af_mul_t || op == af_div_t ? scalar<T>(1) : scalar<T>(0));

    auto arithOp = fetchKernel<T, op>(
        "ssarith_csr", sp_sp_arith_csr_cl_src,
        {DefineKeyValue(IDENTITY_VALUE, af::scalar_to_option(iden_val))});

    cl::NDRange local(256, 1);
    cl::NDRange global(divup(M, local[0]) * local[0], 1, 1);

    arithOp(cl::EnqueueArgs(getQueue(), global, local), *oVals.data,
            *oColIdx.data, *oRowIdx.data, M, N, nnzA, *lVals.data,
            *lRowIdx.data, *lColIdx.data, nnzB, *rVals.data, *rRowIdx.data,
            *rColIdx.data);
    CL_DEBUG_FINISH(getQueue());
}
}  // namespace kernel
}  // namespace opencl


text:
Invitations

  <button ng-click="newInvite()" class="btn btn-primary" >New</button>


text:
namespace BcmMigrationTool
{
    using System;

    public partial class sp_RptGetReportobject_Result
    {
        public byte[] ReportObject { get; set; }
        public string ReportName { get; set; }
        public int BaseEntityType { get; set; }
    }
}


text:
module NexoosSocinal2
  class LoanCcbBalance < Loan
    OPERATION = :obter_saldo_de_contrato_de_emprestimo

    def request_body
      {
        'fac2:Contrato' => @data[:contract],
        'fac2:Data'     => normalize_date(@data[:date] || Date.today)
      }
    end
  end
end