text:
#include "DvAvOpenhomeOrgVolume2.h"
#include <OpenHome/Types.h>
#include <OpenHome/Net/Private/DviService.h>
#include <OpenHome/Net/Private/Service.h>
#include <OpenHome/Net/Private/FunctorDviInvocation.h>
#include <OpenHome/Net/Cpp/DvInvocation.h>
#include <OpenHome/Net/Private/DviStack.h>

using namespace OpenHome;
using namespace OpenHome::Net;

bool DvProviderAvOpenhomeOrgVolume2Cpp::SetPropertyVolume(uint32_t aValue)
{
    ASSERT(iPropertyVolume != NULL);
    return SetPropertyUint(*iPropertyVolume, aValue);
}

void DvProviderAvOpenhomeOrgVolume2Cpp::GetPropertyVolume(uint32_t& aValue)
{
    ASSERT(iPropertyVolume != NULL);
    aValue = iPropertyVolume->Value();
}

bool DvProviderAvOpenhomeOrgVolume2Cpp::SetPropertyMute(bool aValue)
{
    ASSERT(iPropertyMute != NULL);
    return SetPropertyBool(*iPropertyMute, aValue);
}

void DvProviderAvOpenhomeOrgVolume2Cpp::GetPropertyMute(bool& aValue)
{
    ASSERT(iPropertyMute != NULL);
    aValue = iPropertyMute->Value();
}

bool DvProviderAvOpenhomeOrgVolume2Cpp::SetPropertyBalance(int32_t aValue)
{
    ASSERT(iPropertyBalance != NULL);
    return SetPropertyInt(*iPropertyBalance, aValue);
}

void DvProviderAvOpenhomeOrgVolume2Cpp::GetPropertyBalance(int32_t& aValue)
{
    ASSERT(iPropertyBalance != NULL);
    aValue = iPropertyBalance->Value();
}

bool DvProviderAvOpenhomeOrgVolume2Cpp::SetPropertyFade(int32_t aValue)
{
    ASSERT(iPropertyFade != NULL);
    return SetPropertyInt(*iPropertyFade, aValue);
}

void DvProviderAvOpenhomeOrgVolume2Cpp::GetPropertyFade(int32_t& aValue)
{
    ASSERT(iPropertyFade != NULL);
    aValue = iPropertyFade->Value();
}

bool DvProviderAvOpenhomeOrgVolume2Cpp::SetPropertyVolumeLimit(uint32_t aValue)
{
    ASSERT(iPropertyVolumeLimit != NULL);
    return SetPropertyUint(*iPropertyVolumeLimit, aValue);
}

void DvProviderAvOpenhomeOrgVolume2Cpp::GetPropertyVolumeLimit(uint32_t& aValue)
{
    ASSERT(iPropertyVolumeLimit != NULL);
    aValue = iPropertyVolumeLimit->Value();
}

bool DvProviderAvOpenhomeOrgVolume2Cpp::SetPropertyVolumeMax(uint32_t aValue)
{
    ASSERT(iPropertyVolumeMax != NULL);
    return SetPropertyUint(*iPropertyVolumeMax, aValue);
}

void DvProviderAvOpenhomeOrgVolume2Cpp::GetPropertyVolumeMax(uint32_t& aValue)
{
    ASSERT(iPropertyVolumeMax != NULL);
    aValue = iPropertyVolumeMax->Value();
}

bool DvProviderAvOpenhomeOrgVolume2Cpp::SetPropertyVolumeUnity(uint32_t aValue)
{
    ASSERT(iPropertyVolumeUnity != NULL);
    return SetPropertyUint(*iPropertyVolumeUnity, aValue);
}

void DvProviderAvOpenhomeOrgVolume2Cpp::GetPropertyVolumeUnity(uint32_t& aValue)
{
    ASSERT(iPropertyVolumeUnity != NULL);
    aValue = iPropertyVolumeUnity->Value();
}

bool DvProviderAvOpenhomeOrgVolume2Cpp::SetPropertyVolumeSteps(uint32_t aValue)
{
    ASSERT(iPropertyVolumeSteps != NULL);
    return SetPropertyUint(*iPropertyVolumeSteps, aValue);
}

void DvProviderAvOpenhomeOrgVolume2Cpp::GetPropertyVolumeSteps(uint32_t& aValue)
{
    ASSERT(iPropertyVolumeSteps != NULL);
    aValue = iPropertyVolumeSteps->Value();
}

bool DvProviderAvOpenhomeOrgVolume2Cpp::SetPropertyVolumeMilliDbPerStep(uint32_t aValue)
{
    ASSERT(iPropertyVolumeMilliDbPerStep != NULL);
    return SetPropertyUint(*iPropertyVolumeMilliDbPerStep, aValue);
}

void DvProviderAvOpenhomeOrgVolume2Cpp::GetPropertyVolumeMilliDbPerStep(uint32_t& aValue)
{
    ASSERT(iPropertyVolumeMilliDbPerStep != NULL);
    aValue = iPropertyVolumeMilliDbPerStep->Value();
}

bool DvProviderAvOpenhomeOrgVolume2Cpp::SetPropertyBalanceMax(uint32_t aValue)
{
    ASSERT(iPropertyBalanceMax != NULL);
    return SetPropertyUint(*iPropertyBalanceMax, aValue);
}

void DvProviderAvOpenhomeOrgVolume2Cpp::GetPropertyBalanceMax(uint32_t& aValue)
{
    ASSERT(iPropertyBalanceMax != NULL);
    aValue = iPropertyBalanceMax->Value();
}

bool DvProviderAvOpenhomeOrgVolume2Cpp::SetPropertyFadeMax(uint32_t aValue)
{
    ASSERT(iPropertyFadeMax != NULL);
    return SetPropertyUint(*iPropertyFadeMax, aValue);
}

void DvProviderAvOpenhomeOrgVolume2Cpp::GetPropertyFadeMax(uint32_t& aValue)
{
    ASSERT(iPropertyFadeMax != NULL);
    aValue = iPropertyFadeMax->Value();
}

bool DvProviderAvOpenhomeOrgVolume2Cpp::SetPropertyUnityGain(bool aValue)
{
    ASSERT(iPropertyUnityGain != NULL);
    return SetPropertyBool(*iPropertyUnityGain, aValue);
}

void DvProviderAvOpenhomeOrgVolume2Cpp::GetPropertyUnityGain(bool& aValue)
{
    ASSERT(iPropertyUnityGain != NULL);
    aValue = iPropertyUnityGain->Value();
}

DvProviderAvOpenhomeOrgVolume2Cpp::DvProviderAvOpenhomeOrgVolume2Cpp(DvDeviceStd& aDevice)
    : DvProvider(aDevice.Device(), "av.openhome.org", "Volume", 2)
{
    iPropertyVolume = NULL;
    iPropertyMute = NULL;
    iPropertyBalance = NULL;
    iPropertyFade = NULL;
    iPropertyVolumeLimit = NULL;
    iPropertyVolumeMax = NULL;
    iPropertyVolumeUnity = NULL;
    iPropertyVolumeSteps = NULL;
    iPropertyVolumeMilliDbPerStep = NULL;
    iPropertyBalanceMax = NULL;
    iPropertyFadeMax = NULL;
    iPropertyUnityGain = NULL;
}

void DvProviderAvOpenhomeOrgVolume2Cpp::EnablePropertyVolume()
{
    iPropertyVolume = new PropertyUint(new ParameterUint("Volume"));
    iService->AddProperty(iPropertyVolume); // passes ownership
}

void DvProviderAvOpenhomeOrgVolume2Cpp::EnablePropertyMute()
{
    iPropertyMute = new PropertyBool(new ParameterBool("Mute"));
    iService->AddProperty(iPropertyMute); // passes ownership
}

void DvProviderAvOpenhomeOrgVolume2Cpp::EnablePropertyBalance()
{
    iPropertyBalance = new PropertyInt(new ParameterInt("Balance"));
    iService->AddProperty(iPropertyBalance); // passes ownership
}

void DvProviderAvOpenhomeOrgVolume2Cpp::EnablePropertyFade()
{
    iPropertyFade = new PropertyInt(new ParameterInt("Fade"));
    iService->AddProperty(iPropertyFade); // passes ownership
}

void DvProviderAvOpenhomeOrgVolume2Cpp::EnablePropertyVolumeLimit()
{
    iPropertyVolumeLimit = new PropertyUint(new ParameterUint("VolumeLimit"));
    iService->AddProperty(iPropertyVolumeLimit); // passes ownership
}

void DvProviderAvOpenhomeOrgVolume2Cpp::EnablePropertyVolumeMax()
{
    iPropertyVolumeMax = new PropertyUint(new ParameterUint("VolumeMax"));
    iService->AddProperty(iPropertyVolumeMax); // passes ownership
}

void DvProviderAvOpenhomeOrgVolume2Cpp::EnablePropertyVolumeUnity()
{
    iPropertyVolumeUnity = new PropertyUint(new ParameterUint("VolumeUnity"));
    iService->AddProperty(iPropertyVolumeUnity); // passes ownership
}

void DvProviderAvOpenhomeOrgVolume2Cpp::EnablePropertyVolumeSteps()
{
    iPropertyVolumeSteps = new PropertyUint(new ParameterUint("VolumeSteps"));
    iService->AddProperty(iPropertyVolumeSteps); // passes ownership
}

void DvProviderAvOpenhomeOrgVolume2Cpp::EnablePropertyVolumeMilliDbPerStep()
{
    iPropertyVolumeMilliDbPerStep = new PropertyUint(new ParameterUint("VolumeMilliDbPerStep"));
    iService->AddProperty(iPropertyVolumeMilliDbPerStep); // passes ownership
}

void DvProviderAvOpenhomeOrgVolume2Cpp::EnablePropertyBalanceMax()
{
    iPropertyBalanceMax = new PropertyUint(new ParameterUint("BalanceMax"));
    iService->AddProperty(iPropertyBalanceMax); // passes ownership
}

void DvProviderAvOpenhomeOrgVolume2Cpp::EnablePropertyFadeMax()
{
    iPropertyFadeMax = new PropertyUint(new ParameterUint("FadeMax"));
    iService->AddProperty(iPropertyFadeMax); // passes ownership
}

void DvProviderAvOpenhomeOrgVolume2Cpp::EnablePropertyUnityGain()
{
    iPropertyUnityGain = new PropertyBool(new ParameterBool("UnityGain"));
    iService->AddProperty(iPropertyUnityGain); // passes ownership
}

void DvProviderAvOpenhomeOrgVolume2Cpp::EnableActionCharacteristics()
{
    OpenHome::Net::Action* action = new OpenHome::Net::Action("Characteristics");
    action->AddOutputParameter(new ParameterRelated("VolumeMax", *iPropertyVolumeMax));
    action->AddOutputParameter(new ParameterRelated("VolumeUnity", *iPropertyVolumeUnity));
    action->AddOutputParameter(new ParameterRelated("VolumeSteps", *iPropertyVolumeSteps));
    action->AddOutputParameter(new ParameterRelated("VolumeMilliDbPerStep", *iPropertyVolumeMilliDbPerStep));
    action->AddOutputParameter(new ParameterRelated("BalanceMax", *iPropertyBalanceMax));
    action->AddOutputParameter(new ParameterRelated("FadeMax", *iPropertyFadeMax));
    FunctorDviInvocation functor = MakeFunctorDviInvocation(*this, &DvProviderAvOpenhomeOrgVolume2Cpp::DoCharacteristics);
    iService->AddAction(action, functor);
}

void DvProviderAvOpenhomeOrgVolume2Cpp::EnableActionSetVolume()
{
    OpenHome::Net::Action* action = new OpenHome::Net::Action("SetVolume");
    action->AddInputParameter(new ParameterRelated("Value", *iPropertyVolume));
    FunctorDviInvocation functor = MakeFunctorDviInvocation(*this, &DvProviderAvOpenhomeOrgVolume2Cpp::DoSetVolume);
    iService->AddAction(action, functor);
}

void DvProviderAvOpenhomeOrgVolume2Cpp::EnableActionVolumeInc()
{
    OpenHome::Net::Action* action = new OpenHome::Net::Action("VolumeInc");
    FunctorDviInvocation functor = MakeFunctorDviInvocation(*this, &DvProviderAvOpenhomeOrgVolume2Cpp::DoVolumeInc);
    iService->AddAction(action, functor);
}

void DvProviderAvOpenhomeOrgVolume2Cpp::EnableActionVolumeDec()
{
    OpenHome::Net::Action* action = new OpenHome::Net::Action("VolumeDec");
    FunctorDviInvocation functor = MakeFunctorDviInvocation(*this, &DvProviderAvOpenhomeOrgVolume2Cpp::DoVolumeDec);
    iService->AddAction(action, functor);
}

void DvProviderAvOpenhomeOrgVolume2Cpp::EnableActionVolume()
{
    OpenHome::Net::Action* action = new OpenHome::Net::Action("Volume");
    action->AddOutputParameter(new ParameterRelated("Value", *iPropertyVolume));
    FunctorDviInvocation functor = MakeFunctorDviInvocation(*this, &DvProviderAvOpenhomeOrgVolume2Cpp::DoVolume);
    iService->AddAction(action, functor);
}

void DvProviderAvOpenhomeOrgVolume2Cpp::EnableActionSetBalance()
{
    OpenHome::Net::Action* action = new OpenHome::Net::Action("SetBalance");
    action->AddInputParameter(new ParameterRelated("Value", *iPropertyBalance));
    FunctorDviInvocation functor = MakeFunctorDviInvocation(*this, &DvProviderAvOpenhomeOrgVolume2Cpp::DoSetBalance);
    iService->AddAction(action, functor);
}

