text:
<resources>

    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
        <item name="android:textColorPrimary">@color/negro</item>
        <item name="android:windowBackground">@color/gris100</item>
        <item name="windowActionBar">false</item>
        <item name="android:windowNoTitle">true</item>
        <item name="android:windowSoftInputMode">stateHidden</item>

        <item name="colorPrimary">@color/DEEP_ORANGE_400</item>
        <item name="colorPrimaryDark">@color/DEEP_ORANGE_800</item>
        <item name="colorAccent">@color/INDIGO_500</item>
    </style>

    <!-- ToolBar -->
    <style name="ToolBarStyle" parent="Theme.AppCompat">
        <item name="android:textColorPrimary">@android:color/white</item>
        <item name="android:textColorSecondary">@android:color/white</item>
        <item name="actionMenuTextColor">@android:color/white</item>
    </style>
</resources>


text:
$(document).ready(function(){
    $('[data-pjax-container]').pjax('a');
});

redpajama_set_name: RedPajamaGithub


text:
class mock_session;

class mock_dg_transport : public vds::dht::network::iudp_transport {
public:
  mock_dg_transport(mock_session & s)
  : s_(s){
  }
  vds::async_task<vds::expected<void>> write_async(
      const vds::udp_datagram & data) override;

  void set_partner(std::shared_ptr<mock_dg_transport> partner)
  {
    this->partner_ = partner;
  }

private:
  mock_session & s_;
  std::weak_ptr<mock_dg_transport> partner_;

  // Inherited via iudp_transport
  vds::async_task<vds::expected<void>> start(
    const vds::service_provider* sp,
    const std::shared_ptr<vds::asymmetric_public_key>& node_public_key,
    const std::shared_ptr<vds::asymmetric_private_key>& node_key,
    uint16_t port,
    bool dev_network) override;

  void stop() override;
  vds::async_task<vds::expected<void>> try_handshake(const std::string& address) override;
  vds::expected<void> broadcast_handshake() override;
  vds::async_task<vds::expected<void>> on_timer() override;
};

class mock_session : public vds::dht::network::dht_datagram_protocol {
  typedef vds::dht::network::dht_datagram_protocol base_class;
public:
  mock_session(
    const vds::service_provider * sp,
    const vds::network_address& address,
    const vds::const_data_buffer& this_node_id,
    vds::asymmetric_public_key partner_node_key,
    const vds::const_data_buffer& partner_node_id,
    const vds::const_data_buffer& session_key)
    : base_class(sp, address, this_node_id, std::move(partner_node_key), partner_node_id, session_key) {
  }

  vds::async_task<vds::expected<bool>> process_message(
      const std::shared_ptr<vds::dht::network::iudp_transport>& transport,
      uint8_t message_type,
      const vds::const_data_buffer & target_node,
      const std::vector<vds::const_data_buffer>& hops,
      const vds::const_data_buffer& message) override {

    this->message_type_ = message_type;
    this->message_ = message;
    this->target_node_ = target_node;
    this->hops_ = hops;

    co_return true;
  }

  vds::expected<void> check_message(uint8_t message_type, const vds::const_data_buffer & message){
    for(int i = 0; i < 10; ++i) {
      if(!this->message_) {
        std::this_thread::sleep_for(std::chrono::seconds(1));
      }
      else {
        break;
      }
    }
    if(message_type != this->message_type_) {
      return vds::make_unexpected<std::runtime_error>("Invalid message type");
    }
    if (message != this->message_) {
      return vds::make_unexpected<std::runtime_error>("Invalid message");
    }

    this->message_.clear();
    return vds::expected<void>();
  }

  vds::expected<void> check_message(
    uint8_t message_type,
    const vds::const_data_buffer & message,
    const vds::const_data_buffer & target_node,
    const std::vector<vds::const_data_buffer>& hops) {
    int i;
    for (i = 0; i < 10; ++i) {
      if (!this->message_) {
        std::this_thread::sleep_for(std::chrono::seconds(1));
      }
      else {
        break;
      }
    }
    if (message_type != this->message_type_) {
      return vds::make_unexpected<std::runtime_error>("Invalid message type");
    }
    if (message != this->message_) {
      return vds::make_unexpected<std::runtime_error>("Invalid message");
    }
    if (target_node != this->target_node_) {
      return vds::make_unexpected<std::runtime_error>("Invalid target_node");
    }

    if (hops.size() != this->hops_.size()) {
      return vds::make_unexpected<std::runtime_error>("Invalid hops");
    }
    for (int i = 0; i < hops.size(); ++i) {
      if (this->hops_[i] != hops_[i]) {
        return vds::make_unexpected<std::runtime_error>("Invalid hop node");
      }
    }

    this->message_.clear();
    return vds::expected<void>();
  }

  private:
    uint8_t message_type_;
    vds::const_data_buffer message_;
    vds::const_data_buffer target_node_;
    std::vector<vds::const_data_buffer> hops_;
};

#endif //__TEST_VDS_DHT_NETWORK_TEST_DATAGRAM_PROTOCOL_H_


text:
#ifndef SVGFontFaceElement_h
#define SVGFontFaceElement_h

#if ENABLE(SVG_FONTS)
#include "SVGNames.h"
#include "core/svg/SVGElement.h"

namespace WebCore {

class SVGFontElement;
class StyleRuleFontFace;

class SVGFontFaceElement FINAL : public SVGElement {
public:
    static PassRefPtr<SVGFontFaceElement> create(const QualifiedName&, Document*);

    unsigned unitsPerEm() const;
    int xHeight() const;
    float horizontalOriginX() const;
    float horizontalOriginY() const;
    float horizontalAdvanceX() const;
    float verticalOriginX() const;
    float verticalOriginY() const;
    float verticalAdvanceY() const;
    int ascent() const;
    int descent() const;
    String fontFamily() const;

    SVGFontElement* associatedFontElement() const;
    void rebuildFontFace();

    StyleRuleFontFace* fontFaceRule() const { return m_fontFaceRule.get(); }

private:
    SVGFontFaceElement(const QualifiedName&, Document*);

    virtual void parseAttribute(const QualifiedName&, const AtomicString&) OVERRIDE;

    virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
    virtual InsertionNotificationRequest insertedInto(ContainerNode*) OVERRIDE;
    virtual void removedFrom(ContainerNode*) OVERRIDE;

    virtual bool rendererIsNeeded(const NodeRenderingContext&) OVERRIDE { return false; }

    RefPtr<StyleRuleFontFace> m_fontFaceRule;
    SVGFontElement* m_fontElement;
};

inline SVGFontFaceElement* toSVGFontFaceElement(Node* node)
{
    ASSERT_WITH_SECURITY_IMPLICATION(!node || node->hasTagName(SVGNames::font_faceTag));
    return static_cast<SVGFontFaceElement*>(node);
}

} // namespace WebCore

#endif // ENABLE(SVG_FONTS)
#endif

// vim:ts=4:noet


text:
from uservalid import get_user
import gconfig
import json
def useradd(username,password,telephone,mail,usertel,name,adminrole):
    user_list1=get_user()
    for user in user_list1:
        if username == user['username']:
            return False
    useradd_f=open(gconfig.USER_FILE,'rb')
    useradd_info=useradd_f.read()
    useradd_f.close()
    useradd_cxt=json.loads(useradd_info)
    useradd_cxt.append({'username':username,'password':password,'telephone':telephone,'mail':mail,'usertel':usertel,'name':name,'adminrole':adminrole})
    useradd_f=open(gconfig.USER_FILE,'w')
    useradd_f.write(json.dumps(useradd_cxt))
    useradd_f.close()
    return True


text:
void log(const char* format, ...) {
#ifdef _DEBUG
  va_list args;
  va_start(args, format);
#ifdef ANDROID
    __android_log_vprint(ANDROID_LOG_INFO, "DartVM", format, args);
#else
    vfprintf(stderr, format, args);
#endif
  va_end(args);
#endif  // _DEBUG
}

intptr_t InitDartApiDL(void *data) {
  return Dart_InitializeApiDL(data);
}

void FreeMemory(void* memory) {
  free(memory);
}

const int read_buffer_size = 1024;
char read_buffer[read_buffer_size];

static void DispatchCallback(const char *methodname, Dart_Port dart_port,
                      Dart_CObject args) {
  Dart_CObject c_method_name;
  c_method_name.type = Dart_CObject_kString;
  c_method_name.value.as_string = const_cast<char*>(methodname);

  Dart_CObject *c_request_arr[] = {&c_method_name, &args};
  Dart_CObject c_request;

  c_request.type = Dart_CObject_kArray;
  c_request.value.as_array.values = c_request_arr;
  c_request.value.as_array.length =
      sizeof(c_request_arr) / sizeof(c_request_arr[0]);

  log("bicronet_grpc c++ DispatchCallback(%s) sendPort:%lld args count:%ld\n",
      methodname, dart_port, c_request.value.as_array.length);

  Dart_PostCObject_DL(dart_port, &c_request);
}

