text:
#if !defined(_OFSYS_H_INCLUDED_)
#error "Please do not include this file directly.  Include <ofsys.h>"
#endif

#if !defined(_OFLOGSERVICE_H_)
#define _OFLOGSERVICE_H_

#include <string>
using namespace std;

#if defined(OFOPSYS_WIN32)

#include <ofmutex.h>

#define	LOG_EMERG	0	/* system is unusable */
#define	LOG_ALERT	1	/* action must be taken immediately */
#define	LOG_CRIT	2	/* critical conditions */
#define	LOG_ERR		3	/* error conditions */
#define	LOG_WARNING	4	/* warning conditions */
#define	LOG_NOTICE	5	/* normal but significant condition */
#define	LOG_INFO	6	/* informational */
#define	LOG_DEBUG	7	/* debug-level messages */
#endif // OFOPSYS_WIN32

/** Provides a simple cross platform logging service
 */
class OFSYS_API OFLogService
{
 public:
    /** \name Log writing methods
     */
    //@{

    /** Write a standard line to the log
     */
    static void writeLine(const char* format, ...);

    /** Write an error line to the log
     */
    static void errorLine(const char* format, ...);

    /** Write a debug line to the log

        Does nothing for a release build
    */
    static void debugLine(const char* format, ...);

    /** Write a line to stdout
     */
    static void dumpLine(const char* format, ...);

    //@}

    /** \name Helper methods
     */
    //@{

    /** Set the current application name
     */
    void appName(const string& appName);

    //@}

 private:

    /** The name of the current application
     */
    static string m_appName;

    /** Write the supplied line to log
     */
    static void write_(ofuint32 sev, const string& line);

#if defined(OFOPSYS_WIN32)
	/** Mutex for file loggin
	*/
	static OFMutex m_mutexFile;
#endif

};

#endif // _OFLOGSERVICE_H_


text:
/*****************************************************************************/
/* DlgEasEditor.cpp                       Copyright (c) Ladislav Zezula 2008 */
/*---------------------------------------------------------------------------*/
/* Description :                                                             */
/*---------------------------------------------------------------------------*/
/*   Date    Ver   Who  Comment                                              */
/* --------  ----  ---  -------                                              */
/* 25.07.08  1.00  Lad  The first version of DlgEasEditor.cpp                */
/*****************************************************************************/

#include "FileTest.h"
#include "resource.h"

//-----------------------------------------------------------------------------
// Local variables

static TListViewColumns Columns[] =
{
    {IDS_EA_NAME, 120},
    {IDS_EA_SIZE,  80},
    {IDS_EA_VALUE, -1},
    {0, 0}
};

//-----------------------------------------------------------------------------
// Local functions

static BOOL UpdateDialogButtons(HWND hDlg)
{
    HWND hListView = GetDlgItem(hDlg, IDC_EA_LIST);
    HWND hButton;
    int nSelected = ListView_GetSelectedCount(hListView);
    int nItems = ListView_GetItemCount(hListView);
    int nItem = ListView_GetNextItem(hListView, -1, LVNI_SELECTED);

    // "Insert will be always enabled"
    hButton = GetDlgItem(hDlg, IDC_INSERT);
    EnableWindow(hButton, TRUE);

    // Enable/disable "Edit"
    hButton = GetDlgItem(hDlg, IDC_EDIT);
    EnableWindow(hButton, (nSelected == 1));

    // Enable/disable "Delete"
    hButton = GetDlgItem(hDlg, IDC_DELETE);
    EnableWindow(hButton, (nSelected == 1));

    // Enable/disable "Up"
    hButton = GetDlgItem(hDlg, IDC_MOVE_UP);
    EnableWindow(hButton, (nItem > 0));

    // Enable/disable "Down"
    hButton = GetDlgItem(hDlg, IDC_MOVE_DOWN);
    EnableWindow(hButton, (0 <= nItem && nItem < (nItems - 1)));
    return TRUE;
}

static int SetListViewEaEntry(
    HWND hListView,
    int nIndex,
    PFILE_FULL_EA_INFORMATION pEaItem,
    BOOL bInsertNew)
{
    LVITEM lvi;
    LPTSTR szEaName;
    LPTSTR szEaValue;
    LPTSTR szTemp;
    PBYTE pbEaValue = (PBYTE)pEaItem->EaName + pEaItem->EaNameLength + 1;
    TCHAR szEaSize[20];
    int i;

    // -1 means insert to the end of the list
    if(nIndex == -1)
        nIndex = ListView_GetItemCount(hListView);

    // Allocate buffer for EA name and convert the name
    szEaName  = new TCHAR[pEaItem->EaNameLength + 1];
    for(i = 0; i < pEaItem->EaNameLength; i++)
        szEaName[i] = pEaItem->EaName[i];
    szEaName[i] = 0;

    // Allocate buffer for EA value and convert the value
    szEaValue = szTemp = new TCHAR[(pEaItem->EaValueLength * 3) + 1];
    for(i = 0; i < pEaItem->EaValueLength; i++)
        szTemp += _stprintf(szTemp, _T("%02lX "), pbEaValue[i]);
    szTemp[0] = 0;

    // Set the main item
    ZeroMemory(&lvi, sizeof(LVITEM));
    lvi.mask    = LVIF_TEXT | LVIF_PARAM;
    lvi.iItem   = nIndex;
    lvi.pszText = szEaName;
    lvi.lParam  = (LPARAM)pEaItem;

    // Insert or set the item
    if(bInsertNew)
        nIndex = ListView_InsertItem(hListView, &lvi);
    else
        ListView_SetItem(hListView, &lvi);

    // Set the sub item text
    _stprintf(szEaSize, _T("0x%04X"), pEaItem->EaValueLength);
    ListView_SetItemText(hListView, nIndex, 1, szEaSize);

    // Set the sub item text
    ListView_SetItemText(hListView, nIndex, 2, szEaValue);

    delete [] szEaValue;
    delete [] szEaName;
    return TRUE;
}

//-----------------------------------------------------------------------------
// Dialog handlers

static int OnInitDialog(HWND hDlg, LPARAM lParam)
{
    TFileTestData * pData = (TFileTestData *)lParam;
    HWND hListView = GetDlgItem(hDlg, IDC_EA_LIST);

    // Save the user data
    SetDialogData(hDlg, lParam);
    CenterWindowToParent(hDlg);

    // Initialize the listview
    ListView_CreateColumns(hListView, Columns);
    ListView_SetExtendedListViewStyle(hListView, LVS_EX_GRIDLINES | LVS_EX_FULLROWSELECT | LVS_EX_LABELTIP);

    // Save the pointer to TFileTestData
    if(lParam != 0)
        ExtendedAttributesToListView(hDlg, pData->pFileEa);

    // Initialize the listview
    UpdateDialogButtons(hDlg);
    return TRUE;
}

void MoveItem(HWND hDlg, BOOL bUp)
{
    LVITEM lvi1;
    LVITEM lvi2;
    TCHAR szText1[MAX_PATH + 1] = _T("");
    TCHAR szText2[MAX_PATH + 1] = _T("");
    HWND hListView = GetDlgItem(hDlg, IDC_EA_LIST);
    int nItems = ListView_GetItemCount(hListView);
    int nItem1 = 0;
    int nItem2 = 0;

    if(bUp == FALSE)
    {
        nItem1 = ListView_GetNextItem(hListView, -1, LVNI_FOCUSED);
        nItem2 = nItem1 + 1;
        if(nItem1 == nItems - 1)
            return;

    }
    else
    {
        nItem1 = ListView_GetNextItem(hListView, -1, LVNI_FOCUSED) - 1;
        nItem2 = nItem1 + 1;
        if(nItem1 < 0)
            return;
    }

    // Disable redrawing during item acrobatics
    SendMessage(hListView, WM_SETREDRAW, FALSE, 0);

    // Retrieve the both items
    ZeroMemory(&lvi1, sizeof(LVITEM));
    lvi1.mask       = LVIF_IMAGE | LVIF_STATE | LVIF_TEXT | LVIF_PARAM;
    lvi1.stateMask  = (UINT)-1;
    lvi1.iItem      = nItem1;
    lvi1.pszText    = szText1;
    lvi1.cchTextMax = _tsize(szText1);
    ListView_GetItem(hListView, &lvi1);

    ZeroMemory(&lvi2, sizeof(LVITEM));
    lvi2.mask       = LVIF_IMAGE | LVIF_STATE | LVIF_TEXT | LVIF_PARAM;
    lvi2.stateMask  = (UINT)-1;
    lvi2.iItem      = nItem2;
    lvi2.pszText    = szText2;
    lvi2.cchTextMax = _tsize(szText2);
    ListView_GetItem(hListView, &lvi2);

    // Switch the main items
    lvi2.iItem = nItem1;
    ListView_SetItem(hListView, &lvi2);
    lvi1.iItem = nItem2;
    ListView_SetItem(hListView, &lvi1);

    // Switch the texts for the subitems
    ListView_GetItemText(hListView, nItem1, 1, szText1, _tsize(szText1));
    ListView_GetItemText(hListView, nItem2, 1, szText2, _tsize(szText2));
    ListView_SetItemText(hListView, nItem1, 1, szText2);
    ListView_SetItemText(hListView, nItem2, 1, szText1);

    // Enable redrawing and redraw the window
    SendMessage(hListView, WM_SETREDRAW, TRUE, 0);
    InvalidateRect(hListView, NULL, TRUE);
}

static int OnInsertEa(HWND hDlg)
{
    PFILE_FULL_EA_INFORMATION pEaItem = NULL;
    HWND hListView;

    // Call the dialog for creating new EA
    if(EaEditorDialog(hDlg, &pEaItem) != IDOK)
        return TRUE;

    // Insert listview
    hListView = GetDlgItem(hDlg, IDC_EA_LIST);
    SetListViewEaEntry(hListView, -1, pEaItem, TRUE);
    UpdateDialogButtons(hDlg);
    return TRUE;
}

static int OnEditEa(HWND hDlg)
{
    PFILE_FULL_EA_INFORMATION pEaItem = NULL;
    HWND hListView = GetDlgItem(hDlg, IDC_EA_LIST);
    int nSelected = ListView_GetNextItem(hListView, -1, LVNI_SELECTED);

    // If no item selected, do nothing
    if(nSelected == -1)
        return 0;

    // Call the dialog for editing EA
    pEaItem = (PFILE_FULL_EA_INFORMATION)ListView_GetItemParam(hListView, nSelected);
    if(EaEditorDialog(hDlg, &pEaItem) != IDOK)
        return TRUE;

    SetListViewEaEntry(hListView, nSelected, pEaItem, FALSE);
    UpdateDialogButtons(hDlg);
    return TRUE;
}

static int OnDeleteEa(HWND hDlg)
{
    HWND hListView = GetDlgItem(hDlg, IDC_EA_LIST);
    int nSelected = ListView_GetNextItem(hListView, -1, LVNI_SELECTED);

    // If no item selected, do nothing
    if(nSelected != -1)
        ListView_DeleteItem(hListView, nSelected);
    UpdateDialogButtons(hDlg);
    return TRUE;
}

static int OnDoubleClick(HWND hDlg)
{
    HWND hListView = GetDlgItem(hDlg, IDC_EA_LIST);
    int nSelected = ListView_GetNextItem(hListView, -1, LVNI_SELECTED);

    if(nSelected == -1)
        OnInsertEa(hDlg);
    else
        OnEditEa(hDlg);
    return TRUE;
}

static int OnLVKeyDown(HWND hDlg, NMLVKEYDOWN * pLVKeyDown)
{
    switch(pLVKeyDown->wVKey)
    {
        case VK_INSERT:
            return OnInsertEa(hDlg);

        case VK_DELETE:
            return OnDeleteEa(hDlg);
    }
    return FALSE;
}

static BOOL OnSaveDialog(HWND hDlg)
{
    TFileTestData * pData = GetDialogData(hDlg);

    if(pData != NULL)
    {
        // Delete the existing EAs
        if(pData->pFileEa != NULL)
            delete [] pData->pFileEa;
        pData->pFileEa = NULL;
        pData->dwEaSize = 0;

        // Create new extended attributes
        pData->pFileEa = ListViewToExtendedAttributes(hDlg, pData->dwEaSize);
    }
    return TRUE;
}

static int OnDeleteItem(HWND /* hDlg */, LPNMLISTVIEW pNMListView)
{
    PFILE_FULL_EA_INFORMATION pEaItem = (PFILE_FULL_EA_INFORMATION)pNMListView->lParam;

    if(pEaItem != NULL)
        delete [] pEaItem;
    return TRUE;
}

static int OnCommand(HWND hDlg, UINT nNotify, UINT nIDCtrl)
{
    if(nNotify == BN_CLICKED)
    {
        switch(nIDCtrl)
        {
            case IDC_MOVE_UP:
                MoveItem(hDlg, TRUE);
                return TRUE;

            case IDC_MOVE_DOWN:
                MoveItem(hDlg, FALSE);
                return TRUE;

            case IDC_INSERT:
                OnInsertEa(hDlg);
                return TRUE;

            case IDC_EDIT:
                OnEditEa(hDlg);
                return TRUE;

            case IDC_DELETE:
                OnDeleteEa(hDlg);
                return TRUE;

            case IDOK:
                OnSaveDialog(hDlg);
                // No break here !!!

            case IDCANCEL:
                EndDialog(hDlg, nIDCtrl);
                return TRUE;
        }
    }

    return FALSE;
}

