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

#include "umc_vp9_dec_defs.h"

#ifdef MFX_ENABLE_VP9_VIDEO_DECODE

#include "umc_vp9_va_packer.h"
#include "umc_vp9_bitstream.h"
#include "umc_vp9_frame.h"
#include "umc_vp9_utils.h"
#include "mfx_session.h"

using namespace UMC;

namespace UMC_VP9_DECODER
{

Packer * Packer::CreatePacker(UMC::VideoAccelerator * va)
{
    Packer * packer = 0;

    packer = new PackerVA(va);

    return packer;
}

Packer::Packer(UMC::VideoAccelerator * va)
    : m_va(va)
{}

Packer::~Packer()
{}

/****************************************************************************************************/
// VA linux packer implementation
/****************************************************************************************************/
PackerVA::PackerVA(VideoAccelerator * va)
    : Packer(va)
{}

Status PackerVA::GetStatusReport(void * , size_t )
{
    return UMC_OK;
}

void PackerVA::BeginFrame()
{ /* nothing to do here*/ }

void PackerVA::EndFrame()
{ /* nothing to do here*/ }

void PackerVA::PackAU(VP9Bitstream* bs, VP9DecoderFrame const* info)
{
    if (!bs || !info)
        throw vp9_exception(MFX_ERR_NULL_PTR);

    UMC::UMCVACompBuffer* pCompBuf = nullptr;
    VADecPictureParameterBufferVP9 *picParam =
        (VADecPictureParameterBufferVP9*)m_va->GetCompBuffer(VAPictureParameterBufferType, &pCompBuf, sizeof(VADecPictureParameterBufferVP9));

    if (!picParam)
        throw vp9_exception(MFX_ERR_MEMORY_ALLOC);

    memset(picParam, 0, sizeof(VADecPictureParameterBufferVP9));
    PackPicParams(picParam, info);

    pCompBuf = nullptr;
    VASliceParameterBufferVP9 *sliceParam =
        (VASliceParameterBufferVP9*)m_va->GetCompBuffer(VASliceParameterBufferType, &pCompBuf, sizeof(VASliceParameterBufferVP9));
    if (!sliceParam)
        throw vp9_exception(MFX_ERR_MEMORY_ALLOC);

    memset(sliceParam, 0, sizeof(VASliceParameterBufferVP9));
    PackSliceParams(sliceParam, info);

    uint8_t* data;
    uint32_t length;
    bs->GetOrg(&data, &length);
    uint32_t const offset = bs->BytesDecoded();
    length -= offset;

    pCompBuf = nullptr;
    mfxU8 *bistreamData = (mfxU8*)m_va->GetCompBuffer(VASliceDataBufferType, &pCompBuf, length);
    if (!bistreamData)
        throw vp9_exception(MFX_ERR_MEMORY_ALLOC);

    std::copy(data + offset, data + offset + length, bistreamData);
    pCompBuf->SetDataSize(length);

    if(m_va->m_MaxContextPriority)
        PackPriorityParams();
}

void PackerVA::PackPriorityParams()
{
    mfxPriority priority = m_va->m_ContextPriority;
    UMCVACompBuffer *GpuPriorityBuf;
    VAContextParameterUpdateBuffer* GpuPriorityBuf_Vp9Decode = (VAContextParameterUpdateBuffer *)m_va->GetCompBuffer(VAContextParameterUpdateBufferType, &GpuPriorityBuf, sizeof(VAContextParameterUpdateBuffer));
    if (!GpuPriorityBuf_Vp9Decode)
        throw vp9_exception(MFX_ERR_MEMORY_ALLOC);

    memset(GpuPriorityBuf_Vp9Decode, 0, sizeof(VAContextParameterUpdateBuffer));
    GpuPriorityBuf_Vp9Decode->flags.bits.context_priority_update = 1;

    if(priority == MFX_PRIORITY_LOW)
    {
        GpuPriorityBuf_Vp9Decode->context_priority.bits.priority = 0;
    }
    else if (priority == MFX_PRIORITY_HIGH)
    {
        GpuPriorityBuf_Vp9Decode->context_priority.bits.priority = m_va->m_MaxContextPriority;
    }
    else
    {
    GpuPriorityBuf_Vp9Decode->context_priority.bits.priority = m_va->m_MaxContextPriority/2;
    }

    GpuPriorityBuf->SetDataSize(sizeof(VAContextParameterUpdateBuffer));
}

void PackerVA::PackPicParams(VADecPictureParameterBufferVP9* picParam, VP9DecoderFrame const* info)
{
    VM_ASSERT(picParam);
    VM_ASSERT(info);

    picParam->frame_width = info->width;
    picParam->frame_height = info->height;

    if (KEY_FRAME == info->frameType)
        memset(picParam->reference_frames, VA_INVALID_SURFACE, sizeof(picParam->reference_frames));
    else
    {
        for (mfxU8 ref = 0; ref < NUM_REF_FRAMES; ++ref)
        {
            if (info->ref_frame_map[ref] != VP9_INVALID_REF_FRAME)
            {
                picParam->reference_frames[ref] = m_va->GetSurfaceID(info->ref_frame_map[ref]);
            }
            else
            {
                picParam->reference_frames[ref] = VA_INVALID_SURFACE;
            }
        }
    }

    picParam->pic_fields.bits.subsampling_x = info->subsamplingX;
    picParam->pic_fields.bits.subsampling_y = info->subsamplingY;
    picParam->pic_fields.bits.frame_type = info->frameType;
    picParam->pic_fields.bits.show_frame = info->showFrame;
    picParam->pic_fields.bits.error_resilient_mode = info->errorResilientMode;
    picParam->pic_fields.bits.intra_only = info->intraOnly;
    picParam->pic_fields.bits.allow_high_precision_mv = info->allowHighPrecisionMv;
    picParam->pic_fields.bits.mcomp_filter_type = info->interpFilter;
    picParam->pic_fields.bits.frame_parallel_decoding_mode = info->frameParallelDecodingMode;
    picParam->pic_fields.bits.reset_frame_context = info->resetFrameContext;
    picParam->pic_fields.bits.refresh_frame_context = info->refreshFrameContext;
    picParam->pic_fields.bits.frame_context_idx = info->frameContextIdx;
    picParam->pic_fields.bits.segmentation_enabled = info->segmentation.enabled;
    picParam->pic_fields.bits.segmentation_temporal_update = info->segmentation.temporalUpdate;
    picParam->pic_fields.bits.segmentation_update_map = info->segmentation.updateMap;

    {
        picParam->pic_fields.bits.last_ref_frame = info->activeRefIdx[0];
        picParam->pic_fields.bits.last_ref_frame_sign_bias = info->refFrameSignBias[LAST_FRAME];
        picParam->pic_fields.bits.golden_ref_frame = info->activeRefIdx[1];
        picParam->pic_fields.bits.golden_ref_frame_sign_bias = info->refFrameSignBias[GOLDEN_FRAME];
        picParam->pic_fields.bits.alt_ref_frame = info->activeRefIdx[2];
        picParam->pic_fields.bits.alt_ref_frame_sign_bias = info->refFrameSignBias[ALTREF_FRAME];
    }
    picParam->pic_fields.bits.lossless_flag = info->lossless;

    picParam->filter_level = info->lf.filterLevel;
    picParam->sharpness_level = info->lf.sharpnessLevel;
    picParam->log2_tile_rows = info->log2TileRows;
    picParam->log2_tile_columns = info->log2TileColumns;
    picParam->frame_header_length_in_bytes = info->frameHeaderLength;
    picParam->first_partition_size = info->firstPartitionSize;

    for (mfxU8 i = 0; i < VP9_NUM_OF_SEGMENT_TREE_PROBS; ++i)
        picParam->mb_segment_tree_probs[i] = info->segmentation.treeProbs[i];

    for (mfxU8 i = 0; i < VP9_NUM_OF_PREDICTION_PROBS; ++i)
        picParam->segment_pred_probs[i] = info->segmentation.predProbs[i];

    picParam->profile = info->profile;
    picParam->bit_depth = info->bit_depth;
}

void PackerVA::PackSliceParams(VASliceParameterBufferVP9* sliceParam, VP9DecoderFrame const* info)
{
    VM_ASSERT(sliceParam);
    VM_ASSERT(info);

    sliceParam->slice_data_size = info->frameDataSize;
    sliceParam->slice_data_offset = 0;
    sliceParam->slice_data_flag = VA_SLICE_DATA_FLAG_ALL;

    for (mfxU8 segmentId = 0; segmentId < VP9_MAX_NUM_OF_SEGMENTS; ++segmentId)
    {
        sliceParam->seg_param[segmentId].segment_flags.fields.segment_reference_enabled = !!(info->segmentation.featureMask[segmentId] & (1 << SEG_LVL_REF_FRAME));

        sliceParam->seg_param[segmentId].segment_flags.fields.segment_reference =
            GetSegData(info->segmentation, segmentId, SEG_LVL_REF_FRAME);

        sliceParam->seg_param[segmentId].segment_flags.fields.segment_reference_skipped = !!(info->segmentation.featureMask[segmentId] & (1 << SEG_LVL_SKIP));

        for (mfxU8 ref = INTRA_FRAME; ref < MAX_REF_FRAMES; ++ref)
            for (mfxU8 mode = 0; mode < MAX_MODE_LF_DELTAS; ++mode)
                sliceParam->seg_param[segmentId].filter_level[ref][mode] = info->lf_info.level[segmentId][ref][mode];

        const mfxI32 qIndex = GetQIndex(info->segmentation, segmentId, info->baseQIndex);
        if (qIndex < 0)
            throw vp9_exception(MFX_ERR_UNDEFINED_BEHAVIOR);

        sliceParam->seg_param[segmentId].luma_ac_quant_scale = info->yDequant[qIndex][1];
        sliceParam->seg_param[segmentId].luma_dc_quant_scale = info->yDequant[qIndex][0];
        sliceParam->seg_param[segmentId].chroma_ac_quant_scale = info->uvDequant[qIndex][1];
        sliceParam->seg_param[segmentId].chroma_dc_quant_scale = info->uvDequant[qIndex][0];
    }
}

} // namespace UMC_HEVC_DECODER

#endif // MFX_ENABLE_VP9_VIDEO_DECODE


text:
// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: google/cloud/dataproc/v1/clusters.proto

package com.google.cloud.dataproc.v1;

public interface NodeInitializationActionOrBuilder
    extends
    // @@protoc_insertion_point(interface_extends:google.cloud.dataproc.v1.NodeInitializationAction)
    com.google.protobuf.MessageOrBuilder {

  /**
   *
   *
   *

   * Required. Cloud Storage URI of executable file.
   *

   *
   * string executable_file = 1;
   */
  java.lang.String getExecutableFile();
  /**
   *
   *
   *

   * Required. Cloud Storage URI of executable file.
   *

   *
   * string executable_file = 1;
   */
  com.google.protobuf.ByteString getExecutableFileBytes();

  /**
   *
   *
   *

   * Optional. Amount of time executable has to complete. Default is
   * 10 minutes. Cluster creation fails with an explanatory error message (the
   * name of the executable that caused the error and the exceeded timeout
   * period) if the executable is not completed at end of the timeout period.
   *

   *
   * .google.protobuf.Duration execution_timeout = 2;
   */
  boolean hasExecutionTimeout();
  /**
   *
   *
   *

   * Optional. Amount of time executable has to complete. Default is
   * 10 minutes. Cluster creation fails with an explanatory error message (the
   * name of the executable that caused the error and the exceeded timeout
   * period) if the executable is not completed at end of the timeout period.
   *

   *
   * .google.protobuf.Duration execution_timeout = 2;
   */
  com.google.protobuf.Duration getExecutionTimeout();
  /**
   *
   *
   *

   * Optional. Amount of time executable has to complete. Default is
   * 10 minutes. Cluster creation fails with an explanatory error message (the
   * name of the executable that caused the error and the exceeded timeout
   * period) if the executable is not completed at end of the timeout period.
   *

   *
   * .google.protobuf.Duration execution_timeout = 2;
   */
  com.google.protobuf.DurationOrBuilder getExecutionTimeoutOrBuilder();
}

redpajama_set_name: RedPajamaGithub


text:
#include <aws/gamelift/model/GameSessionPlacement.h>
#include <aws/core/utils/json/JsonSerializer.h>

#include <utility>

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

