text:
.. _96b_carbon_nrf51_board:

96Boards Carbon nRF51
#####################

.. note::

   If you're looking to reprogram the main STMicro part, see
   :ref:`96b_carbon_board`. Users should not use this configuration
   unless they want to reprogram the secondary chip which provides
   Bluetooth connectivity.

Overview
********

Zephyr applications use the 96b_carbon_nrf51 configuration to run on
the secondary nRF51822 chip on the 96Boards Carbon. This chip provides
Bluetooth functionality to the main STM32F401RET chip via SPI.

Hardware
********

The 96Boards Carbon nRF51 has two external oscillators. The frequency
of the slow clock is 32.768 kHz. The frequency of the main clock is 16
MHz.

See :ref:`96b_carbon_board` for other general information about the
board; that configuration is for the same physical board, just a
different chip.

Supported Features
==================

+-----------+------------+-------------------------------------+
| Interface | Controller | Driver/Component                    |
+===========+============+=====================================+
| NVIC      | on-chip    | nested vector interrupt controller  |
+-----------+------------+-------------------------------------+
| RTC       | on-chip    | system clock                        |
+-----------+------------+-------------------------------------+
| UART      | on-chip    | serial port                         |
+-----------+------------+-------------------------------------+
| GPIO      | on-chip    | gpio                                |
+-----------+------------+-------------------------------------+
| FLASH     | on-chip    | flash                               |
+-----------+------------+-------------------------------------+
| SPIS      | on-chip    | SPI slave                           |
+-----------+------------+-------------------------------------+
| RADIO     | on-chip    | Bluetooth                           |
+-----------+------------+-------------------------------------+

The default configuration can be found in the defconfig file:

        ``boards/arm/96b_carbon_nrf51/96b_carbon_nrf51_defconfig``

Connections and IOs
===================

The SWD debug pins are broken out to an external header; all other
connected pins are to the main STM32F401RET chip.

.. _96b_carbon_nrf51_programming:

Programming and Debugging
*************************

Flashing
========

The 96Boards Carbon nRF51 can be flashed using an external SWD
debugger, via the debug header labeled "BLE" on the board's
silkscreen. The header is not populated; 0.1" male header must be
soldered on first.

.. figure:: img/96b-carbon-nrf51-debug.png
     :align: center
     :alt: 96Boards Carbon nRF51 Debug

     96Boards Carbon nRF51 Debug

The following example assumes a Zephyr binary ``zephyr.elf`` will be
flashed to the board.

It uses the `Black Magic Debug Probe`_ as an SWD programmer, which can
be connected to the BLE debug header using flying leads and its 20 Pin
JTAG Adapter Board Kit. When plugged into your host PC, the Black
Magic Debug Probe enumerates as a USB serial device as documented on
its `Getting started page`_.

It also uses the GDB binary provided with the Zephyr SDK,
``arm-zephyr-eabi-gdb``. Other GDB binaries, such as the GDB from GCC
ARM Embedded, can be used as well.

.. code-block:: console

   $ arm-zephyr-eabi-gdb -q zephyr.elf
   (gdb) target extended-remote /dev/ttyACM0
   Remote debugging using /dev/ttyACM0
   (gdb) monitor swdp_scan
   Target voltage: 3.3V
   Available Targets:
   No. Att Driver
    1      nRF51
   (gdb) attach 1
   Attaching to Remote target
   0xabcdef12 in ?? ()
   (gdb) load

Debugging
=========

After you've flashed the chip, you can keep debugging using the same
GDB instance. To reattach, just follow the same steps above, but don't
run "load". You can then debug as usual with GDB. In particular, type
"run" at the GDB prompt to restart the program you've flashed.

As an aid to debugging, this board configuration directs a console
output to a currently unused pin connected to the STM32F401RET. Users
who are experienced in electronics rework can remove a resistor (R22)
on the board and attach a wire to the nRF51822's UART output.

.. _96b_carbon_nrf51_bluetooth:

Providing Bluetooth to 96b_carbon
*********************************

This 96b_carbon_nrf51 Zephyr configuration can be used to provide
Bluetooth functionality from the secondary nRF51822 chip to the
primary STM32F401RE chip on the :ref:`96b_carbon_board`.

To do this, build the ``samples/bluetooth/hci_spi/`` application
provided with Zephyr with ``BOARD=96b_carbon_nrf51``, then flash it to
the nRF51822 chip using the instructions :ref:`above
<96b_carbon_nrf51_programming>`. (For instructions on how to build a
Zephyr application, see :ref:`build_an_application`.)

.. warning::

   Be sure to flash the hci_spi application to the nRF51822 chip and
   not to the main STM32F401RET chip.  While both chips are supported
   by Zephyr, the hci_spi application providing Bluetooth support will
   only run on the nRF51822 chip.

References
**********

- `Board documentation from 96Boards`_
- `nRF51822 information from Nordic Semiconductor`_

.. _Black Magic Debug Probe:
   https://github.com/blacksphere/blackmagic/wiki

.. _Getting started page:
   https://github.com/blacksphere/blackmagic/wiki/Getting-Started

.. _Board documentation from 96Boards:
   http://www.96boards.org/product/carbon/

.. _nRF51822 information from Nordic Semiconductor:
   https://www.nordicsemi.com/eng/Products/Bluetooth-low-energy/nRF51822


text:
(function testOriginalRepro() {
  var result;
  var dict = { toString() { result = v;} };
  for (var v of ['fontsize', 'sup']) {
    String.prototype[v].call(dict);
    assertEquals(v, result);
  }
})();

(function testSimpler() {
  var result;
  function setResult() { result = v; }
  for (var v of ['hello', 'world']) {
    setResult();
    assertEquals(v, result);
  }
})();

redpajama_set_name: RedPajamaGithub


text:
<?php

namespace BlockCypher\AppWallet\Infrastructure\AppWalletBundle\Controller\Faucet;

use BlockCypher\AppWallet\App\Command\FundAddressCommand;
use BlockCypher\AppWallet\App\Command\FundAddressCommandValidator;
use BlockCypher\AppWallet\Infrastructure\AppWalletBundle\Controller\AppWalletController;
use BlockCypher\AppWallet\Infrastructure\AppWalletBundle\Form\Faucet\FundAddressFormFactory;
use SimpleBus\Message\Bus\MessageBus;
use Symfony\Bundle\FrameworkBundle\Templating\EngineInterface;
use Symfony\Component\Form\FormView;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Session\Session;
use Symfony\Component\Routing\RouterInterface;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use Symfony\Component\Translation\TranslatorInterface;

class FundAddress extends AppWalletController
{
    /**
     * @var RouterInterface
     */
    private $router;

    /**
     * @var FundAddressFormFactory
     */
    private $fundAddressFormFactory;

    /**
     * @var MessageBus
     */
    private $commandBus;

    /**
     * @param TokenStorageInterface $tokenStorage
     * @param EngineInterface $templating
     * @param TranslatorInterface $translator
     * @param Session $session
     * @param RouterInterface $router
     * @param FundAddressFormFactory $fundAddressFormFactory
     * @param MessageBus $commandBus
     */
    public function __construct(
        TokenStorageInterface $tokenStorage,
        EngineInterface $templating,
        TranslatorInterface $translator,
        Session $session,
        RouterInterface $router,
        FundAddressFormFactory $fundAddressFormFactory,
        MessageBus $commandBus)
    {
        parent::__construct($tokenStorage, $templating, $translator, $session);
        $this->router = $router;
        $this->fundAddressFormFactory = $fundAddressFormFactory;
        $this->commandBus = $commandBus;
    }

    /**
     * @param Request $request
     * @return \Symfony\Component\HttpFoundation\Response
     * @throws \Exception
     */
    public function __invoke(Request $request)
    {
        $user = $this->getUser();

        if (!$user) {
            throw $this->createAccessDeniedException();
        }

        $fundAddressCommand = $this->createFundAddressCommand();

        $fundAddressForm = $this->fundAddressFormFactory->createCreateForm($fundAddressCommand);

        $fundAddressForm->handleRequest($request);

        if (!$fundAddressForm->isValid()) {

            $validationMsg = $this->getAllFormErrorMessagesAsString($fundAddressForm);
            $this->addFlash('error', $this->trans('fund_address_form.flash.invalid_form') . ' ' . $validationMsg);

        } else {

            /** @var FundAddressCommand $fundAddressCommand */
            $fundAddressCommand = $fundAddressForm->getData();
            $fundAddressCommand->setToken($user->getBlockCypherToken());

            try {

                $commandValidator = new FundAddressCommandValidator();
                $commandValidator->validate($fundAddressCommand);

                $this->commandBus->handle($fundAddressCommand);

                $this->addFlash('success', $this->trans('faucet.flash.fund_address_successfully'));

                $url = $this->router->generate('bc_app_wallet_faucet.show');

                return new RedirectResponse($url);

            } catch (\Exception $e) {
                $this->addFlash('error', $e->getMessage());
            }
        }

        return $this->renderFaucetShowPage($request, $fundAddressForm->createView());
    }

    /**
     * @param Request $request
     * @param FormView $createWalletFormView
     * @return Response
     */
    private function renderFaucetShowPage(
        Request $request,
        FormView $createWalletFormView
    )
    {
        $template = $this->getBaseTemplatePrefix() . ':Faucet:show.html';

        return $this->templating->renderResponse(
            $template . '.' . $this->getEngine(),
            array_merge($this->getBasicTemplateVariables($request),
                array(
                    'fund_address_form' => $createWalletFormView
                )
            )
        );
    }
}


text:
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Media.Imaging;

namespace Chapter_35_Smugmug_Fetcher
{
    public class ImageItem
    {
        BitmapImage m_bitmapImage;
        public ImageSource Image { get; set; }
        public event EventHandler<EventArgs> ImageReady;

        private void CreateBitmapFromBuffer(byte[] buffer)
        {
            MemoryStream stream = new MemoryStream(buffer);
            stream.Seek(0, SeekOrigin.Begin);

            m_bitmapImage = new BitmapImage();
            m_bitmapImage.BeginInit();
            m_bitmapImage.StreamSource = stream;
            m_bitmapImage.EndInit();
        }

        void SetImageDpi()
        {
            double dpi = 72;
            int width = m_bitmapImage.PixelWidth;
            int height = m_bitmapImage.PixelHeight;

            int stride = width * 4;

            byte[] pixelData = new byte[stride * height];
            m_bitmapImage.CopyPixels(pixelData, stride, 0);

            BitmapSource bitmapSource = BitmapSource.Create(width, height, dpi, dpi, PixelFormats.Bgra32, null, pixelData, stride);
            bitmapSource.Freeze();

            Image = bitmapSource;
        }

        #region synchronous

        public void LoadImageSynchronously(string url)
        {
            WebClient webClient = new WebClient();
            byte[] buffer = webClient.DownloadData(url);
            CreateBitmapFromBuffer(buffer);
            SetImageDpi();
        }

        #endregion

        #region OldAsynchronous

        int m_offset;
        int m_contentLength;
        byte[] m_buffer;
        Stream m_stream;

public void LoadImageStart(string url)
{
    WebRequest request = WebRequest.CreateHttp(url);

    request.BeginGetResponse(new AsyncCallback(LoadImageResponseCallback), request);
}

public void LoadImageResponseCallback(IAsyncResult result)
{
    WebRequest request = (WebRequest)result.AsyncState;

    WebResponse response = request.EndGetResponse(result);

    m_stream = response.GetResponseStream();
    m_offset = 0;
    m_contentLength = (int) response.ContentLength;
    m_buffer = new byte[m_contentLength];

    StartRead();
}