static int OnNotify(HWND hDlg, NMHDR * pNMHDR)
{
    switch(pNMHDR->code)
    {
        case NM_DBLCLK:
            if(pNMHDR->idFrom == IDC_EA_LIST)
                return OnDoubleClick(hDlg);
            break;

        case LVN_KEYDOWN:
            if(pNMHDR->idFrom == IDC_EA_LIST)
                return OnLVKeyDown(hDlg, (NMLVKEYDOWN *)pNMHDR);
            break;

        case LVN_ITEMCHANGED:
            if(pNMHDR->idFrom == IDC_EA_LIST)
                return UpdateDialogButtons(hDlg);
            break;

        case LVN_DELETEITEM:
            if(pNMHDR->idFrom == IDC_EA_LIST)
                return OnDeleteItem(hDlg, (LPNMLISTVIEW)pNMHDR);
            break;
    }
    return FALSE;
}

//-----------------------------------------------------------------------------
// Public functions

void ExtendedAttributesToListView(HWND hDlg, PFILE_FULL_EA_INFORMATION pFileEa)
{
    PFILE_FULL_EA_INFORMATION pEaItemCopy;
    PFILE_FULL_EA_INFORMATION pEaItem;
    ULONG dwEaItemSize = 0;
    HWND hListView = GetDlgItem(hDlg, IDC_EA_LIST);

    ListView_DeleteAllItems(hListView);

    // Load the listview with the extended attributes
    if(pFileEa != NULL)
    {
        pEaItem = pFileEa;
        for(;;)
        {
            // Create the EA copy and insert it to the list
            dwEaItemSize = GetEaEntrySize(pEaItem);
            pEaItemCopy = (PFILE_FULL_EA_INFORMATION)(new char [dwEaItemSize]);
            CopyMemory(pEaItemCopy, pEaItem, dwEaItemSize);
            pEaItemCopy->NextEntryOffset = dwEaItemSize;
            SetListViewEaEntry(hListView, -1, pEaItemCopy, TRUE);

            // Move to the next item
            if(pEaItem->NextEntryOffset == 0)
                break;
            pEaItem = (PFILE_FULL_EA_INFORMATION)((PBYTE)pEaItem + pEaItem->NextEntryOffset);
        }
    }
}

PFILE_FULL_EA_INFORMATION ListViewToExtendedAttributes(HWND hDlg, DWORD & dwOutEaLength)
{
    PFILE_FULL_EA_INFORMATION pEaItemCopy;
    PFILE_FULL_EA_INFORMATION pEaItem;
    PFILE_FULL_EA_INFORMATION pFileEa = NULL;
    DWORD dwEaLength = 0;
    HWND hListView = GetDlgItem(hDlg, IDC_EA_LIST);
    int nItemCount = ListView_GetItemCount(hListView);
    int nIndex;

    // Calculate the buffer necessary to set the EA.
    for(nIndex = 0; nIndex < nItemCount; nIndex++)
    {
        pEaItem = (PFILE_FULL_EA_INFORMATION)ListView_GetItemParam(hListView, nIndex);
        if(pEaItem != NULL)
        {
            dwEaLength += pEaItem->NextEntryOffset;
        }
    }

    // Allocate buffer for the complete EA list and copy the EAs to that buffer
    pEaItemCopy = pFileEa = (PFILE_FULL_EA_INFORMATION)(new BYTE[dwEaLength]);
    if(pFileEa != NULL)
    {
        for(nIndex = 0; nIndex < nItemCount; nIndex++)
        {
            pEaItem = (PFILE_FULL_EA_INFORMATION)ListView_GetItemParam(hListView, nIndex);
            if(pEaItem != NULL)
            {
                memcpy(pEaItemCopy, pEaItem, pEaItem->NextEntryOffset);

                // If this is the last item, we have to set zero as NextEntryOffset
                if(nIndex == nItemCount - 1)
                    pEaItemCopy->NextEntryOffset = 0;
                pEaItemCopy = (PFILE_FULL_EA_INFORMATION)((LPBYTE)pEaItemCopy + pEaItemCopy->NextEntryOffset);
            }
        }
    }
    else
    {
        dwEaLength = 0;
    }

    // Give the EAs tothe caller
    dwOutEaLength = dwEaLength;
    return pFileEa;
}

// Common dialog proc, shared by Page08Ea.cpp
// - Returns nonzero = message has been handled
// - Returns zero = message has NOT been handled
INT_PTR CALLBACK ExtendedAttributesEditorProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    switch(uMsg)
    {
        case WM_INITDIALOG:
            return OnInitDialog(hDlg, lParam);

        case WM_COMMAND:
            return OnCommand(hDlg, HIWORD(wParam), LOWORD(wParam));

        case WM_NOTIFY:
            return OnNotify(hDlg, (NMHDR *)lParam);
    }

    return FALSE;
}

INT_PTR ExtendedAtributesEditorDialog(HWND hParent, TFileTestData * pData)
{
    return DialogBoxParam(g_hInst,
                          MAKEINTRESOURCE(IDD_EAS_EDITOR),
                          hParent,
                          ExtendedAttributesEditorProc,
                  (LPARAM)pData);
}

redpajama_set_name: RedPajamaGithub


text:
var Dolby=Dolby||{};!function(){"use strict";Dolby.supportDDPlus=!1;var e=new Audio;""!=e.canPlayType('audio/mp4;codecs="ec-3"')&&(-1==navigator.userAgent.indexOf("CPU iPhone OS 9_3")&&-1==navigator.userAgent.indexOf("CPU OS 9_3")||-1==navigator.userAgent.indexOf("Safari")||-1==navigator.userAgent.indexOf("Version/9")||(Dolby.supportDDPlus=!0),-1!=navigator.userAgent.indexOf("Mac OS X 10_1")&&-1!=navigator.userAgent.indexOf("Safari")&&-1!=navigator.userAgent.indexOf("Version/9")&&(Dolby.supportDDPlus=!0),-1!=navigator.userAgent.indexOf("Edge")&&(Dolby.supportDDPlus=!0),-1!=navigator.userAgent.indexOf("Windows Phone 10")&&(Dolby.supportDDPlus=!1)),Dolby.checkDDPlus=function(){return Dolby.supportDDPlus}}();
var dolbySupported = Dolby.checkDDPlus();

// Effects
var delay = new Pizzicato.Effects.Delay({
  feedback: 0.6,
  time: 0.4,
  mix: 0.5
});
var pingPongDelay = new Pizzicato.Effects.PingPongDelay({
	feedback: 0.6,
	time: 0.4,
	mix: 0.5
});
var dubDelay = new Pizzicato.Effects.DubDelay({
	feedback: 0.6,
	time: 0.7,
	mix: 0.5,
	cutoff: 700
});

var compressor = new Pizzicato.Effects.Compressor({
	threshold: -24,
	ratio: 12
});
var lowPassFilter = new Pizzicato.Effects.LowPassFilter({
	frequency: 400,
	peak: 10
});
var highPassFilter = new Pizzicato.Effects.HighPassFilter({
	frequency: 10,
	peak: 10
});
var distortion = new Pizzicato.Effects.Distortion({
	gain: 0.4
});
var quadrafuzz = new Pizzicato.Effects.Quadrafuzz();
var flanger = new Pizzicato.Effects.Flanger();
var stereoPanner = new Pizzicato.Effects.StereoPanner();
var reverb = new Pizzicato.Effects.Reverb();
var convolver = new Pizzicato.Effects.Convolver({ impulse: './audio/scala-milan.wav' });
var tremolo = new Pizzicato.Effects.Tremolo({
	speed: 7,
	mix: 0.8,
	depth: 0.8
});
var ringModulator = new Pizzicato.Effects.RingModulator({
	speed: 30,
	distortion: 1,
	mix: 0.5
});

// Sounds
var sineWave = new Pz.Sound();
var sineWaveRelease = new Pz.Sound({ source: 'wave', options: { frequency: 220, release: 1, attack:0.5 } });
var acoustic = new Pz.Sound(dolbySupported ? './audio/acoustic_Dolby.mp4' : './audio/acoustic.mp3');

var timba = new Pz.Sound({
	source: 'file',
	options: {
		path: dolbySupported ? './audio/timba_Dolby.mp4' : './audio/timba.mp3',
		loop: true
	}
}, function() { timba.addEffect(delay); });

var electro = new Pz.Sound({
	source: 'file',
	options: {
		path: dolbySupported ? './audio/electro_Dolby.mp4' : './audio/electro.mp3',
		loop: true
	}
}, function() { electro.addEffect(compressor); });

var synth = new Pz.Sound({
	source: 'file',
	options: {
		path: dolbySupported ? './audio/synth_Dolby.mp4' : './audio/synth.mp3',
		loop: true
	}
}, function() { synth.addEffect(lowPassFilter); });

var synth2 = new Pz.Sound({
	source: 'file',
	options: {
		path: dolbySupported ? './audio/synth2_Dolby.mp4' : './audio/synth2.mp3',
		loop: true
	}
}, function() { synth2.addEffect(highPassFilter); });

var guitar = new Pz.Sound({
	source: 'file',
	options: {
		path: dolbySupported ? './audio/guitar_Dolby.mp4' : './audio/guitar.mp3',
		loop: true
	}
}, function() { guitar.addEffect(distortion); });

var walkGuitar = new Pz.Sound({
	source: 'file',
	options: {
		path: './audio/uttl.mp3',
		loop: true
	}
}, function() { walkGuitar.addEffect(quadrafuzz); });

var electricGuitar = new Pz.Sound({
	source: 'file',
	options: {
		path: dolbySupported ? './audio/electric-guitar_Dolby.mp4' : './audio/electric-guitar.mp3',
		loop: true
	}
}, function() { electricGuitar.addEffect(flanger); });

var wah = new Pz.Sound({
	source: 'file',
	options: {
		path: './audio/wah.mp3',
		loop: true
	}
}, function() { wah.addEffect(pingPongDelay); });

var chop = new Pz.Sound({
	source: 'file',
	options: {
		path: './audio/chop.mp3',
		loop: true
	}
}, function() { chop.addEffect(dubDelay); });

var stanceBass = new Pz.Sound({
	source: 'file',
	options: {
		path: './audio/stance-bass.mp3',
		loop: true
	}
}, function() { stanceBass.addEffect(stereoPanner); });

var cavaquinho = new Pz.Sound({
	source: 'file',
	options: {
		path: './audio/cavaquinho.mp3',
		loop: true
	}
}, function() { cavaquinho.addEffect(reverb); });

var drums = new Pz.Sound({
	source: 'file',
	options: {
		path: './audio/drums.mp3',
		loop: true
	}
}, function() {
	drums.addEffect(convolver);
});

var tremoloGuitar = new Pz.Sound({
	source: 'file',
	options: {
		path: './audio/tremolo-guitar.mp3',
		loop: true
	}
}, function() {
	tremoloGuitar.addEffect(tremolo);
});

var whiteNoise = new Pz.Sound(function(e) {
  var output = e.outputBuffer.getChannelData(0);
  for (var i = 0; i < e.outputBuffer.length; i++)
    output[i] = Math.random();
});

var voice = new Pizzicato.Sound({ source: 'input' }, function(err) {
	if (!err) return;
	document.getElementById('play-voice').setAttribute('disabled', 'disabled');
	document.getElementById('stop-voice').setAttribute('disabled', 'disabled');
	document.getElementById('volume-voice').setAttribute('disabled', 'disabled');
	document.getElementById('microphone-error').style.display = 'block';
});

var countdown = new Pz.Sound({
	source: 'file',
	options: {
		path: './audio/countdown.mp3',
		loop: true
	}
}, function() {
	countdown.addEffect(ringModulator);
});

var guitarGroup = new Pz.Sound({ source: 'file', options: {
	path: './audio/guitar-group.mp3',
	loop: true
}});
var bassGroup = new Pz.Sound({ source: 'file', options: {
	path: './audio/bass-group.mp3',
	loop: true
}});
var drumsGroup = new Pz.Sound({ source: 'file', options: {
	path: './audio/drums-group.mp3',
	loop: true
}});

var group = new Pz.Group([guitarGroup, drumsGroup, bassGroup]);

