text:
<TITLE
>Video</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.64
"><LINK
REL="HOME"
TITLE="SDL Library Documentation"
HREF="index.html"><LINK
REL="UP"
TITLE="SDL Reference"
HREF="reference.html"><LINK
REL="PREVIOUS"
TITLE="SDL_WasInit"
HREF="sdlwasinit.html"><LINK
REL="NEXT"
TITLE="SDL_GetVideoSurface"
HREF="sdlgetvideosurface.html"><META
NAME="KEYWORD"
CONTENT="video"><META
NAME="KEYWORD"
CONTENT="function">

SDL Library Documentation

Prev		Next

Chapter 6. Video

Table of Contents

SDL_GetVideoSurface — returns a pointer to the current display surface

SDL_GetVideoInfo — returns a pointer to information about the video hardware

SDL_VideoDriverName — Obtain the name of the video driver

SDL_ListModes — Returns a pointer to an array of available screen dimensions for
the given format and video flags

SDL_VideoModeOK — Check to see if a particular video mode is supported.

SDL_SetVideoMode — Set up a video mode with the specified width, height and bits-per-pixel.

SDL_UpdateRect — Makes sure the given area is updated on the given screen.

SDL_UpdateRects — Makes sure the given list of rectangles is updated on the given screen.

SDL_Flip — Swaps screen buffers

SDL_SetColors — Sets a portion of the colormap for the given 8-bit surface.

SDL_SetPalette — Sets the colors in the palette of an 8-bit surface.

SDL_SetGamma — Sets the color gamma function for the display

SDL_GetGammaRamp — Gets the color gamma lookup tables for the display

SDL_SetGammaRamp — Sets the color gamma lookup tables for the display

SDL_MapRGB — Map a RGB color value to a pixel format.

SDL_MapRGBA — Map a RGBA color value to a pixel format.

SDL_GetRGB — Get RGB values from a pixel in the specified pixel format.

SDL_GetRGBA — Get RGBA values from a pixel in the specified pixel format.

SDL_CreateRGBSurface — Create an empty SDL_Surface

SDL_CreateRGBSurfaceFrom — Create an SDL_Surface from pixel data

SDL_FreeSurface — Frees (deletes) a SDL_Surface

SDL_LockSurface — Lock a surface for directly access.

SDL_UnlockSurface — Unlocks a previously locked surface.

SDL_LoadBMP — Load a Windows BMP file into an SDL_Surface.

SDL_SaveBMP — Save an SDL_Surface as a Windows BMP file.

SDL_SetColorKey — Sets the color key (transparent pixel) in a blittable surface and
RLE acceleration.

SDL_SetAlpha — Adjust the alpha properties of a surface

SDL_SetClipRect — Sets the clipping rectangle for a surface.

SDL_GetClipRect — Gets the clipping rectangle for a surface.

SDL_ConvertSurface — Converts a surface to the same format as another surface.

SDL_BlitSurface — This performs a fast blit from the source surface to the destination surface.

SDL_FillRect — This function performs a fast fill of the given rectangle with some color

SDL_DisplayFormat — Convert a surface to the display format

SDL_DisplayFormatAlpha — Convert a surface to the display format

SDL_WarpMouse — Set the position of the mouse cursor.

SDL_CreateCursor — Creates a new mouse cursor.

SDL_FreeCursor — Frees a cursor created with SDL_CreateCursor.

SDL_SetCursor — Set the currently active mouse cursor.

SDL_GetCursor — Get the currently active mouse cursor.

SDL_ShowCursor — Toggle whether or not the cursor is shown on the screen.

SDL_GL_LoadLibrary — Specify an OpenGL library

SDL_GL_GetProcAddress — Get the address of a GL function

SDL_GL_GetAttribute — Get the value of a special SDL/OpenGL attribute

SDL_GL_SetAttribute — Set a special SDL/OpenGL attribute

SDL_GL_SwapBuffers — Swap OpenGL framebuffers/Update Display

SDL_CreateYUVOverlay — Create a YUV video overlay

SDL_LockYUVOverlay — Lock an overlay

SDL_UnlockYUVOverlay — Unlock an overlay

SDL_DisplayYUVOverlay — Blit the overlay to the display

SDL_FreeYUVOverlay — Free a YUV video overlay

SDL_GLattr — SDL GL Attributes

SDL_Rect — Defines a rectangular area

SDL_Color — Format independent color description

SDL_Palette — Color palette for 8-bit pixel formats

SDL_PixelFormat — Stores surface format information

SDL_Surface — Graphical Surface Structure

SDL_VideoInfo — Video Target information

SDL_Overlay — YUV video overlay

SDL presents a very simple interface to the display framebuffer.  The
framebuffer is represented as an offscreen surface to which you can write
directly.  If you want the screen to show what you have written, call the update function which will
guarantee that the desired portion of the screen is updated.

Before you call any of the SDL video functions, you must first call
SDL_Init(SDL_INIT_VIDEO), which initializes the video
and events in the SDL library.  Check the return code, which should be
0, to see if there were any errors in starting up.

If you use both sound and video in your application, you need to call
SDL_Init(SDL_INIT_AUDIO | SDL_INIT_VIDEO) before opening the
sound device, otherwise under Win32 DirectX, you won't be able to set
full-screen display modes.

After you have initialized the library, you can start up the video display in a
number of ways.  The easiest way is to pick a common screen resolution and
depth and just initialize the video, checking for errors.  You will probably
get what you want, but SDL may be emulating your requested mode and converting
the display on update.  The best way is to
query, for the best
video mode closest to the desired one, and then
convert
your images to that pixel format.

SDL currently supports any bit depth >= 8 bits per pixel.  8 bpp formats are
considered 8-bit palettized modes, while 12, 15, 16, 24, and 32 bits per pixel
are considered "packed pixel" modes, meaning each pixel contains the RGB color
components packed in the bits of the pixel.

After you have initialized your video mode, you can take the surface that was
returned, and write to it like any other framebuffer, calling the update
routine as you go.

When you have finished your video access and are ready to quit your
application, you should call "SDL_Quit()" to shutdown the
video and events.

Prev	Home	Next

SDL_WasInit	Up	SDL_GetVideoSurface


text:
<?php

declare(strict_types=1);

namespace Sphp\Stdlib;

/**
 * Implements a simple interface to track the consumed time
 *
 * @author  Sami Holck <sami.holck@gmail.com>
 * @license https://opensource.org/licenses/MIT The MIT License
 * @filesource
 */
class StopWatch {

  /**
   * the start time
   *
   * @var float
   */
  private $startTime;

  /**
   * Starts the clock from the page request
   *
   * @return $this for a fluent interface
   */
  public function startFromRequest() {
    $this->startTime = $_SERVER['REQUEST_TIME_FLOAT'] ?? 0.0;
    return $this;
  }

  /**
   * Starts the timer from the call of this method
   *
   * @return $this for a fluent interface
   */
  public function start() {
    $this->startTime = microtime(true);
    return $this;
  }

  /**
   * Returns the amount of the time from the constructor call or start call to
   *  the current time
   *
   * @return float the requested time
   */
  public function getTime(): float {
    $seconds = microtime(true) - $this->startTime;
    return $seconds;
  }

  /**
   * Returns the amount of the time from the start of the execution to the
   * current time
   *
   * @return float the requested time
   */
  public static function getExecutionTime(): float {
    $instance = new Static();
    $instance->startFromRequest();
    return $instance->getTime();
  }

}

redpajama_set_name: RedPajamaGithub


text:
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;

namespace SunnyChen.Common.Windows.ShellApi
{
    [ComImport]
    [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
    [Guid("000214E6-0000-0000-C000-000000000046")]
    public interface IShellFolder
    {
        // Translates a file object's or folder's display name into an item identifier list.
        // Return value: error code, if any
        [PreserveSig]
        Int32 ParseDisplayName(
            IntPtr hwnd,				// Optional window handle
            IntPtr pbc,					// Optional bind context that controls the parsing operation. This parameter is
            // normally set to NULL.
            [MarshalAs(UnmanagedType.LPWStr)]
			String pszDisplayName,		// Null-terminated UNICODE string with the display name.
            ref UInt32 pchEaten,		// Pointer to a ULONG value that receives the number of characters of the
            // display name that was parsed.
            out IntPtr ppidl,			// Pointer to an ITEMIDLIST pointer that receives the item identifier list for
            // the object.
            ref UInt32 pdwAttributes);	// Optional parameter that can be used to query for file attributes.
        // this can be values from the SFGAO enum

        // Allows a client to determine the contents of a folder by creating an item identifier enumeration object
        // and returning its IEnumIDList interface.
        // Return value: error code, if any
        [PreserveSig]
        Int32 EnumObjects(
            IntPtr hwnd,				// If user input is required to perform the enumeration, this window handle
            // should be used by the enumeration object as the parent window to take
            // user input.
            Int32 grfFlags,				// Flags indicating which items to include in the enumeration. For a list
            // of possible values, see the SHCONTF enum.
            out IntPtr ppenumIDList);	// Address that receives a pointer to the IEnumIDList interface of the
        // enumeration object created by this method.

        // Retrieves an IShellFolder object for a subfolder.
        // Return value: error code, if any
        [PreserveSig]
        Int32 BindToObject(
            IntPtr pidl,				// Address of an ITEMIDLIST structure (PIDL) that identifies the subfolder.
            IntPtr pbc,					// Optional address of an IBindCtx interface on a bind context object to be
            // used during this operation.
            Guid riid,					// Identifier of the interface to return.
            out IntPtr ppv);			// Address that receives the interface pointer.

        // Requests a pointer to an object's storage interface.
        // Return value: error code, if any
        [PreserveSig]
        Int32 BindToStorage(
            IntPtr pidl,				// Address of an ITEMIDLIST structure that identifies the subfolder relative
            // to its parent folder.
            IntPtr pbc,					// Optional address of an IBindCtx interface on a bind context object to be
            // used during this operation.
            Guid riid,					// Interface identifier (IID) of the requested storage interface.
            out IntPtr ppv);			// Address that receives the interface pointer specified by riid.

        // Determines the relative order of two file objects or folders, given their item identifier lists.
        // Return value: If this method is successful, the CODE field of the HRESULT contains one of the following
        // values (the code can be retrived using the helper function GetHResultCode):
        // Negative A negative return value indicates that the first item should precede the second (pidl1 < pidl2).
        // Positive A positive return value indicates that the first item should follow the second (pidl1 > pidl2).
        // Zero A return value of zero indicates that the two items are the same (pidl1 = pidl2).
        [PreserveSig]
        Int32 CompareIDs(
            Int32 lParam,				// Value that specifies how the comparison should be performed. The lower
            // sixteen bits of lParam define the sorting rule. The upper sixteen bits of
            // lParam are used for flags that modify the sorting rule. values can be from
            // the SHCIDS enum
            IntPtr pidl1,				// Pointer to the first item's ITEMIDLIST structure.
            IntPtr pidl2);				// Pointer to the second item's ITEMIDLIST structure.

        // Requests an object that can be used to obtain information from or interact with a folder object.
        // Return value: error code, if any
        [PreserveSig]
        Int32 CreateViewObject(
            IntPtr hwndOwner,			// Handle to the owner window.
            Guid riid,					// Identifier of the requested interface.
            out IntPtr ppv);			// Address of a pointer to the requested interface.

        // Retrieves the attributes of one or more file objects or subfolders.
        // Return value: error code, if any
        [PreserveSig]
        Int32 GetAttributesOf(
            UInt32 cidl,				// Number of file objects from which to retrieve attributes.

            [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)]
			IntPtr[] apidl,				// Address of an array of pointers to ITEMIDLIST structures, each of which
            // uniquely identifies a file object relative to the parent folder.
            ref UInt32 rgfInOut);		// Address of a single ULONG value that, on entry, contains the attributes that
        // the caller is requesting. On exit, this value contains the requested
        // attributes that are common to all of the specified objects. this value can
        // be from the SFGAO enum

        // Retrieves an OLE interface that can be used to carry out actions on the specified file objects or folders.
        // Return value: error code, if any
        [PreserveSig]
        Int32 GetUIObjectOf(
            IntPtr hwndOwner,			// Handle to the owner window that the client should specify if it displays
            // a dialog box or message box.
            UInt32 cidl,				// Number of file objects or subfolders specified in the apidl parameter.
            IntPtr[] apidl,				// Address of an array of pointers to ITEMIDLIST structures, each of which
            // uniquely identifies a file object or subfolder relative to the parent folder.
            Guid riid,					// Identifier of the COM interface object to return.
            ref UInt32 rgfReserved,		// Reserved.
            out IntPtr ppv);			// Pointer to the requested interface.

        // Retrieves the display name for the specified file object or subfolder.
        // Return value: error code, if any
        [PreserveSig]
        Int32 GetDisplayNameOf(
            IntPtr pidl,				// Address of an ITEMIDLIST structure (PIDL) that uniquely identifies the file
            // object or subfolder relative to the parent folder.
            UInt32 uFlags,				// Flags used to request the type of display name to return. For a list of
            // possible values, see the SHGNO enum.
            out ShellApi.STRRET pName);			// Address of a STRRET structure in which to return the display name.

        // Sets the display name of a file object or subfolder, changing the item identifier in the process.
        // Return value: error code, if any
        [PreserveSig]
        Int32 SetNameOf(
            IntPtr hwnd,				// Handle to the owner window of any dialog or message boxes that the client
            // displays.
            IntPtr pidl,				// Pointer to an ITEMIDLIST structure that uniquely identifies the file object
            // or subfolder relative to the parent folder.
            [MarshalAs(UnmanagedType.LPWStr)]
			String pszName,				// Pointer to a null-terminated string that specifies the new display name.
            UInt32 uFlags,				// Flags indicating the type of name specified by the lpszName parameter. For
            // a list of possible values, see the description of the SHGNO enum.
            out IntPtr ppidlOut);		// Address of a pointer to an ITEMIDLIST structure which receives the new ITEMIDLIST.
    }
}