void DvProviderAvOpenhomeOrgVolume2Cpp::EnableActionBalanceInc()
{
    OpenHome::Net::Action* action = new OpenHome::Net::Action("BalanceInc");
    FunctorDviInvocation functor = MakeFunctorDviInvocation(*this, &DvProviderAvOpenhomeOrgVolume2Cpp::DoBalanceInc);
    iService->AddAction(action, functor);
}

void DvProviderAvOpenhomeOrgVolume2Cpp::EnableActionBalanceDec()
{
    OpenHome::Net::Action* action = new OpenHome::Net::Action("BalanceDec");
    FunctorDviInvocation functor = MakeFunctorDviInvocation(*this, &DvProviderAvOpenhomeOrgVolume2Cpp::DoBalanceDec);
    iService->AddAction(action, functor);
}

void DvProviderAvOpenhomeOrgVolume2Cpp::EnableActionBalance()
{
    OpenHome::Net::Action* action = new OpenHome::Net::Action("Balance");
    action->AddOutputParameter(new ParameterRelated("Value", *iPropertyBalance));
    FunctorDviInvocation functor = MakeFunctorDviInvocation(*this, &DvProviderAvOpenhomeOrgVolume2Cpp::DoBalance);
    iService->AddAction(action, functor);
}

void DvProviderAvOpenhomeOrgVolume2Cpp::EnableActionSetFade()
{
    OpenHome::Net::Action* action = new OpenHome::Net::Action("SetFade");
    action->AddInputParameter(new ParameterRelated("Value", *iPropertyFade));
    FunctorDviInvocation functor = MakeFunctorDviInvocation(*this, &DvProviderAvOpenhomeOrgVolume2Cpp::DoSetFade);
    iService->AddAction(action, functor);
}

void DvProviderAvOpenhomeOrgVolume2Cpp::EnableActionFadeInc()
{
    OpenHome::Net::Action* action = new OpenHome::Net::Action("FadeInc");
    FunctorDviInvocation functor = MakeFunctorDviInvocation(*this, &DvProviderAvOpenhomeOrgVolume2Cpp::DoFadeInc);
    iService->AddAction(action, functor);
}

void DvProviderAvOpenhomeOrgVolume2Cpp::EnableActionFadeDec()
{
    OpenHome::Net::Action* action = new OpenHome::Net::Action("FadeDec");
    FunctorDviInvocation functor = MakeFunctorDviInvocation(*this, &DvProviderAvOpenhomeOrgVolume2Cpp::DoFadeDec);
    iService->AddAction(action, functor);
}

void DvProviderAvOpenhomeOrgVolume2Cpp::EnableActionFade()
{
    OpenHome::Net::Action* action = new OpenHome::Net::Action("Fade");
    action->AddOutputParameter(new ParameterRelated("Value", *iPropertyFade));
    FunctorDviInvocation functor = MakeFunctorDviInvocation(*this, &DvProviderAvOpenhomeOrgVolume2Cpp::DoFade);
    iService->AddAction(action, functor);
}

void DvProviderAvOpenhomeOrgVolume2Cpp::EnableActionSetMute()
{
    OpenHome::Net::Action* action = new OpenHome::Net::Action("SetMute");
    action->AddInputParameter(new ParameterRelated("Value", *iPropertyMute));
    FunctorDviInvocation functor = MakeFunctorDviInvocation(*this, &DvProviderAvOpenhomeOrgVolume2Cpp::DoSetMute);
    iService->AddAction(action, functor);
}

void DvProviderAvOpenhomeOrgVolume2Cpp::EnableActionMute()
{
    OpenHome::Net::Action* action = new OpenHome::Net::Action("Mute");
    action->AddOutputParameter(new ParameterRelated("Value", *iPropertyMute));
    FunctorDviInvocation functor = MakeFunctorDviInvocation(*this, &DvProviderAvOpenhomeOrgVolume2Cpp::DoMute);
    iService->AddAction(action, functor);
}

void DvProviderAvOpenhomeOrgVolume2Cpp::EnableActionVolumeLimit()
{
    OpenHome::Net::Action* action = new OpenHome::Net::Action("VolumeLimit");
    action->AddOutputParameter(new ParameterRelated("Value", *iPropertyVolumeLimit));
    FunctorDviInvocation functor = MakeFunctorDviInvocation(*this, &DvProviderAvOpenhomeOrgVolume2Cpp::DoVolumeLimit);
    iService->AddAction(action, functor);
}

void DvProviderAvOpenhomeOrgVolume2Cpp::EnableActionUnityGain()
{
    OpenHome::Net::Action* action = new OpenHome::Net::Action("UnityGain");
    action->AddOutputParameter(new ParameterRelated("Value", *iPropertyUnityGain));
    FunctorDviInvocation functor = MakeFunctorDviInvocation(*this, &DvProviderAvOpenhomeOrgVolume2Cpp::DoUnityGain);
    iService->AddAction(action, functor);
}

void DvProviderAvOpenhomeOrgVolume2Cpp::DoCharacteristics(IDviInvocation& aInvocation)
{
    aInvocation.InvocationReadStart();
    aInvocation.InvocationReadEnd();
    uint32_t respVolumeMax;
    uint32_t respVolumeUnity;
    uint32_t respVolumeSteps;
    uint32_t respVolumeMilliDbPerStep;
    uint32_t respBalanceMax;
    uint32_t respFadeMax;
    DvInvocationStd invocation(aInvocation);
    Characteristics(invocation, respVolumeMax, respVolumeUnity, respVolumeSteps, respVolumeMilliDbPerStep, respBalanceMax, respFadeMax);
    aInvocation.InvocationWriteStart();
    DviInvocationResponseUint respWriterVolumeMax(aInvocation, "VolumeMax");
    respWriterVolumeMax.Write(respVolumeMax);
    DviInvocationResponseUint respWriterVolumeUnity(aInvocation, "VolumeUnity");
    respWriterVolumeUnity.Write(respVolumeUnity);
    DviInvocationResponseUint respWriterVolumeSteps(aInvocation, "VolumeSteps");
    respWriterVolumeSteps.Write(respVolumeSteps);
    DviInvocationResponseUint respWriterVolumeMilliDbPerStep(aInvocation, "VolumeMilliDbPerStep");
    respWriterVolumeMilliDbPerStep.Write(respVolumeMilliDbPerStep);
    DviInvocationResponseUint respWriterBalanceMax(aInvocation, "BalanceMax");
    respWriterBalanceMax.Write(respBalanceMax);
    DviInvocationResponseUint respWriterFadeMax(aInvocation, "FadeMax");
    respWriterFadeMax.Write(respFadeMax);
    aInvocation.InvocationWriteEnd();
}

void DvProviderAvOpenhomeOrgVolume2Cpp::DoSetVolume(IDviInvocation& aInvocation)
{
    aInvocation.InvocationReadStart();
    uint32_t Value = aInvocation.InvocationReadUint("Value");
    aInvocation.InvocationReadEnd();
    DvInvocationStd invocation(aInvocation);
    SetVolume(invocation, Value);
    aInvocation.InvocationWriteStart();
    aInvocation.InvocationWriteEnd();
}

void DvProviderAvOpenhomeOrgVolume2Cpp::DoVolumeInc(IDviInvocation& aInvocation)
{
    aInvocation.InvocationReadStart();
    aInvocation.InvocationReadEnd();
    DvInvocationStd invocation(aInvocation);
    VolumeInc(invocation);
    aInvocation.InvocationWriteStart();
    aInvocation.InvocationWriteEnd();
}

void DvProviderAvOpenhomeOrgVolume2Cpp::DoVolumeDec(IDviInvocation& aInvocation)
{
    aInvocation.InvocationReadStart();
    aInvocation.InvocationReadEnd();
    DvInvocationStd invocation(aInvocation);
    VolumeDec(invocation);
    aInvocation.InvocationWriteStart();
    aInvocation.InvocationWriteEnd();
}

void DvProviderAvOpenhomeOrgVolume2Cpp::DoVolume(IDviInvocation& aInvocation)
{
    aInvocation.InvocationReadStart();
    aInvocation.InvocationReadEnd();
    uint32_t respValue;
    DvInvocationStd invocation(aInvocation);
    Volume(invocation, respValue);
    aInvocation.InvocationWriteStart();
    DviInvocationResponseUint respWriterValue(aInvocation, "Value");
    respWriterValue.Write(respValue);
    aInvocation.InvocationWriteEnd();
}

void DvProviderAvOpenhomeOrgVolume2Cpp::DoSetBalance(IDviInvocation& aInvocation)
{
    aInvocation.InvocationReadStart();
    int32_t Value = aInvocation.InvocationReadInt("Value");
    aInvocation.InvocationReadEnd();
    DvInvocationStd invocation(aInvocation);
    SetBalance(invocation, Value);
    aInvocation.InvocationWriteStart();
    aInvocation.InvocationWriteEnd();
}

void DvProviderAvOpenhomeOrgVolume2Cpp::DoBalanceInc(IDviInvocation& aInvocation)
{
    aInvocation.InvocationReadStart();
    aInvocation.InvocationReadEnd();
    DvInvocationStd invocation(aInvocation);
    BalanceInc(invocation);
    aInvocation.InvocationWriteStart();
    aInvocation.InvocationWriteEnd();
}

void DvProviderAvOpenhomeOrgVolume2Cpp::DoBalanceDec(IDviInvocation& aInvocation)
{
    aInvocation.InvocationReadStart();
    aInvocation.InvocationReadEnd();
    DvInvocationStd invocation(aInvocation);
    BalanceDec(invocation);
    aInvocation.InvocationWriteStart();
    aInvocation.InvocationWriteEnd();
}

void DvProviderAvOpenhomeOrgVolume2Cpp::DoBalance(IDviInvocation& aInvocation)
{
    aInvocation.InvocationReadStart();
    aInvocation.InvocationReadEnd();
    int32_t respValue;
    DvInvocationStd invocation(aInvocation);
    Balance(invocation, respValue);
    aInvocation.InvocationWriteStart();
    DviInvocationResponseInt respWriterValue(aInvocation, "Value");
    respWriterValue.Write(respValue);
    aInvocation.InvocationWriteEnd();
}

void DvProviderAvOpenhomeOrgVolume2Cpp::DoSetFade(IDviInvocation& aInvocation)
{
    aInvocation.InvocationReadStart();
    int32_t Value = aInvocation.InvocationReadInt("Value");
    aInvocation.InvocationReadEnd();
    DvInvocationStd invocation(aInvocation);
    SetFade(invocation, Value);
    aInvocation.InvocationWriteStart();
    aInvocation.InvocationWriteEnd();
}

void DvProviderAvOpenhomeOrgVolume2Cpp::DoFadeInc(IDviInvocation& aInvocation)
{
    aInvocation.InvocationReadStart();
    aInvocation.InvocationReadEnd();
    DvInvocationStd invocation(aInvocation);
    FadeInc(invocation);
    aInvocation.InvocationWriteStart();
    aInvocation.InvocationWriteEnd();
}

void DvProviderAvOpenhomeOrgVolume2Cpp::DoFadeDec(IDviInvocation& aInvocation)
{
    aInvocation.InvocationReadStart();
    aInvocation.InvocationReadEnd();
    DvInvocationStd invocation(aInvocation);
    FadeDec(invocation);
    aInvocation.InvocationWriteStart();
    aInvocation.InvocationWriteEnd();
}

void DvProviderAvOpenhomeOrgVolume2Cpp::DoFade(IDviInvocation& aInvocation)
{
    aInvocation.InvocationReadStart();
    aInvocation.InvocationReadEnd();
    int32_t respValue;
    DvInvocationStd invocation(aInvocation);
    Fade(invocation, respValue);
    aInvocation.InvocationWriteStart();
    DviInvocationResponseInt respWriterValue(aInvocation, "Value");
    respWriterValue.Write(respValue);
    aInvocation.InvocationWriteEnd();
}

void DvProviderAvOpenhomeOrgVolume2Cpp::DoSetMute(IDviInvocation& aInvocation)
{
    aInvocation.InvocationReadStart();
    bool Value = aInvocation.InvocationReadBool("Value");
    aInvocation.InvocationReadEnd();
    DvInvocationStd invocation(aInvocation);
    SetMute(invocation, Value);
    aInvocation.InvocationWriteStart();
    aInvocation.InvocationWriteEnd();
}

void DvProviderAvOpenhomeOrgVolume2Cpp::DoMute(IDviInvocation& aInvocation)
{
    aInvocation.InvocationReadStart();
    aInvocation.InvocationReadEnd();
    bool respValue;
    DvInvocationStd invocation(aInvocation);
    Mute(invocation, respValue);
    aInvocation.InvocationWriteStart();
    DviInvocationResponseBool respWriterValue(aInvocation, "Value");
    respWriterValue.Write(respValue);
    aInvocation.InvocationWriteEnd();
}

void DvProviderAvOpenhomeOrgVolume2Cpp::DoVolumeLimit(IDviInvocation& aInvocation)
{
    aInvocation.InvocationReadStart();
    aInvocation.InvocationReadEnd();
    uint32_t respValue;
    DvInvocationStd invocation(aInvocation);
    VolumeLimit(invocation, respValue);
    aInvocation.InvocationWriteStart();
    DviInvocationResponseUint respWriterValue(aInvocation, "Value");
    respWriterValue.Write(respValue);
    aInvocation.InvocationWriteEnd();
}