var segments = [
	{
		audio: sineWave,
		playButton: document.getElementById('play-wave'),
		stopButton: document.getElementById('stop-wave'),
		volumeSlider: document.getElementById('volume-wave')
	},
	{
		audio: acoustic,
		playButton: document.getElementById('play-acoustic'),
		stopButton: document.getElementById('stop-acoustic'),
		volumeSlider: document.getElementById('volume-acoustic')
	},
	{
		audio: voice,
		playButton: document.getElementById('play-voice'),
		stopButton: document.getElementById('stop-voice'),
		volumeSlider: document.getElementById('volume-voice')
	},
	{
		audio: whiteNoise,
		playButton: document.getElementById('play-white'),
		stopButton: document.getElementById('stop-white'),
		volumeSlider: document.getElementById('volume-white')
	},
	{
		audio: sineWaveRelease,
		playButton: document.getElementById('play-release'),
		stopButton: document.getElementById('stop-release'),
		volumeSlider: document.getElementById('volume-release'),
		releaseSlider: document.getElementById('value-release'),
		attackSlider: document.getElementById('value-attack')
	},
	{
		audio: group,
		playButton: document.getElementById('play-group-1'),
		stopButton: document.getElementById('stop-group-1'),
		volumeSlider: document.getElementById('volume-group-1')
	},
	{
		audio: timba,
		playButton: document.getElementById('play-timba'),
		stopButton: document.getElementById('stop-timba'),
		volumeSlider: document.getElementById('volume-timba'),
		effects: [
			{
				instance: delay,
				parameters: {
					feedback: document.getElementById('delay-feedback'),
					time: document.getElementById('delay-time'),
					mix: document.getElementById('delay-mix')
				}
			}
		]
	},
	{
		audio: wah,
		playButton: document.getElementById('play-wah'),
		stopButton: document.getElementById('stop-wah'),
		volumeSlider: document.getElementById('volume-wah'),
		effects: [
			{
				instance: pingPongDelay,
				parameters: {
					feedback: document.getElementById('ping-pong-delay-feedback'),
					time: document.getElementById('ping-pong-delay-time'),
					mix: document.getElementById('ping-pong-delay-mix')
				}
			}
		]
	},
	{
		audio: chop,
		playButton: document.getElementById('play-chop'),
		stopButton: document.getElementById('stop-chop'),
		volumeSlider: document.getElementById('volume-chop'),
		effects: [
			{
				instance: dubDelay,
				parameters: {
					feedback: document.getElementById('dub-delay-feedback'),
					time: document.getElementById('dub-delay-time'),
					mix: document.getElementById('dub-delay-mix'),
					cutoff: document.getElementById('dub-delay-cutoff')
				}
			}
		]
	},
	{
		audio: stanceBass,
		playButton: document.getElementById('play-stance-bass'),
		stopButton: document.getElementById('stop-stance-bass'),
		volumeSlider: document.getElementById('volume-stance-bass'),
		effects: [
			{
				instance: stereoPanner,
				parameters: {
					pan: document.getElementById('stereo-panner-pan')
				}
			}
		]
	},
	{
		audio: cavaquinho,
		playButton: document.getElementById('play-cavaquinho'),
		stopButton: document.getElementById('stop-cavaquinho'),
		volumeSlider: document.getElementById('volume-cavaquinho'),
		effects: [
			{
				instance: reverb,
				parameters: {
					time: document.getElementById('reverb-time'),
					decay: document.getElementById('reverb-decay'),
					mix: document.getElementById('reverb-mix')
				}
			}
		]
	},
	{
		audio: drums,
		playButton: document.getElementById('play-drums'),
		stopButton: document.getElementById('stop-drums'),
		volumeSlider: document.getElementById('volume-drums'),
		effects: [
			{
				instance: convolver,
				parameters: {
					mix: document.getElementById('convolver-mix')
				}
			}
		]
	},

	{
		audio: tremoloGuitar,
		playButton: document.getElementById('play-tremolo-guitar'),
		stopButton: document.getElementById('stop-tremolo-guitar'),
		volumeSlider: document.getElementById('volume-tremolo-guitar'),
		effects: [
			{
				instance: tremolo,
				parameters: {
					speed: document.getElementById('tremolo-speed'),
					mix: document.getElementById('tremolo-mix'),
					depth: document.getElementById('tremolo-depth')
				}
			}
		]
	},

	{
		audio: electro,
		playButton: document.getElementById('play-electro'),
		stopButton: document.getElementById('stop-electro'),
		volumeSlider: document.getElementById('volume-electro'),
		effects: [
			{
				instance: compressor,
				parameters: {
					threshold: document.getElementById('compressor-threshold'),
					knee: document.getElementById('compressor-knee'),
					attack: document.getElementById('compressor-attack'),
					release: document.getElementById('compressor-release'),
					ratio: document.getElementById('compressor-ratio')
				}
			}
		]
	},
	{
		audio: synth,
		playButton: document.getElementById('play-synth'),
		stopButton: document.getElementById('stop-synth'),
		volumeSlider: document.getElementById('volume-synth'),
		effects: [
			{
				instance: lowPassFilter,
				parameters: {
					frequency: document.getElementById('low-pass-filter-frequency'),
					peak: document.getElementById('low-pass-filter-peak')
				}
			}
		]
	},
	{
		audio: synth2,
		playButton: document.getElementById('play-synth2'),
		stopButton: document.getElementById('stop-synth2'),
		volumeSlider: document.getElementById('volume-synth2'),
		effects: [
			{
				instance: highPassFilter,
				parameters: {
					frequency: document.getElementById('high-pass-filter-frequency'),
					peak: document.getElementById('high-pass-filter-peak')
				}
			}
		]
	},
	{
		audio: guitar,
		playButton: document.getElementById('play-guitar'),
		stopButton: document.getElementById('stop-guitar'),
		volumeSlider: document.getElementById('volume-guitar'),
		effects: [
			{
				instance: distortion,
				parameters: {
					gain: document.getElementById('distortion-gain')
				}
			}
		]
	},
	{
		audio: walkGuitar,
		playButton: document.getElementById('play-drum-fill'),
		stopButton: document.getElementById('stop-drum-fill'),
		volumeSlider: document.getElementById('volume-drum-fill'),
		effects: [
			{
				instance: quadrafuzz,
				parameters: {
					lowGain: document.getElementById('quadrafuzz-low'),
					midLowGain: document.getElementById('quadrafuzz-mid-low'),
					midHighGain: document.getElementById('quadrafuzz-mid-high'),
					highGain: document.getElementById('quadrafuzz-high'),
				}
			}
		]
	},
	{
		audio: electricGuitar,
		playButton: document.getElementById('play-electric-guitar'),
		stopButton: document.getElementById('stop-electric-guitar'),
		volumeSlider: document.getElementById('volume-electric-guitar'),
		effects: [
			{
				instance: flanger,
				parameters: {
					time: document.getElementById('flanger-time'),
					depth: document.getElementById('flanger-depth'),
					speed: document.getElementById('flanger-speed'),
					mix: document.getElementById('flanger-mix'),
					feedback: document.getElementById('flanger-feedback')
				}
			}
		]
	},
	{
		audio: countdown,
		playButton: document.getElementById('play-recorded-voice'),
		stopButton: document.getElementById('stop-recorded-voice'),
		volumeSlider: document.getElementById('volume-recorded-voice'),
		effects: [
			{
				instance: ringModulator,
				parameters: {
					speed: document.getElementById('ringmod-speed'),
					mix: document.getElementById('ringmod-mix'),
					distortion: document.getElementById('ringmod-distortion')
					}
				}
		]
	}
]

for (var i = 0; i < segments.length; i++) {
	(function(segment) {

		segment.audio.on('play', function() {
			segment.playButton.classList.add('pause');
		});

		segment.audio.on('stop', function() {
			segment.playButton.classList.remove('pause');
		});

		segment.audio.on('pause', function() {
			segment.playButton.classList.remove('pause');
		});

		segment.playButton.addEventListener('click', function(e) {
			if (segment.playButton.classList.contains('pause'))
				segment.audio.pause();
			else
				segment.audio.play();
		});

		segment.stopButton.addEventListener('click', function(e) {
			segment.audio.stop();
		});

		segment.volumeSlider.addEventListener('input', function(e) {
			var volumeDisplay = segment.volumeSlider.parentNode.getElementsByClassName('slider-value')[0];
			volumeDisplay.innerHTML = segment.audio.volume = e.target.valueAsNumber;
		});

		if (segment.releaseSlider) {
			segment.releaseSlider.addEventListener('input', function(e) {
				var releaseDisplay = segment.releaseSlider.parentNode.getElementsByClassName('slider-value')[0];
				releaseDisplay.innerHTML = segment.audio.release = e.target.valueAsNumber;
			});
		}

		if (segment.attackSlider) {
			segment.attackSlider.addEventListener('input', function(e) {
				var attackDisplay = segment.attackSlider.parentNode.getElementsByClassName('slider-value')[0];
				attackDisplay.innerHTML = segment.audio.attack = e.target.valueAsNumber;
			});
		}

		if (!segment.effects || !segment.effects.length)
			return;

		for (var i = 0; i < segment.effects.length; i++) {
			var effect = segment.effects[i];

			for (var key in effect.parameters) {
				(function(key, slider, instance){

					var display = slider.parentNode.getElementsByClassName('slider-value')[0];

					slider.addEventListener('input', function(e) {
						display.innerHTML = instance[key] = e.target.valueAsNumber;
					});

				})(key, effect.parameters[key], effect.instance);
			}
		}

	})(segments[i]);
}


text:
FROM netflixoss/java:8

COPY ./build/distributions/Triathlon-1.0.tar /tmp/Triathlon-1.0.tar

RUN tar -xf /tmp/Triathlon-1.0.tar -C /opt
RUN ln -s /opt/Triathlon-1.0 /opt/Triathlon
ADD misc/eureka2-core-2.0.0-SNAPSHOT.jar /opt/Triathlon/lib/eureka2-core-2.0.0-rc.2.jar
RUN rm /tmp/Triathlon-1.0.tar

ENV archaius.deployment.environment=pro

CMD ["/opt/Triathlon/bin/Triathlon", "com.schibsted.triathlon.main.TriathlonServer"]


text:
#ifndef _w32_mm_Mapping_hpp__
#define _w32_mm_Mapping_hpp__

// Copyright (c) 2009-2012, Andre Caron (andre.l.caron@gmail.com)
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
//  * Redistributions of source code must retain the above copyright
//    notice, this list of conditions and the following disclaimer.
//
//  * Redistributions in binary form must reproduce the above copyright
//    notice, this list of conditions and the following disclaimer in the
//    documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

#include "__configure__.hpp"
#include <w32/Object.hpp>
#include <w32/types.hpp>
#include <w32.fs/File.hpp>

namespace w32 { namespace mm {

    /*!
     * @ingroup w32-mm
     *
     * @brief Direct file-to-memory mapping.
     *
     * Segment of virtual memory to which is assigned a byte-for-byte
     * correlation with some portion of a file.
     *
     * Memory-mapped files lead to increased I/O performance, especially for
     * smaller files.  For starters, reading from memory is faster than using a
     * system call to read a portion of a file.  Moreover, the mapped region is
     * the kernel's page cache, avoiding a copy of the data in user space.
     */
    class Mapping :
        public Object
    {
        /* nested types. */
    public:
        /*!
         * @brief Enumeration of file mapping modes.
         */
        class Mode
        {
            /* nested types. */
        public:
            /*!
             * @brief Native mapping mode representation.
             */
            typedef ::DWORD Value;

            /* values. */
        public:
            /*! @brief Maps a file into memory as read-only. */
            static Mode i ();

            /*! @brief Maps a file into memory as write-only. */
            static Mode o ();

            /* data. */
        private:
            Value myValue;

            /* construction. */
        private:
            // For inteernal use only.
            Mode ( Value value );

            /* methods. */
        public:
            /*!
             * @return The native representation of the mapping mode.
             */
            Value value () const;

            /* operators. */
        public:
            /*!
             * @return The native representation of the mapping mode.
             */
            operator Value () const;
        };

        class View;

        /* data. */
    private:
        Mode myMode;

        /* construction. */
    public:
        /*!
         * @brief Reserves one or more pages of memory for a file mapping.
         *
         * If @a size is 0, the entire file will be mapped.
         */
        Mapping ( fs::File& file, Mode mode, qword size = 0 );

        /* methods. */
    public:
        Mode mode () const;
    };

    /*!
     * @brief Selection of what portion to map into memory.
     */
    class Mapping::View
    {
        /* nested types. */
    private:
        typedef Reference< void* > Handle;

        /* data. */
    private:
        Handle myHandle;

        /* construction. */
    public:
        /*!
         * @brief Maps a portion of the file to a page of memory.
         * @param mapping File mapping object backing the view.
         * @param offset Offset, in bytes, from the start of the file.
         * @param amount Number of bytes to map. If this is 0, all bytes
         *  starting from @a offset, are mapped into memory.
         *
         * The file mapping actually only reserves an area in memory.  A view
         * of the file maps the contents of the file onto that reserved page.
         */
        View ( Mapping& mapping, qword offset=0, dword amount=0 );

        /* methods. */
    public:
        /*!
         * @brief Obtains the base address for the view.
         */
        void * location ();

        /*!
         * @brief Write to disk to reflect the contents of memory.
         * @param amount Number of bytes, starting from the base of the view,
         *  to commit to disk.
         *
         * No matter the amount to flush, the commit range always starts at the
         * base of the view.  If @a amount is 0 (the default), all of the view
         * is commited.
         */
        void flush ( dword amount = 0 );
    };

} }

#endif /* _w32_mm_Mapping_hpp__ */


text:
static NSTimeInterval _timeoutInterval = 10.0f;
static NSString * const _contentType = @"text/plain";

@implementation BWMRequestCenter

#pragma mark- Private Methods

+ (AFHTTPRequestOperationManager *)p_manager {
    AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
    manager.responseSerializer.acceptableContentTypes = [NSSet setWithObject:_contentType];
    manager.requestSerializer.timeoutInterval = _timeoutInterval;
    return manager;
}

