text:
import numpy as np

from scipy.linalg import svd

from mne.io import Raw
from mne import pick_types

import scipy.io as sio
from scipy.linalg import pinv
from mne.preprocessing.infomax_ import infomax
from numpy.testing import assert_almost_equal
from mne.utils import random_permutation
from mne.datasets import testing
import os.path as op

base_dir = op.join(op.dirname(__file__), 'data')

def generate_data_for_comparing_against_eeglab_infomax(ch_type, random_state):

    data_dir = op.join(testing.data_path(download=False), 'MEG', 'sample')
    raw_fname = op.join(data_dir, 'sample_audvis_trunc_raw.fif')

    raw = Raw(raw_fname, preload=True)

    if ch_type == 'eeg':
        picks = pick_types(raw.info, meg=False, eeg=True, exclude='bads')
    else:
        picks = pick_types(raw.info, meg=ch_type,
                           eeg=False, exclude='bads')

    # select a small number of channels for the test
    number_of_channels_to_use = 5
    idx_perm = random_permutation(picks.shape[0], random_state)
    picks = picks[idx_perm[:number_of_channels_to_use]]

    raw.filter(1, 45, n_jobs=2)
    X = raw[picks, :][0][:, ::20]

    # Subtract the mean
    mean_X = X.mean(axis=1)
    X -= mean_X[:, None]

    # pre_whitening: z-score
    X /= np.std(X)

    T = X.shape[1]
    cov_X = np.dot(X, X.T) / T

    # Let's whiten the data
    U, D, _ = svd(cov_X)
    W = np.dot(U, U.T / np.sqrt(D)[:, None])
    Y = np.dot(W, X)

    return Y

@testing.requires_testing_data
def test_mne_python_vs_eeglab():
    """ Test eeglab vs mne_python infomax code.
    """
    random_state = 42

    methods = ['infomax', 'infomax', 'extended_infomax', 'extended_infomax']
    list_ch_types = ['eeg', 'mag', 'eeg', 'mag']

    for method, ch_type in zip(methods, list_ch_types):

        if method == 'infomax':
            if ch_type == 'eeg':
                eeglab_results_file = 'eeglab_infomax_results_eeg_data.mat'
            elif ch_type == 'mag':
                eeglab_results_file = 'eeglab_infomax_results_meg_data.mat'

        elif method == 'extended_infomax':

            if ch_type == 'eeg':
                eeglab_results_file = ('eeglab_extended_infomax_results_eeg_'
                                       'data.mat')
            elif ch_type == 'mag':
                eeglab_results_file = ('eeglab_extended_infomax_results_meg_'
                                       'data.mat')

        Y = generate_data_for_comparing_against_eeglab_infomax(ch_type,
                                                               random_state)
        N = Y.shape[0]
        T = Y.shape[1]

        # For comparasion against eeglab, make sure the following
        # parameters have the same value in mne_python and eeglab:
        #
        # - starting point
        # - random state
        # - learning rate
        # - block size
        # - blowup parameter
        # - blowup_fac parameter
        # - tolerance for stopping the algorithm
        # - number of iterations
        # - anneal_step parameter
        #
        # Notes:
        # * By default, eeglab whiten the data using the "sphering transform"
        #   instead of pca. The mne_python infomax code does not
        #   whiten the data. To make sure both mne_python and eeglab starts
        #   from the same point (i.e., the same matrix), we need to make sure
        #   to whiten the data outside, and pass these whiten data to
        #   mne_python and eeglab. Finally, we need to tell eeglab that
        #   the input data is already whiten, this can be done by calling
        #   eeglab with the following syntax:
        #
        #   % Run infomax
        #   [unmixing,sphere,meanvar,bias,signs,lrates,sources,y] = ...
        #       runica( Y, 'sphering', 'none');
        #
        #   % Run extended infomax
        #   [unmixing,sphere,meanvar,bias,signs,lrates,sources,y]  = ...
        #       runica( Y, 'sphering', 'none', 'extended', 1);
        #
        #   By calling eeglab using the former code, we are using its default
        #   parameters, which are specified below in the section
        #   "EEGLAB default parameters".
        #
        # * eeglab does not expose a parameter for fixing the random state.
        #   Therefore, to accomplish this, we need to edit the runica.m
        #   file located at /path_to_eeglab/functions/sigprocfunc/runica.m
        #
        #   i) Comment the line related with the random number generator
        #      (line 812).
        #   ii) Then, add the following line just below line 812:
        #       rng(42); %use 42 as random seed.
        #
        # * eeglab does not have the parameter "n_small_angle",
        #   so we need to disable it for making a fair comparison.
        #
        # * Finally, we need to take the unmixing matrix estimated by the
        #   mne_python infomax implementation and order the components
        #   in the same way that eeglab does. This is done below in the section
        #   "Order the components in the same way that eeglab does".

        ###############################################################
        # EEGLAB default parameters
        ###############################################################
        l_rate_eeglab = 0.00065 / np.log(N)
        block_eeglab = int(np.ceil(np.min([5 * np.log(T), 0.3 * T])))
        blowup_eeglab = 1e9
        blowup_fac_eeglab = 0.8
        max_iter_eeglab = 512

        if method == 'infomax':
            anneal_step_eeglab = 0.9
            use_extended = False

        elif method == 'extended_infomax':
            anneal_step_eeglab = 0.98
            use_extended = True

        if N > 32:
            w_change_eeglab = 1e-7
        else:
            w_change_eeglab = 1e-6
        ###############################################################

        # Call mne_python infomax version using the following sintax
        # to obtain the same result than eeglab version
        unmixing = infomax(Y.T, extended=use_extended,
                           random_state=random_state,
                           max_iter=max_iter_eeglab,
                           l_rate=l_rate_eeglab,
                           block=block_eeglab,
                           w_change=w_change_eeglab,
                           blowup=blowup_eeglab,
                           blowup_fac=blowup_fac_eeglab,
                           n_small_angle=None,
                           anneal_step=anneal_step_eeglab
                           )

        #######################################################################
        # Order the components in the same way that eeglab does
        #######################################################################

        sources = np.dot(unmixing, Y)
        mixing = pinv(unmixing)

        mvar = np.sum(mixing ** 2, axis=0) * \
            np.sum(sources ** 2, axis=1) / (N * T - 1)
        windex = np.argsort(mvar)[::-1]

        unmixing_ordered = unmixing[windex, :]
        #######################################################################

        #######################################################################
        # Load the eeglab results, then compare the unmixing matrices estimated
        # by mne_python and eeglab. To make the comparison use the
        # \ell_inf norm:
        # ||unmixing_mne_python - unmixing_eeglab||_inf
        #######################################################################

        eeglab_data = sio.loadmat(op.join(base_dir, eeglab_results_file))
        unmixing_eeglab = eeglab_data['unmixing_eeglab']

        maximum_difference = np.max(np.abs(unmixing_ordered - unmixing_eeglab))

        assert_almost_equal(maximum_difference, 1e-12, decimal=10)


text:
from functools import cmp_to_key

class Player:
    def __init__(self, name, score):
        self.name = name
        self.score = score

    @staticmethod
    def comparator(a, b):
        if a.score > b.score:
            return -1
        elif b.score > a.score:
            return 1
        elif a.name > b.name:
            return 1
        elif b.name > a.name:
            return -1
        else:
            return 0

n = int(input())
data = []
for _ in range(n):
    name, score = input().split()
    score = int(score)
    player = Player(name, score)
    data.append(player)

data = sorted(data, key=cmp_to_key(Player.comparator))
for i in data:
    print(i.name, i.score)

redpajama_set_name: RedPajamaGithub


text:
title: August Meetup Details Announced
author: joemccann
layout: post
permalink: /august-meetup-details/
categories:
  - Uncategorized
---
After last month's massive turnout, it is officially clear that the only way to beat the Austin heat is to come to the Austin JavaScript meetup (duh).  With that being said, we are expecting all of you to return for this month's installment of the meetup as we have local living legend, [Mike Cravey][1], here to serve up the fundamentals of JavaScript and jQuery.

Mike Cravey ([@craveytrain][1]), a UI Engineer at [WhaleShark Media][2], has loads of web development experience on the back and the front end.  Sadly, his biggest claim to fame is that he hired [Joe McCann][3] a few years back.  What you may not also know is that he has led some internal talks on the basics and fundamentals of JavaScript and his preferred library, jQuery.

Mike's talk will focus on the fundamentals of JavaScript the language.  Think you know it all?  We guarantee you will learn something new, unless you are [@andrewdupont][4] BECAUSE HE KNOWS ALL [#dupontCAPS][5].  Moreover, the introductory talk with cover things like function hoisting and closures, but even simpler topics like basic expressions.  Noobs are certainly welcome so if you are one or know someone, be sure they attend.  The presentation will be a quick one, so feel free to chime in while Cravey runs the show.

Of course we will followup all of this up with our wildly crowd-pleasing roundtable of JavaScript-related questions. This is an open forum to present topics of discussion in a rapid-fire manner.

Since [Joe][3] is still on gypsy status, [Alex Sexton][6] will be hosting the meetup again!

  * When: Tuesday, August 16th, 2011 from 7:30-9:00 PM.
  * Where: frog – 101 West 6th Street – 2nd Floor
  * How: Parking is on the street, or you can take any number of buses to get downtown.
  * Afterwards, the discussion carries on a few blocks away at [The Gingerman][7], where they have over 70 beers on tap.

Any questions or suggestions, please feel free to contact Joe ([@joemccann][3]) or Alex ([@slexaxton][6]). Also, be sure to follow us on Twitter: @AustinJS

 [1]: http://twitter.com/craveytrain
 [2]: http://whalesharkmedia.com
 [3]: http://twitter.com/joemccann
 [4]: http://twitter.com/andrewdupont
 [5]: http://search.twitter.com/?q=#dupontCaps
 [6]: http://twitter.com/slexaxton
 [7]: http://gingermanpub.com/


text:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              xmlns:app="http://schemas.android.com/apk/res-auto"
              xmlns:tools="http://schemas.android.com/tools"
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:fitsSystemWindows="true"
              android:orientation="vertical"
              tools:context="com.oklab.gitjourney.fragments.FeedListFragment">

    <android.support.v4.widget.SwipeRefreshLayout
        android:id="@+id/swipe_refresh_layout"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_behavior="@string/appbar_scrolling_view_behavior">

        <!-- A RecyclerView with some commonly used attributes -->
        <android.support.v7.widget.RecyclerView
            android:id="@+id/items_list_recycler_view"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:scrollbars="vertical"/>

    </android.support.v4.widget.SwipeRefreshLayout>
</LinearLayout>


text:
namespace caprica { namespace papyrus { namespace statements {

struct PapyrusExpressionStatement final : public PapyrusStatement
{
  expressions::PapyrusExpression* expression{ nullptr };

  explicit PapyrusExpressionStatement(CapricaFileLocation loc) : PapyrusStatement(loc) { }
  PapyrusExpressionStatement(const PapyrusExpressionStatement&) = delete;
  virtual ~PapyrusExpressionStatement() override = default;

  virtual bool buildCFG(PapyrusCFG& cfg) const override {
    cfg.appendStatement(this);
    return false;
  }

  virtual void buildPex(pex::PexFile* file, pex::PexFunctionBuilder& bldr) const override {
    bldr.freeValueIfTemp(expression->generateLoad(file, bldr));
  }

  virtual void semantic(PapyrusResolutionContext* ctx) override {
    // We don't explicitly use the result of the expression, so we don't
    // check it for poison.
    expression->semantic(ctx);
  }

  virtual void visit(PapyrusStatementVisitor& visitor) override {
    visitor.visit(this);
  }
};

}}}


text:
namespace {

using tesseract::MutableIterator;
using tesseract::PageIteratorLevel;
using tesseract::ResultIterator;

const char* kStrings8087_054[] = {
    "dat", "Dalmatian", "", "DAMAGED DURING", "margarine,", nullptr};
const PolyBlockType kBlocks8087_054[] = {PT_HEADING_TEXT, PT_FLOWING_TEXT,
                                         PT_PULLOUT_IMAGE, PT_CAPTION_TEXT,
                                         PT_FLOWING_TEXT};

// The fixture for testing Tesseract.
class LayoutTest : public testing::Test {
 protected:
  std::string TestDataNameToPath(const std::string& name) {
    return file::JoinPath(TESTING_DIR, "/" + name);
  }
  std::string TessdataPath() {
    return file::JoinPath(TESSDATA_DIR, "");
  }

  LayoutTest() { src_pix_ = nullptr; }
  ~LayoutTest() { pixDestroy(&src_pix_); }

  void SetImage(const char* filename, const char* lang) {
    pixDestroy(&src_pix_);
    src_pix_ = pixRead(TestDataNameToPath(filename).c_str());
    api_.Init(TessdataPath().c_str(), lang, tesseract::OEM_TESSERACT_ONLY);
    api_.SetPageSegMode(tesseract::PSM_AUTO);
    api_.SetImage(src_pix_);
  }

  // Tests reading order and block finding (very roughly) by iterating
  // over the blocks, expecting that they contain the strings in order,
  // allowing for other blocks in between.
  // An empty string should match an image block, and a nullptr string
  // indicates the end of the array.
  void VerifyBlockTextOrder(const char* strings[], const PolyBlockType* blocks,
                            ResultIterator* it) {
    it->Begin();
    int string_index = 0;
    int block_index = 0;
    do {
      char* block_text = it->GetUTF8Text(tesseract::RIL_BLOCK);
      if (block_text != nullptr && it->BlockType() == blocks[string_index] &&
          strstr(block_text, strings[string_index]) != nullptr) {
        LOG(INFO) << "Found string " << strings[string_index]
          << " in block " << block_index
          << " of type " << kPolyBlockNames[blocks[string_index]] << "\n";
        // Found this one.
        ++string_index;
      } else if (it->BlockType() == blocks[string_index] &&
                 block_text == nullptr && strings[string_index][0] == '\0') {
        LOG(INFO) << "Found block of type " << kPolyBlockNames[blocks[string_index]]
           << " at block " << block_index << "\n";
        // Found this one.
        ++string_index;
      } else {
        LOG(INFO) << "No match found in block with text:\n" << block_text;
      }
      delete[] block_text;
      ++block_index;
      if (strings[string_index] == nullptr) break;
    } while (it->Next(tesseract::RIL_BLOCK));
    EXPECT_TRUE(strings[string_index] == nullptr);
  }

  // Tests that approximate order of the biggest text blocks is correct.
  // Correctness is tested by the following simple rules:
  // If a block overlaps its predecessor in x, then it must be below it.
  // otherwise, if the block is not below its predecessor, then it must
  // be to the left of it if right_to_left is true, or to the right otherwise.
  void VerifyRoughBlockOrder(bool right_to_left, ResultIterator* it) {
    int prev_left = 0;
    int prev_right = 0;
    int prev_bottom = 0;
    it->Begin();
    do {
      int left, top, right, bottom;
      if (it->BoundingBox(tesseract::RIL_BLOCK, &left, &top, &right, &bottom) &&
          PTIsTextType(it->BlockType()) && right - left > 800 &&
          bottom - top > 200) {
        if (prev_right > prev_left) {
          if (std::min(right, prev_right) > std::max(left, prev_left)) {
            EXPECT_GE(top, prev_bottom) << "Overlapping block should be below";
          } else if (top < prev_bottom) {
            if (right_to_left) {
              EXPECT_GE(prev_left, right) << "Block should be to the left";
            } else {
              EXPECT_GE(left, prev_right) << "Block should be to the right";
            }
          }
        }
        prev_left = left;
        prev_right = right;
        prev_bottom = bottom;
      }
    } while (it->Next(tesseract::RIL_BLOCK));
  }

  // Tests that every blob assigned to the biggest text blocks is contained
  // fully within its block by testing that the block polygon winds around
  // the center of the bounding boxes of the outlines in the blob.
  void VerifyTotalContainment(int winding_target, MutableIterator* it) {
    it->Begin();
    do {
      int left, top, right, bottom;
      if (it->BoundingBox(tesseract::RIL_BLOCK, &left, &top, &right, &bottom) &&
          PTIsTextType(it->BlockType()) && right - left > 800 &&
          bottom - top > 200) {
        const PAGE_RES_IT* pr_it = it->PageResIt();
        POLY_BLOCK* pb = pr_it->block()->block->pdblk.poly_block();
        CHECK(pb != nullptr);
        FCOORD skew = pr_it->block()->block->skew();
        EXPECT_GT(skew.x(), 0.0f);
        EXPECT_GT(skew.y(), 0.0f);
        // Iterate the words in the block.
        MutableIterator word_it = *it;
        do {
          const PAGE_RES_IT* w_it = word_it.PageResIt();
          // Iterate the blobs in the word.
          C_BLOB_IT b_it(w_it->word()->word->cblob_list());
          for (b_it.mark_cycle_pt(); !b_it.cycled_list(); b_it.forward()) {
            C_BLOB* blob = b_it.data();
            // Iterate the outlines in the blob.
            C_OUTLINE_IT ol_it(blob->out_list());
            for (ol_it.mark_cycle_pt(); !ol_it.cycled_list(); ol_it.forward()) {
              C_OUTLINE* ol = ol_it.data();
              TBOX box = ol->bounding_box();
              ICOORD middle((box.left() + box.right()) / 2,
                            (box.top() + box.bottom()) / 2);
              EXPECT_EQ(winding_target, pb->winding_number(middle));
            }
          }
        } while (word_it.Next(tesseract::RIL_WORD) &&
                 !word_it.IsAtBeginningOf(tesseract::RIL_BLOCK));
      }
    } while (it->Next(tesseract::RIL_BLOCK));
  }

  Pix* src_pix_;
  std::string ocr_text_;
  tesseract::TessBaseAPI api_;
};

// Tests that Tesseract gets the important blocks and in the right order
// on a UNLV page numbered 8087_054.3B.tif. (Dubrovnik)
TEST_F(LayoutTest, UNLV8087_054) {
  SetImage("8087_054.3B.tif", "eng");
  // Just run recognition.
  EXPECT_EQ(api_.Recognize(nullptr), 0);
  // Check iterator position.
  tesseract::ResultIterator* it = api_.GetIterator();
  VerifyBlockTextOrder(kStrings8087_054, kBlocks8087_054, it);
  delete it;
}

// Tests that Tesseract gets the important blocks and in the right order
// on GOOGLE:13510798882202548:74:84.sj-79.tif (Hebrew image)
// TODO: replace hebrew.png by Google image referred above
TEST_F(LayoutTest, HebrewOrderingAndSkew) {
  SetImage("hebrew.png", "eng");
  // Just run recognition.
  EXPECT_EQ(api_.Recognize(nullptr), 0);
  tesseract::MutableIterator* it = api_.GetMutableIterator();
  // In eng mode, block order should not be RTL.
  VerifyRoughBlockOrder(false, it);
  VerifyTotalContainment(1, it);
  delete it;
  // Now try again using Hebrew.
  SetImage("hebrew.png", "heb");
  // Just run recognition.
  EXPECT_EQ(api_.Recognize(nullptr), 0);
  it = api_.GetMutableIterator();
  // In heb mode, block order should be RTL.
  VerifyRoughBlockOrder(true, it);
  // And blobs should still be fully contained.
  VerifyTotalContainment(-1, it);
  delete it;
}

}  // namespace


text:
import { EditorState, RichUtils, SelectionState, Modifier } from 'draft-js';

const insertImage = (editorState, matchArr) => {
  const currentContent = editorState.getCurrentContent();
  const selection = editorState.getSelection();
  const key = selection.getStartKey();
  const [matchText, alt, src, title] = matchArr;
  const { index } = matchArr;
  const focusOffset = index + matchText.length;
  const wordSelection = SelectionState.createEmpty(key).merge({
    anchorOffset: index,
    focusOffset,
  });
  const nextContent = currentContent.createEntity('IMG', 'IMMUTABLE', { alt, src, title });
  const entityKey = nextContent.getLastCreatedEntityKey();
  let newContentState = Modifier.replaceText(nextContent, wordSelection, '\u200B', null, entityKey);
  newContentState = Modifier.insertText(newContentState, newContentState.getSelectionAfter(), ' ');
  const newWordSelection = wordSelection.merge({
    focusOffset: index + 1,
  });
  let newEditorState = EditorState.push(editorState, newContentState, 'insert-image');
  newEditorState = RichUtils.toggleLink(newEditorState, newWordSelection, entityKey);
  return EditorState.forceSelection(newEditorState, newContentState.getSelectionAfter());
};