namespace Aws
{
namespace GameLift
{
namespace Model
{

GameSessionPlacement::GameSessionPlacement() :
    m_placementIdHasBeenSet(false),
    m_gameSessionQueueNameHasBeenSet(false),
    m_status(GameSessionPlacementState::NOT_SET),
    m_statusHasBeenSet(false),
    m_gamePropertiesHasBeenSet(false),
    m_maximumPlayerSessionCount(0),
    m_maximumPlayerSessionCountHasBeenSet(false),
    m_gameSessionNameHasBeenSet(false),
    m_gameSessionIdHasBeenSet(false),
    m_gameSessionArnHasBeenSet(false),
    m_gameSessionRegionHasBeenSet(false),
    m_playerLatenciesHasBeenSet(false),
    m_startTimeHasBeenSet(false),
    m_endTimeHasBeenSet(false),
    m_ipAddressHasBeenSet(false),
    m_dnsNameHasBeenSet(false),
    m_port(0),
    m_portHasBeenSet(false),
    m_placedPlayerSessionsHasBeenSet(false),
    m_gameSessionDataHasBeenSet(false),
    m_matchmakerDataHasBeenSet(false)
{
}

GameSessionPlacement::GameSessionPlacement(JsonView jsonValue) :
    m_placementIdHasBeenSet(false),
    m_gameSessionQueueNameHasBeenSet(false),
    m_status(GameSessionPlacementState::NOT_SET),
    m_statusHasBeenSet(false),
    m_gamePropertiesHasBeenSet(false),
    m_maximumPlayerSessionCount(0),
    m_maximumPlayerSessionCountHasBeenSet(false),
    m_gameSessionNameHasBeenSet(false),
    m_gameSessionIdHasBeenSet(false),
    m_gameSessionArnHasBeenSet(false),
    m_gameSessionRegionHasBeenSet(false),
    m_playerLatenciesHasBeenSet(false),
    m_startTimeHasBeenSet(false),
    m_endTimeHasBeenSet(false),
    m_ipAddressHasBeenSet(false),
    m_dnsNameHasBeenSet(false),
    m_port(0),
    m_portHasBeenSet(false),
    m_placedPlayerSessionsHasBeenSet(false),
    m_gameSessionDataHasBeenSet(false),
    m_matchmakerDataHasBeenSet(false)
{
  *this = jsonValue;
}

GameSessionPlacement& GameSessionPlacement::operator =(JsonView jsonValue)
{
  if(jsonValue.ValueExists("PlacementId"))
  {
    m_placementId = jsonValue.GetString("PlacementId");

    m_placementIdHasBeenSet = true;
  }

  if(jsonValue.ValueExists("GameSessionQueueName"))
  {
    m_gameSessionQueueName = jsonValue.GetString("GameSessionQueueName");

    m_gameSessionQueueNameHasBeenSet = true;
  }

  if(jsonValue.ValueExists("Status"))
  {
    m_status = GameSessionPlacementStateMapper::GetGameSessionPlacementStateForName(jsonValue.GetString("Status"));

    m_statusHasBeenSet = true;
  }

  if(jsonValue.ValueExists("GameProperties"))
  {
    Aws::Utils::Array<JsonView> gamePropertiesJsonList = jsonValue.GetArray("GameProperties");
    for(unsigned gamePropertiesIndex = 0; gamePropertiesIndex < gamePropertiesJsonList.GetLength(); ++gamePropertiesIndex)
    {
      m_gameProperties.push_back(gamePropertiesJsonList[gamePropertiesIndex].AsObject());
    }
    m_gamePropertiesHasBeenSet = true;
  }

  if(jsonValue.ValueExists("MaximumPlayerSessionCount"))
  {
    m_maximumPlayerSessionCount = jsonValue.GetInteger("MaximumPlayerSessionCount");

    m_maximumPlayerSessionCountHasBeenSet = true;
  }

  if(jsonValue.ValueExists("GameSessionName"))
  {
    m_gameSessionName = jsonValue.GetString("GameSessionName");

    m_gameSessionNameHasBeenSet = true;
  }

  if(jsonValue.ValueExists("GameSessionId"))
  {
    m_gameSessionId = jsonValue.GetString("GameSessionId");

    m_gameSessionIdHasBeenSet = true;
  }

  if(jsonValue.ValueExists("GameSessionArn"))
  {
    m_gameSessionArn = jsonValue.GetString("GameSessionArn");

    m_gameSessionArnHasBeenSet = true;
  }

  if(jsonValue.ValueExists("GameSessionRegion"))
  {
    m_gameSessionRegion = jsonValue.GetString("GameSessionRegion");

    m_gameSessionRegionHasBeenSet = true;
  }

  if(jsonValue.ValueExists("PlayerLatencies"))
  {
    Aws::Utils::Array<JsonView> playerLatenciesJsonList = jsonValue.GetArray("PlayerLatencies");
    for(unsigned playerLatenciesIndex = 0; playerLatenciesIndex < playerLatenciesJsonList.GetLength(); ++playerLatenciesIndex)
    {
      m_playerLatencies.push_back(playerLatenciesJsonList[playerLatenciesIndex].AsObject());
    }
    m_playerLatenciesHasBeenSet = true;
  }

  if(jsonValue.ValueExists("StartTime"))
  {
    m_startTime = jsonValue.GetDouble("StartTime");

    m_startTimeHasBeenSet = true;
  }

  if(jsonValue.ValueExists("EndTime"))
  {
    m_endTime = jsonValue.GetDouble("EndTime");

    m_endTimeHasBeenSet = true;
  }

  if(jsonValue.ValueExists("IpAddress"))
  {
    m_ipAddress = jsonValue.GetString("IpAddress");

    m_ipAddressHasBeenSet = true;
  }

  if(jsonValue.ValueExists("DnsName"))
  {
    m_dnsName = jsonValue.GetString("DnsName");

    m_dnsNameHasBeenSet = true;
  }

  if(jsonValue.ValueExists("Port"))
  {
    m_port = jsonValue.GetInteger("Port");

    m_portHasBeenSet = true;
  }

  if(jsonValue.ValueExists("PlacedPlayerSessions"))
  {
    Aws::Utils::Array<JsonView> placedPlayerSessionsJsonList = jsonValue.GetArray("PlacedPlayerSessions");
    for(unsigned placedPlayerSessionsIndex = 0; placedPlayerSessionsIndex < placedPlayerSessionsJsonList.GetLength(); ++placedPlayerSessionsIndex)
    {
      m_placedPlayerSessions.push_back(placedPlayerSessionsJsonList[placedPlayerSessionsIndex].AsObject());
    }
    m_placedPlayerSessionsHasBeenSet = true;
  }

  if(jsonValue.ValueExists("GameSessionData"))
  {
    m_gameSessionData = jsonValue.GetString("GameSessionData");

    m_gameSessionDataHasBeenSet = true;
  }

  if(jsonValue.ValueExists("MatchmakerData"))
  {
    m_matchmakerData = jsonValue.GetString("MatchmakerData");

    m_matchmakerDataHasBeenSet = true;
  }

  return *this;
}

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

  if(m_placementIdHasBeenSet)
  {
   payload.WithString("PlacementId", m_placementId);

  }

  if(m_gameSessionQueueNameHasBeenSet)
  {
   payload.WithString("GameSessionQueueName", m_gameSessionQueueName);

  }

  if(m_statusHasBeenSet)
  {
   payload.WithString("Status", GameSessionPlacementStateMapper::GetNameForGameSessionPlacementState(m_status));
  }

  if(m_gamePropertiesHasBeenSet)
  {
   Aws::Utils::Array<JsonValue> gamePropertiesJsonList(m_gameProperties.size());
   for(unsigned gamePropertiesIndex = 0; gamePropertiesIndex < gamePropertiesJsonList.GetLength(); ++gamePropertiesIndex)
   {
     gamePropertiesJsonList[gamePropertiesIndex].AsObject(m_gameProperties[gamePropertiesIndex].Jsonize());
   }
   payload.WithArray("GameProperties", std::move(gamePropertiesJsonList));

  }

  if(m_maximumPlayerSessionCountHasBeenSet)
  {
   payload.WithInteger("MaximumPlayerSessionCount", m_maximumPlayerSessionCount);

  }

  if(m_gameSessionNameHasBeenSet)
  {
   payload.WithString("GameSessionName", m_gameSessionName);

  }

  if(m_gameSessionIdHasBeenSet)
  {
   payload.WithString("GameSessionId", m_gameSessionId);

  }

  if(m_gameSessionArnHasBeenSet)
  {
   payload.WithString("GameSessionArn", m_gameSessionArn);

  }

  if(m_gameSessionRegionHasBeenSet)
  {
   payload.WithString("GameSessionRegion", m_gameSessionRegion);

  }

  if(m_playerLatenciesHasBeenSet)
  {
   Aws::Utils::Array<JsonValue> playerLatenciesJsonList(m_playerLatencies.size());
   for(unsigned playerLatenciesIndex = 0; playerLatenciesIndex < playerLatenciesJsonList.GetLength(); ++playerLatenciesIndex)
   {
     playerLatenciesJsonList[playerLatenciesIndex].AsObject(m_playerLatencies[playerLatenciesIndex].Jsonize());
   }
   payload.WithArray("PlayerLatencies", std::move(playerLatenciesJsonList));

  }

  if(m_startTimeHasBeenSet)
  {
   payload.WithDouble("StartTime", m_startTime.SecondsWithMSPrecision());
  }

  if(m_endTimeHasBeenSet)
  {
   payload.WithDouble("EndTime", m_endTime.SecondsWithMSPrecision());
  }

  if(m_ipAddressHasBeenSet)
  {
   payload.WithString("IpAddress", m_ipAddress);

  }

  if(m_dnsNameHasBeenSet)
  {
   payload.WithString("DnsName", m_dnsName);

  }

  if(m_portHasBeenSet)
  {
   payload.WithInteger("Port", m_port);

  }

  if(m_placedPlayerSessionsHasBeenSet)
  {
   Aws::Utils::Array<JsonValue> placedPlayerSessionsJsonList(m_placedPlayerSessions.size());
   for(unsigned placedPlayerSessionsIndex = 0; placedPlayerSessionsIndex < placedPlayerSessionsJsonList.GetLength(); ++placedPlayerSessionsIndex)
   {
     placedPlayerSessionsJsonList[placedPlayerSessionsIndex].AsObject(m_placedPlayerSessions[placedPlayerSessionsIndex].Jsonize());
   }
   payload.WithArray("PlacedPlayerSessions", std::move(placedPlayerSessionsJsonList));

  }

  if(m_gameSessionDataHasBeenSet)
  {
   payload.WithString("GameSessionData", m_gameSessionData);

  }

  if(m_matchmakerDataHasBeenSet)
  {
   payload.WithString("MatchmakerData", m_matchmakerData);

  }

  return payload;
}

} // namespace Model
} // namespace GameLift
} // namespace Aws


text:
require 'spec_helper'

describe 'User model mapping' do
  let(:rom) { ROM.env }

  let(:users) { rom.read(:users) }

  before do
    rom.command(:users).try { create(name: 'Piotr') }
  end

  it 'works' do
    piotr = User.new(id: 1, name: 'Piotr')

    expect(users.by_name('Piotr').to_a).to eql([piotr])
  end
end


text:
Platform API is the base where the 6LoWPAN stack runs. It is the separation between the actual hardware or operating system and the 6LoWPAN stack itself. This is the first layer to study to port the 6LoWPAN stack to a new platform.

The most important parts of Platform API are the timers and critical section functions. These are required for the event-based stack to start up and run.

## API Headers

```
#include arm_hal_interrupt.h
#include arm_hal_timer.h
#include eventOS_scheduler.h
#include arm_hal_random.h
#include arm_hal_aes.h
```

_Table 3-1_ lists the scopes of the Platform API functions.

**Table 3-1 Scopes of Platform API functions**

Scope|API responsibility
-----|------------------
Critical section|The 6LoWPAN stack uses the Platform API to signal that a device is about to enter or exit a critical section where interruptions are not tolerated.
Functions:
platform_enter_critical()
platform_exit_critical()
Idle and sleep functions|The 6LoWPAN stack signals a possible idle or sleep condition. This part of the API is used to manage the power consumption of a processor core and radio drivers.
Functions prefixed with:
eventOS_scheduler
Random number generation|The 6LoWPAN stack relies on platform drivers to generate random numbers.
Functions prefixed with:
platform_random
Timers|The eventing system requires timers to be implemented on platform drivers.
Functions prefixed with:
eventOS_event_timer
AES encryption|To use security on a network layer, AES encryption must be implemented on platform drivers. This allows using hardware encryption where available. ARM supports sample software implementation for platforms without HW encryption. platform_aes_block_encode()

For more information on Platform API, see the chapter [**Porting 6LoWPAN Stack**](16_API_porting.md).


text:
/*
* ========================================
*	BUDGET REPORT APP
* ========================================
*/