+ (AFHTTPRequestOperation *)p_GET:(NSString *)URLString
                     parameters:(id)parameters
                        success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success
                        failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure {
    return [[self p_manager] GET:URLString parameters:parameters success:success failure:failure];
}

+ (AFHTTPRequestOperation *)p_POST:(NSString *)URLString
                       parameters:(id)parameters
                          success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success
                          failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure {
    return [[self p_manager] POST:URLString parameters:parameters success:success failure:failure];
}

#pragma mark- GET Methods
+ (AFHTTPRequestOperation *)GET:(NSString *)URLString parameters:(NSDictionary *)parameters success:(void (^)(AFHTTPRequestOperation *, id))success failure:(void (^)(AFHTTPRequestOperation *, NSError *))failure {
    return [self p_GET:URLString parameters:parameters success:success failure:failure];
}

#pragma mark- POST Methods

+ (AFHTTPRequestOperation *)POST:(NSString *)URLString parameters:(NSDictionary *)parameters success:(void (^)(AFHTTPRequestOperation *, id))success failure:(void (^)(AFHTTPRequestOperation *, NSError *))failure {
    return [self p_POST:URLString parameters:parameters success:success failure:failure];
}

@end


text:
from ui.BoardField import Ui_BoardField
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtCore import pyqtSignal, pyqtSlot, QObject
from GameSettings import PlayerColor

class BoardField(QtWidgets.QPushButton, Ui_BoardField):
    mouseEnter = pyqtSignal(int)
    mouseLeave = pyqtSignal(int)
    mousePressed = pyqtSignal(int)
    mouseReleased = pyqtSignal(int)

    def __init__(self, parent, field_number, column_number):
        super(BoardField, self).__init__(parent)
        self.field_number = field_number
        self.column_number = column_number
        self.setupUi(self, field_number, column_number)
        self.color = PlayerColor.NoPlayer

    def enterEvent(self, event):
        self.mouseEnter.emit(self.field_number)
        return

    def leaveEvent(self, event):
        self.mouseLeave.emit(self.field_number)
        return

    def mousePressEvent(self, mouseEvent):
        self.mousePressed.emit(self.field_number)
        return

    def mouseReleaseEvent(self, mouseEvent):
        self.mouseReleased.emit(self.field_number)
        return

    def setColor(self, color):
        if color == PlayerColor.Red:
            self.setStyleSheet("background-color: rgba(255, 255, 255, 0);\n"
                               "background-image: url(:/fields/red_field_1.png);")
        elif color == PlayerColor.Yellow:
            self.setStyleSheet("background-color: rgba(255, 255, 255, 0);\n"
                               "background-image: url(:/fields/yellow_field_1.png);")
        else:
            self.setStyleSheet("background-color: rgba(255, 255, 255, 0);\n"
                               "background-image: url(:/fields/empty_field_1.png);")
        self.color = color
        return

    def getColor(self):
        return self.color


text:
module RuboCop
  module Cop
    module Style
      # This cop (by default) checks for uses of the lambda literal syntax for
      # single line lambdas, and the method call syntax for multiline lambdas.
      # It is configurable to enforce one of the styles for both single line
      # and multiline lambdas as well.
      #
      # @example EnforcedStyle: line_count_dependent (default)
      #   # bad
      #   f = lambda { |x| x }
      #   f = ->(x) do
      #         x
      #       end
      #
      #   # good
      #   f = ->(x) { x }
      #   f = lambda do |x|
      #         x
      #       end
      #
      # @example EnforcedStyle: lambda
      #   # bad
      #   f = ->(x) { x }
      #   f = ->(x) do
      #         x
      #       end
      #
      #   # good
      #   f = lambda { |x| x }
      #   f = lambda do |x|
      #         x
      #       end
      #
      # @example EnforcedStyle: literal
      #   # bad
      #   f = lambda { |x| x }
      #   f = lambda do |x|
      #         x
      #       end
      #
      #   # good
      #   f = ->(x) { x }
      #   f = ->(x) do
      #         x
      #       end
      class Lambda < Cop
        include ConfigurableEnforcedStyle

        LITERAL_MESSAGE = 'Use the `-> { ... }` lambda literal syntax for ' \
                          '%<modifier>s lambdas.'.freeze
        METHOD_MESSAGE = 'Use the `lambda` method for %<modifier>s ' \
                         'lambdas.'.freeze

        OFFENDING_SELECTORS = {
          style: {
            lambda: { single_line: '->', multiline: '->' },
            literal: { single_line: 'lambda', multiline: 'lambda' },
            line_count_dependent: { single_line: 'lambda', multiline: '->' }
          }
        }.freeze

        def_node_matcher :lambda_node?, '(block $(send nil? :lambda) ...)'

        def on_block(node)
          return unless node.lambda?

          selector = node.send_node.source

          return unless offending_selector?(node, selector)

          add_offense(node,
                      location: node.send_node.source_range,
                      message: message(node, selector))
        end

        def autocorrect(node)
          if node.send_node.source == 'lambda'
            lambda do |corrector|
              autocorrect_method_to_literal(corrector, node)
            end
          else
            LambdaLiteralToMethodCorrector.new(node)
          end
        end

        private

        def offending_selector?(node, selector)
          lines = node.multiline? ? :multiline : :single_line

          selector == OFFENDING_SELECTORS[:style][style][lines]
        end

        def message(node, selector)
          message = selector == '->' ? METHOD_MESSAGE : LITERAL_MESSAGE

          format(message, modifier: message_line_modifier(node))
        end

        def message_line_modifier(node)
          case style
          when :line_count_dependent
            node.multiline? ? 'multiline' : 'single line'
          else
            'all'
          end
        end

        def autocorrect_method_to_literal(corrector, node)
          block_method, args = *node
          corrector.replace(block_method.source_range, '->')
          return if args.children.empty?

          arg_str = "(#{lambda_arg_string(args)})"
          whitespace_and_old_args = node.loc.begin.end.join(args.loc.end)
          corrector.insert_after(block_method.source_range, arg_str)
          corrector.remove(whitespace_and_old_args)
        end

        def lambda_arg_string(args)
          args.children.map(&:source).join(', ')
        end
      end
    end
  end
end


text:
import pyxb.binding.generate
import pyxb.binding.datatypes as xs
import pyxb.binding.basis
import pyxb.utils.domutils

import os.path
xsd='''
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="iopt" nillable="true" type="xs:integer"/>
</xs:schema>
'''

#file('schema.xsd', 'w').write(xsd)
code = pyxb.binding.generate.GeneratePython(schema_text=xsd)
#file('code.py', 'w').write(code)
#print code

rv = compile(code, 'test', 'exec')
eval(rv)

from pyxb.exceptions_ import *

import unittest

class TestTrac_0058 (unittest.TestCase):
    def testRoundTrip (self):
        xml = '<iopt xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"></iopt>'
        instance = CreateFromDocument(xml)
        self.assertTrue(instance._isNil())
        self.assertEqual(0, instance)
        self.assertEqual('', instance.xsdLiteral())
        self.assertEqual(xml, instance.toxml("utf-8", root_only=True))

if __name__ == '__main__':
    unittest.main()


text:
#include <aws/dms/model/TableToReload.h>
#include <aws/core/utils/json/JsonSerializer.h>

#include <utility>

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

namespace Aws
{
namespace DatabaseMigrationService
{
namespace Model
{

TableToReload::TableToReload() :
    m_schemaNameHasBeenSet(false),
    m_tableNameHasBeenSet(false)
{
}

TableToReload::TableToReload(JsonView jsonValue) :
    m_schemaNameHasBeenSet(false),
    m_tableNameHasBeenSet(false)
{
  *this = jsonValue;
}

TableToReload& TableToReload::operator =(JsonView jsonValue)
{
  if(jsonValue.ValueExists("SchemaName"))
  {
    m_schemaName = jsonValue.GetString("SchemaName");

    m_schemaNameHasBeenSet = true;
  }

  if(jsonValue.ValueExists("TableName"))
  {
    m_tableName = jsonValue.GetString("TableName");

    m_tableNameHasBeenSet = true;
  }

  return *this;
}

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

  if(m_schemaNameHasBeenSet)
  {
   payload.WithString("SchemaName", m_schemaName);

  }

  if(m_tableNameHasBeenSet)
  {
   payload.WithString("TableName", m_tableName);

  }

  return payload;
}

} // namespace Model
} // namespace DatabaseMigrationService
} // namespace Aws


text: export * from './prism.component';


text:
#ifndef _MCL_NANODRIVE_XYSTAGE_H_
#define _MCL_NANODRIVE_XYSTAGE_H_

#pragma once

// MCL headers
#include "Madlib.h"
#include "MCL_NanoDrive.h"

// MM headers
#include "../../MMDevice/ModuleInterface.h"
#include "../../MMDevice/MMDevice.h"
#include "../../MMDevice/DeviceBase.h"

// List/heap headers
#include "device_list.h"
#include "handle_list_if.h"
#include "HandleListType.h"
#include "heap.h"

class MCL_NanoDrive_XYStage : public CXYStageBase<MCL_NanoDrive_XYStage>
{
public:

	MCL_NanoDrive_XYStage();
	~MCL_NanoDrive_XYStage();

	bool Busy();
	void GetName(char* name) const;

	int Initialize();
	int Shutdown();

	// XY Stage API
    virtual double GetStepSize();
    virtual int SetPositionSteps(long x, long y);
    virtual int GetPositionSteps(long &x, long &y);
	virtual int SetRelativePositionUm(double dx, double dy);
    virtual int Home();
    virtual int Stop();
    virtual int SetOrigin();
    virtual int GetLimits(double& lower, double& upper);
    virtual int GetLimitsUm(double& xMin, double& xMax, double& yMin, double& yMax);
	virtual int GetStepLimits(long& xMin, long& xMax, long& yMin, long& yMax);
	virtual double GetStepSizeXUm();
	virtual double GetStepSizeYUm();
	virtual int IsXYStageSequenceable(bool& isSequenceable) const;
	int getHandle(){  return MCLhandle_;}

	// Action interface
	int OnPositionXUm(MM::PropertyBase* pProp, MM::ActionType eAct);
	int OnPositionYUm(MM::PropertyBase* pProp, MM::ActionType eAct);
	int OnSettlingTimeXMs(MM::PropertyBase* pProp, MM::ActionType eAct);
	int OnSettlingTimeYMs(MM::PropertyBase* pProp, MM::ActionType eAct);
	int OnSetOrigin(MM::PropertyBase* pProp, MM::ActionType eAct);
	int OnCommandChangedX(MM::PropertyBase* pProp, MM::ActionType eAct);
    int OnCommandChangedY(MM::PropertyBase* pProp, MM::ActionType eAct);

private:
	int SetDeviceProperties();
	int SetPositionXUm(double x);
	int SetPositionYUm(double y);
	void PauseDevice(int axis);
	int SetPositionUm(double x, double y);
    int GetPositionUm(double& x, double& y);

	bool busy_;
	bool initialized_;
	bool is20Bit_;

	int MCLhandle_;

	double stepSizeX_um_;
	double stepSizeY_um_;

	double xMin_;
	double xMax_;
	double yMin_;
	double yMax_;

	int serialNumber_;
	int settlingTimeX_ms_;
	int settlingTimeY_ms_;

	double curXpos_;
	double curYpos_;

	bool firstWriteX_;
	bool firstWriteY_;

	double commandedX_;
	double commandedY_;
};

#endif // _MCL_NANODRIVE_XYSTAGE_H_


text:
package org.sfs.nodes.compute.container;

import io.vertx.core.Handler;
import io.vertx.core.MultiMap;
import org.sfs.SfsRequest;
import org.sfs.util.SfsHttpQueryParams;

import java.util.Objects;

public class DeleteOrDestroyContainer implements Handler<SfsRequest> {

    public DeleteOrDestroyContainer() {
    }

    @Override
    public void handle(SfsRequest sfsRequest) {
        MultiMap queryParams = sfsRequest.params();
        if (Objects.equals("1", queryParams.get(SfsHttpQueryParams.DESTROY))) {
            DestroyContainer destroyContainer = new DestroyContainer();
            destroyContainer.handle(sfsRequest);
        } else {
            DeleteContainer deleteContainer = new DeleteContainer();
            deleteContainer.handle(sfsRequest);
        }
    }
}