static void FreeFinalizer(void *, void *value) { free(value); }

// Builds the arguments to pass to the Dart side as a parameter to the
// callbacks. [num] is the number of arguments to be passed and rest are the
// arguments.
static Dart_CObject CallbackArgBuilder(int num, ...) {
  Dart_CObject c_request_data;
  va_list valist;
  va_start(valist, num);
  void *request_buffer = malloc(sizeof(uint64_t) * num);
  uint64_t *buf = reinterpret_cast<uint64_t *>(request_buffer);

  // uintptr_r will get implicitly casted to uint64_t. So, when the code is
  // executed in 32 bit mode, the upper 32 bit of buf[i] will be 0 extended
  // automatically. This is required because, on the Dart side these addresses
  // are viewed as 64 bit integers.
  for (int i = 0; i < num; i++) {
    buf[i] = va_arg(valist, uintptr_t);
  }

  c_request_data.type = Dart_CObject_kExternalTypedData;
  c_request_data.value.as_external_typed_data.type = Dart_TypedData_kUint8;
  c_request_data.value.as_external_typed_data.length = sizeof(uint64_t) * num;
  c_request_data.value.as_external_typed_data.data =
      static_cast<uint8_t *>(request_buffer);
  c_request_data.value.as_external_typed_data.peer = request_buffer;
  c_request_data.value.as_external_typed_data.callback = FreeFinalizer;

  va_end(valist);

  return c_request_data;
}

Dart_Port get_port_from_stream(bidirectional_stream* stream) {
  assert(stream->annotation != nullptr);
  return *static_cast<Dart_Port*>(stream->annotation);
}

void reset_port(bidirectional_stream* stream) {
  free(stream->annotation);
  stream->annotation = nullptr;
}

static void on_stream_ready(bidirectional_stream* stream) {
  log("bicronet_grpc c++ on_stream_ready %p\n", stream);
  DispatchCallback("on_stream_ready",
                   get_port_from_stream(stream),
                   CallbackArgBuilder(0));
}

static void on_response_headers_received(
    bidirectional_stream* stream,
    const bidirectional_stream_header_array* headers,
    const char* negotiated_protocol) {
  log("bicronet_grpc c++ on_response_headers_received %p negotiated_protocol:%s\n",
      stream, negotiated_protocol);
  for (size_t i = 0; i < headers->count; ++i) {
    log("bicronet_grpc c++ header[%lu]: %s %s\n", i, headers->headers[i].key,
            headers->headers[i].value);
  }

  bidirectional_stream_header_array* headers_copy =
      static_cast<bidirectional_stream_header_array*>(
          malloc(sizeof(bidirectional_stream_header_array)));
  headers_copy->count = headers->count;
  headers_copy->capacity = headers->capacity;
  headers_copy->headers =
      static_cast<bidirectional_stream_header*>(
          malloc(sizeof(bidirectional_stream_header) * headers_copy->count));
  bidirectional_stream_header* p_from = headers->headers;
  bidirectional_stream_header* p_to = headers_copy->headers;
  for (size_t i = 0; i < headers_copy->count; i++) {
    p_to->key = strdup(p_from->key);
    p_to->value = strdup(p_from->value);
    log("bicronet_grpc c++ Copied %s:%s\n", p_to->key, p_to->value);
    p_to++;
    p_from++;
  }

  DispatchCallback("on_response_headers_received",
                   get_port_from_stream(stream),
                   CallbackArgBuilder(3, stream, headers_copy, negotiated_protocol));
  // bidirectional_stream_read(stream, read_buffer, read_buffer_size);
  // log("bicronet_grpc c++ stream_read: %p\n", read_buffer);
}

static void on_read_completed(bidirectional_stream* stream,
                          char* data,
                          int bytes_read) {
  log("bicronet_grpc c++ on_read_completed %p data: %p bytes_read:%d\n", stream, data, bytes_read);
  uintptr_t u_bytes_read = bytes_read;
  DispatchCallback("on_read_completed",
                   get_port_from_stream(stream),
                   CallbackArgBuilder(3, stream, data, u_bytes_read));
}

static void on_write_completed(bidirectional_stream* stream, const char* data) {
  log("bicronet_grpc c++ on_write_completed %p data %p\n", stream, data);
  DispatchCallback("on_write_completed",
                   get_port_from_stream(stream),
                   CallbackArgBuilder(1, data));
}

static void on_response_trailers_received(
    bidirectional_stream* stream,
    const bidirectional_stream_header_array* trailers) {
  log("bicronet_grpc c++ on_response_trailers_received %p count:%d\n",
      stream, trailers->count);
  // for (size_t i = 0; i < trailers->count; ++i) {
  //   log("bicronet_grpc c++ trailer[%lu]: %s %s\n", i, trailers->headers[i].key,
  //           trailers->headers[i].value);
  // }

  bidirectional_stream_header_array* trailers_copy =
      static_cast<bidirectional_stream_header_array*>(
          malloc(sizeof(bidirectional_stream_header_array)));
  trailers_copy->count = trailers->count;
  trailers_copy->capacity = trailers->capacity;
  trailers_copy->headers =
      static_cast<bidirectional_stream_header*>(
          malloc(sizeof(bidirectional_stream_header) * trailers_copy->count));
  bidirectional_stream_header* p_from = trailers->headers;
  bidirectional_stream_header* p_to = trailers_copy->headers;
  for (int i = 0; i < trailers_copy->count; i++) {
    p_to->key = strdup(p_from->key);
    p_to->value = strdup(p_from->value);
    log("bicronet_grpc c++ trailer %d Copied %s:%s\n", i, p_to->key, p_to->value);
    p_to++;
    p_from++;
  }

  DispatchCallback("on_response_trailers_received",
                   get_port_from_stream(stream),
                   CallbackArgBuilder(1, trailers_copy));
}

static void on_succeded(bidirectional_stream* stream) {
  log("bicronet_grpc c++ on_succeded %p\n", stream);
  DispatchCallback("on_succeeded",
                   get_port_from_stream(stream),
                   CallbackArgBuilder(0));
  // don't expect any more callbacks
  reset_port(stream);
}

static void on_failed(bidirectional_stream* stream, int net_error) {
  log("bicronet_grpc c++ on_failed %p net_error:%d\n", stream, net_error);
  DispatchCallback("on_failed",
                   get_port_from_stream(stream),
                   CallbackArgBuilder(1, net_error));
  // don't expect any more callbacks
  reset_port(stream);
}

static void on_canceled(bidirectional_stream* stream) {
  log("bicronet_grpc c++ on_canceled %p\n", stream);
  DispatchCallback("on_canceled",
                   get_port_from_stream(stream),
                   CallbackArgBuilder(0));
  // don't expect any more callbacks
  reset_port(stream);
}

//  stream_engine* engine = bidirectional_stream_engine_create(user_agent);

bidirectional_stream* CreateStreamWithCallbackPort(stream_engine* engine,
                                                   Dart_Port send_port) {
  // TODO(): free when stream no longer need to communicate with dart
  Dart_Port* annotation = static_cast<Dart_Port*>(malloc(sizeof(Dart_Port)));
  *annotation = send_port;
  log("bicronet_grpc c++ CreateStreamWithCallbackPort engine %p, send_port: %llx\n",
      engine, send_port);
  static struct bidirectional_stream_callback callbacks = {
    on_stream_ready,
    on_response_headers_received,
    on_read_completed,
    on_write_completed,
    on_response_trailers_received,
    on_succeded,
    on_failed,
    on_canceled
  };

  return bidirectional_stream_create(engine, annotation, &callbacks);
}


text:
%!TeX tests = bibtex -version
\documentclass{article}

\usepackage{multibib}

\newcites{other}{Other References}

\begin{document}

This may be useful \cite{Kilroy:1942}, but this is definately not \citeother{Angle:2003}.

\bibliographystyle{plain}
\bibliography{foo}

\bibliographystyleother{alpha}
\bibliographyother{foo}

\end{document}


text:
<?php

namespace Grav\Common\Page\Medium;

use Grav\Common\Grav;
use Grav\Common\Media\Interfaces\MediaCollectionInterface;
use Grav\Common\Media\Interfaces\MediaObjectInterface;
use Grav\Common\Page\Page;
use Grav\Common\Utils;
use RocketTheme\Toolbox\ArrayTraits\ArrayAccess;
use RocketTheme\Toolbox\ArrayTraits\Countable;
use RocketTheme\Toolbox\ArrayTraits\Export;
use RocketTheme\Toolbox\ArrayTraits\ExportInterface;
use RocketTheme\Toolbox\ArrayTraits\Iterator;