var budgetReportApp = {};

budgetReportApp.financeContainer = document.getElementById('finance-container');
budgetReportApp.reportContainer = document.getElementById('report-container');
budgetReportApp.negativeCashflowContainer = document.getElementById('negative-cashflow-container');

budgetReportApp.month = document.getElementById('month');
budgetReportApp.currency = document.getElementById('currency');

budgetReportApp.incomeForm = document.getElementById('add-income-form');
budgetReportApp.incomeOutput = document.getElementById('income-output');
budgetReportApp.incomeNameInput = document.getElementById('income-name');
budgetReportApp.incomeValueInput = document.getElementById('income-value');
budgetReportApp.incomeNameOutput = document.getElementById('income-name-output');
budgetReportApp.incomeValueOutput = document.getElementById('income-value-output');
budgetReportApp.newIncomeButton = document.getElementById('add-new-income');
budgetReportApp.totalIncomeOutput = document.getElementById('total-income-value-output');
budgetReportApp.totalIncome = [];
budgetReportApp.totalIncomeLabel = [];

budgetReportApp.expenseForm = document.getElementById('add-expense-form');
budgetReportApp.expenseOutput = document.getElementById('expense-output');
budgetReportApp.expenseNameInput = document.getElementById('expense-name');
budgetReportApp.expenseNameOutput = document.getElementById('expense-name-output');
budgetReportApp.expenseValueInput = document.getElementById('expense-value');
budgetReportApp.expenseValueOutput = document.getElementById('expense-value-output');
budgetReportApp.newExpenseButton = document.getElementById('add-new-expense');
budgetReportApp.totalExpenseOutput = document.getElementById('total-expense-value-output');
budgetReportApp.totalExpense = [];
budgetReportApp.totalExpenseLabel = [];

budgetReportApp.cashflow = 0;
budgetReportApp.cashflowOutput = document.getElementById('cashflow-output');

budgetReportApp.loan = false;

budgetReportApp.totalIncomeColor = [];
budgetReportApp.totalExpenseColor = [];

budgetReportApp.newTotalIncome = 0;
budgetReportApp.newTotalExpense = 0;

budgetReportApp.incomeAnalysisOutput = document.getElementById('income-analysis');
budgetReportApp.cashflowAnalysisOutput = document.getElementById('cashflow-analysis');

budgetReportApp.incomeNameInputValid = false;
budgetReportApp.incomeValueInputValid = false;
budgetReportApp.expenseNameInputValid = false;
budgetReportApp.expenseValueInputValid = false;

budgetReportApp.monthSaved	= false;
budgetReportApp.currencySaved = false;
budgetReportApp.totalIncomeSaved = false;
budgetReportApp.totalIncomeLabelSaved = false;
budgetReportApp.totalExpenseSaved = false;
budgetReportApp.totalExpenseLabelSaved = false;
budgetReportApp.cashflowSaved = false;

budgetReportApp.monthRetrieved;
budgetReportApp.currencyRetrieved;
budgetReportApp.cashflowRetrieved;
budgetReportApp.totalIncomeLabelRetrieved;
budgetReportApp.totalIncomeRetrieved;
budgetReportApp.totalExpenseLabelRetrieved;
budgetReportApp.totalExpenseRetrieved;

budgetReportApp.createNewReportBtn = document.getElementById('create_new_report_btn');

// Check to see if there is a saved version
if(sessionStorage.getItem('budgetReportApp.cashflow') != null) {
	budgetReportApp.monthSaved	= true;
	budgetReportApp.currencySaved = true;
	budgetReportApp.totalIncomeSaved = true;
	budgetReportApp.totalIncomeLabelSaved = true;
	budgetReportApp.totalExpenseSaved	= true;
	budgetReportApp.totalExpenseLabelSaved= true;
	budgetReportApp.cashflowSaved = true;
} else {
	budgetReportApp.monthSaved = false;
	budgetReportApp.currencySaved = false;
	budgetReportApp.totalIncomeSaved = false;
	budgetReportApp.totalIncomeLabelSaved = false;
	budgetReportApp.totalExpenseSaved = false;
	budgetReportApp.totalExpenseLabelSaved= false;
	budgetReportApp.cashflowSaved = false;
}

/*
* ========================================
*	APP LOGIC
* ========================================
*/

budgetReportApp.createNewReportBtn.addEventListener('click', function() {
	sessionStorage.clear();
});

budgetReportApp.newIncome = function() {

	var income_name = document.getElementById('income-name').value.toUpperCase();

	var income_value = parseInt(document.getElementById('income-value').value, 10);

	if(income_name == "LOAN" || income_name == "BORROW") {
		budgetReportApp.loan = true;
	}

	if(budgetReportApp.incomeNameInput.value == "") {
		alert("Please type the name of your income.");
		budgetReportApp.incomeNameInput.focus();
	} else if (budgetReportApp.incomeValueInput.value == "") {
		alert("Please type the value of your income.");
		budgetReportApp.incomeValueInput.focus();
	} else {

		budgetReportApp.totalIncomeLabel.push(income_name);
		budgetReportApp.totalIncome.push(income_value);

		//show output
		budgetReportApp.incomeOutput.style.display = "block";

		//output the input with new line each time
		var new_income_item1 = document.createElement('p');
		var new_income_item2 = document.createElement('p');

		var new_income_name = document.createTextNode(income_name);
		var new_income_value = document.createTextNode(income_value);

		new_income_item1.appendChild(new_income_name);
		new_income_item2.appendChild(new_income_value);

		budgetReportApp.incomeNameOutput.appendChild(new_income_item1);
		budgetReportApp.incomeValueOutput.appendChild(new_income_item2);

		budgetReportApp.getTotalIncome();
		budgetReportApp.getCashflow();
		budgetReportApp.incomeForm.reset();
		budgetReportApp.incomeNameInput.focus();

		//remove an element
		budgetReportApp.removeIncome(new_income_item1, new_income_item2);
	}//endif

}

budgetReportApp.newExpense = function() {
	var expense_name = document.getElementById('expense-name').value.toUpperCase();
	var expense_value = parseInt(document.getElementById('expense-value').value, 10);

	if(budgetReportApp.expenseNameInput.value == "") {
		alert("Please type the name of your expense.");
		budgetReportApp.expenseNameInput.focus();
	} else if (budgetReportApp.expenseValueInput.value == "") {
		alert("Please type the value of your expense.");
		budgetReportApp.expenseValueInput.focus();
	} else {

		budgetReportApp.totalExpenseLabel.push(expense_name);
		budgetReportApp.totalExpense.push(expense_value);

		//show output
		budgetReportApp.expenseOutput.style.display = "block";

		//output the input with new line each time
		var new_expense_item1 = document.createElement('p');
		var new_expense_item2 = document.createElement('p');

		var new_expense_name = document.createTextNode(expense_name);
		var new_expense_value = document.createTextNode(expense_value);

		new_expense_item1.appendChild(new_expense_name);
		new_expense_item2.appendChild(new_expense_value);

		budgetReportApp.expenseNameOutput.appendChild(new_expense_item1);
		budgetReportApp.expenseValueOutput.appendChild(new_expense_item2);

		budgetReportApp.getTotalExpense();
		budgetReportApp.getCashflow();
		budgetReportApp.expenseForm.reset();
		budgetReportApp.expenseNameInput.focus();

		//remove an element
		budgetReportApp.removeExpense(new_expense_item1, new_expense_item2);
	}//endif

}

budgetReportApp.getTotalIncome = function() {
	var total = 0;

	for(i in budgetReportApp.totalIncome) {
		total = total + budgetReportApp.totalIncome[i];
	}

	budgetReportApp.totalIncomeOutput.innerHTML = total;

	if(isNaN(budgetReportApp.totalIncome[0])) {
		console.log('failed to save budgetReportApp.totalIncome');
	} else if(budgetReportApp.totalIncome[0] == "") {
		budgetReportApp.save('budgetReportApp.totalIncome', 0);
		console.log('budgetReportApp.totalIncome was saved as ZERO');
	} else {
		budgetReportApp.save('budgetReportApp.totalIncome', JSON.stringify(budgetReportApp.totalIncome));
		console.log('budgetReportApp.totalIncome was saved');
		budgetReportApp.totalIncomeSaved = true;
	}

	if(budgetReportApp.totalIncomeLabel < 1) {
		console.log('failed to save budgetReportApp.totalIncomeLabel');
	} else {
		budgetReportApp.save('budgetReportApp.totalIncomeLabel', JSON.stringify(budgetReportApp.totalIncomeLabel));
		console.log('budgetReportApp.totalIncomeLabel was saved');
		budgetReportApp.totalIncomeLabelSaved = true;
	}

	return total;

}

budgetReportApp.getTotalExpense = function() {
	var total = 0;

	for(i in budgetReportApp.totalExpense) {
		total = total + budgetReportApp.totalExpense[i];
	}

	budgetReportApp.totalExpenseOutput.innerHTML = total;

	if(isNaN(budgetReportApp.totalExpense[0])) {
		console.log('failed to save budgetReportApp.totalExpense');
	} else if(budgetReportApp.totalExpense[0] == "") {
		budgetReportApp.save('budgetReportApp.totalExpense', 0);
		console.log('budgetReportApp.totalExpense was saved as ZERO');
	} else {
		budgetReportApp.save('budgetReportApp.totalExpense', JSON.stringify(budgetReportApp.totalExpense));
		console.log('budgetReportApp.totalExpense was saved');
		budgetReportApp.totalExpenseSaved = true;
	}

	if(budgetReportApp.totalExpenseLabel < 1) {
		console.log('failed to save budgetReportApp.totalExpenseLabel');
	} else {
		budgetReportApp.save('budgetReportApp.totalExpenseLabel', JSON.stringify(budgetReportApp.totalExpenseLabel));
		console.log('budgetReportApp.totalExpenseLabel was saved');
		budgetReportApp.totalExpenseLabelSaved= true;
	}

	return total;

}

budgetReportApp.getCashflow = function() {

	budgetReportApp.newTotalIncome = budgetReportApp.getTotalIncome();
	budgetReportApp.newTotalExpense = budgetReportApp.getTotalExpense();

	budgetReportApp.cashflow = budgetReportApp.newTotalIncome - budgetReportApp.newTotalExpense;

	// Save the budgetReportApp.cashflow value
	if(budgetReportApp.cashflow != null) {
		budgetReportApp.save('budgetReportApp.cashflow', budgetReportApp.cashflow);
		console.log('budgetReportApp.cashflow was saved');
		budgetReportApp.cashflowSaved = true;
	} else {
		console.log('failed to save budgetReportApp.cashflow');
		budgetReportApp.cashflowSaved = false;
	}

	// Output the budgetReportApp.cashflow
		if(budgetReportApp.cashflow > 0) {
			budgetReportApp.cashflowOutput.innerHTML = "+ " + budgetReportApp.cashflow;
			budgetReportApp.cashflowOutput.style.color = "green";
		} else if (budgetReportApp.cashflow === 0) {
			budgetReportApp.cashflowOutput.innerHTML = budgetReportApp.cashflow;
		} else {
			budgetReportApp.cashflowOutput.innerHTML = budgetReportApp.cashflow;
			budgetReportApp.cashflowOutput.style.color = "red";
		}

	return budgetReportApp.cashflow;

};

budgetReportApp.removeIncome = function(e, f) {
    var removeItem = document.createElement('span');
    var removeItemText = document.createTextNode('-');
    var x = (Math.floor(Math.random() * 256));
    removeItem.setAttribute("id", "remove-button" + x);
    removeItem.setAttribute("class", "remove-button");
    removeItem.addEventListener('click', function() {

    	var a = prompt('Type DELETE to confirm').toUpperCase();

    	if (a === "DELETE") {
    		e.parentNode.removeChild(e);
        	f.parentNode.removeChild(f);

    	// remove the income from the budgetReportApp.totalIncome array
        var income_value_removed = parseInt(f.innerText, 10);
        var index = budgetReportApp.totalIncome.indexOf(income_value_removed);
        budgetReportApp.totalIncome.splice(index, 1);

        // remove the income label from the budgetReportApp.totalIncomeLabel array
        var income_label_removed = e.innerText;
        var index_income_label = budgetReportApp.totalIncomeLabel.indexOf(income_label_removed);
        budgetReportApp.totalIncomeLabel.splice(index_income_label, 1);

        budgetReportApp.getTotalIncome();
        budgetReportApp.getCashflow();

        }

    }, false);

    f.appendChild(removeItem);
    removeItem.appendChild(removeItemText);
}