text:
/*
package com.brogrammers.agora.test;

import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;

import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpDelete;
import org.apache.http.impl.client.DefaultHttpClient;

import android.test.ActivityInstrumentationTestCase2;

import com.brogrammers.agora.CacheDataManager;
import com.brogrammers.agora.DeviceUser;
import com.brogrammers.agora.ESDataManager;
import com.brogrammers.agora.MainActivity;
import com.brogrammers.agora.Question;
import com.brogrammers.agora.QuestionController;

import junit.framework.TestCase;

public class OfflineQuestionTest extends ActivityInstrumentationTestCase2<MainActivity>{
	 /*Test if questions can be added if network is down
	 * and tests if the question will be pushed when network comes back
	 *

	public OfflineQuestionTest() {
		super(MainActivity.class);
	}

	protected void setUp() throws Exception {
		super.setUp();
		HttpClient client = new DefaultHttpClient();
		try {
			HttpDelete deleteRequest = new HttpDelete("http://cmput301.softwareprocess.es:8080/cmput301f14t02/agora/_query?q=_type:agora");
			client.execute(deleteRequest);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	protected void tearDown() throws Exception {
		super.tearDown();
	}

	private class TestDeviceUser extends DeviceUser {
		public TestDeviceUser() {
			setUsername("TestBingsF");
			favoritesPrefFileName = "TEST_FAVORITES";
			cachedPrefFileName = "TEST_CACHED";
			authoredPrefFileName = "TEST_AUTHORED";
			usernamePrefFileName = "TEST_USERNAME";
		}
	}

	private class TestCacheManager extends CacheDataManager {
		public TestCacheManager() {
			super("TEST_CACHE");
		}
	}

	private class TestESManager extends ESDataManager {
		public TestESManager() {
			super("http://cmput301.softwareprocess.es:8080/", "cmput301f14t02/", "agora/");
		}
	}

	private class TestController extends QuestionController {
		public TestController(DeviceUser user, CacheDataManager cache, ESDataManager es) {
			super(user, cache, es);
		}
	}

	public void testRemember() throws Throwable {
		final CountDownLatch signal = new CountDownLatch(1);
		final List<ArrayList<Question>> results = new ArrayList<ArrayList<Question>>();
		DeviceUser user = new TestDeviceUser();
		CacheDataManager cache = new TestCacheManager();
		final ESDataManager es = new TestESManager();
		QuestionController controller = new TestController(user, cache, es);

		// create a question
		Long qid = controller.addQuestion("Test Title D", "Test Body D", null);

		// wait for it to be uploaded
				try {
					signal.await(2, TimeUnit.SECONDS);
				} catch (InterruptedException e) {
					assertTrue(false);
				}

		HttpClient client = new DefaultHttpClient();
		try {
			HttpDelete deleteRequest = new HttpDelete("http://cmput301.softwareprocess.es:8080/cmput301f14t02/agora/_query?q=_type:agora");
			client.execute(deleteRequest);
		} catch (Exception e) {
			e.printStackTrace();
		}

		// wait for it to be uploaded
		try {
			signal.await(10, TimeUnit.SECONDS);
		} catch (InterruptedException e) {
			assertTrue(false);
		}

		// check that the question was saved in Authored Questions
		assertTrue(user.getAuthoredQuestionIDs().size() == 1);
		assertTrue(user.getAuthoredQuestionIDs().get(0) == qid);

		// check that the question was pushed to the ES server
		runTestOnUiThread(new Runnable() { public void run() {
				try {
					results.add((ArrayList<Question>)es.getQuestions());
				} catch (UnsupportedEncodingException e) {
					e.printStackTrace();
				}
			}
		});

		// wait for the response
		try {
			signal.await(2, TimeUnit.SECONDS);
		} catch (InterruptedException e) {
			assertTrue(false);
		}

		List<Question> qList = results.get(0);
		assertTrue("List is empty", qList.size() == 1);
		assertTrue("Retrieved Question has wrong body", qList.get(0).getBody().equals("Test Body D"));
		assertTrue("Retrieved Question has wrong ID", qList.get(0).getID().equals(qid));
	}
}*/


text:
'use strict';

module.exports = {
  parseRedisAddress : function parseRedisAddress(address) {
    var url = {
      auth: '',
      hostname: '',
      port: 6379,
      db: 0
    };

    var check = address;
    // check: [auth@]<hostname>[:port][/db]

    // Check the last part for a db number
    var matches = check.match(/\/(\d+)$/);
    if (matches) {
      url.db = Number(matches[1]);
      check = check.slice(0, check.length - matches[0].length);
    } else {
      var newMatches = check.match(/(\/.+)$/);
      if (newMatches) {
        check = check.slice(0, check.length - matches[0].length);
      }
    }

    // check: [auth@]<hostname>[:port]

    // Check the first part for the auth
    var atPosition = check.lastIndexOf('@');
    if (atPosition > 0) {
      url.auth = check.substring(0, atPosition);
      check = check.slice(atPosition + 1);
    }

    // check: <hostname>[:port]

    // Split the rest for hostname and port
    var parts = check.split(':');
    url.hostname = parts[0];

    if (parts.length > 1) {
      var port = Number(parts[1]);
      if (!isNaN(port)) {
        url.port = port;
      }
    }

    return url;
  }
};


text:
/*
 * WT_PAGE_HEADER --
 *	Blocks have a common header, a WT_PAGE_HEADER structure followed by a
 * block-manager specific structure.
 */
struct __wt_page_header {
	/*
	 * The record number of the first record of the page is stored on disk
	 * so we can figure out where the column-store leaf page fits into the
	 * key space during salvage.
	 */
	uint64_t recno;			/* 00-07: column-store starting recno */

	/*
	 * We maintain page write-generations in the non-transactional case
	 * as that's how salvage can determine the most recent page between
	 * pages overlapping the same key range.
	 */
	uint64_t write_gen;		/* 08-15: write generation */

	/*
	 * The page's in-memory size isn't rounded or aligned, it's the actual
	 * number of bytes the disk-image consumes when instantiated in memory.
	 */
	uint32_t mem_size;		/* 16-19: in-memory page size */

	union {
		uint32_t entries;	/* 20-23: number of cells on page */
		uint32_t datalen;	/* 20-23: overflow data length */
	} u;

	uint8_t type;			/* 24: page type */

#define	WT_PAGE_COMPRESSED	0x01	/* Page is compressed on disk */
#define	WT_PAGE_EMPTY_V_ALL	0x02	/* Page has all zero-length values */
#define	WT_PAGE_EMPTY_V_NONE	0x04	/* Page has no zero-length values */
	uint8_t flags;			/* 25: flags */

	/*
	 * End the structure with 2 bytes of padding: it wastes space, but it
	 * leaves the structure 32-bit aligned and having a few bytes to play
	 * with in the future can't hurt.
	 */
	uint8_t unused[2];		/* 26-27: unused padding */
};
/*
 * WT_PAGE_HEADER_SIZE is the number of bytes we allocate for the structure: if
 * the compiler inserts padding it will break the world.
 */
#define	WT_PAGE_HEADER_SIZE		28

/*
 * The block-manager specific information immediately follows the WT_PAGE_HEADER
 * structure.
 */
#define	WT_BLOCK_HEADER_REF(dsk)					\
	((void *)((uint8_t *)(dsk) + WT_PAGE_HEADER_SIZE))

/*
 * WT_PAGE_HEADER_BYTE --
 * WT_PAGE_HEADER_BYTE_SIZE --
 *	The first usable data byte on the block (past the combined headers).
 */
#define	WT_PAGE_HEADER_BYTE_SIZE(btree)					\
	((u_int)(WT_PAGE_HEADER_SIZE + (btree)->block_header))
#define	WT_PAGE_HEADER_BYTE(btree, dsk)					\
	((void *)((uint8_t *)(dsk) + WT_PAGE_HEADER_BYTE_SIZE(btree)))

/*
 * WT_ADDR --
 *	An in-memory structure to hold a block's location.
 */
struct __wt_addr {
	uint8_t *addr;			/* Block-manager's cookie */
	uint8_t  size;			/* Block-manager's cookie length */

#define	WT_ADDR_INT	1		/* Internal page */
#define	WT_ADDR_LEAF	2		/* Leaf page */
#define	WT_ADDR_LEAF_NO	3		/* Leaf page, no overflow */
	uint8_t  type;

	/*
	 * If an address is both as an address for the previous and the current
	 * multi-block reconciliations, that is, a block we're writing matches
	 * the block written the last time, it will appear in both the current
	 * boundary points as well as the page modification's list of previous
	 * blocks.  The reuse flag is how we know that's happening so the block
	 * is treated correctly (not free'd on error, for example).
	 */
	uint8_t	 reuse;
};

/*
 * Overflow tracking for reuse: When a page is reconciled, we write new K/V
 * overflow items.  If pages are reconciled multiple times, we need to know
 * if we've already written a particular overflow record (so we don't write
 * it again), as well as if we've modified an overflow record previously
 * written (in which case we want to write a new record and discard blocks
 * used by the previously written record).  Track overflow records written
 * for the page, storing the values in a skiplist with the record's value as
 * the "key".
 */
struct __wt_ovfl_reuse {
	uint32_t value_offset;		/* Overflow value offset */
	uint32_t value_size;		/* Overflow value size */
	uint8_t  addr_offset;		/* Overflow addr offset */
	uint8_t  addr_size;		/* Overflow addr size */

	/*
	 * On each page reconciliation, we clear the entry's in-use flag, and
	 * reset it as the overflow record is re-used.  After reconciliation
	 * completes, unused skiplist entries are discarded, along with their
	 * underlying blocks.
	 *
	 * On each page reconciliation, set the just-added flag for each new
	 * skiplist entry; if reconciliation fails for any reason, discard the
	 * newly added skiplist entries, along with their underlying blocks.
	 */
#define	WT_OVFL_REUSE_INUSE		0x01
#define	WT_OVFL_REUSE_JUST_ADDED	0x02
	uint8_t	 flags;

	/*
	 * The untyped address immediately follows the WT_OVFL_REUSE structure,
	 * the untyped value immediately follows the address.
	 */
#define	WT_OVFL_REUSE_ADDR(p)						\
	((void *)((uint8_t *)(p) + (p)->addr_offset))
#define	WT_OVFL_REUSE_VALUE(p)						\
	((void *)((uint8_t *)(p) + (p)->value_offset))

	WT_OVFL_REUSE *next[0];		/* Forward-linked skip list */
};

/*
 * Overflow tracking for cached values: When a page is reconciled, we write new
 * K/V overflow items, and discard previous underlying blocks.  If there's a
 * transaction in the system that needs to read the previous value, we have to
 * cache the old value until no running transaction needs it.
 */
struct __wt_ovfl_txnc {
	uint64_t current;		/* Maximum transaction ID at store */

	uint32_t value_offset;		/* Overflow value offset */
	uint32_t value_size;		/* Overflow value size */
	uint8_t  addr_offset;		/* Overflow addr offset */
	uint8_t  addr_size;		/* Overflow addr size */

	/*
	 * The untyped address immediately follows the WT_OVFL_TXNC
	 * structure, the untyped value immediately follows the address.
	 */
#define	WT_OVFL_TXNC_ADDR(p)						\
	((void *)((uint8_t *)(p) + (p)->addr_offset))
#define	WT_OVFL_TXNC_VALUE(p)						\
	((void *)((uint8_t *)(p) + (p)->value_offset))

	WT_OVFL_TXNC *next[0];		/* Forward-linked skip list */
};

/*
 * WT_PAGE_MODIFY --
 *	When a page is modified, there's additional information to maintain.
 */
struct __wt_page_modify {
	/*
	 * Track the highest transaction ID at which the page was written to
	 * disk.  This can be used to avoid trying to write the page multiple
	 * times if a snapshot is keeping old versions pinned (e.g., in a
	 * checkpoint).
	 */
	uint64_t disk_snap_min;

	/* The largest transaction ID seen on the page by reconciliation. */
	uint64_t rec_max_txn;

	/* The first unwritten transaction ID (approximate). */
	uint64_t first_dirty_txn;

	/* The largest update transaction ID (approximate). */
	uint64_t update_txn;

	/* In-memory split transaction ID. */
	uint64_t inmem_split_txn;

	/* Dirty bytes added to the cache. */
	size_t bytes_dirty;

	/*
	 * When pages are reconciled, the result is one or more replacement
	 * blocks.  A replacement block can be in one of two states: it was
	 * written to disk, and so we have a block address, or it contained
	 * unresolved modifications and we have a disk image for it with a
	 * list of those unresolved modifications.  The former is the common
	 * case: we only build lists of unresolved modifications when we're
	 * evicting a page, and we only expect to see unresolved modifications
	 * on a page being evicted in the case of a hot page that's too large
	 * to keep in memory as it is.  In other words, checkpoints will skip
	 * unresolved modifications, and will write the blocks rather than
	 * build lists of unresolved modifications.
	 *
	 * Ugly union/struct layout to conserve memory, we never have both
	 * a replace address and multiple replacement blocks.
	 */
	union {
	WT_ADDR	 replace;		/* Single, written replacement block */
#define	mod_replace	u1.replace

	struct {			/* Multiple replacement blocks */
	struct __wt_multi {
		/*
		 * Block's key: either a column-store record number or a
		 * row-store variable length byte string.
		 */
		union {
			uint64_t recno;
			WT_IKEY *ikey;
		} key;

		/*
		 * Eviction, but block wasn't written: unresolved updates and
		 * associated disk image.
		 *
		 * Skipped updates are either a WT_INSERT, or a row-store leaf
		 * page entry.
		 */
		struct __wt_upd_skipped {
			WT_INSERT *ins;
			WT_ROW	  *rip;
		} *skip;
		uint32_t skip_entries;
		void	*skip_dsk;

		/*
		 * Block was written: address, size and checksum.
		 * On subsequent reconciliations of this page, we avoid writing
		 * the block if it's unchanged by comparing size and checksum;
		 * the reuse flag is set when the block is unchanged and we're
		 * reusing a previous address.
		 */
		WT_ADDR	 addr;
		uint32_t size;
		uint32_t cksum;
	} *multi;
	uint32_t multi_entries;		/* Multiple blocks element count */
	} m;
#define	mod_multi		u1.m.multi
#define	mod_multi_entries	u1.m.multi_entries
	} u1;