void DvProviderAvOpenhomeOrgVolume2Cpp::DoUnityGain(IDviInvocation& aInvocation)
{
    aInvocation.InvocationReadStart();
    aInvocation.InvocationReadEnd();
    bool respValue;
    DvInvocationStd invocation(aInvocation);
    UnityGain(invocation, respValue);
    aInvocation.InvocationWriteStart();
    DviInvocationResponseBool respWriterValue(aInvocation, "Value");
    respWriterValue.Write(respValue);
    aInvocation.InvocationWriteEnd();
}

void DvProviderAvOpenhomeOrgVolume2Cpp::Characteristics(IDvInvocationStd& /*aInvocation*/, uint32_t& /*aVolumeMax*/, uint32_t& /*aVolumeUnity*/, uint32_t& /*aVolumeSteps*/, uint32_t& /*aVolumeMilliDbPerStep*/, uint32_t& /*aBalanceMax*/, uint32_t& /*aFadeMax*/)
{
    ASSERTS();
}

void DvProviderAvOpenhomeOrgVolume2Cpp::SetVolume(IDvInvocationStd& /*aInvocation*/, uint32_t /*aValue*/)
{
    ASSERTS();
}

void DvProviderAvOpenhomeOrgVolume2Cpp::VolumeInc(IDvInvocationStd& /*aInvocation*/)
{
    ASSERTS();
}

void DvProviderAvOpenhomeOrgVolume2Cpp::VolumeDec(IDvInvocationStd& /*aInvocation*/)
{
    ASSERTS();
}

void DvProviderAvOpenhomeOrgVolume2Cpp::Volume(IDvInvocationStd& /*aInvocation*/, uint32_t& /*aValue*/)
{
    ASSERTS();
}

void DvProviderAvOpenhomeOrgVolume2Cpp::SetBalance(IDvInvocationStd& /*aInvocation*/, int32_t /*aValue*/)
{
    ASSERTS();
}

void DvProviderAvOpenhomeOrgVolume2Cpp::BalanceInc(IDvInvocationStd& /*aInvocation*/)
{
    ASSERTS();
}

void DvProviderAvOpenhomeOrgVolume2Cpp::BalanceDec(IDvInvocationStd& /*aInvocation*/)
{
    ASSERTS();
}

void DvProviderAvOpenhomeOrgVolume2Cpp::Balance(IDvInvocationStd& /*aInvocation*/, int32_t& /*aValue*/)
{
    ASSERTS();
}

void DvProviderAvOpenhomeOrgVolume2Cpp::SetFade(IDvInvocationStd& /*aInvocation*/, int32_t /*aValue*/)
{
    ASSERTS();
}

void DvProviderAvOpenhomeOrgVolume2Cpp::FadeInc(IDvInvocationStd& /*aInvocation*/)
{
    ASSERTS();
}

void DvProviderAvOpenhomeOrgVolume2Cpp::FadeDec(IDvInvocationStd& /*aInvocation*/)
{
    ASSERTS();
}

void DvProviderAvOpenhomeOrgVolume2Cpp::Fade(IDvInvocationStd& /*aInvocation*/, int32_t& /*aValue*/)
{
    ASSERTS();
}

void DvProviderAvOpenhomeOrgVolume2Cpp::SetMute(IDvInvocationStd& /*aInvocation*/, bool /*aValue*/)
{
    ASSERTS();
}

void DvProviderAvOpenhomeOrgVolume2Cpp::Mute(IDvInvocationStd& /*aInvocation*/, bool& /*aValue*/)
{
    ASSERTS();
}

void DvProviderAvOpenhomeOrgVolume2Cpp::VolumeLimit(IDvInvocationStd& /*aInvocation*/, uint32_t& /*aValue*/)
{
    ASSERTS();
}

void DvProviderAvOpenhomeOrgVolume2Cpp::UnityGain(IDvInvocationStd& /*aInvocation*/, bool& /*aValue*/)
{
    ASSERTS();
}


text:
<!doctype html>

  <meta charset="utf-8">
  <title>amp-image-slider example</title>
  <link rel="canonical" href="amps.html">
  <meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1">

Drag/Click Slider with Customizable Labels

NO labels; NO whatever modifications

    <amp-image-slider tabindex="0" layout="responsive" width="1024" height="600">
      <amp-img src="https://unsplash.it/1080/720?image=1037" layout="fill"></amp-img>
      <amp-img src="https://unsplash.it/1080/720?image=1038" layout="fill"></amp-img>
    </amp-image-slider>

Images toggle their own fallback

    <amp-image-slider tabindex="0" layout="responsive" width="1024" height="600">
      <amp-img src="boom" layout="fill">
        <amp-img fallback src="https://unsplash.it/1080/720?image=1038" layout="fill"></amp-img>
      </amp-img>
      <amp-img src="boom" layout="fill">
        <amp-img fallback src="https://unsplash.it/1080/720?image=1037" layout="fill"></amp-img>
      </amp-img>
    </amp-image-slider>

Labels with NO positioning rules specified (default to both top left)

    <amp-image-slider tabindex="0" layout="responsive" width="1024" height="600">
      <amp-img src="https://unsplash.it/1080/720?image=1037" layout="fill"></amp-img>
      <amp-img src="https://unsplash.it/1080/720?image=1038" layout="fill"></amp-img>

BEFORE

AFTER

    </amp-image-slider>

Labels with positioning rules specified

    <amp-image-slider tabindex="0" layout="responsive" width="1024" height="600">
      <amp-img src="https://unsplash.it/1080/720?image=1037" layout="fill"></amp-img>
      <amp-img src="https://unsplash.it/1080/720?image=1038" layout="fill"></amp-img>

BEFORE

AFTER

    </amp-image-slider>

Customizable Hints

Hide hints through display trick

    <amp-image-slider class="hint-hidden" tabindex="0" layout="responsive" width="1024" height="600"
        disable-hint-reappear>
      <amp-img src="https://unsplash.it/1080/720?image=1037" layout="fill"></amp-img>
      <amp-img src="https://unsplash.it/1080/720?image=1038" layout="fill"></amp-img>

BEFORE

AFTER

    </amp-image-slider>

Fully customized hint (current reversing the hint logos, changing sizes and margins)

    <amp-image-slider class="reversed-hint" tabindex="0" layout="responsive" width="1024" height="600">
      <amp-img src="https://unsplash.it/1080/720?image=1037" layout="fill"></amp-img>
      <amp-img src="https://unsplash.it/1080/720?image=1038" layout="fill"></amp-img>

BEFORE

AFTER

    </amp-image-slider>

Fully customized hint (replace with triangles)

    <amp-image-slider class="triangle-hint" tabindex="0" layout="responsive" width="1024" height="600">
      <amp-img src="https://unsplash.it/1080/720?image=1037" layout="fill"></amp-img>
      <amp-img src="https://unsplash.it/1080/720?image=1038" layout="fill"></amp-img>

BEFORE

AFTER

    </amp-image-slider>

Fully customized hint (centering a box)

    <amp-image-slider class="centered-hint" tabindex="0" layout="responsive" width="1024" height="600">
      <amp-img src="https://unsplash.it/1080/720?image=1037" layout="fill"></amp-img>
      <amp-img src="https://unsplash.it/1080/720?image=1038" layout="fill"></amp-img>

BEFORE

AFTER

    </amp-image-slider>

No Reemerging hint

    <amp-image-slider tabindex="0" layout="responsive" width="1024" height="600"
        disable-hint-reappear>
      <amp-img src="https://unsplash.it/1080/720?image=1037" layout="fill"></amp-img>
      <amp-img src="https://unsplash.it/1080/720?image=1038" layout="fill"></amp-img>

BEFORE

AFTER

    </amp-image-slider>

Inside Carousel

Carousel would not be scrolled when moving the slider

    <amp-carousel width="400"
      height="300"
      layout="responsive"
      type="slides"
      controls>
      <amp-image-slider layout="responsive" width="1024" height="600">
        <amp-img src="https://unsplash.it/1080/720?image=1037" layout="fill"></amp-img>
        <amp-img src="https://unsplash.it/1080/720?image=1038" layout="fill"></amp-img>
      </amp-image-slider>
      <amp-img src="https://unsplash.it/200/300?image=0"
        width="400"
        height="300"
        layout="responsive"
        alt="a sample image"></amp-img>
      <amp-image-slider layout="responsive" width="1024" height="600">
        <amp-img src="https://unsplash.it/1080/720?image=1037" layout="fill"></amp-img>
        <amp-img src="https://unsplash.it/1080/720?image=1038" layout="fill"></amp-img>
      </amp-image-slider>
      <amp-img src="https://unsplash.it/200/300?image=1"
        width="400"
        height="300"
        layout="responsive"
        alt="and another sample image"></amp-img>
    </amp-carousel>

Accessibility

Has ARIA labels

    <amp-image-slider tabindex="0" layout="responsive" width="1024" height="600" aria-label="check out the following images">
      <amp-img src="https://unsplash.it/1080/720?image=1037" layout="fill" alt="Mountain"></amp-img>
      <amp-img src="https://unsplash.it/1080/720?image=1038" layout="fill" alt="Ocean"></amp-img>

BEFORE

AFTER

    </amp-image-slider>

Test lightbox overlay

No slider should lay on top of this lightbox

    <amp-lightbox id="my-lightbox"
      layout="nodisplay">

Hello World!

    </amp-lightbox>
    <button class="ampstart-btn caps m2"
      on="tap:my-lightbox"
      role="button"
      tabindex="0">
      Open lightbox
    </button>

redpajama_set_name: RedPajamaGithub


text:
package io.oasp.gastronomy.restaurant.salesmanagement.dataaccess.api.dao;

import io.oasp.gastronomy.restaurant.general.dataaccess.api.dao.ApplicationDao;
import io.oasp.gastronomy.restaurant.salesmanagement.dataaccess.api.OrderPositionEntity;

import java.util.List;

/**
 * {@link io.oasp.gastronomy.restaurant.general.dataaccess.api.dao.ApplicationDao Data Access Object} for {@link OrderPositionEntity} entity.
 *
 * @author hohwille
 */
public interface OrderPositionDao extends ApplicationDao<OrderPositionEntity> {

  /**
   * @param orderId is the {@link io.oasp.gastronomy.restaurant.salesmanagement.logic.api.to.OrderEto#getId() ID} for
   *        which the {@link OrderPositionEntity}s are requested.
   * @return the {@link java.util.List} of all {@link OrderPositionEntity}s {@link OrderPositionEntity#getOrderId() associated}
   *         with the given orderId.
   */
  List<OrderPositionEntity> findOrderPositionsByOrder(Long orderId);

  /**
   * @param orderId is the {@link io.oasp.gastronomy.restaurant.salesmanagement.logic.api.to.OrderEto#getId() table ID}
   *        for which the {@link OrderPositionEntity}s are requested.
   * @return the {@link java.util.List} of all {@link OrderPositionEntity}s that are NOT
   *         {@link io.oasp.gastronomy.restaurant.salesmanagement.common.api.datatype.OrderPositionState#isClosed()
   *         closed} and are {@link io.oasp.gastronomy.restaurant.salesmanagement.logic.api.to.OrderEto#getId() table
   *         ID} with the given {@link io.oasp.gastronomy.restaurant.salesmanagement.logic.api.to.OrderEto}. Will be the
   *         empty {@link java.util.List} if no such {@link OrderPositionEntity} exists.
   */
  List<OrderPositionEntity> findOpenOrderPositionsByOrder(Long orderId);
}


text:
@interface AES256EncryptMode : AbsEncryptingMode

@end


text:
{% extends "_layout/base.html" %}

{% block content %}

Cabinet "{{cabinet.name}}"

<form method="POST"
  action="{{url_for('ui.cabinet', id=cabinet.id)}}">

Details

        Name
        <input type="text" autofocus class="form-control" id="input-name"
          name="name" required placeholder="Cabinet name"
          value="{{cabinet.name}}">

          <button type="submit" class="btn btn-default">

            Update
          </button>

          <button type="button" class="btn btn-danger" data-toggle="modal"
              data-target="#modal-delete">

            Delete
          </button>

</form>

{% macro layout_item(layout) %}

{% if layout.type == "container" %}

  {% for c in layout.children %}
    {{ layout_item(c) }}
  {% endfor %}

{% elif layout.type == "item" %}

xxx

{% endif %}

{% endmacro %}

Drawers

      {{ layout_item(cabinet.layout.spec) }}

        <button type="button" class="close" data-dismiss="modal"
          aria-label="Close">
          ×
        </button>

Confirm delete

          Are you sure you wish to delete cabinet "{{cabinet.name}}".
          This action cannot be undone.

        <form method="POST"
          action="{{url_for('ui.cabinet_delete', id=cabinet.id)}}">
          <button type="button" class="btn btn-default" data-dismiss="modal">
            Do not delete
          </button>
          <button type="submit" class="btn btn-danger">
            Delete cabinet "{{cabinet.name}}"
          </button>
        </form>

{% endblock %}


text:
package xyz.zpayh.hdimage.datasource;

import android.content.Context;
import androidx.annotation.NonNull;

import java.util.List;

import xyz.zpayh.hdimage.state.Orientation;

public class RealOrientationInterceptor implements OrientationInterceptor{

    private final List<OrientationInterceptor> mInterceptors;

    RealOrientationInterceptor(List<OrientationInterceptor> interceptors) {
        mInterceptors = interceptors;
    }

    @Override
    public int getExifOrientation(@NonNull Context context, String sourceUri) {
        for (OrientationInterceptor interceptor : mInterceptors) {
            int orientation = interceptor.getExifOrientation(context, sourceUri);
            if (orientation != Orientation.ORIENTATION_EXIF) {
                return orientation;
            }
        }
        return Orientation.ORIENTATION_0;
    }
}