        private void StartRead()
        {
            m_stream.BeginRead(m_buffer, m_offset, m_contentLength - m_offset, new AsyncCallback(ReadResponseCallback), null);
        }

        public void ReadResponseCallback(IAsyncResult result)
        {
            int bytesRead = m_stream.EndRead(result);

            if (bytesRead + m_offset == m_contentLength)
            {
                DownloadCompleted();
            }
            else
            {
                m_offset += bytesRead;
                StartRead();
            }
        }

        void DownloadCompleted()
        {
            CreateBitmapFromBuffer(m_buffer);
            SetImageDpi();
            if (ImageReady != null)
            {
                ImageReady(this, null);
            }
        }
        #endregion

        #region synchronous

        public async Task<ImageItem> LoadImageAsync(string url)
        {
            byte[] buffer = await new WebClient().DownloadDataTaskAsync(new Uri(url));
            CreateBitmapFromBuffer(buffer);
            SetImageDpi();
            return this;
        }

        static async void WebMethodDownload(string url)
        {
            string contents = await new WebClient().DownloadStringTaskAsync("http://www.bing.com");
            Console.WriteLine(contents);
        }

        #endregion
    }
}


text:
* {
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
  box-sizing: border-box;
}

/*! normalize.css v3.0.0 | MIT License | git.io/normalize */
/**
 * 1. Set default font family to sans-serif.
 * 2. Prevent iOS text size adjust after orientation change, without disabling
 *    user zoom.
 */
html {
  font-family: sans-serif;
  /* 1 */
  -ms-text-size-adjust: 100%;
  /* 2 */
  -webkit-text-size-adjust: 100%;
  /* 2 */
}

/**
 * Remove default margin.
 */
body {
  margin: 0;
}

/* HTML5 display definitions
   ========================================================================== */
/**
 * Correct `block` display not defined in IE 8/9.
 */
article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
main,
nav,
section,
summary {
  display: block;
}

/**
 * 1. Correct `inline-block` display not defined in IE 8/9.
 * 2. Normalize vertical alignment of `progress` in Chrome, Firefox, and Opera.
 */
audio,
canvas,
progress,
video {
  display: inline-block;
  /* 1 */
  vertical-align: baseline;
  /* 2 */
}

/**
 * Prevent modern browsers from displaying `audio` without controls.
 * Remove excess height in iOS 5 devices.
 */
audio:not([controls]) {
  display: none;
  height: 0;
}

/**
 * Address `[hidden]` styling not present in IE 8/9.
 * Hide the `template` element in IE, Safari, and Firefox < 22.
 */
[hidden],
template {
  display: none;
}

/* Links
   ========================================================================== */
/**
 * Remove the gray background color from active links in IE 10.
 */
a {
  background: transparent;
}

/**
 * Improve readability when focused and also mouse hovered in all browsers.
 */
a:active,
a:hover {
  outline: 0;
}

/* Text-level semantics
   ========================================================================== */
/**
 * Address styling not present in IE 8/9, Safari 5, and Chrome.
 */
abbr[title] {
  border-bottom: 1px dotted;
}

/**
 * Address style set to `bolder` in Firefox 4+, Safari 5, and Chrome.
 */
b,
strong {
  font-weight: bold;
}

/**
 * Address styling not present in Safari 5 and Chrome.
 */
dfn {
  font-style: italic;
}

/**
 * Address variable `h1` font-size and margin within `section` and `article`
 * contexts in Firefox 4+, Safari 5, and Chrome.
 */
h1 {
  font-size: 2em;
  margin: 0.67em 0;
}

/**
 * Address styling not present in IE 8/9.
 */
mark {
  background: #ff0;
  color: #000;
}

/**
 * Address inconsistent and variable font size in all browsers.
 */
small {
  font-size: 80%;
}

/**
 * Prevent `sub` and `sup` affecting `line-height` in all browsers.
 */
sub,
sup {
  font-size: 75%;
  line-height: 0;
  position: relative;
  vertical-align: baseline;
}

sup {
  top: -0.5em;
}

sub {
  bottom: -0.25em;
}

/* Embedded content
   ========================================================================== */
/**
 * Remove border when inside `a` element in IE 8/9.
 */
img {
  border: 0;
}

/**
 * Correct overflow displayed oddly in IE 9.
 */
svg:not(:root) {
  overflow: hidden;
}

/* Grouping content
   ========================================================================== */
/**
 * Address margin not present in IE 8/9 and Safari 5.
 */
figure {
  margin: 1em 40px;
}

/**
 * Address differences between Firefox and other browsers.
 */
hr {
  -moz-box-sizing: content-box;
  box-sizing: content-box;
  height: 0;
}

/**
 * Contain overflow in all browsers.
 */
pre {
  overflow: auto;
}

/**
 * Address odd `em`-unit font size rendering in all browsers.
 */
code,
kbd,
pre,
samp {
  font-family: monospace, monospace;
  font-size: 1em;
}

/* Forms
   ========================================================================== */
/**
 * Known limitation: by default, Chrome and Safari on OS X allow very limited
 * styling of `select`, unless a `border` property is set.
 */
/**
 * 1. Correct color not being inherited.
 *    Known issue: affects color of disabled elements.
 * 2. Correct font properties not being inherited.
 * 3. Address margins set differently in Firefox 4+, Safari 5, and Chrome.
 */
button,
input,
optgroup,
select,
textarea {
  color: inherit;
  /* 1 */
  font: inherit;
  /* 2 */
  margin: 0;
  /* 3 */
}

/**
 * Address `overflow` set to `hidden` in IE 8/9/10.
 */
button {
  overflow: visible;
}

/**
 * Address inconsistent `text-transform` inheritance for `button` and `select`.
 * All other form control elements do not inherit `text-transform` values.
 * Correct `button` style inheritance in Firefox, IE 8+, and Opera
 * Correct `select` style inheritance in Firefox.
 */
button,
select {
  text-transform: none;
}

/**
 * 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio`
 *    and `video` controls.
 * 2. Correct inability to style clickable `input` types in iOS.
 * 3. Improve usability and consistency of cursor style between image-type
 *    `input` and others.
 */
button,
html input[type="button"],
input[type="reset"],
input[type="submit"] {
  -webkit-appearance: button;
  /* 2 */
  cursor: pointer;
  /* 3 */
}

/**
 * Re-set default cursor for disabled elements.
 */
button[disabled],
html input[disabled] {
  cursor: default;
}

/**
 * Remove inner padding and border in Firefox 4+.
 */
button::-moz-focus-inner,
input::-moz-focus-inner {
  border: 0;
  padding: 0;
}

/**
 * Address Firefox 4+ setting `line-height` on `input` using `!important` in
 * the UA stylesheet.
 */
input {
  line-height: normal;
}

/**
 * It's recommended that you don't attempt to style these elements.
 * Firefox's implementation doesn't respect box-sizing, padding, or width.
 *
 * 1. Address box sizing set to `content-box` in IE 8/9/10.
 * 2. Remove excess padding in IE 8/9/10.
 */
input[type="checkbox"],
input[type="radio"] {
  box-sizing: border-box;
  /* 1 */
  padding: 0;
  /* 2 */
}

/**
 * Fix the cursor style for Chrome's increment/decrement buttons. For certain
 * `font-size` values of the `input`, it causes the cursor style of the
 * decrement button to change from `default` to `text`.
 */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  height: auto;
}

/**
 * 1. Address `appearance` set to `searchfield` in Safari 5 and Chrome.
 * 2. Address `box-sizing` set to `border-box` in Safari 5 and Chrome
 *    (include `-moz` to future-proof).
 */
input[type="search"] {
  -webkit-appearance: textfield;
  /* 1 */
  -moz-box-sizing: content-box;
  -webkit-box-sizing: content-box;
  /* 2 */
  box-sizing: content-box;
}

/**
 * Remove inner padding and search cancel button in Safari and Chrome on OS X.
 * Safari (but not Chrome) clips the cancel button when the search input has
 * padding (and `textfield` appearance).
 */
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-decoration {
  -webkit-appearance: none;
}

/**
 * Define consistent border, margin, and padding.
 */
fieldset {
  border: 1px solid #c0c0c0;
  margin: 0 2px;
  padding: 0.35em 0.625em 0.75em;
}

/**
 * 1. Correct `color` not being inherited in IE 8/9.
 * 2. Remove padding so people aren't caught out if they zero out fieldsets.
 */
legend {
  border: 0;
  /* 1 */
  padding: 0;
  /* 2 */
}

/**
 * Remove default vertical scrollbar in IE 8/9.
 */
textarea {
  overflow: auto;
}

/**
 * Don't inherit the `font-weight` (applied by a rule above).
 * NOTE: the default cannot safely be changed in Chrome and Safari on OS X.
 */
optgroup {
  font-weight: bold;
}

/* Tables
   ========================================================================== */
/**
 * Remove most spacing between table cells.
 */
table {
  border-collapse: collapse;
  border-spacing: 0;
}

td,
th {
  padding: 0;
}

::selection {
  background: #cecece;
  color: #fefefe;
  text-shadow: none;
}

::-moz-selection {
  background: #cecece;
  color: #fefefe;
  text-shadow: none;
}

i {
  color: inherit;
}

p {
  margin: 0;
  /*margin-bottom: -3em;*/
}

hr {
  display: block;
  height: 1px;
  border: 0;
  border-top: 1px solid #ccc;
  margin: 1em 0;
  padding: 0;
}

iframe {
  border: 0;
}

video {
  width: 100%;
  height: 100%;
}

audio {
  width: 100%;
}

audio,
canvas,
img,
svg,
video {
  vertical-align: middle;
}

img {
  max-width: 100%;
  font-style: italic;
}

button,
input[type="submit"],
input[type="reset"],
input[type="button"] {
  border: none;
  text-decoration: none;
  cursor: pointer;
  line-height: normal;
  padding: 0;
}

/* Fix for odd Mozilla border & padding issues */
button::-moz-focus-inner,
input::-moz-focus-inner {
  border: 0;
  padding: 0;
}

textarea {
  border: none;
  outline: none;
  margin: 0;
  width: 100%;
  display: block;
  background: #fff;
}

html {
  font-family: "ubuntu-light-webfont";
  font-size: 16px;
  line-height: 24px;
  color: #444444;
  background-color: #fefefe;
  cursor: default;
}

body {
  *zoom: 1;
  /*max-width: 68em;*/
  margin-left: auto;
  margin-right: auto;
}
body:before, body:after {
  content: " ";
  display: table;
}
body:after {
  /*clear: both;*/
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 0px;
}

.footer {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 100px;
  width: 100%;
}

fieldset {
  border: 0;
  margin: 0;
  padding: 0;
}

textarea {
  resize: vertical;
}