	/*
	 * Internal pages need to be able to chain root-page splits and have a
	 * special transactional eviction requirement.  Column-store leaf pages
	 * need update and append lists.
	 *
	 * Ugly union/struct layout to conserve memory, a page is either a leaf
	 * page or an internal page.
	 */
	union {
	struct {
		/*
		 * When a root page splits, we create a new page and write it;
		 * the new page can also split and so on, and we continue this
		 * process until we write a single replacement root page.  We
		 * use the root split field to track the list of created pages
		 * so they can be discarded when no longer needed.
		 */
		WT_PAGE *root_split;	/* Linked list of root split pages */

		/*
		 * When we deepen the tree, newly created internal pages cannot
		 * be evicted until all threads have exited the original page
		 * index structure.  We set a transaction value during the split
		 * that's checked during eviction.
		 */
		uint64_t split_txn;	/* Split eviction transaction value */
	} intl;
#define	mod_root_split		u2.intl.root_split
#define	mod_split_txn		u2.intl.split_txn
	struct {
		/*
		 * Appended items to column-stores: there is only a single one
		 * of these per column-store tree.
		 */
		WT_INSERT_HEAD **append;

		/*
		 * Updated items in column-stores: variable-length RLE entries
		 * can expand to multiple entries which requires some kind of
		 * list we can expand on demand.  Updated items in fixed-length
		 * files could be done based on an WT_UPDATE array as in
		 * row-stores, but there can be a very large number of bits on
		 * a single page, and the cost of the WT_UPDATE array would be
		 * huge.
		 */
		WT_INSERT_HEAD **update;
	} leaf;
#define	mod_append		u2.leaf.append
#define	mod_update		u2.leaf.update
	} u2;

	/*
	 * Overflow record tracking for reconciliation.  We assume overflow
	 * records are relatively rare, so we don't allocate the structures
	 * to track them until we actually see them in the data.
	 */
	struct __wt_ovfl_track {
		/*
		 * Overflow key/value address/byte-string pairs we potentially
		 * reuse each time we reconcile the page.
		 */
		WT_OVFL_REUSE	*ovfl_reuse[WT_SKIP_MAXDEPTH];

		/*
		 * Overflow value address/byte-string pairs cached until no
		 * running transaction will possibly read them.
		 */
		WT_OVFL_TXNC	*ovfl_txnc[WT_SKIP_MAXDEPTH];

		/*
		 * Overflow key/value addresses to be discarded from the block
		 * manager after reconciliation completes successfully.
		 */
		WT_CELL **discard;
		size_t	  discard_entries;
		size_t	  discard_allocated;
	} *ovfl_track;

	/*
	 * The write generation is incremented when a page is modified, a page
	 * is clean if the write generation is 0.
	 *
	 * !!!
	 * 4B values are probably larger than required, but I'm more confident
	 * 4B types will always be backed by atomic writes to memory.
	 */
	uint32_t write_gen;

#define	WT_PAGE_LOCK(s, p)						\
	__wt_spin_lock((s), &S2C(s)->page_lock[(p)->modify->page_lock])
#define	WT_PAGE_UNLOCK(s, p)						\
	__wt_spin_unlock((s), &S2C(s)->page_lock[(p)->modify->page_lock])
	uint8_t page_lock;		/* Page's spinlock */

#define	WT_PM_REC_EMPTY		0x01	/* Reconciliation: no replacement */
#define	WT_PM_REC_MULTIBLOCK	0x02	/* Reconciliation: multiple blocks */
#define	WT_PM_REC_REPLACE	0x04	/* Reconciliation: single block */
#define	WT_PM_REC_MASK							\
	(WT_PM_REC_EMPTY | WT_PM_REC_MULTIBLOCK | WT_PM_REC_REPLACE)
	uint8_t flags;			/* Page flags */
};

/*
 * WT_PAGE --
 * The WT_PAGE structure describes the in-memory page information.
 */
struct __wt_page {
	/* Per page-type information. */
	union {
		/*
		 * Internal pages (both column- and row-store).
		 *
		 * The page record number is only used by column-store, but it
		 * makes some things simpler and it doesn't cost us any memory,
		 * other structures in this union are still as large.
		 *
		 * In-memory internal pages have an array of pointers to child
		 * structures, maintained in collated order.  When a page is
		 * read into memory, the initial list of children is stored in
		 * the "orig_index" field, and it and the collated order are
		 * the same.  After a page splits, the collated order and the
		 * original order will differ.
		 *
		 * Multiple threads of control may be searching the in-memory
		 * internal page and a child page of the internal page may
		 * cause a split at any time.  When a page splits, a new array
		 * is allocated and atomically swapped into place.  Threads in
		 * the old array continue without interruption (the old array is
		 * still valid), but have to avoid racing.  No barrier is needed
		 * because the array reference is updated atomically, but code
		 * reading the fields multiple times would be a very bad idea.
		 * Specifically, do not do this:
		 *	WT_REF **refp = page->u.intl__index->index;
		 *	uint32_t entries = page->u.intl__index->entries;
		 *
		 * The field is declared volatile (so the compiler knows not to
		 * read it multiple times), and we obscure the field name and
		 * use a copy macro in all references to the field (so the code
		 * doesn't read it multiple times).
		 */
		struct {
			uint64_t recno;		/* Starting recno */
			WT_REF	*parent_ref;	/* Parent reference */

			struct __wt_page_index {
				uint32_t entries;
				WT_REF	**index;
			} * volatile __index;	/* Collated children */
		} intl;
#undef	pg_intl_recno
#define	pg_intl_recno			u.intl.recno
#define	pg_intl_parent_ref		u.intl.parent_ref

	/*
	 * Macros to copy/set the index because the name is obscured to ensure
	 * the field isn't read multiple times.
	 */
#define	WT_INTL_INDEX_COPY(page)	((page)->u.intl.__index)
#define	WT_INTL_INDEX_SET(page, v) do {					\
	WT_WRITE_BARRIER();						\
	((page)->u.intl.__index) = (v);					\
} while (0)

	/*
	 * Macro to walk the list of references in an internal page.
	 * Two flavors: by default, check that we have a split_gen, but
	 * provide a "SAFE" version for code that can safely read the
	 * page index without a split_gen.
	 */
#define	WT_INTL_FOREACH_BEGIN_SAFE(session, page, ref) do {		\
	WT_PAGE_INDEX *__pindex;					\
	WT_REF **__refp;						\
	uint32_t __entries;						\
	for (__pindex = WT_INTL_INDEX_COPY(page),			\
	    __refp = __pindex->index,					\
	    __entries = __pindex->entries; __entries > 0; --__entries) {\
		(ref) = *__refp++;
#define	WT_INTL_FOREACH_BEGIN(session, page, ref)			\
	WT_ASSERT(session, session->split_gen != 0);			\
	WT_INTL_FOREACH_BEGIN_SAFE(session, page, ref)
#define	WT_INTL_FOREACH_END						\
	}								\
} while (0)

		/* Row-store leaf page. */
		struct {
			/*
			 * The column-store leaf page modification structures
			 * live in the WT_PAGE_MODIFY structure to keep the
			 * WT_PAGE structure as small as possible for read-only
			 * pages.  For consistency, we could move the row-store
			 * modification structures into WT_PAGE_MODIFY too, but
			 * that doesn't shrink WT_PAGE any further and it would
			 * require really ugly naming inside of WT_PAGE_MODIFY
			 * to avoid growing that structure.
			 */
			WT_INSERT_HEAD	**ins;	/* Inserts */
			WT_UPDATE	**upd;	/* Updates */

			WT_ROW *d;		/* Key/value pairs */
			uint32_t entries;	/* Entries */
		} row;
#undef	pg_row_d
#define	pg_row_d	u.row.d
#undef	pg_row_ins
#define	pg_row_ins	u.row.ins
#undef	pg_row_upd
#define	pg_row_upd	u.row.upd
#define	pg_row_entries	u.row.entries
#define	pg_row_entries	u.row.entries

		/* Fixed-length column-store leaf page. */
		struct {
			uint64_t recno;		/* Starting recno */

			uint8_t	*bitf;		/* Values */
			uint32_t entries;	/* Entries */
		} col_fix;
#undef	pg_fix_recno
#define	pg_fix_recno	u.col_fix.recno
#undef	pg_fix_bitf
#define	pg_fix_bitf	u.col_fix.bitf
#undef	pg_fix_entries
#define	pg_fix_entries	u.col_fix.entries

		/* Variable-length column-store leaf page. */
		struct {
			uint64_t recno;		/* Starting recno */

			WT_COL *d;		/* Values */

			/*
			 * Variable-length column-store files maintain a list of
			 * RLE entries on the page so it's unnecessary to walk
			 * the page counting records to find a specific entry.
			 */
			WT_COL_RLE *repeats;	/* RLE array for lookups */
			uint32_t    nrepeats;	/* Number of repeat slots */

			uint32_t    entries;	/* Entries */
		} col_var;
#undef	pg_var_recno
#define	pg_var_recno	u.col_var.recno
#undef	pg_var_d
#define	pg_var_d	u.col_var.d
#undef	pg_var_repeats
#define	pg_var_repeats	u.col_var.repeats
#undef	pg_var_nrepeats
#define	pg_var_nrepeats	u.col_var.nrepeats
#undef	pg_var_entries
#define	pg_var_entries	u.col_var.entries
	} u;

	/*
	 * The page's type and flags are positioned at the end of the WT_PAGE
	 * union, it reduces cache misses in the row-store search function.
	 */
#define	WT_PAGE_IS_INTERNAL(page)					\
	((page)->type == WT_PAGE_COL_INT || (page)->type == WT_PAGE_ROW_INT)
#define	WT_PAGE_INVALID		0	/* Invalid page */
#define	WT_PAGE_BLOCK_MANAGER	1	/* Block-manager page */
#define	WT_PAGE_COL_FIX		2	/* Col-store fixed-len leaf */
#define	WT_PAGE_COL_INT		3	/* Col-store internal page */
#define	WT_PAGE_COL_VAR		4	/* Col-store var-length leaf page */
#define	WT_PAGE_OVFL		5	/* Overflow page */
#define	WT_PAGE_ROW_INT		6	/* Row-store internal page */
#define	WT_PAGE_ROW_LEAF	7	/* Row-store leaf page */
	uint8_t type;			/* Page type */

#define	WT_PAGE_BUILD_KEYS	0x01	/* Keys have been built in memory */
#define	WT_PAGE_DISK_ALLOC	0x02	/* Disk image in allocated memory */
#define	WT_PAGE_DISK_MAPPED	0x04	/* Disk image in mapped memory */
#define	WT_PAGE_EVICT_LRU	0x08	/* Page is on the LRU queue */
#define	WT_PAGE_REFUSE_DEEPEN	0x10	/* Don't deepen the tree at this page */
#define	WT_PAGE_SCANNING	0x20	/* Obsolete updates are being scanned */
#define	WT_PAGE_SPLIT_INSERT	0x40	/* A leaf page was split for append */
#define	WT_PAGE_SPLITTING	0x80	/* An internal page is growing */
	uint8_t flags_atomic;		/* Atomic flags, use F_*_ATOMIC */

	/*
	 * The page's read generation acts as an LRU value for each page in the
	 * tree; it is used by the eviction server thread to select pages to be
	 * discarded from the in-memory tree.
	 *
	 * The read generation is a 64-bit value, if incremented frequently, a
	 * 32-bit value could overflow.
	 *
	 * The read generation is a piece of shared memory potentially read
	 * by many threads.  We don't want to update page read generations for
	 * in-cache workloads and suffer the cache misses, so we don't simply
	 * increment the read generation value on every access.  Instead, the
	 * read generation is incremented by the eviction server each time it
	 * becomes active.  To avoid incrementing a page's read generation too
	 * frequently, it is set to a future point.
	 */
#define	WT_READGEN_NOTSET	0
#define	WT_READGEN_OLDEST	1
#define	WT_READGEN_STEP		100
	uint64_t read_gen;

	size_t memory_footprint;	/* Memory attached to the page */

	/* Page's on-disk representation: NULL for pages created in memory. */
	const WT_PAGE_HEADER *dsk;

	/* If/when the page is modified, we need lots more information. */
	WT_PAGE_MODIFY *modify;
};

/*
 * WT_PAGE_DISK_OFFSET, WT_PAGE_REF_OFFSET --
 *	Return the offset/pointer of a pointer/offset in a page disk image.
 */
#define	WT_PAGE_DISK_OFFSET(page, p)					\
	WT_PTRDIFF32(p, (page)->dsk)
#define	WT_PAGE_REF_OFFSET(page, o)					\
	((void *)((uint8_t *)((page)->dsk) + (o)))