text:
/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.facebook.presto.operator;

import com.facebook.presto.memory.context.LocalMemoryContext;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.ImmutableList;

import javax.annotation.concurrent.GuardedBy;

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

import static java.util.Objects.requireNonNull;

// A TaskExchangeClientManager should be created for each SqlTask/SqlTaskExecution
public class TaskExchangeClientManager
{
    private final ExchangeClientSupplier supplier;

    @GuardedBy("this")
    private final List<ExchangeClient> exchangeClients;

    @VisibleForTesting
    public TaskExchangeClientManager(ExchangeClientSupplier supplier)
    {
        this.supplier = requireNonNull(supplier, "supplier is null");
        this.exchangeClients = new ArrayList<>();
    }

    public synchronized ExchangeClient createExchangeClient(LocalMemoryContext systemMemoryContext)
    {
        ExchangeClient exchangeClient = supplier.get(systemMemoryContext);
        exchangeClients.add(exchangeClient);
        return exchangeClient;
    }

    public synchronized List<ExchangeClient> getExchangeClients()
    {
        return ImmutableList.copyOf(exchangeClients);
    }
}


text:
package edu.jhu.thrax.hadoop.extraction;

import java.io.IOException;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.mapreduce.Reducer;

import edu.jhu.thrax.hadoop.datatypes.AlignedRuleWritable;
import edu.jhu.thrax.hadoop.datatypes.AlignmentWritable;
import edu.jhu.thrax.hadoop.datatypes.Annotation;
import edu.jhu.thrax.hadoop.datatypes.RuleWritable;
import edu.jhu.thrax.util.Vocabulary;

public class ExtractionReducer
    extends Reducer<AlignedRuleWritable, Annotation, RuleWritable, Annotation> {

  private RuleWritable currentRule = null;
  private Annotation currentAnnotation = null;
  private AlignmentWritable maxAlignment = null;
  private int alignmentCount;

  private int minCount;

  protected void setup(Context context) throws IOException, InterruptedException {
    Configuration conf = context.getConfiguration();
    String vocabulary_path = conf.getRaw("thrax.work-dir") + "vocabulary/part-*";
    Vocabulary.initialize(conf, vocabulary_path);
    minCount = conf.getInt("thrax.min-rule-count", 1);
  }

  protected void reduce(AlignedRuleWritable key, Iterable<Annotation> values, Context context)
      throws IOException, InterruptedException {
    RuleWritable rule = key.getRule();
    AlignmentWritable alignment = key.getAlignment();

    Annotation merged = new Annotation();
    for (Annotation a : values)
      merged.merge(a);

    if (!rule.equals(currentRule)) {
      if (currentRule != null
          && (currentAnnotation.count() >= minCount || isUnigramRule(currentRule))) {
        currentAnnotation.setAlignment(maxAlignment);
        context.write(currentRule, currentAnnotation);
        context.progress();
      }
      currentRule = new RuleWritable(rule);
      currentAnnotation = new Annotation();
      alignmentCount = 0;
      maxAlignment = null;
    }
    currentAnnotation.merge(merged);
    if (alignmentCount < merged.count()) {
      maxAlignment = new AlignmentWritable(alignment);
      alignmentCount = merged.count();
    }
  }

  protected void cleanup(Context context) throws IOException, InterruptedException {
    if (currentRule != null) {
      if (currentAnnotation.count() >= minCount || isUnigramRule(currentRule)) {
        currentAnnotation.setAlignment(maxAlignment);
        context.write(currentRule, currentAnnotation);
        context.progress();
      }
    }
  }

  private static boolean isUnigramRule(RuleWritable rule) {
    if (rule.source.length == 1) return !Vocabulary.nt(rule.source[0]);
    return rule.target.length == 1 && !Vocabulary.nt(rule.target[0]);
  }
}


text:
package com.vinkel.remindmewheniamthere.utils;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonObject;
import com.google.gson.JsonPrimitive;
import com.vinkel.remindmewheniamthere.utils.base.IJsonParser;

import java.lang.reflect.Type;

public class JsonParser implements IJsonParser {
  @Override
  public String toJson(Object src) {
    Gson gson = new Gson();
    String json = gson.toJson(src);

    return json;
  }

  @Override
  public <T> T fromJson(String json, Type classOfT) {
    GsonBuilder builder = new GsonBuilder();
    Gson gson = builder.create();
    T result = gson.fromJson(json, classOfT);

    return result;
  }

  @Override
  public <T> T[] fromJsonArray(String json, Type arrayClassOfT) {
    GsonBuilder builder = new GsonBuilder();
    Gson gson = builder.create();
    T[] result = gson.fromJson(json, arrayClassOfT);

    return result;
  }

  @Override
  public String getDirectMember(String json, String memberName) {
    com.google.gson.JsonParser jsonParser = new com.google.gson.JsonParser();
    JsonObject parent = jsonParser
        .parse(json)
        .getAsJsonObject();

    JsonObject member = parent.getAsJsonObject(memberName);

    return member.toString();
  }

  public String getDirectSimpleMember(String json, String memberName) {
    com.google.gson.JsonParser jsonParser = new com.google.gson.JsonParser();
    JsonObject parent = jsonParser
        .parse(json)
        .getAsJsonObject();

    JsonPrimitive primitive = parent.getAsJsonPrimitive(memberName);
    return primitive.toString();
  }

}


text:
export number_of_lattices, lattice_name, lattice,
       lattice_automorphism_group_order, lattice_database

struct LatticeDB
  path::String
  max_rank::Int
  db::Vector{Vector{NamedTuple{(:name, :rank, :deg, :amb, :basis_mat, :min, :aut, :kissing),
                               Tuple{String, Int, Int, Vector{Rational{BigInt}}, Vector{Rational{BigInt}}, BigInt, BigInt, BigInt}}}}

  function LatticeDB(path::String)
    db = Meta.eval(Meta.parse(Base.read(path, String)))
    max_rank = length(db)
    return new(path, max_rank, db)
  end
end

# TODO: Write a parser for the data

function show(io::IO, L::LatticeDB)
  print(io, "Nebe-Sloan database of lattices (rank limit = ", L.max_rank, ")")
end

const default_lattice_db = Ref(joinpath(artifact"ZLatDB", "ZLatDB", "data"))

################################################################################
#
#  For creating a lattice database
#
################################################################################

function lattice_database()
  return LatticeDB(default_lattice_db[])
end

function lattice_database(path::String)
  return LatticeDB(path)
end

################################################################################
#
#  Conversion from linear indicies
#
################################################################################

function from_linear_index(L::LatticeDB, i::Int)
  k = 1
  while i > length(L.db[k])
    i = i - length(L.db[k])
    k += 1
  end
  return (k, i)
end

################################################################################
#
#  Out of bounds error functions
#
################################################################################

@inline function _check_rank_range(L, r)
  r < 0 || r > L.max_rank &&
        throw(error("Rank ($(r)) must be between 1 and $(L.max_rank)"))
end

@inline function _check_range(L, r, i)
  r < 0 || r > L.max_rank &&
          throw(error("Rank ($(r)) must be between 1 and $(L.max_rank)"))
  j = number_of_lattices(L, r)
  i < 0 || i > j && throw(error("Index ($(i)) must be between 1 and $(j)"))
end

@inline function _check_range(L, i)
  j = number_of_lattices(L)
  i < 0 || i > j && throw(error("Index ($(i)) must be between 1 and $(j)"))
end

################################################################################
#
#  Access functions
#
################################################################################

function number_of_lattices(L::LatticeDB, r::Int)
  _check_rank_range(L, r)
  return length(L.db[r])
end

function number_of_lattices(L::LatticeDB)
  return sum(length.(L.db))
end

function lattice_name(L::LatticeDB, r::Int, i::Int)
  _check_range(L, r, i)
  return L.db[r][i].name
end

function lattice_name(L::LatticeDB, i::Int)
  _check_range(L, i)
  return lattice_name(L, from_linear_index(L, i)...)
end

function lattice_automorphism_group_order(L::LatticeDB, r::Int, i::Int)
  _check_range(L, r, i)
  return L.db[r][i].aut
end

function lattice_automorphism_group_order(L::LatticeDB, i::Int)
  _check_range(L, i)
  return lattice_automorphism_group_order(L, from_linear_index(L, i)...)
end

function lattice(L::LatticeDB, r::Int, i::Int)
  _check_range(L, r, i)
  d = L.db[r][i].deg
  A = matrix(FlintQQ, d, d, L.db[r][i].amb)
  B = matrix(FlintQQ, r, d, L.db[r][i].basis_mat)
  return Zlattice(B, gram = A)
end

function lattice(L::LatticeDB, i::Int)
  _check_range(L, i)
  return lattice(L, from_linear_index(L, i)...)
end

################################################################################
#
#  Quadratic lattices DB
#
################################################################################

const default_quad_lattice_db = Ref(joinpath(artifact"QuadLatDB", "QuadLatDB", "data"))

struct QuadLatDB
  path::String
  #db::Vector{Tuple{Vector{BigInt}, Vector{Vector{Rational{BigInt}}}, Vector{Vector{Rational{BigInt}}}, Int}}
  metadata
  head::Int
  length::Int

  function QuadLatDB(path::String)
    metadata = Dict()
    f = open(path)
    head = 0
    while true
      line = readline(f)
      if line[1] == '#'
        head += 1
        if !(':' in line)
          continue
        end
        i = 2
        while line[i] != ':'
          i += 1
        end
        key = strip(line[2:i-1])
        val = strip(line[i+1:end])
        metadata[key] = val
      else
        break
      end
    end
    seekstart(f)
    length = countlines(f)
    close(f)
    return new(path, metadata, head, length - head)
  end
end

function quadratic_lattice_database()
  return QuadLatDB(default_quad_lattice_db[])
end

function quadratic_lattice_database(path::String)
  return QuadLatDB(path)
end

Base.length(D::QuadLatDB) = D.length

class_number(D::QuadLatDB, i::Int) = _lattice_data(D, i)[4]

function Base.show(io::IO, D::QuadLatDB)
  s = get(D.metadata, "Description", "Quadratic lattices database")
  print(io, s, "\n")
  if haskey(D.metadata, "Author")
    print(io, "Author: $(D.metadata["Author"])\n")
  end
  if haskey(D.metadata, "Source")
    print(io, "Source: $(D.metadata["Source"])\n")
  end
  if haskey(D.metadata, "Version")
    print(io, "Version: $(VersionNumber(D.metadata["Version"]))\n")
  end

  print(io, "Number of lattices: ", D.length)
end

function versioninfo(D::QuadLatDB)
  return VersionNumber(D.metadata["Version"])
end

function _lattice_data(D::QuadLatDB, i::Int)
  it = Iterators.drop(eachline(D.path), D.head + i - 1)
  line = IOBuffer(first(it))
  return _parse_quad(line, versioninfo(D))
end

function lattice(D::QuadLatDB, i::Int)
  return _get_lattice(_lattice_data(D, i))
end

function _get_lattice(data)
  f = Globals.Qx(data[1])
  K, a = NumberField(f, "a", cached = false)
  diag = map(K, data[2])
  gens = map(K, data[3])
  D = diagonal_matrix(diag)
  n = nrows(D)
  @assert iszero(mod(length(gens), n))
  gens_split = collect(Iterators.partition(gens, n))
  gens_split = Vector{elem_type(K)}[collect(g) for g in gens_split]
  return quadratic_lattice(K, gens_split, gram = D)
end

################################################################################
#
#  Hermitian lattices DB
#
################################################################################

const default_herm_lattice_db = Ref(joinpath(artifact"HermLatDB", "HermLatDB", "data"))

struct HermLatDB
  path::String
  #db::Vector{Tuple{Vector{BigInt}, Vector{Vector{Rational{BigInt}}}, Vector{Vector{Rational{BigInt}}}, Int}}
  metadata
  head::Int
  length::Int

  function HermLatDB(path::String)
    metadata = Dict()
    f = open(path)
    head = 0
    while true
      line = readline(f)
      if line[1] == '#'
        head += 1
        if !(':' in line)
          continue
        end
        i = 2
        while line[i] != ':'
          i += 1
        end
        key = strip(line[2:i-1])
        val = strip(line[i+1:end])
        metadata[key] = val
      else
        break
      end
    end
    seekstart(f)
    length = countlines(f)
    close(f)
    return new(path, metadata, head, length - head)
  end
end

function hermitian_lattice_database()
  return HermLatDB(default_herm_lattice_db[])
end

function hermitian_lattice_database(path::String)
  return HermLatDB(path)
end

Base.length(D::HermLatDB) = D.length

class_number(D::HermLatDB, i::Int) = _lattice_data(D, i)[5]

function Base.show(io::IO, D::HermLatDB)
  s = get(D.metadata, "Description", "Hermitian lattices database")
  print(io, s, "\n")
  if haskey(D.metadata, "Author")
    print(io, "Author: $(D.metadata["Author"])\n")
  end
  if haskey(D.metadata, "Source")
    print(io, "Source: $(D.metadata["Source"])\n")
  end
  if haskey(D.metadata, "Version")
    print(io, "Version: $(VersionNumber(D.metadata["Version"]))\n")
  end

  print(io, "Number of lattices: ", D.length)
end

function versioninfo(D::HermLatDB)
  return VersionNumber(D.metadata["Version"])
end

function _lattice_data(D::HermLatDB, i::Int)
  it = Iterators.drop(eachline(D.path), D.head + i - 1)
  line = IOBuffer(first(it))
  return _parse_herm(line, versioninfo(D))