export default insertImage;


text:
/**
 * wp.media.controller.State
 *
 * A state is a step in a workflow that when set will trigger the controllers
 * for the regions to be updated as specified in the frame.
 *
 * A state has an event-driven lifecycle:
 *
 *     'ready'      triggers when a state is added to a state machine's collection.
 *     'activate'   triggers when a state is activated by a state machine.
 *     'deactivate' triggers when a state is deactivated by a state machine.
 *     'reset'      is not triggered automatically. It should be invoked by the
 *                  proper controller to reset the state to its default.
 *
 * @class
 * @augments Backbone.Model
 */
var State = Backbone.Model.extend({
	/**
	 * Constructor.
	 *
	 * @since 3.5.0
	 */
	constructor: function() {
		this.on( 'activate', this._preActivate, this );
		this.on( 'activate', this.activate, this );
		this.on( 'activate', this._postActivate, this );
		this.on( 'deactivate', this._deactivate, this );
		this.on( 'deactivate', this.deactivate, this );
		this.on( 'reset', this.reset, this );
		this.on( 'ready', this._ready, this );
		this.on( 'ready', this.ready, this );
		/**
		 * Call parent constructor with passed arguments
		 */
		Backbone.Model.apply( this, arguments );
		this.on( 'change:menu', this._updateMenu, this );
	},
	/**
	 * Ready event callback.
	 *
	 * @abstract
	 * @since 3.5.0
	 */
	ready: function() {},

	/**
	 * Activate event callback.
	 *
	 * @abstract
	 * @since 3.5.0
	 */
	activate: function() {},

	/**
	 * Deactivate event callback.
	 *
	 * @abstract
	 * @since 3.5.0
	 */
	deactivate: function() {},

	/**
	 * Reset event callback.
	 *
	 * @abstract
	 * @since 3.5.0
	 */
	reset: function() {},

	/**
	 * @access private
	 * @since 3.5.0
	 */
	_ready: function() {
		this._updateMenu();
	},

	/**
	 * @access private
	 * @since 3.5.0
	*/
	_preActivate: function() {
		this.active = true;
	},

	/**
	 * @access private
	 * @since 3.5.0
	 */
	_postActivate: function() {
		this.on( 'change:menu', this._menu, this );
		this.on( 'change:titleMode', this._title, this );
		this.on( 'change:content', this._content, this );
		this.on( 'change:toolbar', this._toolbar, this );

		this.frame.on( 'title:render:default', this._renderTitle, this );

		this._title();
		this._menu();
		this._toolbar();
		this._content();
		this._router();
	},

	/**
	 * @access private
	 * @since 3.5.0
	 */
	_deactivate: function() {
		this.active = false;

		this.frame.off( 'title:render:default', this._renderTitle, this );

		this.off( 'change:menu', this._menu, this );
		this.off( 'change:titleMode', this._title, this );
		this.off( 'change:content', this._content, this );
		this.off( 'change:toolbar', this._toolbar, this );
	},

	/**
	 * @access private
	 * @since 3.5.0
	 */
	_title: function() {
		this.frame.title.render( this.get('titleMode') || 'default' );
	},

	/**
	 * @access private
	 * @since 3.5.0
	 */
	_renderTitle: function( view ) {
		view.$el.text( this.get('title') || '' );
	},

	/**
	 * @access private
	 * @since 3.5.0
	 */
	_router: function() {
		var router = this.frame.router,
			mode = this.get('router'),
			view;

		this.frame.$el.toggleClass( 'hide-router', ! mode );
		if ( ! mode ) {
			return;
		}

		this.frame.router.render( mode );

		view = router.get();
		if ( view && view.select ) {
			view.select( this.frame.content.mode() );
		}
	},

	/**
	 * @access private
	 * @since 3.5.0
	 */
	_menu: function() {
		var menu = this.frame.menu,
			mode = this.get('menu'),
			view;

		this.frame.$el.toggleClass( 'hide-menu', ! mode );
		if ( ! mode ) {
			return;
		}

		menu.mode( mode );

		view = menu.get();
		if ( view && view.select ) {
			view.select( this.id );
		}
	},

	/**
	 * @access private
	 * @since 3.5.0
	 */
	_updateMenu: function() {
		var previous = this.previous('menu'),
			menu = this.get('menu');

		if ( previous ) {
			this.frame.off( 'menu:render:' + previous, this._renderMenu, this );
		}

		if ( menu ) {
			this.frame.on( 'menu:render:' + menu, this._renderMenu, this );
		}
	},

	/**
	 * Create a view in the media menu for the state.
	 *
	 * @access private
	 * @since 3.5.0
	 *
	 * @param {media.view.Menu} view The menu view.
	 */
	_renderMenu: function( view ) {
		var menuItem = this.get('menuItem'),
			title = this.get('title'),
			priority = this.get('priority');

		if ( ! menuItem && title ) {
			menuItem = { text: title };

			if ( priority ) {
				menuItem.priority = priority;
			}
		}

		if ( ! menuItem ) {
			return;
		}

		view.set( this.id, menuItem );
	}
});

_.each(['toolbar','content'], function( region ) {
	/**
	 * @access private
	 */
	State.prototype[ '_' + region ] = function() {
		var mode = this.get( region );
		if ( mode ) {
			this.frame[ region ].render( mode );
		}
	};
});

module.exports = State;


text: Check if you wish to publish produced build artifacts to Artifactory.


text:
layout: page
title: Aeon Rain Solutions Conference
date: 2016-05-24
author: Robert Dominguez
tags: weekly links, java
status: published
summary: Sed aliquam elit arcu, in commodo quam porta nec. Aenean.
banner: images/banner/people.jpg
booking:
  startDate: 11/20/2019
  endDate: 11/25/2019
  ctyhocn: OGBCDHX
  groupCode: ARSC
published: true
---
Nunc eget erat felis. Vivamus ac condimentum nisi. Aliquam ex purus, vulputate sed ullamcorper non, pulvinar in elit. Integer nec lectus tortor. Quisque molestie quis turpis vitae molestie. Cras eu quam ligula. Maecenas rhoncus accumsan nisl quis aliquam. Cras posuere lectus in porta pretium. Suspendisse rutrum tortor nisi, et vestibulum odio vulputate quis.

* Maecenas in odio eu mi mollis rutrum non a lorem
* Sed ac sapien vehicula, efficitur neque et, dignissim ante
* Pellentesque malesuada magna ullamcorper odio eleifend porta
* In tristique velit efficitur est sagittis, sed mattis erat posuere
* Nam sed eros eget dui efficitur tincidunt eu et est.

Vivamus in lacus in tellus lobortis rutrum. Sed sagittis nunc et mollis mollis. Quisque sollicitudin dictum scelerisque. Maecenas malesuada dui eget odio laoreet, ut congue sapien venenatis. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Cras quis viverra tellus, sit amet finibus risus. Curabitur sodales semper tellus sed porttitor.
Pellentesque luctus interdum nibh, nec vulputate neque suscipit eget. Etiam sodales nunc quis lobortis accumsan. Phasellus aliquam ante massa, eget finibus odio congue eu. Vestibulum mollis nulla eu nunc tristique feugiat a vel urna. Integer risus massa, ultrices eget tristique ut, feugiat ac ligula. Pellentesque ut risus ut turpis cursus porttitor. Cras vitae velit molestie, volutpat ligula ut, consectetur felis. Donec nisl lorem, iaculis nec sem eu, accumsan condimentum nibh. Aenean viverra bibendum elit ac volutpat. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus sit amet nunc at dolor lacinia posuere id ut dolor. Mauris iaculis est sed sem tempor, nec aliquet mauris volutpat.


text:
/////////////////////////////////////////////////////////////////////////////
// Name:        clipbrd.h
// Purpose:     interface of wxClipboard
// Author:      wxWidgets team
// Licence:     wxWindows licence
/////////////////////////////////////////////////////////////////////////////

/**
    The backwards compatible access macro that returns the global clipboard
    object pointer.
*/
#define wxTheClipboard

/**
    @class wxClipboard

    A class for manipulating the clipboard.

    To use the clipboard, you call member functions of the global
    ::wxTheClipboard object.

    See the @ref overview_dataobject for further information.

    Call wxClipboard::Open() to get ownership of the clipboard. If this
    operation returns @true, you now own the clipboard. Call
    wxClipboard::SetData() to put data on the clipboard, or
    wxClipboard::GetData() to retrieve data from the clipboard. Call
    wxClipboard::Close() to close the clipboard and relinquish ownership. You
    should keep the clipboard open only momentarily.

    For example:

    @code
    // Write some text to the clipboard
    if (wxTheClipboard->Open())
    {
        // This data objects are held by the clipboard,
        // so do not delete them in the app.
        wxTheClipboard->SetData( new wxTextDataObject("Some text") );
        wxTheClipboard->Close();
    }

    // Read some text
    if (wxTheClipboard->Open())
    {
        if (wxTheClipboard->IsSupported( wxDF_TEXT ))
        {
            wxTextDataObject data;
            wxTheClipboard->GetData( data );
            wxMessageBox( data.GetText() );
        }
        wxTheClipboard->Close();
    }
    @endcode

    @note On GTK, the clipboard behavior can vary depending on the configuration of
          the end-user's machine. In order for the clipboard data to persist after
          the window closes, a clipboard manager must be installed. Some clipboard
          managers will automatically flush the clipboard after each new piece of
          data is added, while others will not. The @Flush() function will force
          the clipboard manager to flush the data.

    @library{wxcore}
    @category{dnd}

    @see @ref overview_dnd, @ref overview_dataobject, wxDataObject
*/
class wxClipboard : public wxObject
{
public:
    /**
        Default constructor.
    */
    wxClipboard();

    /**
        Destructor.
    */
    virtual ~wxClipboard();