/*
 * Page state.
 *
 * Synchronization is based on the WT_REF->state field, which has a number of
 * possible states:
 *
 * WT_REF_DISK:
 *	The initial setting before a page is brought into memory, and set as a
 *	result of page eviction; the page is on disk, and must be read into
 *	memory before use.  WT_REF_DISK has a value of 0 (the default state
 *	after allocating cleared memory).
 *
 * WT_REF_DELETED:
 *	The page is on disk, but has been deleted from the tree; we can delete
 *	row-store leaf pages without reading them if they don't reference
 *	overflow items.
 *
 * WT_REF_LOCKED:
 *	Locked for exclusive access.  In eviction, this page or a parent has
 *	been selected for eviction; once hazard pointers are checked, the page
 *	will be evicted.  When reading a page that was previously deleted, it
 *	is locked until the page is in memory with records marked deleted.  The
 *	thread that set the page to WT_REF_LOCKED has exclusive access, no
 *	other thread may use the WT_REF until the state is changed.
 *
 * WT_REF_MEM:
 *	Set by a reading thread once the page has been read from disk; the page
 *	is in the cache and the page reference is OK.
 *
 * WT_REF_READING:
 *	Set by a reading thread before reading an ordinary page from disk;
 *	other readers of the page wait until the read completes.  Sync can
 *	safely skip over such pages: they are clean by definition.
 *
 * WT_REF_SPLIT:
 *	Set when the page is split; the WT_REF is dead and can no longer be
 *	used.
 *
 * The life cycle of a typical page goes like this: pages are read into memory
 * from disk and their state set to WT_REF_MEM.  When the page is selected for
 * eviction, the page state is set to WT_REF_LOCKED.  In all cases, evicting
 * threads reset the page's state when finished with the page: if eviction was
 * successful (a clean page was discarded, and a dirty page was written to disk
 * and then discarded), the page state is set to WT_REF_DISK; if eviction failed
 * because the page was busy, page state is reset to WT_REF_MEM.
 *
 * Readers check the state field and if it's WT_REF_MEM, they set a hazard
 * pointer to the page, flush memory and re-confirm the page state.  If the
 * page state is unchanged, the reader has a valid reference and can proceed.
 *
 * When an evicting thread wants to discard a page from the tree, it sets the
 * WT_REF_LOCKED state, flushes memory, then checks hazard pointers.  If a
 * hazard pointer is found, state is reset to WT_REF_MEM, restoring the page
 * to the readers.  If the evicting thread does not find a hazard pointer,
 * the page is evicted.
 */
typedef enum __wt_page_state {
	WT_REF_DISK=0,			/* Page is on disk */
	WT_REF_DELETED,			/* Page is on disk, but deleted */
	WT_REF_LOCKED,			/* Page locked for exclusive access */
	WT_REF_MEM,			/* Page is in cache and valid */
	WT_REF_READING,			/* Page being read */
	WT_REF_SPLIT			/* Page was split */
} WT_PAGE_STATE;

/*
 * WT_PAGE_DELETED --
 *	Related information for fast-delete, on-disk pages.
 */
struct __wt_page_deleted {
	uint64_t txnid;			/* Transaction ID */

	WT_UPDATE **update_list;	/* List of updates for abort */
};

/*
 * WT_REF --
 *	A single in-memory page and the state information used to determine if
 * it's OK to dereference the pointer to the page.
 */
struct __wt_ref {
	WT_PAGE *page;			/* Page */

	/*
	 * When the tree deepens as a result of a split, the home page value
	 * changes.  Don't cache it, we need to see that change when looking
	 * up our slot in the page's index structure.
	 */
	WT_PAGE * volatile home;	/* Reference page */
	uint32_t ref_hint;		/* Reference page index hint */

	volatile WT_PAGE_STATE state;	/* Page state */

	/*
	 * Address: on-page cell if read from backing block, off-page WT_ADDR
	 * if instantiated in-memory, or NULL if page created in-memory.
	 */
	void	*addr;

	/*
	 * The child page's key.  Do NOT change this union without reviewing
	 * __wt_ref_key.
	 */
	union {
		uint64_t recno;		/* Column-store: starting recno */
		void	*ikey;		/* Row-store: key */
	} key;

	WT_PAGE_DELETED	*page_del;	/* Deleted on-disk page information */
};
/*
 * WT_REF_SIZE is the expected structure size -- we verify the build to ensure
 * the compiler hasn't inserted padding which would break the world.
 */
#define	WT_REF_SIZE	48

/*
 * WT_ROW --
 * Each in-memory page row-store leaf page has an array of WT_ROW structures:
 * this is created from on-page data when a page is read from the file.  It's
 * sorted by key, fixed in size, and starts with a reference to on-page data.
 *
 * Multiple threads of control may be searching the in-memory row-store pages,
 * and the key may be instantiated at any time.  Code must be able to handle
 * both when the key has not been instantiated (the key field points into the
 * page's disk image), and when the key has been instantiated (the key field
 * points outside the page's disk image).  We don't need barriers because the
 * key is updated atomically, but code that reads the key field multiple times
 * is a very, very bad idea.  Specifically, do not do this:
 *
 *	key = rip->key;
 *	if (key_is_on_page(key)) {
 *		cell = rip->key;
 *	}
 *
 * The field is declared volatile (so the compiler knows it shouldn't read it
 * multiple times), and we obscure the field name and use a copy macro in all
 * references to the field (so the code doesn't read it multiple times), all
 * to make sure we don't introduce this bug (again).
 */
struct __wt_row {	/* On-page key, on-page cell, or off-page WT_IKEY */
	void * volatile __key;
};
#define	WT_ROW_KEY_COPY(rip)	((rip)->__key)
#define	WT_ROW_KEY_SET(rip, v)	((rip)->__key) = (void *)(v)

/*
 * WT_ROW_FOREACH --
 *	Walk the entries of an in-memory row-store leaf page.
 */
#define	WT_ROW_FOREACH(page, rip, i)					\
	for ((i) = (page)->pg_row_entries,				\
	    (rip) = (page)->pg_row_d; (i) > 0; ++(rip), --(i))
#define	WT_ROW_FOREACH_REVERSE(page, rip, i)				\
	for ((i) = (page)->pg_row_entries,				\
	    (rip) = (page)->pg_row_d + ((page)->pg_row_entries - 1);	\
	    (i) > 0; --(rip), --(i))

/*
 * WT_ROW_SLOT --
 *	Return the 0-based array offset based on a WT_ROW reference.
 */
#define	WT_ROW_SLOT(page, rip)						\
	((uint32_t)(((WT_ROW *)(rip)) - (page)->pg_row_d))

/*
 * WT_COL --
 * Each in-memory variable-length column-store leaf page has an array of WT_COL
 * structures: this is created from on-page data when a page is read from the
 * file.  It's fixed in size, and references data on the page.
 */
struct __wt_col {
	/*
	 * Variable-length column-store data references are page offsets, not
	 * pointers (we boldly re-invent short pointers).  The trade-off is 4B
	 * per K/V pair on a 64-bit machine vs. a single cycle for the addition
	 * of a base pointer.  The on-page data is a WT_CELL (same as row-store
	 * pages).
	 *
	 * If the value is 0, it's a single, deleted record.
	 *
	 * Obscure the field name, code shouldn't use WT_COL->__col_value, the
	 * public interface is WT_COL_PTR and WT_COL_PTR_SET.
	 */
	uint32_t __col_value;
};

/*
 * WT_COL_RLE --
 * In variable-length column store leaf pages, we build an array of entries
 * with RLE counts greater than 1 when reading the page.  We can do a binary
 * search in this array, then an offset calculation to find the cell.
 */
WT_PACKED_STRUCT_BEGIN(__wt_col_rle)
	uint64_t recno;			/* Record number of first repeat. */
	uint64_t rle;			/* Repeat count. */
	uint32_t indx;			/* Slot of entry in col_var.d */
WT_PACKED_STRUCT_END

/*
 * WT_COL_PTR, WT_COL_PTR_SET --
 *	Return/Set a pointer corresponding to the data offset. (If the item does
 * not exist on the page, return a NULL.)
 */
#define	WT_COL_PTR(page, cip)						\
	((cip)->__col_value == 0 ?					\
	    NULL : WT_PAGE_REF_OFFSET(page, (cip)->__col_value))
#define	WT_COL_PTR_SET(cip, value)					\
	(cip)->__col_value = (value)

/*
 * WT_COL_FOREACH --
 *	Walk the entries of variable-length column-store leaf page.
 */
#define	WT_COL_FOREACH(page, cip, i)					\
	for ((i) = (page)->pg_var_entries,				\
	    (cip) = (page)->pg_var_d; (i) > 0; ++(cip), --(i))

/*
 * WT_COL_SLOT --
 *	Return the 0-based array offset based on a WT_COL reference.
 */
#define	WT_COL_SLOT(page, cip)						\
	((uint32_t)(((WT_COL *)cip) - (page)->pg_var_d))

/*
 * WT_IKEY --
 * Instantiated key: row-store keys are usually prefix compressed and sometimes
 * Huffman encoded or overflow objects.  Normally, a row-store page in-memory
 * key points to the on-page WT_CELL, but in some cases, we instantiate the key
 * in memory, in which case the row-store page in-memory key points to a WT_IKEY
 * structure.
 */
struct __wt_ikey {
	uint32_t size;			/* Key length */

	/*
	 * If we no longer point to the key's on-page WT_CELL, we can't find its
	 * related value.  Save the offset of the key cell in the page.
	 *
	 * Row-store cell references are page offsets, not pointers (we boldly
	 * re-invent short pointers).  The trade-off is 4B per K/V pair on a
	 * 64-bit machine vs. a single cycle for the addition of a base pointer.
	 */
	uint32_t  cell_offset;

	/* The key bytes immediately follow the WT_IKEY structure. */
#define	WT_IKEY_DATA(ikey)						\
	((void *)((uint8_t *)(ikey) + sizeof(WT_IKEY)))
};

/*
 * WT_UPDATE --
 * Entries on leaf pages can be updated, either modified or deleted.  Updates
 * to entries referenced from the WT_ROW and WT_COL arrays are stored in the
 * page's WT_UPDATE array.  When the first element on a page is updated, the
 * WT_UPDATE array is allocated, with one slot for every existing element in
 * the page.  A slot points to a WT_UPDATE structure; if more than one update
 * is done for an entry, WT_UPDATE structures are formed into a forward-linked
 * list.
 */
WT_PACKED_STRUCT_BEGIN(__wt_update)
	uint64_t txnid;			/* update transaction */

	WT_UPDATE *next;		/* forward-linked list */

	/*
	 * We use the maximum size as an is-deleted flag, which means we can't
	 * store 4GB objects; I'd rather do that than increase the size of this
	 * structure for a flag bit.
	 */
#define	WT_UPDATE_DELETED_ISSET(upd)	((upd)->size == UINT32_MAX)
#define	WT_UPDATE_DELETED_SET(upd)	((upd)->size = UINT32_MAX)
#define	WT_UPDATE_MEMSIZE(upd)						\
	(sizeof(WT_UPDATE) + (WT_UPDATE_DELETED_ISSET(upd) ? 0 : (upd)->size))
	uint32_t size;			/* update length */

	/* The untyped value immediately follows the WT_UPDATE structure. */
#define	WT_UPDATE_DATA(upd)						\
	((void *)((uint8_t *)(upd) + sizeof(WT_UPDATE)))
};

/*
 * WT_INSERT --
 *
 * Row-store leaf pages support inserts of new K/V pairs.  When the first K/V
 * pair is inserted, the WT_INSERT_HEAD array is allocated, with one slot for
 * every existing element in the page, plus one additional slot.  A slot points
 * to a WT_INSERT_HEAD structure for the items which sort after the WT_ROW
 * element that references it and before the subsequent WT_ROW element; the
 * skiplist structure has a randomly chosen depth of next pointers in each
 * inserted node.
 *
 * The additional slot is because it's possible to insert items smaller than any
 * existing key on the page: for that reason, the first slot of the insert array
 * holds keys smaller than any other key on the page.
 *
 * In column-store variable-length run-length encoded pages, a single indx
 * entry may reference a large number of records, because there's a single
 * on-page entry representing many identical records.   (We don't expand those
 * entries when the page comes into memory, as that would require resources as
 * pages are moved to/from the cache, including read-only files.)  Instead, a
 * single indx entry represents all of the identical records originally found
 * on the page.
 *
 * Modifying (or deleting) run-length encoded column-store records is hard
 * because the page's entry no longer references a set of identical items.  We
 * handle this by "inserting" a new entry into the insert array, with its own
 * record number.  (This is the only case where it's possible to insert into a
 * column-store: only appends are allowed, as insert requires re-numbering
 * subsequent records.  Berkeley DB did support mutable records, but it won't
 * scale and it isn't useful enough to re-implement, IMNSHO.)
 */
struct __wt_insert {
	WT_UPDATE *upd;				/* value */

	union {
		uint64_t recno;			/* column-store record number */
		struct {
			uint32_t offset;	/* row-store key data start */
			uint32_t size;		/* row-store key data size */
		} key;
	} u;

#define	WT_INSERT_KEY_SIZE(ins) (((WT_INSERT *)ins)->u.key.size)
#define	WT_INSERT_KEY(ins)						\
	((void *)((uint8_t *)(ins) + ((WT_INSERT *)ins)->u.key.offset))
#define	WT_INSERT_RECNO(ins)	(((WT_INSERT *)ins)->u.recno)

	WT_INSERT *next[0];			/* forward-linked skip list */
};

/*
 * Skiplist helper macros.
 */