end

function lattice(D::HermLatDB, i::Int)
  return _get_hermitian_lattice(_lattice_data(D, i))
end

function _get_hermitian_lattice(data)
  f = Globals.Qx(data[1])
  K, a = NumberField(f, "a", cached = false)
  Kt, t = PolynomialRing(K, "t", cached = false)
  E, b = NumberField(Kt(map(K, data[2])), "b", cached = false)
  diag = map(E, map(K, data[3]))
  k = degree(K)
  #gens = [ E(map(K, collect(Iterators.partition(v, k))))  map(E, data[4])
  D = diagonal_matrix(diag)
  n = nrows(D)
  @assert iszero(mod(length(data[4]), n))
  gens_split = collect(Iterators.partition(data[4], n))
  gens = Vector{elem_type(E)}[]
  for v in gens_split
    push!(gens, map(E, [map(K, collect(Vector.(Iterators.partition(w, k)))) for w in v]))
  end
  return hermitian_lattice(E, gens, gram = D)
end

################################################################################
#
#  Parse
#
################################################################################

base_type(::Type{fmpq}) = fmpz

base_type(::Type{Rational{T}}) where {T} = T

function parse_int(io, delim = UInt8[UInt8(',')])
  n = IOBuffer()
  b = Base.read(io, UInt8)
  while !(b in delim)
    Base.write(n, b)
    if eof(io)
      break
    end
    b = Base.read(io, UInt8)
  end

  return b, parse(Int, String(take!(n)))
end

function parse_rational(::Type{T}, io, delim = [UInt8(',')]) where {T}
  n = IOBuffer()
  d = IOBuffer()
  read_den = false
  b = Base.read(io, UInt8)
  while !(b in delim)
    if b == UInt8('/')
      read_den = true
      skip(io, 1)
      @goto read
    end

    if !read_den
      Base.write(n, b)
    else
      Base.write(d, b)
    end

    @label read
    if eof(io)
      break
    end
    b = Base.read(io, UInt8)
  end

  nu = String(take!(n))

  if length(nu) < 18
    num = base_type(T)(parse(Int, nu))
  else
    num = parse(base_type(T), nu)
  end

  if !read_den
    return b, T(num)
  else
    de = String(take!(d))
    if length(de) < 18
      den = base_type(T)(parse(Int, de))
    else
      den = parse(base_type(T), de)
    end
    return b, num//den
  end
end

function parse_array(::Type{T}, io, ldelim = '[', rdelim = ']') where {T}
  res = Vector{T}()
  b = Base.read(io, UInt8)
  @assert b == UInt8(ldelim)
  mark(io)
  b = Base.read(io, UInt8)
  if b == UInt8(rdelim)
    return b, res
  else
    reset(io)
    unmark(io)
    while true
      b, z = parse_rational(T, io, map(UInt8, [',', rdelim]))
      push!(res, z)
      if b != UInt8(',')
        @assert b == UInt8(rdelim)
        break
      end
    end
    return b, res
  end
end

function parse_array(::Type{Vector{T}}, io, ldelim = '[', rdelim = ']') where {T}
  res = Vector{Vector{T}}()
  b = Base.read(io, UInt8)
  @assert b == UInt8(ldelim)
  mark(io)
  b = Base.read(io, UInt8)
  if b == rdelim
    return res
  else
    reset(io)
    unmark(io)
    while true
      b, z = parse_array(T, io)
      push!(res, z)
      b = Base.read(io, UInt8)
      if b == UInt8(rdelim)
        break
      end
      if b != UInt8(',')
        @assert b == UInt8(rdelim)
        break
      end
    end
    return res
  end
end

#db::Vector{Tuple{Vector{BigInt}, Vector{Vector{Rational{BigInt}}}, Vector{Vector{Rational{BigInt}}}, Int}}
function _parse_quad(io, version)
  @assert version == v"0.0.1"
  b, def_poly = parse_array(fmpq, io)
  @assert b == UInt8(']')
  b = Base.read(io, UInt8)
  @assert b == UInt8(',')
  diagonal = parse_array(Vector{fmpq}, io)
  b = Base.read(io, UInt8)
  @assert b == UInt8(',')
  gens = parse_array(Vector{fmpq}, io)
  b = Base.read(io, UInt8)
  @assert b == UInt8(',')
  b, cl = parse_int(io)
  return def_poly, diagonal, gens, cl
end

function _parse_herm(io, version)
  @assert version == v"0.0.1"
  b, def_poly = parse_array(fmpq, io)
  @assert b == UInt8(']')
  b = Base.read(io, UInt8)
  @assert b == UInt8(',')
  ext_poly = parse_array(Vector{fmpq}, io)
  b = Base.read(io, UInt8)
  @assert b == UInt8(',')
  diagonal = parse_array(Vector{fmpq}, io)
  b = Base.read(io, UInt8)
  @assert b == UInt8(',')
  gens = parse_array(Vector{fmpq}, io)
  b = Base.read(io, UInt8)
  @assert b == UInt8(',')
  b, cl = parse_int(io)
  return def_poly, ext_poly, diagonal, gens, cl
end


text:
import logging
import os

import environ

def str2bool(v: str) -> bool:
    return v.lower() in ("yes", "true", "t", "1")

@environ.config(prefix="")
class AppConfig:
    @environ.config
    class PG:
        name: str = environ.var("fias_db")
        host: str = environ.var("127.0.0.1")
        port: int = environ.var(5432, converter=int)
        user: str = environ.var("fias")
        password: str = environ.var("<FROM ENV>")
        pool_recycle: float = environ.var(30.0, converter=float)

    @environ.config
    class Sphinx:
        listen: str = environ.var("127.0.0.1:9312")
        index_addrobj: str = 'idx_fias_addrobj'
        index_sugg: str = 'idx_fias_sugg'
        min_length_to_star: int = 3
        delta_len: int = 2
        default_rating_delta: int = 2
        regression_coef: float = 0.08
        max_results_count: int = 10
        search_freq_words: bool = True
        suggestions_count = 6
        sphinx_user_uid = 104

        def listen_port(self) -> str:
            if self.listen.startswith('/'):
                return self.listen
            else:
                return self.listen.split(':')[1]

    pg: PG = environ.group(PG)
    sphinx: Sphinx = environ.group(Sphinx)

LOG_LEVEL = logging.DEBUG if str2bool(os.environ.get('APP_DEBUG', '1')) else logging.INFO


text:
<?php

$_POST = json_decode(file_get_contents('php://input'), true);

require_once '../db.php';
require_once '../classes.php';

