text:
<!DOCTYPE html>

    <title>Light Blue - Admin Template</title>
    <link href="css/application.min.css" rel="stylesheet">
    <link rel="shortcut icon" href="img/favicon.png">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">
    <meta charset="utf-8">

Light Blue

             Dashboard

             Forms

Account

Article

Elements

Validation

Wizard

             Statistics

Stats

Charts

Realtime

             User Interface

Buttons

Dialogs

Icons

Tabs

Accordion

             Components

Calendar

Maps

Gallery

Fileupload

Bootstrap   new

List Groups   new

             Tables

Static

Dynamic

             Grid

Basic

Live   new

             Special

Search

Invoice

Inbox 3

Login

404

Landing

White

             Menu Levels

Item 1.1

Item 1.2

                    Item 1.3

Item 2.1

Item 2.2

                            Item 2.3

Item 3.1

Item 3.2

Item 3.3

             Sign Out

        <button type="button"
                data-value="icons"
                class="btn-icons btn btn-transparent btn-sm">Icons</button>
        <button type="button"
                data-value="auto"
                class="btn-auto btn btn-transparent btn-sm">Auto</button>

Jane Hew

                                            Hey, John! How is it going? ...

Alies Rumiancaŭ

                                            I'll definitely buy this template

Michał Rumiancaŭ

                                            Is it really Lore ipsum? Lore ...

                                    See all messages

                            8

                                        Check out this awesome ticket

                                        "What is the best way to get ...

                                        This is just a simple notification

                                        12 new orders has arrived today

                                        One more thing that just happened

                                    See all tickets

                                Philip Daineka

                                    Profile

                                    Calendar

                                    Inbox

                <form id="search-form" class="navbar-form pull-right" role="search">
                    <input type="search" class="search-query" placeholder="Search...">
                </form>

Live Grid Draggable widgets. Touch screen support

                            News 17

First Human Colony on Mars

                                        First 700 people will take part in building first human settlement outside of Earth.
                                        That's awesome, right?

Mar 20, 18:46

Light Blue reached $300

                                        Light Blue Inc. shares just hit $300 price. "This was inevitable. It should
                                        have happen sooner or later" - says NYSE expert.

Sep 25, 11:59

No more spying

                                        Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor
                                        incididunt ut labore et dolore magna aliqua.

Mar 20, 18:46

Loader

                            Shares

Maikel Basso

                                about 2 mins ago

Ianus Arendse

                                about 42 mins ago

Valdemar Landau

                                one hour ago

Rick Teagan

                                3 hours ago

Draggable story!

                                Build your own
                                interfaces! Sit back and relax.

                                    Check it out!


text:
#ifndef __rtkIncrementalFourDConjugateGradientConeBeamReconstructionFilter_h
#define __rtkIncrementalFourDConjugateGradientConeBeamReconstructionFilter_h

#include "rtkPhasesToInterpolationWeights.h"
#include "rtkFourDConjugateGradientConeBeamReconstructionFilter.h"
#include "rtkSubSelectFromListImageFilter.h"

#include <itkTimeProbe.h>

namespace rtk
{

  /** \class IncrementalFourDConjugateGradientConeBeamReconstructionFilter
   * \brief Implements incremental 4D reconstruction by conjugate gradient
   *
   * 4D conjugate gradient reconstruction consists in iteratively
   * minimizing the following cost function:
   *
   * \f[ \sum\limits_{\alpha} \| R_\alpha S_\alpha x - p_\alpha \|_2^2 \f]
   *
   * with
   * - \f$ x \f$ a 4D series of 3D volumes, each one being the reconstruction
   * at a given respiratory/cardiac phase
   * - \f$ p_{\alpha} \f$ is the projection measured at angle \f$ \alpha \f$
   * - \f$ S_{\alpha} \f$ an interpolation operator which, from the 3D + time sequence f,
   * estimates the 3D volume through which projection \f$ p_{\alpha} \f$ has been acquired
   * - \f$ R_{\alpha} \f$ is the X-ray transform (the forward projection operator) for angle \f$ \alpha \f$
   * - \f$ D \f$ the displaced detector weighting matrix
   *
   * This filter splits the cost function into smaller terms, each one
   * representing the attachment to a subset of the projections. They are minimized
   * in an alternating fashion.
   *
   * \dot
   * digraph IncrementalFourDConjugateGradientConeBeamReconstructionFilter {
   *
   * Input0 [ label="Input 0 (Input: 4D sequence of volumes)"];
   * Input0 [shape=Mdiamond];
   * Input1 [label="Input 1 (Projections)"];
   * Input1 [shape=Mdiamond];
   * Output [label="Output (Reconstruction: 4D sequence of volumes)"];
   * Output [shape=Mdiamond];
   *
   * node [shape=box];
   * AfterInput1 [label="", fixedsize="false", width=0, height=0, shape=none];
   * AfterCG [label="", fixedsize="false", width=0, height=0, shape=none];
   * BeforeCG [label="", fixedsize="false", width=0, height=0, shape=none];
   * BeforeCGVol [label="", fixedsize="false", width=0, height=0, shape=none];
   * BeforeCGWeights [label="", fixedsize="false", width=0, height=0, shape=none];
   * ConjugateGradient [ label="rtk::ConjugateGradientImageFilter" URL="\ref rtk::ConjugateGradientImageFilter"];
   * SubSelect1 [label="rtk::SubSelectFromListImageFilter" URL="\ref rtk::SubSelectFromListImageFilter"];
   * SubSelect2 [label="rtk::SubSelectFromListImageFilter" URL="\ref rtk::SubSelectFromListImageFilter"];
   * SubSelect3 [label="rtk::SubSelectFromListImageFilter" URL="\ref rtk::SubSelectFromListImageFilter"];
   * InterpWeights1 [label="rtk::PhasesToInterpolationWeights" URL="\ref rtk::PhasesToInterpolationWeights"];
   * InterpWeights2 [label="rtk::PhasesToInterpolationWeights" URL="\ref rtk::PhasesToInterpolationWeights"];
   * InterpWeights3 [label="rtk::PhasesToInterpolationWeights" URL="\ref rtk::PhasesToInterpolationWeights"];
   *
   * Input0 -> BeforeCGVol[arrowhead=none];
   * BeforeCGVol -> ConjugateGradient;
   * Input1 -> AfterInput1[arrowhead=none];
   * AfterInput1 -> SubSelect1;
   * AfterInput1 -> InterpWeights1;
   * AfterInput1 -> SubSelect2;
   * AfterInput1 -> InterpWeights2;
   * AfterInput1 -> SubSelect3;
   * AfterInput1 -> InterpWeights3;
   * SubSelect1 -> BeforeCG[arrowhead=none];
   * SubSelect2 -> BeforeCG[arrowhead=none];
   * SubSelect3 -> BeforeCG[arrowhead=none];
   * InterpWeights1 -> BeforeCGWeights[arrowhead=none];
   * InterpWeights2 -> BeforeCGWeights[arrowhead=none];
   * InterpWeights3 -> BeforeCGWeights[arrowhead=none];
   * BeforeCG -> ConjugateGradient;
   * BeforeCGWeights -> ConjugateGradient;
   * ConjugateGradient -> AfterCG;
   * AfterCG -> BeforeCGVol[style=dashed];
   * AfterCG -> Output;
   * }
   * \enddot
   *
   * \test rtkincrementalfourdconjugategradienttest.cxx
   *
   * \author Cyril Mory
   *
   * \ingroup ReconstructionAlgorithm
   */

template<typename VolumeSeriesType, typename ProjectionStackType>
class ITK_EXPORT IncrementalFourDConjugateGradientConeBeamReconstructionFilter :
  public rtk::IterativeConeBeamReconstructionFilter<VolumeSeriesType, ProjectionStackType>
{
public:
  /** Standard class typedefs. */
  typedef IncrementalFourDConjugateGradientConeBeamReconstructionFilter                   Self;
  typedef IterativeConeBeamReconstructionFilter<VolumeSeriesType, ProjectionStackType>     Superclass;
  typedef itk::SmartPointer<Self>                            Pointer;
  typedef itk::SmartPointer<const Self>                      ConstPointer;

  /** Some convenient typedefs. */
  typedef VolumeSeriesType      InputImageType;
  typedef VolumeSeriesType      OutputImageType;
  typedef ProjectionStackType   VolumeType;

  /** Typedefs of each subfilter of this composite filter */
  typedef rtk::SubSelectFromListImageFilter<ProjectionStackType>                                          SubSelectType;
  typedef rtk::FourDConjugateGradientConeBeamReconstructionFilter<VolumeSeriesType, ProjectionStackType>  CGType;

  /** Standard New method. */
  itkNewMacro(Self)

  /** Runtime information support. */
  itkTypeMacro(IncrementalFourDConjugateGradientConeBeamReconstructionFilter, IterativeConeBeamReconstructionFilter)

  /** Get / Set the object pointer to projection geometry */
  itkGetMacro(Geometry, ThreeDCircularProjectionGeometry::Pointer)
  itkSetMacro(Geometry, ThreeDCircularProjectionGeometry::Pointer)

  /** Get / Set the number of iterations */
  itkGetMacro(MainLoop_iterations, unsigned int)
  itkSetMacro(MainLoop_iterations, unsigned int)

  /** Get / Set the number of iterations */
  itkGetMacro(CG_iterations, unsigned int)
  itkSetMacro(CG_iterations, unsigned int)

  /** Set/Get the 4D image to be updated.*/
  void SetInputVolumeSeries(const VolumeSeriesType* VolumeSeries);
  typename VolumeSeriesType::ConstPointer GetInputVolumeSeries();

  /** Set/Get the stack of projections  */
  void SetInputProjectionStack(const VolumeType* Projection);
  typename VolumeType::ConstPointer GetInputProjectionStack();

  /** Pass the ForwardProjection filter to the conjugate gradient operator */
  void SetForwardProjectionFilter (int _arg);

  /** Pass the backprojection filter to the conjugate gradient operator and to the filter generating the B of AX=B */
  void SetBackProjectionFilter (int _arg);

  /** Set the name of the file containing the phase of each projection */
  itkSetStringMacro(PhasesFileName)

  /** Get / Set the number of projections per subset. Default is all (1 subset) */
  itkGetMacro(NumberOfProjectionsPerSubset, unsigned int)
  itkSetMacro(NumberOfProjectionsPerSubset, unsigned int)

  /** Get / Set whether conjugate gradient should be performed on GPU */
  itkGetMacro(CudaConjugateGradient, bool)
  itkSetMacro(CudaConjugateGradient, bool)

protected:
  IncrementalFourDConjugateGradientConeBeamReconstructionFilter();
  ~IncrementalFourDConjugateGradientConeBeamReconstructionFilter(){}

  virtual void GenerateOutputInformation();

  virtual void GenerateData();

  /** The two inputs should not be in the same space so there is nothing
   * to verify. */
  virtual void VerifyInputInformation() {}

  /** Pointers to each subfilter of this composite filter */
  typename std::vector<typename SubSelectType::Pointer>                   m_SubSelectFilters;
  typename std::vector<typename PhasesToInterpolationWeights::Pointer>    m_PhasesFilters;
  typename CGType::Pointer                                                m_CG;

  /** A vector containing as many vectors of booleans as the number of subsets. Each boolean
  indicates whether the corresponding projection is selected in the subset */
  std::vector< std::vector< bool > > m_SelectedProjsVector;

  /** Geometry object */
  ThreeDCircularProjectionGeometry::Pointer m_Geometry;

  /** Number of iterations */
  unsigned int m_MainLoop_iterations; //Main loop
  unsigned int m_CG_iterations; //Conjugate gradient iterations each time a subset is processed

  /** Number of projections in each subset (given by user), and number of subsets (computed) */
  unsigned int m_NumberOfProjectionsPerSubset;
  unsigned int m_NumberOfSubsets;

  /** Name of the file containing the phases */
  std::string m_PhasesFileName;

  /** Should conjugate gradient be performed on GPU ? */
  bool  m_CudaConjugateGradient;

private:
  //purposely not implemented
  IncrementalFourDConjugateGradientConeBeamReconstructionFilter(const Self&);
  void operator=(const Self&);

}; // end of class

} // end namespace rtk