budgetReportApp.removeExpense = function(e, f) {
    var removeItem = document.createElement('p');
    var removeItemText = document.createTextNode('-');
    var x = (Math.floor(Math.random() * 256));
    removeItem.setAttribute("id", "remove-button" + x);
    removeItem.setAttribute("class", "remove-button");
    removeItem.addEventListener('click', function() {

    	var a = prompt('Type DELETE to confirm').toUpperCase();

    	if (a === "DELETE") {
    		e.parentNode.removeChild(e);
        	f.parentNode.removeChild(f);

        // remove the expense value from the budgetReportApp.totalExpense array
        var expense_value_removed = parseInt(f.innerText, 10);
        var index_expense = budgetReportApp.totalExpense.indexOf(expense_value_removed);
        budgetReportApp.totalExpense.splice(index_expense, 1);

        // remove the expense label from the budgetReportApp.totalExpenseLabel array
        var expense_label_removed = e.innerText;
        var index_expense_label = budgetReportApp.totalExpenseLabel.indexOf(expense_label_removed);
        budgetReportApp.totalExpenseLabel.splice(index_expense_label, 1);

        budgetReportApp.getTotalExpense();

        budgetReportApp.getCashflow();

        }

    }, false);
    f.appendChild(removeItem);
    removeItem.appendChild(removeItemText);
}

budgetReportApp.getRandomColor = function() {
	var random_color = 'rgb(' + (Math.floor(Math.random() * 256)) + ',' + (Math.floor(Math.random() * 256)) + ',' + (Math.floor(Math.random() * 256)) + ')';

	return random_color;
}

budgetReportApp.showReport = function() {

		document.getElementById('finance-container').style.display = 'none';
		document.getElementById('report-container').style.display = 'block';
		document.getElementById('negative-cashflow-container').style.display = 'none';

		document.getElementById('report-button').style.display = 'none';
		document.getElementById('back-button').style.display = 'block';

		var report_month;
		var report_currency;
		var report_total_income;
		var report_total_income_output;
		var report_total_income_label;
		var report_total_income_sum;
		var report_total_expense;
		var report_total_expense_output;
		var report_total_expense_label;
		var report_total_expense_sum;
		var report_cashflow;

		//check to see if there is a saved version
			if(budgetReportApp.monthRetrieved != undefined) {
				report_month = budgetReportApp.monthRetrieved;
			} else {
				report_month = budgetReportApp.month.value;
			}

			if(budgetReportApp.currencyRetrieved != undefined) {
				report_currency = budgetReportApp.currencyRetrieved;
			} else {
				report_currency = budgetReportApp.currency.value;
			}

			if(budgetReportApp.totalIncomeRetrieved != undefined) {
				report_total_income_label = JSON.parse(sessionStorage.getItem('budgetReportApp.totalIncomeLabel'));
				report_total_income_array = JSON.parse(sessionStorage.getItem('budgetReportApp.totalIncome'));
				report_total_income_sum = 0;
				for(j in report_total_income_array) {
					report_total_income_sum = report_total_income_sum + report_total_income_array[j];
				}
				report_total_income_output = report_total_income_sum.toLocaleString('ro-RO');
			} else {
				report_total_income_label = budgetReportApp.totalIncomeLabel;
				report_total_income_array = budgetReportApp.totalIncome;
				report_total_income_output = Number(budgetReportApp.newTotalIncome).toLocaleString('ro-RO');
				report_total_income_sum = budgetReportApp.getTotalIncome();
			}

			if(budgetReportApp.totalExpenseRetrieved != undefined) {
				report_total_expense_label = JSON.parse(sessionStorage.getItem('budgetReportApp.totalExpenseLabel'));
				report_total_expense_array = JSON.parse(sessionStorage.getItem('budgetReportApp.totalExpense'));
				report_total_expense_sum = 0;
				for(k in report_total_expense_array) {
					report_total_expense_sum = report_total_expense_sum + report_total_expense_array[k];
				}
				report_total_expense_output = report_total_expense_sum.toLocaleString('ro-RO');
			} else {
				report_total_expense_label = budgetReportApp.totalExpenseLabel;
				report_total_expense_array = budgetReportApp.totalExpense;
				report_total_expense_output = Number(budgetReportApp.newTotalExpense).toLocaleString('ro-RO');
				report_total_expense_sum = budgetReportApp.getTotalExpense();
			}

			if(budgetReportApp.cashflowRetrieved != undefined) {
				report_cashflow = Number(budgetReportApp.cashflowRetrieved).toLocaleString('ro-RO');
			} else {
				report_cashflow = Number(budgetReportApp.cashflow).toLocaleString('ro-RO');
			}

		document.getElementById('month-field').innerHTML = 'My Budget for: ' + report_month;
		document.getElementById('income-field').innerHTML = report_total_income_output + " " + report_currency;
		document.getElementById('expenses-field').innerHTML = report_total_expense_output + " " + report_currency;
		document.getElementById('cashflow-field').innerHTML = report_cashflow + " " + report_currency;

		var cashflow_analyse;

		if(budgetReportApp.cashflowRetrieved != undefined) {
			cashflow_analyse = Number(budgetReportApp.cashflowRetrieved);
		} else {
			cashflow_analyse = Number(budgetReportApp.cashflow);
		}

		budgetReportApp.showNegativeCashflow();

		if(cashflow_analyse > 0) {
			document.getElementById('cashflow-field').style.color = 'green';
		} else {
			document.getElementById('cashflow-field').style.color = 'red';
		}

		// income analysis

		if (budgetReportApp.totalIncome.length > 1 && budgetReportApp.loan == false || budgetReportApp.totalIncomeRetrieved != undefined && budgetReportApp.loan == false) {
			budgetReportApp.incomeAnalysisOutput.innerHTML = '
Good job! You have more then one source of income!
';
		} else if (budgetReportApp.totalIncome.length > 2 && budgetReportApp.loan == true || budgetReportApp.totalIncomeRetrieved != undefined && budgetReportApp.loan == true) {
			budgetReportApp.incomeAnalysisOutput.innerHTML = '
Good job! You have more then one source of income, but you should pay back that loan!
';
		}

		// budgetReportApp.cashflow analysis

		if (cashflow_analyse > 0) {
			budgetReportApp.cashflowAnalysisOutput.innerHTML =

			'
 Great! You have a positive cashflow!
';

		} else if (cashflow_analyse == 0) {
			budgetReportApp.cashflowAnalysisOutput.innerHTML = '';
		}

		/* GRAPHS
		================================================================ */

		//random income colors

		for(i=0; i<budgetReportApp.totalIncome.length; i++) {
			var count_i = i;
			var icolor = budgetReportApp.getRandomColor();
			budgetReportApp.totalIncomeColor.push(icolor);
		}

		//random expense color

		for(j=0; j<budgetReportApp.totalExpense.length; j++) {
			var count_j = j;
			var ecolor = budgetReportApp.getRandomColor();
			budgetReportApp.totalExpenseColor.push(ecolor);
		}

		if(budgetReportApp.totalIncome.length > 0) {
			budgetReportApp.save('budgetReportApp.totalIncomeColor', JSON.stringify(budgetReportApp.totalIncomeColor));
			budgetReportApp.save('budgetReportApp.totalExpenseColor', JSON.stringify(budgetReportApp.totalExpenseColor));
			console.log('color was saved');
		}

		var report_total_incomeColor;
		var report_total_expenseColor;

		if(budgetReportApp.totalIncomeRetrieved != undefined) {
			report_total_incomeColor = JSON.parse(sessionStorage.getItem('budgetReportApp.totalIncomeColor'));
		} else {
			report_total_incomeColor = budgetReportApp.totalIncomeColor;
		}

		if(budgetReportApp.totalExpenseRetrieved != undefined) {
			report_total_expenseColor = JSON.parse(sessionStorage.getItem('budgetReportApp.totalExpenseColor'));
		} else {
			report_total_expenseColor = budgetReportApp.totalExpenseColor;
		}

		//income Graph
			var ctx = document.getElementById("incomeChart");
			var myChart = new Chart(ctx, {
			    type: 'doughnut',
			    data: {
			        labels: JSON.parse(sessionStorage.getItem('budgetReportApp.totalIncomeLabel')),
			        datasets: [{
			            label: '# of Votes',
			            data: JSON.parse(sessionStorage.getItem('budgetReportApp.totalIncome')),
			            backgroundColor: report_total_incomeColor,
			            borderColor: report_total_incomeColor,
			            borderWidth: 1
			        }]
			    },
			    options: {
			        scales: {
			            yAxes: [{
			                ticks: {
			                    beginAtZero:true
			                }
			            }]
			        }
			    }
			}); // income graph

		//expenses graph
			var ctx = document.getElementById("expenseChart");
			var myChart = new Chart(ctx, {
			    type: 'doughnut',
			    data: {
			        labels: JSON.parse(sessionStorage.getItem('budgetReportApp.totalExpenseLabel')),
			        datasets: [{
			            label: '# of Votes',
			            data: JSON.parse(sessionStorage.getItem('budgetReportApp.totalExpense')),
			            backgroundColor: report_total_expenseColor,
			            borderColor:  report_total_expenseColor,
			            borderWidth: 1
			        }]
			    },
			    options: {
			        scales: {
			            yAxes: [{
			                ticks: {
			                    beginAtZero:true
			                }
			            }]
			        }
			    }
			}); // expense graph

	//income source analysis

	//max of total income

	function getMaxOfArray(numArray) {
  		return Math.max.apply(null, numArray);
	}

	var max_income;
	var max_income_index;

	//Check to see if there is a saved version
	if(budgetReportApp.totalIncomeRetrieved != undefined) {
		max_income = getMaxOfArray(budgetReportApp.totalIncomeRetrieved);
		max_income_index = budgetReportApp.totalIncomeRetrieved.indexOf(max_income);

	} else {
		max_income = getMaxOfArray(budgetReportApp.totalIncome);
		max_income_index = budgetReportApp.totalIncome.indexOf(max_income);
	}

	if(cashflow_analyse > 0) {
	document.getElementById('income-source-analysis').innerHTML =
		'
Your biggest source of income is: ' + '' + report_total_income_label[max_income_index] + ':' + ' ' + max_income.toLocaleString('ro-RO') + ' ' + report_currency + '' + ' and it represents ' + parseFloat(Number(max_income) / Number(report_total_income_sum) * 100).toFixed(2) + '%  of your total income.
' +
		'
Have you ever thought what will happen if you would loose this source of income? With your cash-flow level, it will take ' + parseFloat(max_income / budgetReportApp.cashflow).toFixed(2) + ' months to save ' + max_income.toLocaleString('ro-RO') + ' ' + report_currency + '
' +
		'
On the other hand, if you want to survive for 6 months and keep the same life style, you will need to have in savings arround: ' + (parseInt(Number(report_total_income_sum) * 6)).toLocaleString('ro-RO') + ' ' + report_currency + '
';
	} else if (cashflow_analyse == 0) {
		document.getElementById('income-source-analysis').innerHTML =
		'
Your biggest source of income is: ' + '' + report_total_income_label[max_income_index] + ':' + ' ' + max_income.toLocaleString('ro-RO') + ' ' + report_currency + '' + ' and it represents ' + parseFloat(Number(max_income) / Number(report_total_income_sum) * 100).toFixed(2) + '%  of your total income.
' +
		'Have you ever thought what will happen if you would loose this source of income? With your cash-flow level, you are doomed!
' +
		'
On the other hand, if you want to survive for 6 months and keep the same life style, you will need to have in savings arround: ' + (parseInt(report_total_income_sum * 6)).toLocaleString('ro-RO') + ' ' + report_currency + '
';
	}
	//expense source analysis

	//max of total expenses

	var max_expense;
	var max_expense_index;

	if(budgetReportApp.totalExpenseRetrieved != undefined) {
		max_expense = getMaxOfArray(budgetReportApp.totalExpenseRetrieved);
		max_expense_index = budgetReportApp.totalExpenseRetrieved.indexOf(max_expense);
	} else {
		max_expense = getMaxOfArray(budgetReportApp.totalExpense);
		max_expense_index = budgetReportApp.totalExpense.indexOf(max_expense);
	}

	document.getElementById('expense-source-analysis').innerHTML =
		'
Your biggest expense is: ' + '' + budgetReportApp.totalExpenseLabel[max_expense_index] + ':' + ' ' + max_expense.toLocaleString('ro-RO') + ' ' + report_currency + '' + ' and it represents ' + parseFloat(max_expense / report_total_expense_sum * 100).toFixed(2) + '%  of your total expenses.' +
		' Is there any way to reduce it?
' + '
';

}//budgetReportApp.showReport();