    /**
        Call this function to add the data object to the clipboard.

        This is an obsolete synonym for SetData().
    */
    virtual bool AddData(wxDataObject* data);

    /**
        Clears the global clipboard object and the system's clipboard if
        possible.
    */
    virtual void Clear();

    /**
        Call this function to close the clipboard, having opened it with
        Open().
    */
    virtual void Close();

    /**
        Flushes the clipboard: this means that the data which is currently on
        clipboard will stay available even after the application exits
        (possibly eating memory), otherwise the clipboard will be emptied on
        exit.

        Currently this method is implemented in MSW and GTK and always returns @false
        otherwise.

        @note On GTK, only the non-primary selection can be flushed. Calling this function
              when the clipboard is using the primary selection will return @false and not
              make any data available after the program exits.

        @return @false if the operation is unsuccessful for any reason.
    */
    virtual bool Flush();

    /**
        Call this function to fill @a data with data on the clipboard, if
        available in the required format. Returns @true on success.
    */
    virtual bool GetData(wxDataObject& data);

    /**
        Returns @true if the clipboard has been opened.
    */
    virtual bool IsOpened() const;

    /**
        Returns @true if there is data which matches the data format of the
        given data object currently @b available on the clipboard.

        @todo The name of this function is misleading. This should be renamed
              to something that more accurately indicates what it does.
    */
    virtual bool IsSupported(const wxDataFormat& format);

    /**
        Returns @true if we are using the primary selection, @false if
        clipboard one.

        @see UsePrimarySelection()
    */
    bool IsUsingPrimarySelection() const;

    /**
        Call this function to open the clipboard before calling SetData() and
        GetData().

        Call Close() when you have finished with the clipboard. You should keep
        the clipboard open for only a very short time.

        @return @true on success. This should be tested (as in the sample
                shown above).
    */
    virtual bool Open();

    /**
        Call this function to set the data object to the clipboard.

        The new data object replaces any previously set one, so if the
        application wants to provide clipboard data in several different
        formats, it must use a composite data object supporting all of the
        formats instead of calling this function several times with different
        data objects as this would only leave data from the last one in the
        clipboard.

        After this function has been called, the clipboard owns the data, so do
        not delete the data explicitly.
    */
    virtual bool SetData(wxDataObject* data);

    /**
        On platforms supporting it (all X11-based ports), wxClipboard uses the
        CLIPBOARD X11 selection by default. When this function is called with
        @true, all subsequent clipboard operations will use PRIMARY selection
        until this function is called again with @false.

        On the other platforms, there is no PRIMARY selection and so all
        clipboard operations will fail. This allows implementing the standard
        X11 handling of the clipboard which consists in copying data to the
        CLIPBOARD selection only when the user explicitly requests it (i.e. by
        selecting the "Copy" menu command) but putting the currently selected
        text into the PRIMARY selection automatically, without overwriting the
        normal clipboard contents with the currently selected text on the other
        platforms.
    */
    virtual void UsePrimarySelection(bool primary = false);

    /**
       Returns the global instance (wxTheClipboard) of the clipboard object.
    */
    static wxClipboard *Get();

};


text:
package org.nd4j.linalg.factory;

import org.nd4j.linalg.api.blas.Lapack;
import org.nd4j.linalg.api.blas.Level1;
import org.nd4j.linalg.api.blas.Level2;
import org.nd4j.linalg.api.blas.Level3;
import org.nd4j.linalg.api.ndarray.INDArray;

public interface BlasWrapper {
    /***************************************************************************
     * BLAS Level 1
     */

    /**
     * Compute x <-> y (swap two matrices)
     */
    INDArray swap(INDArray x, INDArray y);

    /**
     * Return the level 1 functions
     * for this blas impl
     * @return
     */
    Level1 level1();

    /**
     * Return the level 2 functions
     * for this blas impl
     * @return
     */
    Level2 level2();

    /**
     * Return the level 3 functions
     * for this blas impl
     * @return
     */
    Level3 level3();

    /**
     * LAPack interface
     * @return
     */
    Lapack lapack();

    @Deprecated
    INDArray scal(double alpha, INDArray x);

    /**
     * Compute x <- alpha * x (scale a matrix)
     */
    @Deprecated
    INDArray scal(float alpha, INDArray x);

    /**
     * Compute y <- x (copy a matrix)
     */
    INDArray copy(INDArray x, INDArray y);

    @Deprecated
    INDArray axpy(double da, INDArray dx, INDArray dy);

    /**
     * Compute y <- alpha * x + y (elementwise addition)
     */
    @Deprecated
    INDArray axpy(float da, INDArray dx, INDArray dy);

    /**
     * Compute y <- y + x * alpha
     * @param da the alpha to multiply by
     * @param dx
     * @param dy
     * @return
     */
    INDArray axpy(Number da, INDArray dx, INDArray dy);

    /**
     * Compute x^T * y (dot product)
     */
    double dot(INDArray x, INDArray y);

    /**
     * Compute || x ||_2 (2-norm)
     */
    double nrm2(INDArray x);

    /**
     * Compute || x ||_1 (1-norm, sum of absolute values)
     */
    double asum(INDArray x);

    /**
     * Compute index of element with largest absolute value (index of absolute
     * value maximum)
     */
    int iamax(INDArray x);

    /**
     * ************************************************************************
     * BLAS Level 2
     */

    INDArray gemv(Number alpha, INDArray a, INDArray x, double beta, INDArray y);

    @Deprecated
    INDArray gemv(double alpha, INDArray a, INDArray x, double beta, INDArray y);

    /**
     * Compute y <- alpha*op(a)*x + beta * y (general matrix vector
     * multiplication)
     */
    @Deprecated
    INDArray gemv(float alpha, INDArray a, INDArray x, float beta, INDArray y);

    INDArray ger(Number alpha, INDArray x, INDArray y, INDArray a);

    @Deprecated
    INDArray ger(double alpha, INDArray x, INDArray y, INDArray a);

    /**
     * Compute A <- alpha * x * y^T + A (general rank-1 update)
     */
    INDArray ger(float alpha, INDArray x, INDArray y, INDArray a);

    /**
     * ************************************************************************
     * LAPACK
     */

    INDArray gesv(INDArray a, int[] ipiv, INDArray b);

    //STOP

    void checkInfo(String name, int info);
    //START

    INDArray sysv(char uplo, INDArray a, int[] ipiv, INDArray b);

    int syev(char jobz, char uplo, INDArray a, INDArray w);

    int syevx(char jobz, char range, char uplo, INDArray a, double vl, double vu, int il, int iu, double abstol,
                    INDArray w, INDArray z);

    int syevx(char jobz, char range, char uplo, INDArray a, float vl, float vu, int il, int iu, float abstol,
                    INDArray w, INDArray z);

    int syevd(char jobz, char uplo, INDArray A, INDArray w);

    @Deprecated
    int syevr(char jobz, char range, char uplo, INDArray a, double vl, double vu, int il, int iu, double abstol,
                    INDArray w, INDArray z, int[] isuppz);

    @Deprecated
    int syevr(char jobz, char range, char uplo, INDArray a, float vl, float vu, int il, int iu, float abstol,
                    INDArray w, INDArray z, int[] isuppz);

    int syevr(char jobz, char range, char uplo, INDArray a, float vl, float vu, int il, int iu, Number abstol,
                    INDArray w, INDArray z, int[] isuppz);

    void posv(char uplo, INDArray A, INDArray B);

    int geev(char jobvl, char jobvr, INDArray A, INDArray WR, INDArray WI, INDArray VL, INDArray VR);

    int sygvd(int itype, char jobz, char uplo, INDArray A, INDArray B, INDArray W);

    /**
     * Generalized Least Squares via *GELSD.
     *

     * Note that B must be padded to contain the solution matrix. This occurs when A has fewer rows
     * than columns.
     *

     * For example: in A * X = B, A is (m,n), X is (n,k) and B is (m,k). Now if m < n, since B is overwritten to contain
     * the solution (in classical LAPACK style), B needs to be padded to be an (n,k) matrix.
     *

     * Likewise, if m > n, the solution consists only of the first n rows of B.
     *
     * @param A an (m,n) matrix
     * @param B an (max(m,n), k) matrix (well, at least)
     */
    void gelsd(INDArray A, INDArray B);

    void geqrf(INDArray A, INDArray tau);

    void ormqr(char side, char trans, INDArray A, INDArray tau, INDArray C);

    @Deprecated
    void saxpy(double alpha, INDArray x, INDArray y);

    /**
     * Abstraction over saxpy
     *
     * @param alpha the alpha to scale by
     * @param x     the ndarray to use
     * @param y     the ndarray to use
     */
    @Deprecated
    void saxpy(float alpha, INDArray x, INDArray y);

}


text:
#ifndef SimTK_SIMBODY_MOBILIZED_BODY_GROUND_H_
#define SimTK_SIMBODY_MOBILIZED_BODY_GROUND_H_

/** @file
Declares the MobilizedBody::Ground class. **/

#include "simbody/internal/MobilizedBody.h"

namespace SimTK {

/** This is a special type of "mobilized" body generated automatically by
Simbody as a placeholder for Ground in the 0th slot for a
SimbodyMatterSubsystem's mobilized bodies. The body type
will also be Ground. You can think of this as a Weld-like mobilizer that
connects the Ground body to the world, located at the Ground origin. The
reaction force in this mobilizer represents the total torque and force
applied by the System to Ground. This mobilizer is not available for
users -- if you want to weld something to Ground use MobilizedBody::Weld
instead.
@see MobilizedBody::Weld **/
class SimTK_SIMBODY_EXPORT MobilizedBody::Ground : public MobilizedBody {
public:
    /// There is no "reverse" Ground.
    Ground();
    Ground& addBodyDecoration(const Transform& X_BD, const DecorativeGeometry& g) {
        (void)MobilizedBody::addBodyDecoration(X_BD,g); return *this;
    }

    /** @cond **/ // hide from Doxygen
    SimTK_INSERT_DERIVED_HANDLE_DECLARATIONS(Ground, GroundImpl, MobilizedBody);
    /** @endcond **/
};

} // namespace SimTK