text:
#pragma once
#ifndef __nodeGenerator_H__
#define __nodeGenerator_H__
#include "Air3Prerequisties.h"
#include "NPCNode.h"
#include "NodeList.h"
#include "Ogre.h"
#include "OgreVector3.h"
#include "OgreQuaternion.h"
using namespace Ogre;
using namespace std;

class AIR3EXPORT nodeGenerator
{
public:
	nodeGenerator(Vector3 size,SceneManager* scene,int spacing,bool nodeListFeedback);
	~nodeGenerator();
	void setNodeList(NodeList* nList);
	vector<NPCNode*> generate_nodes(void);
private:
	NodeList* nodeList;
	int mSpacing;
	bool feedback;
	SceneManager* mSceneMgr;
	Vector3 mSize;
};

#endif /*__SOUNDMANAGER_H__*/


text:
package seedu.Tdoo.testutil;

import seedu.Tdoo.model.TaskList;
import seedu.Tdoo.model.task.Task;
import seedu.Tdoo.model.task.UniqueTaskList;

/**
 * A utility class to help with building TodoList objects.
 */
public class TodoListBuilder {

	private TaskList TodoList;

	public TodoListBuilder(TaskList TodoList) {
		this.TodoList = TodoList;
	}

	public TodoListBuilder withTask(Task task) throws UniqueTaskList.DuplicatetaskException {
		TodoList.addTask(task);
		return this;
	}

	public TaskList build() {
		return TodoList;
	}
}


text:
'use babel';

import AtomKlipView from '../lib/atom-klip-view';

describe('AtomKlipView', () => {
  it('has one valid test', () => {
    expect('life').toBe('easy');
  });
});


text:
<?php

/**
 * Created by PhpStorm.
 * User: puyihao
 * Date: 2016/12/22
 * Time: 23:43
 */
class Login extends CI_Controller
{
    public function __construct()
    {
        parent::__construct();
        $this->load->helper('url');
        $this->load->helper('form');
        $this->load->library('form_validation');
    }

    public function index()
    {
        $this->load->view('userSystem/login');
    }

    public function logout()
    {
        $this->User_model->logout();
        redirect("");
    }

    public function login()
    {
        $this->form_validation->set_rules('user_account', 'Username', 'callback_username_check');
        $this->form_validation->set_rules('user_password', 'Password', 'callback_password_check');

        if ($this->form_validation->run() == FALSE) {
            $this->load->view('userSystem/login');
        } else {
            $this->User_model->to_login($_POST['user_account']);
            redirect('FaultManage/FaultShow');
        }
    }

    public function username_check($user_name)
    {
        $user = $this->User_model->get_by_account($user_name);
        if ($user->num_rows() == 0) {
            $this->form_validation->set_message('username_check', '用户名不存在');
            return FALSE;
        } else {
            return TRUE;
        }
    }

    public function password_check()
    {
        $user = $this->User_model->get_by_account($_POST['user_account']);
        if ($user->num_rows() > 0 && $user->row()->user_password != sha1($_POST['user_password'])) {
            $this->form_validation->set_message('password_check', '密码错误');
            return FALSE;
        } else {
            return TRUE;
        }
    }

}