switch ($_GET['r']) {

	case "basic_info":

	$con = new pdo_db("personal_infos");

	$_POST["update_log"] = "CURRENT_TIMESTAMP";
	$_POST["employee_date_hired"] = ($_POST["employee_date_hired"] == "")?"0000-00-00":date("Y-m-d",strtotime($_POST["employee_date_hired"]));
	$_POST["employee_date_separated"] = ($_POST["employee_date_separated"] == "")?"0000-00-00":date("Y-m-d",strtotime($_POST["employee_date_separated"]));
	$_POST["employee_birthdate"] = ($_POST["employee_birthdate"] == "")?"0000-00-00":date("Y-m-d",strtotime($_POST["employee_birthdate"]));

	$_POST["employee_schedule"] = $_POST["employee_schedule"]["schedule_id"];
	$_POST["employee_appointment_status"] = $_POST["employee_appointment_status"]["as_id"];
	$_POST["employee_department"] = $_POST["employee_department"]["department_id"];
	$_POST["employee_division"] = $_POST["employee_division"]["division_id"];
	$_POST["employee_section"] = $_POST["employee_section"]["section_id"];
	$_POST["employee_employment_status"] = $_POST["employee_employment_status"]["es_id"];
	$_POST["employee_payroll_affiliation"] = $_POST["employee_payroll_affiliation"]["department_id"];
	$_POST["employee_payroll_class"] = $_POST["employee_payroll_class"]["pc_id"];
	$_POST["employee_position"] = $_POST["employee_position"]["position_id"];
	$_POST["employee_separation_cause"] = $_POST["employee_separation_cause"]["sc_id"];
	$_POST["employee_citizenship_country"] = $_POST["employee_citizenship_country"]["name"];
	$_POST["employee_residential_brgy"] = $_POST["employee_residential_brgy"]["barangay_id"];
	$_POST["employee_residential_mun_city"] = $_POST["employee_residential_mun_city"]["municipality_id"];
	$_POST["employee_residential_province"] = $_POST["employee_residential_province"]["province_id"];
	$_POST["employee_permanent_brgy"] = $_POST["employee_permanent_brgy"]["barangay_id"];
	$_POST["employee_permanent_mun_city"] = $_POST["employee_permanent_mun_city"]["municipality_id"];
	$_POST["employee_permanent_province"] = $_POST["employee_permanent_province"]["province_id"];
	$_POST["employee_birthplace_town"] = $_POST["employee_birthplace_town"]["municipality_id"];
	$_POST["employee_birthplace_province"] = $_POST["employee_birthplace_province"]["province_id"];

	$_POST["employee_civil_status_others"] = ($_POST["employee_civil_status"] != "Others")?"":$_POST["employee_civil_status_others"];

	if ($_POST["employee_citizenship"] == "Filipino") {
		$_POST["employee_dual_method"] = "";
		$_POST["employee_citizenship_country"] = "";
	}

	$con->updateData($_POST,"employee_no");

	echo $_POST["employee_no"];

	break;

	case "account_info":

	$Crypt = new Crypt();

	$con = new pdo_db("personal_infos");

	$_POST["employee_password"] = $Crypt->e($_POST["employee_password"]);
	$_POST["employee_group"] = $_POST["employee_group"]["group_id"];
	$con->updateData($_POST,"employee_no");

	echo $_POST["employee_no"];

	break;

	case "family":

	$con_spouse = new pdo_db("spouses");

	if ($_POST['spouse']['spouse_id'] == 0) { // insert
		unset($_POST['spouse']['spouse_id']);
		$spouse = $con_spouse->insertData($_POST['spouse']);
	} else { // update
		$_POST['spouse']['update_log'] = "CURRENT_TIMESTAMP";
		$spouse = $con_spouse->updateData($_POST['spouse'],"spouse_id");
	}

	$con_parent = new pdo_db("parents");

	$_POST['parent']['father_is_dependent'] = ($_POST['parent']['father_is_dependent'] == "true")?1:0;
	$_POST['parent']['mother_is_dependent'] = ($_POST['parent']['mother_is_dependent'] == "true")?1:0;

	if ($_POST['parent']['parent_id'] == 0) { // insert
		unset($_POST['parent']['parent_id']);
		$parent = $con_parent->insertData($_POST['parent']);
	} else { // update
		$_POST['parent']['update_log'] = "CURRENT_TIMESTAMP";
		$parent = $con_parent->updateData($_POST['parent'],"parent_id");
	}

	if (count($_POST['children'])) {

		$con_children = new pdo_db("children");

		foreach ($_POST['children'] as $key => $child) {

			unset($_POST['children'][$key]['disabled']);
			unset($_POST['children'][$key]['valid']);

			$_POST['children'][$key]['is_dependent'] = ($_POST['children'][$key]['is_dependent'])?1:0;

			if ($_POST['children'][$key]['child_birthdate'] == '') unset($_POST['children'][$key]['child_birthdate']);
			else $_POST['children'][$key]['child_birthdate'] = date("Y-m-d",strtotime($_POST['children'][$key]['child_birthdate']));

			if ($child['child_id'] == 0) {
				$insert_child = $con_children->insertData($_POST['children'][$key]);
			} else {
				$_POST['children'][$key]['update_log'] = "CURRENT_TIMESTAMP";
				$update_child = $con_children->updateData($_POST['children'][$key],'child_id');
			}

		}

	}

	if (count($_POST['dels'])) {
		$con_children = new pdo_db("children");
		$delete = $con_children->deleteData(array("child_id"=>implode(",",$_POST['dels'])));
	}

	echo $_POST["spouse"]["spouse_eno"];

	break;

	case "education":

	$con = new pdo_db("educations");

	if (count($_POST['data'])) {

		foreach ($_POST['data'] as $key => $education) {

			unset($_POST['data'][$key]['disabled']);
			unset($_POST['data'][$key]['school_invalid']);

			$_POST['data'][$key]['is_highest_level'] = $_POST['data'][$key]['is_highest_level']['id'];

			$_POST['data'][$key]['education_inclusive_date_from'] = ($_POST['data'][$key]['education_from_to']=="")?"0000":explode("-",$_POST['data'][$key]['education_from_to'])[0];
			$_POST['data'][$key]['education_inclusive_date_to'] = ($_POST['data'][$key]['education_from_to']=="")?"0000":explode("-",$_POST['data'][$key]['education_from_to'])[1];

			unset($_POST['data'][$key]['education_from_to']);

			if ($_POST['data'][$key]['education_year_graduated'] == '') unset($_POST['data'][$key]['education_year_graduated']);

			if ($_POST['data'][$key]['education_id'] == 0) {
				unset($_POST['data'][$key]['education_id']);
				$_POST['data'][$key]['education_type'] = $_POST['data'][$key]['education_type']['el_id'];
				$_POST['data'][$key]['education_school'] = $_POST['data'][$key]['education_school']['es_id'];
				$_POST['data'][$key]['education_degree'] = $_POST['data'][$key]['education_degree']['ec_id'];
				$insert = $con->insertData($_POST['data'][$key]);
			} else {
				$_POST['data'][$key]['update_log'] = "CURRENT_TIMESTAMP";
				$_POST['data'][$key]['education_type'] = $_POST['data'][$key]['education_type']['el_id'];
				$_POST['data'][$key]['education_school'] = $_POST['data'][$key]['education_school']['es_id'];
				$_POST['data'][$key]['education_degree'] = $_POST['data'][$key]['education_degree']['ec_id'];
				$update = $con->updateData($_POST['data'][$key],"education_id");
			}

		}

	echo $_POST['data'][0]["education_eno"];

	}

	if (count($_POST['dels'])) {

		$delete = $con->deleteData(array("education_id"=>implode(",",$_POST['dels'])));

	}

	break;

	case "eligibility":

	$con = new pdo_db("eligibilities");

	if (count($_POST['data'])) {

		foreach ($_POST['data'] as $key => $eligibility) {

			unset($_POST['data'][$key]['disabled']);
			unset($_POST['data'][$key]['title_invalid']);
			unset($_POST['data'][$key]['rating_invalid']);
			unset($_POST['data'][$key]['eligibility_date_str']);

			$_POST['data'][$key]['eligibility_rating'] = $_POST['data'][$key]['eligibility_rating']/100;

			if ($_POST['data'][$key]['eligibility_date'] == "") $_POST['data'][$key]['eligibility_date'] = "0000-00-00";
			if ($_POST['data'][$key]['eligibility_release_date'] == "") $_POST['data'][$key]['eligibility_release_date'] = "0000-00-00";

			if ($_POST['data'][$key]['eligibility_id'] == 0) {
				unset($_POST['data'][$key]['eligibility_id']);
				$_POST['data'][$key]['eligibility_type'] = $_POST['data'][$key]['eligibility_type']['et_id'];
				$insert = $con->insertData($_POST['data'][$key]);
			} else {
				$_POST['data'][$key]['update_log'] = "CURRENT_TIMESTAMP";
				$_POST['data'][$key]['eligibility_type'] = $_POST['data'][$key]['eligibility_type']['et_id'];
				$update = $con->updateData($_POST['data'][$key],"eligibility_id");
			}

		}

	echo $_POST['data'][0]["eligibility_eno"];

	}

	if (count($_POST['dels'])) {

		$delete = $con->deleteData(array("eligibility_id"=>implode(",",$_POST['dels'])));

	}

	break;

	case "service_records":

	$con = new pdo_db("service_records");

	if (count($_POST['data'])) {

		foreach ($_POST['data'] as $key => $service_record) {

			unset($_POST['data'][$key]['disabled']);
			unset($_POST['data'][$key]['company_invalid']);
			unset($_POST['data'][$key]['from_str']);
			unset($_POST['data'][$key]['to_str']);

			$_POST['data'][$key]['service_record_inclusive_date_from'] = ($_POST['data'][$key]['service_record_from_to']=="")?"0000-00-00":date("Y-m-d",strtotime(explode("-",$_POST['data'][$key]['service_record_from_to'])[0]));
			$_POST['data'][$key]['service_record_inclusive_date_to'] = ($_POST['data'][$key]['service_record_from_to']=="")?"0000-00-00":date("Y-m-d",strtotime(explode("-",$_POST['data'][$key]['service_record_from_to'])[1]));

			unset($_POST['data'][$key]['service_record_from_to']);

			if ($_POST['data'][$key]['service_record_salary'] == "") $_POST['data'][$key]['service_record_salary'] = 0;

			if ($_POST['data'][$key]['service_record_id'] == 0) {
				unset($_POST['data'][$key]['service_record_id']);
				$insert = $con->insertData($_POST['data'][$key]);
			} else {
				$_POST['data'][$key]['update_log'] = "CURRENT_TIMESTAMP";
				$update = $con->updateData($_POST['data'][$key],"service_record_id");
			}

		}

	echo $_POST['data'][0]["service_record_eno"];

	}

	if (count($_POST['dels'])) {

		$delete = $con->deleteData(array("service_record_id"=>implode(",",$_POST['dels'])));

	}

	break;

	case "voluntary_works":

	$con = new pdo_db("voluntary_works");

	if (count($_POST['data'])) {

		foreach ($_POST['data'] as $key => $voluntary_work) {

			unset($_POST['data'][$key]['disabled']);
			unset($_POST['data'][$key]['name_invalid']);

			$_POST['data'][$key]['voluntary_work_date_from'] = ($_POST['data'][$key]['voluntary_work_from_to']=="")?"0000-00-00":date("Y-m-d",strtotime(explode("-",$_POST['data'][$key]['voluntary_work_from_to'])[0]));
			$_POST['data'][$key]['voluntary_work_date_to'] = ($_POST['data'][$key]['voluntary_work_from_to']=="")?"0000-00-00":date("Y-m-d",strtotime(explode("-",$_POST['data'][$key]['voluntary_work_from_to'])[1]));

			if ($_POST['data'][$key]['voluntary_work_id'] == 0) {
				unset($_POST['data'][$key]['voluntary_work_id']);
				unset($_POST['data'][$key]['voluntary_work_from_to']);
				$insert = $con->insertData($_POST['data'][$key]);
			} else {
				$_POST['data'][$key]['voluntary_work_date_from'] = ($_POST['data'][$key]['voluntary_work_from_to']=="")?"0000-00-00":date("Y-m-d",strtotime(explode("-",$_POST['data'][$key]['voluntary_work_from_to'])[0]));
				$_POST['data'][$key]['voluntary_work_date_to'] = ($_POST['data'][$key]['voluntary_work_from_to']=="")?"0000-00-00":date("Y-m-d",strtotime(explode("-",$_POST['data'][$key]['voluntary_work_from_to'])[1]));
				$_POST['data'][$key]['update_log'] = "CURRENT_TIMESTAMP";
				unset($_POST['data'][$key]['voluntary_work_from_to']);
				$update = $con->updateData($_POST['data'][$key],"voluntary_work_id");
			}

		}

	echo $_POST['data'][0]["voluntary_work_eno"];

	}

	if (count($_POST['dels'])) {

		$delete = $con->deleteData(array("voluntary_work_id"=>implode(",",$_POST['dels'])));

	}

	break;

	case "trainings":

	$con = new pdo_db("trainings");

	if (count($_POST['data'])) {

		foreach ($_POST['data'] as $key => $training) {

			unset($_POST['data'][$key]['disabled']);
			unset($_POST['data'][$key]['title_invalid']);
			unset($_POST['data'][$key]['training_date_from_str']);
			unset($_POST['data'][$key]['training_date_to_str']);

			$_POST['data'][$key]['training_date_from'] = ($_POST['data'][$key]['training_from_to']=="")?"0000-00-00":date("Y-m-d",strtotime(explode("-",$_POST['data'][$key]['training_from_to'])[0]));
			$_POST['data'][$key]['training_date_to'] = ($_POST['data'][$key]['training_from_to']=="")?"0000-00-00":date("Y-m-d",strtotime(explode("-",$_POST['data'][$key]['training_from_to'])[1]));

			if ($_POST['data'][$key]['training_id'] == 0) {
				unset($_POST['data'][$key]['training_id']);
				unset($_POST['data'][$key]['training_from_to']);
				$insert = $con->insertData($_POST['data'][$key]);
			} else {
				$_POST['data'][$key]['training_date_from'] = ($_POST['data'][$key]['training_from_to']=="")?"0000-00-00":date("Y-m-d",strtotime(explode("-",$_POST['data'][$key]['training_from_to'])[0]));
				$_POST['data'][$key]['training_date_to'] = ($_POST['data'][$key]['training_from_to']=="")?"0000-00-00":date("Y-m-d",strtotime(explode("-",$_POST['data'][$key]['training_from_to'])[1]));
				$_POST['data'][$key]['update_log'] = "CURRENT_TIMESTAMP";
				unset($_POST['data'][$key]['training_from_to']);
				$update = $con->updateData($_POST['data'][$key],"training_id");
			}

		}

	echo $_POST['data'][0]["training_eno"];

	}

	if (count($_POST['dels'])) {

		$delete = $con->deleteData(array("training_id"=>implode(",",$_POST['dels'])));

	}

	break;

	case "other_info":

	$eno = 0;

	if (count($_POST['other_info_skills'])) {

		$con = new pdo_db("other_info_skills");

		foreach ($_POST['other_info_skills']['data'] as $key => $skill) {

			unset($_POST['other_info_skills']['data'][$key]['disabled']);
			unset($_POST['other_info_skills']['data'][$key]['description_invalid']);

			if ($_POST['other_info_skills']['data'][$key]['other_info_skill_id'] == 0) {
				unset($_POST['other_info_skills']['data'][$key]['other_info_skill_id']);
				$insert = $con->insertData($_POST['other_info_skills']['data'][$key]);
			} else {
				$_POST['other_info_skills']['data'][$key]['update_log'] = "CURRENT_TIMESTAMP";
				$update = $con->updateData($_POST['other_info_skills']['data'][$key],"other_info_skill_id");
			}

		}

		if (count($_POST['other_info_skills']['data'])) $eno = $_POST['other_info_skills']['data'][0]["other_info_skill_eno"];

		if (count($_POST['other_info_skills']['dels'])) {

			$_eno = $con->getData("SELECT other_info_skill_eno FROM other_info_skills WHERE other_info_skill_id = ".$_POST['other_info_skills']['dels'][0]);
			$delete = $con->deleteData(array("other_info_skill_id"=>implode(",",$_POST['other_info_skills']['dels'])));
			$eno = $_eno[0]['other_info_skill_eno'];

		}

	}

	if (count($_POST['other_info_recognitions'])) {

		$con = new pdo_db("other_info_recognitions");

		foreach ($_POST['other_info_recognitions']['data'] as $key => $skill) {

			unset($_POST['other_info_recognitions']['data'][$key]['disabled']);
			unset($_POST['other_info_recognitions']['data'][$key]['description_invalid']);

			if ($_POST['other_info_recognitions']['data'][$key]['other_info_recognition_id'] == 0) {
				unset($_POST['other_info_recognitions']['data'][$key]['other_info_recognition_id']);
				$insert = $con->insertData($_POST['other_info_recognitions']['data'][$key]);
			} else {
				$_POST['other_info_recognitions']['data'][$key]['update_log'] = "CURRENT_TIMESTAMP";
				$update = $con->updateData($_POST['other_info_recognitions']['data'][$key],"other_info_recognition_id");
			}

		}

		if (count($_POST['other_info_recognitions']['data'])) $eno = $_POST['other_info_recognitions']['data'][0]["other_info_recognition_eno"];

		if (count($_POST['other_info_recognitions']['dels'])) {

			$_eno = $con->getData("SELECT other_info_recognition_eno FROM other_info_recognitions WHERE other_info_recognition_id = ".$_POST['other_info_recognitions']['dels'][0]);
			$delete = $con->deleteData(array("other_info_recognition_id"=>implode(",",$_POST['other_info_recognitions']['dels'])));
			$eno = $_eno[0]['other_info_recognition_eno'];

		}

	}

	if (count($_POST['other_info_memberships'])) {

		$con = new pdo_db("other_info_memberships");

		foreach ($_POST['other_info_memberships']['data'] as $key => $skill) {

			unset($_POST['other_info_memberships']['data'][$key]['disabled']);
			unset($_POST['other_info_memberships']['data'][$key]['description_invalid']);

			if ($_POST['other_info_memberships']['data'][$key]['other_info_membership_id'] == 0) {
				unset($_POST['other_info_memberships']['data'][$key]['other_info_membership_id']);
				$insert = $con->insertData($_POST['other_info_memberships']['data'][$key]);
			} else {
				$_POST['other_info_memberships']['data'][$key]['update_log'] = "CURRENT_TIMESTAMP";
				$update = $con->updateData($_POST['other_info_memberships']['data'][$key],"other_info_membership_id");
			}

		}

		if (count($_POST['other_info_memberships']['data'])) $eno = $_POST['other_info_memberships']['data'][0]["other_info_membership_eno"];

		if (count($_POST['other_info_memberships']['dels'])) {

			$_eno = $con->getData("SELECT other_info_membership_eno FROM other_info_memberships WHERE other_info_membership_id = ".$_POST['other_info_memberships']['dels'][0]);
			$delete = $con->deleteData(array("other_info_membership_id"=>implode(",",$_POST['other_info_memberships']['dels'])));
			$eno = $_eno[0]['other_info_membership_eno'];

		}

	}

	echo $eno;

	break;

	case "qa":

	if (count($_POST)) {

		$con = new pdo_db("qa");

		foreach ($_POST as $key => $qa) {

			unset($_POST[$key]['invalid']);

			if (!$_POST[$key]['qa_value']) $_POST[$key]['qa_if_yes'] = "";

			if ($_POST[$key]['qa_id'] == 0) {
				unset($_POST[$key]['qa_id']);
				$insert = $con->insertData($_POST[$key]);
			} else {
				$_POST[$key]['update_log'] = "CURRENT_TIMESTAMP";
				$update = $con->updateData($_POST[$key],"qa_id");
			}

		}

		echo $_POST[0]["qa_eno"];

	}

	break;

	case "references":

	$con = new pdo_db("character_references");

	if (count($_POST['data'])) {

		foreach ($_POST['data'] as $key => $reference) {

			unset($_POST['data'][$key]['disabled']);
			unset($_POST['data'][$key]['fullname_invalid']);

			if ($_POST['data'][$key]['cr_id'] == 0) {
				unset($_POST['data'][$key]['cr_id']);
				$insert = $con->insertData($_POST['data'][$key]);
			} else {
				$_POST['data'][$key]['update_log'] = "CURRENT_TIMESTAMP";
				$update = $con->updateData($_POST['data'][$key],"cr_id");
			}

		}

	echo $_POST['data'][0]["cr_eno"];

	}

	if (count($_POST['dels'])) {

		$delete = $con->deleteData(array("cr_id"=>implode(",",$_POST['dels'])));

	}

	break;

}