#endif // SimTK_SIMBODY_MOBILIZED_BODY_GROUND_H_


text:
package org.apache.logging.log4j.core.config.yaml;

import org.apache.logging.log4j.core.config.Configuration;
import org.apache.logging.log4j.core.config.ConfigurationFactory;
import org.apache.logging.log4j.core.config.ConfigurationSource;
import org.apache.logging.log4j.core.config.Order;
import org.apache.logging.log4j.core.config.plugins.Plugin;
import org.apache.logging.log4j.core.util.Loader;

@Plugin(name = "YamlConfigurationFactory", category = ConfigurationFactory.CATEGORY)
@Order(7)
public class YamlConfigurationFactory extends ConfigurationFactory {

    /**
     * The file extensions supported by this factory.
     */
    private static final String[] SUFFIXES = new String[] {".yml", ".yaml"};

    private static final String[] dependencies = new String[] {
            "com.fasterxml.jackson.databind.ObjectMapper",
            "com.fasterxml.jackson.databind.JsonNode",
            "com.fasterxml.jackson.core.JsonParser",
            "com.fasterxml.jackson.dataformat.yaml.YAMLFactory"
    };

    private final boolean isActive;

    public YamlConfigurationFactory() {
        for (final String dependency : dependencies) {
            if (!Loader.isClassAvailable(dependency)) {
                LOGGER.debug("Missing dependencies for Yaml support");
                isActive = false;
                return;
            }
        }
        isActive = true;
    }

    @Override
    protected boolean isActive() {
        return isActive;
    }

    @Override
    public Configuration getConfiguration(final ConfigurationSource source) {
        if (!isActive) {
            return null;
        }
        return new YamlConfiguration(source);
    }

    @Override
    public String[] getSupportedTypes() {
        return SUFFIXES;
    }

}


text:
/*
 * Do not modify this file. This file is generated from the elasticfilesystem-2015-02-01.normal.json service model.
 */
using System;
using System.Collections.Generic;
using System.Xml.Serialization;
using System.Text;
using System.IO;

using Amazon.Runtime;
using Amazon.Runtime.Internal;

namespace Amazon.ElasticFileSystem.Model
{
    ///
    /// Container for the parameters to the DeleteMountTarget operation.
    /// Deletes the specified mount target.
    ///
    ///
    /// <para>
    ///  This operation forcibly breaks any mounts of the file system via the mount target
    /// being deleted, which might disrupt instances or applications using those mounts. To
    /// avoid applications getting cut off abruptly, you might consider unmounting any mounts
    /// of the mount target, if feasible. The operation also deletes the associated network
    /// interface. Uncommitted writes may be lost, but breaking a mount target using this
    /// operation does not corrupt the file system itself. The file system you created remains.
    /// You can mount an EC2 instance in your VPC using another mount target.
    /// </para>
    ///
    /// <para>
    ///  This operation requires permission for the following action on the file system:
    /// </para>
    ///

 elasticfilesystem:DeleteMountTarget

 <note>The
    /// DeleteMountTarget call returns while the mount target state is still
    /// "deleting". You can check the mount target deletion by calling the DescribeMountTargets
    /// API, which returns a list of mount target descriptions for the given file system.
    /// </note>
    /// <para>
    /// The operation also requires permission for the following Amazon EC2 action on the
    /// mount target's network interface:
    /// </para>
    ///

 ec2:DeleteNetworkInterface

    ///
    public partial class DeleteMountTargetRequest : AmazonElasticFileSystemRequest
    {
        private string _mountTargetId;

        ///
        /// Empty constructor used to set  properties independently even when a simple constructor is available
        ///
        public DeleteMountTargetRequest() { }

        ///
        /// Instantiates DeleteMountTargetRequest with the parameterized properties
        ///
        /// <param name="mountTargetId">String. The ID of the mount target to delete.</param>
        public DeleteMountTargetRequest(string mountTargetId)
        {
            _mountTargetId = mountTargetId;
        }

        ///
        /// Gets and sets the property MountTargetId.
        /// <para>
        /// String. The ID of the mount target to delete.
        /// </para>
        ///
        public string MountTargetId
        {
            get { return this._mountTargetId; }
            set { this._mountTargetId = value; }
        }

        // Check to see if MountTargetId property is set
        internal bool IsSetMountTargetId()
        {
            return this._mountTargetId != null;
        }

    }
}


text:
require 'ads_common/savon_service'
require 'adwords_api/v201409/traffic_estimator_service_registry'

module AdwordsApi; module V201409; module TrafficEstimatorService
  class TrafficEstimatorService < AdsCommon::SavonService
    def initialize(config, endpoint)
      namespace = 'https://adwords.google.com/api/adwords/o/v201409'
      super(config, endpoint, namespace, :v201409)
    end

    def get(*args, &block)
      return execute_action('get', args, &block)
    end

    private

    def get_service_registry()
      return TrafficEstimatorServiceRegistry
    end

    def get_module()
      return AdwordsApi::V201409::TrafficEstimatorService
    end
  end
end; end; end


text:
package de.qaware.chronix.lucene.client;

/**
 * Some constants used within the chronix lucene storage
 *
 * @author f.lautenschlager
 */
public final class ChronixLuceneStorageConstants {

    public static final String MULTI_VALUE_FIELD_DELIMITER = "::mv::";

    private ChronixLuceneStorageConstants() {

    }

}


text:
// scalastyle:off println
package org.apache.spark.examples.streaming.clickstream

import java.io.PrintWriter
import java.net.ServerSocket
import java.util.Random

/** Represents a page view on a website with associated dimension data. */
class PageView(val url: String, val status: Int, val zipCode: Int, val userID: Int)
    extends Serializable {
  override def toString(): String = {
    "%s\t%s\t%s\t%s\n".format(url, status, zipCode, userID)
  }
}

object PageView extends Serializable {
  def fromString(in: String): PageView = {
    val parts = in.split("\t")
    new PageView(parts(0), parts(1).toInt, parts(2).toInt, parts(3).toInt)
  }
}

// scalastyle:off
/**
 * Generates streaming events to simulate page views on a website.
 *
 * This should be used in tandem with PageViewStream.scala. Example:
 *
 * To run the generator
 * `$ bin/run-example org.apache.spark.examples.streaming.clickstream.PageViewGenerator 44444 10`
 * To process the generated stream
 * `$ bin/run-example \
 *    org.apache.spark.examples.streaming.clickstream.PageViewStream errorRatePerZipCode localhost 44444`
 *
 */
// scalastyle:on
object PageViewGenerator {
  val pages = Map("http://foo.com/" -> .7,
                  "http://foo.com/news" -> 0.2,
                  "http://foo.com/contact" -> .1)
  val httpStatus = Map(200 -> .95,
                       404 -> .05)
  val userZipCode = Map(94709 -> .5,
                        94117 -> .5)
  val userID = Map((1 to 100).map(_ -> .01): _*)

  def pickFromDistribution[T](inputMap: Map[T, Double]): T = {
    val rand = new Random().nextDouble()
    var total = 0.0
    for ((item, prob) <- inputMap) {
      total = total + prob
      if (total > rand) {
        return item
      }
    }
    inputMap.take(1).head._1 // Shouldn't get here if probabilities add up to 1.0
  }

  def getNextClickEvent(): String = {
    val id = pickFromDistribution(userID)
    val page = pickFromDistribution(pages)
    val status = pickFromDistribution(httpStatus)
    val zipCode = pickFromDistribution(userZipCode)
    new PageView(page, status, zipCode, id).toString()
  }

  def main(args: Array[String]): Unit = {
    if (args.length != 2) {
      System.err.println("Usage: PageViewGenerator <port> <viewsPerSecond>")
      System.exit(1)
    }
    val port = args(0).toInt
    val viewsPerSecond = args(1).toFloat
    val sleepDelayMs = (1000.0 / viewsPerSecond).toInt
    val listener = new ServerSocket(port)
    println(s"Listening on port: $port")

    while (true) {
      val socket = listener.accept()
      new Thread() {
        override def run(): Unit = {
          println(s"Got client connected from: ${socket.getInetAddress}")
          val out = new PrintWriter(socket.getOutputStream(), true)

          while (true) {
            Thread.sleep(sleepDelayMs)
            out.write(getNextClickEvent())
            out.flush()
          }
          socket.close()
        }
      }.start()
    }
  }
}
// scalastyle:on println


text:
#ifndef OneSignalNotificationSettingsIOS10_h
#define OneSignalNotificationSettingsIOS10_h

#import "OneSignalNotificationSettings.h"

@interface OneSignalNotificationSettingsIOS10 : NSObject <OneSignalNotificationSettings>
+(dispatch_queue_t)getQueue;
@end

#endif /* OneSignalNotificationSettingsIOS10_h */


text:
#include "ant_search_sharing.h"
#include <stdint.h>
#include "ant_interface.h"
#include "ant_parameters.h"
#include "app_error.h"
#include "boards.h"
#include "sdk_config.h"
#include "ant_channel_config.h"
#include "ant_search_config.h"
#include "nrf_soc.h"

// Miscellaneous defines.
#define ANT_CHANNEL_DEFAULT_NETWORK    0x00         /**< ANT Channel Network. */
#define ANT_CHANNEL_NUMBER_0           0            /**< ANT Channel Number for channel 0. */
#define ANT_CHANNEL_NUMBER_1           1            /**< ANT Channel Number for channel 1. */

bool m_rx_first_ch0;                                /**< Received first message on channel 0. */
bool m_rx_first_ch1;                                /**< Received first message on channel 1. */