budgetReportApp.showNegativeCashflow = function() {
	if(Number(sessionStorage.getItem('budgetReportApp.cashflow')) < 0) {
		document.getElementById('negative-cashflow-container').style.display = 'block';
		document.getElementById('income-cashflow-analyse').style.display = 'none';
	} else {
		document.getElementById('negative-cashflow-container').style.display = 'none';
		document.getElementById('income-cashflow-analyse').style.display = 'block';
	}

}// budgetReportApp.showNegativeCashflow();

budgetReportApp.showFinance = function() {
	document.getElementById('finance-container').style.display = 'block';
	document.getElementById('report-container').style.display = 'none';
	document.getElementById('negative-cashflow-container').style.display = 'none';
	document.getElementById('report-button').style.display = 'block';

}//show_finance();

budgetReportApp.borrowMoney = function() {
	budgetReportApp.loan = true;
	budgetReportApp.showFinance();
	document.getElementById('cut-expenses').style.display = 'none';
	document.getElementById('borrow-money').style.display = 'block';
}

budgetReportApp.cutExpenses = function() {
	budgetReportApp.showFinance();
	document.getElementById('borrow-money').style.display = 'none';
	document.getElementById('cut-expenses').style.display = 'block';
}

/*
* ========================================
*	DATA VALIDATION
* ========================================
*/

budgetReportApp.month.addEventListener('input', function() {
	var month_valid = false;
	if(budgetReportApp.month.value == ""){
		document.getElementById('month-validation').innerHTML = "Error: This field is required";
		budgetReportApp.month.style.borderBottom = '3px solid red';
	} else {
		month_valid = true;
		budgetReportApp.month.style.borderBottom = '3px solid green';
		document.getElementById('month-validation').innerHTML = "";
	}

	if(!/^[A-Za-z ]+$/.test(budgetReportApp.month.value)) {
		document.getElementById('month-validation').innerHTML = "Error: Please use only letters";
		budgetReportApp.month.style.borderBottom = '3px solid red';
	} else {
		month_valid = true;
		budgetReportApp.month.style.borderBottom = '3px solid green';
		document.getElementById('month-validation').innerHTML = "";
	}
});

budgetReportApp.currency.addEventListener('input', function() {
	var currency_valid = false;
	if(budgetReportApp.currency.value == ""){
		document.getElementById('currency-validation').innerHTML = "Error: This field is required";
		budgetReportApp.currency.style.borderBottom = '3px solid red';
	} else {
		currency_valid = true;
		budgetReportApp.currency.style.borderBottom = '3px solid green';
		document.getElementById('currency-validation').innerHTML = "";
	}

	if(!/^[A-Za-z ]+$/.test(budgetReportApp.currency.value)) {
		document.getElementById('currency-validation').innerHTML = "Error: Please use only letters";
		budgetReportApp.currency.style.borderBottom = '3px solid red';
	} else {
		currency_valid = true;
		budgetReportApp.currency.style.borderBottom = '3px solid green';
		document.getElementById('currency-validation').innerHTML = "";
	}
});

budgetReportApp.incomeNameInput.addEventListener('input', function() {
	if(budgetReportApp.incomeNameInput.value == ""){
		document.getElementById('income-name-validation').innerHTML = "Error: Income name is required";
		budgetReportApp.incomeNameInput.style.borderBottom = '3px solid red';
		budgetReportApp.incomeNameInputValid = false;
	} else {
		budgetReportApp.incomeNameInputValid = true;
		budgetReportApp.incomeNameInput.style.borderBottom = '3px solid green';
		document.getElementById('income-name-validation').innerHTML = "";
	}

	if(!/^[A-Za-z ]+$/.test(budgetReportApp.incomeNameInput.value)) {
		document.getElementById('income-name-validation').innerHTML = "Error: Please use only letters.";
		budgetReportApp.incomeNameInput.style.borderBottom = '3px solid red';
		budgetReportApp.incomeNameInputValid = false;
	} else {
		budgetReportApp.incomeNameInputValid = true;
		budgetReportApp.incomeNameInput.style.borderBottom = '3px solid green';
		document.getElementById('income-name-validation').innerHTML = "";
	}
});

budgetReportApp.incomeValueInput.addEventListener('input', function() {
	if(budgetReportApp.incomeValueInput.value == ""){
		document.getElementById('income-value-validation').innerHTML = "Error: Income value is required";
		budgetReportApp.incomeValueInput.style.borderBottom = '3px solid red';
		budgetReportApp.incomeValueInputValid = false;
	} else {
		budgetReportApp.incomeValueInputValid = true;
		budgetReportApp.incomeValueInput.style.borderBottom = '3px solid green';
		document.getElementById('income-value-validation').innerHTML = "";
	}

	if(!/^[0-9]*$/g.test(budgetReportApp.incomeValueInput.value)) {
		document.getElementById('income-value-validation').innerHTML = "Error: Please use only numbers";
		budgetReportApp.incomeValueInput.style.borderBottom = '3px solid red';
		budgetReportApp.incomeValueInputValid = false;
	} else {
		budgetReportApp.incomeValueInputValid = true;
		budgetReportApp.incomeValueInput.style.borderBottom = '3px solid green';
		document.getElementById('income-value-validation').innerHTML = "";
	}
});

budgetReportApp.expenseNameInput.addEventListener('input', function() {
	if(budgetReportApp.expenseNameInput.value == ""){
		document.getElementById('expense-name-validation').innerHTML = "Error: Expense name is required";
		budgetReportApp.expenseNameInput.style.borderBottom = '3px solid red';
		budgetReportApp.expenseNameInputValid = false;
	} else {
		budgetReportApp.expenseNameInputValid = true;
		budgetReportApp.expenseNameInput.style.borderBottom = '3px solid green';
		document.getElementById('expense-name-validation').innerHTML = "";
	}

	if(!/^[A-Za-z ]+$/.test(budgetReportApp.expenseNameInput.value)) {
		document.getElementById('expense-name-validation').innerHTML = "Error: Please use only letters.";
		budgetReportApp.expenseNameInput.style.borderBottom = '3px solid red';
		budgetReportApp.expenseNameInputValid = false;
	} else {
		budgetReportApp.expenseNameInputValid = true;
		budgetReportApp.expenseNameInput.style.borderBottom = '3px solid green';
		document.getElementById('expense-name-validation').innerHTML = "";
	}
});

budgetReportApp.expenseValueInput.addEventListener('input', function() {
	if(budgetReportApp.expenseValueInput.value == ""){
		document.getElementById('expense-value-validation').innerHTML = "Error: Expense value is required";
		budgetReportApp.expenseValueInput.style.borderBottom = '3px solid red';
		budgetReportApp.expenseValueInputValid = false;
	} else {
		budgetReportApp.expenseValueInputValid = true;
		budgetReportApp.expenseValueInput.style.borderBottom = '3px solid green';
		document.getElementById('expense-value-validation').innerHTML = "";
	}

	if(!/^[0-9]*$/g.test(budgetReportApp.expenseValueInput.value)) {
		document.getElementById('expense-value-validation').innerHTML = "Error: Please use only numbers.";
		budgetReportApp.expenseValueInput.style.borderBottom = '3px solid red';
		budgetReportApp.expenseValueInputValid = false;
	} else {
		budgetReportApp.expenseValueInputValid = true;
		budgetReportApp.expenseValueInput.style.borderBottom = '3px solid green';
		document.getElementById('expense-value-validation').innerHTML = "";
	}
});

budgetReportApp.incomeValueInput.addEventListener('keypress', function(e) {
	var keyCode = e.keyCode;
    if(keyCode == 13){
    	if(budgetReportApp.incomeValueInputValid == true) {
    		budgetReportApp.newIncome();
    	}

    }
});

budgetReportApp.expenseValueInput.addEventListener('keypress', function(e) {
	var keyCode = e.keyCode;
    if(keyCode == 13){
        if(budgetReportApp.expenseValueInputValid == true) {
    		budgetReportApp.newExpense();
    	}
    }
});

/*
* ========================================
*	SAVE LOCALSESSION
* ========================================
*/
// General save function
if (typeof(Storage) !== "undefined") {

	budgetReportApp.save = function(keyname, keyvalue) {
		sessionStorage.setItem(keyname, keyvalue);
	}

} else {
    console.log('Sorry, there is no Web Storage Support.')
}

// Save budgetReportApp.month
budgetReportApp.month.addEventListener('input', function() {

	if (budgetReportApp.month.value != null) {
	budgetReportApp.budgetReportApp.save('budgetReportApp.month', budgetReportApp.month.value);
	console.log('budgetReportApp.month was saved');
	budgetReportApp.monthSaved = true;
	} else {
		console.log('failed to save budgetReportApp.month');
		budgetReportApp.monthSaved = false;
	}

});

// Save budgetReportApp.currency
budgetReportApp.currency.addEventListener('input', function() {

	if (budgetReportApp.currency.value != null) {
	budgetReportApp.budgetReportApp.save('budgetReportApp.currency', budgetReportApp.currency.value);
	console.log('budgetReportApp.currency was saved');
	budgetReportApp.currencySaved = true;
	} else {
		console.log('failed to save budgetReportApp.currency');
		budgetReportApp.monthSaved = false;
	}

});

/*
* ========================================
*	RETRIEVE SAVED DATA
* ========================================
*/

// Retrieve budgetReportApp.month
	budgetReportApp.monthRetrieved = sessionStorage.getItem('budgetReportApp.month');

	// Retrieve budgetReportApp.month as the input placeholder
	if(budgetReportApp.monthRetrieved != undefined) {
		budgetReportApp.month.setAttribute('placeholder', budgetReportApp.monthRetrieved);
		document.getElementById('error').innerText = "Ups! Something went wrong. Here is a saved version of your data!" +
		"But unfortunately at this moment you can't interact with it.";
	} else {
		budgetReportApp.month.setAttribute('placeholder', 'month');
	}

// Retrieve budgetReportApp.currency
	budgetReportApp.currencyRetrieved = sessionStorage.getItem('budgetReportApp.currency');

	if(budgetReportApp.currencyRetrieved != undefined) {
		budgetReportApp.currency.setAttribute('placeholder', budgetReportApp.currencyRetrieved);
	} else {
		budgetReportApp.currency.setAttribute('placeholder', 'USD');
	}

// Retrieve the income_name (budgetReportApp.totalIncomeLabel array)

	budgetReportApp.totalIncomeLabelRetrieved = JSON.parse(sessionStorage.getItem('budgetReportApp.totalIncomeLabel'));

	if(budgetReportApp.totalIncomeLabelRetrieved.length > 0) {
		budgetReportApp.incomeOutput.style.display = "block";
		budgetReportApp.totaLabel= "";
		for(x in budgetReportApp.totalIncomeLabelRetrieved) {
			budgetReportApp.totalLabel = '
' + budgetReportApp.totalLabel + budgetReportApp.totalIncomeLabelRetrieved[x] + '
';
			budgetReportApp.incomeNameOutput.innerHTML = budgetReportApp.totalLabel;
		}

	}

// Retrieve the income_value (budgetReportApp.totalIncome array)

	budgetReportApp.totalIncomeRetrieved = JSON.parse(sessionStorage.getItem('budgetReportApp.totalIncome'));

		if(budgetReportApp.totalIncomeRetrieved.length > 0) {
			budgetReportApp.incomeOutput.style.display = "block";
			budgetReportApp.totalValue1= "";
			for(x in budgetReportApp.totalIncomeRetrieved) {
				budgetReportApp.totalValue1 = '
' + budgetReportApp.totalValue1 + budgetReportApp.totalIncomeRetrieved[x] + " " + "-" + '
';
				budgetReportApp.incomeValueOutput.innerHTML = '
' + budgetReportApp.totalValue1 + '
';
			}
			budgetReportApp.incomeSum = 0;
			for(y in budgetReportApp.totalIncomeRetrieved) {
				budgetReportApp.incomeSum = budgetReportApp.incomeSum + budgetReportApp.totalIncomeRetrieved[y];
			}
			budgetReportApp.totalIncomeOutput.innerHTML = '
' + budgetReportApp.incomeSum + '
';
		}

// Retrieve the expense_name (budgetReportApp.totalExpenseLabel array)

	budgetReportApp.totalExpenseLabelRetrieved = JSON.parse(sessionStorage.getItem('budgetReportApp.totalExpenseLabel'));

	if(budgetReportApp.totalExpenseLabelRetrieved.length > 0) {
		budgetReportApp.expenseOutput.style.display = "block";
		budgetReportApp.totalLabel = "";
		for(x in budgetReportApp.totalExpenseLabelRetrieved) {
			budgetReportApp.totalLabel = '
' + budgetReportApp.totalLabel + budgetReportApp.totalExpenseLabelRetrieved[x] + '
';
			budgetReportApp.expenseNameOutput.innerHTML = budgetReportApp.totalLabel;
		}

	}