abstract class AbstractMedia implements ExportInterface, MediaCollectionInterface
{
    use ArrayAccess;
    use Countable;
    use Iterator;
    use Export;

    protected $items = [];
    protected $path;
    protected $images = [];
    protected $videos = [];
    protected $audios = [];
    protected $files = [];
    protected $media_order;

    /**
     * Return media path.
     *
     * @return string
     */
    public function getPath()
    {
        return $this->path;
    }

    public function setPath(?string $path)
    {
        $this->path = $path;
    }

    /**
     * Get medium by filename.
     *
     * @param string $filename
     * @return Medium|null
     */
    public function get($filename)
    {
        return $this->offsetGet($filename);
    }

    /**
     * Call object as function to get medium by filename.
     *
     * @param string $filename
     * @return mixed
     */
    public function __invoke($filename)
    {
        return $this->offsetGet($filename);
    }

    /**
     * Set file modification timestamps (query params) for all the media files.
     *
     * @param string|int|null $timestamp
     * @return $this
     */
    public function setTimestamps($timestamp = null)
    {
        /** @var Medium $instance */
        foreach ($this->items as $instance) {
            $instance->setTimestamp($timestamp);
        }

        return $this;
    }

    /**
     * Get a list of all media.
     *
     * @return MediaObjectInterface[]
     */
    public function all()
    {
        $this->items = $this->orderMedia($this->items);

        return $this->items;
    }

    /**
     * Get a list of all image media.
     *
     * @return MediaObjectInterface[]
     */
    public function images()
    {
        $this->images = $this->orderMedia($this->images);

        return $this->images;
    }

    /**
     * Get a list of all video media.
     *
     * @return MediaObjectInterface[]
     */
    public function videos()
    {
        $this->videos = $this->orderMedia($this->videos);

        return $this->videos;
    }

    /**
     * Get a list of all audio media.
     *
     * @return MediaObjectInterface[]
     */
    public function audios()
    {
        $this->audios = $this->orderMedia($this->audios);

        return $this->audios;
    }

    /**
     * Get a list of all file media.
     *
     * @return MediaObjectInterface[]
     */
    public function files()
    {
        $this->files = $this->orderMedia($this->files);

        return $this->files;
    }

    /**
     * @param string $name
     * @param MediaObjectInterface $file
     */
    public function add($name, $file)
    {
        $this->offsetSet($name, $file);
        switch ($file->type) {
            case 'image':
                $this->images[$name] = $file;
                break;
            case 'video':
                $this->videos[$name] = $file;
                break;
            case 'audio':
                $this->audios[$name] = $file;
                break;
            default:
                $this->files[$name] = $file;
        }
    }

    /**
     * Order the media based on the page's media_order
     *
     * @param array $media
     * @return array
     */
    protected function orderMedia($media)
    {
        if (null === $this->media_order) {
            /** @var Page $page */
            $page = Grav::instance()['pages']->get($this->getPath());

            if ($page && isset($page->header()->media_order)) {
                $this->media_order = array_map('trim', explode(',', $page->header()->media_order));
            }
        }

        if (!empty($this->media_order) && is_array($this->media_order)) {
            $media = Utils::sortArrayByArray($media, $this->media_order);
        } else {
            ksort($media, SORT_NATURAL | SORT_FLAG_CASE);
        }

        return $media;
    }

    /**
     * Get filename, extension and meta part.
     *
     * @param  string $filename
     * @return array
     */
    protected function getFileParts($filename)
    {
        if (preg_match('/(.*)@(\d+)x\.(.*)$/', $filename, $matches)) {
            $name = $matches[1];
            $extension = $matches[3];
            $extra = (int) $matches[2];
            $type = 'alternative';

            if ($extra === 1) {
                $type = 'base';
                $extra = null;
            }
        } else {
            $fileParts = explode('.', $filename);

            $name = array_shift($fileParts);
            $extension = null;
            $extra = null;
            $type = 'base';

            while (($part = array_shift($fileParts)) !== null) {
                if ($part !== 'meta' && $part !== 'thumb') {
                    if (null !== $extension) {
                        $name .= '.' . $extension;
                    }
                    $extension = $part;
                } else {
                    $type = $part;
                    $extra = '.' . $part . '.' . implode('.', $fileParts);
                    break;
                }
            }
        }

        return array($name, $extension, $type, $extra);
    }
}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>Uses of Interface org.apache.edgent.execution.services.RuntimeServices (Edgent v1.1.0)</title>
<meta name="date" content="2017-02-26">
<link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes

Uses of Interface
org.apache.edgent.execution.services.RuntimeServices

Packages that use RuntimeServices

Package
Description

org.apache.edgent.oplet

Oplets API.

org.apache.edgent.providers.direct

Direct execution of a streaming topology.

org.apache.edgent.runtime.etiao

A runtime for executing an Edgent streaming topology, designed as an embeddable library
 so that it can be executed in a simple Java application.

org.apache.edgent.topology

Functional api to build a streaming topology.

Uses of RuntimeServices in org.apache.edgent.oplet

Subinterfaces of RuntimeServices in org.apache.edgent.oplet

Modifier and Type
Interface and Description

interface
OpletContext<I,O>

Context information for the Oplet's invocation context.

Uses of RuntimeServices in org.apache.edgent.providers.direct

Methods in org.apache.edgent.providers.direct that return types with arguments of type RuntimeServices

Modifier and Type
Method and Description

Supplier<RuntimeServices>
DirectTopology.getRuntimeServiceSupplier()

Uses of RuntimeServices in org.apache.edgent.runtime.etiao

Classes in org.apache.edgent.runtime.etiao that implement RuntimeServices

Modifier and Type
Class and Description

class
AbstractContext<I,O>

Provides a skeletal implementation of the OpletContext
 interface.

class
Executable

Executes and provides runtime services to the executable graph
 elements (oplets and functions).

class
InvocationContext<I,O>

Context information for the Oplet's execution context.

Methods in org.apache.edgent.runtime.etiao with parameters of type RuntimeServices

Modifier and Type
Method and Description

void
Invocation.initialize(JobContext job,
          RuntimeServices services)

Initialize the invocation.

Constructors in org.apache.edgent.runtime.etiao with parameters of type RuntimeServices

Constructor and Description

AbstractContext(JobContext job,
               RuntimeServices services)

InvocationContext(java.lang.String id,
                 JobContext job,
                 RuntimeServices services,
                 int inputCount,
                 java.util.List<? extends Consumer<O>> outputs,
                 java.util.List<OutputPortContext> outputContext)

Creates an InvocationContext with the specified parameters.

Uses of RuntimeServices in org.apache.edgent.topology

Methods in org.apache.edgent.topology that return types with arguments of type RuntimeServices

Modifier and Type
Method and Description

Supplier<RuntimeServices>
Topology.getRuntimeServiceSupplier()

Return a function that at execution time
 will return a RuntimeServices instance
 a stream function can use.

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Apache Edgent (incubating)

Prev

Next

Frames

No Frames

All Classes

Copyright © 2017 The Apache Software Foundation. All Rights Reserved - 4744f56-20170226-1707


text:
import trigger from './event.js';
import {Mapper, maxValue} from './parametermapping.js';

export class InputHandler {
  constructor() {
    this.sliders = new Map()
      .set('masterGain', {title: ['quiet', 'loud']})
      .set('tempo', {title: ['slow', 'fast']})
      .set('tightness', {title: ['loose', 'tight'], initial: 0.75 * maxValue})
    ;
    var sliders = document.getElementById('sliders');
    for (let [key,value] of this.sliders.entries()) {
      value.callback = Mapper.map(key);
      var slider = document.createElement('div');
      slider.setAttribute('class', 'slider');
      var label = document.createElement('label');
      var text = document.createTextNode(value.title[0]);
      label.appendChild(text);
      var input = document.createElement('input');
      input.setAttribute('id', 'slider-' + key);
      input.setAttribute('type', 'range');
      input.setAttribute('min', '0');
      input.setAttribute('max', '' + maxValue);
      label.appendChild(input);
      var text2 = document.createTextNode(value.title[1]);
      label.appendChild(text2);
      slider.appendChild(label);
      sliders.appendChild(slider);
      input.addEventListener('input', value.callback, false);
      var initialValue = value.initial || (maxValue / 2);
      input.value = '' + initialValue;
      value.callback({target: {value: initialValue}});
    }
    var button = document.getElementById('playpause');
    button.addEventListener('click', () => {
      trigger('playpause');
    })
  }
}


text:
require 'sinatra'
require 'json'

class ThermostatController < Sinatra::Application
enable :sessions
set :session_secret, "secret"