#ifndef ITK_MANUAL_INSTANTIATION
#include "rtkIncrementalFourDConjugateGradientConeBeamReconstructionFilter.hxx"
#endif

#endif

redpajama_set_name: RedPajamaGithub


text:
title:  "Simple Boxplot in R "
layout: single
date: 2017-03-27
categories:
  - r
---

In last post, I downloaded TCGA 309 normalized RNA-Seq data for OV tumor tissue.This time, I'm going to draw simple boxplot from this expression tissue.

{% include toc %}

I will show two solutions here, one with base R and base plot functions, the other using the so-called [tidy data](http://bit.ly/1V7jmkY){:target="_blank"}, pipe and ggplot2.

# Base R

Here the only function not base is `str_split_fixed` which imported from "stringr". This makes split so easy, but you can also use `strsplit()`` for this purpose. Of course you can adjust parameters to make them look better.

```r
#load required pacakges.
library("stringr");library("tidyr")
library(dplyr);library(reshape2)
library(ggplot2);library(gridExtra)
# read file and draw boxplot of interested genes
ov <- read.table("OV__gene.normalized_RNAseq__tissueTypeAll__20170308150904.txt",header=T,stringsAsFactors = F)
# splite gene id to "geneName" and "EntrezID". from stingr
t <- str_split_fixed(ov$gene_id, "\\|",n=2)
ov <- cbind(t,ov)
ov <- ov[,-3];rm(t) # combine splite name and original values
colnames(ov)[1:2] <- c("geneName","EntrezID")

# get expression for genes we want.
expr <- ov[ov$EntrezID %in% c("672","10575"),]

# plot use base R boxplot() function
par(mfrow=c(1,2))
boxplot(t(expr[,c(3:311)]),names = expr[,1],main="beforeLog2")
boxplot(log2(t(expr[,c(3:311)])+1),names=expr[,1],main="afterLog2")

# plot use ggplot2
expr_m <- melt(expr,id.vars =c("geneName","EntrezID"))
p1 <- ggplot(data=expr_m,aes(x=geneName,y=value)) + geom_boxplot() +
ggtitle("beforeLog2")
p2 <- ggplot(data=expr_m,aes(x=geneName,y=log2(value+1)))+ geom_boxplot() +
ggtitle("afterLog2")
grid.arrange(p1, p2, ncol = 2)
```

gene_id TCGA.04.1348.01A.01R.1565.13 TCGA.04.1357.01A.01R.1565.13
1 ?|100130426                       0.0000                       0.0000
2 ?|100133144                      27.3245                      21.9661
3 ?|100134869                      45.8134                      36.6276
4     ?|10357                      24.0979                       9.1146
5     ?|10431                    1509.2767                     696.6146
  TCGA.04.1362.01A.01R.1565.13 TCGA.04.1364.01A.01R.1565.13
1                       0.6619                       0.0000
2                      27.2611                      18.6062
3                      53.1619                      14.4677
4                      32.1030                      30.2498
5                    1056.4202                    1372.5640

20531   310

![Imgur](http://i.imgur.com/qGtQsNU.png)

![Imgur](http://i.imgur.com/REEsv5O.png)

# Tidy and Pipe

Probably because I have used base function for too long, that the tidy format at first doesn't make sense to me. After read [Mastering Software Development in R](https://bookdown.org/rdpeng/RProgDA/){:target="_blank"}, I finally got some ideas that I could implement the pipe. Here is the code:

```r
# To do the samething in pipe or the so called tidy data
ov1 <- read_tsv("OV__gene.normalized_RNAseq__tissueTypeAll__20170308150904.txt") %>%
 separate(gene_id,c("geneName","EntrezID"),"\\|") %&>%
 filter(EntrezID %in% c("672","10575")) %>%
 select(-EntrezID) %>%
 gather(sample,value,-geneName)
 #mutate(value=log2(value+1))

# draw violin plot in ggplot2
p3 <- ggplot(data=ov1,aes(x=geneName,y=value))+ geom_violin() +
 ggtitle("beforeLog2")
p4 <- ggplot(data=ov1,aes(x=geneName,y=log2(value+1)))+ geom_violin() +
 ggtitle("afterLog2")
grid.arrange(p3,p4,ncol=2)
```

![Imgur](http://i.imgur.com/xjsWjg4.png)

# Speed test and memory usage

I also did a speed test for two different code. BaseR took **11.962s**, pipe took **2.51s**, pipe is much faster. I did not do microbenhmark, but it looks like read_table is very fast.

In the end I compared three object memory use, all with two genes' expression in 309 tissues.

1. base R processed dataframe (expr)
2. melt base R dataframe (expr_m)
3. tibble from pipe (ov1)

```r
library(pryr)
obsize <- c(object_size(expr),object_size(expr_m),object_size(ov1))
names(obsize) <- c("expr","expr_m","ov1")
barplot((obsize/1e6),ylim=c(0,3),las=2,ylab="MB",xlab="object",main="memoryUsage")
```

![Imgur](http://i.imgur.com/onFq8HS.png)

**Ov1 only takes 38.2k! That's impressive. Why? Next time i will test on a bigger dataset.**

| expr | expr_m | ov1 |
|----------|:-------------:|------:|
| 2.37MB | 2.36MB| 38.2kB |


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:paddingLeft="@dimen/dialog_padding"
    android:paddingRight="@dimen/dialog_padding"
    android:layout_height="wrap_content">

    <EditText
        android:id="@+id/suggestions_edit_text"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="@string/suggestions_text"
        android:inputType="text|textMultiLine"
        android:gravity="top"/>
</LinearLayout>


text:
define([
    'angular',
    'angular-mocks',
    'app'
], function (angular, mocks, app) {
    'use strict';

    describe('Service: products', function () {

        // load the service's module
        beforeEach(module('app'));

        // instantiate service
        var products;
        beforeEach(inject(function (_products_) {
            products = _products_;
        }));

        it('should do something', function () {
            expect(!!products).toBe(true);
        });

    });
});


text:
var config = require('../config.js');

var ga = require('./components/misc/google-analytics')(config.analytics);

var page = require('./page.ejs');

document.addEventListener("DOMContentLoaded", function () {
	document.body.innerHTML = page({});
	ga('send', 'pageview');
});


text:
using namespace SDKTemplate;

using namespace concurrency;
using namespace Platform;
using namespace Microsoft::WRL;
using namespace Windows::Foundation;
using namespace Windows::Graphics::Imaging;
using namespace Windows::Media::Capture::Frames;
using namespace Windows::UI::Xaml::Controls;
using namespace Windows::UI::Xaml::Media::Imaging;

#pragma region Low-level operations on reference pointers

// InterlockedExchange for reference pointer types.
template<typename T, typename U>
T^ InterlockedExchangeRefPointer(T^* target, U value)
{
    static_assert(sizeof(T^) == sizeof(void*), "InterlockedExchangePointer is the wrong size");
    T^ exchange = value;
    void** rawExchange = reinterpret_cast<void**>(&exchange);
    void** rawTarget = reinterpret_cast<void**>(target);
    *rawExchange = static_cast<IInspectable*>(InterlockedExchangePointer(rawTarget, *rawExchange));
    return exchange;
}

// Convert a reference pointer to a specific ComPtr.
template<typename T>
Microsoft::WRL::ComPtr<T> AsComPtr(Platform::Object^ object)
{
    Microsoft::WRL::ComPtr<T> p;
    reinterpret_cast<IUnknown*>(object)->QueryInterface(IID_PPV_ARGS(&p));
    return p;
}
#pragma endregion

// Structure used to access colors stored in 8-bit BGRA format.
struct ColorBGRA
{
    byte B, G, R, A;
};

// Colors to map values to based on intensity.
static constexpr std::array<ColorBGRA, 9> colorRamp = {
    ColorBGRA{ 0xFF, 0x7F, 0x00, 0x00 },
    ColorBGRA{ 0xFF, 0xFF, 0x00, 0x00 },
    ColorBGRA{ 0xFF, 0xFF, 0x7F, 0x00 },
    ColorBGRA{ 0xFF, 0xFF, 0xFF, 0x00 },
    ColorBGRA{ 0xFF, 0x7F, 0xFF, 0x7F },
    ColorBGRA{ 0xFF, 0x00, 0xFF, 0xFF },
    ColorBGRA{ 0xFF, 0x00, 0x7F, 0xFF },
    ColorBGRA{ 0xFF, 0x00, 0x00, 0xFF },
    ColorBGRA{ 0xFF, 0x00, 0x00, 0x7F }
};

static ColorBGRA ColorRampInterpolation(float value)
{
    static_assert(colorRamp.size() >= 2, "colorRamp table is too small");

    // Map value to surrounding indexes on the color ramp.
    size_t rampSteps = colorRamp.size() - 1;
    float scaled = value * rampSteps;
    int integer = static_cast<int>(scaled);
    int index = min(static_cast<size_t>(max(0, integer)), rampSteps - 1);
    const ColorBGRA& prev = colorRamp[index];
    const ColorBGRA& next = colorRamp[index + 1];

    // Set color based on a ratio of how closely it matches the surrounding colors.
    UINT32 alpha = static_cast<UINT32>((scaled - integer) * 255);
    UINT32 beta = 255 - alpha;
    return {
        static_cast<byte>((prev.A * beta + next.A * alpha) / 255), // Alpha
        static_cast<byte>((prev.R * beta + next.R * alpha) / 255), // Red
        static_cast<byte>((prev.G * beta + next.G * alpha) / 255), // Green
        static_cast<byte>((prev.B * beta + next.B * alpha) / 255)  // Blue
    };
}

// Initializes pseudo-color look up table for depth pixels
static ColorBGRA GeneratePseudoColorLookupTable(UINT32 index, UINT32 size)
{
    return ColorRampInterpolation(static_cast<float>(index) / static_cast<float>(size));
}

// Initializes the pseudo-color look up table for infrared pixels
static ColorBGRA GenerateInfraredRampLookupTable(UINT32 index, UINT32 size)
{
    const float value = static_cast<float>(index) / static_cast<float>(size);

    // Adjust to increase color change between lower values in infrared images.
    const float alpha = powf(1 - value, 12);

    return ColorRampInterpolation(alpha);
}

static LookupTable<ColorBGRA, 1024> colorLookupTable(GeneratePseudoColorLookupTable);
static LookupTable<ColorBGRA, 1024> infraredLookupTable(GenerateInfraredRampLookupTable);

static ColorBGRA PseudoColor(float value)
{
    return colorLookupTable.GetValue(value);
}

static ColorBGRA InfraredColor(float value)
{
    return infraredLookupTable.GetValue(value);
}

// Maps each pixel in a scanline from a 16 bit depth value to a pseudo-color pixel.
static void PseudoColorForDepth(int pixelWidth, byte* inputRowBytes, byte* outputRowBytes, float depthScale)
{
    // Visualize space in front of your desktop, in meters.
    constexpr float min = 0.5f;   // 0.5 meters
    constexpr float max = 4.0f;  // 4 meters
    constexpr float one_min = 1.0f / min;
    constexpr float range = 1.0f / max - one_min;

    UINT16* inputRow = reinterpret_cast<UINT16*>(inputRowBytes);
    ColorBGRA* outputRow = reinterpret_cast<ColorBGRA*>(outputRowBytes);
    for (int x = 0; x < pixelWidth; x++)
    {
        float depth = static_cast<float>(inputRow[x]) * depthScale;

        // Map invalid depth values to transparent pixels.
        // This happens when depth information cannot be calculated, e.g. when objects are too close.
        if (depth == 0)
        {
            outputRow[x] = { 0 };
        }
        else
        {
            float alpha = (1.0f / depth - one_min) / range;
            outputRow[x] = PseudoColor(alpha * alpha);
        }
    }
}

// Maps each pixel in a scanline from a 16 bit infrared value to a pseudo-color pixel.
static void PseudoColorFor16BitInfrared(int pixelWidth, byte* inputRowBytes, byte* outputRowBytes)
{
    UINT16* inputRow = reinterpret_cast<UINT16*>(inputRowBytes);
    ColorBGRA* outputRow = reinterpret_cast<ColorBGRA*>(outputRowBytes);
    for (int x = 0; x < pixelWidth; x++)
    {
        outputRow[x] = InfraredColor(inputRow[x] / static_cast<float>(UINT16_MAX));
    }
}

// Maps each pixel in a scanline from a 8 bit infrared value to a pseudo-color pixel.
static void PseudoColorFor8BitInfrared(int pixelWidth, byte* inputRowBytes, byte* outputRowBytes)
{
    ColorBGRA* outputRow = reinterpret_cast<ColorBGRA*>(outputRowBytes);
    for (int x = 0; x < pixelWidth; x++)
    {
        outputRow[x] = InfraredColor(inputRowBytes[x] / static_cast<float>(UINT8_MAX));
    }
}

FrameRenderer::FrameRenderer(Image^ imageElement)
{
    m_imageElement = imageElement;
    m_imageElement->Source = ref new SoftwareBitmapSource();
}

Concurrency::task<void> FrameRenderer::DrainBackBufferAsync()
{
    // Keep draining frames from the backbuffer until the backbuffer is empty.
    SoftwareBitmap^ latestBitmap = InterlockedExchangeRefPointer(&m_backBuffer, nullptr);
    if (latestBitmap != nullptr)
    {
        if (SoftwareBitmapSource^ imageSource = dynamic_cast<SoftwareBitmapSource^>(m_imageElement->Source))
        {
            return create_task(imageSource->SetBitmapAsync(latestBitmap))
                .then([this]()
            {
                return DrainBackBufferAsync();
            }, task_continuation_context::use_current());
        }
    }

    // To avoid a race condition against ProcessFrame, we cannot let any other
    // tasks run on the UI thread between point that the InterlockedExchangeRefPointer
    // reports that there is no more work, and we clear the m_taskRunning flag on
    // the UI thread.
    m_taskRunning = false;

    return task_from_result();
}

void FrameRenderer::ProcessFrame(Windows::Media::Capture::Frames::MediaFrameReference^ frame)
{
    if (frame == nullptr)
    {
        return;
    }

    SoftwareBitmap^ softwareBitmap = ConvertToDisplayableImage(frame->VideoMediaFrame);
    if (softwareBitmap != nullptr)
    {
        // Swap the processed frame to _backBuffer, and trigger the UI thread to render it.
        softwareBitmap = InterlockedExchangeRefPointer(&m_backBuffer, softwareBitmap);

        // UI thread always resets m_backBuffer before using it. Unused bitmap should be disposed.
        delete softwareBitmap;

        // Changes to the XAML ImageElement must happen in the UI thread, via the CoreDispatcher.
        m_imageElement->Dispatcher->RunAsync(Windows::UI::Core::CoreDispatcherPriority::Normal,
            ref new Windows::UI::Core::DispatchedHandler([this]()
        {
            // Don't let two copies of this task run at the same time.
            if (m_taskRunning)
            {
                return;
            }

            m_taskRunning = true;

            // Keep draining frames from the backbuffer until the backbuffer is empty.
            DrainBackBufferAsync();
        }));
    }
}

SoftwareBitmap^ FrameRenderer::ConvertToDisplayableImage(VideoMediaFrame^ inputFrame)
{
    if (inputFrame == nullptr)
    {
        return nullptr;
    }

    SoftwareBitmap^ inputBitmap = inputFrame->SoftwareBitmap;
    if ((inputBitmap->BitmapPixelFormat == BitmapPixelFormat::Bgra8) &&
        (inputBitmap->BitmapAlphaMode == BitmapAlphaMode::Premultiplied))
    {
        // SoftwareBitmap is already in the correct format for an Image control, so just return a copy.
        return SoftwareBitmap::Copy(inputBitmap);
    }
    else if ((inputBitmap->BitmapPixelFormat == BitmapPixelFormat::Gray16) && (inputFrame->FrameReference->SourceKind == MediaFrameSourceKind::Depth))
    {
        using namespace std::placeholders;

        // Use a special pseudo color to render 16 bits depth frame.
        // Since we must scale the output appropriately we use std::bind to
        // create a function that takes the depth scale as input but also matches
        // the required signature.
        double depthScale = inputFrame->DepthMediaFrame->DepthFormat->DepthScaleInMeters;
        return TransformBitmap(inputBitmap, std::bind(&PseudoColorForDepth, _1, _2, _3, static_cast<float>(depthScale)));
    }
    else if (inputBitmap->BitmapPixelFormat == BitmapPixelFormat::Gray16)
    {
        // Use pseudo color to render 16 bits frames.
        return TransformBitmap(inputBitmap, PseudoColorFor16BitInfrared);
    }
    else if (inputBitmap->BitmapPixelFormat == BitmapPixelFormat::Gray8)
    {
        // Use pseudo color to render 8 bits frames.
        return TransformBitmap(inputBitmap, PseudoColorFor8BitInfrared);
    }
    else
    {
        try
        {
            // Convert to Bgra8 Premultiplied SoftwareBitmap, so xaml can display in UI.
            return SoftwareBitmap::Convert(inputBitmap, BitmapPixelFormat::Bgra8, BitmapAlphaMode::Premultiplied);
        }
        catch (InvalidArgumentException^ exception)
        {
            // Conversion of software bitmap format is not supported.  Drop this frame.
            OutputDebugStringW(exception->Message->Data());
            OutputDebugStringW(L"\r\n");
            return nullptr;
        }
    }

    return nullptr;
}

SoftwareBitmap^ FrameRenderer::TransformBitmap(SoftwareBitmap^ inputBitmap, TransformScanline pixelTransformation)
{
    // XAML Image control only supports premultiplied Bgra8 format.
    SoftwareBitmap^ outputBitmap = ref new SoftwareBitmap(
        BitmapPixelFormat::Bgra8,
        inputBitmap->PixelWidth,
        inputBitmap->PixelHeight,
        BitmapAlphaMode::Premultiplied);

    BitmapBuffer^ input = inputBitmap->LockBuffer(BitmapBufferAccessMode::Read);
    BitmapBuffer^ output = outputBitmap->LockBuffer(BitmapBufferAccessMode::Write);

    // Get stride values to calculate buffer position for a given pixel x and y position.
    int inputStride = input->GetPlaneDescription(0).Stride;
    int outputStride = output->GetPlaneDescription(0).Stride;

    int pixelWidth = inputBitmap->PixelWidth;
    int pixelHeight = inputBitmap->PixelHeight;

    IMemoryBufferReference^ inputReference = input->CreateReference();
    IMemoryBufferReference^ outputReference = output->CreateReference();

    // Get input and output byte access buffers.
    byte* inputBytes;
    UINT32 inputCapacity;
    AsComPtr<IMemoryBufferByteAccess>(inputReference)->GetBuffer(&inputBytes, &inputCapacity);

    byte* outputBytes;
    UINT32 outputCapacity;
    AsComPtr<IMemoryBufferByteAccess>(outputReference)->GetBuffer(&outputBytes, &outputCapacity);

    // Iterate over all pixels, and store the converted value.
    for (int y = 0; y < pixelHeight; y++)
    {
        byte* inputRowBytes = inputBytes + y * inputStride;
        byte* outputRowBytes = outputBytes + y * outputStride;

        pixelTransformation(pixelWidth, inputRowBytes, outputRowBytes);
    }

    // Close objects that need closing.
    delete outputReference;
    delete inputReference;
    delete output;
    delete input;

    return outputBitmap;
}


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

namespace PSSQT.RankLogParser
{
    public class PidMappings : List<PidMapping>
    {
        private static readonly char[] sepChars = { ' ' };

        public PidMappings(string value)  // e.g. value = "[1:content::7:%default] [2:content::1:%default] [3:content::5:%default] [56:content::2:%default] [100:content::3:link] [10:content::6:link] [264:content::14:link] "
        {
            var items = value.Split(sepChars, StringSplitOptions.RemoveEmptyEntries);

            foreach (var item in items)
            {
                Add(new PidMapping(item));
            }
        }
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.0" language="cs_CZ" sourcelanguage="en">
<defaultcodec>UTF-8</defaultcodec>
<context>
    <name>AddCategoryDlg</name>
    <message>
        <location filename="../ui/addcategorydlg.ui" line="14"/>
        <location filename="../addcategorydlg.cpp" line="87"/>
        <source>Add category</source>
        <translation>Přidat kategorii</translation>
    </message>
    <message>
        <location filename="../ui/addcategorydlg.ui" line="26"/>
        <source>Name:</source>
        <translation>Jméno:</translation>
    </message>
    <message>
        <location filename="../ui/addcategorydlg.ui" line="36"/>
        <source>Max age:</source>
        <translation>Maximální věk:</translation>
    </message>
    <message>
        <location filename="../ui/addcategorydlg.ui" line="53"/>
        <source>adult</source>
        <translation>dospělý</translation>
    </message>
    <message>
        <location filename="../ui/addcategorydlg.ui" line="60"/>
        <source>male</source>
        <translation>mužské</translation>
    </message>
    <message>
        <location filename="../ui/addcategorydlg.ui" line="70"/>
        <source>female</source>
        <translation>ženské</translation>
    </message>
    <message>
        <location filename="../ui/addcategorydlg.ui" line="77"/>
        <source>Sex:</source>
        <translation>Pohlaví:</translation>
    </message>
    <message>
        <location filename="../ui/addcategorydlg.ui" line="101"/>
        <source>Add</source>
        <translation>Přidat</translation>
    </message>
    <message>
        <location filename="../ui/addcategorydlg.ui" line="108"/>
        <source>Add and close</source>
        <translation>Přidat a zavřít</translation>
    </message>
    <message>
        <location filename="../ui/addcategorydlg.ui" line="115"/>
        <source>Save</source>
        <translation>Uložit</translation>
    </message>
    <message>
        <location filename="../ui/addcategorydlg.ui" line="122"/>
        <source>Cancel</source>
        <translation>Zrušit</translation>
    </message>
    <message>
        <location filename="../addcategorydlg.cpp" line="33"/>
        <location filename="../addcategorydlg.cpp" line="77"/>
        <source>Edit category</source>
        <translation>Upravit kategorii</translation>
    </message>
    <message>
        <location filename="../addcategorydlg.cpp" line="129"/>
        <source>You must specified category name.</source>
        <translation>Musíte vyplnit jméno kategorie.</translation>
    </message>
</context>
<context>
    <name>AddPlayerDlg</name>
    <message>
        <location filename="../ui/addplayerdlg.ui" line="14"/>
        <location filename="../ui/addplayerdlg.ui" line="252"/>
        <location filename="../addplayerdlg.cpp" line="63"/>
        <location filename="../addplayerdlg.cpp" line="179"/>
        <source>Add player</source>
        <translation>Přidat hráče</translation>
    </message>
    <message>
        <location filename="../ui/addplayerdlg.ui" line="35"/>
        <source>Firstname:</source>
        <translation>Jméno:</translation>
    </message>
    <message>
        <location filename="../ui/addplayerdlg.ui" line="56"/>
        <source>E-mail:</source>
        <translation>E-mail:</translation>
    </message>
    <message>
        <location filename="../ui/addplayerdlg.ui" line="70"/>
        <source>Address:</source>
        <translation>Adresa:</translation>
    </message>
    <message>
        <location filename="../ui/addplayerdlg.ui" line="84"/>
        <source>Phone:</source>
        <translation>Telefon:</translation>
    </message>
    <message>
        <location filename="../ui/addplayerdlg.ui" line="104"/>
        <source>Day of birth:</source>
        <translation>Datum narození:</translation>
    </message>
    <message>
        <location filename="../ui/addplayerdlg.ui" line="117"/>
        <source>d.M.yyyy</source>
        <translation></translation>
    </message>
    <message>
        <location filename="../ui/addplayerdlg.ui" line="130"/>
        <source>Number:</source>
        <translation>Číslo:</translation>
    </message>
    <message>
        <location filename="../ui/addplayerdlg.ui" line="156"/>
        <source>Surname:</source>
        <translation>Příjmení:</translation>
    </message>
    <message>
        <location filename="../ui/addplayerdlg.ui" line="170"/>
        <location filename="../addplayerdlg.cpp" line="49"/>
        <source>defender</source>
        <translation>obránce</translation>
    </message>
    <message>
        <location filename="../ui/addplayerdlg.ui" line="175"/>
        <location filename="../addplayerdlg.cpp" line="50"/>
        <source>forward</source>
        <translation>útočník</translation>
    </message>
    <message>
        <location filename="../ui/addplayerdlg.ui" line="180"/>
        <source>goalie</source>
        <translation>brankář</translation>
    </message>
    <message>
        <location filename="../ui/addplayerdlg.ui" line="194"/>
        <source>Post:</source>
        <translation>Post:</translation>
    </message>
    <message>
        <location filename="../ui/addplayerdlg.ui" line="201"/>
        <source>Photo:</source>
        <translation>Fotografie:</translation>
    </message>
    <message>
        <location filename="../ui/addplayerdlg.ui" line="213"/>
        <source>File...</source>
        <translation>Soubor...</translation>
    </message>
    <message>
        <location filename="../ui/addplayerdlg.ui" line="263"/>
        <source>Add player and close</source>
        <translation>Přidat hráče a zavřít</translation>
    </message>
    <message>
        <location filename="../ui/addplayerdlg.ui" line="274"/>
        <source>Save changes</source>
        <translation>Uložit změny</translation>
    </message>
    <message>
        <location filename="../ui/addplayerdlg.ui" line="285"/>
        <source>Cancel</source>
        <translation>Zrušit</translation>
    </message>
    <message>
        <location filename="../addplayerdlg.cpp" line="35"/>
        <location filename="../addplayerdlg.cpp" line="156"/>
        <source>Edit player</source>
        <translation>Upravit hráče</translation>
    </message>
    <message>
        <location filename="../addplayerdlg.cpp" line="169"/>
        <source>You must specified firstname and surname.</source>
        <translation>Musíte vyplnit jméno a příjmení.</translation>
    </message>
    <message>
        <location filename="../addplayerdlg.cpp" line="179"/>
        <source>Selected file does not exists.</source>
        <translation>Vybraný soubor neexistuje.</translation>
    </message>
    <message>
        <location filename="../addplayerdlg.cpp" line="192"/>
        <source>Open Image</source>
        <translation>Vybrat fotografii</translation>
    </message>
    <message>
        <location filename="../addplayerdlg.cpp" line="192"/>
        <source>Image Files (*.png *.jpg *.bmp)</source>
        <translation>Soubory obrázků</translation>
    </message>
</context>
<context>
    <name>AddTeamDlg</name>
    <message>
        <location filename="../ui/addteamdlg.ui" line="14"/>
        <location filename="../addteamdlg.cpp" line="147"/>
        <source>Add team</source>
        <translation>Přidat tým</translation>
    </message>
    <message>
        <location filename="../ui/addteamdlg.ui" line="29"/>
        <source>Team name:</source>
        <translation>Jméno týmu:</translation>
    </message>
    <message>
        <location filename="../ui/addteamdlg.ui" line="39"/>
        <source>Category:</source>
        <translation>Kategorie:</translation>
    </message>
    <message>
        <source>male</source>
        <translation type="obsolete">mužské</translation>
    </message>
    <message>
        <source>female</source>
        <translation type="obsolete">ženské</translation>
    </message>
    <message>
        <location filename="../ui/addteamdlg.ui" line="53"/>
        <source>Players in team</source>
        <translation>Hráči v týmu</translation>
    </message>
    <message>
        <location filename="../ui/addteamdlg.ui" line="148"/>
        <source>Players without team</source>
        <translation>Hráči bez týmu</translation>
    </message>
    <message>
        <location filename="../ui/addteamdlg.ui" line="196"/>
        <source>Add</source>
        <translation>Přidat</translation>
    </message>
    <message>
        <location filename="../ui/addteamdlg.ui" line="207"/>
        <source>Add and close</source>
        <translation>Přidat a zavřít</translation>
    </message>
    <message>
        <location filename="../ui/addteamdlg.ui" line="218"/>
        <source>Save</source>
        <translation>Uložit</translation>
    </message>
    <message>
        <location filename="../ui/addteamdlg.ui" line="229"/>
        <source>Cancel</source>
        <translation>Zrušit</translation>
    </message>
    <message>
        <location filename="../addteamdlg.cpp" line="45"/>
        <location filename="../addteamdlg.cpp" line="125"/>
        <source>Edit team</source>
        <translation>Upravit tým</translation>
    </message>
    <message>
        <location filename="../addteamdlg.cpp" line="222"/>
        <source>You must specified team name.</source>
        <translation>Musíte vyplnit jméno týmu.</translation>
    </message>
</context>
<context>
    <name>AddTournamentDlg</name>
    <message>
        <location filename="../ui/addtournamentdlg.ui" line="20"/>
        <location filename="../addtournamentdlg.cpp" line="49"/>
        <source>Add tournament</source>
        <translation>Přidat turnaj</translation>
    </message>
    <message>
        <location filename="../ui/addtournamentdlg.ui" line="32"/>
        <source>Team:</source>
        <translation>Tým:</translation>
    </message>
    <message>
        <location filename="../ui/addtournamentdlg.ui" line="42"/>
        <source>Date:</source>
        <translation>Datum:</translation>
    </message>
    <message>
        <location filename="../ui/addtournamentdlg.ui" line="49"/>
        <source>d.M.yyyy</source>
        <translation>d.M.yyyy</translation>
    </message>
    <message>
        <location filename="../ui/addtournamentdlg.ui" line="56"/>
        <source>Place:</source>
        <translation>Místo:</translation>
    </message>
    <message>
        <location filename="../ui/addtournamentdlg.ui" line="66"/>
        <source>In season</source>
        <translation>V sezóně</translation>
    </message>
    <message>
        <location filename="../ui/addtournamentdlg.ui" line="73"/>
        <source>yes</source>
        <translation>ano</translation>
    </message>
    <message>
        <location filename="../ui/addtournamentdlg.ui" line="100"/>
        <source>Add</source>
        <translation>Přidat</translation>
    </message>
    <message>
        <location filename="../ui/addtournamentdlg.ui" line="117"/>
        <source>Add and close</source>
        <translation>Přidat a zavřít</translation>
    </message>
    <message>
        <location filename="../ui/addtournamentdlg.ui" line="134"/>
        <source>Save</source>
        <translation>Uložit</translation>
    </message>
    <message>
        <location filename="../ui/addtournamentdlg.ui" line="145"/>
        <source>Cancel</source>
        <translation>Zrušit</translation>
    </message>
    <message>
        <location filename="../addtournamentdlg.cpp" line="29"/>
        <location filename="../addtournamentdlg.cpp" line="114"/>
        <source>Edit tournament</source>
        <translation>Upravit turnaj</translation>
    </message>
    <message>
        <location filename="../addtournamentdlg.cpp" line="126"/>
        <source>You must specified place.</source>
        <translation>Musíte vyplnit místo.</translation>
    </message>
</context>
<context>
    <name>AddTrainingDlg</name>
    <message>
        <location filename="../ui/addtrainingdlg.ui" line="12"/>
        <location filename="../addtrainingdlg.cpp" line="102"/>
        <source>Add training</source>
        <translation>Přidat trénink</translation>
    </message>
    <message>
        <location filename="../ui/addtrainingdlg.ui" line="24"/>
        <source>Team:</source>
        <translation>Tým:</translation>
    </message>
    <message>
        <location filename="../ui/addtrainingdlg.ui" line="34"/>
        <source>Date:</source>
        <translation>Datum:</translation>
    </message>
    <message>
        <location filename="../ui/addtrainingdlg.ui" line="45"/>
        <source>every week</source>
        <translation>každý týden</translation>
    </message>
    <message>
        <location filename="../ui/addtrainingdlg.ui" line="56"/>
        <source>Monday</source>
        <translation>Pondělí</translation>
    </message>
    <message>
        <location filename="../ui/addtrainingdlg.ui" line="61"/>
        <source>Tuesday</source>
        <translation>Úterý</translation>
    </message>
    <message>
        <location filename="../ui/addtrainingdlg.ui" line="66"/>
        <source>Wednesday</source>
        <translation>Středa</translation>
    </message>
    <message>
        <location filename="../ui/addtrainingdlg.ui" line="71"/>
        <source>Thursday</source>
        <translation>Čtvrtek</translation>
    </message>
    <message>
        <location filename="../ui/addtrainingdlg.ui" line="76"/>
        <source>Friday</source>
        <translation>Pátek</translation>
    </message>
    <message>
        <location filename="../ui/addtrainingdlg.ui" line="81"/>
        <source>Saturday</source>
        <translation>Sobota</translation>
    </message>
    <message>
        <location filename="../ui/addtrainingdlg.ui" line="86"/>
        <source>Sunday</source>
        <translation>Neděle</translation>
    </message>
    <message>
        <location filename="../ui/addtrainingdlg.ui" line="114"/>
        <source>d.M.yyyy</source>
        <translation>d.M.yyyy</translation>
    </message>
    <message>
        <location filename="../ui/addtrainingdlg.ui" line="138"/>
        <source>Time:</source>
        <translation>Čas:</translation>
    </message>
    <message>
        <location filename="../ui/addtrainingdlg.ui" line="156"/>
        <source>Place:</source>
        <translation>Místo:</translation>
    </message>
    <message>
        <location filename="../ui/addtrainingdlg.ui" line="171"/>
        <source>Canceled</source>
        <translation>Zrušeno</translation>
    </message>
    <message>
        <location filename="../ui/addtrainingdlg.ui" line="197"/>
        <source>Add</source>
        <translation>Přidat</translation>
    </message>
    <message>
        <location filename="../ui/addtrainingdlg.ui" line="208"/>
        <source>Add and close</source>
        <translation>Přidat a zavřít</translation>
    </message>
    <message>
        <location filename="../ui/addtrainingdlg.ui" line="219"/>
        <source>Save</source>
        <translation>Uložit</translation>
    </message>
    <message>
        <location filename="../ui/addtrainingdlg.ui" line="230"/>
        <source>Cancel</source>
        <translation>Zrušit</translation>
    </message>
    <message>
        <location filename="../addtrainingdlg.cpp" line="44"/>
        <location filename="../addtrainingdlg.cpp" line="90"/>
        <source>Edit training</source>
        <translation>Upravit trénink</translation>
    </message>
    <message>
        <location filename="../addtrainingdlg.cpp" line="182"/>
        <source>You must specified place.</source>
        <translation>Musíte vyplnit místo.</translation>
    </message>
</context>
<context>
    <name>AttendanceMatrixModel</name>
    <message>
        <location filename="../models/attendancematrixmodel.cpp" line="32"/>
        <source>dd.MM.yyyy h:mm</source>
        <translation>dd.MM.yyyy h:mm</translation>
    </message>
    <message>
        <location filename="../models/attendancematrixmodel.cpp" line="58"/>
        <source>Yes</source>
        <translation>Ano</translation>
    </message>
    <message>
        <location filename="../models/attendancematrixmodel.cpp" line="58"/>
        <source>No</source>
        <translation>Ne</translation>
    </message>
</context>
<context>
    <name>AttendanceModel</name>
    <message>
        <location filename="../models/attendancemodel.cpp" line="84"/>
        <source>Yes</source>
        <translation>Ano</translation>
    </message>
    <message>
        <location filename="../models/attendancemodel.cpp" line="84"/>
        <source>No</source>
        <translation>Ne</translation>
    </message>
    <message>
        <location filename="../models/attendancemodel.cpp" line="140"/>
        <source>Player</source>
        <translation>Hráč</translation>
    </message>
    <message>
        <location filename="../models/attendancemodel.cpp" line="141"/>
        <source>Was present?</source>
        <translation>Byl přítomen?</translation>
    </message>
</context>
<context>
    <name>AttendanceTab</name>
    <message>
        <location filename="../ui/attendancetab.ui" line="14"/>
        <source>Form</source>
        <translation></translation>
    </message>
    <message>
        <location filename="../ui/attendancetab.ui" line="29"/>
        <source>All categories</source>
        <translation>Všechny kategorie</translation>
    </message>
</context>
<context>
    <name>CategoryModel</name>
    <message>
        <location filename="../models/categorymodel.cpp" line="35"/>
        <source>adult</source>
        <translation>dospělý</translation>
    </message>
</context>
<context>
    <name>EditCategoriesDlg</name>
    <message>
        <location filename="../ui/editcategoriesdlg.ui" line="14"/>
        <source>Edit categories</source>
        <translation>Upravit kategorie</translation>
    </message>
    <message>
        <location filename="../ui/editcategoriesdlg.ui" line="26"/>
        <source>male</source>
        <translation>mužské</translation>
    </message>
    <message>
        <location filename="../ui/editcategoriesdlg.ui" line="36"/>
        <source>female</source>
        <translation>ženské</translation>
    </message>
    <message>
        <location filename="../ui/editcategoriesdlg.ui" line="78"/>
        <source>Add</source>
        <translation>Přidat</translation>
    </message>
    <message>
        <location filename="../ui/editcategoriesdlg.ui" line="85"/>
        <source>Edit</source>
        <translation>Upravit</translation>
    </message>
    <message>
        <location filename="../ui/editcategoriesdlg.ui" line="92"/>
        <source>Delete</source>
        <translation>Smazat</translation>
    </message>
    <message>
        <location filename="../ui/editcategoriesdlg.ui" line="131"/>
        <source>Close</source>
        <translation>Zavřít</translation>
    </message>
    <message>
        <location filename="../editcategoriesdlg.cpp" line="50"/>
        <source>Delete category</source>
        <translation>Smazat kategorii</translation>
    </message>
    <message>
        <location filename="../editcategoriesdlg.cpp" line="50"/>
        <source>Really delete category?</source>
        <translation>Opravdu chcete smazat kategorii?</translation>
    </message>
</context>
<context>
    <name>FiltrEdit</name>
    <message>
        <location filename="../widget/filtredit.cpp" line="40"/>
        <location filename="../widget/filtredit.cpp" line="59"/>
        <location filename="../widget/filtredit.cpp" line="85"/>
        <source>Filter...</source>
        <translation>Filtr...</translation>
    </message>
</context>
<context>
    <name>MainWindow</name>
    <message>
        <location filename="../ui/mainwindow.ui" line="14"/>
        <location filename="../mainwindow.cpp" line="20"/>
        <source>Floco</source>
        <translation>Floco</translation>
    </message>
    <message>
        <location filename="../ui/mainwindow.ui" line="33"/>
        <source>Players</source>
        <translation>Hráči</translation>
    </message>
    <message>
        <location filename="../ui/mainwindow.ui" line="42"/>
        <source>Teams</source>
        <translation>Týmy</translation>
    </message>
    <message>
        <location filename="../ui/mainwindow.ui" line="51"/>
        <source>Tournaments</source>
        <translation>Turnaje</translation>
    </message>
    <message>
        <location filename="../ui/mainwindow.ui" line="60"/>
        <source>Trainings</source>
        <translation>Tréninky</translation>
    </message>
    <message>
        <location filename="../ui/mainwindow.ui" line="69"/>
        <source>Attendance</source>
        <translation>Docházka</translation>
    </message>
    <message>
        <location filename="../ui/mainwindow.ui" line="87"/>
        <source>&Fle</source>
        <translation>&Soubor</translation>
    </message>
    <message>
        <location filename="../ui/mainwindow.ui" line="93"/>
        <source>&Help</source>
        <translation>&Nápověda</translation>
    </message>
    <message>
        <location filename="../ui/mainwindow.ui" line="99"/>
        <source>&Categories</source>
        <translation>&Kategorie</translation>
    </message>
    <message>
        <location filename="../ui/mainwindow.ui" line="109"/>
        <source>About...</source>
        <translation>O Floco...</translation>
    </message>
    <message>
        <location filename="../ui/mainwindow.ui" line="114"/>
        <source>Edit categories</source>
        <translation>Upravit kategorie</translation>
    </message>
    <message>
        <location filename="../ui/mainwindow.ui" line="119"/>
        <source>Close</source>
        <translation>Zavřít</translation>
    </message>
    <message>
        <location filename="../mainwindow.cpp" line="20"/>
        <source>Cannot open database file!</source>
        <translation>Nelze otevřít soubor s databází!</translation>
    </message>
    <message>
        <location filename="../mainwindow.cpp" line="44"/>
        <source>About Floco</source>
        <translation>O Floco</translation>
    </message>
    <message>
        <location filename="../mainwindow.cpp" line="44"/>
        <source>Created by Aleš Nejdr</source>
        <translation>Vytvořil Aleš Nejdr</translation>
    </message>
</context>
<context>
    <name>PlayerDetails</name>
    <message>
        <location filename="../ui/playerdetails.ui" line="14"/>
        <source>Player details</source>
        <translation>Detaily hráče</translation>
    </message>
    <message>
        <location filename="../ui/playerdetails.ui" line="57"/>
        <source>Player name</source>
        <translation>Jméno hráče</translation>
    </message>
    <message>
        <location filename="../ui/playerdetails.ui" line="64"/>
        <source>Number:</source>
        <translation>Číslo:</translation>
    </message>
    <message>
        <location filename="../ui/playerdetails.ui" line="71"/>
        <source>Post:</source>
        <translation>Post:</translation>
    </message>
    <message>
        <location filename="../ui/playerdetails.ui" line="78"/>
        <source>Day of birth:</source>
        <translation>Datum narození:</translation>
    </message>
    <message>
        <location filename="../ui/playerdetails.ui" line="85"/>
        <source>Address:</source>
        <translation>Adresa:</translation>
    </message>
    <message>
        <location filename="../ui/playerdetails.ui" line="92"/>
        <source>Phone:</source>
        <translation>Telefon:</translation>
    </message>
    <message>
        <location filename="../ui/playerdetails.ui" line="99"/>
        <source>E-mail:</source>
        <translation>E-mail:</translation>
    </message>
    <message>
        <location filename="../ui/playerdetails.ui" line="117"/>
        <source>Statistics</source>
        <translation>Statistiky</translation>
    </message>
    <message>
        <location filename="../playerdetails.cpp" line="17"/>
        <source>Player details - </source>
        <translation>Detaily hráče - </translation>
    </message>
    <message>
        <location filename="../playerdetails.cpp" line="20"/>
        <source>Number: <b></source>
        <translation>Číslo: <b></translation>
    </message>
    <message>
        <location filename="../playerdetails.cpp" line="21"/>
        <source>Post: <b></source>
        <translation>Post: <b></translation>
    </message>
    <message>
        <location filename="../playerdetails.cpp" line="22"/>
        <source>Day of birth: <b></source>
        <translation>Datum narození: <b></translation>
    </message>
    <message>
        <location filename="../playerdetails.cpp" line="23"/>
        <source>Address: <b></source>
        <translation>Adresa: <b></translation>
    </message>
    <message>
        <location filename="../playerdetails.cpp" line="24"/>
        <source>Phone: <b></source>
        <translation>Telefon: <b></translation>
    </message>
    <message>
        <location filename="../playerdetails.cpp" line="25"/>
        <source>E-mail: <b></source>
        <translation>E-mail: <b></translation>
    </message>
</context>
<context>
    <name>PlayersTab</name>
    <message>
        <location filename="../ui/playerstab.ui" line="14"/>
        <source>Form</source>
        <translation></translation>
    </message>
    <message>
        <location filename="../ui/playerstab.ui" line="22"/>
        <source>Add player</source>
        <translation>Přidat hráče</translation>
    </message>
    <message>
        <location filename="../ui/playerstab.ui" line="42"/>
        <source>Edit player</source>
        <translation>Upravit hráče</translation>
    </message>
    <message>
        <location filename="../ui/playerstab.ui" line="62"/>
        <location filename="../playerstab.cpp" line="75"/>
        <source>Delete players</source>
        <translation>Smazat hráče</translation>
    </message>
    <message>
        <location filename="../ui/playerstab.ui" line="146"/>
        <source>Show player's details</source>
        <translation>Zobrazit detaily hráče</translation>
    </message>
    <message>
        <source>Filtr</source>
        <translation type="obsolete">FIltr</translation>
    </message>
    <message>
        <location filename="../ui/playerstab.ui" line="100"/>
        <location filename="../playerstab.cpp" line="131"/>
        <source>Filter...</source>
        <translation>Filtr...</translation>
    </message>
    <message>
        <source>Show players list</source>
        <translation type="obsolete">Zobrazit seznam hráčů</translation>
    </message>
    <message>
        <source>Players list</source>
        <translation type="obsolete">Seznam hráčů</translation>
    </message>
    <message>
        <source>Player name</source>
        <translation type="obsolete">Jméno hráče</translation>
    </message>
    <message>
        <source>Number:</source>
        <translation type="obsolete">Číslo:</translation>
    </message>
    <message>
        <source>Post:</source>
        <translation type="obsolete">Post:</translation>
    </message>
    <message>
        <source>Day of birth:</source>
        <translation type="obsolete">Datum narození:</translation>
    </message>
    <message>
        <source>Address:</source>
        <translation type="obsolete">Adresa:</translation>
    </message>
    <message>
        <source>Phone:</source>
        <translation type="obsolete">Telefon:</translation>
    </message>
    <message>
        <source>E-mail:</source>
        <translation type="obsolete">E-mail:</translation>
    </message>
    <message>
        <source>Statistics</source>
        <translation type="obsolete">Statistiky</translation>
    </message>
    <message>
        <location filename="../playerstab.cpp" line="75"/>
        <source>Really delete players?</source>
        <translation>Opravdu chcete smazat hráče?</translation>
    </message>
    <message>
        <source>Number: <b></source>
        <translation type="obsolete">Číslo: <b></translation>
    </message>
    <message>
        <source>Post: <b></source>
        <translation type="obsolete">Post: <b></translation>
    </message>
    <message>
        <source>Day of birth: <b></source>
        <translation type="obsolete">Datum narození: <b></translation>
    </message>
    <message>
        <source>Address: <b></source>
        <translation type="obsolete">Adresa: <b></translation>
    </message>
    <message>
        <source>Phone: <b></source>
        <translation type="obsolete">Telefon: <b></translation>
    </message>
    <message>
        <source>E-mail: <b></source>
        <translation type="obsolete">E-mail: <b></translation>
    </message>
</context>
<context>
    <name>QObject</name>
    <message>
        <location filename="../models/categorymodel.cpp" line="17"/>
        <location filename="../models/playermodel.cpp" line="14"/>
        <location filename="../models/tournamentmodel.cpp" line="10"/>
        <source>ID</source>
        <translation>ID</translation>
    </message>
    <message>
        <location filename="../models/categorymodel.cpp" line="18"/>
        <source>Name</source>
        <translation>Jméno</translation>
    </message>
    <message>
        <location filename="../models/categorymodel.cpp" line="19"/>
        <source>Max age</source>
        <translation>Maximální věk</translation>
    </message>
    <message>
        <location filename="../models/playermodel.cpp" line="15"/>
        <source>Firstname</source>
        <translation>Jméno</translation>
    </message>
    <message>
        <location filename="../models/playermodel.cpp" line="16"/>
        <source>Surname</source>
        <translation>Příjmení</translation>
    </message>
    <message>
        <source>Date of birth</source>
        <translation type="obsolete">Datum narození</translation>
    </message>
    <message>
        <location filename="../models/playermodel.cpp" line="17"/>
        <source>Day of birth</source>
        <translation>Datum narození</translation>
    </message>
    <message>
        <location filename="../models/playermodel.cpp" line="18"/>
        <source>Address</source>
        <translation>Adresa</translation>
    </message>
    <message>
        <location filename="../models/playermodel.cpp" line="19"/>
        <source>E-mail</source>
        <translation>E-mail</translation>
    </message>
    <message>
        <location filename="../models/playermodel.cpp" line="20"/>
        <source>Phone</source>
        <translation>Telefon</translation>
    </message>
    <message>
        <location filename="../models/playermodel.cpp" line="21"/>
        <source>Number</source>
        <translation>Číslo</translation>
    </message>
    <message>
        <location filename="../models/playermodel.cpp" line="22"/>
        <source>Photo</source>
        <translation>Fotografie</translation>
    </message>
    <message>
        <location filename="../models/playermodel.cpp" line="23"/>
        <source>Post</source>
        <translation>Post</translation>
    </message>
    <message>
        <location filename="../models/tournamentmodel.cpp" line="11"/>
        <source>Date</source>
        <translation>Datum</translation>
    </message>
    <message>
        <location filename="../models/tournamentmodel.cpp" line="12"/>
        <source>Place</source>
        <translation>Místo</translation>
    </message>
    <message>
        <location filename="../models/tournamentmodel.cpp" line="13"/>
        <source>In season</source>
        <translation>V sezóně</translation>
    </message>
</context>
<context>
    <name>RecordAttendanceDlg</name>
    <message>
        <location filename="../ui/recordattendancedlg.ui" line="14"/>
        <source>Record attendance</source>
        <translation>Zaznamenat docházku</translation>
    </message>
    <message>
        <location filename="../ui/recordattendancedlg.ui" line="26"/>
        <source>Training:</source>
        <translation>Trénink:</translation>
    </message>
    <message>
        <location filename="../ui/recordattendancedlg.ui" line="39"/>
        <source>TextLabel</source>
        <translation></translation>
    </message>
    <message>
        <location filename="../ui/recordattendancedlg.ui" line="86"/>
        <source>Save</source>
        <translation>Uložit</translation>
    </message>
    <message>
        <location filename="../ui/recordattendancedlg.ui" line="97"/>
        <source>Cancel</source>
        <translation>Zrušit</translation>
    </message>
    <message>
        <location filename="../recordattendancedlg.cpp" line="22"/>
        <source>dd.MM.yyyy h:mm</source>
        <translation>dd.MM.yyyy h:mm</translation>
    </message>
</context>
<context>
    <name>TeamModel</name>
    <message>
        <location filename="../models/teammodel.cpp" line="17"/>
        <source>ID</source>
        <translation>ID</translation>
    </message>
    <message>
        <location filename="../models/teammodel.cpp" line="18"/>
        <source>Name</source>
        <translation>Jméno</translation>
    </message>
</context>
<context>
    <name>TeamsTab</name>
    <message>
        <location filename="../ui/teamstab.ui" line="14"/>
        <source>Form</source>
        <translation></translation>
    </message>
    <message>
        <location filename="../ui/teamstab.ui" line="32"/>
        <source>Add team</source>
        <translation>Přidat tým</translation>
    </message>
    <message>
        <location filename="../ui/teamstab.ui" line="52"/>
        <source>Edit team</source>
        <translation>Upravit tým</translation>
    </message>
    <message>
        <location filename="../ui/teamstab.ui" line="72"/>
        <source>Delete teams</source>
        <translation>Smazat tým</translation>
    </message>
    <message>
        <location filename="../ui/teamstab.ui" line="127"/>
        <source>All categories</source>
        <translation>Všechny kategorie</translation>
    </message>
    <message>
        <location filename="../teamstab.cpp" line="90"/>
        <source>Delete team</source>
        <translation>Smazat tým</translation>
    </message>
    <message>
        <location filename="../teamstab.cpp" line="90"/>
        <source>Really delete team?</source>
        <translation>Opravdu chcete smazat tým?</translation>
    </message>
</context>
<context>
    <name>TournamentModel</name>
    <message>
        <location filename="../models/tournamentmodel.cpp" line="33"/>
        <source>In season</source>
        <translation>V sezóně</translation>
    </message>
</context>
<context>
    <name>TournamentsTab</name>
    <message>
        <location filename="../ui/tournamentstab.ui" line="14"/>
        <source>Form</source>
        <translation></translation>
    </message>
    <message>
        <location filename="../ui/tournamentstab.ui" line="93"/>
        <source>All categories</source>
        <translation>Všechny kategorie</translation>
    </message>
    <message>
        <location filename="../tournamentstab.cpp" line="74"/>
        <source>Delete tournaments</source>
        <translation>Smazat turnaje</translation>
    </message>
    <message>
        <location filename="../tournamentstab.cpp" line="74"/>
        <source>Really delete tournaments?</source>
        <translation>Opravdu chcete smazat turnaje?</translation>
    </message>
</context>
<context>
    <name>TrainingModel</name>
    <message>
        <location filename="../models/trainingmodel.cpp" line="19"/>
        <source>ID</source>
        <translation>ID</translation>
    </message>
    <message>
        <location filename="../models/trainingmodel.cpp" line="20"/>
        <source>Datetime</source>
        <translation>Datum a čas</translation>
    </message>
    <message>
        <location filename="../models/trainingmodel.cpp" line="21"/>
        <source>Place</source>
        <translation>Místo</translation>
    </message>
    <message>
        <location filename="../models/trainingmodel.cpp" line="22"/>
        <location filename="../models/trainingmodel.cpp" line="49"/>
        <source>Canceled</source>
        <translation>Zrušeno</translation>
    </message>
    <message>
        <location filename="../models/trainingmodel.cpp" line="43"/>
        <source>dd.MM.yyyy h:mm</source>
        <translation>dd.MM.yyyy h:mm</translation>
    </message>
</context>
<context>
    <name>TrainingsTab</name>
    <message>
        <location filename="../ui/trainingstab.ui" line="14"/>
        <source>Form</source>
        <translation></translation>
    </message>
    <message>
        <location filename="../ui/trainingstab.ui" line="22"/>
        <source>Add training</source>
        <translation>Přidat trénink</translation>
    </message>
    <message>
        <location filename="../ui/trainingstab.ui" line="42"/>
        <source>Edit training</source>
        <translation>Upravit trénink</translation>
    </message>
    <message>
        <location filename="../ui/trainingstab.ui" line="62"/>
        <source>Delete training</source>
        <translation>Smazat trénink</translation>
    </message>
    <message>
        <location filename="../ui/trainingstab.ui" line="102"/>
        <source>All categories</source>
        <translation>Všechny kategorie</translation>
    </message>
    <message>
        <location filename="../ui/trainingstab.ui" line="164"/>
        <source>Record attendance</source>
        <translation>Zaznamenat docházku</translation>
    </message>
    <message>
        <location filename="../trainingstab.cpp" line="77"/>
        <source>Delete trainings</source>
        <translation>Smazat tréninky</translation>
    </message>
    <message>
        <location filename="../trainingstab.cpp" line="77"/>
        <source>Really delete trainings?</source>
        <translation>Opravdu chcete smazat tréninky?</translation>
    </message>
</context>
</TS>


text:
package com.github.t3t5u.common.domain;

import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;

@SuppressWarnings("serial")
public abstract class AbstractIdentity<VALUE> implements Identity<VALUE> {
	private final VALUE value;

	protected AbstractIdentity(final VALUE value) {
		this.value = value;
	}

	@Override
	public VALUE getValue() {
		return value;
	}

	@Override
	@SuppressWarnings("unchecked")
	public boolean equals(final Object o) {
		return (o == this) || ((o instanceof Identity) && new EqualsBuilder().append(getValue(), ((Identity<VALUE>) o).getValue()).build());
	}

	@Override
	public int hashCode() {
		return new HashCodeBuilder().append(getValue()).build();
	}

	@Override
	public String toString() {
		return new ToStringBuilder(this).append(getValue()).build();
	}
}


text:
#ifndef FAKE_MONKEY_SACCADE_AND_FIXATE_H
#define FAKE_MONKEY_SACCADE_AND_FIXATE_H

#include "MWorksCore/TrialBuildingBlocks.h"
#include "FakeMonkey.h"

class mFakeMonkeySaccadeAndFixate : public Action {
protected:
	shared_ptr<mFakeMonkey> monkey;
	shared_ptr<Variable> h_loc;
	shared_ptr<Variable> v_loc;
	shared_ptr<Variable> duration;
public:
	mFakeMonkeySaccadeAndFixate(const shared_ptr<mFakeMonkey> &_monkey,
								const shared_ptr<Variable> &_h_loc,
								const shared_ptr<Variable> &_v_loc,
								const shared_ptr<Variable> &_duration);

	virtual ~mFakeMonkeySaccadeAndFixate();
	virtual bool execute();
};

#endif


text:
import * as actionType from "../actions/actionTypes";

const initialState ={
    data: null,
    error: null,
    isLoading: false,
}

export default function reducer(state = initialState, action){
    switch (action.type) {
        case actionType.REQ_PWD_RECOVER:
            return {...state,isLoading:true};
        case actionType.RECV_DATA_PWD_RECOVER:
            return {...state, isLoading:false, data:action.data};
        case actionType.RECV_ERROR_PWD_RECOVER:
            return {...state, isLoading:false, error:action.data};
        case actionType.RESET_PWD_RECOVER:
            return {...state, isLoading:false, data: null, error:null};
        default:
            return state;
    }
}


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>网站后台管理</title>
<link href="__PUBLIC__/Admin/images/Admin_css.css" type="text/css" rel="stylesheet">
<link rel="shortcut icon" href="__PUBLIC__/Admin/images/myfav.ico" type="image/x-icon" />
<import file= "Admin.js.admin,Admin.js.Jquery"/>

  添加友情链接分类

<form action="{:U('Friendlink/dogroupadd')}" method="post" name="myform" onsubmit="return CheckForm();">

分类名称
<input name="name" type="text" id="name" size="40" maxlength="20"/>

<input  type="submit" class="bnt" value="添 加">  <input type="button" onclick="history.go(-1);" class="bnt" value="返 回">

<input type="hidden" name="_from" value="<empty name="Think.get.from">{$_SERVER['HTTP_REFERER']}</empty>"/>
</form>

<include file="Index:copy" />


text:
define({
  //Default configuration settings for the applciation. This is where you"ll define things like a bing maps key,
  //default web map, default app color theme and more. These values can be overwritten by template configuration settings
  //and url parameters.
  "appid": "",
  "webmap": "adffc6423fff4007896da63fdbb9cd87",
  "oauthappid": null,
  //Enter the url to the proxy if needed by the applcation. See the "Using the proxy page" help topic for details
  //developers.arcgis.com/en/javascript/jshelp/ags_proxy.html
  "proxyurl": "",
  //Example of a template specific property. If your template had several color schemes
  //you could define the default here and setup configuration settings to allow users to choose a different
  //color theme.
  "title": "",
  "summary": "",
  "defaultPanel": "legend",
  "enableDialogModal": false,
  "dialogModalContent": "",
  "dialogModalTitle": "",
  "enableSummaryInfo": true,
  "enableLegendPanel": true,
  "enableAboutPanel": true,
  "enableLayersPanel": true,
  "enableHomeButton": true,
  "enableShareDialog": true,
  "enableBookmarks": true,
  "enableModifiedDate": true,
  "enableViewsCount": true,
  "enableMoreInfo": true,
  "enablePrintButton": false,
  "defaultBasemap": "topo",
  "nextBasemap": "hybrid",
  "locationSearch": true,
  //When searchExtent is true the locator will prioritize results within the current map extent.
  "searchExtent": false,
  "searchLayers":[{
      "id": "",
      "fields": []
  }],
  "hideNotesLayerPopups": true,
  "enableInstagram": true,
  "instagramVisible": false,
  "instagramTime": "",
  "enableFlickr": true,
  "flickrVisible": false,
  "flickrSearch": "",
  "flickrTime": "",
  "enableTwitter": true,
  "twitterVisible": false,
  "twitterSearch": "",
  "enableWebcams": true,
  "webcamsVisible": false,
  "enableYouTube": true,
  "youtubeVisible": false,
  "youtubeSearch": "",
  "youtubeTime": "all_time", // today, this_week, this_month, all_time
  "bitlyLogin": "arcgis",
  "bitlyKey": "R_b8a169f3a8b978b9697f64613bf1db6d",
  "twitterUrl": location.protocol + "//utility.arcgis.com/tproxy/proxy/1.1/search/tweets.json",
  "twitterSigninUrl": location.protocol + "//utility.arcgis.com/tproxy/signin",
  "flickr_key": "404ebea7d5bc27aa5251d1207620e99b",
  "webcams_key": "65939add1ebe8bc9cc4180763f5df2ca",
  "instagram_key": "288c36a1a42c49de9a2480a05d054619",
  "youtube_key": "AIzaSyBvrlsx50mxX_W-Ra2cJ8PB0jKt0jACZfg",
  //Enter the url to your organizations bing maps key if you want to use bing basemaps
  "bingmapskey": "",
  //Defaults to arcgis.com. Set this value to your portal or organization host name.
  "sharinghost": location.protocol + "//" + "www.arcgis.com",
  //When true the template will query arcgis.com for default settings for helper services, units etc. If you
  "units": null,
  "helperServices": {
    "geometry": {
      "url": "//utility.arcgisonline.com/arcgis/rest/services/Geometry/GeometryServer"
    }
  }
});


text:
package mod.bedrock.rtap.items;

import java.util.List;

import mod.bedrock.rtap.Reference;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemFood;
import net.minecraft.item.ItemStack;

public class foodRamenCooked extends ItemFood {

	public foodRamenCooked() {

		super(4, .5F, false);

		setUnlocalizedName(Reference.RTAPItems.FOODRAMENCOOKED.getUnlocalizedName());
		setRegistryName(Reference.RTAPItems.FOODRAMENCOOKED.getRegistryName());
		setCreativeTab(Reference.tabRTAP);

	}

}


text:
namespace toolbox
{

template<typename T, unsigned int N>
class stack
{
public:
    using value_type = T;
    using reference = const T&;
    using const_reference = const T&;
    using iterator = const T*;
    using const_iterator = const T*;
    using size_type = unsigned int;

    void push_back(const T& element) {
        buffer_.construct(top_, element);
        top_ ++;
    }

    template<typename... Args>
    void emplace_back(Args... args) {
        buffer_.construct(top_, args...);
        top_ ++;
    }

    void pop_back() {
        top_ --;
        buffer_.destruct(top_);
    }

    reference back() {
        return buffer_.at(top_ - 1);
    }

    iterator begin() {
        return &buffer_[0];
    }

    iterator end() {
        return &buffer_[top_];
    }

    size_type size() const {
        return top_;
    }

    constexpr size_type capacity() const {
        return N;
    }

private:
    toolbox::uninitialized_array<T, N> buffer_;
    unsigned int top_ = 0;
};

} // namespace toolbox

#endif // _TOOLBOX_CONTAINER_STACK_HPP_


text:
.confirmation-modal .modal-header {
	background-color: #3F3F3F !important;
	border-bottom: 1px solid #e5e5e5;
	color: #F5F5F5 !important;
	min-height: 30px !important;
	padding: 5px 10px !important;
}

.confirmation-modal .modal-dialog {
	width: 400px !important;
}

.confirmation-modal .modal-body {
	padding: 10px !important;
}

.confirmation-modal .modal-content {
	border-radius: 0px !important;
}

.confirmation-modal .modal-footer {
	padding: 9px 20px 10px !important;
}


text:
This template provisions a Jenkins master running in a VM on Azure; configures a DevOps pipeline based on
two public Tomcat Docker images and deploys to [AKS (Azure Container Service)](https://azure.microsoft.com/en-us/services/container-service/).
It is an example to demonstrate how we can use Jenkins pipeline to do zero-downtime deployment on AKS.

The quickstart template will provision the following resources in Azure:

* A Jenkins master running on a Linux Ubuntu 16.04 LTS VM in Azure. The instance is pre-configured with
   the Azure Service Principal credential you provide. This credential is used to manage the Azure resources.
* An AKS cluster, with the following resources:
   * For blue/green deployment demonstration:
      * Two similar deployments representing the environment **blue** and **green**. Both are initially setup with the
         `tomcat:7` image.
      * Two test endpoint service (`tomcat-test-blue` and `tomcat-test-green`), which are connected to the corresponding
         deployments, and can be use to test if the deployments are ready for production use.
      * A production service endpoint (`tomcat-service`) which represents the public endpoint that the users will access.
         Initially it is routing to the **blue** environment.

         We call the environment that is serving the public traffic the **active** environment (initially "blue"), and
         the other one "**inactive**" or "**staging**".
   * For RollingUpdate deployment demonstration:
      * A deployment `tomcat-deployment-rolling-update` with 2 replicas and using the `RollingUpdate` strategy.
      * A service endpoint `tomcat-service-rolling` for public access to the Tomcat service in the deployment.
* A basic pipeline that demonstrates the steps to do blue/green deployment to Kubernetes:
   1. Ask for the Tomcat image version (`7`, `8`, or `9`) to be deployed.

      (In real world project, we can configure an upstream job to build the image, and feed the image name & tag to the
      deployment job.)

   1. Deploy the Tomcat image to the inactive environment.
   1. Verify that the inactive environment is working as expected through the test endpoint.
   1. Update the application public endpoint to route the traffic to inactive environment, after that it becomes active.
   1. Verify that the public endpoint is working properly with the updated backend environment.
* A basic pipieline that demonstrates the rolling update deployment to Kubernetes.

   ***Note***: As the rolling-update process is pretty straight forward, we do not provide further instructions on it.
   You can check the **AKS Rolling Update Deployment** job in Jenkins after the quickstart template deployment finishes,
   and try to build the Job.

**Note**: At the time when this quickstart is created, AKS is in preview. You may need to enable the preview
for your Azure subscription. Please refer to https://docs.microsoft.com/en-us/azure/aks/kubernetes-walkthrough#enabling-aks-preview-for-your-azure-subscription
for more details.

## How to try it out

### Prerequisites

* An Azure subscription.
* An Azure Service Principal to manage the related Azure resources.
* An SSH key pair that will be used to login remotely to the Jenkins master VM.

### Steps

1. Click the **Deploy to Azure** button from above, this will lead you to the ARM provision page.
1. Fill in the parameters, agree to the terms & conditions and click Purchase. It takes about 20 minutes
   for the provision process to complete. Once the deployment is complete, the resource group contains
   all resources for the Jenkins master and the AKS cluster:

   ![Resource List](images/resource-list.png)

1. Check in the resource group, then then click `Deployments` to find the latest deployment with the name
   `Microsoft.Template`, the following details will be displayed in the *Outputs* section:
   * `ADMIN_USERNAME`: The Admin username for the Jenkins master VM, which is the one you filled in the provision page
   * `JENKINS_VM_FQDN`: The host name of the Jenkins master VM
   * `JENKINS_URL`: The Jenkins URL
   * `SSH`: The SSH command to create a tunnel through which you can login and manage the Jenkins instance
      securely
   * `KUBERNETES_MASTER_FQDN`: The host name of the ACS Kubernetes master node
1. Run the command listed in the `SSH` box. Check the Jenkins admin password by running the following command
   in the SSH session:

   ```sh
   sudo cat /var/lib/jenkins/secrets/initialAdminPassword
   ```

1. Visit http://localhost:8080, login with the admin password.
1. Follow the instructions to setup the Jenkins instance.
1. You can access the AKS cluster by doing the following from your local machine.

   > **Note**: 	You need Azure CLI version 2.0.25 or later for AKS.
   > Refer to https://docs.microsoft.com/en-us/cli/azure/install-azure-cli?view=azure-cli-latest#update-the-cli
   > if you need to update your installation.

   In command line:

   ```sh
   az login
   az aks get-credentials \
       --resource-group <yourResourceGroup> \
       --name aks \
       --admin
   ```

   To verify the connection to your cluster, use the `kubectl get` command.

   ![kubectl get](images/kubectl-get.png)

   ```sh
   kubectl proxy
   ```

   Type http://localhost:8001/ui in your browser to get to the Kubernetes Web UI (Dashboard.) You should be able
   to see the deployments:

   ![Kubernetes Deployments](images/kubernetes-deployments.png)

   and the service endpoints:

   ![Service Endpoints](images/k8s-tomcat-service.png)

   Click the the external endpoint for the `tomcat-service`, you'll see the Tomcat 7 landing page:

   ![Tomcat 7 Landing Page](images/tomcat-7.png)

   You can also check the external endpoints for `tomcat-test-blue` and `tomcat-test-green`. Both of them show
   the same Tomcat 7 landing page initially.

   ***Note***: In recent version of Kubernetes, the dashboard UI redirection seems to be broken. If you see
   blank page after the server redirection, add a trailing slash `/` to the redirected address in the
   address bar.

1. Go back to your Jenkins master dashboard, you should see a job **AKS Kubernetes Blue/green Deployment**.
1. Click the job, on the left panel click **Build with Parameters**, Choose a Tomcat version that is to be rolled
   into production. Initially, both the blue and green environments were setup with the version `7`,
   so we can try `8` or `9`.
1. Start the build.
1. When the Jenkins job finishes, verify the new Tomcat version has been deployed and enabled through to the public
   service endpoint, click the external endpoint for `tomcat-service`. The version shown is Tomcat/8.X.X.

   ![Tomcat 8 Landing Page](images/tomcat-8.png)

   Check the `role` label for `tomcat-service`, this indicates which environment is the current active one.
   Go to the external endpoint for that environment and you should see the same version of Tomcat landing page.

1. If you run the build more than once, it will cycle through BLUE and GREEN deployments. i.e., if the current
   environment is **Green**, the job will deploy/test the **Blue** environment and then update the application
   public endpoint to route traffic to the **Blue** environment if all is good with testing.


text:
#ifndef __openma_body_skeletonhelperposeestimator_h
#define __openma_body_skeletonhelperposeestimator_h

#include "openma/body/poseestimator.h"

namespace ma
{
namespace body
{
  class OPENMA_BODY_EXPORT SkeletonHelperPoseEstimator : public PoseEstimator
  {
    OPENMA_DECLARE_NODEID(SkeletonHelperPoseEstimator, PoseEstimator)

  public:
    SkeletonHelperPoseEstimator(const std::string& name, Node* parent = nullptr);
    ~SkeletonHelperPoseEstimator() _OPENMA_NOEXCEPT;

    SkeletonHelperPoseEstimator(const SkeletonHelperPoseEstimator& ) = delete;
    SkeletonHelperPoseEstimator(SkeletonHelperPoseEstimator&& ) _OPENMA_NOEXCEPT = delete;
    SkeletonHelperPoseEstimator& operator=(const SkeletonHelperPoseEstimator& ) = delete;
    SkeletonHelperPoseEstimator& operator=(SkeletonHelperPoseEstimator&& ) _OPENMA_NOEXCEPT = delete;

    virtual bool run(Model* output, SkeletonHelper* helper, Trial* trial) final;
  };
};
};

OPENMA_EXPORT_STATIC_TYPEID(ma::body::SkeletonHelperPoseEstimator, OPENMA_BODY_EXPORT);

#endif // __openma_body_skeletonhelperposeestimator_h


text:
package org.openchai.spark.p2p

import java.io.{ByteArrayOutputStream, ObjectOutputStream}

object TcpCommon {
  def serialize(a: Any): Array[Byte] = {
    // TODO: determine how to properly size the bos
    val bos = new ByteArrayOutputStream(2 ^ 18)
    val oos = new ObjectOutputStream(bos)
    oos.writeObject(a)
    bos.toByteArray
  }

  def deserialize(a: Array[Byte]): Any = {
    import java.io._
    // TODO: determine how to properly size the bos
    val bis = new ByteArrayInputStream(a)
    val ois = new ObjectInputStream(bis)
    ois.readObject
  }

}


text:
package collegepal.himanshu.integration.test;

import static org.junit.Assert.*;

import java.util.Collection;

import himanshu.user.client.UserClientApi;
import himanshu.user.repository.User;

import org.junit.Test;
import collegepal.himanshu.data.TestDataUser;

import retrofit.RequestInterceptor;
import retrofit.RestAdapter;
import retrofit.RequestInterceptor.RequestFacade;
import retrofit.RestAdapter.LogLevel;

/**
*
*@author himanshu
*/

public class UserClientApiFindTest {

	private final String URL = "http://localhost:8080";

	private UserClientApi UserService = new RestAdapter.Builder()
	.setEndpoint(URL).setLogLevel(LogLevel.FULL).build()
			.create(UserClientApi.class);

	@Test
	public void testFindUser() throws Exception {

		Collection<User> users = UserService.findByEmailIdIgnoreCase("himanshu1449@iiitd.ac.in");
		Collection<User> allUsers = UserService.getUserList();
		assertTrue(allUsers.contains(users));
	}

}


text:
"""
Test backend for django-rcsfield.
"""

# importing like this needs a django settings.py:
#from rcsfield.backends.base import BaseBackend
# this works without if we just want to run the doctests in this file:
from base import BaseBackend

class NoSuchRevision(Exception):
    pass

class VersionizedDict(dict):
    """
    A dict which will hold a list for every key.

    >>> d = VersionizedDict()
    >>> d['a'] = 'Hallo'
    >>> d['a'] = 'Hallo Welt'
    >>> d['a'] = 'Hallo Welt!'
    >>> d['B'] = [1,2,3]
    >>> d['B'] = [1,2]
    >>> d['B'] = [1]
    >>> d
    <VersionizedDict at rev 6 with keys: ['a', 'B']>
    >>> d['a']
    'Hallo Welt!'
    >>> d['B']
    [1]
    >>> d.get('a')
    'Hallo Welt!'
    >>> d.get('a', rev=6)
    'Hallo Welt!'
    >>> d.get('a', rev=5)
    'Hallo Welt!'
    >>> d.get('a', rev=2)
    'Hallo Welt'
    >>> d.get('a', rev=0)
    >>> d.get('B', rev=0)
    >>> d.get('B', rev=1)
    Traceback (most recent call last):
    ...
    NoSuchRevision
    >>> d.get('B', rev=1, default='X')
    'X'
    >>> d.get_revs_for_key('a')
    [1, 2, 3]
    >>> d.get_revs_for_key('B')
    [4, 5, 6]
    """
    def __init__(self, data=()):
        self.rev = 0
        self.history = []
        super(VersionizedDict, self).__init__(data)

    def __repr__(self):
        return "<%s at rev %s with keys: %s>" % (self.__class__.__name__,
                            self.rev, self.keys())

    def __getitem__(self, key):
        list_ = super(VersionizedDict, self).__getitem__(key)
        try:
            return list_[0]
        except IndexError:
            return None

    def __setitem__(self, key, value):
        try:
            list_ = super(VersionizedDict, self).__getitem__(key)
            list_.insert(0, value)
        except KeyError:
            list_ = [value,]
        self.rev += 1
        self.history.append({'key': key, 'index': len(list_)-1})
        assert len(self.history) == self.rev
        return super(VersionizedDict, self).__setitem__(key, list_)

    def get(self, key, default=None, rev=None):
        if rev is None:
            return self.__getitem__(key)
        elif rev is 0:
            return default
        else:
            if rev > self.rev:
                raise NoSuchRevision

            list_ = super(VersionizedDict, self).__getitem__(key)
            try:
                changes = reversed(self.history[:rev])
                for change in changes:
                    if change['key'] == key:
                        try:
                            return list(reversed(list_))[change['index']]
                        except IndexError:
                            raise NoSuchRevision
            except IndexError:
                raise NoSuchRevision

            if default is not None:
                return default
            raise NoSuchRevision

    def get_revs_for_key(self, key):
        return [i+1 for i,v in enumerate(self.history) if v['key'] == key]

class TestBackend(BaseBackend):
    """
    Rcsfield backend used for testing.

    """
    def __init__(self):
        """
        Set up a testrepo
        """
        self.repo = VersionizedDict()
        from django.conf import settings
        self.location = settings.MEDIA_ROOT

    def initial(self, prefix):
        self.repo = VersionizedDict()

    def fetch(self, key, rev):
        """
        fetch revision ``rev`` of entity identified by ``key``.

        """
        try:
            rev = int(rev)
        except:
            pass
        return self.repo.get(key, rev=rev)

    def commit(self, key, data):
        """
        commit changed ``data`` to the entity identified by ``key``.

        """
        try:
            old = self.repo[key]
        except KeyError:
            old = ''
        if data != old:
            self.repo[key] = data

    def get_revisions(self, key):
        """
        returns a list with all revisions at which ``key`` was changed.
        Revision Numbers are integers starting at 1.

        """
        return list(reversed(self.repo.get_revs_for_key(key)))

    def move(self, key_from, key_to):
        raise NotImplementedError, "The test-backend doesn't allow moving of keys"

rcs = TestBackend()

if __name__ == '__main__':
    import doctest
    doctest.testmod()


text:
<?xml version="1.0" encoding="UTF-8"?>
<CustomFieldTranslation xmlns="http://soap.sforce.com/2006/04/metadata">
    <name>Exclude_from_Household_Formal_Greeting__c</name>
    <help>Actualment, aquest camp no està relacionat amb la funcionalitat del producte.</help>
    <label>Exclou de la salutació formal de la llar</label>
</CustomFieldTranslation>


text:
<?php

namespace StartupPalace\Maki\Tests;

use Illuminate\Foundation\Testing\DatabaseMigrations;
use StartupPalace\Maki\Contracts\MenuItemInterface;
use StartupPalace\Maki\Link;
use StartupPalace\Maki\Menu;
use StartupPalace\Maki\MenuItem;

class MenusTest extends TestCase
{
    use DatabaseMigrations;

    public function testMenuConfig()
    {
        $menu = $this->newMenu();

        $this->assertEquals(['template' => 'menus.aside'], $menu->getConfig());
        $this->assertEquals('menus.aside', $menu->getConfig('template'));
        $this->assertEquals('maki.menus.aside', $menu->getTemplateName());
    }

    public function testMenuMenuItemRelation()
    {
        list($menu) = $this->createMenuWithMenuItem();

        $this->assertNotEmpty($menu->menuItems);
    }

    public function testMenuItemParentRelation()
    {
        list($menu, $menuItem) = $this->createMenuWithMenuItem();

        $link = Link::create([
            'text' => 'Another link',
            'title' => 'Another link',
            'url' => 'https://github.com/startup-palace',
        ]);

        $childMenuItem = new MenuItem([
            'title' => 'My child item',
            'link_id' => $link->id,
        ]);
        $childMenuItem->parent()->associate($menuItem);
        $childMenuItem->save();

        $this->assertNotEmpty($menu->menuItems->first()->menuItems);
    }

    public function testRendering()
    {
        list($menu, $menuItem) = $this->createMenuWithMenuItem();

        $this->assertContains('A link', (string) $menu->render());

        $link = Link::create([
            'text' => 'A link',
            'title' => 'A link',
            'url' => 'https://github.com/startup-palace',
        ]);

        $subItem = $this->newMenuItem($link, 'Github');
        $subItem->parent()->associate($menuItem);
        $subItem->save();

        $menu->refresh();

        $this->assertContains('Github', (string) $menu->render());
    }

    protected function createMenuWithMenuItem() : array
    {
        $menu = $this->createMenu();

        $link = Link::create([
            'text' => 'A link',
            'title' => 'A link',
            'url' => 'https://github.com',
        ]);

        $menuItem = $this->newMenuItem($link);
        $menuItem->parent()->associate($menu);
        $menuItem->save();

        return [$menu, $menuItem, $link];
    }

    protected function createMenu() : Menu
    {
        $menu = $this->newMenu();
        $menu->save();

        return $menu;
    }

    protected function newMenu() : Menu
    {
        return new Menu([
            'title' => 'My menu',
            'slug' => 'my-menu',
            'description' => 'The description of my menu',
            'type' => 'aside',
        ]);
    }

    protected function newMenuItem(Link $link, $title = '', MenuItem $parent = null) : MenuItem
    {
        return new MenuItem([
            'title' => $title,
            'link_id' => $link->id,
        ]);
    }
}


text:
import { R, run, constants, log, printTitle, time } from '../../common';

export const name = 'run';
export const group = 'dev';
export const alias = 'r';
export const description = 'Run the given command on all modules.';
export const args = {
	'[script]': 'The name of the NPM script to run',
	'--test, -t':
		'Flag indicating if a test run should be performed (default: false).',
};

export async function cmd(args: {
	params: string[];
	options: {
		test?: boolean;
		t?: boolean;
	};
}) {
	// Setup initial conditions.
	const startedAt = time.timer();
	const isTest = args.options.test || args.options.t || false;

	const formatScript = (text: string): string => {
		switch (text.trim()) {
			case 'l':
				return 'lint';
			case 'b':
				return 'build';
			case 'pp':
				return 'prepublish';
			case 'npp':
				return 'prepublish';
			default:
				return text;
		}
	};

	// Determine the script to run.
	const script = formatScript(args.params.join(' '));
	const isScriptName = !(
		script.startsWith('npm ') || script.startsWith('yarn ')
	);
	const cmd = isScriptName ? `yarn run ${script}` : script;
	if (R.isEmpty(script)) {
		log.error('Please specify a yarn script to run.\n');
		return;
	}
	printTitle(`Running ${log.magenta(cmd)}`);

	// Retrieve the list of modules that have tests.
	const modules = constants.MODULE_DIRS
		.toPackageObjects()
		.filter(pkg => (isScriptName ? pkg.hasScript(script) : true));
	await run.execOn(modules, cmd, { isConcurrent: true }).listr.run();

	if (modules.length === 0) {
		log.info.gray(`No modules with the script ${log.magenta(script)}.\n`);
	}

	// Finish up.
	log.info.gray(`\n${startedAt.elapsed()} elapsed.`);
}