// Retrieve the expense_value (budgetReportApp.totalExpense array)

	budgetReportApp.totalExpenseRetrieved = JSON.parse(sessionStorage.getItem('budgetReportApp.totalExpense'));

		if(budgetReportApp.totalExpenseRetrieved.length > 0) {
			budgetReportApp.expenseOutput.style.display = "block";
			budgetReportApp.totalValue2= "";
			for(x in budgetReportApp.totalExpenseRetrieved) {
				budgetReportApp.totalValue2 = '
' + budgetReportApp.totalValue2 + budgetReportApp.totalExpenseRetrieved[x] + " " + "-" + '
';
				budgetReportApp.expenseValueOutput.innerHTML = '
' + budgetReportApp.totalValue2 + '
';
			}
			budgetReportApp.expenseSum = 0;
			for(z in budgetReportApp.totalExpenseRetrieved) {
				budgetReportApp.expenseSum = budgetReportApp.expenseSum + budgetReportApp.totalExpenseRetrieved[z];
			}
			budgetReportApp.totalExpenseOutput.innerHTML = '
' + budgetReportApp.expenseSum + '
';
		}

// Retrieve the budgetReportApp.cashflow

	if(budgetReportApp.cashflowSaved === true) {

			budgetReportApp.cashflowRetrieved = sessionStorage.getItem('budgetReportApp.cashflow');

			if(budgetReportApp.cashflowRetrieved > 0) {
				budgetReportApp.cashflowOutput.innerText = "+ " + budgetReportApp.cashflowRetrieved;
				budgetReportApp.cashflowOutput.style.color = "green";
			} else if (budgetReportApp.cashflowRetrieved === 0) {
				budgetReportApp.cashflowOutput.innerText = budgetReportApp.cashflowRetrieved;
			} else {
				budgetReportApp.cashflowOutput.innerText = budgetReportApp.cashflowRetrieved;
				budgetReportApp.cashflowOutput.style.color = "red";
			}

		}

	budgetReportApp.removeBtn = document.getElementsByName('remove-button');

	for(x in budgetReportApp.removeBtn) {
		budgetReportApp.removeBtn[x].addEventListener('click', function() {
			alert("Sorry, at this moment you can't delete saved values");
		});
	}


text:
package de.mpicbg.knime.hcs.base.nodes.mine.binningapply;

import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;

import javax.swing.JCheckBox;
import javax.swing.JPanel;
import javax.swing.JSeparator;
import javax.swing.JSpinner;
import javax.swing.SpinnerNumberModel;

import org.knime.core.data.DataTableSpec;
import org.knime.core.node.InvalidSettingsException;
import org.knime.core.node.NodeSettingsRO;
import org.knime.core.node.NodeSettingsWO;

@SuppressWarnings("serial")
public class BinningApplySamplingPanel extends JPanel {

	JCheckBox comp_useSampling = new JCheckBox("Enable sampling");
	JCheckBox comp_useSeed = new JCheckBox("Use random seed");
	JSpinner comp_sampleSize = new JSpinner();
	JSpinner comp_seed = new JSpinner();

	public BinningApplySamplingPanel() {

		super(new GridBagLayout());
		GridBagConstraints c = new GridBagConstraints();

		comp_sampleSize.setEnabled(false);
		comp_useSeed.setEnabled(false);
		comp_seed.setEnabled(false);

		Integer val = new Integer(0);
		Integer min = new Integer(0);
		Integer max = new Integer(Integer.MAX_VALUE);
		Integer stepSize = new Integer(1);
		SpinnerNumberModel model = new SpinnerNumberModel(val, min, max, stepSize);
		comp_sampleSize.setModel(model);

		Long lmin = new Long(0);
		Long lmax = Long.MAX_VALUE;
		Long lval = new Long(0);
		Long lstepSize = new Long(1);
		model = new SpinnerNumberModel(lval, lmin, lmax, lstepSize);
		comp_seed.setModel(model);

		comp_useSampling.addItemListener(new ItemListener() {

			@Override
			public void itemStateChanged(ItemEvent e) {
				if(e.getItem() == comp_useSampling) {
					boolean selected = comp_useSampling.isSelected();
					comp_sampleSize.setEnabled(selected);
					comp_useSeed.setEnabled(selected);
					comp_seed.setEnabled(selected && comp_useSeed.isSelected());
					}
				}
		});

		comp_useSeed.addItemListener(new ItemListener() {

			@Override
			public void itemStateChanged(ItemEvent e) {
				if(e.getItem() == comp_useSeed) {
					comp_seed.setEnabled(comp_useSeed.isSelected());
				}
			}
		});

		c.gridx = 0;			//x-pos in grid
		c.gridy = 0;			//y-pos in grid
		c.gridwidth = 1;		// amount of cells in x-direction
		c.insets = new Insets(10, 10, 0, 10);	// some space to left, upper and right
		c.fill = GridBagConstraints.HORIZONTAL;
		c.anchor = GridBagConstraints.NORTHWEST;
		c.weightx = 20;		// ratio of column width (not exactly...)
		add(comp_useSampling, c);

		c.gridx++;
		c.weightx = 80;
		add(comp_sampleSize, c);

		c.gridx = 0;
        c.gridy++;
        c.gridwidth = 2;
        c.weightx = 1;
        c.insets = new Insets(0, 10, 0, 10);	// some space to left and right
        add(new JSeparator(), c);

        c.gridy++;
        c.gridwidth = 1;
        c.weighty = 1;		// use complete y-space for the cells of the last row
        add(comp_useSeed, c);

        c.gridx++;
        add(comp_seed, c);
	}

	public void loadSettingsFrom(NodeSettingsRO settings, DataTableSpec dataTableSpec) throws InvalidSettingsException {
		boolean sm_useSampling = settings.getBoolean(BinningApplyNodeModel.CFG_SAMPLING);
		boolean sm_useSeed = settings.getBoolean(BinningApplyNodeModel.CFG_SEED);

		long sm_seedValue =  settings.getLong(BinningApplyNodeModel.CFG_SEED_VALUE);
		int sm_sampleSize = settings.getInt(BinningApplyNodeModel.CFG_SAMPLE_SIZE);

		comp_useSampling.setSelected(sm_useSampling);
		comp_useSeed.setSelected(sm_useSeed);

		comp_sampleSize.getModel().setValue(sm_sampleSize);
		comp_seed.getModel().setValue(sm_seedValue);
	}

	public void saveSettingsTo(NodeSettingsWO settings) {
		boolean useSampling = comp_useSampling.isSelected();
		boolean useSeed = comp_useSeed.isSelected();

		settings.addBoolean(BinningApplyNodeModel.CFG_SAMPLING, useSampling);
		settings.addBoolean(BinningApplyNodeModel.CFG_SEED, useSeed);

		int sampleSize = ((Integer)comp_sampleSize.getModel().getValue()).intValue();
		long seedValue = ((Long) comp_seed.getModel().getValue()).longValue();

		settings.addInt(BinningApplyNodeModel.CFG_SAMPLE_SIZE, sampleSize);
		settings.addLong(BinningApplyNodeModel.CFG_SEED_VALUE, seedValue);

	}

}


text:
int main(int, char**)
{
    std::unordered_set<int> c;
    c.empty(); // expected-warning {{ignoring return value of function declared with 'nodiscard' attribute}}

    return 0;
}


text:
/**
 * BaylorBot Continous Integration
 * When new code is pushed to the GitHub repo, it redeploys here
 */
var express = require("express"),
    app = express(),
    spawn = require("child_process").spawn,
    bodyParser = require("body-parser"),
    pm2 = require("pm2");

pm2.connect(function(err) {
  if (err) throw err;
});

app.use(bodyParser.json());

app.post("/", function(req, res) {
  console.log("Got CI Webhook for GitHub, downloading...");

  let updater = spawn("git", ["pull", "--all"]);
  updater.stdout.pipe(process.stdout);
  updater.stderr.pipe(process.stderr);
  updater.on("close", cloneCode => {
    let reset = spawn("git", ["reset","--hard", "origin/master"]);
    reset.stdout.pipe(process.stdout);
    reset.stderr.pipe(process.stderr);
    reset.on("close", resetCode => {
      if (cloneCode || resetCode) {
        console.log("Could not update from GitHub");
        res.status(500);
        res.end("Could not clone from github");
      } else {
        console.log("Done");
        console.log("Reinstalling Package...")
        let install = spawn("npm", ["install"]);
        install.stdout.pipe(process.stdout);
        install.stderr.pipe(process.stderr);
        install.on("close", function() {
          console.log("Done.");
          process.stdout.write("Restarting app...");
          pm2.restart("BaylorBot", (err, desc) => {
            if (err) throw err;
            console.log("Done")
          });
        })

      }
    })
  });

});

app.listen(48065, "0.0.0.0", function() {
  console.log("CI Server Started at 0.0.0.0:48065");
});


text:
package com.google.idea.blaze.base.sync.projectview;

import com.google.common.collect.ImmutableSet;
import com.google.idea.blaze.base.io.FileOperationProvider;
import com.google.idea.blaze.base.model.primitives.WorkspacePath;
import com.google.idea.blaze.base.sync.workspace.WorkspacePathResolver;
import com.intellij.openapi.components.ServiceManager;
import java.io.File;
import java.nio.file.Path;
import java.nio.file.Paths;

/** Utility class to find WorkspacePaths that are related */
public final class RelatedWorkspacePathFinder {

  public static RelatedWorkspacePathFinder getInstance() {
    return ServiceManager.getService(RelatedWorkspacePathFinder.class);
  }

  public ImmutableSet<WorkspacePath> findRelatedWorkspaceDirectories(
      WorkspacePathResolver pathResolver, WorkspacePath workspacePath) {

    Path path = Paths.get(workspacePath.relativePath());
    Path testsPath = Paths.get("");

    boolean foundTests = false;
    for (Path element : path) {
      if (!foundTests && element.toString().equals("java")) {
        Path potentialTestsPath = testsPath.resolve("javatests");
        if (exists(pathResolver.resolveToFile(potentialTestsPath.toString()))) {
          testsPath = potentialTestsPath;
          foundTests = true;
          continue;
        }
      }

      testsPath = testsPath.resolve(element);
    }

    if (!foundTests || !exists(pathResolver.resolveToFile(testsPath.toString()))) {
      return ImmutableSet.of();
    }

    return ImmutableSet.of(new WorkspacePath(testsPath.toString()));
  }

  private boolean exists(File file) {
    return FileOperationProvider.getInstance().exists(file);
  }
}


text:
(function () {
    "use strict";

    var inherit,
        child,
        parent;

    /**
     * Inheritance implementation with Proxy saving, uber pointer and the correct constructor pointer
     * @returns {Function}
     */
    function inheritance() {
        /**
         * There is no need to create new Proxy for each inheritance
         * @constructor
         */
        var Proxy = function () {};

        return function (ToClass, FromClass) {
            Proxy.prototype = FromClass.prototype;
            ToClass.prototype = new Proxy();
            ToClass.uber = FromClass.prototype;
            ToClass.prototype.constructor = ToClass;
        };
    }

    inherit = inheritance();

    function Parent() {
        this.a = "a";
    }
    Parent.prototype.prop1 = "prop1 value";

    function Child() {}

    inherit(Child, Parent);

    /**Testing*/

    child = new Child();
    parent = new Parent();

    print("@public prototype child.prop1 == " + child.prop1);
    print("@public prototype parent.prop1 == " + parent.prop1);

    Parent.prototype.prop1 = "modified Parent prop1";

    print("@public prototype modified child.prop1 == " + child.prop1);
    print("@public prototype modified parent.prop1 == " + parent.prop1);
    print("");
    print("@private parent.a == " + parent.a);
    print("@private child.a == " + child.a);
    print("");
    print("Child.prototype.constructor.name == " + Child.prototype.constructor.name);
    print("Parent.prototype.constructor.name == " + Parent.prototype.constructor.name);
    print("Child.uber.name == " + Child.uber.constructor.name);

})();


text:
#ifndef __PARTITIONS_H__
#define __PARTITIONS_H__

#define MAX_PARTITION_NUM		128
#define EFI_NAMELEN			36

struct ptentry {
	unsigned int	start;
	unsigned int	length;
	unsigned int	flags;
	unsigned int	loadaddr;
	unsigned int	loadsize;
	int		id;
	char		name[EFI_NAMELEN];
};

extern int get_partition(void);
extern struct ptentry *find_ptn(const char *str);
extern int update_fip_spec(void);