set :public_folder, proc { File.join(root) }
set :views, Proc.new { File.join(root, "views") }

  get '/' do
    erb :index
  end

  get '/temperature' do
    if session[:temperature]
      temp = {temp: session[:temperature]}
    else
      temp = {temp: 20}
    end
    JSON.generate(temp)
  end

  post '/temperature' do
    session[:temperature] = params[:temp]
  end

  run! if app_file == $0
end


text:
\hypertarget{structrocksdb_1_1TableProperties}{}\section{rocksdb\+:\+:Table\+Properties Struct Reference}
\label{structrocksdb_1_1TableProperties}\index{rocksdb\+::\+Table\+Properties@{rocksdb\+::\+Table\+Properties}}
\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item
std\+::string {\bfseries To\+String} (const std\+::string \&prop\+\_\+delim=\char`\"{}; \char`\"{}, const std\+::string \&kv\+\_\+delim=\char`\"{}=\char`\"{}) const\hypertarget{structrocksdb_1_1TableProperties_a1765630751c3f5bdd6c617f4b44ee858}{}\label{structrocksdb_1_1TableProperties_a1765630751c3f5bdd6c617f4b44ee858}

\item
void {\bfseries Add} (const \hyperlink{structrocksdb_1_1TableProperties}{Table\+Properties} \&tp)\hypertarget{structrocksdb_1_1TableProperties_acb38cadf3f051101f2a61c6385f57147}{}\label{structrocksdb_1_1TableProperties_acb38cadf3f051101f2a61c6385f57147}

\end{DoxyCompactItemize}
\subsection*{Public Attributes}
\begin{DoxyCompactItemize}
\item
uint64\+\_\+t {\bfseries data\+\_\+size} = 0\hypertarget{structrocksdb_1_1TableProperties_aa19f1cca160494e67a142ffeba03d315}{}\label{structrocksdb_1_1TableProperties_aa19f1cca160494e67a142ffeba03d315}

\item
uint64\+\_\+t {\bfseries index\+\_\+size} = 0\hypertarget{structrocksdb_1_1TableProperties_a5be9c67d6ad3b834eaae0dd8a46fc597}{}\label{structrocksdb_1_1TableProperties_a5be9c67d6ad3b834eaae0dd8a46fc597}

\item
uint64\+\_\+t {\bfseries filter\+\_\+size} = 0\hypertarget{structrocksdb_1_1TableProperties_a27b9bd50ad2fefd0219397364814d5c7}{}\label{structrocksdb_1_1TableProperties_a27b9bd50ad2fefd0219397364814d5c7}

\item
uint64\+\_\+t {\bfseries raw\+\_\+key\+\_\+size} = 0\hypertarget{structrocksdb_1_1TableProperties_aaff307e34c262c4809e2b564ffe8f5c3}{}\label{structrocksdb_1_1TableProperties_aaff307e34c262c4809e2b564ffe8f5c3}

\item
uint64\+\_\+t {\bfseries raw\+\_\+value\+\_\+size} = 0\hypertarget{structrocksdb_1_1TableProperties_a703a1934f01c88827fec52c58d166169}{}\label{structrocksdb_1_1TableProperties_a703a1934f01c88827fec52c58d166169}

\item
uint64\+\_\+t {\bfseries num\+\_\+data\+\_\+blocks} = 0\hypertarget{structrocksdb_1_1TableProperties_a4ee984809b836ea14c3e5e80b3add02a}{}\label{structrocksdb_1_1TableProperties_a4ee984809b836ea14c3e5e80b3add02a}

\item
uint64\+\_\+t {\bfseries num\+\_\+entries} = 0\hypertarget{structrocksdb_1_1TableProperties_a20104b30dc6567bd576ad63152db8e1f}{}\label{structrocksdb_1_1TableProperties_a20104b30dc6567bd576ad63152db8e1f}

\item
uint64\+\_\+t {\bfseries format\+\_\+version} = 0\hypertarget{structrocksdb_1_1TableProperties_a2903a2711e59bec0dad6b29d61d69842}{}\label{structrocksdb_1_1TableProperties_a2903a2711e59bec0dad6b29d61d69842}

\item
uint64\+\_\+t {\bfseries fixed\+\_\+key\+\_\+len} = 0\hypertarget{structrocksdb_1_1TableProperties_a89dd7cb7e24a68b610d594355db1e2ff}{}\label{structrocksdb_1_1TableProperties_a89dd7cb7e24a68b610d594355db1e2ff}

\item
uint64\+\_\+t {\bfseries column\+\_\+family\+\_\+id}
\item
std\+::string {\bfseries column\+\_\+family\+\_\+name}\hypertarget{structrocksdb_1_1TableProperties_a7205e28a5b059e8919c2f342ec0718f6}{}\label{structrocksdb_1_1TableProperties_a7205e28a5b059e8919c2f342ec0718f6}

\item
std\+::string {\bfseries filter\+\_\+policy\+\_\+name}\hypertarget{structrocksdb_1_1TableProperties_a126ce72e5ccd2de56684e4993c24f959}{}\label{structrocksdb_1_1TableProperties_a126ce72e5ccd2de56684e4993c24f959}

\item
User\+Collected\+Properties {\bfseries user\+\_\+collected\+\_\+properties}\hypertarget{structrocksdb_1_1TableProperties_a91b4581d8bd7f9ee2a2adf1fba775a54}{}\label{structrocksdb_1_1TableProperties_a91b4581d8bd7f9ee2a2adf1fba775a54}

\item
User\+Collected\+Properties {\bfseries readable\+\_\+properties}\hypertarget{structrocksdb_1_1TableProperties_acc3d8a0af78f830ddcd472dce0a327f6}{}\label{structrocksdb_1_1TableProperties_acc3d8a0af78f830ddcd472dce0a327f6}

\end{DoxyCompactItemize}

\subsection{Member Data Documentation}
\index{rocksdb\+::\+Table\+Properties@{rocksdb\+::\+Table\+Properties}!column\+\_\+family\+\_\+id@{column\+\_\+family\+\_\+id}}
\index{column\+\_\+family\+\_\+id@{column\+\_\+family\+\_\+id}!rocksdb\+::\+Table\+Properties@{rocksdb\+::\+Table\+Properties}}
\subsubsection[{\texorpdfstring{column\+\_\+family\+\_\+id}{column\_family\_id}}]{\setlength{\rightskip}{0pt plus 5cm}uint64\+\_\+t rocksdb\+::\+Table\+Properties\+::column\+\_\+family\+\_\+id}\hypertarget{structrocksdb_1_1TableProperties_a9046d2fe3f1eab7dbefe9b011b5b0c09}{}\label{structrocksdb_1_1TableProperties_a9046d2fe3f1eab7dbefe9b011b5b0c09}
{\bfseries Initial value\+:}
\begin{DoxyCode}
=
      rocksdb::TablePropertiesCollectorFactory::Context::kUnknownColumnFamily
\end{DoxyCode}

The documentation for this struct was generated from the following file\+:\begin{DoxyCompactItemize}
\item
Appserver/src/external/rocksdb/table\+\_\+properties.\+h\end{DoxyCompactItemize}


text:
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package org.chromium.telemetry_shell;

import android.app.Activity;
import android.os.Bundle;
import android.webkit.CookieManager;
import android.webkit.WebView;
import android.webkit.WebViewClient;

/**
 * This activity is designed for Telemetry testing of WebView.
 */
public class TelemetryActivity extends Activity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        getWindow().setTitle(
                getResources().getString(R.string.title_activity_telemetry));
        setContentView(R.layout.activity_telemetry);

        WebView webView = (WebView) findViewById(R.id.webview);
        CookieManager.setAcceptFileSchemeCookies(true);
        webView.getSettings().setJavaScriptEnabled(true);

        webView.setWebViewClient(new WebViewClient() {
                @Override
                public boolean shouldOverrideUrlLoading(WebView webView, String url) {
                    return false;
                }
        });

        webView.loadUrl("about:blank");
    }
}


text:
using System;
using System.Collections;

namespace DeviceHive
{
    /// <summary>
    /// Equipment data structure
    /// </summary>
    /// <remarks>
    /// Represents the DeviceEquipment data object compliant to HTTP API v.6 specification.
    /// Used to specify command parameters in /device/{ID}/command GET, POST and PUT messages.
    /// </remarks>
    [Serializable]
    public class DeviceEquipment
    {
        /// <summary>
        /// Timestamp of the command
        /// </summary>
        /// <remarks>
        /// Created by server.
        /// </remarks>
        public string timestamp;

        /// <summary>
        /// Command name
        /// </summary>
        public string name;

        /// <summary>
        /// Name-value array of parameters
        /// </summary>
        public Hashtable parameters;

        public override int GetHashCode()
        {
            return ObjectHelpers.GetHashCode(timestamp)
                ^ ObjectHelpers.GetHashCode(name)
                ^ ObjectHelpers.GetHashCode(parameters);
        }
    }
}


text:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
    <class name="org.snaker.engine.entity.CCOrder" table="wf_cc_order">
		<composite-id>
		    <key-property name="orderId" column="ORDER_ID"/>
		    <key-property name="actorId" column="ACTOR_ID"/>
		</composite-id>
		<property name="status" type="java.lang.Integer" column="status"/>
    </class>
</hibernate-mapping>


text:
import java.net.*;
import java.util.*;
import java.text.*;
import java.io.*;
import java.nio.*;
import java.nio.channels.*;
import java.util.*;
import com.sun.net.httpserver.*;
import javax.security.auth.*;
import javax.security.auth.callback.*;
import javax.security.auth.login.*;

class LogFilter extends Filter {

    PrintStream ps;
    DateFormat df;

    LogFilter (File file) throws IOException {
        ps = new PrintStream (new FileOutputStream (file));
        df = DateFormat.getDateTimeInstance();
    }

    /**
     * The filter's implementation, which is invoked by the serve r
     */
    public void doFilter (HttpExchange t, Filter.Chain chain) throws IOException
    {
        chain.doFilter (t);
        HttpContext context = t.getHttpContext();
        Headers rmap = t.getRequestHeaders();
        String s = df.format (new Date());
        s = s +" " + t.getRequestMethod() + " " + t.getRequestURI() + " ";
        s = s +" " + t.getResponseCode () +" " + t.getRemoteAddress();
        ps.println (s);
    }

    public void init (HttpContext ctx) {}

    public String description () {
        return "Request logger";
    }

    public void destroy (HttpContext c){}
}


text:
package main

import (
	"container/list"
	log "github.com/Sirupsen/logrus"
	"github.com/gtfierro/cs262-project/common"
	"sync"
	"time"
)

type Broker struct {
	common.BrokerInfo
	connectionActive bool
	alive            bool
	doneChan         chan bool
	waitGroup        *sync.WaitGroup
	rcvWaitGroup     *sync.WaitGroup
	aliveLock        sync.Mutex
	aliveCond        *sync.Cond
	activeCond       *sync.Cond

	outstandingMessages    map[common.MessageIDType]common.SendableWithID // messageID -> message
	outMessageLock         sync.RWMutex
	messageHandler         MessageHandler
	messageSendBuffer      chan common.Sendable
	requestHeartbeatBuffer chan chan bool
	heartbeatBuffer        chan bool
	heartbeatInterval      time.Duration
	terminating            chan bool // send on this channel when broker is shutting down permanently
	clock                  common.Clock
	deathChannel           chan *Broker
	listElem               *list.Element
	pubClientMapLock       sync.RWMutex
}

func NewBroker(broker *common.BrokerInfo, messageHandler MessageHandler,
	heartbeatInterval time.Duration, clock common.Clock, deathChannel chan *Broker) *Broker {
	bc := new(Broker)
	bc.BrokerInfo = *broker
	bc.terminating = make(chan bool)
	bc.messageSendBuffer = make(chan common.Sendable, 200) // TODO buffer size?
	bc.requestHeartbeatBuffer = make(chan chan bool, 20)
	bc.heartbeatBuffer = make(chan bool, 5)
	bc.outstandingMessages = make(map[common.MessageIDType]common.SendableWithID)
	bc.aliveLock = sync.Mutex{}
	bc.aliveCond = sync.NewCond(&bc.aliveLock)
	bc.activeCond = sync.NewCond(&bc.aliveLock)
	bc.outMessageLock = sync.RWMutex{}
	bc.messageHandler = messageHandler
	bc.heartbeatInterval = heartbeatInterval
	bc.clock = clock
	bc.deathChannel = deathChannel
	return bc
}

func (bc *Broker) PushToList(l *list.List) {
	bc.listElem = l.PushBack(bc)
}

func (bc *Broker) RemoveFromList(l *list.List) {
	l.Remove(bc.listElem)
}

// Start up communication with this broker, asynchronously
// Calling this on an existing Broker before calling WaitForCleanup
// will result in undefined behavior
func (bc *Broker) StartAsynchronously(commConn CommConn) {
	var wasAlive bool
	bc.aliveLock.Lock()
	if !bc.alive {
		wasAlive = false
		bc.doneChan = make(chan bool, 1)
		bc.waitGroup = new(sync.WaitGroup)
		bc.rcvWaitGroup = new(sync.WaitGroup)
	} else {
		// transient connection issue; didn't determine death of broker
		wasAlive = true
	}
	done, wg, receiveWg := bc.doneChan, bc.waitGroup, bc.rcvWaitGroup
	bc.alive = true
	bc.connectionActive = true
	bc.terminating = make(chan bool)
	bc.aliveLock.Unlock()
	receiveWg.Add(1)
	go bc.receiveLoop(commConn, done, receiveWg)
	wg.Add(1)
	go bc.sendLoop(commConn, done, wg)
	if !wasAlive {
		wg.Add(1)
		go bc.monitorHeartbeats(done, wg)
		go bc.cleanupWhenDone(done, receiveWg, wg)
	}
}

// Instruct this Broker to terminate itself
func (bc *Broker) Terminate() {
	close(bc.terminating)
}

// Wait until all of this Broker's threads and connections have been cleaned
func (bc *Broker) WaitForCleanup() {
	bc.aliveLock.Lock()
	for bc.alive == true {
		bc.aliveCond.Wait()
	}
	bc.aliveLock.Unlock()
}

// Asynchonously a message to this Broker
func (bc *Broker) Send(msg common.Sendable) {
	bc.messageSendBuffer <- msg
}

// Request a heartbeat from this broker and wait until it is determined whether
// or not the broker is alive (a heartbeat is received or it times out)
// Returns true if the broker is alive, or else false
func (bc *Broker) RequestHeartbeatAndWait() bool {
	bc.messageSendBuffer <- &common.RequestHeartbeatMessage{}
	respChan := make(chan bool)
	bc.requestHeartbeatBuffer <- respChan

	bc.aliveLock.Lock()
	if !bc.connectionActive {
		bc.aliveLock.Unlock()
		return false
	}
	bc.aliveLock.Unlock()

	determineDeathChan := make(chan bool)
	go func() {
		bc.aliveLock.Lock()
		for bc.connectionActive && !common.IsChanClosed(determineDeathChan) {
			bc.activeCond.Wait()
		}
		bc.aliveLock.Unlock()
		if !common.IsChanClosed(determineDeathChan) {
			close(determineDeathChan)
		}
	}()
	select {
	case ready := <-respChan:
		close(determineDeathChan)
		bc.aliveLock.Lock()
		bc.activeCond.Broadcast()
		bc.aliveLock.Unlock()
		return ready
	case <-determineDeathChan:
		return false
	}
}

// Returns true iff currently alive
func (bc *Broker) IsAlive() bool {
	bc.aliveLock.Lock()
	defer bc.aliveLock.Unlock()
	return bc.alive
}

// Monitor heartbeats from the broker and determine death if necessary
func (bc *Broker) monitorHeartbeats(done chan bool, wg *sync.WaitGroup) {
	defer wg.Done()
	lastHeartbeat := time.Now()
	nextHeartbeat := lastHeartbeat.Add(bc.heartbeatInterval)
	heartbeatRequested := false
	outstandingRespChans := make(map[chan bool]struct{})
	hbRequest := common.RequestHeartbeatMessage{}
	for {
		log.WithFields(log.Fields{
			"broker": bc.BrokerID, "heartbeatInterval": bc.heartbeatInterval,
		}).Debug("About to sleep while waiting for a heartbeat from broker")
		select {
		case <-done:
			return
		case <-bc.terminating:
			return
		default: // continue on
		}
		select {
		case <-bc.clock.After(nextHeartbeat.Sub(lastHeartbeat)):
			elapsed := bc.clock.Now().Sub(lastHeartbeat)
			if elapsed >= 3*bc.heartbeatInterval { // determine that it's dead
				log.WithFields(log.Fields{
					"broker": bc.BrokerID, "heartbeatInterval": bc.heartbeatInterval, "secSinceResponse": elapsed.Seconds(),
				}).Warn("Broker has not responded; determining death")
				for respChan, _ := range outstandingRespChans {
					respChan <- false // Broker is dead
				}
				closeIfNotClosed(done)
			} else if elapsed >= 2*bc.heartbeatInterval && !heartbeatRequested {
				log.WithFields(log.Fields{
					"brokerID": bc.BrokerID, "heartbeatInterval": bc.heartbeatInterval, "secSinceResponse": elapsed.Seconds(),
				}).Warn("Broker has not responded; sending HeartbeatRequest")
				bc.messageSendBuffer <- &hbRequest
			} else if elapsed >= 1*bc.heartbeatInterval && heartbeatRequested {
				log.WithFields(log.Fields{
					"brokerID": bc.BrokerID, "heartbeatInterval": bc.heartbeatInterval, "secSinceResponse": elapsed.Seconds(),
				}).Warn("Broker has not responded after requesting a heartbeat; determining death")
				for respChan, _ := range outstandingRespChans {
					respChan <- false // Broker is dead
				}
				closeIfNotClosed(done)
			}
		case respChan := <-bc.requestHeartbeatBuffer:
			// TODO maybe ignore it and just return true on the channel if it's only been
			// e.g. 1/10 of an heartbeatInterval since the last heartbeat to avoid flooding?
			if !heartbeatRequested { // only do anything if we haven't already requested one
				heartbeatRequested = true
				nextHeartbeat = bc.clock.Now().Add(bc.heartbeatInterval)
			}
			outstandingRespChans[respChan] = struct{}{}
		case <-bc.heartbeatBuffer:
			lastHeartbeat = bc.clock.Now()
			nextHeartbeat = lastHeartbeat.Add(bc.heartbeatInterval)
			heartbeatRequested = false
			for respChan, _ := range outstandingRespChans {
				respChan <- true // Broker is still alive
			}
		case <-done:
			return
		case <-bc.terminating:
			return
		}
	}
}