#define	WT_SKIP_FIRST(ins_head)						\
	(((ins_head) == NULL) ? NULL : ((WT_INSERT_HEAD *)ins_head)->head[0])
#define	WT_SKIP_LAST(ins_head)						\
	(((ins_head) == NULL) ? NULL : ((WT_INSERT_HEAD *)ins_head)->tail[0])
#define	WT_SKIP_NEXT(ins)  ((ins)->next[0])
#define	WT_SKIP_FOREACH(ins, ins_head)					\
	for ((ins) = WT_SKIP_FIRST(ins_head);				\
	    (ins) != NULL;						\
	    (ins) = WT_SKIP_NEXT(ins))

/*
 * Atomically allocate and swap a structure or array into place.
 */
#define	WT_PAGE_ALLOC_AND_SWAP(s, page, dest, v, count)	do {		\
	if (((v) = (dest)) == NULL) {					\
		WT_ERR(__wt_calloc_def(s, count, &(v)));		\
		if (WT_ATOMIC_CAS8(dest, NULL, v))			\
			__wt_cache_page_inmem_incr(			\
			    s, page, (count) * sizeof(*(v)));		\
		else							\
			__wt_free(s, v);				\
	}								\
} while (0)

/*
 * WT_INSERT_HEAD --
 * 	The head of a skiplist of WT_INSERT items.
 */
struct __wt_insert_head {
	WT_INSERT *head[WT_SKIP_MAXDEPTH];	/* first item on skiplists */
	WT_INSERT *tail[WT_SKIP_MAXDEPTH];	/* last item on skiplists */
};

/*
 * The row-store leaf page insert lists are arrays of pointers to structures,
 * and may not exist.  The following macros return an array entry if the array
 * of pointers and the specific structure exist, else NULL.
 */
#define	WT_ROW_INSERT_SLOT(page, slot)					\
	((page)->pg_row_ins == NULL ? NULL : (page)->pg_row_ins[slot])
#define	WT_ROW_INSERT(page, ip)						\
	WT_ROW_INSERT_SLOT(page, WT_ROW_SLOT(page, ip))
#define	WT_ROW_UPDATE(page, ip)						\
	((page)->pg_row_upd == NULL ?					\
	    NULL : (page)->pg_row_upd[WT_ROW_SLOT(page, ip)])
/*
 * WT_ROW_INSERT_SMALLEST references an additional slot past the end of the
 * the "one per WT_ROW slot" insert array.  That's because the insert array
 * requires an extra slot to hold keys that sort before any key found on the
 * original page.
 */
#define	WT_ROW_INSERT_SMALLEST(page)					\
	((page)->pg_row_ins == NULL ?					\
	    NULL : (page)->pg_row_ins[(page)->pg_row_entries])

/*
 * The column-store leaf page update lists are arrays of pointers to structures,
 * and may not exist.  The following macros return an array entry if the array
 * of pointers and the specific structure exist, else NULL.
 */
#define	WT_COL_UPDATE_SLOT(page, slot)					\
	((page)->modify == NULL || (page)->modify->mod_update == NULL ?	\
	    NULL : (page)->modify->mod_update[slot])
#define	WT_COL_UPDATE(page, ip)						\
	WT_COL_UPDATE_SLOT(page, WT_COL_SLOT(page, ip))

/*
 * WT_COL_UPDATE_SINGLE is a single WT_INSERT list, used for any fixed-length
 * column-store updates for a page.
 */
#define	WT_COL_UPDATE_SINGLE(page)					\
	WT_COL_UPDATE_SLOT(page, 0)

/*
 * WT_COL_APPEND is an WT_INSERT list, used for fixed- and variable-length
 * appends.
 */
#define	WT_COL_APPEND(page)						\
	((page)->modify != NULL && (page)->modify->mod_append != NULL ?	\
	    (page)->modify->mod_append[0] : NULL)

/* WT_FIX_FOREACH walks fixed-length bit-fields on a disk page. */
#define	WT_FIX_FOREACH(btree, dsk, v, i)				\
	for ((i) = 0,							\
	    (v) = (i) < (dsk)->u.entries ?				\
	    __bit_getv(							\
	    WT_PAGE_HEADER_BYTE(btree, dsk), 0, (btree)->bitcnt) : 0;	\
	    (i) < (dsk)->u.entries; ++(i),				\
	    (v) = __bit_getv(						\
	    WT_PAGE_HEADER_BYTE(btree, dsk), i, (btree)->bitcnt))

/*
 * Manage split generation numbers.  Splits walk the list of sessions to check
 * when it is safe to free structures that have been replaced.  We also check
 * that list periodically (e.g., when wrapping up a transaction) to free any
 * memory we can.
 *
 * Before a thread enters code that will examine page indexes (which are
 * swapped out by splits), it publishes a copy of the current split generation
 * into its session.  Don't assume that threads never re-enter this code: if we
 * already have a split generation, leave it alone.  If our caller is examining
 * an index, we don't want the oldest split generation to move forward and
 * potentially free it.
 *
 * Check that we haven't raced with a split_gen update after publishing: we
 * rely on the published value not being missed when scanning for the oldest
 * active split_gen.
 */
#define	WT_ENTER_PAGE_INDEX(session) do {				\
	uint64_t __prev_split_gen = (session)->split_gen;		\
	if (__prev_split_gen == 0)					\
		do {                                                    \
			WT_PUBLISH((session)->split_gen,                \
			    S2C(session)->split_gen);                   \
		} while ((session)->split_gen != S2C(session)->split_gen)

#define	WT_LEAVE_PAGE_INDEX(session)					\
	if (__prev_split_gen == 0)					\
		(session)->split_gen = 0;				\
	} while (0)

#define	WT_WITH_PAGE_INDEX(session, e)					\
	WT_ENTER_PAGE_INDEX(session);					\
	(e);								\
	WT_LEAVE_PAGE_INDEX(session)


text:
package edu.mines.jtk.sgl;

import org.testng.annotations.Test;

import java.util.Random;

import static edu.mines.jtk.util.MathPlus.DBL_EPSILON;
import static org.junit.Assert.assertEquals;

/**
 * Tests classes for matrix, point, and vector math.
 * @author Dave Hale
 * @version 2005.05.20
 */
public class MatrixPointVectorTest {

  @Test
  public void testMatrix() {
    int ntrial = 10;
    for (int itrial=0; itrial<ntrial; ++itrial) {
      Matrix44 i = Matrix44.identity();
      Matrix44 a = randomMatrix44();

      Matrix44 at = a.transpose();
      assertMatrix44Equals(a,at.transpose());

      Matrix44 ai = a.inverse();
      assertMatrix44Equals(a,ai.inverse());

      assertMatrix44Equals(i,a.times(ai));
      assertMatrix44Equals(i,a.transpose().timesTranspose(ai));
      assertMatrix44Equals(i,a.transposeTimes(ai.transpose()));

      Matrix44 ac = new Matrix44(a);
      assertMatrix44Equals(i,ac.timesEquals(ai));
      ac = new Matrix44(a);
      assertMatrix44Equals(i,ac.transposeEquals().timesTranspose(ai));
      ac = new Matrix44(a);
      assertMatrix44Equals(i,ac.transposeTimesEquals(ai.transpose()));
    }
  }

  @Test
  public void testVector() {
    int ntrial = 10;
    for (int itrial=0; itrial<ntrial; ++itrial) {
      Vector3 u = randomVector3();
      Vector3 v = randomVector3();
      Vector3 vc = new Vector3(v);
      assertTuple3Equals(v,v.negate().negate());
      assertTuple3Equals(v,vc.negateEquals().negateEquals());
      assertEquals(1.0,v.normalize().length(),TOLERANCE);
      assertEquals(1.0,vc.normalizeEquals().length(),TOLERANCE);
      assertEquals(1.0,v.normalize().lengthSquared(),TOLERANCE);
      assertEquals(v.dot(v),v.lengthSquared(),TOLERANCE);
      assertEquals(0.0,u.cross(v).dot(u),TOLERANCE);
      assertEquals(0.0,u.cross(v).dot(v),TOLERANCE);
    }
  }

  @Test
  public void testPoint() {
    int ntrial = 10;
    for (int itrial=0; itrial<ntrial; ++itrial) {
      Point3 p = randomPoint3();
      Point3 pc = new Point3(p);
      Vector3 v = randomVector3();
      assertTuple3Equals(p,p.plus(v).minus(v));
      assertTuple3Equals(p,pc.plusEquals(v).minusEquals(v));
      Point3 q = p.minus(v);
      assertEquals(q.distanceTo(p),v.length(),TOLERANCE);
    }
  }

  @Test
  public void testMatrixVector() {
    int ntrial = 10;
    for (int itrial=0; itrial<ntrial; ++itrial) {
      Vector3 v = randomVector3();
      Matrix44 a = randomMatrix33();
      Matrix44 ata = a.transposeTimes(a);
      assertTuple3Equals(ata.times(v),a.transposeTimes(a.times(v)));
      Matrix44 aat = a.timesTranspose(a);
      assertTuple3Equals(aat.times(v),a.times(a.transposeTimes(v)));
    }
  }

  @Test
  public void testMatrixPoint() {
    int ntrial = 10;
    for (int itrial=0; itrial<ntrial; ++itrial) {
      Matrix44 a,ata,aat;
      a = randomMatrix33();
      ata = a.transposeTimes(a);
      aat = a.timesTranspose(a);
      Point3 p3 = randomPoint3();
      assertTuple3Equals(ata.times(p3),a.transposeTimes(a.times(p3)));
      assertTuple3Equals(aat.times(p3),a.times(a.transposeTimes(p3)));
      a = randomMatrix44();
      ata = a.transposeTimes(a);
      aat = a.timesTranspose(a);
      Point4 p4 = randomPoint4();
      assertTuple3Equals(ata.times(p4),a.transposeTimes(a.times(p4)));
      assertTuple3Equals(aat.times(p4),a.times(a.transposeTimes(p4)));
    }
  }

  ///////////////////////////////////////////////////////////////////////////
  // private

  private static Random _random = new Random(314159);

  private static final double TOLERANCE = 100*DBL_EPSILON;

  /**
   * Returns a diagonally dominant random 3x3 matrix.
   */
  private static Matrix44 randomMatrix33() {
    double[] m = new double[16];
    for (int i=0; i<16; ++i)
      m[i] = _random.nextDouble();
    m[ 0] += 4.0;
    m[ 5] += 4.0;
    m[10] += 4.0;
    m[ 3] = m[12] = 0.0;
    m[ 7] = m[13] = 0.0;
    m[11] = m[14] = 0.0;
    m[15] = 1.0;
    return new Matrix44(m);
  }

  /**
   * Returns Makes a diagonally dominant random 4x4 matrix.
   */
  private static Matrix44 randomMatrix44() {
    double[] m = new double[16];
    for (int i=0; i<16; ++i)
      m[i] = _random.nextDouble();
    m[ 0] += 4.0;
    m[ 5] += 4.0;
    m[10] += 4.0;
    m[15] += 4.0;
    return new Matrix44(m);
  }

  private static Point3 randomPoint3() {
    double x = _random.nextDouble();
    double y = _random.nextDouble();
    double z = _random.nextDouble();
    return new Point3(x,y,z);
  }

  private static Vector3 randomVector3() {
    double x = _random.nextDouble();
    double y = _random.nextDouble();
    double z = _random.nextDouble();
    return new Vector3(x,y,z);
  }

  private static Point4 randomPoint4() {
    double x = _random.nextDouble();
    double y = _random.nextDouble();
    double z = _random.nextDouble();
    double w = _random.nextDouble();
    return new Point4(x,y,z,w);
  }

  private static void assertMatrix44Equals(Matrix44 e, Matrix44 a) {
    double[] em = e.m;
    double[] am = a.m;
    for (int i=0; i<16; ++i)
      assertEquals(em[i],am[i],TOLERANCE);
  }

  private static void assertTuple3Equals(Tuple3 e, Tuple3 a) {
    assertEquals(e.x,a.x,TOLERANCE);
    assertEquals(e.y,a.y,TOLERANCE);
    assertEquals(e.z,a.z,TOLERANCE);
  }

  private static void assertTuple3Equals(Tuple4 e, Tuple4 a) {
    assertEquals(e.x,a.x,TOLERANCE);
    assertEquals(e.y,a.y,TOLERANCE);
    assertEquals(e.z,a.z,TOLERANCE);
    assertEquals(e.w,a.w,TOLERANCE);
  }

}


text:
<?php

namespace yupe\components\validators;

use CUniqueValidator;

/**
 * Class YUniqueSlugValidator
 * @package yupe\components\validators
 */
class YUniqueSlugValidator extends CUniqueValidator
{
    /**
     * @param \CModel $object
     * @param string $attribute
     * @throws \CException
     */
    protected function validateAttribute($object, $attribute)
    {
        $this->criteria = ['condition' => 'lang = :lang', 'params' => [':lang' => $object->lang]];

        return parent::validateAttribute($object, $attribute);
    }
}


text:
class CableLink : public LinkContact
{
public:
	CableLink(PhysicObject* one, PhysicObject* two, float length, float restitution = 0.0f);
	~CableLink() {};

	virtual void AddContact(CollisionHandler* handler) const;

	float MaxLength;
	float Restitution;
};
#endif