#endif /* __PARTITIONS_H__ */


text:
package net.jforum.view.forum;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

import net.jforum.JForumExecutionContext;
import net.jforum.SessionFacade;
import net.jforum.context.RequestContext;
import net.jforum.dao.DataAccessDriver;
import net.jforum.dao.ForumDAO;
import net.jforum.dao.ModerationLogDAO;
import net.jforum.dao.TopicDAO;
import net.jforum.entities.ModerationLog;
import net.jforum.entities.Topic;
import net.jforum.entities.User;
import net.jforum.repository.ForumRepository;
import net.jforum.repository.PostRepository;
import net.jforum.repository.SecurityRepository;
import net.jforum.repository.TopicRepository;
import net.jforum.security.SecurityConstants;
import net.jforum.util.I18n;
import net.jforum.util.preferences.TemplateKeys;
import net.jforum.view.forum.common.ForumCommon;

import org.apache.log4j.Logger;

import freemarker.template.SimpleHash;

/**
 * @author Rafael Steil
 * @version $Id$
 */
public class ModerationHelper
{
	private static final Logger LOGGER = Logger.getLogger(ModerationHelper.class);

	public static final int SUCCESS = 1;
	public static final int FAILURE = 2;
	public static final int IGNORE = 3;

	public int doModeration(String returnUrl)
	{
		int status = FAILURE;

		if (SecurityRepository.canAccess(SecurityConstants.PERM_MODERATION)) {
			// Deleting topics
			RequestContext request = JForumExecutionContext.getRequest();

			if (request.getParameter("topicRemove") != null) {
				if (SecurityRepository.canAccess(SecurityConstants.PERM_MODERATION_POST_REMOVE)) {
					this.removeTopics();

					status = SUCCESS;
				}
			}
			else if (request.getParameter("topicMove") != null) {
				if (SecurityRepository.canAccess(SecurityConstants.PERM_MODERATION_TOPIC_MOVE)) {
					this.moveTopics();

					status = IGNORE;
				}
			}
			else if (request.getParameter("topicLock") != null) {
				if (SecurityRepository.canAccess(SecurityConstants.PERM_MODERATION_TOPIC_LOCK_UNLOCK)) {
					this.lockUnlockTopics(Topic.STATUS_LOCKED);

					status = SUCCESS;
				}
			}
			else if (request.getParameter("topicUnlock") != null) {
				if (SecurityRepository.canAccess(SecurityConstants.PERM_MODERATION_TOPIC_LOCK_UNLOCK)) {
					this.lockUnlockTopics(Topic.STATUS_UNLOCKED);

					status = SUCCESS;
				}
			}
		}

		if (status == ModerationHelper.FAILURE) {
			this.denied();
		}
		else if (status == ModerationHelper.SUCCESS && returnUrl != null) {
			JForumExecutionContext.setRedirect(returnUrl);
		}

		return status;
	}

	public void saveModerationLog(ModerationLog log)
	{
		ModerationLogDAO dao = DataAccessDriver.getInstance().newModerationLogDAO();
		dao.add(log);
	}

	public ModerationLog buildModerationLogFromRequest()
	{
		RequestContext request = JForumExecutionContext.getRequest();

		ModerationLog log = new ModerationLog();

		User user = new User();
		user.setId(SessionFacade.getUserSession().getUserId());
		log.setUser(user);

		log.setDescription(request.getParameter("log_description"));
		log.setOriginalMessage(request.getParameter("log_original_message"));
		log.setType(request.getIntParameter("log_type"));

		if (request.getParameter("post_id") != null) {
			log.setPostId(request.getIntParameter("post_id"));
		}

		String[] values = request.getParameterValues("topic_id");

		if (values != null && values.length == 1) {
			log.setTopicId(request.getIntParameter("topic_id"));
		}

		return log;
	}

	public int doModeration()
	{
		return this.doModeration(null);
	}

	private void removeTopics()
	{
		String[] topics = JForumExecutionContext.getRequest().getParameterValues("topic_id");

		List<Integer> forumsList = new ArrayList<Integer>();
		TopicDAO tm = DataAccessDriver.getInstance().newTopicDAO();

		List<Topic> topicsToDelete = new ArrayList<Topic>();

		if (topics != null && topics.length > 0) {
			ModerationLog log = this.buildModerationLogFromRequest();

			for (int i = 0; i < topics.length; i++) {
				Topic topic = tm.selectRaw(Integer.parseInt(topics[i]));

				log.setTopicId(topic.getId());
				log.setPosterUser(topic.getPostedBy());

				this.saveModerationLog(log);

				if (!forumsList.contains(Integer.valueOf(topic.getForumId()))) {
					forumsList.add(Integer.valueOf(topic.getForumId()));
				}

				topicsToDelete.add(topic);
				PostRepository.clearCache(topic.getId());
			}

			tm.deleteTopics(topicsToDelete, false);

			ForumDAO fm = DataAccessDriver.getInstance().newForumDAO();
			TopicRepository.loadMostRecentTopics();

			// Reload changed forums
			for (Iterator<Integer> iter = forumsList.iterator(); iter.hasNext(); ) {
				int forumId = ((Integer)iter.next()).intValue();

				TopicRepository.clearCache(forumId);

				int postId = fm.getMaxPostId(forumId);

				if (postId > -1) {
					fm.setLastPost(forumId, postId);
				}
				else {
					LOGGER.warn("Could not find last post id for forum " + forumId);
				}

				ForumRepository.reloadForum(forumId);
			}
		}
	}

	private void lockUnlockTopics(int status)
	{
		String[] topics = JForumExecutionContext.getRequest().getParameterValues("topic_id");

		if (topics != null && topics.length > 0) {
			int[] ids = new int[topics.length];

			ModerationLog log = this.buildModerationLogFromRequest();

			for (int i = 0; i < topics.length; i++) {
				ids[i] = Integer.parseInt(topics[i]);
				log.setTopicId(ids[i]);
				this.saveModerationLog(log);
			}

			DataAccessDriver.getInstance().newTopicDAO().lockUnlock(ids, status);

			// Clear the cache
			Topic topic = DataAccessDriver.getInstance().newTopicDAO().selectById(ids[0]);
			TopicRepository.clearCache(topic.getForumId());
		}
	}

	private void moveTopics()
	{
		SimpleHash context = JForumExecutionContext.getTemplateContext();

		context.put("persistData", JForumExecutionContext.getRequest().getParameter("persistData"));
		context.put("allCategories", ForumCommon.getAllCategoriesAndForums(false));

		String[] topics = JForumExecutionContext.getRequest().getParameterValues("topic_id");

		if (topics.length > 0) {
			// If forum_id is null, get from the database
			String forumId = JForumExecutionContext.getRequest().getParameter("forum_id");

			if (forumId == null) {
				int topicId = Integer.parseInt(topics[0]);

				Topic topic = TopicRepository.getTopic(new Topic(topicId));

				if (topic == null) {
					topic = DataAccessDriver.getInstance().newTopicDAO().selectRaw(topicId);
				}

				forumId = Integer.toString(topic.getForumId());
			}

			context.put("forum_id", forumId);

			StringBuffer sb = new StringBuffer(128);

			for (int i = 0; i < topics.length - 1; i++) {
				sb.append(topics[i]).append(',');
			}

			sb.append(topics[topics.length - 1]);

			context.put("topics", sb.toString());
		}
	}

	public int moveTopicsSave(String successUrl)
	{
		int status = SUCCESS;

		if (!SecurityRepository.canAccess(SecurityConstants.PERM_MODERATION_TOPIC_MOVE)) {
			status = FAILURE;
		}
		else {
			RequestContext request = JForumExecutionContext.getRequest();
			String topics = request.getParameter("topics");

			if (topics != null) {
				int fromForumId = Integer.parseInt(request.getParameter("forum_id"));
				int toForumId = Integer.parseInt(request.getParameter("to_forum"));

				String[] topicList = topics.split(",");

				DataAccessDriver.getInstance().newForumDAO().moveTopics(topicList, fromForumId, toForumId);

				ModerationLog log = this.buildModerationLogFromRequest();

				for (int i = 0; i < topicList.length; i++) {
					int topicId = Integer.parseInt(topicList[i]);
					log.setTopicId(topicId);
					this.saveModerationLog(log);
				}

				ForumRepository.reloadForum(fromForumId);
				ForumRepository.reloadForum(toForumId);

				TopicRepository.clearCache(fromForumId);
				TopicRepository.clearCache(toForumId);

				TopicRepository.loadMostRecentTopics();
				TopicRepository.loadHottestTopics();
			}
		}

		if (status == FAILURE) {
			this.denied();
		}
		else {
			this.moderationDone(successUrl);
		}

		return status;
	}

	public String moderationDone(String redirectUrl)
	{
		JForumExecutionContext.getRequest().setAttribute("template", TemplateKeys.MODERATION_DONE);
		JForumExecutionContext.getTemplateContext().put("message", I18n.getMessage("Moderation.ModerationDone", new String[] { redirectUrl }));

		return TemplateKeys.MODERATION_DONE;
	}

	public void denied()
	{
		this.denied(I18n.getMessage("Moderation.Denied"));
	}

	public void denied(String message)
	{
		JForumExecutionContext.getRequest().setAttribute("template", TemplateKeys.MODERATION_DENIED);
		JForumExecutionContext.getTemplateContext().put("message", message);
	}
}


text:
/* global $ */
/* global m */
/* global grecaptcha */
import app from 'flarum/app';
import { extend } from 'flarum/extend';
import SignUpModal from 'flarum/components/SignUpModal';
// import LogInModal from 'flarum/components/LogInModal';

app.initializers.add('sijad-recaptcha', () => {
  const key = () => app.forum.attribute('recaptchaPublic');
  const isAvail = () => typeof grecaptcha !== 'undefined';

  function load() {
    if (!key()) return;

    const render = () => {
      if (this.$('.g-recaptcha').length) return;

      const el = $('<div class="Form-group g-recaptcha">')
        .insertBefore(this.$('[type="submit"]').parent())[0];

      if (el && !$(el).data('g-rendred')) {
        this.recaptchaID = grecaptcha.render(el, {
          sitekey: key(),
          theme: app.forum.attribute('darkMode') ? 'dark' : 'light',
          callback: val => {
            this.recaptchaValue = val;
          },
        });
        $(el).data('g-rendred', true);
        m.redraw();
      }
    };

    if (isAvail()) {
      render();
    } else {
      $.getScript(
        `https://www.google.com/recaptcha/api.js?hl=${app.locale}&render=explicit`,
        () => {
          let attemps = 0;
          const interval = setInterval(() => {
            ++attemps;
            if (isAvail()) {
              clearInterval(interval);
              render();
            }
            if (attemps > 100) {
              clearInterval(interval);
            }
          }, 100);
        }
      );
    }
  }
  extend(SignUpModal.prototype, 'config', load);
  // extend(LogInModal.prototype, 'config', load);

  function clean() {
    this.$('.g-recaptcha').remove();
  }
  extend(SignUpModal.prototype, 'logIn', clean);
  // extend(LogInModal.prototype, 'signUp', clean);

  extend(SignUpModal.prototype, 'submitData', function (data) {
    const newData = data;
    newData['g-recaptcha-response'] = this.recaptchaValue;
    return newData;
  });

  extend(SignUpModal.prototype, 'onerror', function () {
    if (isAvail()) {
      grecaptcha.reset(this.recaptchaID);
    }
  });
});


text:
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ILCompiler.DependencyAnalysisFramework;
using Internal.TypeSystem;

namespace ILCompiler.DependencyAnalysis
{
    public enum ReadyToRunHelperId
    {
        NewHelper,
        NewArr1,
        VirtualCall,
        IsInstanceOf,
        CastClass,
        GetNonGCStaticBase,
        GetGCStaticBase,
        GetThreadStaticBase,
        DelegateCtor,
        InterfaceDispatch,
    }

    public partial class ReadyToRunHelperNode : AssemblyStubNode
    {
        private ReadyToRunHelperId _id;
        private Object _target;

        public ReadyToRunHelperNode(ReadyToRunHelperId id, Object target)
        {
            _id = id;
            _target = target;
        }

        public override string GetName()
        {
            return ((ISymbolNode)this).MangledName;
        }

        public ReadyToRunHelperId Id
        {
            get
            {
                return _id;
            }
        }

        public Object Target
        {
            get
            {
                return _target;
            }
        }