text:
<?xml version="1.0" ?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements.  See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to you under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License.  You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<Root>
  <TestCase name="testSingleRowNotEquiJoin">
    <Resource name="sql">
      <![CDATA[SELECT a1, a2 FROM A, (SELECT COUNT(a1) AS cnt FROM A) WHERE a1 < cnt]]>
    </Resource>
    <Resource name="planBefore">
      <![CDATA[
LogicalProject(a1=[$0], a2=[$1])
+- LogicalFilter(condition=[<($0, $2)])
   +- LogicalJoin(condition=[true], joinType=[inner])
      :- LogicalTableScan(table=[[default_catalog, default_database, A, source: [TestTableSource(a1, a2)]]])
      +- LogicalAggregate(group=[{}], cnt=[COUNT($0)])
         +- LogicalProject(a1=[$0])
            +- LogicalTableScan(table=[[default_catalog, default_database, A, source: [TestTableSource(a1, a2)]]])
]]>
    </Resource>
    <Resource name="planAfter">
      <![CDATA[
Calc(select=[a1, a2])
+- NestedLoopJoin(joinType=[InnerJoin], where=[<(a1, cnt)], select=[a1, a2, cnt], build=[right], singleRowJoin=[true])
   :- Exchange(distribution=[any], shuffle_mode=[BATCH])
   :  +- LegacyTableSourceScan(table=[[default_catalog, default_database, A, source: [TestTableSource(a1, a2)]]], fields=[a1, a2], reuse_id=[1])
   +- Exchange(distribution=[broadcast])
      +- HashAggregate(isMerge=[true], select=[Final_COUNT(count$0) AS cnt])
         +- Exchange(distribution=[single])
            +- LocalHashAggregate(select=[Partial_COUNT(a1) AS count$0])
               +- Calc(select=[a1])
                  +- Reused(reference_id=[1])
]]>
    </Resource>
  </TestCase>
  <TestCase name="testLeftSingleRightJoinEqualPredicate">
    <Resource name="sql">
      <![CDATA[SELECT a1 FROM (SELECT COUNT(*) AS cnt FROM B) RIGHT JOIN A ON cnt = a2]]>
    </Resource>
    <Resource name="planBefore">
      <![CDATA[
LogicalProject(a1=[$1])
+- LogicalJoin(condition=[=($0, $2)], joinType=[right])
   :- LogicalAggregate(group=[{}], cnt=[COUNT()])
   :  +- LogicalProject($f0=[0])
   :     +- LogicalTableScan(table=[[default_catalog, default_database, B, source: [TestTableSource(b1, b2)]]])
   +- LogicalTableScan(table=[[default_catalog, default_database, A, source: [TestTableSource(a1, a2)]]])
]]>
    </Resource>
    <Resource name="planAfter">
      <![CDATA[
Calc(select=[a1])
+- NestedLoopJoin(joinType=[RightOuterJoin], where=[=(cnt, a2)], select=[cnt, a1, a2], build=[left], singleRowJoin=[true])
   :- Exchange(distribution=[broadcast])
   :  +- HashAggregate(isMerge=[true], select=[Final_COUNT(count1$0) AS cnt])
   :     +- Exchange(distribution=[single])
   :        +- LocalHashAggregate(select=[Partial_COUNT(*) AS count1$0])
   :           +- Calc(select=[0 AS $f0])
   :              +- LegacyTableSourceScan(table=[[default_catalog, default_database, B, source: [TestTableSource(b1, b2)]]], fields=[b1, b2])
   +- LegacyTableSourceScan(table=[[default_catalog, default_database, A, source: [TestTableSource(a1, a2)]]], fields=[a1, a2])
]]>
    </Resource>
  </TestCase>
  <TestCase name="testLeftSingleRightJoinNotEqualPredicate">
    <Resource name="sql">
      <![CDATA[SELECT a1 FROM (SELECT COUNT(*) AS cnt FROM B) RIGHT JOIN A ON cnt < a2]]>
    </Resource>
    <Resource name="planBefore">
      <![CDATA[
LogicalProject(a1=[$1])
+- LogicalJoin(condition=[<($0, $2)], joinType=[right])
   :- LogicalAggregate(group=[{}], cnt=[COUNT()])
   :  +- LogicalProject($f0=[0])
   :     +- LogicalTableScan(table=[[default_catalog, default_database, B, source: [TestTableSource(b1, b2)]]])
   +- LogicalTableScan(table=[[default_catalog, default_database, A, source: [TestTableSource(a1, a2)]]])
]]>
    </Resource>
    <Resource name="planAfter">
      <![CDATA[
Calc(select=[a1])
+- NestedLoopJoin(joinType=[RightOuterJoin], where=[<(cnt, a2)], select=[cnt, a1, a2], build=[left], singleRowJoin=[true])
   :- Exchange(distribution=[broadcast])
   :  +- HashAggregate(isMerge=[true], select=[Final_COUNT(count1$0) AS cnt])
   :     +- Exchange(distribution=[single])
   :        +- LocalHashAggregate(select=[Partial_COUNT(*) AS count1$0])
   :           +- Calc(select=[0 AS $f0])
   :              +- LegacyTableSourceScan(table=[[default_catalog, default_database, B, source: [TestTableSource(b1, b2)]]], fields=[b1, b2])
   +- LegacyTableSourceScan(table=[[default_catalog, default_database, A, source: [TestTableSource(a1, a2)]]], fields=[a1, a2])
]]>
    </Resource>
  </TestCase>
  <TestCase name="testRightSingleLeftJoinNotEqualPredicate">
    <Resource name="sql">
      <![CDATA[SELECT a2 FROM A LEFT JOIN (SELECT COUNT(*) AS cnt FROM B) AS x ON a1 > cnt]]>
    </Resource>
    <Resource name="planBefore">
      <![CDATA[
LogicalProject(a2=[$1])
+- LogicalJoin(condition=[>($0, $2)], joinType=[left])
   :- LogicalTableScan(table=[[default_catalog, default_database, A, source: [TestTableSource(a1, a2)]]])
   +- LogicalAggregate(group=[{}], cnt=[COUNT()])
      +- LogicalProject($f0=[0])
         +- LogicalTableScan(table=[[default_catalog, default_database, B, source: [TestTableSource(b1, b2)]]])
]]>
    </Resource>
    <Resource name="planAfter">
      <![CDATA[
Calc(select=[a2])
+- NestedLoopJoin(joinType=[LeftOuterJoin], where=[>(a1, cnt)], select=[a1, a2, cnt], build=[right], singleRowJoin=[true])
   :- LegacyTableSourceScan(table=[[default_catalog, default_database, A, source: [TestTableSource(a1, a2)]]], fields=[a1, a2])
   +- Exchange(distribution=[broadcast])
      +- HashAggregate(isMerge=[true], select=[Final_COUNT(count1$0) AS cnt])
         +- Exchange(distribution=[single])
            +- LocalHashAggregate(select=[Partial_COUNT(*) AS count1$0])
               +- Calc(select=[0 AS $f0])
                  +- LegacyTableSourceScan(table=[[default_catalog, default_database, B, source: [TestTableSource(b1, b2)]]], fields=[b1, b2])
]]>
    </Resource>
  </TestCase>
  <TestCase name="testSingleRowCrossJoin">
    <Resource name="sql">
      <![CDATA[SELECT a1, a_sum FROM A, (SELECT SUM(a1) + SUM(a2) AS a_sum FROM A)]]>
    </Resource>
    <Resource name="planBefore">
      <![CDATA[
LogicalProject(a1=[$0], a_sum=[$2])
+- LogicalJoin(condition=[true], joinType=[inner])
   :- LogicalTableScan(table=[[default_catalog, default_database, A, source: [TestTableSource(a1, a2)]]])
   +- LogicalProject(a_sum=[+($0, $1)])
      +- LogicalAggregate(group=[{}], agg#0=[SUM($0)], agg#1=[SUM($1)])
         +- LogicalTableScan(table=[[default_catalog, default_database, A, source: [TestTableSource(a1, a2)]]])
]]>
    </Resource>
    <Resource name="planAfter">
      <![CDATA[
NestedLoopJoin(joinType=[InnerJoin], where=[true], select=[a1, a_sum], build=[right], singleRowJoin=[true])
:- Exchange(distribution=[any], shuffle_mode=[BATCH])
:  +- Calc(select=[a1])
:     +- LegacyTableSourceScan(table=[[default_catalog, default_database, A, source: [TestTableSource(a1, a2)]]], fields=[a1, a2], reuse_id=[1])
+- Exchange(distribution=[broadcast])
   +- Calc(select=[+($f0, $f1) AS a_sum])
      +- HashAggregate(isMerge=[true], select=[Final_SUM(sum$0) AS $f0, Final_SUM(sum$1) AS $f1])
         +- Exchange(distribution=[single])
            +- LocalHashAggregate(select=[Partial_SUM(a1) AS sum$0, Partial_SUM(a2) AS sum$1])
               +- Reused(reference_id=[1])
]]>
    </Resource>
  </TestCase>
  <TestCase name="testRightSingleLeftJoinEqualPredicate">
    <Resource name="sql">
      <![CDATA[SELECT a2 FROM A LEFT JOIN (SELECT COUNT(*) AS cnt FROM B) AS x  ON a1 = cnt]]>
    </Resource>
    <Resource name="planBefore">
      <![CDATA[
LogicalProject(a2=[$1])
+- LogicalJoin(condition=[=($0, $2)], joinType=[left])
   :- LogicalTableScan(table=[[default_catalog, default_database, A, source: [TestTableSource(a1, a2)]]])
   +- LogicalAggregate(group=[{}], cnt=[COUNT()])
      +- LogicalProject($f0=[0])
         +- LogicalTableScan(table=[[default_catalog, default_database, B, source: [TestTableSource(b1, b2)]]])
]]>
    </Resource>
    <Resource name="planAfter">
      <![CDATA[
Calc(select=[a2])
+- NestedLoopJoin(joinType=[LeftOuterJoin], where=[=(a1, cnt)], select=[a1, a2, cnt], build=[right], singleRowJoin=[true])
   :- LegacyTableSourceScan(table=[[default_catalog, default_database, A, source: [TestTableSource(a1, a2)]]], fields=[a1, a2])
   +- Exchange(distribution=[broadcast])
      +- HashAggregate(isMerge=[true], select=[Final_COUNT(count1$0) AS cnt])
         +- Exchange(distribution=[single])
            +- LocalHashAggregate(select=[Partial_COUNT(*) AS count1$0])
               +- Calc(select=[0 AS $f0])
                  +- LegacyTableSourceScan(table=[[default_catalog, default_database, B, source: [TestTableSource(b1, b2)]]], fields=[b1, b2])
]]>
    </Resource>
  </TestCase>
  <TestCase name="testSingleRowJoinWithComplexPredicate">
    <Resource name="sql">
      <![CDATA[
SELECT a1, a2, b1, b2 FROM A,
  (SELECT min(b1) AS b1, max(b2) AS b2 FROM B)
WHERE a1 < b1 AND a2 = b2
      ]]>
    </Resource>
    <Resource name="planBefore">
      <![CDATA[
LogicalProject(a1=[$0], a2=[$1], b1=[$2], b2=[$3])
+- LogicalFilter(condition=[AND(<($0, $2), =($1, $3))])
   +- LogicalJoin(condition=[true], joinType=[inner])
      :- LogicalTableScan(table=[[default_catalog, default_database, A, source: [TestTableSource(a1, a2)]]])
      +- LogicalAggregate(group=[{}], b1=[MIN($0)], b2=[MAX($1)])
         +- LogicalTableScan(table=[[default_catalog, default_database, B, source: [TestTableSource(b1, b2)]]])
]]>
    </Resource>
    <Resource name="planAfter">
      <![CDATA[
NestedLoopJoin(joinType=[InnerJoin], where=[AND(<(a1, b1), =(a2, b2))], select=[a1, a2, b1, b2], build=[right], singleRowJoin=[true])
:- LegacyTableSourceScan(table=[[default_catalog, default_database, A, source: [TestTableSource(a1, a2)]]], fields=[a1, a2])
+- Exchange(distribution=[broadcast])
   +- HashAggregate(isMerge=[true], select=[Final_MIN(min$0) AS b1, Final_MAX(max$1) AS b2])
      +- Exchange(distribution=[single])
         +- LocalHashAggregate(select=[Partial_MIN(b1) AS min$0, Partial_MAX(b2) AS max$1])
            +- LegacyTableSourceScan(table=[[default_catalog, default_database, B, source: [TestTableSource(b1, b2)]]], fields=[b1, b2])
]]>
    </Resource>
  </TestCase>
  <TestCase name="testSingleRowJoinInnerJoin">
    <Resource name="sql">
      <![CDATA[SELECT a2, SUM(a1) FROM A GROUP BY a2 HAVING SUM(a1) > (SELECT SUM(a1) * 0.1 FROM A)]]>
    </Resource>
    <Resource name="planBefore">
      <![CDATA[
LogicalFilter(condition=[>($1, $SCALAR_QUERY({
LogicalProject(EXPR$0=[*($0, 0.1:DECIMAL(2, 1))])
  LogicalAggregate(group=[{}], agg#0=[SUM($0)])
    LogicalProject(a1=[$0])
      LogicalTableScan(table=[[default_catalog, default_database, A, source: [TestTableSource(a1, a2)]]])
}))])
+- LogicalAggregate(group=[{0}], EXPR$1=[SUM($1)])
   +- LogicalProject(a2=[$1], a1=[$0])
      +- LogicalTableScan(table=[[default_catalog, default_database, A, source: [TestTableSource(a1, a2)]]])
]]>
    </Resource>
    <Resource name="planAfter">
      <![CDATA[
Calc(select=[a2, EXPR$1])
+- NestedLoopJoin(joinType=[InnerJoin], where=[>(EXPR$1, $f0)], select=[a2, EXPR$1, $f0], build=[right], singleRowJoin=[true])
   :- HashAggregate(isMerge=[true], groupBy=[a2], select=[a2, Final_SUM(sum$0) AS EXPR$1])
   :  +- Exchange(distribution=[hash[a2]])
   :     +- LocalHashAggregate(groupBy=[a2], select=[a2, Partial_SUM(a1) AS sum$0])
   :        +- LegacyTableSourceScan(table=[[default_catalog, default_database, A, source: [TestTableSource(a1, a2)]]], fields=[a1, a2], reuse_id=[1])
   +- Exchange(distribution=[broadcast])
      +- SortAggregate(isMerge=[false], select=[SINGLE_VALUE(EXPR$0) AS $f0])
         +- Calc(select=[*($f0, 0.1:DECIMAL(2, 1)) AS EXPR$0])
            +- SortAggregate(isMerge=[true], select=[Final_SUM(sum$0) AS $f0])
               +- Exchange(distribution=[single])
                  +- LocalSortAggregate(select=[Partial_SUM(a1) AS sum$0])
                     +- Calc(select=[a1])
                        +- Reused(reference_id=[1])
]]>
    </Resource>
  </TestCase>
</Root>


text:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

	<parent>
		<groupId>com.systematic.trading</groupId>
		<artifactId>systematic-trading-parent</artifactId>
		<version>1.0.0</version>
		<relativePath>../systematic-trading-parent/pom.xml</relativePath>
	</parent>

	<modelVersion>4.0.0</modelVersion>
	<artifactId>systematic-trading-data</artifactId>
	<version>0.0.1-SNAPSHOT</version>

	<dependencies>
		<dependency>
			<groupId>com.systematic.trading</groupId>
			<artifactId>systematic-trading-data-model</artifactId>
			<version>${systematic.trading.data.model.version}</version>
		</dependency>

		<!-- Data service instantiation -->
		<dependency>
			<groupId>com.systematic.trading</groupId>
			<artifactId>systematic-trading-data-api-yahoo</artifactId>
			<version>${systematic.trading.data.api.yahoo.version}</version>
		</dependency>
		<dependency>
			<groupId>com.systematic.trading</groupId>
			<artifactId>systematic-trading-data-api-alpha-vantage</artifactId>
			<version>${systematic.trading.data.api.alpha.vantage.version}</version>
		</dependency>
		<dependency>
			<groupId>com.systematic.trading</groupId>
			<artifactId>systematic-trading-data-api-quandl</artifactId>
			<version>${systematic.trading.data.api.quandl.version}</version>
		</dependency>
		<dependency>
			<groupId>com.systematic.trading</groupId>
			<artifactId>systematic-trading-data-orm-hibernate</artifactId>
			<version>${systematic.trading.data.hibernate.version}</version>
		</dependency>
	</dependencies>

</project>


text:
script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"

${script_dir}/setup-defaults.sh

${script_dir}/setup-xcode.sh

${script_dir}/setup-brew.sh

${script_dir}/setup-directories.sh

${script_dir}/setup-repositories.sh

${script_dir}/setup-python.sh

${script_dir}/setup-zsh.sh

${script_dir}/setup-apps.sh

brew cask install visual-studio-code

brew install task

brew install gnupg

brew install wget

brew install rbenv

brew tap AdoptOpenJDK/openjdk

brew cask install adoptopenjdk8

java installed under /Library/Java/JavaVirtualMachines/

enable inifnite scroll in iterm

vscode extenstions:

- Docker
- TSlint
- Jest runner
- Python


text:
#ifdef MEMORY_CHECK
#include <assert.h>
#define MEMCHECK(x) x
#else
#define MEMCHECK(x)
#endif

#if defined(WIN32) && !defined(_WIN32_WCE)
#define _CRTDBG_MAP_ALLOC
#include <crtdbg.h>
#define snprintf(dst, len, frm, ...) _snprintf_s(dst, len, _TRUNCATE, frm, __VA_ARGS__)
#endif

#include "ILibParsers.h"
#include "ILibRemoteLogging.h"
#include "ILibProcessPipe.h"
#include <assert.h>
#ifndef WIN32
#include <fcntl.h>              /* Obtain O_* constant definitions */
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>
#endif

typedef struct ILibProcessPipe_Manager_Object
{
	ILibChain_PreSelect Pre;
	ILibChain_PostSelect Post;
	ILibChain_Destroy Destroy;

	void* chain;
	ILibLinkedList ActivePipes;
	ILibQueue WaitHandles_PendingAdd;
	ILibQueue WaitHandles_PendingDel;
#ifdef WIN32
	int abort;
	HANDLE updateEvent;
	HANDLE workerThread;
#endif
}ILibProcessPipe_Manager_Object;

typedef void(*ILibProcessPipe_GenericReadHandler)(char *buffer, int bufferLen, int* bytesConsumed, void* user1, void* user2);
typedef void(*ILibProcessPipe_GenericSendOKHandler)(void* user1, void* user2);
struct ILibProcessPipe_Process_Object; // Forward Prototype

typedef struct ILibProcessPipe_PipeObject
{
	char* buffer;
	int bufferSize;

	int readOffset;
	int totalRead;

	ILibProcessPipe_Manager_Object *manager;
	struct ILibProcessPipe_Process_Object* mProcess;
	ILibQueue WriteBuffer;
	void *handler;
	void* brokenPipeHandler;
	void *user1, *user2;
#ifdef WIN32
	HANDLE mPipe_ReadEnd;
	HANDLE mPipe_WriteEnd;
	struct _OVERLAPPED *mOverlapped;
#else
	int mPipe_ReadEnd, mPipe_WriteEnd;
#endif
}ILibProcessPipe_PipeObject;

typedef void(*ILibProcessPipe_GenericBrokenPipeHandler)(ILibProcessPipe_PipeObject* sender);

typedef struct ILibProcessPipe_Process_Object
{
	unsigned int flags1, flags2;
	ILibProcessPipe_Manager_Object *parent;
	unsigned long PID;
	void *userObject;

	ILibProcessPipe_PipeObject *stdIn;
	ILibProcessPipe_PipeObject *stdOut;
	ILibProcessPipe_PipeObject *stdErr;
	ILibProcessPipe_Process_ExitHandler exitHandler;
#ifdef WIN32
	HANDLE hProcess;
#endif

}ILibProcessPipe_Process_Object;

typedef struct ILibProcessPipe_WriteData
{
	char *buffer;
	int bufferLen;
	ILibTransport_MemoryOwnership ownership;
}ILibProcessPipe_WriteData;

ILibProcessPipe_WriteData* ILibProcessPipe_WriteData_Create(char* buffer, int bufferLen, ILibTransport_MemoryOwnership ownership)
{
	ILibProcessPipe_WriteData* retVal;

	if ((retVal = (ILibProcessPipe_WriteData*)malloc(sizeof(ILibProcessPipe_WriteData))) == NULL) { ILIBCRITICALEXIT(254); }
	memset(retVal, 0, sizeof(ILibProcessPipe_WriteData));
	retVal->bufferLen = bufferLen;
	if (ownership == ILibTransport_MemoryOwnership_USER)
	{
		if ((retVal->buffer = (char*)malloc(bufferLen)) == NULL) { ILIBCRITICALEXIT(254); }
		memcpy(retVal->buffer, buffer, bufferLen);
		retVal->ownership = ILibTransport_MemoryOwnership_CHAIN;
	}
	else
	{
		retVal->buffer = buffer;
		retVal->ownership = ownership;
	}
	return(retVal);
}
#define ILibProcessPipe_WriteData_Destroy(writeData) if (writeData->ownership == ILibTransport_MemoryOwnership_CHAIN) { free(writeData->buffer); } free(writeData);

#ifdef WIN32
typedef void(*ILibProcessPipe_WaitHandle_Handler)(HANDLE event, void* user);
typedef struct ILibProcessPipe_WaitHandle
{
	HANDLE event;
	void *user;
	ILibProcessPipe_WaitHandle_Handler callback;
}ILibProcessPipe_WaitHandle;
void ILibProcessPipe_WaitHandle_Remove(ILibProcessPipe_Manager_Object *manager, HANDLE event)
{
	ILibQueue_Lock(manager->WaitHandles_PendingDel);
	ILibQueue_EnQueue(manager->WaitHandles_PendingDel, event);
	ILibQueue_UnLock(manager->WaitHandles_PendingDel);
	SetEvent(manager->updateEvent);
}
void ILibProcessPipe_WaitHandle_Add(ILibProcessPipe_Manager_Object *manager, HANDLE event, void *user, ILibProcessPipe_WaitHandle_Handler callback)
{
	ILibProcessPipe_WaitHandle *waitHandle;
	if ((waitHandle = (ILibProcessPipe_WaitHandle*)malloc(sizeof(ILibProcessPipe_WaitHandle))) == NULL) { ILIBCRITICALEXIT(254); }
	memset(waitHandle, 0, sizeof(ILibProcessPipe_WaitHandle));

	waitHandle->event = event;
	waitHandle->user = user;
	waitHandle->callback = callback;

	ILibQueue_Lock(manager->WaitHandles_PendingAdd);
	ILibQueue_EnQueue(manager->WaitHandles_PendingAdd, waitHandle);
	ILibQueue_UnLock(manager->WaitHandles_PendingAdd);
	SetEvent(manager->updateEvent);
}
int ILibProcessPipe_Manager_WindowsWaitHandles_Remove_Comparer(void *source, void *matchWith)
{
	return(((ILibProcessPipe_WaitHandle*)source)->event == matchWith ? 0 : 1);
}
void ILibProcessPipe_Manager_WindowsRunLoop(void *arg)
{
	ILibProcessPipe_Manager_Object *manager = (ILibProcessPipe_Manager_Object*)arg;
	HANDLE* hList = (HANDLE*)malloc(FD_SETSIZE * sizeof(HANDLE)* 2);
	ILibLinkedList active = manager->ActivePipes;

	void* node;
	ILibProcessPipe_WaitHandle* data;

	int i, x;

	memset(hList, 0, FD_SETSIZE * sizeof(HANDLE)* 2);

	while (manager->abort == 0)
	{
		hList[0] = manager->updateEvent;
		i = 1;

		//Pending Remove
		ILibQueue_Lock(manager->WaitHandles_PendingDel);
		while (ILibQueue_IsEmpty(manager->WaitHandles_PendingDel) == 0)
		{
			node = ILibQueue_DeQueue(manager->WaitHandles_PendingDel);
			node = ILibLinkedList_GetNode_Search(active, &ILibProcessPipe_Manager_WindowsWaitHandles_Remove_Comparer, node);
			if (node != NULL) { free(ILibLinkedList_GetDataFromNode(node)); ILibLinkedList_Remove(node); }
		}
		ILibQueue_UnLock(manager->WaitHandles_PendingDel);

		//Pending Add
		ILibQueue_Lock(manager->WaitHandles_PendingAdd);
		while (ILibQueue_IsEmpty(manager->WaitHandles_PendingAdd) == 0)
		{
			ILibLinkedList_AddTail(active, ILibQueue_DeQueue(manager->WaitHandles_PendingAdd));
		}
		ILibQueue_UnLock(manager->WaitHandles_PendingAdd);

		//Prepare the rest of the WaitHandle Array, for the WaitForMultipleObject call
		node = ILibLinkedList_GetNode_Head(active);
		while (node != NULL && (data = (ILibProcessPipe_WaitHandle*)ILibLinkedList_GetDataFromNode(node)) != NULL)
		{
			hList[i] = data->event;
			hList[i + FD_SETSIZE] = (HANDLE)data;
			++i;
			node = ILibLinkedList_GetNextNode(node);
		}

		while ((x = WaitForMultipleObjects(i, hList, FALSE, INFINITE) - WAIT_OBJECT_0) != 0)
		{
			data = (ILibProcessPipe_WaitHandle*)hList[x + FD_SETSIZE];
			if (data->callback != NULL) { data->callback(data->event, data->user); }
		}
		ResetEvent(manager->updateEvent);
	}

	for (x = 1; x<(1 + ILibLinkedList_GetCount(active)); ++x)
	{
		free(hList[x + FD_SETSIZE]);
	}
	free(hList);
}
void ILibProcessPipe_Manager_Start(void* chain, void* user)
{
	ILibProcessPipe_Manager_Object* man = (ILibProcessPipe_Manager_Object*)user;
	man->workerThread = ILibSpawnNormalThread((voidfp)&ILibProcessPipe_Manager_WindowsRunLoop, user);
}
#else
void ILibProcessPipe_Process_ReadHandler(void* user);
void ILibProcessPipe_Manager_OnPreSelect(void* object, fd_set *readset, fd_set *writeset, fd_set *errorset, int* blocktime)
{
	ILibProcessPipe_Manager_Object *man = (ILibProcessPipe_Manager_Object*)object;
	void *node;
	ILibProcessPipe_PipeObject *j;

	node = ILibLinkedList_GetNode_Head(man->ActivePipes);
	while(node != NULL && (j = (ILibProcessPipe_PipeObject*)ILibLinkedList_GetDataFromNode(node)) != NULL)
	{
		if(j->mPipe_ReadEnd != 0)
		{
			FD_SET(j->mPipe_ReadEnd, readset);
		}
		node = ILibLinkedList_GetNextNode(node);
	}

}
void ILibProcessPipe_Manager_OnPostSelect(void* object, int slct, fd_set *readset, fd_set *writeset, fd_set *errorset)
{
	ILibProcessPipe_Manager_Object *man = (ILibProcessPipe_Manager_Object*)object;
	void *node;
	ILibProcessPipe_PipeObject *j;

	node = ILibLinkedList_GetNode_Head(man->ActivePipes);
	while(node != NULL && (j = (ILibProcessPipe_PipeObject*)ILibLinkedList_GetDataFromNode(node)) != NULL)
	{
		if(j->mPipe_ReadEnd != 0)
		{
			if(FD_ISSET(j->mPipe_ReadEnd, readset) != 0)
			{
				ILibProcessPipe_Process_ReadHandler(j);
			}
		}
		node = ILibLinkedList_GetNextNode(node);
	}
}
#endif
void ILibProcessPipe_Manager_OnDestroy(void *object)
{
	ILibProcessPipe_Manager_Object *man = (ILibProcessPipe_Manager_Object*)object;

#ifdef WIN32
	man->abort = 1;
	SetEvent(man->updateEvent);
	WaitForSingleObject(man->workerThread, INFINITE);
#endif

	ILibLinkedList_Destroy(man->ActivePipes);
	ILibQueue_Destroy(man->WaitHandles_PendingAdd);
	ILibQueue_Destroy(man->WaitHandles_PendingDel);
}
ILibProcessPipe_Manager ILibProcessPipe_Manager_Create(void *chain)
{
	ILibProcessPipe_Manager_Object *retVal;

	if ((retVal = (ILibProcessPipe_Manager_Object*)malloc(sizeof(ILibProcessPipe_Manager_Object))) == NULL) { ILIBCRITICALEXIT(254); }
	memset(retVal, 0, sizeof(ILibProcessPipe_Manager_Object));

	retVal->chain = chain;
	retVal->ActivePipes = ILibLinkedList_Create();
	retVal->WaitHandles_PendingAdd = ILibQueue_Create();
	retVal->WaitHandles_PendingDel = ILibQueue_Create();

#ifdef WIN32
	retVal->updateEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
	ILibChain_OnStartEvent_AddHandler(chain, (ILibChain_StartEvent)&ILibProcessPipe_Manager_Start, retVal);
#else
	retVal->Pre = &ILibProcessPipe_Manager_OnPreSelect;
	retVal->Post = &ILibProcessPipe_Manager_OnPostSelect;
#endif
	retVal->Destroy = &ILibProcessPipe_Manager_OnDestroy;
	ILibAddToChain(chain, retVal);
	return(retVal);
}

void ILibProcessPipe_FreePipe(ILibProcessPipe_PipeObject *pipeObject)
{
#ifdef WIN32
	CloseHandle(pipeObject->mPipe_ReadEnd);
	CloseHandle(pipeObject->mPipe_WriteEnd);
	CloseHandle(pipeObject->mOverlapped->hEvent);
	free(pipeObject->mOverlapped);
#endif

	if (pipeObject->buffer != NULL) { free(pipeObject->buffer); }
	if (pipeObject->WriteBuffer != NULL)
	{
		ILibProcessPipe_WriteData* data;
		while ((data = (ILibProcessPipe_WriteData*)ILibQueue_DeQueue(pipeObject->WriteBuffer)) != NULL)
		{
			ILibProcessPipe_WriteData_Destroy(data);
		}
		ILibQueue_Destroy(pipeObject->WriteBuffer);
	}
	free(pipeObject);
}

#ifdef WIN32
void ILibProcessPipe_PipeObject_DisableInherit(HANDLE* h)
{
	HANDLE tmpRead = *h;
	DuplicateHandle(GetCurrentProcess(), tmpRead, GetCurrentProcess(), h,  0, FALSE, DUPLICATE_SAME_ACCESS);
	CloseHandle(tmpRead);
}
#endif

ILibProcessPipe_PipeObject* ILibProcessPipe_CreatePipe(ILibProcessPipe_Manager manager, int pipeBufferSize, ILibProcessPipe_GenericBrokenPipeHandler brokenPipeHandler)
{
	ILibProcessPipe_PipeObject* retVal = NULL;
#ifdef WIN32
	char pipeName[255];
	SECURITY_ATTRIBUTES saAttr;
#else
	int fd[2];
#endif

	if ((retVal = (ILibProcessPipe_PipeObject*)malloc(sizeof(ILibProcessPipe_PipeObject))) == NULL) { ILIBCRITICALEXIT(254); }
	memset(retVal, 0, sizeof(ILibProcessPipe_PipeObject));
	retVal->brokenPipeHandler = brokenPipeHandler;
	retVal->manager = (ILibProcessPipe_Manager_Object*)manager;

#ifdef WIN32
	saAttr.nLength = sizeof(SECURITY_ATTRIBUTES);
	saAttr.bInheritHandle = TRUE;
	saAttr.lpSecurityDescriptor = NULL;

	snprintf(pipeName, sizeof(pipeName), "\\\\.\\pipe\\%p", (void*)retVal);

	if ((retVal->mOverlapped = (struct _OVERLAPPED*)malloc(sizeof(struct _OVERLAPPED))) == NULL) { ILIBCRITICALEXIT(254); }
	memset(retVal->mOverlapped, 0, sizeof(struct _OVERLAPPED));

	if ((retVal->mOverlapped->hEvent = CreateEvent(NULL, TRUE, FALSE, NULL)) == NULL) { ILIBCRITICALEXIT(254); }

	retVal->mPipe_ReadEnd = CreateNamedPipeA(pipeName, PIPE_ACCESS_INBOUND | FILE_FLAG_OVERLAPPED, PIPE_TYPE_BYTE, 1, pipeBufferSize, pipeBufferSize, 0, &saAttr);
	if (retVal->mPipe_ReadEnd == INVALID_HANDLE_VALUE) { ILIBCRITICALEXIT(254); }

	retVal->mPipe_WriteEnd = CreateFileA(pipeName, GENERIC_WRITE, 0, &saAttr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
	if (retVal->mPipe_WriteEnd == INVALID_HANDLE_VALUE) { ILIBCRITICALEXIT(254); }
#else
	if(pipe(fd)==0)
	{
		fcntl(fd[0], F_SETFL, O_NONBLOCK);
		fcntl(fd[1], F_SETFL, O_NONBLOCK);
		retVal->mPipe_ReadEnd = fd[0];
		retVal->mPipe_WriteEnd = fd[1];
	}
#endif

	return(retVal);
}

void ILibProcessPipe_Process_Destroy(ILibProcessPipe_Process_Object *p)
{
	ILibProcessPipe_FreePipe(p->stdIn);
	ILibProcessPipe_FreePipe(p->stdOut);
	ILibProcessPipe_FreePipe(p->stdErr);
	free(p);
}
#ifndef WIN32
void ILibProcessPipe_Process_BrokenPipeSink(ILibProcessPipe_PipeObject* sender)
{
	ILibProcessPipe_Process_Object *p = sender->mProcess;
	int status;

	if (ILibIsRunningOnChainThread(sender->manager->chain) != 0)
	{
		// This was called from the Reader
		if (p->exitHandler != NULL)
		{
			waitpid(p->PID, &status, 0);
			p->exitHandler(p, WEXITSTATUS(status), p->userObject);
		}
	}
}
#endif

int ILibProcessPipe_Process_GetPID(ILibProcessPipe_Process p)
{
	return(p != NULL ? ((ILibProcessPipe_Process_Object*)p)->PID : 0);
}
ILibProcessPipe_Process ILibProcessPipe_Manager_SpawnProcess(ILibProcessPipe_Manager pipeManager, char* target, char* parameters[])
{
	ILibProcessPipe_Process_Object* retVal = NULL;

#ifdef WIN32
	STARTUPINFOA info = { sizeof(info) };
	PROCESS_INFORMATION processInfo = { 0 };
	SECURITY_ATTRIBUTES saAttr;
	char* parms = NULL;

	if (parameters != NULL && parameters[0] != NULL && parameters[1] == NULL)
	{
		parms = parameters[0];
	}
	else if (parameters != NULL && parameters[0] != NULL && parameters[1] != NULL)
	{
		int len = 0;
		int i = 0;
		int sz = 0;

		while (parameters[i] != NULL)
		{
			sz += (strlen(parameters[i++]) + 1);
		}
		sz += (i - 1); // Need to make room for delimiter characters
		parms = (char*)malloc(sz);
		i = 0; len = 0;

		while (parameters[i] != NULL)
		{
			len += snprintf(parms + len, sz - len, "%s%s", (i==0)?"":" ", parameters[i]);
			++i;
		}
	}

	saAttr.nLength = sizeof(SECURITY_ATTRIBUTES);
	saAttr.bInheritHandle = TRUE;
	saAttr.lpSecurityDescriptor = NULL;
#else
	pid_t pid;
#endif

	if ((retVal = (ILibProcessPipe_Process_Object*)malloc(sizeof(ILibProcessPipe_Process_Object))) == NULL) { ILIBCRITICALEXIT(254); }
	memset(retVal, 0, sizeof(ILibProcessPipe_Process_Object));

	retVal->stdIn = ILibProcessPipe_CreatePipe(pipeManager, 4096, NULL);
	retVal->stdIn->mProcess = retVal;
#ifdef WIN32
	retVal->stdOut = ILibProcessPipe_CreatePipe(pipeManager, 4096, NULL);
#else
	retVal->stdOut = ILibProcessPipe_CreatePipe(pipeManager, 4096, &ILibProcessPipe_Process_BrokenPipeSink);
#endif
	retVal->stdOut->mProcess = retVal;
	retVal->stdErr = ILibProcessPipe_CreatePipe(pipeManager, 4096, NULL);
	retVal->stdErr->mProcess = retVal;
	retVal->parent = (ILibProcessPipe_Manager_Object*)pipeManager;

#ifdef WIN32
	ZeroMemory(&processInfo, sizeof(PROCESS_INFORMATION));
	ZeroMemory(&info, sizeof(STARTUPINFOA));

	ILibProcessPipe_PipeObject_DisableInherit(&(retVal->stdIn->mPipe_WriteEnd));
	ILibProcessPipe_PipeObject_DisableInherit(&(retVal->stdOut->mPipe_ReadEnd));
	ILibProcessPipe_PipeObject_DisableInherit(&(retVal->stdErr->mPipe_ReadEnd));

	info.cb = sizeof(STARTUPINFOA);
	info.hStdError = retVal->stdErr->mPipe_WriteEnd;
	info.hStdInput = retVal->stdIn->mPipe_ReadEnd;
	info.hStdOutput = retVal->stdOut->mPipe_WriteEnd;
	info.dwFlags |= STARTF_USESTDHANDLES;

	if (!CreateProcessA(target, parms, NULL, NULL, TRUE, 0, NULL, NULL, &info, &processInfo))
	{
		ILibProcessPipe_FreePipe(retVal->stdErr);
		ILibProcessPipe_FreePipe(retVal->stdOut);
		ILibProcessPipe_FreePipe(retVal->stdIn);
		free(retVal);
		return(NULL);
	}

	CloseHandle(retVal->stdOut->mPipe_WriteEnd);	retVal->stdOut->mPipe_WriteEnd = NULL;
	CloseHandle(retVal->stdErr->mPipe_WriteEnd);	retVal->stdErr->mPipe_WriteEnd = NULL;
	CloseHandle(retVal->stdIn->mPipe_ReadEnd);		retVal->stdIn->mPipe_ReadEnd = NULL;

	retVal->hProcess = processInfo.hProcess;
	if (processInfo.hThread != NULL) CloseHandle(processInfo.hThread);
	retVal->PID = processInfo.dwProcessId;
#else
	pid = vfork();
	if(pid < 0)
	{
		ILibProcessPipe_FreePipe(retVal->stdErr);
		ILibProcessPipe_FreePipe(retVal->stdOut);
		ILibProcessPipe_FreePipe(retVal->stdIn);
		free(retVal);
		return(NULL);
	}
	if(pid==0)
	{
		close(retVal->stdIn->mPipe_WriteEnd); //close write end of stdin pipe
		close(retVal->stdOut->mPipe_ReadEnd); //close read end of stdout pipe

		dup2(retVal->stdIn->mPipe_ReadEnd, STDIN_FILENO);
		dup2(retVal->stdOut->mPipe_WriteEnd, STDOUT_FILENO);

		close(retVal->stdIn->mPipe_ReadEnd);
		close(retVal->stdOut->mPipe_WriteEnd);

		execv(target, parameters);
		exit(1);
	}
	close(retVal->stdIn->mPipe_ReadEnd);
	close(retVal->stdOut->mPipe_WriteEnd);
	retVal->PID = pid;
#endif

	return(retVal);
}
#ifdef WIN32
void ILibProcessPipe_Process_ReadHandler(HANDLE event, void* user)
#else
void ILibProcessPipe_Process_ReadHandler(void* user)
#endif
{
	ILibProcessPipe_PipeObject *pipeObject = (ILibProcessPipe_PipeObject*)user;
	int consumed;
	int err;

#ifdef WIN32
	BOOL result;
	DWORD bytesRead;
#else
	int bytesRead;
#endif

	do
	{
#ifdef WIN32
		result = GetOverlappedResult(pipeObject->mPipe_ReadEnd, pipeObject->mOverlapped, &bytesRead, FALSE);
		if (result == FALSE) { break; }
#else
		bytesRead = read(pipeObject->mPipe_ReadEnd, pipeObject->buffer, pipeObject->bufferSize);
		if(bytesRead <= 0)
		{
			break;
		}

#endif

		pipeObject->totalRead += bytesRead;
		ILibRemoteLogging_printf(ILibChainGetLogger(pipeObject->manager->chain), ILibRemoteLogging_Modules_Microstack_NamedPipe, ILibRemoteLogging_Flags_VerbosityLevel_5, "ILibNamedPipe[ReadHandler]: %u bytes read on Pipe: %p", bytesRead, (void*)pipeObject);

		if (pipeObject->handler == NULL)
		{
			//
			// Since the user doesn't care about the data, we'll just empty the buffer
			//
			pipeObject->readOffset = 0;
			pipeObject->totalRead = 0;
			continue;
		}

		while (1)
		{
			consumed = 0;
			((ILibProcessPipe_GenericReadHandler)pipeObject->handler)(pipeObject->buffer + pipeObject->readOffset, pipeObject->totalRead - pipeObject->readOffset, &consumed, pipeObject->user1, pipeObject->user2);
			if (consumed == 0)
			{
				//
				// None of the buffer was consumed
				//
				ILibRemoteLogging_printf(ILibChainGetLogger(pipeObject->manager->chain), ILibRemoteLogging_Modules_Microstack_NamedPipe, ILibRemoteLogging_Flags_VerbosityLevel_5, "ILibNamedPipe[ReadHandler]: No bytes consumed on Pipe: %p", (void*)pipeObject);

				//
				// We need to move the memory to the start of the buffer, or else we risk running past the end, if we keep reading like this
				//
				memmove(pipeObject->buffer, pipeObject->buffer + pipeObject->readOffset, pipeObject->totalRead - pipeObject->readOffset);
				pipeObject->totalRead -= pipeObject->readOffset;
				pipeObject->readOffset = 0;

				break; // Break out of inner while loop
			}
			else if (consumed == (pipeObject->totalRead - pipeObject->readOffset))
			{
				//
				// Entire Buffer was consumed
				//
				pipeObject->readOffset = 0;
				pipeObject->totalRead = 0;

				ILibRemoteLogging_printf(ILibChainGetLogger(pipeObject->manager->chain), ILibRemoteLogging_Modules_Microstack_NamedPipe, ILibRemoteLogging_Flags_VerbosityLevel_5, "ILibNamedPipe[ReadHandler]: ReadBuffer drained on Pipe: %p", (void*)pipeObject);
				break; // Break out of inner while loop
			}
			else
			{
				//
				// Only part of the buffer was consumed
				//
				pipeObject->readOffset += consumed;
			}
		}
	}
#ifdef WIN32
	while ((result = ReadFile(pipeObject->mPipe_ReadEnd, pipeObject->buffer, pipeObject->bufferSize, NULL, pipeObject->mOverlapped)) == TRUE); // Note: This is actually the end of a do-while loop
	if ((err = GetLastError()) != ERROR_IO_PENDING)
#else
	while(1); // Note: This is actually the end of a do-while loop
	err = 0;
	if(bytesRead == 0 || ((err = errno) != EAGAIN && errno != EWOULDBLOCK))
#endif
	{
		//
		// Broken Pipe
		//
		ILibRemoteLogging_printf(ILibChainGetLogger(pipeObject->manager->chain), ILibRemoteLogging_Modules_Microstack_NamedPipe, ILibRemoteLogging_Flags_VerbosityLevel_1, "ILibNamedPipe[ReadHandler]: BrokenPipe(%d) on Pipe: %p", err, (void*)pipeObject);
#ifdef WIN32
		ILibProcessPipe_WaitHandle_Remove(pipeObject->manager, pipeObject->mOverlapped->hEvent); // Pipe Broken, so remove ourselves from the processing loop
#else
		// Sincc we are on the microstack thread, we can directly access the LinkedList

#endif
		ILibLinkedList_Remove(ILibLinkedList_GetNode_Search(pipeObject->manager->ActivePipes, NULL, pipeObject));

		if (pipeObject->brokenPipeHandler != NULL)
		{
			((ILibProcessPipe_GenericBrokenPipeHandler)pipeObject->brokenPipeHandler)(pipeObject);
		}
		return;
	}
	else
	{
		ILibRemoteLogging_printf(ILibChainGetLogger(pipeObject->manager->chain), ILibRemoteLogging_Modules_Microstack_NamedPipe, ILibRemoteLogging_Flags_VerbosityLevel_5, "ILibNamedPipe[ReadHandler]: Pipe: %p [EMPTY]", (void*)pipeObject);
	}

}
#ifdef WIN32
void ILibProcessPipe_Process_WindowsWriteHandler(HANDLE event, void* user)
{
	ILibProcessPipe_PipeObject *pipeObject = (ILibProcessPipe_PipeObject*)user;
	BOOL result;
	DWORD bytesWritten;
	ILibProcessPipe_WriteData* data;

	result = GetOverlappedResult(pipeObject->mPipe_WriteEnd, pipeObject->mOverlapped, &bytesWritten, FALSE);
	if (result == FALSE)
	{
		// Broken Pipe
		ILibProcessPipe_WaitHandle_Remove(pipeObject->manager, pipeObject->mOverlapped->hEvent); // Pipe Broken, so remove ourselves from the processing loop
		ILibRemoteLogging_printf(ILibChainGetLogger(pipeObject->manager->chain), ILibRemoteLogging_Modules_Microstack_NamedPipe, ILibRemoteLogging_Flags_VerbosityLevel_1, "ILibNamedPipe[WriteHandler]: BrokenPipe(%d) on Pipe: %p", GetLastError(), (void*)pipeObject);
		if (pipeObject->brokenPipeHandler != NULL) { ((ILibProcessPipe_GenericBrokenPipeHandler)pipeObject->brokenPipeHandler)(pipeObject); }
		return;
	}

	ILibQueue_Lock(pipeObject->WriteBuffer);
	while ((data = (ILibProcessPipe_WriteData*)ILibQueue_DeQueue(pipeObject->WriteBuffer)) != NULL)
	{
		ILibProcessPipe_WriteData_Destroy(data);
		data = (ILibProcessPipe_WriteData*)ILibQueue_PeekQueue(pipeObject->WriteBuffer);
		if (data != NULL)
		{
			result = WriteFile(pipeObject->mPipe_WriteEnd, data->buffer, data->bufferLen, NULL, pipeObject->mOverlapped);
			if (result == TRUE) { continue; }
			if (GetLastError() != ERROR_IO_PENDING)
			{
				// Broken Pipe
				ILibQueue_UnLock(pipeObject->WriteBuffer);
				ILibRemoteLogging_printf(ILibChainGetLogger(pipeObject->manager->chain), ILibRemoteLogging_Modules_Microstack_NamedPipe, ILibRemoteLogging_Flags_VerbosityLevel_1, "ILibNamedPipe[WriteHandler]: BrokenPipe(%d) on Pipe: %p", GetLastError(), (void*)pipeObject);
				if (pipeObject->brokenPipeHandler != NULL) { ((ILibProcessPipe_GenericBrokenPipeHandler)pipeObject->brokenPipeHandler)(pipeObject); }
				return;
			}
			break;
		}
	}
	if (ILibQueue_IsEmpty(pipeObject->WriteBuffer) != 0)
	{
		ILibProcessPipe_WaitHandle_Remove(pipeObject->manager, pipeObject->mOverlapped->hEvent);
		ILibQueue_UnLock(pipeObject->WriteBuffer);
		if (pipeObject->handler != NULL) ((ILibProcessPipe_GenericSendOKHandler)pipeObject->handler)(pipeObject->user1, pipeObject->user2);
	}
	else
	{
		ILibQueue_UnLock(pipeObject->WriteBuffer);
	}
	return;
}
#endif
void ILibProcessPipe_Process_SetWriteHandler(ILibProcessPipe_PipeObject *pipeObject, ILibProcessPipe_GenericSendOKHandler handler, void* user1, void* user2)
{
	pipeObject->handler = handler;
	pipeObject->user1 = user1;
	pipeObject->user2 = user2;
}

void ILibProcessPipe_Process_StartPipeReaderWriterEx(void *object)
{
	ILibProcessPipe_PipeObject* pipeObject = (ILibProcessPipe_PipeObject*)object;
	ILibLinkedList_AddTail(pipeObject->manager->ActivePipes, pipeObject);
}

void ILibProcessPipe_Process_StartPipeReader(ILibProcessPipe_PipeObject *pipeObject, int bufferSize, ILibProcessPipe_GenericReadHandler handler, void* user1, void* user2)
{
#ifdef WIN32
	BOOL result;
#endif

	if ((pipeObject->buffer = (char*)malloc(bufferSize)) == NULL) { ILIBCRITICALEXIT(254); }
	pipeObject->bufferSize = bufferSize;
	pipeObject->handler = handler;
	pipeObject->user1 = user1;
	pipeObject->user2 = user2;

#ifdef WIN32
	result = ReadFile(pipeObject->mPipe_ReadEnd, pipeObject->buffer, pipeObject->bufferSize, NULL, pipeObject->mOverlapped);
	ILibProcessPipe_WaitHandle_Add(pipeObject->manager, pipeObject->mOverlapped->hEvent, pipeObject, &ILibProcessPipe_Process_ReadHandler);
#else
	ILibLifeTime_Add(ILibGetBaseTimer(pipeObject->manager->chain), pipeObject, 0, &ILibProcessPipe_Process_StartPipeReaderWriterEx, NULL); // Need to context switch to Chain Thread
#endif
}
void ILibProcessPipe_Process_PipeHandler_StdOut(char *buffer, int bufferLen, int* bytesConsumed, void* user1, void *user2)
{
	ILibProcessPipe_Process_Object *j = (ILibProcessPipe_Process_Object*)user1;
	if (user2 != NULL)
	{
		((ILibProcessPipe_Process_OutputHandler)user2)(j, buffer, bufferLen, bytesConsumed, j->userObject);
	}
}
void ILibProcessPipe_Process_PipeHandler_StdIn(void *user1, void *user2)
{
	ILibProcessPipe_Process_Object* j = (ILibProcessPipe_Process_Object*)user1;
	ILibProcessPipe_Process_SendOKHandler sendOk = (ILibProcessPipe_Process_SendOKHandler)user2;

	if (sendOk != NULL) sendOk(j, j->userObject);
}
#ifdef WIN32
void ILibProcessPipe_Process_OnExit(HANDLE event, void* user)
{
	ILibProcessPipe_Process_Object* j = (ILibProcessPipe_Process_Object*)user;
	DWORD exitCode;
	BOOL result;

	ILibProcessPipe_WaitHandle_Remove(j->parent, j->hProcess);
	result = GetExitCodeProcess(j->hProcess, &exitCode);
	if (j->exitHandler != NULL)
	{
		j->exitHandler(j, exitCode, j->userObject);
	}
	ILibProcessPipe_Process_Destroy(j);
}
#endif

void ILibProcessPipe_Process_AddHandlers(ILibProcessPipe_Process module, ILibProcessPipe_Process_ExitHandler exitHandler, ILibProcessPipe_Process_OutputHandler stdOut, ILibProcessPipe_Process_OutputHandler stdErr, ILibProcessPipe_Process_SendOKHandler sendOk, void *user)
{
	ILibProcessPipe_Process_Object* j = (ILibProcessPipe_Process_Object*)module;
	j->userObject = user;
	j->exitHandler = exitHandler;

	ILibProcessPipe_Process_StartPipeReader(j->stdOut, 4096, &ILibProcessPipe_Process_PipeHandler_StdOut, j, stdOut);
	ILibProcessPipe_Process_SetWriteHandler(j->stdIn, &ILibProcessPipe_Process_PipeHandler_StdIn, j, sendOk);

#ifdef WIN32
	ILibProcessPipe_WaitHandle_Add(j->parent, j->hProcess, j, &ILibProcessPipe_Process_OnExit);
#endif
}

ILibTransport_DoneState ILibProcessPipe_Pipe_Write(ILibProcessPipe_PipeObject* pipeObject, char* buffer, int bufferLen, ILibTransport_MemoryOwnership ownership)
{
	ILibTransport_DoneState retVal = ILibTransport_DoneState_ERROR;
	if (pipeObject->WriteBuffer == NULL)
	{
		pipeObject->WriteBuffer = ILibQueue_Create();
	}

	ILibQueue_Lock(pipeObject->WriteBuffer);
	if (ILibQueue_IsEmpty(pipeObject->WriteBuffer) == 0)
	{
		ILibQueue_EnQueue(pipeObject->WriteBuffer, ILibProcessPipe_WriteData_Create(buffer, bufferLen, ownership));
	}
	else
	{
#ifdef WIN32
		BOOL result = WriteFile(pipeObject->mPipe_WriteEnd, buffer, bufferLen, NULL, pipeObject->mOverlapped);
		if (result == TRUE) { retVal = ILibTransport_DoneState_COMPLETE; }
#else
		int result = write(pipeObject->mPipe_WriteEnd, buffer, bufferLen);
		if (result > 0) { retVal = ILibTransport_DoneState_COMPLETE; }
#endif
		else
		{
#ifdef WIN32
			if (GetLastError() == ERROR_IO_PENDING)
#else
			if (result < 0 && (errno == EAGAIN || errno == EWOULDBLOCK))
#endif
			{
				retVal = ILibTransport_DoneState_INCOMPLETE;
				ILibQueue_EnQueue(pipeObject->WriteBuffer, ILibProcessPipe_WriteData_Create(buffer, bufferLen, ownership));
#ifdef WIN32
				ILibProcessPipe_WaitHandle_Add(pipeObject->manager, pipeObject->mOverlapped->hEvent, pipeObject, &ILibProcessPipe_Process_WindowsWriteHandler);
#else
				ILibLifeTime_Add(ILibGetBaseTimer(pipeObject->manager->chain), pipeObject, 0, &ILibProcessPipe_Process_StartPipeReaderWriterEx, NULL); // Need to context switch to Chain Thread
#endif
			}
			else
			{
#ifdef WIN32
				ILibRemoteLogging_printf(ILibChainGetLogger(pipeObject->manager->chain), ILibRemoteLogging_Modules_Microstack_NamedPipe, ILibRemoteLogging_Flags_VerbosityLevel_1, "ILibNamedPipe[Write]: BrokenPipe(%d) on Pipe: %p", GetLastError(), (void*)pipeObject);
#else
				ILibRemoteLogging_printf(ILibChainGetLogger(pipeObject->manager->chain), ILibRemoteLogging_Modules_Microstack_NamedPipe, ILibRemoteLogging_Flags_VerbosityLevel_1, "ILibNamedPipe[Write]: BrokenPipe(%d) on Pipe: %p", result < 0 ? errno : 0, (void*)pipeObject);
#endif
				if (pipeObject->brokenPipeHandler != NULL)
				{
					ILibQueue_UnLock(pipeObject->WriteBuffer);
#ifdef WIN32
					ILibProcessPipe_WaitHandle_Remove(pipeObject->manager, pipeObject->mOverlapped->hEvent); // Pipe Broken, so remove ourselves from the processing loop
#endif
					((ILibProcessPipe_GenericBrokenPipeHandler)pipeObject->brokenPipeHandler)(pipeObject);
					ILibQueue_Lock(pipeObject->WriteBuffer);
				}
			}
		}
	}
	ILibQueue_UnLock(pipeObject->WriteBuffer);

	return(retVal);
}

ILibTransport_DoneState ILibProcessPipe_Process_WriteStdIn(ILibProcessPipe_Process p, char* buffer, int bufferLen, ILibTransport_MemoryOwnership ownership)
{
	ILibProcessPipe_Process_Object *j = (ILibProcessPipe_Process_Object*)p;

	return(ILibProcessPipe_Pipe_Write(j->stdIn, buffer, bufferLen, ownership));
}


text:
require 'babl/utils'
require 'babl/schema'
require 'singleton'

module Babl
    module Nodes
        class IsNull
            include Singleton

            def schema
                Schema::Typed::BOOLEAN
            end

            def dependencies
                Utils::Hash::EMPTY
            end

            def pinned_dependencies
                Utils::Hash::EMPTY
            end

            def render(frame)
                ::NilClass === frame.object
            end

            def optimize
                self
            end
        end
    end
end


text:
package de.huberlin.wbi.cuneiform.core.ticketsrc;

import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;

import de.huberlin.wbi.cuneiform.core.actormodel.Message;
import de.huberlin.wbi.cuneiform.core.cre.BaseCreActor;
import de.huberlin.wbi.cuneiform.core.semanticmodel.JsonReportEntry;
import de.huberlin.wbi.cuneiform.core.semanticmodel.Ticket;

public class TicketFinishedMsg extends Message {

	private final Ticket ticket;
	private final Set<JsonReportEntry> reportEntrySet;

	public TicketFinishedMsg( BaseCreActor sender, Ticket ticket, Collection<JsonReportEntry> report ) {

		super( sender );

		if( ticket == null )
			throw new NullPointerException( "Ticket must not be null." );

		this.ticket = ticket;

		reportEntrySet = new HashSet<>();

		addReport( report );
	}

	public void addReport( Collection<JsonReportEntry> report ) {

		if( report == null )
			throw new NullPointerException( "JSON report entry collection must not be null." );

		for( JsonReportEntry entry : report )
			addReport( entry );
	}

	public void addReport( JsonReportEntry entry ) {

		if( entry == null )
			throw new NullPointerException( "JSON report entry must not be null." );

		reportEntrySet.add( entry );
	}

	public Set<JsonReportEntry> getReportEntrySet() {
		return Collections.unmodifiableSet( reportEntrySet );
	}

	public Ticket getTicket() {
		return ticket;
	}

	@Override
	public String toString() {
		return "{ ticketFinished, "+ticket.getTicketId()+" }";
	}
}


text:
import { registerLanguage } from '../_.contribution.js';
registerLanguage({
    id: 'hcl',
    extensions: ['.tf', '.tfvars', '.hcl'],
    aliases: ['Terraform', 'tf', 'HCL', 'hcl'],
    loader: function () { return import('./hcl.js'); }
});


text:
namespace appcache {

AppCacheRequestHandler::AppCacheRequestHandler(
    AppCacheHost* host, ResourceType::Type resource_type)
    : host_(host), resource_type_(resource_type),
      is_waiting_for_cache_selection_(false), found_group_id_(0),
      found_cache_id_(0), found_network_namespace_(false),
      cache_entry_not_found_(false), maybe_load_resource_executed_(false) {
  DCHECK(host_);
  host_->AddObserver(this);
}

AppCacheRequestHandler::~AppCacheRequestHandler() {
  if (host_) {
    storage()->CancelDelegateCallbacks(this);
    host_->RemoveObserver(this);
  }
}

AppCacheStorage* AppCacheRequestHandler::storage() const {
  DCHECK(host_);
  return host_->service()->storage();
}

void AppCacheRequestHandler::GetExtraResponseInfo(
    int64* cache_id, GURL* manifest_url) {
  if (job_ && job_->is_delivering_appcache_response()) {
    *cache_id = job_->cache_id();
    *manifest_url = job_->manifest_url();
  }
}

AppCacheURLRequestJob* AppCacheRequestHandler::MaybeLoadResource(
    net::URLRequest* request, net::NetworkDelegate* network_delegate) {
  maybe_load_resource_executed_ = true;
  if (!host_ || !IsSchemeAndMethodSupported(request) || cache_entry_not_found_)
    return NULL;

  // This method can get called multiple times over the life
  // of a request. The case we detect here is having scheduled
  // delivery of a "network response" using a job setup on an
  // earlier call thru this method. To send the request thru
  // to the network involves restarting the request altogether,
  // which will call thru to our interception layer again.
  // This time thru, we return NULL so the request hits the wire.
  if (job_) {
    DCHECK(job_->is_delivering_network_response() ||
           job_->cache_entry_not_found());
    if (job_->cache_entry_not_found())
      cache_entry_not_found_ = true;
    job_ = NULL;
    storage()->CancelDelegateCallbacks(this);
    return NULL;
  }

  // Clear out our 'found' fields since we're starting a request for a
  // new resource, any values in those fields are no longer valid.
  found_entry_ = AppCacheEntry();
  found_fallback_entry_ = AppCacheEntry();
  found_cache_id_ = kNoCacheId;
  found_manifest_url_ = GURL();
  found_network_namespace_ = false;

  if (is_main_resource())
    MaybeLoadMainResource(request, network_delegate);
  else
    MaybeLoadSubResource(request, network_delegate);

  // If its been setup to deliver a network response, we can just delete
  // it now and return NULL instead to achieve that since it couldn't
  // have been started yet.
  if (job_ && job_->is_delivering_network_response()) {
    DCHECK(!job_->has_been_started());
    job_ = NULL;
  }

  return job_;
}

AppCacheURLRequestJob* AppCacheRequestHandler::MaybeLoadFallbackForRedirect(
    net::URLRequest* request,
    net::NetworkDelegate* network_delegate,
    const GURL& location) {
  if (!host_ || !IsSchemeAndMethodSupported(request) || cache_entry_not_found_)
    return NULL;
  if (is_main_resource())
    return NULL;
  // TODO(vabr) This is a temporary fix (see crbug/141114). We should get rid of
  // it once a more general solution to crbug/121325 is in place.
  if (!maybe_load_resource_executed_)
    return NULL;
  if (request->url().GetOrigin() == location.GetOrigin())
    return NULL;

  DCHECK(!job_);  // our jobs never generate redirects

  if (found_fallback_entry_.has_response_id()) {
    // 6.9.6, step 4: If this results in a redirect to another origin,
    // get the resource of the fallback entry.
    job_ = new AppCacheURLRequestJob(request, network_delegate, storage());
    DeliverAppCachedResponse(
        found_fallback_entry_, found_cache_id_, found_group_id_,
        found_manifest_url_,  true, found_namespace_entry_url_);
  } else if (!found_network_namespace_) {
    // 6.9.6, step 6: Fail the resource load.
    job_ = new AppCacheURLRequestJob(request, network_delegate, storage());
    DeliverErrorResponse();
  } else {
    // 6.9.6 step 3 and 5: Fetch the resource normally.
  }

  return job_;
}

AppCacheURLRequestJob* AppCacheRequestHandler::MaybeLoadFallbackForResponse(
    net::URLRequest* request, net::NetworkDelegate* network_delegate) {
  if (!host_ || !IsSchemeAndMethodSupported(request) || cache_entry_not_found_)
    return NULL;
  if (!found_fallback_entry_.has_response_id())
    return NULL;

  if (request->status().status() == net::URLRequestStatus::CANCELED) {
    // 6.9.6, step 4: But not if the user canceled the download.
    return NULL;
  }

  // We don't fallback for responses that we delivered.
  if (job_) {
    DCHECK(!job_->is_delivering_network_response());
    return NULL;
  }

  if (request->status().is_success()) {
    int code_major = request->GetResponseCode() / 100;
    if (code_major !=4 && code_major != 5)
      return NULL;

    // Servers can override the fallback behavior with a response header.
    const std::string kFallbackOverrideHeader(
        "x-chromium-appcache-fallback-override");
    const std::string kFallbackOverrideValue(
        "disallow-fallback");
    std::string header_value;
    request->GetResponseHeaderByName(kFallbackOverrideHeader, &header_value);
    if (header_value == kFallbackOverrideValue)
      return NULL;
  }

  // 6.9.6, step 4: If this results in a 4xx or 5xx status code
  // or there were network errors, get the resource of the fallback entry.
  job_ = new AppCacheURLRequestJob(request, network_delegate, storage());
  DeliverAppCachedResponse(
      found_fallback_entry_, found_cache_id_, found_group_id_,
      found_manifest_url_, true, found_namespace_entry_url_);
  return job_;
}

void AppCacheRequestHandler::OnDestructionImminent(AppCacheHost* host) {
  storage()->CancelDelegateCallbacks(this);
  host_ = NULL;  // no need to RemoveObserver, the host is being deleted

  // Since the host is being deleted, we don't have to complete any job
  // that is current running. It's destined for the bit bucket anyway.
  if (job_) {
    job_->Kill();
    job_ = NULL;
  }
}

void AppCacheRequestHandler::DeliverAppCachedResponse(
    const AppCacheEntry& entry, int64 cache_id, int64 group_id,
    const GURL& manifest_url,  bool is_fallback,
    const GURL& namespace_entry_url) {
  DCHECK(host_ && job_ && job_->is_waiting());
  DCHECK(entry.has_response_id());

  if (ResourceType::IsFrame(resource_type_) && !namespace_entry_url.is_empty())
    host_->NotifyMainResourceIsNamespaceEntry(namespace_entry_url);

  job_->DeliverAppCachedResponse(manifest_url, group_id, cache_id,
                                 entry, is_fallback);
}

void AppCacheRequestHandler::DeliverErrorResponse() {
  DCHECK(job_ && job_->is_waiting());
  job_->DeliverErrorResponse();
}

void AppCacheRequestHandler::DeliverNetworkResponse() {
  DCHECK(job_ && job_->is_waiting());
  job_->DeliverNetworkResponse();
}

// Main-resource handling ----------------------------------------------

void AppCacheRequestHandler::MaybeLoadMainResource(
    net::URLRequest* request, net::NetworkDelegate* network_delegate) {
  DCHECK(!job_);
  DCHECK(host_);

  const AppCacheHost* spawning_host =
      ResourceType::IsSharedWorker(resource_type_) ?
          host_ : host_->GetSpawningHost();
  GURL preferred_manifest_url = spawning_host ?
      spawning_host->preferred_manifest_url() : GURL();

  // We may have to wait for our storage query to complete, but
  // this query can also complete syncrhonously.
  job_ = new AppCacheURLRequestJob(request, network_delegate, storage());
  storage()->FindResponseForMainRequest(
      request->url(), preferred_manifest_url, this);
}

void AppCacheRequestHandler::OnMainResponseFound(
    const GURL& url, const AppCacheEntry& entry,
    const GURL& namespace_entry_url, const AppCacheEntry& fallback_entry,
    int64 cache_id, int64 group_id, const GURL& manifest_url) {
  DCHECK(job_);
  DCHECK(host_);
  DCHECK(is_main_resource());
  DCHECK(!entry.IsForeign());
  DCHECK(!fallback_entry.IsForeign());
  DCHECK(!(entry.has_response_id() && fallback_entry.has_response_id()));

  if (!job_)
    return;

  AppCachePolicy* policy = host_->service()->appcache_policy();
  bool was_blocked_by_policy = !manifest_url.is_empty() && policy &&
      !policy->CanLoadAppCache(manifest_url, host_->first_party_url());

  if (was_blocked_by_policy) {
    if (ResourceType::IsFrame(resource_type_)) {
      host_->NotifyMainResourceBlocked(manifest_url);
    } else {
      DCHECK(ResourceType::IsSharedWorker(resource_type_));
      host_->frontend()->OnContentBlocked(host_->host_id(), manifest_url);
    }
    DeliverNetworkResponse();
    return;
  }

  if (ResourceType::IsFrame(resource_type_) && cache_id != kNoCacheId) {
    // AppCacheHost loads and holds a reference to the main resource cache
    // for two reasons, firstly to preload the cache into the working set
    // in advance of subresource loads happening, secondly to prevent the
    // AppCache from falling out of the working set on frame navigations.
    host_->LoadMainResourceCache(cache_id);
    host_->set_preferred_manifest_url(manifest_url);
  }

  // 6.11.1 Navigating across documents, steps 10 and 14.

  found_entry_ = entry;
  found_namespace_entry_url_ = namespace_entry_url;
  found_fallback_entry_ = fallback_entry;
  found_cache_id_ = cache_id;
  found_group_id_ = group_id;
  found_manifest_url_ = manifest_url;
  found_network_namespace_ = false;  // not applicable to main requests

  if (found_entry_.has_response_id()) {
    DCHECK(!found_fallback_entry_.has_response_id());
    DeliverAppCachedResponse(
        found_entry_, found_cache_id_, found_group_id_, found_manifest_url_,
        false, found_namespace_entry_url_);
  } else {
    DeliverNetworkResponse();
  }
}

// Sub-resource handling ----------------------------------------------

void AppCacheRequestHandler::MaybeLoadSubResource(
    net::URLRequest* request, net::NetworkDelegate* network_delegate) {
  DCHECK(!job_);

  if (host_->is_selection_pending()) {
    // We have to wait until cache selection is complete and the
    // selected cache is loaded.
    is_waiting_for_cache_selection_ = true;
    job_ = new AppCacheURLRequestJob(request, network_delegate, storage());
    return;
  }

  if (!host_->associated_cache() ||
      !host_->associated_cache()->is_complete()) {
    return;
  }

  job_ = new AppCacheURLRequestJob(request, network_delegate, storage());
  ContinueMaybeLoadSubResource();
}

void AppCacheRequestHandler::ContinueMaybeLoadSubResource() {
  // 6.9.6 Changes to the networking model
  // If the resource is not to be fetched using the HTTP GET mechanism or
  // equivalent ... then fetch the resource normally.
  DCHECK(job_);
  DCHECK(host_->associated_cache() &&
         host_->associated_cache()->is_complete());

  const GURL& url = job_->request()->url();
  AppCache* cache = host_->associated_cache();
  storage()->FindResponseForSubRequest(
      host_->associated_cache(), url,
      &found_entry_, &found_fallback_entry_, &found_network_namespace_);

  if (found_entry_.has_response_id()) {
    // Step 2: If there's an entry, get it instead.
    DCHECK(!found_network_namespace_ &&
           !found_fallback_entry_.has_response_id());
    found_cache_id_ = cache->cache_id();
    found_group_id_ = cache->owning_group()->group_id();
    found_manifest_url_ = cache->owning_group()->manifest_url();
    DeliverAppCachedResponse(
        found_entry_, found_cache_id_, found_group_id_, found_manifest_url_,
        false, GURL());
    return;
  }

  if (found_fallback_entry_.has_response_id()) {
    // Step 4: Fetch the resource normally, if this results
    // in certain conditions, then use the fallback.
    DCHECK(!found_network_namespace_ &&
           !found_entry_.has_response_id());
    found_cache_id_ = cache->cache_id();
    found_manifest_url_ = cache->owning_group()->manifest_url();
    DeliverNetworkResponse();
    return;
  }

  if (found_network_namespace_) {
    // Step 3 and 5: Fetch the resource normally.
    DCHECK(!found_entry_.has_response_id() &&
           !found_fallback_entry_.has_response_id());
    DeliverNetworkResponse();
    return;
  }

  // Step 6: Fail the resource load.
  DeliverErrorResponse();
}

void AppCacheRequestHandler::OnCacheSelectionComplete(AppCacheHost* host) {
  DCHECK(host == host_);
  if (is_main_resource())
    return;
  if (!is_waiting_for_cache_selection_)
    return;

  is_waiting_for_cache_selection_ = false;

  if (!host_->associated_cache() ||
      !host_->associated_cache()->is_complete()) {
    DeliverNetworkResponse();
    return;
  }

  ContinueMaybeLoadSubResource();
}

}  // namespace appcache


text:
photon.dataTable = photon.dataTable || {};

photon.dataTable.create = function (container, options) {
    var $container = $(container);

    var bindingContext = new photon.binding.BindingContext.getInstance();

    // ensure we have registered a row binding callback
    var originalRowCallback = options.fnRowCallback;
    options.fnRowCallback = function (nRow, aData, iDisplayIndex) {
        if (originalRowCallback) {
            originalRowCallback(nRow, aData, iDisplayIndex);
        }

        photon.binding.applyBindings(aData, nRow,
            photon.binding.DataContext.getForElement($container[0]));

        $(nRow).bind('click', {
            container:$container,
            row:nRow,
            rowData:aData
        }, function (event) {
            var data = event.data;

            // notify the
            var nodeBindingInfo = photon.binding.NodeBindingInfo.getForElement(container);
            if (nodeBindingInfo) {
                var binding = nodeBindingInfo.findBinding(function (binding) {
                    return binding.getExpression().getPropertyHandler() instanceof photon.dataTable.SelectedItemProperty;
                });

                if (binding) {
                    if (binding.selectedRowElement) {
                        $(binding.selectedRowElement).toggleClass('selected');
                        delete binding.selectedRowElement;
                    }

                    $(data.row).toggleClass('selected');

                    binding.selectedRowElement = data.row;
                    binding.selectedItem_ = data.rowData;
                    binding.updateSource();
                }
            }
        });

        $(nRow).bind('dblclick', {
            container:$container,
            row:nRow,
            rowData:aData
        }, function (event) {
            var data = event.data;

            var nodeBindingInfo = photon.binding.NodeBindingInfo.getForElement($(data.container)[0]);
            var optionsBinding = nodeBindingInfo.findBinding(function (binding) {
                return binding.getExpression().getPropertyHandler() instanceof photon.dataTable.OptionsProperty;
            });

            if(optionsBinding && optionsBinding.options_){
                var options = optionsBinding.options_;
                if(options.fnRowDoubleClickCallback){
                    options.fnRowDoubleClickCallback(data.rowData);
                }
            }
        });

    };

    if (options.aoColumns) {
        var dataContext = new photon.binding.DataContext();
        photon.array.forEach(options.aoColumns, function (column) {
            if (column.bindingTemplate) {
                if (!column.binding) {
                    column.bindingExpression = photon.templating.getPrimaryDataBindingExpressionFromHtml(
                        column.bindingTemplate);
                }
            }
            if (column.binding) {
                if (!column.bindingExpression) {
                    column.bindingExpression = bindingContext.parseBindingExpressions("data-bind", "null:" + column.binding)[0];
                }
            }

            if (column.binding || column.bindingTemplate) {
                column.mDataProp = function (obj, type, value) {
                    switch (type) {
                        case "display":
                            return column.bindingTemplate ?
                                column.bindingTemplate :
                                column.bindingExpression.getGetter()(obj);
                        case "set":
                            column.bindingExpression.getSetter()(obj, value);
                            break;
                        default:
                            return column.bindingExpression ? column.bindingExpression.getGetter()(obj) : null;
                    }
                };
            }
        });
    }

    var result = $container.dataTable(options);

    // remove copies of data-bind attribute that get cloned all over the place!!!
    $(".dataTable[data-bind]").filter(
        function (i, x) {
            return x !== $container[0];
        }).removeAttr("data-bind");

    // return
    return result;
};

photon.defineType(photon.dataTable.DataProperty = function () {

},
    photon.binding.data.Property,
    {
        dataChanged:function (event) {
            this.updateData($(event.data.getTarget()).dataTable(), event.data.getSourceValue());
        },
        updateData:function (dataTable, data) {
            data = photon.observable.unwrap(data);
            if (dataTable) {
                dataTable.fnClearTable();
                dataTable.fnAddData(data);
            }
        },
        getValue:function (binding) {
            return binding.data_;
        },
        setValue:function (binding) {
            if (!binding.isInitialized) {
                binding.isInitialized = true;
                var target = binding.getTarget(), dataTable = $(target).dataTable();
                var newValue = binding.getSourceValue();
                var oldValue = binding.data_;
                if (newValue !== oldValue) {
                    if (binding.dataSubscriber_) {
                        binding.dataSubscriber_.dispose();
                        delete binding.dataSubscriber_;
                    }
                    binding.data_ = newValue;
                    if (newValue && newValue.subscribe) {
                        binding.dataSubscriber_ = newValue.subscribe(this.dataChanged, this, binding);
                    }
                    this.updateData(dataTable, newValue);
                }
            }

        }
    });

photon.defineType(photon.dataTable.OptionsProperty = function () {
},
    photon.binding.data.Property,
    {
        getValue:function (binding) {
            return binding.options_;
        },
        setValue:function (binding) {
            if (binding.options_) {
                return;
            }
            binding.options_ = binding.getSourceValue();
            photon.dataTable.create(binding.getTarget(), binding.options_);
        }
    });

photon.defineType(photon.dataTable.SelectedItemProperty = function () {
},
    photon.binding.data.Property,
    {
        getValue:function (binding) {
            return binding.selectedItem_;
        },
        setValue:function (binding) {
            binding.selectedItem_ = binding.getSourceValue();
        }
    }
);

photon.defineType(photon.dataTable.HiddenColumnsProperty = function () {
},
    photon.binding.data.Property,
    {
        getDefaultBindingMode:function () {
            return photon.binding.data.DataBindingMode.OneWay;
        },
        getValue:function (binding) {
            return binding.hiddenColumns;
        },
        setValue:function (binding) {
            if (!binding.isInitialized) {
                binding.isInitialized = true;
                var target = binding.getTarget(), dataTable = $(target).dataTable();
                var newValue = binding.getSourceValue();
                var oldValue = binding.data_;
                if (newValue !== oldValue) {
                    if (binding.dataSubscriber_) {
                        binding.dataSubscriber_.dispose();
                        delete binding.dataSubscriber_;
                    }
                    binding.data_ = newValue;
                    if (newValue && newValue.subscribe) {
                        binding.dataSubscriber_ = newValue.subscribe(this.dataChanged, this, binding);
                    }
                    this.updateData(dataTable, newValue);
                }
            }
        },
        dataChanged:function (event) {
            this.updateData($(event.data.getTarget()).dataTable(), event.data.getSourceValue());
        },
        updateData:function (dataTable, data) {
            var hiddenColumns = photon.observable.unwrap(data);
            if (dataTable) {
                var columns = dataTable.fnSettings().aoColumns;
                var aoColumnMap = {};

                var isMatchingColumn = function (c) {
                    return c === this.sName;
                };

                for (var i = 0, n = columns.length; i < n; i++) {
                    var column = columns[i];
                    aoColumnMap[column.sName] = {column:column, index:i};
                    var index = photon.array.findIndex(hiddenColumns, isMatchingColumn, column);
                    if (index < 0) {
                        dataTable.fnSetColumnVis(i, true);
                    }
                }

                for (var j = 0, m = hiddenColumns.length; j < m; j++) {
                    var hiddenColumn = hiddenColumns[j];
                    if (aoColumnMap.hasOwnProperty(hiddenColumn)) {
                        dataTable.fnSetColumnVis(aoColumnMap[hiddenColumn].index, false);
                    }
                }
            }
        }
    }
);

photon.binding.data.properties["dataTable.data"] = new photon.dataTable.DataProperty();
photon.binding.data.properties["dataTable.options"] = new photon.dataTable.OptionsProperty();
photon.binding.data.properties["dataTable.selectedItem"] = new photon.dataTable.SelectedItemProperty();
photon.binding.data.properties["dataTable.hiddenColumns"] = new photon.dataTable.HiddenColumnsProperty();


text:
package EpiRR::Service::AccessionService;

use Moose;
use namespace::autoclean;
use LWP;
use Carp;
use URI::Encode qw(uri_encode);
use BioSD;
use JSON;
use autodie;
use EpiRR::Parser::JsonParser;
use EpiRR::Parser::TextFileParser;
use feature qw(say);

has 'conversion_service' => (
    is       => 'rw',
    isa      => 'EpiRR::Service::ConversionService',
    required => 1,
);

has 'output_service' => (
    is       => 'rw',
    isa      => 'EpiRR::Service::OutputService',
    required => 1,
);

has 'json' => (
    is       => 'ro',
    isa      => 'JSON',
    required => 1,
    default  => sub {
        JSON->new();
    }
);

sub json_parser {
	return EpiRR::Parser::JsonParser->new();
}

sub text_parser {
	return EpiRR::Parser::TextFileParser->new()
}

# Process inputfiles
# 1. Decide on Parser
# 2. Parse
# 3. Create RawData (from parsing JSON) and DataSet (to store in DB)
# 4. Using ConversionService, store it in the DB
sub accession {
    my ( $self, $in_file, $out_file, $err_file, $quiet ) = @_;

    open my $ofh, '>', $out_file;
    open my $efh, '>', $err_file;

    my $errors = [];
    my @output = ($errors);

    my $parser;
    if ( $in_file =~ m/\.json$/ ) {
        $parser = $self->json_parser();
        print STDERR "Using JSON parser$/" unless $quiet;
    }
    else {
        $parser = $self->text_parser();
        print STDERR "Using text parser$/" unless $quiet;
    }
    $parser->file_path($in_file);
    $parser->parse();

    if ( $parser->error_count() ) {
        print $efh
          "Error(s) when parsing file, accessioning will not proceed.$/";
        print $efh $_ . $/ for ( $parser->all_errors() );
        push @$errors, $parser->all_errors;
        return @output;
    }

    my $user_dataset = $parser->dataset();
    push @output, $user_dataset;

    my $db_dataset =
      $self->conversion_service->user_to_db( $user_dataset, $errors );

    if (@$errors) {
        print $efh
"Error(s) when checking and storing data set, accessioning will not proceed."
          . $/;
        print $efh $_ . $/ for (@$errors);

    }
    else {
        my $full_dataset = $self->output_service->db_to_user($db_dataset);
        $output[1] = $full_dataset;

        print $ofh $self->json->pretty()->encode( $full_dataset->to_hash() );
    }

    close $ofh;
    close $efh;
    return @output;
}

1;


text:
@interface HolidayFeeAlertView : UIView

@property (nonatomic,copy) dispatch_block_t  confirmBlock;

@end


text:
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.

using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.ComponentModel.Composition.Primitives;
using System.ComponentModel.Composition.ReflectionModel;
using System.Globalization;
using System.Linq;
using System.Reflection;

namespace Microsoft.Common.Core.Extensions {
    public static partial class CompositionBatchExtensions {
        internal class FactoryReflectionComposablePart : ComposablePart {
            private readonly ComposablePartDefinition _composablePartDefinition;
            private readonly Lazy<ComposablePart> _composablePart;
            private readonly IDictionary<ImportDefinition, IEnumerable<Export>> _imports;

            public FactoryReflectionComposablePart(ComposablePartDefinition composablePartDefinition, Delegate valueFactory) {
                _composablePartDefinition = composablePartDefinition;
                _composablePart = new Lazy<ComposablePart>(() => CreatePart(valueFactory));
                _imports = new Dictionary<ImportDefinition, IEnumerable<Export>>();
            }

            public override IEnumerable<ExportDefinition> ExportDefinitions => _composablePartDefinition.ExportDefinitions;
            public override IEnumerable<ImportDefinition> ImportDefinitions => _composablePartDefinition.ImportDefinitions;
            public override IDictionary<string, object> Metadata => _composablePartDefinition.Metadata;

            public override void Activate() {
                _composablePart.Value.Activate();
            }

            public override object GetExportedValue(ExportDefinition definition) {
                return _composablePart.Value.GetExportedValue(definition);
            }

            public override void SetImport(ImportDefinition definition, IEnumerable<Export> exports) {
                if (_composablePart.IsValueCreated ||
                    _imports == null) {
                    _composablePart.Value.SetImport(definition, exports);
                } else {
                    _imports.Add(definition, exports);
                }
            }

            private ComposablePart CreatePart(Delegate valueFactory) {
                var args = GetArguments(valueFactory);
                var value = valueFactory.DynamicInvoke(args);
                var part = AttributedModelServices.CreatePart(_composablePartDefinition, value);
                foreach (KeyValuePair<ImportDefinition, IEnumerable<Export>> import in _imports) {
                    part.SetImport(import.Key, import.Value);
                }

                _imports.Clear();
                return part;
            }

            private object[] GetArguments(Delegate valueFactory) {
                object[] arguments = new object[valueFactory.GetMethodInfo().GetParameters().Length];

                IEnumerable<ImportDefinition> ctorImportDefinitions = ImportDefinitions.Where(ReflectionModelServices.IsImportingParameter);
                foreach (ImportDefinition ctorImportDefinition in ctorImportDefinitions) {
                    ParameterInfo parameterInfo = ReflectionModelServices.GetImportingParameter(ctorImportDefinition).Value;
                    IEnumerable<Export> value;
                    if (_imports.TryGetValue(ctorImportDefinition, out value)) {
                        arguments[parameterInfo.Position] = value.Single().Value;
                        _imports.Remove(ctorImportDefinition);
                    } else {
                        throw new InvalidOperationException(string.Format(CultureInfo.InvariantCulture, "There is no export for parameter of type {0}",
                            parameterInfo.ParameterType));
                    }
                }

                return arguments;
            }
        }
    }
}


text:
module DocumentMatchHelper
  def formatted_title(document)
    link_to(document_download_path(document.file_ptr)) do
      document.file_original_name
    end
  end

  def formatted_diff(_document_match)
    ""
  end
end