void ant_search_sharing_setup(void)
{
    uint32_t err_code;

    ant_channel_config_t channel_config =
    {
        .channel_type   = CHANNEL_TYPE_SLAVE,
        .ext_assign     = 0x00,
        .device_number  = 0x00,     // Wild card
        .network_number = ANT_CHANNEL_DEFAULT_NETWORK,
    };

    ant_search_config_t search_config =
    {
        .low_priority_timeout  = SEARCH_TIMEOUT,
        .high_priority_timeout = ANT_HIGH_PRIORITY_SEARCH_DISABLE,
        .search_sharing_cycles = SEARCH_CYCLES,
        .search_priority       = ANT_SEARCH_PRIORITY_DEFAULT,
        .waveform              = ANT_WAVEFORM_FAST,     // Use fast waveform to limit impact on acquisition time from searching on multiple frequencies
    };

    m_rx_first_ch0 = false;
    m_rx_first_ch1 = false;

    // Configure channel parameters for channel 0
    channel_config.channel_number    = ANT_CHANNEL_NUMBER_0;
    channel_config.device_type       = CH0_CHAN_ID_DEV_TYPE;
    channel_config.transmission_type = CH0_CHAN_ID_TRANS_TYPE;
    channel_config.channel_period    = CH0_CHAN_PERIOD;
    channel_config.rf_freq           = CH0_RF_FREQ;
    err_code                         = ant_channel_init(&channel_config);
    APP_ERROR_CHECK(err_code);

    // Configure search parameters for channel 0
    search_config.channel_number = ANT_CHANNEL_NUMBER_0;
    err_code                     = ant_search_init(&search_config);
    APP_ERROR_CHECK(err_code);

    // Configure channel parameters for channel 1
    channel_config.channel_number    = ANT_CHANNEL_NUMBER_1;
    channel_config.device_type       = CH1_CHAN_ID_DEV_TYPE;
    channel_config.transmission_type = CH1_CHAN_ID_TRANS_TYPE;
    channel_config.channel_period    = CH1_CHAN_PERIOD;
    channel_config.rf_freq           = CH1_RF_FREQ;
    err_code                         = ant_channel_init(&channel_config);
    APP_ERROR_CHECK(err_code);

    // Configure search parameters for channel 1
    search_config.channel_number = ANT_CHANNEL_NUMBER_1;
    err_code                     = ant_search_init(&search_config);
    APP_ERROR_CHECK(err_code);

    // Open both channels
    err_code = sd_ant_channel_open(ANT_CHANNEL_NUMBER_0);
    APP_ERROR_CHECK(err_code);

    err_code = sd_ant_channel_open(ANT_CHANNEL_NUMBER_1);
    APP_ERROR_CHECK(err_code);

}

void ant_search_sharing_event_handler(ant_evt_t * p_ant_evt)
{
    switch (p_ant_evt->event)
    {
        case EVENT_RX:
            switch (p_ant_evt->channel)
            {
                case ANT_CHANNEL_NUMBER_0:
                    if (!m_rx_first_ch0)
                    {
                        m_rx_first_ch0 = true;
                        bsp_board_led_on(BSP_BOARD_LED_0);
                    }
                    break;

                case ANT_CHANNEL_NUMBER_1:
                    if (!m_rx_first_ch1)
                    {
                        m_rx_first_ch1 = true;
                        bsp_board_led_on(BSP_BOARD_LED_1);
                    }
                    break;
            }
            break;

        default:
            break; // No implementation needed
    }
}


text:
'use strict';

var now = require('microtime-x');

module.exports = function (event) {
	return event.stamp < (now() - 1000 * 1000 * 10);
};


text:
from timeseries_analysis import create_surface_registration, \
                                get_voxel_timeseries, \
                                get_roi_timeseries, \
                                get_vertices_timeseries, \
                                gen_vertices_timeseries, \
                                gen_voxel_timeseries, \
                                gen_roi_timeseries, \
                                get_spatial_map_timeseries

__all__ = ['create_surface_registration', \
           'get_voxel_timeseries', \
           'get_roi_timeseries', \
           'get_vertices_timeseries', \
           'gen_vertices_timeseries', \
           'gen_voxel_timeseries', \
           'gen_roi_timeseries', \
           'get_spatial_map_timeseries']


text:
<TITLE>General Search -- Web of Science v4.31</TITLE>

<FORM  ACTION=http://tame.mimas.ac.uk:80/isicgi/CIW.cgi  METHOD=POST>
<INPUT TYPE=HIDDEN NAME="SID" VALUE="PMrU0IJYy4MAAELSXic_E2011300_PMrU0IJYy4MAAELSXic-0">
<INPUT TYPE=HIDDEN NAME="SESSION_DIR" VALUE="">

<INPUT TYPE=IMAGE BORDER=0 NAME="Home" ALT="Home" SRC="http://tame.mimas.ac.uk:80/isicgi/Images/tbhome.gif">		<INPUT TYPE=IMAGE BORDER=0 NAME="Date & Database Limits" ALT="Date & Database Limits" SRC="http://tame.mimas.ac.uk:80/isicgi/Images/tblimits.gif">	<INPUT TYPE=IMAGE BORDER=0 NAME="Cited Ref Search" ALT="Cited Ref Search" SRC="http://tame.mimas.ac.uk:80/isicgi/Images/tbcrsch.gif">	<INPUT TYPE=IMAGE BORDER=0 NAME="Log off" ALT="Log off" SRC="http://tame.mimas.ac.uk:80/isicgi/Images/tblogoff.gif">

		 General Search

		 Enter individual search terms or phrases separated by search operators such as AND or OR then press SEARCH below.

		 Set language and document type limits and sort option.

                  <INPUT TYPE=IMAGE BORDER=0 VSPACE=0 HSPACE=1 SRC=http://tame.mimas.ac.uk:80/isicgi/Images/search.gif NAME="Search" ALT="Search">

		 Search using terms entered below.

		 TOPIC: Enter terms from the article title, keywords, or abstract

		 Examples

		 <INPUT TYPE=TEXT NAME="topic" SIZE="50" VALUE="">
  <INPUT TYPE=CHECKBOX NAME="titleonly">
Title only

		 AUTHOR:
		 Enter one or more author names as O'BRIAN C* OR OBRIAN C*

		 <INPUT TYPE=TEXT NAME="author" SIZE="50" VALUE="">

		 SOURCE TITLE:
		 Enter journal title or copy and paste from the
		 source list

		 <INPUT TYPE=TEXT NAME="journal" SIZE="50" VALUE="">

		 ADDRESS:
		 Enter terms from an author's affiliation as YALE UNIV SAME HOSP (see abbreviations list)

		 <INPUT TYPE=TEXT NAME="address" SIZE="50" VALUE="">

                  <INPUT TYPE=IMAGE SRC=http://tame.mimas.ac.uk:80/isicgi/Images/search.gif ALT="Search" BORDER=0 VSPACE=0 HSPACE=1 NAME="Search">

		 Search using terms entered above.

		  <INPUT TYPE=IMAGE BORDER=0 VSPACE=0 HSPACE=1 SRC=http://tame.mimas.ac.uk:80/isicgi/Images/saveq.gif ALT="Save query" NAME="Save query">

		 Save the search terms for future use.

                  <INPUT TYPE=IMAGE BORDER=0 VSPACE=0 HSPACE=1 SRC=http://tame.mimas.ac.uk:80/isicgi/Images/clear.gif NAME="Clear" ALT="Clear">

		 Clear all search terms entered above.

		 SET LIMITS AND SORT OPTION

  Restrict search to a specific language or document type:

 (Multiple items may be selected from lists) Sort results by:

 <SELECT NAME="languagetype" MULTIPLE SIZE="5">
<OPTION VALUE="All languages" SELECTED>All languages
<OPTION VALUE="English">English
<OPTION VALUE="Afrikaans">Afrikaans
<OPTION VALUE="Arabic">Arabic
<OPTION VALUE="Bengali">Bengali
<OPTION VALUE="Bulgarian">Bulgarian
<OPTION VALUE="Byelorussian">Byelorussian
<OPTION VALUE="Catalan">Catalan
<OPTION VALUE="Chinese">Chinese
<OPTION VALUE="Croatian">Croatian
<OPTION VALUE="Czech">Czech
<OPTION VALUE="Danish">Danish
<OPTION VALUE="Dutch">Dutch
<OPTION VALUE="Estonian">Estonian
<OPTION VALUE="Finnish">Finnish
<OPTION VALUE="Flemish">Flemish
<OPTION VALUE="French">French
<OPTION VALUE="Gaelic">Gaelic
<OPTION VALUE="Galician">Galician
<OPTION VALUE="Georgian">Georgian
<OPTION VALUE="German">German
<OPTION VALUE="Greek">Greek
<OPTION VALUE="Hebrew">Hebrew
<OPTION VALUE="Hungarian">Hungarian
<OPTION VALUE="Icelandic">Icelandic
<OPTION VALUE="Italian">Italian
<OPTION VALUE="Japanese">Japanese
<OPTION VALUE="Korean">Korean
<OPTION VALUE="Latin">Latin
<OPTION VALUE="Macedonian">Macedonian
<OPTION VALUE="Multi-Language">Multi-Language
<OPTION VALUE="Norwegian">Norwegian
<OPTION VALUE="Persian">Persian
<OPTION VALUE="Polish">Polish
<OPTION VALUE="Portuguese">Portuguese
<OPTION VALUE="Provencal">Provencal
<OPTION VALUE="Rumanian">Rumanian
<OPTION VALUE="Russian">Russian
<OPTION VALUE="Serbian">Serbian
<OPTION VALUE="Serbo-Croatian">Serbo-Croatian
<OPTION VALUE="Slovak">Slovak
<OPTION VALUE="Slovene">Slovene
<OPTION VALUE="Spanish">Spanish
<OPTION VALUE="Swedish">Swedish
<OPTION VALUE="Turkish">Turkish
<OPTION VALUE="Ukrainian">Ukrainian
<OPTION VALUE="Welsh">Welsh
</SELECT>
<SELECT NAME="doctype" MULTIPLE SIZE="5">
<OPTION VALUE="All document types" SELECTED>All document types
<OPTION VALUE="Article">Article
<OPTION VALUE="Abstract of Published Item">Abstract of Published Item
<OPTION VALUE="Art Exhibit Review">Art Exhibit Review
<OPTION VALUE="Bibliography">Bibliography
<OPTION VALUE="Biographical-Item">Biographical-Item
<OPTION VALUE="Book Review">Book Review
<OPTION VALUE="Chronology">Chronology
<OPTION VALUE="Correction">Correction
<OPTION VALUE="Correction, Addition">Correction, Addition
<OPTION VALUE="Dance Performance Review">Dance Performance Review
<OPTION VALUE="Database Review">Database Review
<OPTION VALUE="Discussion">Discussion
<OPTION VALUE="Editorial Material">Editorial Material
<OPTION VALUE="Excerpt">Excerpt
<OPTION VALUE="Fiction, Creative Prose">Fiction, Creative Prose
<OPTION VALUE="Film Review">Film Review
<OPTION VALUE="Hardware Review">Hardware Review
<OPTION VALUE="Item About an Individual">Item About an Individual
<OPTION VALUE="Letter">Letter
<OPTION VALUE="Meeting Abstract">Meeting Abstract
<OPTION VALUE="Meeting-Abstract">Meeting-Abstract
<OPTION VALUE="Music Performance Review">Music Performance Review
<OPTION VALUE="Music Score">Music Score
<OPTION VALUE="Music Score Review">Music Score Review
<OPTION VALUE="News Item">News Item
<OPTION VALUE="Note">Note
<OPTION VALUE="Poetry">Poetry
<OPTION VALUE="Record Review">Record Review
<OPTION VALUE="Reprint">Reprint
<OPTION VALUE="Review">Review
<OPTION VALUE="Script">Script
<OPTION VALUE="Software Review">Software Review
<OPTION VALUE="TV Review, Radio Review">TV Review, Radio Review
<OPTION VALUE="TV Review, Radio Review, Video">TV Review, Radio Review, Video
<OPTION VALUE="Theater Review">Theater Review
</SELECT>
<SELECT NAME="Sort" SIZE="5">
<OPTION VALUE="Latest date" SELECTED>Latest date
<OPTION VALUE="Times Cited">Times Cited
<OPTION VALUE="Relevance">Relevance
<OPTION VALUE="First author">First author
<OPTION VALUE="Source Title">Source Title
</SELECT>