// Wait for a signal on done or bc.terminating, and then close conn
func (bc *Broker) cleanupWhenDone(done chan bool, receiveWg, wg *sync.WaitGroup) {
	// Simply wait for a done or terminating signal
	select {
	case <-done:
	case <-bc.terminating:
	}
	log.WithField("broker", bc.BrokerID).Debug("Broker cleanup; waiting on the workGroup")
	wg.Wait() // Wait for heartbeat monitoring and sendLoop
	//commConn.Close() // Close connection to force receiveLoop to finish
	log.WithField("broker", bc.BrokerID).Debug("Broker cleanup; waiting on the rcvLoop")
	receiveWg.Wait()
	bc.deathChannel <- bc
	bc.aliveLock.Lock()
	bc.connectionActive = false
	bc.alive = false
	bc.aliveCond.Broadcast()
	bc.aliveLock.Unlock()
}

// Watch for incoming messages from the broker. Internally handles acknowledgments and heartbeats;
// other messages are provided to bc.messageHandler.
// Watches for messages until bc.alive is false or an EOF is reached
func (bc *Broker) receiveLoop(commConn CommConn, done chan bool, wg *sync.WaitGroup) {
	log.WithField("brokerID", bc.BrokerID).Info("Beginning to receive messages from broker")
	defer wg.Done()
	for {
		msg, err := commConn.ReceiveMessage()
		select {
		case <-done:
			commConn.Close()
			log.WithField("brokerID", bc.BrokerID).Warn("No longer receiving messages from broker (death)")
			return
		case <-bc.terminating:
			log.WithField("brokerID", bc.BrokerID).Info("No longer receiving messages from broker (termination)")
			return
		default: // fall through
		}
		if err == nil {
			switch m := msg.(type) {
			case *common.AcknowledgeMessage:
				log.WithField("brokerID", bc.BrokerID).WithField("ID", m.MessageID).Debug("Received ACK from Broker for messageID")
				bc.handleAck(m)
			case *common.HeartbeatMessage:
				log.WithField("brokerID", bc.BrokerID).Debug("Received heartbeat from Broker")
				bc.heartbeatBuffer <- true
			default:
				log.WithFields(log.Fields{
					"brokerID": bc.BrokerID, "message": msg, "messageType": common.GetMessageType(msg),
				}).Info("Received message from broker")
				go bc.messageHandler(&MessageFromBroker{msg, bc})
			}
		} else {
			//closeIfNotClosed(done)
			bc.aliveLock.Lock()
			bc.connectionActive = false
			bc.activeCond.Broadcast()
			bc.aliveLock.Unlock()
			commConn.Close()
			log.WithFields(log.Fields{
				"brokerID": bc.BrokerID, "error": err,
			}).Warn("Temporarily no longer receiving messages from broker; error encountered")
			return // connection closed
		}
	}
}

func (bc *Broker) sendLoop(commConn CommConn, done chan bool, wg *sync.WaitGroup) {
	var err error
	log.WithField("brokerID", bc.BrokerID).Info("Beginning the send loop to broker")
	defer wg.Done()
	for {
		select {
		case msg := <-bc.messageSendBuffer:
			switch m := msg.(type) {
			case common.SendableWithID:
				err = bc.sendEnsureDelivery(commConn, m, done)
			case common.Sendable:
				log.WithFields(log.Fields{
					"brokerID": bc.BrokerID, "message": m, "messageType": common.GetMessageType(m),
				}).Info("Sending message to broker...")
				err = commConn.Send(m)
			}
			if err != nil {
				bc.messageSendBuffer <- msg
				//closeIfNotClosed(done)
				bc.aliveLock.Lock()
				bc.connectionActive = false
				bc.activeCond.Broadcast()
				bc.aliveLock.Unlock()
				commConn.Close()
				log.WithFields(log.Fields{
					"brokerID": bc.BrokerID, "error": err,
				}).Warn("Temporarily not sending to broker; error encountered")
				return
			}
		case <-done:
			commConn.Close()
			log.WithField("brokerID", bc.BrokerID).Warn("Exiting the send loop to broker (death)")
			for _, pendingMsg := range commConn.GetPendingMessages() {
				bc.messageSendBuffer <- pendingMsg // Store for later
			}
			return
		case <-bc.terminating:
			log.WithField("brokerID", bc.BrokerID).Info("Exiting the send loop to broker (termination)")
			return
		}
	}
}

func (bc *Broker) sendEnsureDelivery(commConn CommConn, message common.SendableWithID,
	done chan bool) (err error) {
	log.WithFields(log.Fields{
		"brokerID": bc.BrokerID, "message": message, "messageType": common.GetMessageType(message),
	}).Info("Sending message to broker with ensured delivery...")
	err = commConn.Send(message)
	if err != nil {
		return err
	}
	bc.outMessageLock.Lock()
	bc.outstandingMessages[message.GetID()] = message
	bc.outMessageLock.Unlock()
	go func() {
		select {
		case <-bc.terminating:
			return
		case <-done:
		case <-bc.clock.After(5 * time.Second):
		}
		bc.outMessageLock.RLock()
		msg, ok := bc.outstandingMessages[message.GetID()]
		bc.outMessageLock.RUnlock()
		if ok {
			log.WithFields(log.Fields{
				"brokerID": bc.BrokerID, "message": msg, "messageType": common.GetMessageType(msg),
			}).Info("Send with ensured delivery has not been acked; placing back onto send buf")
			bc.messageSendBuffer <- msg // put back onto the queue to be sent again
		}
	}()
	return
}

// Handles an acknowledgment by removing the MessageID from the outstanding
// messages map
func (bc *Broker) handleAck(ack *common.AcknowledgeMessage) {
	log.WithFields(log.Fields{
		"brokerID": bc.BrokerID, "ackMessage": ack,
	}).Debug("Received ack from broker for message")
	bc.outMessageLock.Lock()
	defer bc.outMessageLock.Unlock()
	delete(bc.outstandingMessages, ack.MessageID)
}

func closeIfNotClosed(channel chan bool) {
	select {
	case _, ok := <-channel:
		if ok {
			close(channel)
		}
	default:
		close(channel)
	}
}


text:
<?xml version="1.0" encoding="utf-8"?>
<ApplicationManifest xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ApplicationTypeName="WCFMicroServiceType" ApplicationTypeVersion="1.0.0" xmlns="http://schemas.microsoft.com/2011/01/fabric">
   <Parameters>
      <Parameter Name="StatefulMicroService1_MinReplicaSetSize" DefaultValue="2" />
      <Parameter Name="StatefulMicroService1_PartitionCount" DefaultValue="1" />
      <Parameter Name="StatefulMicroService1_TargetReplicaSetSize" DefaultValue="3" />
      <Parameter Name="FrontEndGateway_InstanceCount" DefaultValue="-1" />
   </Parameters>
   <ServiceManifestImport>
      <ServiceManifestRef ServiceManifestName="StatefulMicroService1Pkg" ServiceManifestVersion="1.0.0" />
      <ConfigOverrides />
   </ServiceManifestImport>
   <ServiceManifestImport>
      <ServiceManifestRef ServiceManifestName="FrontEndGatewayPkg" ServiceManifestVersion="1.0.0" />
      <ConfigOverrides />
   </ServiceManifestImport>
   <DefaultServices>
      <Service Name="StatefulMicroService1">
         <StatefulService ServiceTypeName="StatefulMicroService1Type" TargetReplicaSetSize="[StatefulMicroService1_TargetReplicaSetSize]" MinReplicaSetSize="[StatefulMicroService1_MinReplicaSetSize]">
            <UniformInt64Partition PartitionCount="[StatefulMicroService1_PartitionCount]" LowKey="-9223372036854775808" HighKey="9223372036854775807" />
         </StatefulService>
      </Service>
      <Service Name="FrontEndGateway">
         <StatelessService ServiceTypeName="FrontEndGatewayType" InstanceCount="[FrontEndGateway_InstanceCount]">
            <SingletonPartition />
         </StatelessService>
      </Service>
   </DefaultServices>