?>


text:
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)

require 'bundler/setup'
Bundler.require(:development)

require 'coveralls'
Coveralls.wear! unless ENV['SIMPLE_COVERAGE']

begin
  if ENV['SIMPLE_COVERAGE']
    require 'simplecov'
    SimpleCov.start do
      add_group 'Lib', 'lib'

      add_filter '/spec/'
    end
  end
rescue LoadError
  warn '=' * 80
  warn 'simplecov not installed. No coverage report'
  warn '=' * 80
end

#########################################
require 'cookies'
#########################################

Dir[File.join(File.expand_path(__dir__), 'support/**/*.rb')].each { |f| require f }

# This file was generated by the `rspec --init` command. Conventionally, all
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
# Require this file using `require "spec_helper"` to ensure that it is only
# loaded once.
#
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
RSpec.configure do |config|
  config.run_all_when_everything_filtered = true
  config.filter_run :focus

  # Run specs in random order to surface order dependencies. If you find an
  # order dependency and want to debug it, you can fix the order by providing
  # the seed, which is printed after each run.
  #     --seed 1234
  config.order = 'random'
end


text:
import {Component, ViewChild} from '@angular/core';
import {NavController, NavParams, ViewController, IonicPage} from 'ionic-angular';
import {HttpService} from '../../../providers/http.service';
import {TipsService} from "../../../providers/Tips.service";
import {Camera} from "@ionic-native/camera";

@IonicPage({
  segment:'sign/info'
})
@Component({
  selector: 'page-sign-info',
  templateUrl: 'sign-info.html'
})

export class SignInfoPage {
  @ViewChild('fileInput') fileInput;
  private user : Object = JSON.parse(localStorage.getItem('user'));
  private SignInfo : SignInfo = new SignInfo(null,null,0);
  constructor(private navCtrl: NavController,
              private navParams: NavParams,
              private viewCtrl: ViewController,
              private httpService: HttpService,
              private tipsService: TipsService,
              private camera: Camera) {

  }

  getPicture() {
    if (this.camera['installed']) {
      this.camera.getPicture({
        targetWidth: 96,
        targetHeight: 96,
      }).then((data) => {
        this.SignInfo.avatar = 'data:image/jpg;base64,' +  data ;
      }, (err) => {
        this.tipsService.presentToast({meassge : '暂时无法获取照片'})
      })
    } else {
      this.fileInput.nativeElement.click();
    }
  }

  processWebImage(event) {
    let input = this.fileInput.nativeElement;
    var reader = new FileReader();
    reader.onload = (readerEvent) => {
      console.log(readerEvent);
      var imageData = (readerEvent.target as any).result;
      this.SignInfo.avatar = imageData;
    };
    reader.readAsDataURL(event.target.files[0]);
  }

  setGender(gender){
    this.SignInfo.gender = gender;
  }

  getTips(){
    this.tipsService.presentToast({message:'昵称只能是6位中文或12位英文、数字',position:'bottom'});
  }

  doConfirm(){
    if(!this.SignInfo['avatar'] || !this.SignInfo['nickName'] ){
      this.tipsService.presentAlert({subTitle : '以上信息不能为空'});
      return;
    }
    let signinfoUrl = 'http://php.17wxy.com/api/UserCenter/userInfo';
    let params = {
      userId : this.user['uid'],
      userAvatar : this.SignInfo.avatar,
      nickName : this.SignInfo.nickName,
      gender : this.SignInfo.gender
    }
    this.sendHttp(signinfoUrl,params)
  }

  sendHttp(url,params){
    let subscription = this.httpService.postHttp(url,params);
    subscription.subscribe(result => {
      if(result.status === 0){
        localStorage.setItem('user',JSON.stringify(result.user));
        this.viewCtrl.dismiss();
        // this.navCtrl.setRoot('TabsPage',null,{animate:true,direction:'forward'});
      }else if(result.status === 1){
        this.tipsService.presentAlert({subTitle: result.msg});//输出错误信息
      }else{
        this.tipsService.presentAlert({subTitle: '未知错误,请稍后再试'});
      }
    })
  }

  //跳过
  skip(){
    this.viewCtrl.dismiss();
  }
}

export class SignInfo{
  constructor(public avatar : string,
              public nickName : string,
              public gender : number){}
}


text:
package voxngine.graphics;

import static org.lwjgl.glfw.GLFW.GLFW_KEY_F;
import static org.lwjgl.opengl.GL11.GL_CULL_FACE;
import static org.lwjgl.opengl.GL11.GL_DEPTH_TEST;
import static org.lwjgl.opengl.GL11.GL_FILL;
import static org.lwjgl.opengl.GL11.GL_FLOAT;
import static org.lwjgl.opengl.GL11.GL_FRONT_AND_BACK;
import static org.lwjgl.opengl.GL11.GL_LINE;
import static org.lwjgl.opengl.GL11.GL_TRIANGLES;
import static org.lwjgl.opengl.GL11.GL_UNSIGNED_INT;
import static org.lwjgl.opengl.GL11.glDisable;
import static org.lwjgl.opengl.GL11.glDrawArrays;
import static org.lwjgl.opengl.GL11.glDrawElements;
import static org.lwjgl.opengl.GL11.glEnable;
import static org.lwjgl.opengl.GL11.glPolygonMode;
import static org.lwjgl.opengl.GL15.GL_ARRAY_BUFFER;
import static org.lwjgl.opengl.GL15.GL_DYNAMIC_DRAW;
import static org.lwjgl.opengl.GL15.GL_ELEMENT_ARRAY_BUFFER;
import static org.lwjgl.opengl.GL20.GL_FRAGMENT_SHADER;
import static org.lwjgl.opengl.GL20.GL_VERTEX_SHADER;
import static org.lwjgl.opengl.GL20.glEnableVertexAttribArray;
import static org.lwjgl.opengl.GL20.glUniformMatrix4fv;
import static org.lwjgl.opengl.GL20.glVertexAttribPointer;
import static org.lwjgl.stb.STBTruetype.stbtt_GetPackedQuad;

import java.nio.FloatBuffer;
import java.nio.IntBuffer;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.Callable;
import java.util.concurrent.Executors;

import org.joml.Matrix4f;
import org.joml.Vector3f;
import org.lwjgl.BufferUtils;
import org.lwjgl.stb.STBTTAlignedQuad;
import org.lwjgl.stb.STBTTPackedchar;

import voxngine.camera.Camera;
import voxngine.camera.TPCamera;
import voxngine.graphics.shaders.Shader;
import voxngine.graphics.shaders.ShaderProgram;
import voxngine.graphics.textures.Font;
import voxngine.io.Controlls;
import voxngine.io.ScreenMessage;
import voxngine.io.Window;
import voxngine.threading.NonBlockingExecutor;
import voxngine.threading.NonBlockingFuture;
import voxngine.utils.BufferManager;

public class RenderEngine {

	int count;

	private int numTextVertices;
	private int num3DVertices;
	private int totalDepictedEntities;

	private NonBlockingExecutor executor =
            new NonBlockingExecutor(Executors.newSingleThreadExecutor());

	private BufferManager bufferManager;

    private Vao textVao;
    private Rbo textVbo;

    private Map<Integer, Map<String, RenderObject>> renderObjects = new HashMap<Integer, Map<String, RenderObject>>();

	private ShaderProgram textShaderProgram;
	private ShaderProgram shaderProgram;
	private int matLocation;

	private Camera cam = new TPCamera();
	static boolean wireframe;

    private FloatBuffer textVertices;
	private final STBTTAlignedQuad q  = new STBTTAlignedQuad();
	private final FloatBuffer      xb = BufferUtils.createFloatBuffer(1);
	private final FloatBuffer      yb = BufferUtils.createFloatBuffer(1);

	public RenderEngine() {
		bufferManager = new BufferManager();
	}

	public int registerMesh(Mesh mesh) {

		Map<String, RenderObject> roMap = buildRenderObject(mesh);
		mesh.clear();
		int id = renderObjects.size();

		renderObjects.put(id, roMap);

		return id;
	}

	public void updateMesh(int id, Mesh mesh) {
		Map<String, RenderObject> newRoMap = buildRenderObject(mesh);
		renderObjects.replace(id, renderObjects.get(id), newRoMap);
		mesh.clear();
	}

	public void updateDepictedEntityCount(int count) {
		totalDepictedEntities += count;
	}

	private Map<String, RenderObject> buildRenderObject(Mesh mesh) {

		Vao vao = new Vao();
		vao.setCount(mesh.getEntityCount());
		vao.bind();

		FloatBuffer verticesBuffer = bufferManager.getFloatBuffer();
		verticesBuffer.put(mesh.getVertArray());
		verticesBuffer.flip();

		// Create a Buffer Object and upload the vertices buffer
        Rbo vbo = new Rbo(GL_ARRAY_BUFFER);
        vbo.bind();
        vbo.uploadData(verticesBuffer, GL_DYNAMIC_DRAW);
        vbo.setCount(mesh.getIndecesArray().length);

        bufferManager.releaseFLoatBuffer(verticesBuffer);

        IntBuffer entityBuffer = bufferManager.getIntBuffer();
        entityBuffer.put(mesh.getIndecesArray());
        entityBuffer.flip();

        // Create a Buffer Object and upload the vertices buffer
        Rbo ebo = new Rbo(GL_ELEMENT_ARRAY_BUFFER);
        ebo.bind();
        ebo.uploadData(entityBuffer, GL_DYNAMIC_DRAW);
        ebo.setCount(mesh.getEntityCount());

        bufferManager.releaseIntBuffer(entityBuffer);

        mesh.clear();

        // The size of float, in bytes (will be 4)
        final int sizeOfFloat = Float.SIZE / Byte.SIZE;

        // The sizes of the vertex and color components
        final int vertexSize = 3 * sizeOfFloat;
        final int colorSize  = 4 * sizeOfFloat;

        // The 'stride' is the sum of the sizes of individual components
        final int stride = vertexSize + colorSize;

        // The 'offset is the number of bytes from the start of the tuple
        final long offsetPosition = 0;
        final long offsetColor    = 3 * sizeOfFloat;

        // Setup pointers using 'stride' and 'offset' we calculated above
        glVertexAttribPointer(0, 3, GL_FLOAT, false, stride, offsetPosition);
        glVertexAttribPointer(1, 4, GL_FLOAT, false, stride, offsetColor);
        //glVertexAttribPointer(2, 3, GL_FLOAT, false, stride, offsetPosition);

		 // Enable the vertex attribute locations
        glEnableVertexAttribArray(0);
        glEnableVertexAttribArray(1);
        //glEnableVertexAttribArray(2);

        vao.unbind();

		Map<String, RenderObject> rboMap = new HashMap<String, RenderObject>();

		rboMap.put("VAO", vao);
		rboMap.put("VBO", vbo);
		rboMap.put("EBO", ebo);

		return rboMap;
	}

	public void initShaders() {

		shaderProgram = new ShaderProgram();

		Shader vShad = shaderProgram.loadShader(GL_VERTEX_SHADER, "src/main/resources/shaders/default.vs");
		shaderProgram.attachShader(vShad);
		vShad.delete();

		Shader fShad = shaderProgram.loadShader(GL_FRAGMENT_SHADER, "src/main/resources/shaders/default.fs");
		shaderProgram.attachShader(fShad);
		fShad.delete();

		shaderProgram.link();

		matLocation = shaderProgram.getUniformLocation("viewProjMatrix");

		cam.init();
	}

	public void initText() {
		textVao = new Vao();

		textVbo = new Rbo(GL_ARRAY_BUFFER);

		 /* Create FloatBuffer */
		//We need to flush the render when we exceed this buffers capacity
        textVertices = BufferUtils.createFloatBuffer(4096*10);

        textVao.bind();

        /* Upload null data to allocate storage for the VBO */
        long size = textVertices.capacity() * Float.BYTES;
        textVbo.bind();
        textVbo.uploadData(size, GL_DYNAMIC_DRAW);

        /* Initialize variables */
        numTextVertices = 0;

        textShaderProgram = new ShaderProgram();

		Shader vShad = textShaderProgram.loadShader(GL_VERTEX_SHADER, "src/main/resources/shaders/text.vs");
		textShaderProgram.attachShader(vShad);
		vShad.delete();

		Shader fShad = textShaderProgram.loadShader(GL_FRAGMENT_SHADER, "src/main/resources/shaders/text.fs");
		textShaderProgram.attachShader(fShad);
		fShad.delete();

		textShaderProgram.link();
		textShaderProgram.bind();

		 /* Specify Vertex Pointer */
        int posAttrib = textShaderProgram.getAttributeLocation("fontPos");
        textShaderProgram.enableVertexAttribute(posAttrib);
        textShaderProgram.pointVertexAttribute(posAttrib, 2, 7 * Float.BYTES, 0);

        /* Specify Color Pointer */
        int colAttrib = textShaderProgram.getAttributeLocation("fontColor");
        textShaderProgram.enableVertexAttribute(colAttrib);
        textShaderProgram.pointVertexAttribute(colAttrib, 3, 7 * Float.BYTES, 2 * Float.BYTES);

        /* Specify Texture Pointer */
        int texAttrib = textShaderProgram.getAttributeLocation("fontTexcoord");
        textShaderProgram.enableVertexAttribute(texAttrib);
        textShaderProgram.pointVertexAttribute(texAttrib, 2, 7 * Float.BYTES, 5 * Float.BYTES);

        /* Set texture uniform */
        int uniTex = textShaderProgram.getUniformLocation("texImage");
        textShaderProgram.setUniform(uniTex, 0);

        /* Set model matrix to identity matrix */
        Matrix4f model = new Matrix4f();
        int uniModel = textShaderProgram.getUniformLocation("model");
        textShaderProgram.setUniform(uniModel, model);

        /* Set view matrix to identity matrix */
        Matrix4f view = new Matrix4f();
        int uniView = textShaderProgram.getUniformLocation("view");
        textShaderProgram.setUniform(uniView, view);

        /* Set projection matrix to an orthographic projection */
        Matrix4f projection = new Matrix4f();
        int uniProjection = textShaderProgram.getUniformLocation("projection");
        textShaderProgram.setUniform(uniProjection, projection.ortho(0.0f, Window.WIDTH, Window.HEIGHT, 0.0f, -1.0f, 1.0f));

	}