        public override string MangledName
        {
            get
            {
                switch (_id)
                {
                    case ReadyToRunHelperId.NewHelper:
                        return "__NewHelper_" + NodeFactory.NameMangler.GetMangledTypeName((TypeDesc)_target);
                    case ReadyToRunHelperId.NewArr1:
                        return "__NewArr1_" + NodeFactory.NameMangler.GetMangledTypeName((TypeDesc)_target);
                    case ReadyToRunHelperId.VirtualCall:
                        return "__VirtualCall_" + NodeFactory.NameMangler.GetMangledMethodName((MethodDesc)_target);
                    case ReadyToRunHelperId.IsInstanceOf:
                        return "__IsInstanceOf_" + NodeFactory.NameMangler.GetMangledTypeName((TypeDesc)_target);
                    case ReadyToRunHelperId.CastClass:
                        return "__CastClass_" + NodeFactory.NameMangler.GetMangledTypeName((TypeDesc)_target);
                    case ReadyToRunHelperId.GetNonGCStaticBase:
                        return "__GetNonGCStaticBase_" + NodeFactory.NameMangler.GetMangledTypeName((TypeDesc)_target);
                    case ReadyToRunHelperId.GetGCStaticBase:
                        return "__GetGCStaticBase_" + NodeFactory.NameMangler.GetMangledTypeName((TypeDesc)_target);
                    case ReadyToRunHelperId.GetThreadStaticBase:
                        return "__GetThreadStaticBase_" + NodeFactory.NameMangler.GetMangledTypeName((TypeDesc)_target);
                    case ReadyToRunHelperId.DelegateCtor:
                        return "__DelegateCtor_" + NodeFactory.NameMangler.GetMangledMethodName(((DelegateInfo)_target).Target);
                    case ReadyToRunHelperId.InterfaceDispatch:
                        return "__InterfaceDispatch_" + NodeFactory.NameMangler.GetMangledMethodName((MethodDesc)_target);
                    default:
                        throw new NotImplementedException();
                }
            }
        }

        protected override DependencyList ComputeNonRelocationBasedDependencies(NodeFactory context)
        {
            if (_id == ReadyToRunHelperId.VirtualCall)
            {
                DependencyList dependencyList = new DependencyList();
                dependencyList.Add(context.VirtualMethodUse((MethodDesc)_target), "ReadyToRun Virtual Method Call");
                return dependencyList;
            }
            else if (_id == ReadyToRunHelperId.InterfaceDispatch)
            {
                DependencyList dependencyList = new DependencyList();
                dependencyList.Add(context.VirtualMethodUse((MethodDesc)_target), "ReadyToRun Interface Method Call");
                return dependencyList;
            }
            else
            {
                return null;
            }
        }
    }
}


text:
@echo off
bundler\SqlBundler.exe ..\..\..\ "db/1.x/1.0" false
copy auth.sql auth-blank.sql
del auth.sql
copy auth-blank.sql ..\..\auth-blank.sql
pause


text:
/**
 * @desc		Pivot group class
 * @param {}	arg_name			pivot group name (string)
 * @param {}	arg_field			field (object of class LibaptField)
 * @param {}	arg_label			pivot group label (string)
 */
function LibaptPivotGroup(arg_name, arg_field, arg_label)
{
	// INHERIT
	this.inheritFrom = LibaptObject;
	this.inheritFrom(arg_name, false);

	// CONSTRUCTOR BEGIN
	this.trace				= false;
	this.class_name			= 'LibaptPivotGroup';
	var context				= this.class_name + '(' + arg_field.name + ')';
	this.enter(context, 'constructor');

	// FILTER ATTRIBUTES
	this.field				= get_arg(arg_field, null);
	this.can_group_on_cols	= true;
	this.can_group_on_rows	= true;
	this.is_sparse			= true;
	this.label				= get_arg(arg_label, this.field.label);

	this.distinct_values	= null;

	// CONSTRUCTOR END
	this.leave(context, 'success');

	// VALUES METHOD : GET DISTINCT GROUP VALUES
	this.get_distinct_values = function(arg_force_read, arg_max, arg_axis)
	{
		var context = 'get_distinct_values(...)';
		this.enter(context, 'max=[' + arg_max + ']');

		if ( Libapt.is_array(this.distinct_values) )
		{
			if ( Libapt.is_number(arg_max) && arg_max < this.distinct_values.length)
			{
				this.leave(context, 'cached values only ' + arg_max);
				return this.distinct_values.slice(0, arg_max - 1);
			}

			this.value(context, 'distinct_values', this.distinct_values);
			this.leave(context, 'cached values');
			return this.distinct_values;
		}

		// READ SPARSE DISTINCT VALUES
		if (this.is_sparse && arg_axis)
		{
			this.step(context, 'for sparse axis');
			var grid	= arg_axis.grid;
			this.assertNotNull(context, 'grid', grid);

			var query	= grid.query;
			this.assertNotNull(context, 'query', query);

			var model = grid.model;
			this.assertNotNull(context, 'model', model);

			var fields	= query.fields_set.fields;
			var filters	= query.filters;
			var groups	= query.groups;
			var orders	= [ new LibaptOrder(this.field, 'ASC') ];
			var ok_cb	= null;
			var ko_cb	= null;

			this.distinct_values = model.read_distinct_one_sync(this.field, fields, filters, orders, groups, arg_max, ok_cb, ko_cb);
			this.value(context, 'distinct_values.length', this.distinct_values.length);

			this.leave(context, '');
			return this.distinct_values;
		}

		// READ ALL DISTINCT VALUES
		this.distinct_values = this.field.get_all_distinct_values(arg_force_read, arg_max);

		this.leave(context, '');
		return this.distinct_values;
	}

	// VALUES METHOD : GET DISTINCT GROUP VALUES COUNT
	this.get_distinct_values_count = function(arg_force_read, arg_max, arg_axis)
	{
		this.step('get_distinct_values_count', 'max=[' + arg_max + ']');

		return this.get_distinct_values(arg_force_read, arg_max, arg_axis).length;
	}

	// VALUES METHOD : GET DISTINCT GROUP VALUES
	this.get_distinct_value_at = function(arg_index, arg_force_read, arg_max, arg_axis)
	{
		this.step('get_distinct_value_at[' + arg_index + ']', 'max=[' + arg_max + ']');

		return this.get_distinct_values(arg_force_read, arg_max, arg_axis)[arg_index];
	}

	// TRACE METHOD : TO STRING
	this.to_string_self = function()
	{
		return this.to_string_value('field.name', this.field.name)
			+ this.to_string_value('can_group_on_cols', this.can_group_on_cols)
			+ this.to_string_value('can_group_on_rows', this.can_group_on_rows)
			+ this.to_string_value('is_sparse', this.is_sparse)
			+ this.to_string_value('label', this.label)
			;
	}
}

Libapt.register_inheritance(LibaptPivotGroup, LibaptObject);

LibaptPivotGroup.create = function(arg_settings)
{
	var context = 'LibaptPivotGroup.create(arg_settings)';
	trace_enter(context, '', true);

	// INIT DEFAUTL SETTINGS
	var default_settings =
		{
			"name"				: null,
			"field"				: null,
			"label"				: null,
			"can_group_on_cols"	: true,
			"can_group_on_rows"	: true,
			"is_sparse"			: true,
			'grid'				: null
		};

	// EXTENDS DEFAULT OPTIONS WITH GIVEN OPTIONS
	var ext_settings = $.extend(default_settings, arg_settings);

	// CHECK SETTINGS
	if ( ! Libapt.is_not_empty_str(ext_settings.name) )
	{
		trace_error(context, 'name is not valid', true);
		return null;
	}
	if ( Libapt.is_null(ext_settings.field) )
	{
		trace_error(context, 'field is not valid', true);
		return null;
	}

	// CREATE OBJECT
	var obj = new LibaptPivotGroup(ext_settings.name, ext_settings.field, ext_settings.label, ext_settings.grid);
	obj.can_group_on_cols	= ext_settings.can_group_on_cols;
	obj.can_group_on_rows	= ext_settings.can_group_on_rows;
	obj.is_sparse			= ext_settings.is_sparse;

	trace_leave(context, '', true);
	return obj;
}


text:
<?php

/** Zend_Mobile_Push_Interface **/
require_once 'Zend/Mobile/Push/Interface.php';

/** Zend_Mobile_Push_Exception **/
require_once 'Zend/Mobile/Push/Exception.php';

/**
 * Push Abstract
 *
 * @category   Zend
 * @package    Zend_Mobile
 * @subpackage Zend_Mobile_Push
 * @copyright  Copyright (c) 2005-2011 Zend Technologies USA Inc. (http://www.zend.com)
 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 * @version    $Id$
 */
abstract class Zend_Mobile_Push_Abstract implements Zend_Mobile_Push_Interface
{
    /**
     * Is Connected
     *
     * @var boolean
     */
    protected $_isConnected = false;

    /**
     * Connect to the Push Server
     *
     * @return Zend_Mobile_Push_Abstract
     */
    public function connect()
    {
        $this->_isConnected = true;
        return $this;
    }

    /**
     * Send a Push Message
     *
     * @param Zend_Mobile_Push_Message_Abstract $message
     * @return boolean
     * @throws DomainException
     */
    public function send(Zend_Mobile_Push_Message_Abstract $message)
    {
        if (!$this->_isConnected) {
            $this->connect();
        }
        return true;
    }

    /**
     * Close the Connection to the Push Server
     *
     * @return void
     */
    public function close()
    {
        $this->_isConnected = false;
    }

    /**
     * Is Connected
     *
     * @return boolean
     */
    public function isConnected()
    {
        return $this->_isConnected;
    }

    /**
     * Set Options
     *
     * @param array $options
     * @return Zend_Mobile_Push_Abstract
     * @throws Zend_Mobile_Push_Exception
     */
    public function setOptions(array $options)
    {
        foreach ($options as $k => $v) {
            $method = 'set' . ucwords($k);
            if (!method_exists($this, $method)) {
                throw new Zend_Mobile_Push_Exception('The method "' . $method . "' does not exist.");
            }
            $this->$method($v);
        }
        return $this;
    }
}


text:
/*
 * Ext JS Library 2.1
 *
 */

Ext.onReady(function(){
    Ext.QuickTips.init();

    var tb = new Ext.Toolbar();
    tb.render('toolbarLoggedOut');
    tb.add(new Ext.Toolbar.Button({text: 'Home',link:'CasLogin.do',handler: handleMenu}));

    // functions to display feedback

	function handleMenu(item)
	{
	document.location.href = item.link;
	}

});


text:
types:
  - global
id: 344d0518-9deb-4bfc-ac62-fe48a9304a81
---
A helper to output the CSRF token inside a hidden field named `_token` from the session.

POST requests in Statamic will be keeping an eye out for a `_token` value.

```
{{ csrf_field }}
```

```
<input type="hidden" name="_token" value="csrftokenhere" />
```


text:
<?php

namespace Qmaker\Linq\Operation;

use Qmaker\Linq\IEnumerable;

interface Joining
{
    /**
     * Make cross-product of two iterators
     * @param array|\Iterator|callable|IEnumerable $source
     * @param callable $projector
     * @return $this
     */
    function product($source, $projector = null);

    /**
     * Joins two sequences based on key selector functions and extracts pairs of values
     * @param array|\Iterator|callable|IEnumerable $source
     * @param callable $expression The expression to compute key from value for source
     * @param callable $expressionInner The expression to compute key from value for current stream
     * @param callable $projector
     * @param callable $predicate
     * @return $this
     */
    function join($source, $expression, $expressionInner, $projector = null, $predicate = null);

    /**
     * Joins two sequences based on key selector functions and extracts pairs of values. The pair consists of the
     * element from the left stream and the element from the right stream or null, if there is no corresponding element
     * found
     * @param array|\Iterator|callable|IEnumerable $source
     * @param callable $expression The expression to compute key from value for source
     * @param callable $expressionInner The expression to compute key from value for current stream
     * @param callable $projector
     * @param callable $predicate
     * @return $this
     */
    function joinOuter($source, $expression, $expressionInner, $projector = null, $predicate = null);

    /**
     * Joins two sequences based on key selector functions and groups the resulting matches for each element
     * @param array|\Iterator|callable|IEnumerable $source
     * @param callable $expression The expression to compute key from value for source
     * @param callable $expressionInner The expression to compute key from value for current stream
     * @param callable $projector
     * @param callable $predicate
     * @return $this
     */
    function groupJoin($source, $expression, $expressionInner, $projector = null, $predicate = null);
}


text:
<!DOCTYPE html>

        <title>Contact - Capture the CTF</title>
        <link href="css/normalize.css" rel="stylesheet">
        <link href="css/bootstrap.css" rel="stylesheet">
        <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
        <link href="css/styles.css" rel="stylesheet">

Home

About

FAQ

Sponsors

Contact

Register

team@ctctf.io

/capturethectf

@capturethectf