Back to
		 top of Search
		 page

		   <INPUT TYPE=HIDDEN NAME=Form VALUE=General>
		   <INPUT TYPE=HIDDEN NAME=Func VALUE=Search>
		 </FORM>
Acceptable Use Policy

Copyright © 2002 Institute for Scientific Information


text:
/*
 * (C) 2003-2014 Anope Team
 * Contact us at team@anope.org
 *
 * Please read COPYING and README for further details.
 */

#include "../../webcpanel.h"

WebCPanel::HostServ::Request::Request(const Anope::string &cat, const Anope::string &u) : WebPanelProtectedPage (cat, u)
{
}

bool WebCPanel::HostServ::Request::OnRequest(HTTPProvider *server, const Anope::string &page_name, HTTPClient *client, HTTPMessage &message, HTTPReply &reply, NickAlias *na, TemplateFileServer::Replacements &replacements)
{
	if (message.post_data.count("req") > 0)
	{
		std::vector<Anope::string> params;
		params.push_back(HTTPUtils::URLDecode(message.post_data["req"]));

		WebPanel::RunCommand(na->nc->display, na->nc, "HostServ", "hostserv/request", params, replacements, "CMDR");
	}

	if (na->HasVhost())
	{
		if (na->GetVhostIdent().empty() == false)
			replacements["VHOST"] = na->GetVhostIdent() + "@" + na->GetVhostHost();
		else
			replacements["VHOST"] = na->GetVhostHost();
	}
	if (ServiceReference<Command>("Command", "hostserv/request"))
		replacements["CAN_REQUEST"] = "YES";
	TemplateFileServer page("hostserv/request.html");
	page.Serve(server, page_name, client, message, reply, replacements);
	return true;
}


text:
using System;
using System.Linq;
using System.Text;

using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.Command;

using Neo.Core;
using Neo.IO.Json;
using Neo.SmartContract;
using Neo.VM;

using Neo.Gui.Globalization.Resources;

using Neo.Gui.Base.Dialogs.Interfaces;
using Neo.Gui.Base.Dialogs.LoadParameters.Contracts;
using Neo.Gui.Base.Dialogs.Results.Contracts;
using Neo.Gui.Base.Controllers.Interfaces;
using Neo.Gui.Base.Managers.Interfaces;
using Neo.Gui.Base.Services.Interfaces;

namespace Neo.Gui.ViewModels.Contracts
{
    public class InvokeContractViewModel :
        ViewModelBase,
        ILoadableDialogViewModel<InvokeContractDialogResult, InvokeContractLoadParameters>
    {
        #region Private Fields
        private readonly IDialogManager dialogManager;
        private readonly IFileManager fileManager;
        private readonly IFileDialogService fileDialogService;
        private readonly IWalletController walletController;

        private InvocationTransaction transaction;

        private UInt160 scriptHash;
        private ContractParameter[] parameters;

        private string scriptHashStr;

        private bool editParametersEnabled;

        private string customScript;
        private string results;

        private string fee;

        private bool invokeEnabled;
        #endregion

        #region Public Properties
        public string ScriptHash
        {
            get => this.scriptHashStr;
            set
            {
                if (this.scriptHashStr == value) return;

                this.scriptHashStr = value;

                RaisePropertyChanged();

                // Update dependent properties
                RaisePropertyChanged(nameof(this.GetContractEnabled));
            }
        }

        public bool GetContractEnabled => UInt160.TryParse(this.ScriptHash, out _);

        public string ContractName { get; private set; }

        public string ContractVersion { get; private set; }

        public string ContractAuthor { get; private set; }

        public string ContractParameters { get; private set; }

        public bool EditParametersEnabled
        {
            get => this.editParametersEnabled;
            set
            {
                if (this.editParametersEnabled == value) return;

                this.editParametersEnabled = value;

                RaisePropertyChanged();
            }
        }

        public string CustomScript
        {
            get => this.customScript;
            set
            {
                if (this.customScript == value) return;

                this.customScript = value;

                RaisePropertyChanged();

                // Update dependent properties
                this.InvokeEnabled = false;
                RaisePropertyChanged(nameof(this.TestEnabled));
            }
        }

        public string Results
        {
            get => this.results;
            set
            {
                if (this.results == value) return;

                this.results = value;

                RaisePropertyChanged();
            }
        }

        public string Fee
        {
            get => string.IsNullOrEmpty(this.fee) ? Strings.NotEvaluated : this.fee;
            set
            {
                if (this.fee == value) return;

                this.fee = value;

                RaisePropertyChanged();
            }
        }

        public bool TestEnabled => !string.IsNullOrEmpty(this.CustomScript);

        public bool InvokeEnabled
        {
            get => this.invokeEnabled;
            set
            {
                if (this.invokeEnabled == value) return;

                this.invokeEnabled = value;

                RaisePropertyChanged();
            }
        }

        public RelayCommand GetContractCommand => new RelayCommand(this.GetContract);

        public RelayCommand EditParametersCommand => new RelayCommand(this.EditParameters);

        public RelayCommand LoadCommand => new RelayCommand(this.Load);

        public RelayCommand TestCommand => new RelayCommand(this.Test);

        public RelayCommand InvokeCommand => new RelayCommand(this.Invoke);

        public RelayCommand CancelCommand => new RelayCommand(this.Cancel);
        #endregion Public Properties

        #region Constructor
        public InvokeContractViewModel(
            IDialogManager dialogManager,
            IFileManager fileManager,
            IFileDialogService fileDialogService,
            IWalletController walletController)
        {
            this.dialogManager = dialogManager;
            this.fileManager = fileManager;
            this.fileDialogService = fileDialogService;
            this.walletController = walletController;
        }
        #endregion

        #region ILoadableDialogViewModel implementation
        public event EventHandler Close;

        public event EventHandler<InvokeContractDialogResult> SetDialogResultAndClose;

        public InvokeContractDialogResult DialogResult { get; private set; }

        public void OnDialogLoad(InvokeContractLoadParameters parameters)
        {
            if (parameters?.Transaction == null) return;

            // Set base transaction
            this.transaction = parameters.Transaction;

            this.CustomScript = this.transaction.Script.ToHexString();
        }
        #endregion

        #region Private Methods
        private void GetContract()
        {
            this.scriptHash = UInt160.Parse(this.ScriptHash);

            var contractState = this.walletController.GetContractState(this.scriptHash);

            if (contractState == null)
            {
                this.dialogManager.ShowMessageDialog(string.Empty, "Cannot find contract.");
                return;
            }

            this.parameters = contractState.ParameterList.Select(p => new ContractParameter(p)).ToArray();
            this.ContractName = contractState.Name;
            this.ContractVersion = contractState.CodeVersion;
            this.ContractAuthor = contractState.Author;
            this.ContractParameters = string.Join(", ", contractState.ParameterList);

            // Update bindable properties
            RaisePropertyChanged(nameof(this.ContractName));
            RaisePropertyChanged(nameof(this.ContractVersion));
            RaisePropertyChanged(nameof(this.ContractAuthor));
            RaisePropertyChanged(nameof(this.ContractParameters));

            this.EditParametersEnabled = this.parameters.Length > 0;

            UpdateCustomScript();
        }

        private void EditParameters()
        {
            this.dialogManager.ShowDialog<ContractParametersEditorDialogResult, ContractParametersEditorLoadParameters>(
                new ContractParametersEditorLoadParameters(this.parameters));

            UpdateCustomScript();
        }

        private void UpdateCustomScript()
        {
            if (this.parameters.Any(p => p.Value == null)) return;

            using (var builder = new ScriptBuilder())
            {
                builder.EmitAppCall(this.scriptHash, this.parameters);
                this.CustomScript = builder.ToArray().ToHexString();
            }
        }

        private void Load()
        {
            var filePath = this.fileDialogService.OpenFileDialog();

            if (string.IsNullOrEmpty(filePath)) return;

            byte[] loadedBytes;
            try
            {
                loadedBytes = this.fileManager.ReadAllBytes(filePath);
            }
            catch
            {
                // TODO Show error message
                return;
            }

            var hexString = string.Empty;

            if (loadedBytes != null)
            {
                hexString = loadedBytes.ToHexString();
            }

            this.CustomScript = hexString;
        }

        private void Test()
        {
            byte[] script;
            try
            {
                script = this.CustomScript.Trim().HexToBytes();
            }
            catch (FormatException ex)
            {
                this.dialogManager.ShowMessageDialog("An error occurred!", ex.Message);
                return;
            }

            if (this.transaction == null)
            {
                this.transaction = new InvocationTransaction();
            }

            this.transaction.Version = 1;
            this.transaction.Script = script;

            // Load default transaction values if required
            if (this.transaction.Attributes == null) this.transaction.Attributes = new TransactionAttribute[0];
            if (this.transaction.Inputs == null) this.transaction.Inputs = new CoinReference[0];
            if (this.transaction.Outputs == null) this.transaction.Outputs = new TransactionOutput[0];
            if (this.transaction.Scripts == null) this.transaction.Scripts = new Witness[0];

            var engine = ApplicationEngine.Run(this.transaction.Script, this.transaction);

            // Get transaction test results
            var builder = new StringBuilder();
            builder.AppendLine($"VM State: {engine.State}");
            builder.AppendLine($"Gas Consumed: {engine.GasConsumed}");
            builder.AppendLine($"Evaluation Stack: {new JArray(engine.EvaluationStack.Select(p => p.ToParameter().ToJson()))}");

            this.Results = builder.ToString();

            if (!engine.State.HasFlag(VMState.FAULT))
            {
                this.transaction.Gas = engine.GasConsumed - Fixed8.FromDecimal(10);

                if (this.transaction.Gas < Fixed8.Zero) this.transaction.Gas = Fixed8.Zero;

                this.transaction.Gas = this.transaction.Gas.Ceiling();

                var transactionFee = this.transaction.Gas.Equals(Fixed8.Zero) ? this.walletController.NetworkFee : this.transaction.Gas;

                this.Fee = transactionFee + " gas";
                this.InvokeEnabled = true;
            }
            else
            {
                this.dialogManager.ShowMessageDialog(string.Empty, Strings.ExecutionFailed);
            }
        }

        private void Invoke()
        {
            if (!this.InvokeEnabled) return;

            if (this.transaction == null) return;

            this.walletController.InvokeContract(this.transaction);

            this.Close(this, EventArgs.Empty);
        }

        private void Cancel()
        {
            this.transaction = null;

            this.Close(this, EventArgs.Empty);
        }
        #endregion
    }
}