input[type="text"],
input[type="password"],
input[type="email"],
select,
textarea {
  width: 100%;
  margin-bottom: 24px;
  padding: 6px 12px;
  border: 1px solid #cecece;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
select:focus,
textarea:focus {
  border: 1px solid #c65555;
}

input[type="checkbox"] {
  display: block;
  margin: 6px 12px;
  margin-bottom: 24px;
}

label {
  display: block;
  margin-bottom: 12px;
  font-size: 18px;
}
label input[type="checkbox"] {
  display: inline;
  margin: 6px 12px;
  margin-bottom: 0;
}

@font-face {
  font-family: ubuntu-light-webfont;
  font-weight: normal;
  font-style: normal;
  src: url("vendors/fonts/ubuntu-light-webfont.eot");
  src: url("vendors/fonts/ubuntu-light-webfont.eot?#iefix") format("embedded-opentype"), url("vendors/fonts/ubuntu-light-webfont.woff") format("woff"), url("vendors/fonts/ubuntu-light-webfont.ttf") format("truetype"), url("vendors/fonts/ubuntu-light-webfont.svg#ubuntu-light-webfont") format("svg");
}
@media screen and (-webkit-min-device-pixel-ratio: 0) {
  @font-face {
    font-family: 'ubuntu-light-webfont';
    src: url("vendors/fonts/ubuntu-light-webfont.svg") format("svg");
  }
}
a {
  color: #979797;
  text-decoration: none;
  outline: 0;
}
a:hover, a:focus {
  color: #1c1c1c;
}

ul, ol {
  margin: 0;
  padding: 0;
  list-style-type: none;
}
h1 {
  font-size: 25.88854px;
  line-height: 38.83282px;
}

h2 {
  font-size: 21.33333px;
  line-height: 32.0px;
}

.comment-media, .container-spirit,
.header, .row,
.comment {
  *zoom: 1;
}
.comment-media:before, .container:before,
.header:before, .row:before,
.comment:before, .comment-media:after, .container:after,
.header:after, .row:after,
.comment:after {
  content: " ";
  display: table;
}
.comment-media:after, .container:after,
.header:after, .row:after,
.comment:after {
  clear: both;
}

.inline-list li,
.tabs li,
.admin-tabs li,
.header-tabs li,
.nav li,
.comment-info li,
.comment-actions li,
.paginator li,
.reply-markdown li,
.profile-track li, .row-info div {
  display: inline-block;
  *display: inline;
  zoom: 1;
}

.inline-list li,
.tabs li,
.admin-tabs li,
.header-tabs li,
/*.nav li,*/
.comment-info li,
.comment-actions li,
.paginator li,
.reply-markdown li,
.profile-track li {
  margin-left: 12px;
}
.inline-list li:first-child,
.tabs li:first-child,
.admin-tabs li:first-child,
.header-tabs li:first-child,
.nav li:first-child,
.comment-info li:first-child,
.comment-actions li:first-child,
.paginator li:first-child,
.reply-markdown li:first-child,
.profile-track li:first-child {
  margin-left: 0;
}

input[type="submit"].button,
.button, .dropdown-button {
  line-height: 2;
  height: 2em;
  color: #444444;
}

input[type="submit"].button,
.button {
  display: block;
  width: 100%;
  text-align: center;
  background-color: #cecece;
}
input[type="submit"].button.is-undo,
.button.is-undo {
  background-color: #c65555;
}
@media screen and (min-width: 768px) {
  input[type="submit"].button,
  .button {
    display: inline-block;
    *display: inline;
    zoom: 1;
    width: auto;
    padding: 0 12px;
  }
}

.comment-img {
  float: left;
}

.comment-body {
  overflow: hidden;
}

.tab-link {
  display: block;
  font-size: 18px;
  padding: 0 12px 6px 12px;
}
.tab-link.is-selected {
  color: #1c1c1c;
  border-bottom: #cecece 4px solid;
}

.side-menu {
  z-index: 9000;
  position: fixed;
  top: 0;
  left: 0;
  width: 0;
  /* hidden (for animation) */
  max-width: 320px;
  height: 100%;
  overflow: hidden;
  overflow-y: auto;
  background: #333333;
  -webkit-box-shadow: inset -1.5em 0 1.5em -0.75em rgba(0, 0, 0, 0.25);
  -moz-box-shadow: inset -1.5em 0 1.5em -0.75em rgba(0, 0, 0, 0.25);
  box-shadow: inset -1.5em 0 1.5em -0.75em rgba(0, 0, 0, 0.25);
  -webkit-transition: width 0.5s ease;
  -moz-transition: width 0.5s ease;
  -o-transition: width 0.5s ease;
  transition: width 0.5s ease;
}
.side-menu li {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.side-menu li:last-child {
  border-bottom: rgba(255, 255, 255, 0.1) solid 1px;
}

/* IE9+ */
#side-menu:target,
.side-menu-show {
  width: 70%;
}

.side-menu-link {
  display: block;
  line-height: 42px;
  white-space: nowrap;
  color: #cccccc;
  padding-left: 15px;
}
.side-menu-link:focus, .side-menu-link:hover {
  color: #fefefe;
  background: rgba(255, 255, 255, 0.1);
}
.side-menu-link.is-active {
  color: #fefefe;
}

.side-menu-close {
  font-size: 35px;
  line-height: 75px;
  margin-left: 15px;
  color: #cccccc;
}
.side-menu-close:focus, .side-menu-close:hover {
  color: #fefefe;
}

.container-spirit{
  padding-left: 0px;
  margin-right: auto;
}
.header {
  /*margin-bottom: 24px;*/
  padding-top: 50px;

}

.header-logo {
  float: left;
  font-size: 28px;
  line-height: 48px;
  color: #444444;
}

.header-link {
  float: right;
  line-height: 48px;
}

.header-tabs {
  float: right;
  line-height: 48px;
}
.header-tabs li {
  margin-left: 24px;
}

.header-tab-link.is-selected {
  color: #1c1c1c;
}
.header-tab-link.is-highlighted {
  color: #c65555;
}

.header-tabs-content {
  clear: both;
}

.header-tab-content {
  display: none;
  padding-bottom: 24px;
  border-bottom: #cecece 1px solid;
}

@media screen and (min-width: 768px) {
  .header-nav {
    text-align: right;
  }
}
.header-nav .menu {
  text-align: left;
}

.footer-container {
  *zoom: 1;
  max-width: 68em;
  margin-left: auto;
  margin-right: auto;
}
.footer-container:before, .footer-container:after {
  content: " ";
  display: table;
}
.footer-container:after {
  clear: both;
}

.footer-logo {
  float: right;
  font-size: 14px;
  margin-top: 50px;
}

.headline {
  font-weight: normal;
}

.checkboxes {
  overflow: auto;
  max-height: 144px;
  margin-bottom: 24px;
  background-color: #fefefe;
  border: 1px solid #cecece;
}

.errorlist {
  color: #c65555;
  margin-bottom: 12px;
}

.video {
  display: block;
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
}
.video iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.rows {
  margin-bottom: 24px;
}

.row,
.comment {
  padding: 12px;
  border-top: #cecece 1px solid;
}
.row:last-child,
.comment:last-child {
  border-bottom: #cecece 1px solid;
}

.row-title {
  float: left;
  display: block;
  margin-right: 7.42297%;
  width: 100%;
  margin-bottom: 12px;
}
.row-title:last-child {
  margin-right: 0;
}
@media screen and (min-width: 768px) {
  .row-title {
    float: left;
    display: block;
    margin-right: 3.57866%;
    width: 48.21067%;
    margin-bottom: 0;
  }
  .row-title:last-child {
    margin-right: 0;
  }
}

.row-link {
  color: #444444;
}
.row-link:visited {
  color: #979797;
}

.row-info {
  float: left;
  display: block;
  margin-right: 7.42297%;
  width: 100%;
  color: #979797;
}
.row-info:last-child {
  margin-right: 0;
}
.row-info div {
  margin-left: 24px;
}
.row-info div:first-child {
  margin-left: 0;
}
@media screen and (min-width: 768px) {
  .row-info {
    float: left;
    display: block;
    margin-right: 3.57866%;
    width: 48.21067%;
    text-align: right;
  }
  .row-info:last-child {
    margin-right: 0;
  }
}

.row-unread {
  font-size: 9.88854px;
  background-color: #e2f5fc;
}

.row-edit {
  float: right;
}

.categories {
  float: left;
  display: block;
  margin-right: 7.42297%;
  width: 100%;
  margin-bottom: 12px;
}
.categories:last-child {
  margin-right: 0;
}
@media screen and (min-width: 768px) {
  .categories {
    float: left;
    display: block;
    margin-right: 3.57866%;
    width: 48.21067%;
  }
  .categories:last-child {
    margin-right: 0;
  }
}

.tab-content {
  display: none;
}

.new-topic {
  float: left;
  display: block;
  margin-right: 7.42297%;
  width: 100%;
}
.new-topic:last-child {
  margin-right: 0;
}
@media screen and (min-width: 768px) {
  .new-topic {
    float: left;
    display: block;
    margin-right: 3.57866%;
    width: 48.21067%;
    text-align: right;
  }
  .new-topic:last-child {
    margin-right: 0;
  }
}

.topic-moderation {
  margin-bottom: 24px;
}
@media screen and (min-width: 768px) {
  .topic-moderation {
    text-align: right;
  }
  .topic-moderation .menu {
    text-align: left;
  }
}

.head-edit-link {
  font-size: 14px;
}

.move-comments {
  position: fixed;
  bottom: 0;
  left: 0;
  z-index: 1;
  display: block;
  width: 100%;
  background: #cecece;
  padding: 6px 0;
}

.move-container {
  *zoom: 1;
  max-width: 68em;
  margin-left: auto;
  margin-right: auto;
}
.move-container:before, .move-container:after {
  content: " ";
  display: table;
}
.move-container:after {
  clear: both;
}

.move-link,
.move-label,
.move-input {
  display: inline-block;
  vertical-align: middle;
  margin: 0;
  margin-left: 12px;
}

.move-link {
  padding: 6px;
  background: #f6f6f6;
}

.move-input input {
  width: 100px;
  margin: 0;
}

input.move-comment-checkbox {
  display: inline-block;
  margin: 0;
}

.nav {
  font-size: 14px;
}
.nav .fa {
  margin-left: 12px;
}

.comments {
  margin-bottom: 24px;
}

.comment.is-highlighted {
  background: #ffffe9;
}

.comment-img {
  width: 50px;
  word-wrap: break-word;
  margin-right: 24px;
}

.comment-body blockquote {
  border-left: #cecece 4px solid;
  padding-left: 12px;
}
.comment-body ul {
  list-style-type: disc;
  list-style-position: inside;
  margin-left: 40px;
}

.comment-info {
  font-size: 14px;
  text-align: right;
}

.comment-username {
  font-size: 14px;
  text-align: center;
}

.comment-actions {
  font-size: 14px;
  text-align: right;
}

.username.is-admin {
  background: #ffffe9;
}
.username.is-mod {
  background: #e2f5fc;
}

.paginator {
  margin-bottom: 24px;
}
@media screen and (min-width: 768px) {
  .paginator {
    float: left;
    display: block;
    margin-right: 3.57866%;
    width: 48.21067%;
  }
  .paginator:last-child {
    margin-right: 0;
  }
}

.paginator-button {
  display: block;
  padding: 4px 12px;
  border: #cecece 1px solid;
}

.notify {
  margin-bottom: 48px;
}
@media screen and (min-width: 768px) {
  .notify {
    float: left;
    display: block;
    margin-right: 3.57866%;
    width: 48.21067%;
    text-align: right;
  }
  .notify:last-child {
    margin-right: 0;
  }
}

.reply {
  padding: 12px;
}
.reply textarea {
  height: 96px;
  margin-bottom: 12px;
}

.reply-markdown {
  margin-bottom: 24px;
}
@media screen and (min-width: 768px) {
  .reply-markdown {
    float: left;
  }
}
.reply-markdown li {
  margin-left: 24px;
}

ul.reply-markdown {
  /* reset */
  list-style: none;
  margin-left: 0;
}

@media screen and (min-width: 768px) {
  .reply-button {
    float: right;
  }
}

.topic-publish-comment textarea {
  height: 240px;
}

@media screen and (min-width: 768px) {
  .menu,
  .participants-menu {
    display: inline-block;
  }
}
.menu li,
.participants-menu li {
  background-color: #f6f6f6;
  margin-bottom: 6px;
}
.menu li:last-child,
.participants-menu li:last-child {
  margin-bottom: 0;
}

.menu-link {
  display: block;
  padding: 0 12px;
}

.menu-item {
  padding: 0 12px;
}

.menu-icon {
  float: right;
}

.profile-img {
  float: left;
  display: block;
  margin-right: 7.42297%;
  width: 100%;
  margin-bottom: 24px;
  text-align: center;
}
.profile-img:last-child {
  margin-right: 0;
}

.profile-avatar {
  width: 200px;
  height: 200px;
}

.profile-username {
  font-size: 21px;
}

.profile-info {
  margin-bottom: 24px;
  text-align: center;
}

.profile-title {
  text-align: left;
}

.profile-date {
  text-align: left;
}

.private-message {
  margin-bottom: 48px;
  text-align: center;
}

.profile-preferences {
  margin-bottom: 48px;
  text-align: center;
}

.private-participants {
  float: left;
  display: block;
  margin-right: 7.42297%;
  width: 100%;
  margin-bottom: 12px;
}
.private-participants:last-child {
  margin-right: 0;
}
@media screen and (min-width: 768px) {
  .private-participants {
    float: left;
    display: block;
    margin-right: 3.57866%;
    width: 48.21067%;
  }
  .private-participants:last-child {
    margin-right: 0;
  }
}

.private-leave {
  float: left;
  display: block;
  margin-right: 7.42297%;
  width: 100%;
  margin-bottom: 24px;
}
.private-leave:last-child {
  margin-right: 0;
}
@media screen and (min-width: 768px) {
  .private-leave {
    float: left;
    display: block;
    margin-right: 3.57866%;
    width: 48.21067%;
    text-align: right;
  }
  .private-leave:last-child {
    margin-right: 0;
  }
}

.participants-menu {
  margin-bottom: 12px;
}

.preference-label {
  font-size: 18px;
  margin-bottom: 12px;
}

.preference-desc {
  margin: 0;
  margin-bottom: 24px;
  padding: 0 12px;
}

.login {
  margin-bottom: 24px;
}

.login-link {
  display: block;
  margin-bottom: 6px;
}

.messages-info, .messages-error {
  margin-bottom: 24px;
  padding: 12px;
}

.messages-info {
  background: #e2f5fc;
}

.messages-error {
  background: #fce2e2;
}

.message-title {
  margin-bottom: 12px;
}
.message-title.is-info {
  color: #95a2a7;
}
.message-title.is-error {
  color: #c65555;
}

.admin-tabs {
  margin-bottom: 24px;
}

.statistics-box {
  float: left;
  display: block;
  margin-right: 7.42297%;
  width: 19.43277%;
  word-wrap: break-word;
  padding: 12px 0;
  margin-bottom: 24px;
  background: #f6f6f6;
}
.statistics-box:last-child {
  margin-right: 0;
}
.statistics-box:nth-child(4n) {
  margin-right: 0;
}
.statistics-box:nth-child(4n+1) {
  clear: left;
}

.statistics-title {
  text-align: center;
}

.statistics-count {
  text-align: center;
}

.new-category {
  margin-bottom: 24px;
}
@media screen and (min-width: 768px) {
  .new-category {
    text-align: right;
  }
}

/*
div.container {
  @include outer-container;

  div.element {
    @include span-columns(4);
	//styles

	@include media( $medium ) {
      @include span-columns(4);
	  //styles
    }

	@include media( $medium-only ) {
	  @include omega(2n);
	  //only for omega.
    }

	@include media( $large ) {
      @include span-columns(3);
	  //styles
	}
  }

}
*/


text:
layout: page
title: Download
permalink: /download/
---

            Hello there! :)

 I am Java developer with passion for android, linux, front end development and other open source technologies.

         Star it if you loved!

    GitHub Repository


text:
<!DOCTYPE html>

supercalifragilisticexpialidocious
supercalifragilisticexpialidocious
supercalifragilisticexpialidocious


text:
.relative_positive td:last-child {
    color: green;
}
.relative_negative td:last-child {
    color: red;
}
.market_hole td:nth-child(3),
.market_hole td:nth-child(4),
.market_hole td:nth-last-child(1) {
    color: orange;
}


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

namespace CivGen
{
    public partial class GreatPersonClass : CivBase
    {
        //Constants used to correct / convert the 'Name' to the friendly display name.
        private const string NamePrefix = "LOC_GREAT_PERSON_CLASS_";
        private const string NameSuffix = "_NAME";

        /// <summary>
        /// ABSTRACT - MUST BE IMPLEMENTED:  Friendly name for the class instance in the html output.
        /// </summary>
        public override string ReferenceName
        {
            get
            {
                return Name.Replace(NamePrefix, "").Replace(NameSuffix, "");
            }
        }

        /// <summary>
        /// ABSTRACT - MUST BE IMPLEMENTED:  Access to the Era.
        /// </summary>
        public override eERA ReferenceEra
        {
            get
            {
                return eERA.ANCIENT;

            }
        }
    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<ivy-module version="2.0" xmlns:m="http://ant.apache.org/ivy/maven">
	<info organisation="com.google.guava"
		module="guava"
		revision="16.0.1"
		status="release"
		publication="20140203174528"
	>
		<description homepage="">
		Guava is a suite of core and expanded libraries that include
    utility classes, google's collections, io classes, and much
    much more.

    Guava has only one code dependency - javax.annotation,
    per the JSR-305 spec.
		</description>
		<m:dependency.management__org.easymock__easymock__scope>test</m:dependency.management__org.easymock__easymock__scope>
		<m:dependency.management__com.google.caliper__caliper__scope>test</m:dependency.management__com.google.caliper__caliper__scope>
		<m:dependency.management__junit__junit__scope>test</m:dependency.management__junit__junit__scope>
		<m:dependency.management__org.truth0__truth__scope>test</m:dependency.management__org.truth0__truth__scope>
		<m:properties__test.include>**/*Test.java</m:properties__test.include>
		<m:properties__gpg.skip>true</m:properties__gpg.skip>
		<m:dependency.management__org.mockito__mockito-core__scope>test</m:dependency.management__org.mockito__mockito-core__scope>
		<m:properties__truth.version>0.13</m:properties__truth.version>
		<m:properties__project.build.sourceEncoding>UTF-8</m:properties__project.build.sourceEncoding>
		<m:dependency.management__javax.inject__javax.inject__version>1</m:dependency.management__javax.inject__javax.inject__version>
		<m:dependency.management__org.truth0__truth__exclusion_0>com.google.guava__guava</m:dependency.management__org.truth0__truth__exclusion_0>
		<m:dependency.management__com.google.caliper__caliper__version>0.5-rc1</m:dependency.management__com.google.caliper__caliper__version>
		<m:dependency.management__junit__junit__version>4.8.2</m:dependency.management__junit__junit__version>
		<m:dependency.management__com.google.caliper__caliper__exclusion_0>com.google.guava__guava</m:dependency.management__com.google.caliper__caliper__exclusion_0>
		<m:dependency.management__org.truth0__truth__version>0.13</m:dependency.management__org.truth0__truth__version>
		<m:dependency.management__com.google.code.findbugs__jsr305__version>1.3.9</m:dependency.management__com.google.code.findbugs__jsr305__version>
		<m:properties__sonatypeOssDistMgmtSnapshotsUrl>https://oss.sonatype.org/content/repositories/snapshots/</m:properties__sonatypeOssDistMgmtSnapshotsUrl>
		<m:dependency.management__org.mockito__mockito-core__version>1.8.5</m:dependency.management__org.mockito__mockito-core__version>
		<m:dependency.management__org.easymock__easymock__version>3.0</m:dependency.management__org.easymock__easymock__version>
		<m:maven.plugins>org.apache.maven.plugins__maven-enforcer-plugin__1.0|org.apache.maven.plugins__maven-enforcer-plugin__1.0|null__maven-gpg-plugin__1.4|org.apache.maven.plugins__maven-enforcer-plugin__1.0|org.apache.maven.plugins__maven-enforcer-plugin__1.0|null__maven-gpg-plugin__1.4|org.apache.felix__maven-bundle-plugin__2.3.7|null__maven-compiler-plugin__null|null__maven-source-plugin__null|null__maven-dependency-plugin__null|org.codehaus.mojo__animal-sniffer-maven-plugin__null|org.apache.maven.plugins__maven-javadoc-plugin__null</m:maven.plugins>
	</info>
	<configurations>
		<conf name="default" visibility="public" description="runtime dependencies and master artifact can be used with this conf" extends="runtime,master"/>
		<conf name="master" visibility="public" description="contains only the artifact published by this module itself, with no transitive dependencies"/>
		<conf name="compile" visibility="public" description="this is the default scope, used if none is specified. Compile dependencies are available in all classpaths."/>
		<conf name="provided" visibility="public" description="this is much like compile, but indicates you expect the JDK or a container to provide it. It is only available on the compilation classpath, and is not transitive."/>
		<conf name="runtime" visibility="public" description="this scope indicates that the dependency is not required for compilation, but is for execution. It is in the runtime and test classpaths, but not the compile classpath." extends="compile"/>
		<conf name="test" visibility="private" description="this scope indicates that the dependency is not required for normal use of the application, and is only available for the test compilation and execution phases." extends="runtime"/>
		<conf name="system" visibility="public" description="this scope is similar to provided except that you have to provide the JAR which contains it explicitly. The artifact is always available and is not looked up in a repository."/>
		<conf name="sources" visibility="public" description="this configuration contains the source artifact of this module, if any."/>
		<conf name="javadoc" visibility="public" description="this configuration contains the javadoc artifact of this module, if any."/>
		<conf name="optional" visibility="public" description="contains all optional dependencies"/>
	</configurations>
	<publications>
		<artifact name="guava" type="bundle" ext="jar" conf="master"/>
	</publications>
	<dependencies>
		<dependency org="com.google.code.findbugs" name="jsr305" rev="1.3.9" force="true" conf="optional->compile(*),master(compile)"/>
		<override org="org.easymock" module="easymock" matcher="exact" rev="3.0"/>
		<override org="org.truth0" module="truth" matcher="exact" rev="0.13"/>
		<override org="com.google.caliper" module="caliper" matcher="exact" rev="0.5-rc1"/>
		<override org="org.mockito" module="mockito-core" matcher="exact" rev="1.8.5"/>
		<override org="javax.inject" module="javax.inject" matcher="exact" rev="1"/>
		<override org="junit" module="junit" matcher="exact" rev="4.8.2"/>
		<override org="com.google.code.findbugs" module="jsr305" matcher="exact" rev="1.3.9"/>
	</dependencies>
</ivy-module>


text:
**pimsl** is a small utility library for Scala.

[![Build Status](https://travis-ci.org/DavidGregory084/pimsl.svg?branch=master)](https://travis-ci.org/DavidGregory084/pimsl) [![codecov.io](http://codecov.io/github/DavidGregory084/pimsl/coverage.svg?branch=master)](http://codecov.io/github/DavidGregory084/pimsl?branch=master)

## Usage

### Arrows
**pimsl** offers a limited implementation of [John Hughes' Arrows](http://www.cse.chalmers.se/~rjmh/Papers/arrows.pdf) in Scala, including compatibility with sequence comprehensions in a way that imitates Haskell's `proc` notation:

```scala
scala> import pimsl.Arrow._
import pimsl.Arrow._

scala> val addOne: Int => Int = a => a + 1
addOne: Int => Int = <function1>

scala> val addTwo: Int => Int = a => a + 2
addOne: Int => Int = <function1>

scala> :paste
// Entering paste mode (ctrl-D to finish)

val proc: Int => Int = x => for {
  y <- addOne -< x
  z <- addTwo -< x
} yield y + z

// Exiting paste mode, now interpreting.

proc: Int => Int = <function1>

scala> proc(0)
res0: Int = 3
```

**Author**

[David Gregory](https://github.com/DavidGregory084)


text:
require_relative 'node'
require_relative 'null_node'

module Library

  class Tree

    attr_reader :nodes
    attr_accessor :paths

    def initialize(paths:)
      @paths = paths
    end

    def nodes
      @nodes ||= root_nodes
    end

    def to_h
      nodes.map(&:to_h)
    end

    def to_json
      to_h.to_json
    end

    private

    def splitted_paths
      paths.map { |path| path.split('/').reject { |path| path.empty? } }
    end

    def unlinked_nodes
      @unlinked_nodes ||= splitted_paths
        .map do |paths|
          paths.map do |path|
            Node.new(name: path)
          end
      end
    end

    def linked_nodes
      @linked_nodes ||= unlinked_nodes.map do |unlinked_nodes|
        root_nodes = []
        unlinked_nodes.each_cons(2).each_with_index do |(parent, child), index|
          if(index == 0)
            root_nodes << parent
          end
          child.parent = parent
          parent.nodes << child
        end
        root_nodes
      end
    end

    def root_nodes
      backup_nodes = linked_nodes.dup
      temp_nodes = backup_nodes.first.dup
      backup_nodes.shift
      backup_nodes.each_with_object(temp_nodes) do |nod, tmp|
        rewire_nodes(node: nod.first, base_node: tmp.first)
      end
      temp_nodes
    end

    def rewire_nodes(node:, base_node:, backup_parent: nil)
      if(node.name == base_node.name)
        x = base_node.nodes.detect { |n| n.name == node.nodes.first.name } || base_node.nodes.first || NullNode.new
        if x.name == "nodeless"
          rewire_nodes(node: node.nodes.first, base_node: x, backup_parent: base_node)
        else
          rewire_nodes(node: node.nodes.first, base_node: x)
        end
      elsif(base_node.name == "nodeless")
        node.parent = backup_parent
        backup_parent.nodes << node
      else
        node.parent = base_node.parent
        base_node.parent.nodes << node
      end
    end

  end

end


text:
package ee.cone.c4actor

import okio.ByteString

import ee.cone.c4actor.QProtocol._
import ee.cone.c4actor.Types._

case class RawSnapshot(relativePath: String)
trait RawSnapshotSaver {
  def save(snapshot: RawSnapshot, data: Array[Byte]): Unit
}

trait RawSnapshotLoader {
  def load(snapshot: RawSnapshot): ByteString
}
trait RawSnapshotLoaderFactory {
  def create(baseURL: String): RawSnapshotLoader
}

trait SnapshotSaver {
  def save(offset: NextOffset, data: Array[Byte], headers: List[RawHeader]): RawSnapshot
}
trait SnapshotUtil {
  def hashFromName: RawSnapshot=>Option[SnapshotInfo]
}
case class SnapshotInfo(subDirStr: String, offset: NextOffset, uuid: String, headers: List[RawHeader], raw: RawSnapshot)
trait SnapshotLoader {
  def load(snapshot: RawSnapshot): Option[RawEvent]
}
trait SnapshotLoaderFactory {
  def create(raw: RawSnapshotLoader): SnapshotLoader
}

sealed abstract class SnapshotTask(val name: String, val offsetOpt: Option[NextOffset]) extends Product
case class NextSnapshotTask(offsetOptArg: Option[NextOffset]) extends SnapshotTask("next",offsetOptArg)
case class DebugSnapshotTask(offsetArg: NextOffset) extends SnapshotTask("debug",Option(offsetArg))

trait SnapshotTaskSigner extends Signer[SnapshotTask]

trait SnapshotMaker {
  def make(task: SnapshotTask): List[RawSnapshot]
}

trait RemoteSnapshotUtil {
  def request(appURL: String, signed: String): ()=>List[RawSnapshot]
}

trait SnapshotMerger {
  def merge(baseURL: String, signed: String): Context => Context
}

trait SnapshotDiffer {
  def diff(currentSnapshot: RawEvent, targetFullSnapshot: RawEvent, addIgnore: Set[Long]): List[N_UpdateFrom]
  def diff(currentSnapshot: RawEvent, target: List[N_UpdateFrom], addIgnore: Set[Long]): List[N_UpdateFrom]
  def needCurrentSnapshot: Context=>RawEvent
}

case class TimedSnapshotInfo(snapshot: SnapshotInfo, mTime: Long)

trait SnapshotLister {
  def list: List[SnapshotInfo]
  def listWithMTime: List[TimedSnapshotInfo]
}


text:
package com.exxeta.iss.sonar.esql;

import org.sonar.api.config.Configuration;
import org.sonar.api.resources.AbstractLanguage;

public class EsqlLanguage extends AbstractLanguage {

    public static final String KEY = "esql";

    static final String FILE_SUFFIXES_KEY = "sonar.esql.file.suffixes";
    static final String FILE_SUFFIXES_DEFVALUE = ".esql";

    private Configuration configuration;

    public EsqlLanguage(Configuration configuration) {
        super(KEY, "Esql");
        this.configuration = configuration;
    }

    @Override
    public String[] getFileSuffixes() {
        return configuration.getStringArray(FILE_SUFFIXES_KEY);
    }

}


text:
<?xml version="1.0" encoding="UTF-8"?>
<dataset>
	<product id="id" name="name"/>
</dataset>


text:
module OS
  module Linux
    # Helper functions for querying `glibc` information.
    #
    # @api private
    module Glibc
      extend T::Sig

      module_function

      def system_version
        @system_version ||= begin
          version = Utils.popen_read("/usr/bin/ldd", "--version")[/ (\d+\.\d+)/, 1]
          if version
            Version.new version
          else
            Version::NULL
          end
        end
      end

      def version
        @version ||= begin
          version = Utils.popen_read(HOMEBREW_PREFIX/"opt/glibc/bin/ldd", "--version")[/ (\d+\.\d+)/, 1]
          if version
            Version.new version
          else
            system_version
          end
        end
      end

      sig { returns(Version) }
      def minimum_version
        Version.new(ENV.fetch("HOMEBREW_LINUX_MINIMUM_GLIBC_VERSION"))
      end

      def below_minimum_version?
        system_version < minimum_version
      end
    end
  end
end


text:
<!DOCTYPE HTML>

  <title>Preferences Test</title>

  <meta http-equiv="Content-Type" content="text/html;charset=utf-8">

  <link href="https://cdnjs.cloudflare.com/ajax/libs/jsoneditor/4.2.1/jsoneditor.min.css" rel="stylesheet" type="text/css">

    [ Simple ]
    [ Advanced ]

    [ Simple ]
    [ Advanced ]

      This page supports display and configuration of a few sample preferences.

            <input type="checkbox" id="enable_spellchecking"/> Enable spell checking

            <input type="checkbox" id="allow_running_insecure_content"/> Allow running insecure content

            Proxy type:
            <select id="proxy_type" onChange="proxyTypeChange()">
              <option value="direct">Direct</option>
              <option value="auto_detect">Auto-Detect</option>
              <option value="pac_script">PAC Script</option>
              <option value="fixed_servers">Fixed Servers</option>
              <option value="system">System</option>
            </select>
            <input id="proxy_value" type="text" size="80" disabled/>

            <input type="button" value="Refresh" onClick="refreshSimple()"/>

            <input type="button" value="Apply Changes" onClick="applySimpleChanges()"/>

      This page displays all preferences organized in a tree structure. Arbitrary changes are
      allowed, however changing preferences in arbitrary ways may result in crashes. If you
      experience a crash while setting preferences then run a Debug build of CEF/Chromium and watch
      for DCHECKs in the Chromium code to figure out what went wrong.

          <input type="button" value="Refresh" onClick="refreshEditor()"/>
          <input type="checkbox" id="hide_defaults"/> Show modified preferences only

          <input type="button" value="Apply Changes" onClick="applyEditorChanges()"/>


text:
In order to contribute just git clone the repository and then run:

```
git clone git@github.com:mgonto/restangular.git
cd restangular
npm install grunt-cli --global
npm install
```

Be sure to have PhantomJS installed as Karma tests use it. Otherwise, in Mac just run

```
brew install phantomjs
```

All changes must be done in src/restangular.js

##Branching

Please submit a Pull Request or create issues for anything you want :). If your code is super small, nobody will blame
you for doing it from master to master. Otherwise, please try to create a branch `features/[name of your awesome feature]`.

##Testing and styling

Before submiting any PR, you should run `grunt test` to validate your didn't break anything. If you just added a new
feature, please consider also adding tests for it. And when you're done with your code, run `grunt jshint` to check
if you code follow the same simple coding design as the rest of the project.

Thanks!


text:
package org.butterfaces.component.showcase;

import org.butterfaces.component.showcase.example.AbstractCodeExample;
import org.butterfaces.component.showcase.example.XhtmlCodeExample;
import org.butterfaces.component.showcase.type.PrettyPrintType;
import org.butterfaces.model.tree.EnumTreeBoxWrapper;
import org.butterfaces.component.showcase.example.AbstractCodeExample;
import org.butterfaces.component.showcase.example.XhtmlCodeExample;
import org.butterfaces.component.showcase.type.PrettyPrintType;
import org.butterfaces.model.tree.EnumTreeBoxWrapper;

import javax.faces.view.ViewScoped;
import javax.inject.Named;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

@Named
@ViewScoped
@SuppressWarnings("serial")
public class PrettyPrintShowcase extends AbstractCodeShowcase implements Serializable {

    private PrettyPrintType prettyPrintType = PrettyPrintType.HTML;

    @Override
    public void buildCodeExamples(List<AbstractCodeExample> codeExamples) {
        final XhtmlCodeExample xhtmlCodeExample = new XhtmlCodeExample(false);
        xhtmlCodeExample.setWrappedByForm(false);

        xhtmlCodeExample.appendInnerContent("\n        ");
        if (prettyPrintType == PrettyPrintType.HTML) {
            xhtmlCodeExample.appendInnerContent("           #{myBean.htmlContent}");
        } else if (prettyPrintType == PrettyPrintType.JAVA) {
            xhtmlCodeExample.appendInnerContent("           #{myBean.javaContent}");
        } else {
            xhtmlCodeExample.appendInnerContent("           #{myBean.xmlContent}");
        }
        xhtmlCodeExample.appendInnerContent("        ");

        codeExamples.add(xhtmlCodeExample);
    }

    public String getContent() {
        switch (prettyPrintType) {
            case JAVA:
                return getJavaExample();
            case XML:
                return getXmlExample();
            default:
                return getHtmlExample();
        }
    }

    public String getLanguage() {
        switch (prettyPrintType) {
            case JAVA:
                return "lang-java";
            case XML:
                return "lang-xml";
            default:
                return "lang-html";
        }
    }

    public List<EnumTreeBoxWrapper> getPrettyPrintTypes() {
        final List<EnumTreeBoxWrapper> items = new ArrayList<>();

        for (final PrettyPrintType type : PrettyPrintType.values()) {
            items.add(new EnumTreeBoxWrapper(type, type.label));
        }
        return items;
    }

    private String getJavaExample() {
        final StringBuilder java = new StringBuilder();

        java.append("public class HelloWorld {\n\n");
        java.append("    public static void main(String[ ] args) {\n");
        java.append("        System.out.println(\"Hello World!\");\n");
        java.append("    }\n\n");
        java.append("}\n");

        return java.toString();
    }

    private String getXmlExample() {
        final StringBuilder xml = new StringBuilder();

        xml.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\n");
        xml.append("<root>\n");
        xml.append("    <title>Hello World!</title>\n");
        xml.append("</root>\n");

        return xml.toString();
    }

    private String getHtmlExample() {
        final StringBuilder html = new StringBuilder();
        html.append("<!DOCTYPE html>\n");
        html.append("\n");
        html.append("<h:head />\n");
        html.append("\n");
        html.append("   <form>\n");
        html.append("      Hello World!\n");
        html.append("   </form>\n");
        html.append("\n");
        html.append("");

        return html.toString();
    }

    public PrettyPrintType getPrettyPrintType() {
        return prettyPrintType;
    }

    public void setPrettyPrintType(PrettyPrintType prettyPrintType) {
        this.prettyPrintType = prettyPrintType;
    }
}


text:
<!DOCTYPE html>

<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link href="/releases/4.2.0/css/style.css" rel="stylesheet" />

<title>-contract</title>
<meta name="generator" content="Jekyll v3.7.4" />
<meta property="og:title" content="-contract" />
<meta property="og:locale" content="en_US" />
<meta name="description" content="Though the OSGi has a very elegant package version model there are still many that think this is too much work. They do not want to be bothered by the niceties of semantic versions and just want to use, let's say, Servlet 3.0. For those people (seemingly not interested in minimizing dependencies) the OSGi Alliance came up with contracts in OSGi Core, Release 5.0.0. A contract allows you to:" />
<meta property="og:description" content="Though the OSGi has a very elegant package version model there are still many that think this is too much work. They do not want to be bothered by the niceties of semantic versions and just want to use, let's say, Servlet 3.0. For those people (seemingly not interested in minimizing dependencies) the OSGi Alliance came up with contracts in OSGi Core, Release 5.0.0. A contract allows you to:" />
<meta property="og:type" content="article" />
<meta property="article:published_time" content="2019-10-12T19:48:23-04:00" />

			Intro
			Headers
			Instructions
			Macros
			Commands

<button class="dropbtn">4.2.0</button>

Introduction

How to install bnd

Guided Tour

Guided Tour Workspace & Projects

Concepts

Best practices

Build

Generating JARs

Versioning

Baselining

Service Components

Metatype

Contracts

Manifest Annotations

Resolving Dependencies

Launching

Plain JUnit Testing with OSGi (PRELIMENARY)

Testing

Packaging Applications

Wrapping Libraries to OSGi Bundles

Commands

For Developers

Tools bound to bnd

Headers

Instruction Reference

Instruction Index

Macro Reference

Macro Index

Plugins

Settings

Errors

Warnings

Frequently Asked Questions

 -contract

Though the OSGi has a very elegant package version model there are still many that think this is too much work. They do not want to be bothered by the niceties of semantic versions and just want to use, let's say, Servlet 3.0. For those people (seemingly not interested in minimizing dependencies) the OSGi Alliance came up with contracts in OSGi Core, Release 5.0.0. A contract allows you to:

Declare that a bundle provides the API of the given specification

Require that the API comes from a bundle that made the declaration

This very common pattern is called the Capability/Requirement (C/R) model in OSGi, it underlies all of its dependency concepts like Import/Export package and others; it forms the foundation of the OSGi Bundle Repository. If you ever want to know what is happening deep down inside a framework than look at the Wiring API and you see the requirements and capabilities in their most fundamental form.

Capabilities declare a set of properties that describe something that a bundle can provide. A Requirement in a bundle has a filter that must match a capability before this bundle can be resolved. To prevent requirements matching completely unrelated capabilities they must both be defined in the same namespace, where the namespace then defines the semantics of the properties. Using the C/R model we were able to describe most of the OSGi dependencies with surprisingly few additional concepts. For a modern OSGi resolver there is very little difference between the Import-Package and Require-Bundle headers.

So how do those contracts work? Well, the bundle that provides the API for the contract has a contract capability. What this means is that it provides a Provide-Capability clause in the osgi.contract namespace, for example:

# Bundle P:
Provide-Capability:\
  osgi.contract;\
    osgi.contract=Servlet;\
    uses:="javax.servlet,javax.servlet.http";\
    version="3.0"
Export-Package: javax.servlet, javax.servlet.http

This contract defines two properties, the contract name (by convention this is the namespace name as property key) and the version. A bundle that wants to rely on this API can add the following requirement to its manifest:

# Bundle R:
Require-Capability:\
  osgi.contract;\
    filter:="(&(osgi.contract=Servlet)(version=3.0))"
Import-Package: javax.servlet, javax.servlet.http

Experienced OSGi users should have cringed at these versionless packages, cringing becomes a gut-reaction at the sight of versionless packages. However, in this case it actually cannot harm. The previous example will ensure that Bundle P will be the class loader for the Bundle R for packages javax.servlet, javax.servlet.http. The magic is in the uses: directive, if the Require-Capability in bundle R is resolved to the Provide-Capability in bundle P then bundle R must import these packages from bundle P.

Obviously bnd has support for this (well, since today, i.e. version osgi:biz.aQute.bndlib@2.2.0.20130806-071947 or later). First bnd can make it easier to create the Provide-Capability header since the involved packages are in the Export-Package as well as in the Provide-Capability headers. The do-no-repeat-yourself mantra dictated am ${exports} macro. The ${exports} macro is replaced by the exported packages of the bundle, for example:

# Bundle P:
Provide-Capability:\
  osgi.contract;\
    osgi.contract=Servlet;\
    uses:="${exports}";\
    version="3.0"
Export-Package: javax.servlet, javax.servlet.http

That said, the most extensive help you get from bnd is for requiring contracts. Providing a contract is not so cumbersome, after all you're the provider so you have all the knowledge and the interest in providing metadata. Consuming a contract is less interesting and it is much harder to get the metadata right. In a similar vein, bnd analyzes your classes to find out the dependencies to create the Import-Package statement, doing this by hand is really hard (as other OSGi developing environments can testify!)

So to activate the use of contracts, add the -contract instruction:

# bnd.bnd:
-contract: *

This instruction will give bnd permission to scan the build path for contracts, i.e. Provide-Capability clauses in the osgi.contract namespace. These declared contracts cause a corresponding requirement in the bundle when the bundle imports packages listed in the uses clause. In the example with Bundle R, bnd will automatically insert the Require-Capability header and remove any versions on the imported packages.

Sometimes the wildcard for the -contract instruction can be used to limit the contracts that are considered. Sometimes you want a specific contract but not others. Other times you want to skip a specific contract. The following example skips the 'Servlet' contract:

bnd.bnd:\
  -contract: !Servlet,*

Note: As of bnd 4.1.0 the default value for the -contract instruction will be * which result in the automatic application of any contracts found at build time.

The tests provide some examples for people that want to have a deeper understanding: https://github.com/bndtools/bnd/blob/next/biz.aQute.bndlib.tests/src/test/ContractTest.java

Further Reading

See also Portable Contract Definitions

GitHub


text:
package ru.job4j.tictactoe;

import javafx.scene.shape.Rectangle;
/**
 * Класс отвечает за клетку на поле.
 * Он содержит методы - имеет ли клетка крестик, нолик или она пустая.
 */
public class Figure3T extends Rectangle {
    private boolean markX = false;
    private boolean markO = false;

    public Figure3T() {
    }

    public Figure3T(boolean markX, boolean markO) {
        this.markX = markX;
        this.markO = markO;
    }

    public void take(boolean markX) {
        this.markX = markX;
        this.markO = !markX;
    }

    public boolean hasMarkX() {
        return this.markX;
    }

    public boolean hasMarkO() {
        return this.markO;
    }
}


text:
<resources>
    <string name="app_name">Fragment基本使用</string>
</resources>


text:
using Acuerdo.External.Uploader;
using Dulcet.ThirdParty;
using Dulcet.Twitter.Credential;

namespace Casket.Uploaders
{
    public class TwitPic : IUploader
    {
        private static string _appkey = "f4e98ee376dc3e692342b6add361608d";

        public string UploadImage(OAuth credential, string path, string comment)
        {
            string url;
            if (!credential.UploadToTwitpic(_appkey, comment, path, out url))
            {
                return null;
            }
            else
            {
                return url;
            }
        }

        public string ServiceName
        {
            get { return "TwitPic"; }
        }

        public bool IsResolvable(string url)
        {
            return url.StartsWith("http://twitpic.com/");
        }

        public string Resolve(string url)
        {
            if (IsResolvable(url))
            {
                return "http://twitpic.com/show/full/" + url.Substring(19);
            }
            else
            {
                return null;
            }
        }
    }
}


text:
#include <aws/glacier/model/InvalidParameterValueException.h>
#include <aws/core/utils/json/JsonSerializer.h>

#include <utility>

using namespace Aws::Utils::Json;
using namespace Aws::Utils;

namespace Aws
{
namespace Glacier
{
namespace Model
{

InvalidParameterValueException::InvalidParameterValueException() :
    m_typeHasBeenSet(false),
    m_codeHasBeenSet(false),
    m_messageHasBeenSet(false)
{
}

InvalidParameterValueException::InvalidParameterValueException(JsonView jsonValue) :
    m_typeHasBeenSet(false),
    m_codeHasBeenSet(false),
    m_messageHasBeenSet(false)
{
  *this = jsonValue;
}

InvalidParameterValueException& InvalidParameterValueException::operator =(JsonView jsonValue)
{
  if(jsonValue.ValueExists("type"))
  {
    m_type = jsonValue.GetString("type");

    m_typeHasBeenSet = true;
  }

  if(jsonValue.ValueExists("code"))
  {
    m_code = jsonValue.GetString("code");

    m_codeHasBeenSet = true;
  }

  if(jsonValue.ValueExists("message"))
  {
    m_message = jsonValue.GetString("message");

    m_messageHasBeenSet = true;
  }

  return *this;
}

JsonValue InvalidParameterValueException::Jsonize() const
{
  JsonValue payload;

  if(m_typeHasBeenSet)
  {
   payload.WithString("type", m_type);

  }

  if(m_codeHasBeenSet)
  {
   payload.WithString("code", m_code);

  }

  if(m_messageHasBeenSet)
  {
   payload.WithString("message", m_message);

  }

  return payload;
}

} // namespace Model
} // namespace Glacier
} // namespace Aws


text:
package com.lordrhys.mod.lib;

import com.lordrhys.mod.LordRhysModMain;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;

public class OreRegistry
{

	public static void RegisterOres()
	{
		OreDictionary.registerOre("oreVoid", LordRhysModMain.oreVoid);
		OreDictionary.registerOre("oreCopper", LordRhysModMain.oreCopper);
		OreDictionary.registerOre("oreNickel", LordRhysModMain.oreNickel);
		OreDictionary.registerOre("oreTin", LordRhysModMain.oreTin);
		OreDictionary.registerOre("oreEnergy", LordRhysModMain.lightStone);
		OreDictionary.registerOre("oreLight", LordRhysModMain.lightDirt);
		OreDictionary.registerOre("ingotBronze", LordRhysModMain.ingotBronze);
		OreDictionary.registerOre("ingotCopper", LordRhysModMain.ingotCopper);
		OreDictionary.registerOre("ingotNickel", LordRhysModMain.ingotNickel);
		OreDictionary.registerOre("ingotSteel", LordRhysModMain.ingotSteel);
		OreDictionary.registerOre("ingotTin", LordRhysModMain.ingotTin);
		OreDictionary.registerOre("ingotVoid", LordRhysModMain.ingotVoid);
		OreDictionary.registerOre("ingotStone", LordRhysModMain.cobblestoneNugget);

	}
}


text: sda"kpaskoasdodskosdkmmds/l kmsslk maslks/kml  kdslkmdsckmdsmk/lmkdsz/kkdsklds mk, msdzlk dslkm ksdkm mds km dckmds kmdskds km sdm s


text:
/**
 * The Fires layer module.
 *
 * @return FiresLayer class (extends CartoDBLayerClass)
 */
define([
  'underscore',
  'moment',
  'uri',
  'abstract/layer/CartoDBLayerClass',
  'map/presenters/layers/FiresLayerPresenter',
  'text!map/cartocss/global_7d.cartocss'
], function(_, moment, UriTemplate, CartoDBLayerClass, Presenter, global7dCartoCSS) {

  'use strict';

  var FiresLayer = CartoDBLayerClass.extend({
    options: {
      sql: 'SELECT the_geom_webmercator, acq_time,  COALESCE(to_char(acq_date, \'DD Mon, YYYY\')) as acq_date, confidence, brightness, longitude, latitude FROM global_7d WHERE acq_date > \'{year}-{month}-{day}\' AND CAST(confidence AS INT) > 30',
      cartocss: global7dCartoCSS,
      interactivity: 'acq_time, acq_date, confidence, brightness, longitude, latitude',
      infowindow: true
    },

    init: function(layer, options, map) {
      _.bindAll(this, 'setCurrentDate');
      this.presenter = new Presenter(this);

      // Default to 48 hours
      this.setCurrentDate(options.currentDate ||
        [moment().subtract(48, 'hours'), moment().subtract(24, 'hours')]);

      this._super(layer, options, map);
    },

    getQuery: function() {
      var query = new UriTemplate(this.options.sql).fillFromObject({
        tableName: this.layer.table_name,
        year: moment(this.currentDate[0]).year(),
        month: moment(this.currentDate[0]).format('MM'),
        day: moment(this.currentDate[0]).format('DD')
      });

      return query;
    },

    /**
     * Used by FiresLayerPresenter to set the dates for the tile.
     *
     * @param {Array} date 2D array of moment dates [begin, end]
     */
    setCurrentDate: function(date) {
      this.currentDate = date;
    }
  });

  return FiresLayer;
});


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

<title>TestImageRecordReader</title>
<meta name="date" content="2016-06-19">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

org.canova.image.recordreader

Class TestImageRecordReader

java.lang.Object

org.canova.image.recordreader.TestImageRecordReader

public class TestImageRecordReader
extends java.lang.Object

Constructor Summary

Constructors

Constructor and Description

TestImageRecordReader()

Method Summary

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

TestImageRecordReader

public TestImageRecordReader()

Overview

Package

Class

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method


text:
The [Staking Launchpad](https://github.com/ethereum/eth2.0-deposit) is a website
from the Ethereum Foundation which guides users how to use the
[`eth2.0-deposit-cli`](https://github.com/ethereum/eth2.0-deposit-cli)
command-line program to generate consensus validator keys.

The keys that are generated from `eth2.0-deposit-cli` can be easily loaded into
a Lighthouse validator client (`lighthouse vc`). In fact, both of these
programs are designed to work with each other.

This guide will show the user how to import their keys into Lighthouse so they
can perform their duties as a validator. The guide assumes the user has already
[installed Lighthouse](./installation.md).

## Instructions

Whilst following the steps on the website, users are instructed to download the
[`eth2.0-deposit-cli`](https://github.com/ethereum/eth2.0-deposit-cli)
repository. This `eth2-deposit-cli` script will generate the validator BLS keys
into a `validator_keys` directory. We assume that the user's
present-working-directory is the `eth2-deposit-cli` repository (this is where
you will be if you just ran the `./deposit.sh` script from the Staking Launch pad
website). If this is not the case, simply change the `--directory` to point to
the `validator_keys` directory.

Now, assuming that the user is in the `eth2-deposit-cli` directory and they're
using the default (`~/.lighthouse/{network}/validators`) `validators` directory (specify a different one using
`--validators-dir` flag), they can follow these steps:

### 1. Run the `lighthouse account validator import` command.

Docker users should use the command from the [Docker](#docker)
section, all other users can use:

```bash
lighthouse --network mainnet account validator import --directory validator_keys
```

Note: The user must specify the consensus client network that they are importing the keys for using the `--network` flag.

After which they will be prompted for a password for each keystore discovered:

```
Keystore found at "validator_keys/keystore-m_12381_3600_0_0_0-1595406747.json":

 - Public key: 0xa5e8702533f6d66422e042a0bf3471ab9b302ce115633fa6fdc5643f804b6b4f1c33baf95f125ec21969a3b1e0dd9e56
 - UUID: 8ea4cf99-8719-43c5-9eda-e97b8a4e074f

If you enter a password it will be stored in validator_definitions.yml so that it is not required each time the validator client starts.

Enter a password, or press enter to omit a password:
```

The user can choose whether or not they'd like to store the validator password
in the [`validator_definitions.yml`](./validator-management.md) file. If the
password is *not* stored here, the validator client (`lighthouse vc`)
application will ask for the password each time it starts. This might be nice
for some users from a security perspective (i.e., if it is a shared computer),
however it means that if the validator client restarts, the user will be liable
to off-line penalties until they can enter the password. If the user trusts the
computer that is running the validator client and they are seeking maximum
validator rewards, we recommend entering a password at this point.

Once the process is done the user will see:

```
Successfully imported keystore.
Successfully updated validator_definitions.yml.

Successfully imported 1 validators (0 skipped).

WARNING: DO NOT USE THE ORIGINAL KEYSTORES TO VALIDATE WITH ANOTHER CLIENT, OR YOU WILL GET SLASHED..
```

The import process is complete!

### 2. Run the `lighthouse vc` command.

Now the keys are imported the user can start performing their validator duties
by running `lighthouse vc` and checking that their validator public key appears
as a `voting_pubkey` in one of the following logs:

```
INFO Enabled validator       voting_pubkey: 0xa5e8702533f6d66422e042a0bf3471ab9b302ce115633fa6fdc5643f804b6b4f1c33baf95f125ec21969a3b1e0dd9e56
```

Once this log appears (and there are no errors) the `lighthouse vc` application
will ensure that the validator starts performing its duties and being rewarded
by the protocol. There is no more input required from the user.

## Docker

The `import` command is a little more complex for Docker users, but the example
in this document can be substituted with:

```bash
docker run -it \
	-v $HOME/.lighthouse:/root/.lighthouse \
	-v $(pwd)/validator_keys:/root/validator_keys \
	sigp/lighthouse \
	lighthouse --network MY_NETWORK account validator import --directory /root/validator_keys
```

Here we use two `-v` volumes to attach:

- `~/.lighthouse` on the host to `/root/.lighthouse` in the Docker container.
- The `validator_keys` directory in the present working directory of the host
	to the `/root/validator_keys` directory of the Docker container.


text:
import numpy as np
import pytest
import scipy.sparse as sp
from scipy.special import comb
from numpy.testing import assert_array_almost_equal

from sklearn.utils.random import _random_choice_csc, sample_without_replacement
from sklearn.utils._random import _our_rand_r_py

###############################################################################
# test custom sampling without replacement algorithm
###############################################################################
def test_invalid_sample_without_replacement_algorithm():
    with pytest.raises(ValueError):
        sample_without_replacement(5, 4, "unknown")

def test_sample_without_replacement_algorithms():
    methods = ("auto", "tracking_selection", "reservoir_sampling", "pool")

    for m in methods:

        def sample_without_replacement_method(
            n_population, n_samples, random_state=None
        ):
            return sample_without_replacement(
                n_population, n_samples, method=m, random_state=random_state
            )

        check_edge_case_of_sample_int(sample_without_replacement_method)
        check_sample_int(sample_without_replacement_method)
        check_sample_int_distribution(sample_without_replacement_method)

def check_edge_case_of_sample_int(sample_without_replacement):

    # n_population < n_sample
    with pytest.raises(ValueError):
        sample_without_replacement(0, 1)
    with pytest.raises(ValueError):
        sample_without_replacement(1, 2)

    # n_population == n_samples
    assert sample_without_replacement(0, 0).shape == (0,)

    assert sample_without_replacement(1, 1).shape == (1,)

    # n_population >= n_samples
    assert sample_without_replacement(5, 0).shape == (0,)
    assert sample_without_replacement(5, 1).shape == (1,)

    # n_population < 0 or n_samples < 0
    with pytest.raises(ValueError):
        sample_without_replacement(-1, 5)
    with pytest.raises(ValueError):
        sample_without_replacement(5, -1)

def check_sample_int(sample_without_replacement):
    # This test is heavily inspired from test_random.py of python-core.
    #
    # For the entire allowable range of 0 <= k <= N, validate that
    # the sample is of the correct length and contains only unique items
    n_population = 100

    for n_samples in range(n_population + 1):
        s = sample_without_replacement(n_population, n_samples)
        assert len(s) == n_samples
        unique = np.unique(s)
        assert np.size(unique) == n_samples
        assert np.all(unique < n_population)

    # test edge case n_population == n_samples == 0
    assert np.size(sample_without_replacement(0, 0)) == 0

def check_sample_int_distribution(sample_without_replacement):
    # This test is heavily inspired from test_random.py of python-core.
    #
    # For the entire allowable range of 0 <= k <= N, validate that
    # sample generates all possible permutations
    n_population = 10

    # a large number of trials prevents false negatives without slowing normal
    # case
    n_trials = 10000

    for n_samples in range(n_population):
        # Counting the number of combinations is not as good as counting the
        # the number of permutations. However, it works with sampling algorithm
        # that does not provide a random permutation of the subset of integer.
        n_expected = comb(n_population, n_samples, exact=True)

        output = {}
        for i in range(n_trials):
            output[
                frozenset(sample_without_replacement(n_population, n_samples))
            ] = None

            if len(output) == n_expected:
                break
        else:
            raise AssertionError(
                "number of combinations != number of expected (%s != %s)"
                % (len(output), n_expected)
            )

def test_random_choice_csc(n_samples=10000, random_state=24):
    # Explicit class probabilities
    classes = [np.array([0, 1]), np.array([0, 1, 2])]
    class_probabilities = [np.array([0.5, 0.5]), np.array([0.6, 0.1, 0.3])]

    got = _random_choice_csc(n_samples, classes, class_probabilities, random_state)
    assert sp.issparse(got)

    for k in range(len(classes)):
        p = np.bincount(got.getcol(k).toarray().ravel()) / float(n_samples)
        assert_array_almost_equal(class_probabilities[k], p, decimal=1)

    # Implicit class probabilities
    classes = [[0, 1], [1, 2]]  # test for array-like support
    class_probabilities = [np.array([0.5, 0.5]), np.array([0, 1 / 2, 1 / 2])]

    got = _random_choice_csc(
        n_samples=n_samples, classes=classes, random_state=random_state
    )
    assert sp.issparse(got)

    for k in range(len(classes)):
        p = np.bincount(got.getcol(k).toarray().ravel()) / float(n_samples)
        assert_array_almost_equal(class_probabilities[k], p, decimal=1)

    # Edge case probabilities 1.0 and 0.0
    classes = [np.array([0, 1]), np.array([0, 1, 2])]
    class_probabilities = [np.array([0.0, 1.0]), np.array([0.0, 1.0, 0.0])]

    got = _random_choice_csc(n_samples, classes, class_probabilities, random_state)
    assert sp.issparse(got)

    for k in range(len(classes)):
        p = (
            np.bincount(
                got.getcol(k).toarray().ravel(), minlength=len(class_probabilities[k])
            )
            / n_samples
        )
        assert_array_almost_equal(class_probabilities[k], p, decimal=1)

    # One class target data
    classes = [[1], [0]]  # test for array-like support
    class_probabilities = [np.array([0.0, 1.0]), np.array([1.0])]

    got = _random_choice_csc(
        n_samples=n_samples, classes=classes, random_state=random_state
    )
    assert sp.issparse(got)

    for k in range(len(classes)):
        p = np.bincount(got.getcol(k).toarray().ravel()) / n_samples
        assert_array_almost_equal(class_probabilities[k], p, decimal=1)

def test_random_choice_csc_errors():
    # the length of an array in classes and class_probabilities is mismatched
    classes = [np.array([0, 1]), np.array([0, 1, 2, 3])]
    class_probabilities = [np.array([0.5, 0.5]), np.array([0.6, 0.1, 0.3])]
    with pytest.raises(ValueError):
        _random_choice_csc(4, classes, class_probabilities, 1)

    # the class dtype is not supported
    classes = [np.array(["a", "1"]), np.array(["z", "1", "2"])]
    class_probabilities = [np.array([0.5, 0.5]), np.array([0.6, 0.1, 0.3])]
    with pytest.raises(ValueError):
        _random_choice_csc(4, classes, class_probabilities, 1)

    # the class dtype is not supported
    classes = [np.array([4.2, 0.1]), np.array([0.1, 0.2, 9.4])]
    class_probabilities = [np.array([0.5, 0.5]), np.array([0.6, 0.1, 0.3])]
    with pytest.raises(ValueError):
        _random_choice_csc(4, classes, class_probabilities, 1)

    # Given probabilities don't sum to 1
    classes = [np.array([0, 1]), np.array([0, 1, 2])]
    class_probabilities = [np.array([0.5, 0.6]), np.array([0.6, 0.1, 0.3])]
    with pytest.raises(ValueError):
        _random_choice_csc(4, classes, class_probabilities, 1)

def test_our_rand_r():
    assert 131541053 == _our_rand_r_py(1273642419)
    assert 270369 == _our_rand_r_py(0)


text:
from django.conf.urls import patterns, include, url
from django.contrib import admin

from fle_redesign.apps.radpress import urls as radpress_urls

admin.autodiscover()

urlpatterns = patterns('fle_redesign.apps.main.views',
    url(r'^$', 'home', name='home'),
    url(r'^map/$', 'map', name='map'),
)

urlpatterns += patterns('',
	url(r'^blog/', include(radpress_urls)),
    url(r'^admin/', include(admin.site.urls)),
)


text:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;

namespace Stratus
{
	public abstract class StratusSingleton<T> : IStratusLogger
		where T : class
	{
		/// <summary>
		/// Returns a reference to the singular instance of this class. If not available currently,
		/// it will instantiate it when accessed.
		/// </summary>
		public static T instance
		{
			get
			{
				// If not found, instantiate
				if (_instance == null)
				{
					if (shouldInstantiate == false)
					{
						StratusDebug.LogWarning($"Will not automatically instantiate singleton of type {typeof(T).Name}...");
						return null;
					}

					if (isPlayerOnly && StratusEditorBridge.isEditMode)
					{
						StratusDebug.LogWarning($"Will not instantiate singleton of type {typeof(T).Name} outside of playmode");
						return null;
					}

					_instance = (T)Activator.CreateInstance(typeof(T)); //  new T();

				}

				return _instance;
			}
		}
		/// <summary>
		/// Whether this singleton has been instantiated
		/// </summary>
		public static bool instantiated => instance != null;

		/// <summary>
		/// Whether the class should be instantiated. By default, true.
		/// </summary>
		private static bool shouldInstantiate => attribute?.GetProperty<bool>(nameof(StratusSingletonAttribute.instantiate)) ?? true;
		/// <summary>
		/// Whether the class should be instantiated while in editor mode
		/// </summary>
		private static bool isPlayerOnly => attribute?.GetProperty<bool>(nameof(StratusSingletonAttribute.isPlayerOnly)) ?? true;

		/// <summary>
		/// Returns the current specific attributes for the derived singleton class, if any are present
		/// </summary>
		private static StratusSingletonAttribute attribute => typeof(T).GetAttribute<StratusSingletonAttribute>();

		/// <summary>
		/// Whether this singleton has been initialized
		/// </summary>
		public bool initialized { get; private set; }

		//------------------------------------------------------------------------/
		// Fields
		//------------------------------------------------------------------------/
		/// <summary>
		/// The singular instance of the class
		/// </summary>
		protected static T _instance;

		//------------------------------------------------------------------------/
		// Methods
		//------------------------------------------------------------------------/
		protected StratusSingleton()
		{
			Initialize();
		}

		public void Initialize()
		{
			if (initialized)
			{
				return;
			}
			OnInitialize();
			initialized = true;
		}

		protected abstract void OnInitialize();
	}

}


text:
set -e

. /opt/kolla/kolla-common.sh

: ${ADMIN_TENANT_NAME:=admin}
: ${HEAT_DB_NAME:=heat}
: ${HEAT_DB_USER:=heat}
: ${HEAT_KEYSTONE_USER:=heat}
: ${KEYSTONE_AUTH_PROTOCOL:=http}
: ${PUBLIC_IP:=$HEAT_API_PORT_8004_TCP_ADDR}
: ${RABBIT_USER:=guest}
: ${RABBIT_PASSWORD:=guest}

check_required_vars HEAT_DB_PASSWORD HEAT_KEYSTONE_PASSWORD \
                    KEYSTONE_PUBLIC_SERVICE_HOST RABBITMQ_SERVICE_HOST

check_for_db
dump_vars

cat > /openrc <<EOF
export OS_AUTH_URL="http://${KEYSTONE_PUBLIC_SERVICE_HOST}:5000/v2.0"
export OS_USERNAME="${HEAT_KEYSTONE_USER}"
export OS_PASSWORD="${HEAT_KEYSTONE_PASSWORD}"
export OS_TENANT_NAME="${ADMIN_TENANT_NAME}"
EOF

crudini --set /etc/heat/heat.conf DEFAULT log_file \
    ""
crudini --set /etc/heat/heat.conf DEFAULT use_stderr \
    true
crudini --set /etc/heat/heat.conf DEFAULT rpc_backend \
    heat.openstack.common.rpc.impl_kombu
crudini --set /etc/heat/heat.conf DEFAULT rabbit_host \
    ${RABBITMQ_SERVICE_HOST}
crudini --set /etc/heat/heat.conf DEFAULT rabbit_userid \
    ${RABBIT_USER}
crudini --set /etc/heat/heat.conf DEFAULT rabbit_password \
    ${RABBIT_PASSWORD}

crudini --set /etc/heat/heat.conf database connection \
    mysql://${HEAT_DB_USER}:${HEAT_DB_PASSWORD}@${MARIADB_SERVICE_HOST}/${HEAT_DB_NAME}

crudini --set /etc/heat/heat.conf keystone_authtoken auth_protocol \
    "${KEYSTONE_AUTH_PROTOCOL}"
crudini --set /etc/heat/heat.conf keystone_authtoken auth_host \
    "${KEYSTONE_PUBLIC_SERVICE_HOST}"
crudini --set /etc/heat/heat.conf keystone_authtoken auth_port \
    5000
crudini --set /etc/heat/heat.conf keystone_authtoken auth_uri \
    "${KEYSTONE_AUTH_PROTOCOL}://${KEYSTONE_PUBLIC_SERVICE_HOST}:5000/v2.0"
crudini --set /etc/heat/heat.conf  keystone_authtoken admin_tenant_name \
    "${ADMIN_TENANT_NAME}"
crudini --set /etc/heat/heat.conf keystone_authtoken admin_user \
    "${HEAT_KEYSTONE_USER}"
crudini --set /etc/heat/heat.conf keystone_authtoken admin_password \
    "${HEAT_KEYSTONE_PASSWORD}"

crudini --set /etc/heat/heat.conf ec2authtoken auth_uri \
    "${KEYSTONE_AUTH_PROTOCOL}://${KEYSTONE_PUBLIC_SERVICE_HOST}:5000/v2.0"

# cfn
#crudini --set /etc/heat/heat.conf DEFAULT heat_metadata_server_url \
#    http://${HEAT_CFN_API_SERVICE_HOST}:8000
#crudini --set /etc/heat/heat.conf DEFAULT heat_waitcondition_server_url \
#    http://${HEAT_CFN_API_SERVICE_HOST}:8000/v1/waitcondition


text:
/* Generated by camel build tools - do NOT edit this file! */
package org.apache.camel.component.springrabbit;

import java.net.URISyntaxException;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

import org.apache.camel.spi.EndpointUriFactory;

/**
 * Generated by camel build tools - do NOT edit this file!
 */
public class SpringRabbitMQEndpointUriFactory extends org.apache.camel.support.component.EndpointUriFactorySupport implements EndpointUriFactory {

    private static final String BASE = ":exchangeName";

    private static final Set<String> PROPERTY_NAMES;
    private static final Set<String> SECRET_PROPERTY_NAMES;
    static {
        Set<String> props = new HashSet<>(35);
        props.add("asyncConsumer");
        props.add("prefetchCount");
        props.add("synchronous");
        props.add("maximumRetryAttempts");
        props.add("messageConverter");
        props.add("exchangeType");
        props.add("rejectAndDontRequeue");
        props.add("autoStartup");
        props.add("noLocal");
        props.add("retryDelay");
        props.add("bridgeErrorHandler");
        props.add("deadLetterRoutingKey");
        props.add("messagePropertiesConverter");
        props.add("exclusive");
        props.add("retry");
        props.add("disableReplyTo");
        props.add("maxConcurrentConsumers");
        props.add("deadLetterExchange");
        props.add("exchangePattern");
        props.add("deadLetterExchangeType");
        props.add("concurrentConsumers");
        props.add("messageListenerContainerType");
        props.add("args");
        props.add("lazyStartProducer");
        props.add("deadLetterQueue");
        props.add("connectionFactory");
        props.add("testConnectionOnStartup");
        props.add("acknowledgeMode");
        props.add("queues");
        props.add("exchangeName");
        props.add("replyTimeout");
        props.add("usePublisherConnection");
        props.add("exceptionHandler");
        props.add("routingKey");
        props.add("autoDeclare");
        PROPERTY_NAMES = Collections.unmodifiableSet(props);
        SECRET_PROPERTY_NAMES = Collections.emptySet();
    }

    @Override
    public boolean isEnabled(String scheme) {
        return "spring-rabbitmq".equals(scheme);
    }

    @Override
    public String buildUri(String scheme, Map<String, Object> properties, boolean encode) throws URISyntaxException {
        String syntax = scheme + BASE;
        String uri = syntax;

        Map<String, Object> copy = new HashMap<>(properties);

        uri = buildPathParameter(syntax, uri, "exchangeName", null, true, copy);
        uri = buildQueryParameters(uri, copy, encode);
        return uri;
    }

    @Override
    public Set<String> propertyNames() {
        return PROPERTY_NAMES;
    }

    @Override
    public Set<String> secretPropertyNames() {
        return SECRET_PROPERTY_NAMES;
    }

    @Override
    public boolean isLenientProperties() {
        return false;
    }
}