	public void input(Controlls controlls) {
		cam.input(controlls);
		if(controlls.getKeyboad().activeKeyEvent()) {
			if(controlls.getKeyboad().isKeyDown(GLFW_KEY_F)) {
				if(wireframe) {
					wireframe = false;
				} else {
					wireframe = true;
				}
			}
		}
	}

	public void update(float delta) {
		cam.update(delta);
	}

	public void render() {
		render3d();
		renderText();
	}

	private void render3d() {

		glEnable(GL_DEPTH_TEST);
		glEnable(GL_CULL_FACE);

		if(wireframe) {
			glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
		} else {
			glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
		}

		FloatBuffer fb = cam.getMVMatrix();

		num3DVertices=0;

		renderObjects.values().stream().forEach(rboMap -> {
			Vao vao = (Vao) rboMap.get("VAO");
			int entities = vao.getCount();

			vao.bind();

            shaderProgram.bind();

            glUniformMatrix4fv(matLocation, false, fb);
            glDrawElements(GL_TRIANGLES, (36*entities)+1, GL_UNSIGNED_INT, 1);

            shaderProgram.unbind();
            vao.unbind();

            num3DVertices+=(36*entities);

		});

		Window.queScreenMessage("DebugOverlay", new ScreenMessage("Total Rendered Cubes: "+num3DVertices/36));
		Window.queScreenMessage("DebugOverlay", new ScreenMessage("Verts: "+num3DVertices));
		Window.queScreenMessage("DebugOverlay", new ScreenMessage("Total Depicted Cubes: "+totalDepictedEntities));
		totalDepictedEntities=0;
	}

	private void renderText() {

		if (numTextVertices > 0) {
			glDisable(GL_CULL_FACE);
			glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
			textVertices.flip();
            textVao.bind();
            textShaderProgram.bind();
            /* Upload the new vertex data */
            textVbo.bind();
            textVbo.uploadSubData(0, textVertices);
            /* Draw batch */
            glDrawArrays(GL_TRIANGLES, 0, numTextVertices);
            /* Clear vertex data for next batch */
            numTextVertices = 0;
        }

		textVertices.clear();
	}

	public Camera getCamera() {
		return this.cam;
	}

	public void dispose() {

		renderObjects.values().stream().forEach(rbo -> {
			((Vao) rbo.get("VAO")).unbind();
			((Rbo) rbo.get("VBO")).unbind();
			((Rbo) rbo.get("EBO")).unbind();
		});

		if(shaderProgram!=null)shaderProgram.delete();

		textVao.delete();
		textVbo.delete();
		if(textShaderProgram!=null)textShaderProgram.delete();

	}

	private void drawBoxTC(float x1, float y1, float x2, float y2, float s1, float t1, float s2, float t2, Vector3f c) {
		float r = c.x;
        float g = c.y;
        float b = c.z;

        textVertices.put(x1).put(y1).put(r).put(g).put(b).put(s1).put(t1);
        textVertices.put(x1).put(y2).put(r).put(g).put(b).put(s1).put(t2);
        textVertices.put(x2).put(y2).put(r).put(g).put(b).put(s2).put(t2);

        textVertices.put(x1).put(y1).put(r).put(g).put(b).put(s1).put(t1);
        textVertices.put(x2).put(y2).put(r).put(g).put(b).put(s2).put(t2);
        textVertices.put(x2).put(y1).put(r).put(g).put(b).put(s2).put(t1);

        numTextVertices += 6;
	}

	public void print(float x, float y, Font font, String text) {
		print(x, y, font, text, new Vector3f(1f,1f,1f));
	}

	public void print(float x, float y, Font font, String text, Vector3f color) {
		xb.put(0, x);
		yb.put(0, y);

		font.getChardata().position(font.getFontTexture().getId() * 128 * STBTTPackedchar.SIZEOF);

		font.getFontTexture().bind();

		for ( int i = 0; i < text.length(); i++ ) {
			stbtt_GetPackedQuad(font.getChardata(), font.getBitMapW(), font.getBitMapH(), text.charAt(i), xb, yb, q.buffer(), 0);
			drawBoxTC(
				q.getX0(), q.getY0(), q.getX1(), q.getY1(),
				q.getS0(), q.getT0(), q.getS1(), q.getT1(),
				color
			);
		}
	}

	public <T> NonBlockingFuture<T> call(Callable<T> callable) {
		return executor.submitNonBlocking(callable);
	}

}


text:
package uk.joshiejack.furniture;

import net.minecraftforge.event.entity.player.EntityItemPickupEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;

@SuppressWarnings("unused")
@Mod.EventBusSubscriber(modid = Furniture.MODID)
public class BasketEvents {
    @SubscribeEvent
    public static void onItemPickup(EntityItemPickupEvent event) {
        //TODO: Make the basket work
        /*
        IItemHandler basket = EntityBasket.getBasketForPlayer(event.getEntityPlayer());
        if (basket != null) {
            ItemStack stack = event.getItem().getItem();
            ItemStack result = ItemHandlerHelper.insertItem(basket, stack, true);
            if (result.isEmpty()) {
                event.getItem().setDead();
                event.setCanceled(true);
                ItemHandlerHelper.insertItem(basket, stack, false);
            }
        } */
    }
}


text:
<?php
require 'connection.inc.php';
require 'core.inc.php';

?>

        <meta charset="UTF-8"/>
        <title>
                New User Account Creation
        </title>

        <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">

        <link rel="stylesheet" type="text/css" href="css/stylesheet.css" media="screen" />
        <link rel="stylesheet" type="text/css" href="css/signInStyles.css" media="screen" />
        <link href='https://fonts.googleapis.com/css?family=Montserrat:400,700' rel='stylesheet' type='text/css'>
        <link href='https://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>

            <form action="insertNewUser.php"  method="POST" onsubmit="return validate()">

                        <form>
                            <input type="text" name="username" id="username" placeholder="Username">
                            <input type="text" name="firstName" id="firstName" placeholder="First Name">
                            <input type="text" name="lastName" id="lastName" placeholder="Last Name">
                            <input type="text" name="email" id="email" placeholder="Email">
                            <input type="password" name="password" id="password" placeholder="Password">
                            <input type="password" name="passwordCheck" id="passwordCheck" placeholder="Re-Enter Password">
                            <input type="submit" name="login" class="login loginmodal-submit" value="Create New Account">

                        </form>

                            Have an Exsiting Account?

            </form>


text:
To create different variants of the same feature, but avoid code
duplications within plugins, you have multiple options:

- Define a needs clause in a [contract](/doc/CONTRACT.ini) and reuse another
  plugin as it is. This should be preferred for filter and validation
  tasks.
- Have common code together in a helper library (or core library),
  see the CMake function `add_lib` for creating such a library
  (in the folder libs).
  This should be used for rather common functionality that might
  be useful for many plugins or even applications.
- Have configuration for plugins (See [elektraPluginGetConfig()](https://doc.libelektra.org/api/master/html/group__plugin.html)
  and dynamically switch with `if` according to the configuration.
  This should be preferred when you want to (de)activate some
  features of a plugin at run-time.
- Or use compilation variants to compile the plugin code multiple
  times with different `COMPILE_DEFINITIONS` (that are Macro definitions).
  This should be preferred when different macro definitions
  lead to different plugins.
  It should especially be used when the resulting plugins have different
  dependencies: it is possible to have different `LINK_LIBRARIES`.

The advantage of compilation variants are:

- No run-time overhead
- Can be used during bootstrapping (when no configuration is available)
- Different compilation variants can be built at once (no recompilation
  with different CMake flags required)
- Different compilation variants can have different dependencies
- Different compilation variants can be mounted without `#refnames`

## How to use It

To use compilation variants, add your plugin in the CMake Cache
Variable `PLUGINS` multiple times.
Then there can be an arbitrary number of variants.
As naming convention you should have a base name with an additional
variant appended with underscore, e.g.:

```cmake
myplugin_varianta;myplugin_variantb
```

In the CMakeLists.txt of your plugin, you have two options.
Option (A): When you can easily enlist every variant you
simply list all plugins one after the other (_outside of_ `if (DEPENDENCY_PHASE)`):

```cmake
add_plugin(myplugin_varianta
	SOURCES      <your sources for varianta here..>
	COMPILE_DEFINITIONS   VARIANTA ELEKTRA_VARIANT=varianta
	LINK_LIBRARIES <libraries for varianta>
	)
add_plugin(myplugin_variantb
	SOURCES      <your sources for variantb here..>
	COMPILE_DEFINITIONS   VARIANTB  ELEKTRA_VARIANT=variantb
	LINK_LIBRARIES <libraries for variantb>
	)
```

Option (B): If you cannot enlist every possible compilation variant,
you can iterate over all PLUGINS and check which names are requested.
Then you create a plugin for every name that matches:

```cmake
foreach (plugin ${PLUGINS})
	if (${plugin} MATCHES "myplugin_.*")
		# somehow process the variant names and include
		# or change sources and compile definitions
		# based on that.
		add_plugin(${plugin}
		SOURCES      <your sources here..>
		COMPILE_DEFINITIONS   <definitions here..>
			ELEKTRA_VARIANT=${plugin without prefix}
	LINK_LIBRARIES <libraries for variantb>
	if (${plugin} MATCHES "ALL")
		# handle categories of plugins
		add_plugin(myplugin_all1, ...)
		add_plugin(myplugin_all2, ...)
```

For the categories such as `ALL`, however, you need to automatically
append (using `add_plugin`) a useful set of plugins.

Note that every plugin needs to have
`ELEKTRA_VARIANT` differently set in `COMPILE_DEFINITIONS`, otherwise you will
get a linker error that `libelektra_<pluginname>_LTX_elektraPluginSymbol` has
multiple definitions.

Now every public function of the plugin conflicts with itself. To avoid
that, you can use:

- static functions, but they are only visible within one file.
  This should be preferred, when possible.
- use helper libraries using `add_lib` to share code
  between compilation variants
  (only if code is also potentially useful for other plugins/applications)
- Get a unique name for every variant using the macro
  `ELEKTRA_PLUGIN_FUNCTION(myplugin, open)` where myplugin is
  the name of the plugin and the second argument is how the function
  should be called.
- Including a readme for every variant (with `#ifdef` for different text)
  using the macro `#include ELEKTRA_README(myplugin)`

As a summary, you can have many plugins build out of the same source.
Using `pluginname_variantnames` many plugins will be compiled, each
with other `SOURCES` or `COMPILE_DEFINITIONS` and even `LINK_LIBRARIES`:
If you, e.g. just set
the variants name as macro you can use

```c
#ifdef varianta
#endif
```

within the code and can have two plugins: one (called `myplugin_varianta`)
compiled included the `#ifdef` the other (base variant called
`myplugin`) without.

Currently compilation variants are used in
[the resolver plugin](https://master.libelektra.org/src/plugins/resolver/resolver.c).


text:
namespace InfluxData.Net.InfluxDb.Enums
{
    public enum TaskType
    {
        Stream,
        Batch
    }
}


text:
/**<#-- This CSS source is a Freemarker template and is supposed to be included. -->*/
@media
only screen and (max-width: 1018px),
(min-device-width: 768px) and (max-device-width: 1024px)  {

    table#itemsList,
    table#itemsList thead,
    table#itemsList tbody,
    table#itemsList th,
    table#itemsList td,
    table#itemsList tr {
        display: block;
    }

    table#itemsList th {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }

    table#itemsList tr { border: 1px solid #ccc; }

    table#itemsList td {
        border: none;
        border-bottom: 1px solid #eee;
        position: relative;
        padding-left: 30%;
    }

    table#itemsList td:before {
        position: absolute;
        top: 6px;
        left: 6px;
        width: 45%;
        padding-right: 10px;
        white-space: nowrap;
    }

    table#itemsList td:nth-of-type(1):before { content: "${i18n('adminUsersEventId')}"; }
    table#itemsList td:nth-of-type(2):before { content: "${i18n('adminUsersEventType')}"; }
    table#itemsList td:nth-of-type(3):before { content: "${i18n('adminUsersEventTarget')}"; }
    table#itemsList td:nth-of-type(4):before { content: "${i18n('adminUsersEventIP')}"; }
    table#itemsList td:nth-of-type(5):before { content: "${i18n('adminUsersEventTime')}"; }

    table#itemsList a .glyphicon { font-size: 22px; }
    table#itemsList a .event-info { display:block; }
}


text:
"""Constants for the Zerproc integration."""
DOMAIN = "zerproc"

DATA_ADDRESSES = "addresses"
DATA_DISCOVERY_SUBSCRIPTION = "discovery_subscription"