</ApplicationManifest>


text:
// Package apiserver contains the code that provides a rest.ful api service.
package apiserver // import "k8s.io/kubernetes/pkg/apiserver"


text:
<?php

namespace INCES\ComedorBundle\Tests\Controller;

use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;

class DefaultControllerTest extends WebTestCase
{
  public function setUp()
  {
    $this->client = static::createClient();
  }

  public function testIndex()
  {
    $crawler = $this->client->request('GET', '/');

    $this->assertGreaterThan(
      0,
      $crawler->filter('html:contains("Login")')->count()
    );
  }

  public function testError()
  {
    $crawler = $this->client->request('GET', '/error');

    $this->assertGreaterThan(
      0,
      $crawler->filter('html:contains("Oops! An error has occurred")')->count()
    );
  }
}


text:
<resources>

    <!--
        Base application theme, dependent on API level. This theme is replaced
        by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
    -->
    <style name="AppBaseTheme" parent="android:Theme.Black">
        <!--
            Theme customizations available in newer API levels can go in
            res/values-vXX/styles.xml, while customizations related to
            backward-compatibility can go here.
        -->
    </style>

    <!-- Application theme. -->
    <style name="AppTheme" parent="AppBaseTheme">
        <!-- All customizations that are NOT specific to a particular API-level can go here. -->
    </style>

    <style name="BatteryProgressBar" parent="android:Widget.ProgressBar.Horizontal">
        <item name="android:indeterminateOnly">false</item>
        <item name="android:progressDrawable">@drawable/battery_progress_bar</item>
        <item name="android:minHeight">10dip</item>
        <item name="android:maxHeight">20dip</item>
    </style>

    <style name="BatteryLevelMajor" parent="BatteryLevelMinor">
        <item name="android:textStyle">bold</item>
        <item name="android:fontFamily">sans-serif</item>
    </style>

    <style name="BatteryLevelMinor">
        <item name="android:textAppearance">?android:attr/textAppearanceLarge</item>
        <item name="android:textSize">80sp</item>
        <item name="android:textIsSelectable">false</item>
        <item name="android:textStyle">normal</item>
        <item name="android:layout_centerVertical">true</item>
        <item name="android:fontFamily">sans-serif-light</item>
    </style>

</resources>


text:
'''
MAP Client Plugin
'''

__version__ = '0.1.1'
__author__ = 'Hugh Sorby'
__stepname__ = 'Heart Surface'
__location__ = 'https://github.com/mapclient-plugins/heartsurfacesegmenter/archive/v0.1.1.zip'

# import class that derives itself from the step mountpoint.
from mapclientplugins.heartsurfacesegmenterstep import step


text:
package main

import "unsafe"

type myPointer unsafe.Pointer

const _ = unsafe.Pointer(uintptr(1)) // ERROR "is not (a )?constant"
const _ = myPointer(uintptr(1)) // ERROR "is not (a )?constant"

const _ = (*int)(unsafe.Pointer(uintptr(1))) // ERROR "is not (a )?constant"
const _ = (*int)(myPointer(uintptr(1))) // ERROR "is not (a )?constant"

const _ = uintptr(unsafe.Pointer(uintptr(1))) // ERROR "is not (a )?constant"
const _ = uintptr(myPointer(uintptr(1))) // ERROR "is not (a )?constant"

const _ = []byte("") // ERROR "is not (a )?constant"
const _ = []rune("") // ERROR "is not (a )?constant"


text:
<?php

$languageStrings = array(

    //Blocks
    'LBL_PBXMANAGER_INFORMATION' => 'Detalles de la llamada',
    'LBL_CUSTOM_INFORMATION'=>'Información personalizada',

    // list view settings links
    'LBL_SERVER_CONFIGURATION' => 'Configuración de proveedor',

    //Detail view header title
    'LBL_CALL_FROM' => 'Llamad desde',
    'LBL_CALL_TO' => 'Llamado a la',

    //Incoming call pop-up
    'LBL_HIDDEN' => '(Oculto)',

    // Fields
    'Total Duration' => 'Duración (seg)',
    'Bill Duration'  => 'Bill Duración (seg)',
    'Recording URL' => 'Grabación',

    'SINGLE_PBXManager' => 'Call Record' ,

);


text:
beluganos_install() {
    OPTS="--with-opennsl=$BEL_ONSL_ENABLE" ./bootstrap.sh
    if [ "${ENABLE_VIRTUALENV}" = "yes" ]; then
        make release
    else
        make install
        make fflow-install
        sudo make fibc-install
    fi
}

netconf_install() {
    if [ "${BEL_NC_ENABLE}" != "yes" ]; then
        return
    fi

    local NC_DIR=${LXD_WORK_DIR}/netconf

    if [ -e $NC_DIR ]; then
        pushd $NC_DIR
    else
        git clone $BEL_NC_URL $NC_DIR || { echo "beluganos_netconf/clone error."; exit 1; }
        pushd $NC_DIR
    fi

    PROXY=${PROXY} ./create.sh beluganos-netconf

    popd
}


text:
<?php
include_once dirname(__FILE__) . '/default.php';
include_once dirname(__FILE__) . '/lime.php';
include_once dirname(__FILE__) . '/../../vendor/autoload.php';


text:
#ifndef Vxa_ICollection_Interface
#define Vxa_ICollection_Interface

#ifndef Vxa_ICollection
#define Vxa_ICollection extern
#endif

/************************
 *****  Components  *****
 ************************/

#include "Vxa_ISingleton.h"

/**************************
 *****  Declarations  *****
 **************************/

DECLARE_VxaINTERFACE (ICaller)

VINTERFACE_TEMPLATE_INSTANTIATIONS_AT_LEVEL (Vxa,ICollection,2)

/*************************
 *****  Definitions  *****
 *************************/

namespace Vxa {

//  Bind   (pCaller, rMessageName, cParameters, cTask); // Intention form
//  Invoke (pCaller, rMessageName, cParameters, cTask); // Extension form

    VINTERFACE_ROLE (ICollection, ISingleton)
	VINTERFACE_ROLE_4 (Bind  , ICaller*, VString const&, cardinality_t, cardinality_t);
	VINTERFACE_ROLE_4 (Invoke, ICaller*, VString const&, cardinality_t, cardinality_t);
	VINTERFACE_ROLE_1 (QueryCardinality, IVReceiver<cardinality_t>*);
    VINTERFACE_ROLE_END

    VxaINTERFACE (ICollection, ISingleton);
	VINTERFACE_METHOD_4 (Bind  , ICaller*, VString const&, cardinality_t, cardinality_t);
	VINTERFACE_METHOD_4 (Invoke, ICaller*, VString const&, cardinality_t, cardinality_t);
	VINTERFACE_METHOD_1 (QueryCardinality, IVReceiver<cardinality_t>*);
    VINTERFACE_END
}

#endif


text:
**pre-requisite:**
- all the ones listed in [README.md](README.md)
- X11 (X Window System)

```bash
DISPLAY=$DISPLAY docker-compose run intellij /usr/share/intellij/bin/idea.sh
```

***Note: If you don't know how to configure X11, take a look at [this blog post](http://fabiorehm.com/blog/2014/09/11/running-gui-apps-with-docker/).***


text:
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

/**
 * The {@link com.azure.cosmos.models.CosmosItemRequestOptions} that allows to specify options for encryption /
 * decryption.
 */
package com.azure.cosmos.encryption;

import com.azure.cosmos.models.CosmosItemRequestOptions;

import java.util.function.Consumer;

// TODO: how invoking setter methods chaining works? parent setters returns CosmosItemRequestOptions
// this class setter require EncryptionItemRequestOptions
public class EncryptionItemRequestOptions extends CosmosItemRequestOptions {

    private Consumer<DecryptionResult> decryptionResultHandler;
    private EncryptionOptions encryptionOptions;

    /**
     * Gets options to be provided for encryption of data.
     * @return EncryptionOptions the configured encryption options.
     */
    public EncryptionOptions getEncryptionOptions() {
        return encryptionOptions;
    }

    /**
     * Gets delegate method that will be invoked (if configured) in case of decryption failure.
     * @return the configured handler of DecryptionResult
     */
    public Consumer<DecryptionResult> getDecryptionResultHandler() {
        return decryptionResultHandler;
    }