text:
import {Injectable} from "@angular/core";
import { Headers, Http } from '@angular/http';
import 'rxjs/add/operator/toPromise';

import {Item} from "../models/item";

@Injectable()
export class ItemService {
    private itemsUrl = '/api/v1/items';

    constructor(private http: Http) { }

    getItems(): Promise<Item[]> {
        return this.http.get(this.itemsUrl)
               .toPromise()
               .then(response => <Item[]>response.json())
               .catch(this.handleError);
    }

    addItem(name:string) {

    }

    private handleError(error: any) {
        console.error('An error occurred', error);
        return Promise.reject(error.message || error);
    }
}


text:
#include "twoDRobotModel.h"

#include <QtGui/QColor>

#include <kitBase/robotModel/robotModelUtils.h>
#include <kitBase/robotModel/robotParts/lightSensor.h>

#include "trikDisplayWidget.h"
#include "robotModel/twoD/parts/twoDDisplay.h"
#include "robotModel/twoD/parts/twoDSpeaker.h"
#include "robotModel/twoD/parts/twoDShell.h"
#include "robotModel/twoD/parts/twoDInfraredSensor.h"
#include "robotModel/twoD/parts/twoDLed.h"
#include "robotModel/twoD/parts/twoDLineSensor.h"
#include "robotModel/twoD/parts/twoDObjectSensor.h"
#include "robotModel/twoD/parts/twoDColorSensor.h"
#include <trikKit/robotModel/parts/trikLineSensor.h>
#include <trikKit/robotModel/parts/trikObjectSensor.h>
#include <trikKit/robotModel/parts/trikColorSensor.h>
#include <trikKit/robotModel/parts/trikInfraredSensor.h>
#include <trikKit/robotModel/parts/trikSonarSensor.h>
#include <trikKit/robotModel/parts/trikShell.h>

#include "trikDisplayWidget.h"

using namespace trik::robotModel;
using namespace trik::robotModel::twoD;
using namespace kitBase::robotModel;

TwoDRobotModel::TwoDRobotModel(RobotModelInterface &realModel)
	: twoDModel::robotModel::TwoDRobotModel(realModel)
	, mLeftWheelPort("M3")
	, mRightWheelPort("M4")
	, mDisplayWidget(new TrikDisplayWidget())
{
}

robotParts::Device *TwoDRobotModel::createDevice(const PortInfo &port, const DeviceInfo &deviceInfo)
{
	if (deviceInfo.isA<robotParts::Display>()) {
		return new parts::Display(deviceInfo, port, *engine());
	}

	if (deviceInfo.isA<robotParts::Speaker>()) {
		return new parts::TwoDSpeaker(deviceInfo, port, *engine());
	}

	if (deviceInfo.isA<robotModel::parts::TrikShell>()) {
		return new parts::Shell(deviceInfo, port);
	}

	if (deviceInfo.isA<robotModel::parts::TrikInfraredSensor>()) {
		return new parts::TwoDInfraredSensor(deviceInfo, port, *engine());
	}

	if (deviceInfo.isA<robotModel::parts::TrikLed>()) {
		return new parts::TwoDLed(deviceInfo, port, *engine());
	}

	if (deviceInfo.isA<robotModel::parts::TrikLineSensor>()) {
		return new parts::LineSensor(deviceInfo, port, *engine());
	}

	if (deviceInfo.isA<robotModel::parts::TrikObjectSensor>()) {
		return new parts::ObjectSensor(deviceInfo, port);
	}

	if (deviceInfo.isA<robotModel::parts::TrikColorSensor>()) {
		return new parts::ColorSensor(deviceInfo, port);
	}

	return twoDModel::robotModel::TwoDRobotModel::createDevice(port, deviceInfo);
}

void TwoDRobotModel::onInterpretationStarted()
{
	robotModel::parts::TrikDisplay * const display =
			RobotModelUtils::findDevice<robotModel::parts::TrikDisplay>(*this, "DisplayPort");
	if (display) {
		display->clearScreen();
		display->setBackground(QColor(Qt::gray));
	} else {
		/// @todo: if we get here it is wrong because display is not configured before the interpretation!
	}
}

QString TwoDRobotModel::robotImage() const
{
	return ":icons/trikTwoDRobot.svg";
}

PortInfo TwoDRobotModel::defaultLeftWheelPort() const
{
	return PortInfo(mLeftWheelPort, output);
}

PortInfo TwoDRobotModel::defaultRightWheelPort() const
{
	return PortInfo(mRightWheelPort, output);
}

twoDModel::engine::TwoDModelDisplayWidget *TwoDRobotModel::displayWidget() const
{
	return mDisplayWidget;
}

QString TwoDRobotModel::sensorImagePath(const DeviceInfo &deviceType) const
{
	if (deviceType.isA<kitBase::robotModel::robotParts::LightSensor>()) {
		return ":icons/twoDColorEmpty.svg";
	} else if (deviceType.isA<robotModel::parts::TrikInfraredSensor>()) {
		return ":icons/twoDIrRangeSensor.svg";
	} else if (deviceType.isA<robotModel::parts::TrikSonarSensor>()) {
		return ":icons/twoDUsRangeSensor.svg";
	} else if (deviceType.isA<robotModel::parts::TrikLineSensor>()) {
		return ":icons/twoDVideoModule.svg";
	}

	return QString();
}

void TwoDRobotModel::setWheelPorts(const QString &leftWheelPort, const QString &rightWheelPort)
{
	mLeftWheelPort = leftWheelPort;
	mRightWheelPort = rightWheelPort;
}

QRect TwoDRobotModel::sensorImageRect(const kitBase::robotModel::DeviceInfo &deviceType) const
{
	if (deviceType.isA<robotParts::LightSensor>()) {
		return QRect(-6, -6, 12, 12);
	} else if (deviceType.isA<robotModel::parts::TrikInfraredSensor>()) {
		return QRect(-18, -18, 36, 36);
	} else if (deviceType.isA<robotModel::parts::TrikSonarSensor>()) {
		return QRect(-18, -18, 36, 36);
	} else if (deviceType.isA<robotModel::parts::TrikLineSensor>()) {
		return QRect(-9, -9, 18, 18);
	}

	return QRect();
}

QHash<kitBase::robotModel::PortInfo, kitBase::robotModel::DeviceInfo> TwoDRobotModel::specialDevices() const
{
	QHash<PortInfo, DeviceInfo> result(twoDModel::robotModel::TwoDRobotModel::specialDevices());
	return result;
}

QPair<QPoint, qreal> TwoDRobotModel::specialDeviceConfiguration(const PortInfo &port) const
{
	if (port == PortInfo("LineSensorPort", input)) {
		return qMakePair(QPoint(1, 0), 0);
	}

	return twoDModel::robotModel::TwoDRobotModel::specialDeviceConfiguration(port);
}

QHash<QString, int> TwoDRobotModel::buttonCodes() const
{
	QHash<QString, int> result;
	result["LeftButton"] = 105;
	result["RightButton"] = 106;
	result["UpButton"] = 103;
	result["DownButton"] = 108;
	result["EnterButton"] = 28;
	result["PowerButton"] = 116;
	result["EscButton"] = 1;
	return result;
}


text:
local configs = require 'nvim-treesitter.configs'

configs.setup {
    ensure_installed = 'all',
    highlight = {
        enable = true;
        additional_vim_regex_highlighting = false;
        disable = { "latex" };
    },
    indent = {
        enable = false;
    },
}

vim.opt.foldmethod = 'expr'
vim.opt.foldexpr = 'nvim_treesitter#foldexpr()'


text:
import {Story} from './interfaces';

import {autoinject} from 'aurelia-framework';

import { Api } from './services/api';
import { Notification } from './services/notification';

@autoinject()
export class Home {

    public stories: Story[];

    constructor(public api: Api, public notification: Notification) {  }

    activate(params, routeConfig, navigationInstruction) {
        return new Promise((resolve, reject) => {
            this.api.getStories().then(stories => stories.json()).then(stories => {
                this.stories = stories;
                resolve(stories);
            }).catch(e => {
                this.notification.error('Stories could not be loaded.');
                resolve();
            });
        });
    }

    attached() {

    }

}