    /**
     * Sets options to be provided for encryption of data.
     * @param encryptionOptions encryption options.
     * @return EncryptionItemRequestOptions the current request options.
     */
    public EncryptionItemRequestOptions setEncryptionOptions(EncryptionOptions encryptionOptions) {
        this.encryptionOptions = encryptionOptions;
        return this;
    }

    /**
     * Sets delegate method that will be invoked (if configured) in case of decryption failure.
     *
     * If DecryptionResultHandler is not configured, we throw exception.
     * If DecryptionResultHandler is configured, we invoke the delegate method and return the encrypted document as
     * is (without decryption) in case of failure.
     *
     * @param decryptionResultHandler failure handler for decryption.
     * @return EncryptionItemRequestOptions the current request options.
     */
    public EncryptionItemRequestOptions setDecryptionResultHandler(Consumer<DecryptionResult> decryptionResultHandler) {
        this.decryptionResultHandler = decryptionResultHandler;
        return this;
    }
}


text:
namespace kepler {
namespace gl {

shared_ptr<Material> Material::create() {
    return std::make_shared<Material>();
}

shared_ptr<Material> Material::create(const shared_ptr<Technique>& technique) {
    auto mat = create();
    mat->setTechnique(technique);
    return mat;
}

shared_ptr<Technique> Material::technique() const {
    return _technique;
}

const std::string& Material::name() const {
    return _name;
}

void Material::setName(const std::string& name) {
    _name.assign(name);
}

void Material::setTechnique(const shared_ptr<Technique>& technique) {
    if (_technique != technique) {
        if (_technique) {
            _technique->setMaterial(nullptr);
        }
        _technique = technique;
        if (_technique) {
            _technique->setMaterial(shared_from_this());
        }
    }
}

void Material::addParam(const shared_ptr<MaterialParameter>& param) {
    _parameters[param->name()] = param;
}

shared_ptr<MaterialParameter> Material::param(const std::string& name) const {
    auto p = _parameters.find(name);
    if (p != _parameters.end()) {
        return p->second;
    }
    return nullptr;
}

void Material::bind() {
    if (_technique) {
        _technique->bind();
    }
}
}
}


text:
// Copyright (c) 2011-2015 ScalaMock Contributors (https://github.com/paulbutcher/ScalaMock/graphs/contributors)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

package org.scalamock.test.specs2

import org.scalamock.test.mockable.TestTrait
import org.scalamock.specs2.IsolatedMockFactory
import org.specs2.mutable.Specification

/**
 *  Tests for mocks defined in suite scope (i.e. outside test case scope)
 *
 *  Tests for issue #25
 */
class SuiteScopeMockParallelTest extends Specification with IsolatedMockFactory {
  // please note that this test suite runs in isolated mode

  val mockWithoutExpectationsPredefined = mock[TestTrait]

  "Specs2 suite" should {
    "allow to use mock defined suite scope" in {
      (mockWithoutExpectationsPredefined.oneParamMethod _).expects(1).returning("one")
      (mockWithoutExpectationsPredefined.oneParamMethod _).expects(2).returning("two")

      mockWithoutExpectationsPredefined.oneParamMethod(1) must_== "one"
      mockWithoutExpectationsPredefined.oneParamMethod(2) must_== "two"
    }

    "allow to use mock defined suite scope in more than one test case" in {
      (mockWithoutExpectationsPredefined.oneParamMethod _).expects(3).returning("three")

      mockWithoutExpectationsPredefined.oneParamMethod(3) must_== "three"
    }
  }
}


text:
<!DOCTYPE html>

    <meta http-equiv="Content-Security-Policy" content="default-src 'self' data: gap: https://ssl.gstatic.com 'unsafe-eval'; style-src 'self' 'unsafe-inline'; media-src *">
    <meta name="format-detection" content="telephone=no">
    <meta name="msapplication-tap-highlight" content="no">
    <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width">
    <link rel="stylesheet" type="text/css" href="jquery/jquery.mobile-1.4.5.min.css">

    <title>Group Members</title>

        Back

          David Rusu

        Home

Here's a link:  LinkedIn! maybe go there to see.

About

Work

Play


text:
//----------------------------------*-C++-*----------------------------------//
/**
 *  @file   Quadrature.i.hh
 *  @brief  Quadrature inline member definitions
 *  @author Jeremy Roberts
 *  @date   Sep 5, 2012
 */
//---------------------------------------------------------------------------//

#ifndef detran_angle_QUADRATURE_I_HH_
#define detran_angle_QUADRATURE_I_HH_

namespace detran_angle
{

inline Quadrature::size_t Quadrature::number_angles() const
{
  return d_number_angles;
}

inline Quadrature::size_t Quadrature::number_octants() const
{
  return d_number_octants;
}

inline Quadrature::size_t Quadrature::number_angles_octant() const
{
  return d_number_angles_octant;
}

//inline Quadrature::size_t Quadrature::number_azimuths_octant() const
//{
//  THROW("A PRODUCT QUADRATURE MUST IMPLEMENT THIS");
//  return 0;
//}
//
//inline Quadrature::size_t Quadrature::number_polar_octant() const
//{
//  THROW("A PRODUCT QUADRATURE MUST IMPLEMENT THIS");
//  return 0;
//}

inline Quadrature::size_t Quadrature::index(const size_t o, const size_t a)
{
  Require(o < d_number_octants);
  Require(a < d_number_angles_octant);
  size_t angle = a + o * d_number_angles_octant;
  Ensure(angle < d_number_angles);
  return angle;
}

//inline Quadrature::size_t Quadrature::angle(const size_t a, const size_t p) const
//{
//  THROW("NOT A PRODUCT QUADRATURE");
//  return 0;
//}

inline const Quadrature::vec_dbl& Quadrature::weights() const
{
  return d_weight;
}

inline const Quadrature::vec_dbl& Quadrature::cosines(const size_t dir) const
{
  if (dir == MU)
  {
    return d_mu;
  }
  else if (dir == ETA)
  {
    Require(d_dimension > 1);
    return d_eta;
  }
  else
  {
    Require(d_dimension > 1);
    return d_xi;
  }
}

inline double Quadrature::weight(const size_t a) const
{
  Require(a < d_number_angles_octant);
  return d_weight[a];
}

inline double Quadrature::mu(const size_t o, const size_t a) const
{
  Require(a < d_number_angles_octant);
  Require(o < d_number_octants);
  return d_octant_sign[o][MU] * d_mu[a];
}

inline double Quadrature::eta(const size_t o, const size_t a) const
{
  Require(a < d_number_angles_octant);
  Require(o < d_number_octants);
  return d_octant_sign[o][ETA] * d_eta[a];
}

inline double Quadrature::xi(const size_t o, const size_t a) const
{
  Require(a < d_number_angles_octant);
  Require(o < d_number_octants);
  return d_octant_sign[o][XI] * d_xi[a];
}

inline double Quadrature::angular_norm(const size_t d)
{
  Require(d < 4);
  if (d == 1)
    return 0.5;
  else
    return detran_utilities::inv_four_pi;
}

inline bool Quadrature::valid_index(const size_t o, const size_t a) const
{
  if (o < d_number_octants && a < d_number_angles_octant)
  {
    return true;
  }
  else
  {
    return false;
  }
}

} // end namespace detran_angle

#endif // detran_angle_QUADRATURE_I_HH_

//---------------------------------------------------------------------------//
//              end of file Quadrature.i.hh
//---------------------------------------------------------------------------//


text:
# easy.js
A small, versatile JavaScript library.

## Documentation
```JavaScript
// easy or $ can both be used to represent the library
// you can also create a global variable to hold the value of this library
// for example:
var lib = easy; // or var lib = $;

// in case you are using jQuery or other JavaScript libraries/framework that use $ as an alias
// OR
// you are using another variable called 'easy' but it is not the library
// like var easy = 0
// you can use easy.noConflict like this
if(easy && easy.noConflict) {
  easy.noConflict()
}

// if you want to do something as soon as document is ready (DOMContentLoaded)
// you could use $.ready
$.ready(function(){
  // ...
});

// easy.repeat = for loop
// normally, you would use:
  for(var i=0;i<someOtherVariable;i++) {
    // ...
  }

// with easyJS, you do:
  $.repeat(function(i){
    // ...
  },someOtherVariable);

// easy.get = document.querySelectorAll + more
// getting all 'p' element
  $.get('p')

// getting all 'class' as class element
  $.get('.class')

// getting element with id
  $.get('#id')

// getting elements with attribute
  $.get('div[class=div]')

/*
  NOTE: $.get will return an array-like object if there are more than one elements that match the selector,
        which means $.get('p').doSomeThing() would not work.
*/
// You must specify an index:
  $.get('p')[index]

// If you need to call a function on every item in the array-like object, you can use:
  $().each(fn,true)
```
```
// (this===documentation && documentation.toBeContinued)
```