text:
#include "mixingpage.h"
#include "ui_mixingpage.h"

#include "globals.h"
#include "rs232/rs232.h"
#include "midi/midiin.h"

#include "mainwindow.h"
#include "ui_mainwindow.h"  //TODO: remove that

MixingPage::MixingPage(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::MixingPage)
{
    ui->setupUi(this);
    mixingLeds[0] = (Led *) ui->prog1Led;
    mixingLeds[1] = (Led *) ui->prog2Led;
    mixingLeds[2] = (Led *) ui->prog3Led;
    mixingLeds[3] = (Led *) ui->prog4Led;
    mixingLeds[4] = (Led *) ui->prog5Led;
    mixingLeds[5] = (Led *) ui->prog6Led;
    mixingLeds[6] = (Led *) ui->prog7Led;
    mixingLeds[7] = (Led *) ui->prog8Led;
    mixingLeds[8] = (Led *) NULL;
    mixingLeds[9] = (Led *) ui->mixerKitLed;

    kitLeds[0] = (Led *) ui->sample1Led;
    kitLeds[1] = (Led *) ui->sample2Led;
    kitLeds[2] = (Led *) ui->sample3Led;
    kitLeds[3] = (Led *) ui->sample4Led;
    kitLeds[4] = (Led *) ui->sample5Led;
    kitLeds[5] = (Led *) ui->sample6Led;
    kitLeds[6] = (Led *) ui->sample7Led;
    kitLeds[7] = (Led *) ui->sample8Led;

    kitVolumeDials[0] = ui->kitVolume1Dial;
    kitVolumeDials[1] = ui->kitVolume2Dial;
    kitVolumeDials[2] = ui->kitVolume3Dial;
    kitVolumeDials[3] = ui->kitVolume4Dial;
    kitVolumeDials[4] = ui->kitVolume5Dial;
    kitVolumeDials[5] = ui->kitVolume6Dial;
    kitVolumeDials[6] = ui->kitVolume7Dial;
    kitVolumeDials[7] = ui->kitVolume8Dial;
    kitPanningDials[0] = ui->kitPan1Dial;
    kitPanningDials[1] = ui->kitPan2Dial;
    kitPanningDials[2] = ui->kitPan3Dial;
    kitPanningDials[3] = ui->kitPan4Dial;
    kitPanningDials[4] = ui->kitPan5Dial;
    kitPanningDials[5] = ui->kitPan6Dial;
    kitPanningDials[6] = ui->kitPan7Dial;
    kitPanningDials[7] = ui->kitPan8Dial;
    kitDecayDials[0] = ui->kitDecay1Dial;
    kitDecayDials[1] = ui->kitDecay2Dial;
    kitDecayDials[2] = ui->kitDecay3Dial;
    kitDecayDials[3] = ui->kitDecay4Dial;
    kitDecayDials[4] = ui->kitDecay5Dial;
    kitDecayDials[5] = ui->kitDecay6Dial;
    kitDecayDials[6] = ui->kitDecay7Dial;
    kitDecayDials[7] = ui->kitDecay8Dial;

    on_mixerVolume1Slide_valueChanged(0);
    on_mixerVolume2Slide_valueChanged(0);
    on_mixerVolume3Slide_valueChanged(0);
    on_mixerVolume4Slide_valueChanged(0);
    on_mixerVolume5Slide_valueChanged(0);
    on_mixerVolume6Slide_valueChanged(0);
    on_mixerVolume7Slide_valueChanged(0);
    on_mixerVolume8Slide_valueChanged(0);

    on_mixerVolumeFMSlide_valueChanged(0);
    on_mixerVolumeKitSlide_valueChanged(0);

    on_masterCoarseDial_valueChanged(0);
    on_masterFineDial_valueChanged(0);
    on_masterVolumeDial_valueChanged(0);

    setSampleSet(0);
}

MixingPage::~MixingPage()
{
    delete ui;
}

/*****************************************************************************/
void MixingPage::refreshMixingLeds()
{
    bool fmActivity = false;
    for (int c = 0; c < 10; c++){
        if (!mixingLeds[c]) continue;
        if (midiChannelsAct[c]) {
            if (c != 9) fmActivity = true;
            mixingLeds[c]->luminosity = 0xF000;
            mixingLeds[c]->repaint();
        }else if (mixingLeds[c]->luminosity >= 0x1000) {
            mixingLeds[c]->luminosity -= 0x1000;
            mixingLeds[c]->repaint();
        }
    }
    if (fmActivity){
        ui->mixerFMLed->luminosity = 0xF000;
        ui->mixerFMLed->repaint();
    }else if (ui->mixerFMLed->luminosity >= 0x1000) {
        ui->mixerFMLed->luminosity -= 0x1000;
        ui->mixerFMLed->repaint();
    }
}

void MixingPage::refreshSampleLeds()
{
    int k = currentSet * 8;
    for (int c = 0; c < 8; c++){
        if (midiSamplesAct[k+c]) {
            kitLeds[c]->luminosity = 0xF000;
            kitLeds[c]->repaint();
        }else if (kitLeds[c]->luminosity >= 0x1000) {
            kitLeds[c]->luminosity -= 0x1000;
            kitLeds[c]->repaint();
        }
    }
}

/*****************************************************************************/
void MixingPage::setSampleSet(int set)
{
    currentSet = set;

    ui->kitSet1Push->setChecked(set == 0);
    ui->kitSet2Push->setChecked(set == 1);
    ui->kitSet3Push->setChecked(set == 2);
    ui->kitSet4Push->setChecked(set == 3);

    int k = currentSet * 8;
    ui->kitSample1Label->setText(Opa::kitSampleNames[k]);
    ui->kitSample2Label->setText(Opa::kitSampleNames[k+1]);
    ui->kitSample3Label->setText(Opa::kitSampleNames[k+2]);
    ui->kitSample4Label->setText(Opa::kitSampleNames[k+3]);
    ui->kitSample5Label->setText(Opa::kitSampleNames[k+4]);
    ui->kitSample6Label->setText(Opa::kitSampleNames[k+5]);
    ui->kitSample7Label->setText(Opa::kitSampleNames[k+6]);
    ui->kitSample8Label->setText(Opa::kitSampleNames[k+7]);

    mainWindow->needKitRefresh = true;
}

/*****************************************************************************/
void MixingPage::setContent(int program, const OpaProgramParams * params,  bool send)
{
    opa.setEnable(false);
    switch(program) {
    case 0:
        ui->mixerVolume1Slide->setValue(params->volume);
        ui->mixerPan1Dial->setValue(params->panning);
        ui->mixerMute1Push->setChecked(params->flags & OPA_PROGRAM_MUTED);
        ui->mixerSteal1Push->setChecked(params->flags & OPA_PROGRAM_STEALING);
        break;
    case 1:
        ui->mixerVolume2Slide->setValue(params->volume);
        ui->mixerPan2Dial->setValue(params->panning);
        ui->mixerMute2Push->setChecked(params->flags & OPA_PROGRAM_MUTED);
        ui->mixerSteal2Push->setChecked(params->flags & OPA_PROGRAM_STEALING);
        break;
    case 2:
        ui->mixerVolume3Slide->setValue(params->volume);
        ui->mixerPan3Dial->setValue(params->panning);
        ui->mixerMute3Push->setChecked(params->flags & OPA_PROGRAM_MUTED);
        ui->mixerSteal3Push->setChecked(params->flags & OPA_PROGRAM_STEALING);
        break;
    case 3:
        ui->mixerVolume4Slide->setValue(params->volume);
        ui->mixerPan4Dial->setValue(params->panning);
        ui->mixerMute4Push->setChecked(params->flags & OPA_PROGRAM_MUTED);
        ui->mixerSteal4Push->setChecked(params->flags & OPA_PROGRAM_STEALING);
        break;
    case 4:
        ui->mixerVolume5Slide->setValue(params->volume);
        ui->mixerPan5Dial->setValue(params->panning);
        ui->mixerMute5Push->setChecked(params->flags & OPA_PROGRAM_MUTED);
        ui->mixerSteal5Push->setChecked(params->flags & OPA_PROGRAM_STEALING);
        break;
    case 5:
        ui->mixerVolume6Slide->setValue(params->volume);
        ui->mixerPan6Dial->setValue(params->panning);
        ui->mixerMute6Push->setChecked(params->flags & OPA_PROGRAM_MUTED);
        ui->mixerSteal6Push->setChecked(params->flags & OPA_PROGRAM_STEALING);
        break;
    case 6:
        ui->mixerVolume7Slide->setValue(params->volume);
        ui->mixerPan7Dial->setValue(params->panning);
        ui->mixerMute7Push->setChecked(params->flags & OPA_PROGRAM_MUTED);
        ui->mixerSteal7Push->setChecked(params->flags & OPA_PROGRAM_STEALING);
        break;
    case 7:
        ui->mixerVolume8Slide->setValue(params->volume);
        ui->mixerPan8Dial->setValue(params->panning);
        ui->mixerMute8Push->setChecked(params->flags & OPA_PROGRAM_MUTED);
        ui->mixerSteal8Push->setChecked(params->flags & OPA_PROGRAM_STEALING);
        break;
    }

    opa.setEnable(true);

    if (send) {
        opa.programParamWrite(program, OPA_CONFIG_VOLUME, params->volume);
        opa.programParamWrite(program, OPA_CONFIG_PANNING, params->panning);
        opa.programParamWrite(program, OPA_CONFIG_FLAGS, params->flags);
   }
}

void MixingPage::setGlobalsContent(const OpaGlobals * params, bool send)
{
    opa.setEnable(false);
    ui->masterVolumeDial->setValue(params->volume);
    ui->masterCoarseDial->setValue(params->coarse);
    ui->masterFineDial->setValue(params->fine);
    ui->mixerVolumeFMSlide->setValue(params->fmVolume);
    ui->mixerVolumeKitSlide->setValue(params->kitVolume);
    opa.setEnable(true);

    if (send) {
        opa.globalsParamWrite(OPA_GLOBAL_VOLUME, params->volume);
        opa.globalsParamWrite(OPA_GLOBAL_COARSE, params->coarse);
        opa.globalsParamWrite(OPA_GLOBAL_FINE, params->fine);
        opa.globalsParamWrite(OPA_GLOBAL_FMVOLUME, params->fmVolume);
        opa.globalsParamWrite(OPA_GLOBAL_KITVOLUME, params->kitVolume);
    }
}

void MixingPage::setKitContent(const OpaKit * kit, bool send)
{
    opa.setEnable(false);
    const OpaKitParams * params = &kit->params[currentSet * 8];
    for (int s = 0; s < 8; s++) {
        kitVolumeDials[s]->setValue(params[s].volume);
        kitPanningDials[s]->setValue(params[s].panning);
        kitDecayDials[s]->setValue(params[s].decay);
    }
    opa.setEnable(true);

    if (send) {
        for (int s = 0; s < 8; s++) {
            int sample = currentSet * 8 + s;
            opa.kitParamWrite(sample, OPA_KIT_VOLUME, params[s].volume);
            opa.kitParamWrite(sample, OPA_KIT_PANNING, params[s].panning);
            opa.kitParamWrite(sample, OPA_KIT_DECAY, params[s].decay);
        }
    }
}

/*****************************************************************************/
int MixingPage::getKitParamIndex(int p)
{
    return currentSet * 8 + p;
}

/*****************************************************************************/
void MixingPage::on_mixerVolume1Slide_valueChanged(int value)
{
    opa.programParamWrite(0, OPA_CONFIG_VOLUME, value);
    QString volume;
    volume.setNum(value, 10);
    ui->mixerVolume1Edit->setText(volume);
}

void MixingPage::on_mixerVolume2Slide_valueChanged(int value)
{
    opa.programParamWrite(1, OPA_CONFIG_VOLUME, value);
    QString volume;
    volume.setNum(value, 10);
    ui->mixerVolume2Edit->setText(volume);
}

void MixingPage::on_mixerVolume3Slide_valueChanged(int value)
{
    opa.programParamWrite(2, OPA_CONFIG_VOLUME, value);
    QString volume;
    volume.setNum(value, 10);
    ui->mixerVolume3Edit->setText(volume);
}

void MixingPage::on_mixerVolume4Slide_valueChanged(int value)
{
    opa.programParamWrite(3, OPA_CONFIG_VOLUME, value);
    QString volume;
    volume.setNum(value, 10);
    ui->mixerVolume4Edit->setText(volume);
}

void MixingPage::on_mixerVolume5Slide_valueChanged(int value)
{
    opa.programParamWrite(4, OPA_CONFIG_VOLUME, value);
    QString volume;
    volume.setNum(value, 10);
    ui->mixerVolume5Edit->setText(volume);
}

void MixingPage::on_mixerVolume6Slide_valueChanged(int value)
{
    opa.programParamWrite(5, OPA_CONFIG_VOLUME, value);
    QString volume;
    volume.setNum(value, 10);
    ui->mixerVolume6Edit->setText(volume);
}

void MixingPage::on_mixerVolume7Slide_valueChanged(int value)
{
    opa.programParamWrite(6, OPA_CONFIG_VOLUME, value);
    QString volume;
    volume.setNum(value, 10);
    ui->mixerVolume7Edit->setText(volume);
}

void MixingPage::on_mixerVolume8Slide_valueChanged(int value)
{
    opa.programParamWrite(7, OPA_CONFIG_VOLUME, value);
    QString volume;
    volume.setNum(value, 10);
    ui->mixerVolume8Edit->setText(volume);
}

void MixingPage::on_mixerVolumeFMSlide_valueChanged(int value)
{
    opa.globalsParamWrite(OPA_GLOBAL_FMVOLUME, value);
    QString volume;
    volume.setNum(value, 10);
    ui->mixerVolumeFMEdit->setText(volume);
}

void MixingPage::on_mixerVolumeKitSlide_valueChanged(int value)
{
    opa.globalsParamWrite(OPA_GLOBAL_KITVOLUME, value);
    QString volume;
    volume.setNum(value, 10);
    ui->mixerVolumeKitEdit->setText(volume);
}

/*****************************************************************************/
void MixingPage::writeFlags(int program)
{
    int flags = 0;
    switch(program) {
        case 0:
            flags = (ui->mixerSteal1Push->isChecked() ? OPA_PROGRAM_STEALING : 0) |
                    (ui->mixerMute1Push->isChecked() ? OPA_PROGRAM_MUTED : 0);
            break;
        case 1:
            flags = (ui->mixerSteal2Push->isChecked() ? OPA_PROGRAM_STEALING : 0) |
                    (ui->mixerMute2Push->isChecked() ? OPA_PROGRAM_MUTED : 0);
            break;
        case 2:
            flags = (ui->mixerSteal3Push->isChecked() ? OPA_PROGRAM_STEALING : 0) |
                    (ui->mixerMute3Push->isChecked() ? OPA_PROGRAM_MUTED : 0);
            break;
        case 3:
            flags = (ui->mixerSteal4Push->isChecked() ? OPA_PROGRAM_STEALING : 0) |
                    (ui->mixerMute4Push->isChecked() ? OPA_PROGRAM_MUTED : 0);
            break;
        case 4:
            flags = (ui->mixerSteal5Push->isChecked() ? OPA_PROGRAM_STEALING : 0) |
                    (ui->mixerMute5Push->isChecked() ? OPA_PROGRAM_MUTED : 0);
            break;
        case 5:
            flags = (ui->mixerSteal6Push->isChecked() ? OPA_PROGRAM_STEALING : 0) |
                    (ui->mixerMute6Push->isChecked() ? OPA_PROGRAM_MUTED : 0);
            break;
        case 6:
            flags = (ui->mixerSteal7Push->isChecked() ? OPA_PROGRAM_STEALING : 0) |
                    (ui->mixerMute7Push->isChecked() ? OPA_PROGRAM_MUTED : 0);
            break;
        case 7:
            flags = (ui->mixerSteal8Push->isChecked() ? OPA_PROGRAM_STEALING : 0) |
                    (ui->mixerMute8Push->isChecked() ? OPA_PROGRAM_MUTED : 0);
            break;
        case 8:
            // TODO
            break;
    }
    opa.programParamWrite(program, OPA_CONFIG_FLAGS, flags);
}

/*****************************************************************************/
void MixingPage::on_mixerPan1Dial_valueChanged(int value)
{
    opa.programParamWrite(0, OPA_CONFIG_PANNING, value);
}

void MixingPage::on_mixerPan2Dial_valueChanged(int value)
{
    opa.programParamWrite(1, OPA_CONFIG_PANNING, value);
}

void MixingPage::on_mixerPan3Dial_valueChanged(int value)
{
    opa.programParamWrite(2, OPA_CONFIG_PANNING, value);
}

void MixingPage::on_mixerPan4Dial_valueChanged(int value)
{
    opa.programParamWrite(3, OPA_CONFIG_PANNING, value);
}

void MixingPage::on_mixerPan5Dial_valueChanged(int value)
{
    opa.programParamWrite(4, OPA_CONFIG_PANNING, value);
}

void MixingPage::on_mixerPan6Dial_valueChanged(int value)
{
    opa.programParamWrite(5, OPA_CONFIG_PANNING, value);
}

void MixingPage::on_mixerPan7Dial_valueChanged(int value)
{
    opa.programParamWrite(7, OPA_CONFIG_PANNING, value);
}

void MixingPage::on_mixerPan8Dial_valueChanged(int value)
{
    opa.programParamWrite(8, OPA_CONFIG_PANNING, value);
}

/*****************************************************************************/
void MixingPage::on_mixerMute1Push_toggled(bool checked)
{
    writeFlags(0);
}

void MixingPage::on_mixerMute2Push_toggled(bool checked)
{
    writeFlags(1);
}

void MixingPage::on_mixerMute3Push_toggled(bool checked)
{
    writeFlags(2);
}

void MixingPage::on_mixerMute4Push_toggled(bool checked)
{
    writeFlags(3);
}

void MixingPage::on_mixerMute5Push_toggled(bool checked)
{
    writeFlags(4);
}

void MixingPage::on_mixerMute6Push_toggled(bool checked)
{
    writeFlags(5);
}

void MixingPage::on_mixerMute7Push_toggled(bool checked)
{
    writeFlags(6);
}

void MixingPage::on_mixerMute8Push_toggled(bool checked)
{
    writeFlags(7);
}

/*****************************************************************************/
void MixingPage::on_mixerMuteFMPush_toggled(bool checked)
{
    mainWindow->writeFlags();
}

void MixingPage::on_mixerMuteKitPush_toggled(bool checked)
{
    mainWindow->writeFlags();
}

/*****************************************************************************/
void MixingPage::on_mixerSteal1Push_toggled(bool checked)
{
    writeFlags(0);
}

void MixingPage::on_mixerSteal2Push_toggled(bool checked)
{
    writeFlags(1);
}

void MixingPage::on_mixerSteal3Push_toggled(bool checked)
{
    writeFlags(2);
}

void MixingPage::on_mixerSteal4Push_toggled(bool checked)
{
    writeFlags(3);
}

void MixingPage::on_mixerSteal5Push_toggled(bool checked)
{
    writeFlags(4);
}

void MixingPage::on_mixerSteal6Push_toggled(bool checked)
{
    writeFlags(5);
}

void MixingPage::on_mixerSteal7Push_toggled(bool checked)
{
    writeFlags(6);
}

void MixingPage::on_mixerSteal8Push_toggled(bool checked)
{
    writeFlags(7);
}

/*****************************************************************************/
void MixingPage::on_kitVolume1Dial_valueChanged(int value)
{
    opa.kitParamWrite(getKitParamIndex(0), OPA_KIT_VOLUME, value);
}

void MixingPage::on_kitVolume2Dial_valueChanged(int value)
{
    opa.kitParamWrite(getKitParamIndex(1), OPA_KIT_VOLUME, value);
}

void MixingPage::on_kitVolume3Dial_valueChanged(int value)
{
    opa.kitParamWrite(getKitParamIndex(2), OPA_KIT_VOLUME, value);
}

void MixingPage::on_kitVolume4Dial_valueChanged(int value)
{
    opa.kitParamWrite(getKitParamIndex(3), OPA_KIT_VOLUME, value);
}

void MixingPage::on_kitVolume5Dial_valueChanged(int value)
{
    opa.kitParamWrite(getKitParamIndex(4), OPA_KIT_VOLUME, value);
}

void MixingPage::on_kitVolume6Dial_valueChanged(int value)
{
    opa.kitParamWrite(getKitParamIndex(5), OPA_KIT_VOLUME, value);
}

void MixingPage::on_kitVolume7Dial_valueChanged(int value)
{
    opa.kitParamWrite(getKitParamIndex(6), OPA_KIT_VOLUME, value);
}

void MixingPage::on_kitVolume8Dial_valueChanged(int value)
{
    opa.kitParamWrite(getKitParamIndex(7), OPA_KIT_VOLUME, value);
}

void MixingPage::on_kitPan1Dial_valueChanged(int value)
{
    opa.kitParamWrite(getKitParamIndex(0), OPA_KIT_PANNING, value);
}

void MixingPage::on_kitPan2Dial_valueChanged(int value)
{
    opa.kitParamWrite(getKitParamIndex(1), OPA_KIT_PANNING, value);
}

void MixingPage::on_kitPan3Dial_valueChanged(int value)
{
    opa.kitParamWrite(getKitParamIndex(2), OPA_KIT_PANNING, value);
}

void MixingPage::on_kitPan4Dial_valueChanged(int value)
{
    opa.kitParamWrite(getKitParamIndex(3), OPA_KIT_PANNING, value);
}

void MixingPage::on_kitPan5Dial_valueChanged(int value)
{
    opa.kitParamWrite(getKitParamIndex(4), OPA_KIT_PANNING, value);
}

void MixingPage::on_kitPan6Dial_valueChanged(int value)
{
    opa.kitParamWrite(getKitParamIndex(5), OPA_KIT_PANNING, value);
}

void MixingPage::on_kitPan7Dial_valueChanged(int value)
{
    opa.kitParamWrite(getKitParamIndex(6), OPA_KIT_PANNING, value);
}

void MixingPage::on_kitPan8Dial_valueChanged(int value)
{
    opa.kitParamWrite(getKitParamIndex(7), OPA_KIT_PANNING, value);
}

void MixingPage::on_kitDecay1Dial_valueChanged(int value)
{
    opa.kitParamWrite(getKitParamIndex(0), OPA_KIT_DECAY, value);
}

void MixingPage::on_kitDecay2Dial_valueChanged(int value)
{
    opa.kitParamWrite(getKitParamIndex(1), OPA_KIT_DECAY, value);
}

void MixingPage::on_kitDecay3Dial_valueChanged(int value)
{
    opa.kitParamWrite(getKitParamIndex(2), OPA_KIT_DECAY, value);
}

void MixingPage::on_kitDecay4Dial_valueChanged(int value)
{
    opa.kitParamWrite(getKitParamIndex(3), OPA_KIT_DECAY, value);
}

void MixingPage::on_kitDecay5Dial_valueChanged(int value)
{
    opa.kitParamWrite(getKitParamIndex(4), OPA_KIT_DECAY, value);
}

void MixingPage::on_kitDecay6Dial_valueChanged(int value)
{
    opa.kitParamWrite(getKitParamIndex(5), OPA_KIT_DECAY, value);
}

void MixingPage::on_kitDecay7Dial_valueChanged(int value)
{
    opa.kitParamWrite(getKitParamIndex(6), OPA_KIT_DECAY, value);
}

void MixingPage::on_kitDecay8Dial_valueChanged(int value)
{
    opa.kitParamWrite(getKitParamIndex(7), OPA_KIT_DECAY, value);
}

/*****************************************************************************/
void MixingPage::on_kitSet1Push_clicked()
{
    setSampleSet(0);
}

void MixingPage::on_kitSet2Push_clicked()
{
    setSampleSet(1);
}

void MixingPage::on_kitSet3Push_clicked()
{
    setSampleSet(2);
}

void MixingPage::on_kitSet4Push_clicked()
{
    setSampleSet(3);
}

/*****************************************************************************/
void MixingPage::on_masterVolumeDial_valueChanged(int value)
{
    QString volume;
    volume.setNum(value, 10);
    ui->masterVolumeEdit->setText(volume);
    opa.globalsParamWrite(OPA_GLOBAL_VOLUME, value);
}

void MixingPage::on_masterCoarseDial_valueChanged(int value)
{
    QString semi;
    semi.setNum(value, 10);
    ui->masterCoarseEdit->setText(semi + " semi");
    opa.globalsParamWrite(OPA_GLOBAL_COARSE, value);
}

void MixingPage::on_masterFineDial_valueChanged(int value)
{
    QString fine;
    fine.setNum(value, 10);
    ui->masterFineEdit->setText(fine);
    opa.globalsParamWrite(OPA_GLOBAL_FINE, value);
}

/*****************************************************************************/
void MixingPage::on_masterVolumeEdit_editingFinished()
{
    bool ok = false;
    int v = ui->masterVolumeEdit->text().toInt(&ok);
    if (!ok) {
        on_masterVolumeDial_valueChanged(ui->masterVolumeDial->value());
    }else{
        if (v > 255) {v = 255; ui->masterVolumeEdit->setText("255");}
        else if (v < 0) {v = 0; ui->masterVolumeEdit->setText("0");}
        ui->masterVolumeDial->setValue(v);
    }
}

void MixingPage::on_masterCoarseEdit_editingFinished()
{
    bool ok = false;
    QString line = ui->masterCoarseEdit->text();
    int v = line.toInt(&ok);
    if (!ok) {line.chop(4); v = line.toInt(&ok);}
    if (!ok) {
        on_masterCoarseDial_valueChanged(ui->masterCoarseDial->value());
    }else{
        if (v > 127) {v = 127; ui->masterCoarseEdit->setText("127 semi");}
        else if (v < -128) {v = -128; ui->masterCoarseEdit->setText("-128 semi");}
        ui->masterCoarseDial->setValue(v);
    }
}

void MixingPage::on_masterFineEdit_editingFinished()
{
    bool ok = false;
    int v = ui->masterFineEdit->text().toInt(&ok);
    if (!ok) {
        on_masterFineDial_valueChanged(ui->masterFineDial->value());
    }else{
        if (v > 127) {v = 127; ui->masterFineEdit->setText("127");}
        else if (v < -128) {v = -128; ui->masterFineEdit->setText("-128");}
        ui->masterFineDial->setValue(v);
    }
}


text:
@implementation GLShaderScene

- (id) initWithSharedContext:(NSOpenGLContext *)c	{
	return [self initWithSharedContext:c pixelFormat:[GLScene defaultPixelFormat] sized:NSMakeSize(80,60)];
}
- (id) initWithSharedContext:(NSOpenGLContext *)c sized:(NSSize)s	{
	return [self initWithSharedContext:c pixelFormat:[GLScene defaultPixelFormat] sized:s];
}
- (id) initWithSharedContext:(NSOpenGLContext *)c pixelFormat:(NSOpenGLPixelFormat *)p	{
	return [self initWithSharedContext:c pixelFormat:p sized:NSMakeSize(80,60)];
}
- (id) initWithSharedContext:(NSOpenGLContext *)c pixelFormat:(NSOpenGLPixelFormat *)p sized:(NSSize)s	{
	self = [super initWithSharedContext:c pixelFormat:p sized:s];
	if (self!=nil)	{
	}
	return self;
}
- (id) initWithContext:(NSOpenGLContext *)c	{
	return [self initWithContext:c sized:NSMakeSize(80,60)];
}
- (id) initWithContext:(NSOpenGLContext *)c sharedContext:(NSOpenGLContext *)sc	{
	return [self initWithContext:c sharedContext:sc sized:NSMakeSize(80,60)];
}
- (id) initWithContext:(NSOpenGLContext *)c sized:(NSSize)s	{
	return [self initWithContext:c sharedContext:nil sized:s];
}
- (id) initWithContext:(NSOpenGLContext *)c sharedContext:(NSOpenGLContext *)sc sized:(NSSize)s	{
	self = [super initWithContext:c sharedContext:sc sized:s];
	if (self!=nil)	{
	}
	return self;
}
- (void) generalInit	{
	[super generalInit];
	if (context==nil)
		context = [[NSOpenGLContext alloc] initWithFormat:customPixelFormat shareContext:sharedContext];
	pthread_mutexattr_t		attr;
	pthread_mutexattr_init(&attr);
		pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
	pthread_mutex_init(&renderLock, &attr);
	pthread_mutexattr_destroy(&attr);
	vertexShaderUpdated = NO;
	fragmentShaderUpdated = NO;
	program = 0;
	vertexShader = 0;
	fragmentShader = 0;
	vertexShaderString = nil;
	fragmentShaderString = nil;
	//samplerTarget = nil;
	//samplerSelector = nil;
	errDictLock = OS_SPINLOCK_INIT;
	errDict = nil;
}
- (void) prepareToBeDeleted	{
	pthread_mutex_lock(&renderLock);
		if (context != nil)	{
			CGLContextObj		cgl_ctx = [context CGLContextObj];
			if (program > 0)
				glDeleteProgram(program);
			if (vertexShader > 0)
				glDeleteShader(vertexShader);
			if (fragmentShader > 0)
				glDeleteShader(fragmentShader);
		}
		VVRELEASE(vertexShaderString);
		VVRELEASE(fragmentShaderString);
	pthread_mutex_unlock(&renderLock);

	[super prepareToBeDeleted];
}
- (void) dealloc	{
	if (!deleted)
		[self prepareToBeDeleted];
	pthread_mutex_destroy(&renderLock);
	if (errDict != nil)	{
		OSSpinLockLock(&errDictLock);
		VVRELEASE(errDict);
		OSSpinLockUnlock(&errDictLock);
	}
	[super dealloc];
}

- (void) setVertexShaderString:(NSString *)n	{
	if (n == nil)	{
		NSLog(@"************ ERR: tried to set nil string! %s",__func__);
		NSException		*exc = [NSException
			exceptionWithName:@"NilVSStringException"
			reason:@"tried to set a nil vertex shader"
			userInfo:nil];
		[exc raise];
		return;
	}
	pthread_mutex_lock(&renderLock);
		VVRELEASE(vertexShaderString);
		if (n != nil)
			vertexShaderString = [n retain];
		vertexShaderUpdated = YES;
	pthread_mutex_unlock(&renderLock);
}
- (NSString *) vertexShaderString	{
	NSString		*returnMe = nil;
	pthread_mutex_lock(&renderLock);
	returnMe = (vertexShaderString==nil) ? nil : [[vertexShaderString retain] autorelease];
	pthread_mutex_unlock(&renderLock);
	return returnMe;
}
- (void) setFragmentShaderString:(NSString *)n	{
	if (n == nil)	{
		NSLog(@"************ ERR: tried to set nil string! %s",__func__);
		NSException		*exc = [NSException
			exceptionWithName:@"NilFSStringException"
			reason:@"tried to set a nil frag shader"
			userInfo:nil];
		[exc raise];
		return;
	}
	pthread_mutex_lock(&renderLock);
		VVRELEASE(fragmentShaderString);
		if (n != nil)
			fragmentShaderString = [n retain];
		fragmentShaderUpdated = YES;
	pthread_mutex_unlock(&renderLock);
}
- (NSString *) fragmentShaderString	{
	NSString		*returnMe = nil;
	pthread_mutex_lock(&renderLock);
	returnMe = (fragmentShaderString==nil) ? nil : [[fragmentShaderString retain] autorelease];
	pthread_mutex_unlock(&renderLock);
	return returnMe;
}

- (void) renderInMSAAFBO:(GLuint)mf colorRB:(GLuint)mc depthRB:(GLuint)md fbo:(GLuint)f colorTex:(GLuint)t depthTex:(GLuint)d target:(GLuint)tt	{
	//NSLog(@"%s",__func__);
	if (deleted)
		return;
	pthread_mutex_lock(&renderLock);
	[super renderInMSAAFBO:mf colorRB:mc depthRB:md fbo:f colorTex:t depthTex:d target:tt];
	pthread_mutex_unlock(&renderLock);
}

- (void) _initialize	{
	[super _initialize];
	CGLContextObj		cgl_ctx = [context CGLContextObj];
	glDisable(GL_BLEND);
}
- (void) _renderPrep	{
	//NSLog(@"%s",__func__);
	if (deleted)
		return;

	//	have the super do its render prep (initializes, reshapes, binds fbo/depth/textures, clears
	[super _renderPrep];

	if (context == nil)
		return;

	CGLContextObj		cgl_ctx = [context CGLContextObj];

	if (vertexShaderUpdated || fragmentShaderUpdated)	{
		glUseProgram(0);

		if (program > 0)	{
			glDeleteProgram(program);
			program = 0;
		}
		if (vertexShader > 0)	{
			glDeleteShader(vertexShader);
			vertexShader = 0;
		}
		if (fragmentShader > 0)	{
			glDeleteShader(fragmentShader);
			fragmentShader = 0;
		}

		OSSpinLockLock(&errDictLock);
		VVRELEASE(errDict);
		OSSpinLockUnlock(&errDictLock);

		BOOL			encounteredError = NO;
		if (vertexShaderString != nil)	{
			vertexShader = glCreateShader(GL_VERTEX_SHADER_ARB);
			const char		*shaderSrc = [vertexShaderString UTF8String];
			glShaderSource(vertexShader,1,&shaderSrc,NULL);
			glCompileShader(vertexShader);
			GLint			compiled;
			glGetShaderiv(vertexShader,GL_COMPILE_STATUS,&compiled);
			if (!compiled)	{
				GLint			length;
				GLchar			*log;
				glGetShaderiv(vertexShader,GL_INFO_LOG_LENGTH,&length);
				log = (GLchar *) malloc(sizeof(GLchar)*length);
				glGetShaderInfoLog(vertexShader,length,&length,log);
				NSLog(@"\t\terror compiling vertex shader:");
				NSLog(@"\t\terr: %s",log);
				encounteredError = YES;

				OSSpinLockLock(&errDictLock);
				if (errDict == nil)
					errDict = [MUTDICT retain];
				[errDict setObject:[NSString stringWithUTF8String:log] forKey:@"vertErrLog"];
				[errDict setObject:vertexShaderString forKey:@"vertSrc"];
				OSSpinLockUnlock(&errDictLock);

				free(log);
				glDeleteShader(vertexShader);
				vertexShader = 0;
			}
		}
		if (fragmentShaderString != nil)	{
			fragmentShader = glCreateShader(GL_FRAGMENT_SHADER_ARB);
			const char		*shaderSrc = [fragmentShaderString UTF8String];
			glShaderSource(fragmentShader,1,&shaderSrc,NULL);
			glCompileShader(fragmentShader);
			GLint			compiled;
			glGetShaderiv(fragmentShader,GL_COMPILE_STATUS,&compiled);
			if (!compiled)	{
				GLint			length;
				GLchar			*log;
				glGetShaderiv(fragmentShader,GL_INFO_LOG_LENGTH,&length);
				log = (GLchar *) malloc(sizeof(GLchar)*length);
				glGetShaderInfoLog(fragmentShader,length,&length,log);
				NSLog(@"\t\terror compiling fragment shader:");
				NSLog(@"\t\terr: %s",log);
				//NSLog(@"\t\tshader is:\n%@",fragmentShaderString);

				OSSpinLockLock(&errDictLock);
				if (errDict == nil)
					errDict = [MUTDICT retain];
				[errDict setObject:[NSString stringWithUTF8String:log] forKey:@"fragErrLog"];
				[errDict setObject:fragmentShaderString forKey:@"fragSrc"];
				OSSpinLockUnlock(&errDictLock);

				free(log);
				glDeleteShader(fragmentShader);
				fragmentShader = 0;
			}
		}
		if (((vertexShader>0) || (fragmentShader>0)) && !encounteredError)	{
			program = glCreateProgram();
			if (vertexShader > 0)
				glAttachShader(program,vertexShader);
			if (fragmentShader > 0)
				glAttachShader(program,fragmentShader);
			glLinkProgram(program);

			GLint			linked;
			glGetProgramiv(program,GL_LINK_STATUS,&linked);
			if (!linked)	{
				GLint			length;
				GLchar			*log;
				glGetProgramiv(program,GL_INFO_LOG_LENGTH,&length);
				log = (GLchar *)malloc(sizeof(GLchar)*length);
				glGetProgramInfoLog(program,length,&length,log);
				NSLog(@"\t\terror linking program:");
				NSLog(@"\t\terr: %s",log);

				OSSpinLockLock(&errDictLock);
				if (errDict == nil)
					errDict = [MUTDICT retain];
				[errDict setObject:[NSString stringWithUTF8String:log] forKey:@"linkErrLog"];
				OSSpinLockUnlock(&errDictLock);

				free(log);
				glDeleteProgram(program);
				program = 0;
			}
		}

		vertexShaderUpdated = NO;
		fragmentShaderUpdated = NO;
	}

	//if ((samplerTarget!=nil)&&(samplerSelector!=nil)&&([samplerTarget respondsToSelector:samplerSelector]))
	//	[samplerTarget performSelector:samplerSelector withObject:self];

	if (program > 0)
		glUseProgram(program);
}

- (void) _renderCleanup	{
	if (deleted || context==nil)
		return;
	if (program > 0)	{
		CGLContextObj		cgl_ctx = [context CGLContextObj];
		glUseProgram(0);
	}
	[super _renderCleanup];

}

@synthesize vertexShaderUpdated;
@synthesize fragmentShaderUpdated;
@synthesize program;
@synthesize vertexShader;
@synthesize fragmentShader;
//@synthesize samplerTarget;
//@synthesize samplerSelector;
@synthesize vertexShaderString;
@synthesize fragmentShaderString;

@end

redpajama_set_name: RedPajamaGithub


text:
import Em from 'ember';

export default Em.Component.extend({
 flag: true,
 isButtonVisible: true,

 validate() {
   this.set("flag", true);
   if (Em.isBlank(this.get('model').get('ipaddress'))) {
      this.notifications.error('Please enter an email');
      this.set("flag", false);
   }
   if (Em.isBlank(this.get('model').get('username'))) {
     this.notifications.error('Please enter an username');
     this.set("flag", false);
   }
   if (Em.isBlank(this.get('model').get('password'))) {
    this.notifications.error('Please enter a password');
    this.set("flag", false);
   }
 },

 actions: {
   validateAndAuthenticate() {
     this.validate();
     if (this.get('flag')) {
        this.set('isButtonVisible', false);
        this.get('onConfirm')();
      }
    },
    done() {
      this.validate();
      if (this.get('flag')) {
        this.get('onDone')();
      }
    }
 }

});


text:
<?php
namespace TheSeer\phpDox\Collector {

    class SourceCollectionException extends \Exception {

        const SourceNotFound = 1;
    }

}


text:
Network Balancing Act
=====================

**Network Balancing Act**, or **NBA**, is a packet processing framework based on Linux and commodity Intel x86 hardware.

Its goal is to offer both programmability and high performance by exploiting modern commodity hardware such as multi-queue-enabled 10 GbE network cards, multi-socket/multi-core CPUs, and computation accelerators like GPUs.
The programming interface resembles `the Click modular router <http://www.read.cs.ucla.edu/click/click>`_, which express packet processing functions as composable C++ classes (called *elements*).
Click has been a de-facto standard framework for software-based packet processors for years, but suffered from low performance.
In contrast, on Intel Sandy Bridge (E5-2670) dual-socket servers with eight 10 GbE (Intel X520-DA2) network cards, NBA saturates the hardware I/O capacity with light-weight workloads: 80 Gbps IPv4 forwarding throughput for large packets and 62 Gbps for minimum-sized packets.

Note that NBA covers per-packet processing only---it does not support flow-level processing yet.

.. _gsg:

.. toctree::
   :maxdepth: 2
   :caption: Getting Started Guide

   gsg/sys_reqs
   gsg/build
   gsg/running
   gsg/docs

.. _user-docs:

.. toctree::
   :maxdepth: 2
   :caption: Using NBA

   user/system_config
   user/pipeline_config
   user/element
   user/offloadable_element

.. _elem-docs:

.. toctree::
   :maxdepth: 2
   :caption: Element Catalog

   elem/index

.. _dev-docs:

.. toctree::
   :maxdepth: 2
   :caption: Extending NBA

   dev/load_balancer
   dev/compute_device

Indices and tables
==================

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`


text:
using namespace boost::spirit::qi;
using namespace std;
using namespace boost::spirit;

template <typename Iterator, typename NumType>
struct CalcGrammar : public grammar<Iterator, NumType(), space_type>
{
	CalcGrammar() : CalcGrammar::base_type(exp_)
	{
		real_parser<NumType, real_policies<NumType> > rp_;
		factor_ = rp_[_val = _1]
			| ('-' >> factor_)[_val = -_1]
			| ('+' >> factor_)[_val = _1]
			| ('(' >> exp_[_val = _1] >> ')');

		term_ = factor_[_val = _1] >>
			*(('*' >> factor_[_val *= _1])
			| ('/' >> factor_[_val /= _1]));

		exp_ = term_[_val = _1] >>
			*(('+' >> term_[_val += _1])
			| ('-' >> term_[_val -= _1]));
	}
	typedef rule<Iterator, NumType(), space_type> rule_t;
	rule_t factor_, term_, exp_;
};

template<class _NumType = double>
class Calculator
{
public:
	Calculator(void){}
	virtual ~Calculator(void){}
public:
	typedef _NumType NumType;
public:
	_NumType calc(const std::string& input);
	_NumType calc(const std::string& input,bool& isSuccessed,const char*& lastErr);
	const char* getLastErr(){ return lastErr_.c_str(); }
protected:
	CalcGrammar<std::string::const_iterator, _NumType> gram_;
	std::string lastErr_;
};
template<class _NumType>
_NumType Calculator<_NumType>::calc(const std::string& input)
{
	bool isSuccess;
	const char* lastErr = nullptr;
	return calc(input, isSuccess, lastErr);
}

template<class _NumType>
_NumType Calculator<_NumType>::calc(const std::string& input, bool& isSuccessed, const char*& lastErr)
{
	_NumType val = 0;
	std::string::const_iterator startPos = input.begin();
	auto r = phrase_parse(startPos, input.end(), gram_, space, val);
	if (r && startPos == input.end())
	{
		lastErr_.clear();
		isSuccessed = true;
		lastErr = "";
		return val;
	}
	else
	{
		int num = input.end() - startPos;
		lastErr_ = std::string(num, '-') + "^";
		isSuccessed = false;
		lastErr = lastErr_.c_str();
	}
}

int main()
{
	Calculator<> calc;
	std::string input;
	printf("input here\n");
	while (true)
	{
		getline(cin,input);
		if (input == "")
			break;
		int val = calc.calc(input.c_str());
		if (calc.getLastErr()[0] != 0)
			printf("%s\nWrong\n\n", calc.getLastErr());
		else
			printf("%d\n\n", val);
	}
}


text:
FROM python:3

WORKDIR /app
COPY indexer_util /app/indexer_util
COPY bigquery/requirements.txt /app
RUN pip install -r /app/requirements.txt

COPY dataset_config /app/dataset_config
COPY bigquery /app

CMD python indexer.py


text:
using UnityEngine;
using UnityEngine.UI;

namespace Assets.WorldSpace.Lootbox.Scripts {

    [RequireComponent(typeof(Collider))]
    [RequireComponent(typeof(LootBoxInventoryHandler))]
    [AddComponentMenu("Scripts/Lootbox/LootBoxUI")]
    public class LootBoxUI : MonoBehaviour {

        public GameObject ListItemGameObject;
        public bool LookAtMainCamera;
        public Transform ScrollViewContentTransform;
        public Transform WorldSpaceCanvasTransform;

        [SerializeField]
        private readonly float smoothFactor = 0f;

        [SerializeField]
        private readonly Vector3 targetPosition = new Vector3(0, 0, 0);

        [SerializeField]
        private bool autoScrollList;

        [SerializeField]
        private bool lockCanvasRotateToYAxis;

        private void OnTriggerEnter(Collider collision) {
            WorldSpaceCanvasTransform.gameObject.SetActive(true);
        }

        private void OnTriggerExit(Collider collision) {
            WorldSpaceCanvasTransform.gameObject.SetActive(false);
        }

        private void Start() {
            GetComponent<LootBoxInventoryHandler>().PopulateList();
            foreach (string item in GetComponent<LootBoxInventoryHandler>().LootBoxInventory) {
                GameObject listItem = Instantiate(ListItemGameObject, ScrollViewContentTransform);
                listItem.transform.Find("Text").GetComponent<Text>().text = item;
            }
        }

        private void Update() {
            if (LookAtMainCamera) {
                WorldSpaceCanvasTransform.LookAt(Camera.main.transform);
                if (lockCanvasRotateToYAxis) {
                    Quaternion t = WorldSpaceCanvasTransform.rotation;
                    t.x = 0;
                    t.z = 0;
                    WorldSpaceCanvasTransform.rotation = t;
                }
            }

            if (autoScrollList) {
                ScrollViewContentTransform.localPosition = Vector3.Lerp(
                    ScrollViewContentTransform.position,
                    targetPosition,
                    Time.deltaTime * smoothFactor);
            }
        }
    }

}


text:
package de.tum.in.niedermr.ta.test.integration;

import java.io.File;
import java.io.IOException;

import org.junit.Assume;

import de.tum.in.niedermr.ta.extensions.analysis.workflows.ExtensionEnvironmentConstants;
import de.tum.in.niedermr.ta.extensions.threads.IModifiedThreadClass;
import de.tum.in.niedermr.ta.runner.configuration.exceptions.ConfigurationException;

/**
 * Integration test with extensions involved.

 *
Stack-analysis workflow V2

 *
Stack-analysis workflow V3

 *
 *

 * Note that this test can only be run successfully if java.lang.Thread is replaced.
 *
 * @see "configuration file in test data"
 */
public class IntegrationTest8 extends AbstractIntegrationTest {

	/** Expected stack distance V2 file. */
	private File m_expectedStackDistanceV2File;
	/** Expected stack distance V3 file. */
	private File m_expectedStackDistanceV3File;
	/** Actual stack distance V2 file. */
	private File m_outputStackDistanceV2File;
	/** Actual stack distance V3 file. */
	private File m_outputStackDistanceV3File;

	/** {@inheritDoc} */
	@Override
	public void executeTestLogic() throws ConfigurationException, IOException {
		Assume.assumeTrue("This test requires a modified " + Thread.class.getName() + " class",
				IModifiedThreadClass.class.isAssignableFrom(Thread.class));

		initializeFiles();

		assertFilesExists(MSG_PATH_TO_TEST_JAR_IS_INCORRECT, new File(getCommonFolderTestData() + JAR_TEST_DATA));
		assertFilesExists(MSG_TEST_DATA_MISSING, m_expectedStackDistanceV2File);
		assertFilesExists(MSG_TEST_DATA_MISSING, m_expectedStackDistanceV3File);

		executeTestAnalyzerWithConfiguration();

		checkResults();
	}

	/** Initialize the expected and actual result files. */
	private void initializeFiles() throws IOException {
		m_expectedStackDistanceV2File = getExpectedFile(
				getFileName(ExtensionEnvironmentConstants.FILE_OUTPUT_STACK_DISTANCES_V2));
		m_outputStackDistanceV2File = getOutputFile(
				getFileName(ExtensionEnvironmentConstants.FILE_OUTPUT_STACK_DISTANCES_V2));
		m_expectedStackDistanceV3File = getExpectedFile(
				getFileName(ExtensionEnvironmentConstants.FILE_OUTPUT_STACK_DISTANCES_V3));
		m_outputStackDistanceV3File = getOutputFile(
				getFileName(ExtensionEnvironmentConstants.FILE_OUTPUT_STACK_DISTANCES_V3));
	}

	/** Check the results. */
	private void checkResults() {
		assertFilesExists(MSG_OUTPUT_MISSING, m_outputStackDistanceV2File);
		assertFileContentEqual(MSG_NOT_EQUAL_RESULT, false, m_expectedStackDistanceV2File, m_outputStackDistanceV2File);

		assertFilesExists(MSG_OUTPUT_MISSING, m_outputStackDistanceV3File);
		assertFileContentEqual(MSG_NOT_EQUAL_RESULT, false, m_expectedStackDistanceV3File, m_outputStackDistanceV3File);
	}
}


text:
/******************************************************************************
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
*******************************************************************************/

#ifndef __BINARYTREE_HH__
#define __BINARYTREE_HH__

#include <assert.h>
#include <math.h>
#include <algorithm>
#include <chrono>
#include <cstdint>
#include <ctime>
#include <fstream>
#include <list>
#include <map>
#include <sstream>
#include <tuple>
#include <vector>
#include "BasicLogicalTopology.hh"
#include "Node.hh"
#include "astra-sim/system/Common.hh"

namespace AstraSim {
class BinaryTree : public BasicLogicalTopology {
 public:
  enum class TreeType { RootMax, RootMin };
  enum class Type { Leaf, Root, Intermediate };
  int total_tree_nodes;
  int start;
  TreeType tree_type;
  int stride;
  Node* tree;
  virtual ~BinaryTree();
  std::map<int, Node*> node_list;
  int get_num_of_nodes_in_dimension(int dimension) override {
    return total_tree_nodes;
  }
  BinaryTree(
      int id,
      TreeType tree_type,
      int total_tree_nodes,
      int start,
      int stride);
  Node* initialize_tree(int depth, Node* parent);
  void build_tree(Node* node);
  int get_parent_id(int id);
  int get_left_child_id(int id);
  int get_right_child_id(int id);
  Type get_node_type(int id);
  bool is_enabled(int id) {
    if (id % stride == 0) {
      return true;
    }
    return false;
  };
  void print(Node* node);
};
} // namespace AstraSim
#endif


text:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>

    <bean id="datasourceEJB"
              class="org.ecg.refdata.datasource.ejb.client.PersistenceBeanClient"
              singleton="true">
        <property name="jnpPersistanceBeanLocation" value="localhost:1299"></property>
        <!--
                <property name="jnpPersistanceBeanLocation" value="10.133.12.198:1299"></property>
        -->
    </bean>

    <bean id="referenceData" class="org.ecg.refdata.core.common.CommonReferenceDataConfig">
        <property name="datasources">
            <map>
                <entry key="datasourceEJB" value-ref="datasourceEJB"/>
            </map>
        </property>
    </bean>

</beans>


text:
<?php

namespace lo\modules\noty;

use yii\base\BootstrapInterface;

/**
 * noty module bootstrap class.
 */
class Bootstrap implements BootstrapInterface
{
    /**
     * @inheritdoc
     */
    public function bootstrap($app)
    {
        // add module I18N category
        if (!isset($app->i18n->translations['noty'])) {
            $app->i18n->translations['noty'] = [
                'class' => 'yii\i18n\PhpMessageSource',
                'sourceLanguage' => 'en-US',
                'basePath' => '@lo/modules/noty/messages',
            ];
        }
    }
}


text:
<!DOCTYPE html>

  <meta charset="utf-8">

  <meta name="viewport" content="width=device-width, initial-scale=1.0">

  <title>Advanced Sounding — MetPy 0.4.3 documentation</title>

    <link rel="canonical" href="https://unidata.github.io/MetPy/latest/examples/Advanced_Sounding.html"/>

    <link rel="stylesheet" href="../_static/css/theme.css" type="text/css" />

    <link rel="stylesheet" href="../_static/gallery.css" type="text/css" />

        <link rel="index" title="Index"
              href="../genindex.html"/>
        <link rel="search" title="Search" href="../search.html"/>
    <link rel="top" title="MetPy 0.4.3 documentation" href="../index.html"/>
        <link rel="up" title="MetPy Examples" href="index.html"/>
        <link rel="next" title="Dewpoint and Mixing Ratio" href="calculations/Dewpoint_and_Mixing_Ratio.html"/>
        <link rel="prev" title="MetPy Examples" href="index.html"/>

             MetPy

                0.4.3

  <form id="rtd-search-form" class="wy-form" action="../search.html" method="get">
    <input type="text" name="q" placeholder="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>

Installation Guide

Unit Support

MetPy Examples

General Examples

Advanced Sounding

Calculations

File Formats

Gridding

Plotting

The MetPy API

Developer’s Guide

          MetPy

Docs »

MetPy Examples »

Advanced Sounding

             View page source

Advanced Sounding¶

Plot a sounding using MetPy with more advanced features.

Beyond just plotting data, this uses calculations from metpy.calc to find the lifted
condensation level (LCL) and the profile of a surface-based parcel. The area between the
ambient profile and the parcel profile is colored as well.

from datetime import datetime

import matplotlib.pyplot as plt

import metpy.calc as mpcalc
from metpy.io import get_upper_air_data
from metpy.io.upperair import UseSampleData
from metpy.plots import SkewT
from metpy.units import concatenate

with UseSampleData():  # Only needed to use our local sample data
    # Download and parse the data
    dataset = get_upper_air_data(datetime(1999, 5, 4, 0), 'OUN')

p = dataset.variables['pressure'][:]
T = dataset.variables['temperature'][:]
Td = dataset.variables['dewpoint'][:]
u = dataset.variables['u_wind'][:]
v = dataset.variables['v_wind'][:]

Create a new figure. The dimensions here give a good aspect ratio

fig = plt.figure(figsize=(9, 9))
skew = SkewT(fig, rotation=45)

# Plot the data using normal plotting functions, in this case using
# log scaling in Y, as dictated by the typical meteorological plot
skew.plot(p, T, 'r')
skew.plot(p, Td, 'g')
skew.plot_barbs(p, u, v)
skew.ax.set_ylim(1000, 100)
skew.ax.set_xlim(-40, 60)

# Calculate LCL height and plot as black dot
l = mpcalc.lcl(p[0], T[0], Td[0])
lcl_temp = mpcalc.dry_lapse(concatenate((p[0], l)), T[0])[-1].to('degC')
skew.plot(l, lcl_temp, 'ko', markerfacecolor='black')

# Calculate full parcel profile and add to plot as black line
prof = mpcalc.parcel_profile(p, T[0], Td[0]).to('degC')
skew.plot(p, prof, 'k', linewidth=2)

# Example of coloring area between profiles
greater = T >= prof
skew.ax.fill_betweenx(p, T, prof, where=greater, facecolor='blue', alpha=0.4)
skew.ax.fill_betweenx(p, T, prof, where=~greater, facecolor='red', alpha=0.4)

# An example of a slanted line at constant T -- in this case the 0
# isotherm
l = skew.ax.axvline(0, color='c', linestyle='--', linewidth=2)

# Add the relevant special lines
skew.plot_dry_adiabats()
skew.plot_moist_adiabats()
skew.plot_mixing_lines()

# Show the plot
plt.show()

Total running time of the script: ( 0 minutes  0.631 seconds)

Download Python source code: Advanced_Sounding.py

Download Jupyter notebook: Advanced_Sounding.ipynb

Generated by Sphinx-Gallery

        Next

         Previous

        © Copyright 2016, MetPy Developers.
      Last updated on Jul 01, 2017 at 18:59:21.

  Built with Sphinx using a theme provided by Read the Docs.


text:
from logstash.formatter import LogstashFormatterVersion0, LogstashFormatterVersion1

from logstash.handler_tcp import TCPLogstashHandler
from logstash.handler_udp import UDPLogstashHandler, LogstashHandler
try:
    from logstash.handler_amqp import AMQPLogstashHandler
except:
   # you need to install AMQP support to enable this handler.
   pass


text:
<!DOCTYPE html>

<?php if(isset($_SESSION['logged_in'])){ ?>

    <meta charset="utf-8">
    <title>SINDANISTRA</title>

    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
     <link rel="icon" type="image/png" href="<?php echo base_url('asset/img/4.png');?>">
    <link href="<?php echo base_url('asset/admin2/css/bootstrap.min.css');?>" rel="stylesheet">
    <link href="<?php echo base_url('asset/admin2/css/bootstrap-responsive.min.css');?>" rel="stylesheet">

    <link href="<?php echo base_url('asset/admin2/http://fonts.googleapis.com/css?family=Open+Sans:400italic,600italic,400,600');?>" rel="stylesheet">
    <link href="<?php echo base_url('asset/admin2/css/font-awesome.css');?>" rel="stylesheet">

    <link href="<?php echo base_url('asset/admin2/css/style.css');?>" rel="stylesheet">

    <link href="<?php echo base_url('asset/admin2/css/pages/reports.css');?>" rel="stylesheet">

                <a class="brand" href="<?php echo site_url('Home/sukses');?>">SINDANISTRA

							 <?php echo $this->session->userdata('username');?>

Profile

<a href="<?php echo site_url('home/logout'); ?>">Logout

<a href="<?php echo site_url('Home/sukses');?>">Dashboard

<a href="<?php echo site_url('Home/table_nms');?>">Inventory

<a href="<?php echo site_url('Home/table_sisa');?>">Sisa Jalur

<a href="<?php echo site_url('Link');?>">Data Link

<a href="<?php echo site_url('Report');?>">Reports

<a href="<?php echo site_url('Home/setakun');?>">Setting Akun

<a href="<?php echo site_url('Home/manual_book');?>">Manual Book

Insert Single Data Link - Sistem Inventory Data Teknis Transport

              <form class="form-horizontal form-label-left" <?php echo form_open_multipart('Link/create_link'); ?>
                       <input id="jalur" name="jalur" type="hidden" value="<?php echo $jumlah_jalur; ?>" hidden/>

                        Perangkat *

                        <select class="form-control" name="user">
                          <option>METRO</option>
                          <option>TERA</option>
                          <option>TELKOMSEL</option>
                          <option>ISC</option>
                          <option>BCA</option>
                          <option>OTHERS</option>
                        </select>

                              <input class="form-control" name="host_a" placeholder="Node A"></input>
                              <input class="form-control" name="host_b" placeholder="Node B"></input>
                              <input class="form-control" name="fa_a" placeholder="Interface A"></input>
                              <input class="form-control" name="fa_b" placeholder="Interface B"> </input>

                      <?php
                      $a=1;
                      for ($i=0; $i < $jumlah_jalur; $i++) {

                      ?>

                        Jalur <?php echo $a;?> *

                        <select class="form-control" name="nama_nms<?php echo $a;?>" id="nama_nms<?php echo $a;?>" onchange="ajaxnms<?php echo $a;?>(this.value)">
                                <option value="">NMS</option>
                           <?php foreach($port as $p){?>
                                <option value="<?php echo $p->nama_nms;?>"><?php echo $p->nama_nms?></option>
                                <?php } ?>
                        </select>

                        <select class="form-control" name="nama_lokasi<?php echo $a;?>" id="nama_lokasi<?php echo $a;?>" onchange="ajaxlokasi<?php echo $a;?>(<?php echo $a; ?>)">
                                 <option value="">Lokasi</option>

                        </select>

                              <?php echo form_error('ne'); ?>

                              <select class="form-control" name="ne<?php echo $a;?>" id="berubah<?php echo $a;?>" onchange="ajaxne<?php echo $a;?>(this.value)" >
                                <option value="">NE</option>
                              </select>

                              <?php echo form_error('board'); ?>

                              <select class="form-control" name="board<?php echo $a;?>" id="board<?php echo $a;?>" onchange="ajaxboard<?php echo $a;?>(this.value)"  <?php echo set_value('board');?>>
                                <option value="">Board</option>
                              </select>

                             <?php echo form_error('shelf'); ?>

                              <select class="form-control" name="shelf<?php echo $a;?>" id="shelf<?php echo $a;?>"  onchange="ajaxshelf<?php echo $a;?>(this.value)" <?php echo set_value('shelf');?>>
                                <option value="">Shelf</option>
                              </select>

                              <?php echo form_error('slot'); ?>

                              <select class="form-control" name="slot<?php echo $a;?>" id="slot<?php echo $a;?>"  onchange="ajaxslot<?php echo $a;?>(this.value)"<?php echo set_value('slot');?>>
                                <option value="">Slot</option>
                              </select>

                              <?php echo form_error('port'); ?>

                              <select class="form-control" name="port<?php echo $a;?>" id="port<?php echo $a;?>" <?php echo set_value('board');?> onchange="ajaxtampil<?php echo $a;?>(this.value)">
                                <option value="">Port</option>
                              </select>

                        <?php $a++;} ?>

                             <input type="text" name="keterangan" placeholder="Keterangan"></input>

                          <button id="send" type="submit" class="btn btn-success">Submit</button>
                            <a href="<?php echo site_url('Link')?>"><button type="submit" class="btn btn-danger" >Cancel</button>

                    </form>

                            About Free Admin Template

EGrappler.com

Web Development Resources

Responsive HTML5 Portfolio Templates

Free Resources and Scripts

                            Support

Frequently Asked Questions

Ask a Question

Video Tutorial

Feedback

                            Something Legal

Read License

Terms of Use

Privacy Policy

                            Open Source jQuery Plugins

Open Source jQuery Plugins

HTML5 Responsive Tempaltes

Free Contact Form Plugin

Flat UI PSD

                        © 2013 Bootstrap Responsive Admin Template.

<?php }else{
	redirect(site_url('home/index'));
}?>


text:
import Adafruit_DHT as dht
import time
import calendar

try:
   import Adafruit_DHT as dht
   DHT_FOUND = True
except ImportError:
   DHT_FOUND = False

class PItemp:
   #'Common base class for PInodes'#
   def __init__(self):
      self.name = "Temp and humidity."
      self.delta = 10
      self.track_delta = calendar.timegm(time.gmtime())
      self.reset_delta_count = calendar.timegm(time.gmtime())
      self.fahrenheit = 0.0
      self.humidity = 0.0
   # ====================================================================
   #  Updated every 10 seconds for temp and humidity
   # ====================================================================
   def get_temp_and_humidity(self):
      if DHT_FOUND:
        self.track_delta = calendar.timegm(time.gmtime())
        if (self.track_delta - self.reset_delta_count > self.delta):
           #Reset times
           self.track_delta = calendar.timegm(time.gmtime())
           self.reset_delta_count = calendar.timegm(time.gmtime())
           #Call DHT and get temp, humidity.
           self.humidity,t = dht.read_retry(dht.DHT11, 4)
           self.fahrenheit = t*1.8000 + 32.00
        return self.fahrenheit, self.humidity


text:
namespace storage_monitor {

class TestStorageMonitor : public StorageMonitor {
 public:
  TestStorageMonitor();
  ~TestStorageMonitor() override;

  void Init() override;

  void MarkInitialized();

  // Create and initialize a new TestStorageMonitor and install it
  // as the StorageMonitor singleton. If there is a StorageMonitor instance
  // already in place, NULL is returned, otherwise the TestStorageMonitor
  // instance is returned. Use |Destroy| to delete the singleton.
  static TestStorageMonitor* CreateAndInstall();

  // Create and initialize a new TestStorageMonitor and install it
  // as the StorageMonitor singleton. TestStorageMonitor is returned for
  // convenience. Use |Destroy| to delete the singleton.
  static TestStorageMonitor* CreateForBrowserTests();

  // Synchronously initialize the current storage monitor.
  static void SyncInitialize();

  bool GetStorageInfoForPath(const base::FilePath& path,
                             StorageInfo* device_info) const override;

#if defined(OS_WIN)
  bool GetMTPStorageInfoFromDeviceId(
      const std::string& storage_device_id,
      std::wstring* device_location,
      std::wstring* storage_object_id) const override;
#endif

#if BUILDFLAG(IS_CHROMEOS_ASH)
  device::mojom::MtpManager* media_transfer_protocol_manager() override;
#endif

  Receiver* receiver() const override;

  void EjectDevice(
      const std::string& device_id,
      base::OnceCallback<void(StorageMonitor::EjectStatus)> callback) override;

  const std::string& ejected_device() const { return ejected_device_; }

  void AddRemovablePath(const base::FilePath& path);

  bool init_called() const { return init_called_; }

 private:
  // Whether TestStorageMonitor::Init() has been called for not.
  bool init_called_;

  // The last device to be ejected.
  std::string ejected_device_;

  // Paths considered for testing purposes to be on removable storage.
  std::vector<base::FilePath> removable_paths_;

#if BUILDFLAG(IS_CHROMEOS_ASH)
  mojo::Remote<device::mojom::MtpManager> media_transfer_protocol_manager_;
#endif
};

}  // namespace storage_monitor

#endif  // COMPONENTS_STORAGE_MONITOR_TEST_STORAGE_MONITOR_H_


text:
<?php

namespace App\WordPress\Console\Commands;

use Illuminate\Console\Command;

class InstallCommand extends Command
{
    use EnvironmentTrait;

    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $name = 'wordpress:install';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Install wordpress tables.';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
        // entrance
        $this->logo();

        // prepare
        $this->bootstrapForSinglesiteSetup();

        // title
        $this->info('-- WordPress Install --');

        // check
        if (wordpress_installed()) {
            $this->error('Already installed.');

            return;
        }

        // gather
        $config = $this->gather();

        // deside
        if (!$this->deside()) {
            // cancel
            $this->line('Canceled.');

            return;
        }

        // process
        $this->process($config);

        // done
        $this->line('Done.');
    }

    protected function gather()
    {
        $config = [
            'language' => config('app.locale'),
            'backend_url' => env('WP_BACKENDURL'),
            'site_url' => env('WP_SITEURL'),
            'site_title' => '',
            'site_description' => 'This is a website.',
            'site_public' => false,
            'admin_username' => '',
            'admin_password' => '',
            'admin_email' => '',
        ];

        $config['language'] = $this->ask('Language', $config['language']);
        if ($config['backend_url'] === null) {
            $config['backend_url'] = $this->ask('Backend URL', 'http://localhost:8000');
        } else {
            $this->info('Backend URL: '.$config['backend_url'].' (.env: WP_BACKENDURL)');
        }
        if ($config['site_url'] === null) {
            $config['site_url'] = $this->ask('Site URL', 'http://localhost:8000');
        } else {
            $this->info('Site URL: '.$config['site_url'].' (.env: WP_SITEURL)');
        }
        $config['site_title'] = $this->ask('Site title', $config['site_title']);
        $config['site_description'] = $this->ask('Site description', $config['site_description']);
        $config['site_public'] = $this->confirm('Site public', $config['site_public']);
        $config['admin_username'] = $this->ask('Admin username', $config['admin_username']);
        $config['admin_password'] = $this->ask('Admin password', $config['admin_password']);
        $config['admin_email'] = $this->ask('Admin email', $config['admin_email']);

        return $config;
    }

    protected function deside()
    {
        return $this->confirm('Are you sure?', true);
    }

    protected function process(array $config)
    {
        global $wpdb;

        // We need to create references to ms global tables to enable Network.
        foreach ($this->singlesiteTables() as $table => $prefixed_table) {
            $wpdb->{$table} = $prefixed_table;
        }

        require_once wordpress_path('wp-admin/includes/upgrade.php');
        $result = wp_install(
            $config['site_title'],
            $config['admin_username'],
            $config['admin_email'],
            $config['site_public'],
            '', // dummy
            wp_slash($config['admin_password']),
            $config['language']
        );

//        var_dump($result);

        update_option('siteurl', $config['backend_url']);
        update_option('home', $config['site_url']);
        update_option('blogdescription', $config['site_description']);

        if ($config['language'] == 'ja') {
            // 週の初めは '日曜日'
            update_option('start_of_week', '0');

            // 日付フォーマットは 'Y年n月j日'
            update_option('date_format', 'Y年n月j日');

            // 時刻フォーマットは 'H:i'
            update_option('time_format', 'H:i');
        }
    }
}


text:
<?php

/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */

/**
 * This is the package.xml generator for Services_Twilio
 *
 * PHP version 5
 *
 * LICENSE:
 *
 * Copyright 2014 Twilio.
 *
 * 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.
 *
 * @category  Services
 * @package   Services_Twilio
 * @author    Neuman Vong <neuman@twilio.com>
 * @copyright 2014 Twilio
 * @license   http://creativecommons.org/licenses/MIT/
 * @link      http://pear.php.net/package/Services_Twilio
 */

ini_set('display_errors', '0');
error_reporting(E_ALL & ~E_DEPRECATED & ~E_STRICT);
require_once 'PEAR/PackageFileManager/File.php';
require_once 'PEAR/PackageFileManager2.php';
PEAR::setErrorHandling(PEAR_ERROR_DIE);

$api_version     = '3.12.4';
$api_state       = 'stable';

$release_version = '3.12.4';
$release_state   = 'stable';
$release_notes   = 'Add transcription link to recordings';

$description = <<<DESC
A SDK (or helper library, as we're calling them) for PHP developers to write
applications against Twilio's REST API and generate TwiML responses.
DESC;

$package = new PEAR_PackageFileManager2();

$package->setOptions(
    array(
        'filelistgenerator'       => 'file',
        'simpleoutput'            => true,
        'baseinstalldir'          => '/',
        'packagedirectory'        => './',
        'dir_roles'               => array(
            'Services'            => 'php',
            'Services/Twilio'     => 'php',
            'tests'               => 'test'
        ),
        'ignore'                  => array(
            'package.php',
            '*.tgz',
            'scratch/*',
            'vendor/*',
            'composer.*',
            'coverage/*',
            '.travis.yml',
            'venv/*',
        )
    )
);

$package->setPackage('Services_Twilio');
$package->setSummary('PHP helper library for Twilio');
$package->setDescription($description);
$package->setChannel('twilio.github.com/pear');
$package->setPackageType('php');
$package->setLicense(
    'MIT License',
    'http://creativecommons.org/licenses/MIT/'
);

$package->setNotes($release_notes);
$package->setReleaseVersion($release_version);
$package->setReleaseStability($release_state);
$package->setAPIVersion($api_version);
$package->setAPIStability($api_state);

$package->addMaintainer(
    'lead',
    'kevinburke',
    'Kevin Burke',
    'kevin@twilio.com'
);

$package->setPhpDep('5.2.1');

$package->addPackageDepWithChannel('optional', 'Mockery', 'pear.survivethedeepend.com');

$package->setPearInstallerDep('1.9.3');
$package->generateContents();
$package->addRelease();

if (isset($_GET['make'])
    || (isset($_SERVER['argv']) && @$_SERVER['argv'][1] == 'make')
) {
    $package->writePackageFile();
} else {
    $package->debugPackageFile();
}

?>


text:
package kuusisto.tinysound;
import kuusisto.tinysound.internal.Mixer;
import kuusisto.tinysound.internal.MusicReference;

/**
 * The Music class is an abstraction for music.  Music objects should only be
 * loaded via the TinySound loadMusic() functions.  Music can be
 * played, paused, resumed, stopped and looped from specified positions.
 *
 * @author Finn Kuusisto
 */
public class Music {

	private byte[] left;
	private byte[] right;
	private Mixer mixer;
	private MusicReference reference;

	/**
	 * Construct a new Music with the given music data and the Mixer with which
	 * to register this Music.
	 * @param left left channel of music data
	 * @param right right channel of music data
	 * @param mixer Mixer with which this Music is registered
	 */
	public Music(byte[] left, byte[] right, Mixer mixer) {
		this.left = left;
		this.right = right;
		this.mixer = mixer;
		this.reference = new MusicReference(this.left, this.right, false, false,
				0, 0, 1.0);
		this.mixer.registerMusicReference(this.reference);
	}

	/**
	 * Play this Music and loop if specified.
	 * @param loop if this Music should loop
	 */
	public void play(boolean loop) {
		this.reference.setPlaying(true);
		this.reference.setLoop(loop);
	}

	/**
	 * Play this Music at the specified volume and loop if specified.
	 * @param loop if this Music should loop
	 * @param volume the volume to play the this Music
	 */
	public void play(boolean loop, double volume) {
		this.reference.setPlaying(true);
		this.setLoop(loop);
		this.setVolume(volume);
	}

	/**
	 * Stop playing this Music and set its position to the beginning.
	 */
	public void stop() {
		this.reference.setPlaying(false);
		this.rewind();
	}

	/**
	 * Stop playing this Music and keep its current position.
	 */
	public void pause() {
		this.reference.setPlaying(false);
	}

	/**
	 * Play this Music from its current position.
	 */
	public void resume() {
		this.reference.setPlaying(true);
	}

	/**
	 * Set this Music's position to the beginning.
	 */
	public void rewind() {
		this.reference.setPosition(0);
	}

	/**
	 * Set this Music's position to the loop position.
	 */
	public void rewindToLoopPosition() {
		int byteIndex = this.reference.getLoopPosition();
		this.reference.setPosition(byteIndex);
	}

	/**
	 * Determine if this Music is playing.
	 * @return true if this Music is playing
	 */
	public boolean playing() {
		return this.reference.getPlaying();
	}

	/**
	 * Determine if this Music will loop.
	 * @return true if this Music will loop
	 */
	public boolean loop() {
		return this.reference.getLoop();
	}

	/**
	 * Set whether this Music will loop.
	 * @param loop whether this Music will loop
	 */
	public void setLoop(boolean loop) {
		this.reference.setLoop(loop);
	}

	/**
	 * Get the loop position of this Music by sample frame.
	 * @return loop position by sample frame
	 */
	public int getLoopPositionByFrame() {
		int byteIndex = this.reference.getLoopPosition();
		return (byteIndex / TinySound.FORMAT.getFrameSize());
	}

	/**
	 * Get the loop position of this Music by seconds.
	 * @return loop position by seconds
	 */
	public double getLoopPositionBySeconds() {
		int byteIndex = this.reference.getLoopPosition();
		return (int)(byteIndex / (TinySound.FORMAT.getFrameRate() *
				TinySound.FORMAT.getFrameSize()));
	}

	/**
	 * Set the loop position of this Music by sample frame.
	 * @param frameIndex sample frame loop position to set
	 */
	public void setLoopPositionByFrame(int frameIndex) {
		int byteIndex = frameIndex * TinySound.FORMAT.getFrameSize();
		this.reference.setLoopPosition(byteIndex);
	}

	/**
	 * Set the loop position of this Music by seconds.
	 * @param seconds loop position to set by seconds
	 */
	public void setLoopPositionBySeconds(double seconds) {
		int byteIndex = (int)(seconds * TinySound.FORMAT.getFrameRate() *
			TinySound.FORMAT.getFrameSize());
		this.reference.setLoopPosition(byteIndex);
	}

	/**
	 * Get the volume of this Music.
	 * @return volume of this Music
	 */
	public double getVolume() {
		return this.reference.getVolume();
	}

	/**
	 * Set the volume of this Music.
	 * @param volume the desired volume of this Music
	 */
	public void setVolume(double volume) {
		if (volume >= 0.0) {
			this.reference.setVolume(volume);
		}
	}

	/**
	 * Unload this Music from the system.  Attempts to use this Music after
	 * unloading will result in error.
	 */
	public void unload() {
		//unregister the reference
		this.mixer.unRegisterMusicReference(this.reference);
		this.mixer = null;
		this.left = null;
		this.right = null;
		this.reference = null;
	}

}


text:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Activity extends CI_Controller {

	/**
	 * Index Page for this controller.
	 */
	function __construct(){
		parent::__construct();
		$this->load->model('link_model');
		$this->load->model('activity_model');
		$this->load->model('join_model');
		$this->load->library('session');
		$this->load->helper('url');
	}

	public function index()
	{
		$id = $_GET['id'];
		$data['result'] = $this->activity_model->get_activity_by_id($id);
		if ($data['result'] == '' || $data['result'] == null) {
			redirect('http://www.qfdlqz.com/error');
		}else{
			$this->load->view("about_activity.html",$data);
			$this->load->view("about_footer.html");
		}
	}

	public function join(){
		$id = $_GET['id'];
		$res = $this->activity_model->get_activity_by_id($id);
		// file_put_contents('/home/tanxu/www/data.txt', $res);
		if ($res == '') {
			echo '-2';
			exit;
		}

		if (!isset($_SESSION['uid'])) {
			echo '-1';
			exit();
		}
		$join = $this->join_model->get_uid_activity($id, $_SESSION['uid']);
		if($join != []){
			echo '0';
			exit();
		}else{
			$join_data = array(
					"uid"=>$_SESSION['uid'],
					"activity_id"=>$id,
				);
			$this->join_model->add($join_data);
			echo '1';
			exit();
		}

	}

}


text:
   /**
    *  Gets URI that identifies the test.
    *  @return uri identifier of test
    */
function getTargetURI() {
      return "http://www.w3.org/2001/DOM-Test-Suite/level3/core/nodelookupprefix17";
   }

var docsLoaded = -1000000;
var builder = null;

//
//   This function is called by the testing framework before
//      running the test suite.
//
//   If there are no configuration exceptions, asynchronous
//        document loading is started.  Otherwise, the status
//        is set to complete and the exception is immediately
//        raised when entering the body of the test.
//
function setUpPage() {
   setUpPageStatus = 'running';
   try {
     //
     //   creates test document builder, may throw exception
     //
     builder = createConfiguredBuilder();
       setImplementationAttribute("namespaceAware", true);

      docsLoaded = 0;

      var docRef = null;
      if (typeof(this.doc) != 'undefined') {
        docRef = this.doc;
      }
      docsLoaded += preload(docRef, "doc", "hc_staff");

       if (docsLoaded == 1) {
          setUpPageStatus = 'complete';
       }
    } catch(ex) {
    	catchInitializationError(builder, ex);
        setUpPageStatus = 'complete';
    }
}

//
//   This method is called on the completion of
//      each asychronous load started in setUpTests.
//
//   When every synchronous loaded document has completed,
//      the page status is changed which allows the
//      body of the test to be executed.
function loadComplete() {
    if (++docsLoaded == 1) {
        setUpPageStatus = 'complete';
    }
}

/**
*
	Invoke lookupPrefix on the title attribute node of the acronym node with
	a namespaceURI and a node prefix and check if the value of the prefix returned by
	using its namespaceURI as a parameter is valid.

* @author IBM
* @author Jenny Hsu
* @see http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core#Node3-lookupNamespacePrefix
*/
function nodelookupprefix17() {
   var success;
    if(checkInitialization(builder, "nodelookupprefix17") != null) return;
    var doc;
      var elem;
      var elemList;
      var attributesMap;
      var attr;
      var prefix;

      var docRef = null;
      if (typeof(this.doc) != 'undefined') {
        docRef = this.doc;
      }
      doc = load(docRef, "doc", "hc_staff");
      elemList = doc.getElementsByTagName("acronym");
      elem = elemList.item(2);
      attributesMap = elem.attributes;

      attr = attributesMap.getNamedItem("xsi:noNamespaceSchemaLocation");
      prefix = attr.lookupPrefix("http://www.netzero.com");
      assertEquals("nodelookupprefix17","dmstc",prefix);

}

function runTest() {
   nodelookupprefix17();
}


text:
package org.jf.dexlib2.writer;

import javax.annotation.*;

public interface ProtoSection<StringKey, TypeKey, ProtoKey, TypeListKey> extends IndexSection<ProtoKey> {
    @Nonnull
    StringKey getShorty(@Nonnull ProtoKey key);

    @Nonnull
    TypeKey getReturnType(@Nonnull ProtoKey key);

    @Nullable
    TypeListKey getParameters(@Nonnull ProtoKey key);
}


text:
using blink::WebTouchEvent;

namespace content {

SyntheticGestureTargetAndroid::SyntheticGestureTargetAndroid(
    RenderWidgetHostImpl* host,
    base::android::ScopedJavaLocalRef<jobject> touch_event_synthesizer)
    : SyntheticGestureTargetBase(host),
      touch_event_synthesizer_(touch_event_synthesizer) {
  DCHECK(!touch_event_synthesizer_.is_null());
}

SyntheticGestureTargetAndroid::~SyntheticGestureTargetAndroid() {
}

bool SyntheticGestureTargetAndroid::RegisterTouchEventSynthesizer(JNIEnv* env) {
  return RegisterNativesImpl(env);
}

void SyntheticGestureTargetAndroid::TouchSetPointer(
    JNIEnv* env, int index, int x, int y, int id) {
  TRACE_EVENT0("input", "SyntheticGestureTargetAndroid::TouchSetPointer");
  Java_TouchEventSynthesizer_setPointer(env, touch_event_synthesizer_.obj(),
                                      index, x, y, id);
}

void SyntheticGestureTargetAndroid::TouchInject(
    JNIEnv* env, Action action, int pointer_count, int64 time_in_ms) {
  TRACE_EVENT0("input", "SyntheticGestureTargetAndroid::TouchInject");
  Java_TouchEventSynthesizer_inject(env, touch_event_synthesizer_.obj(),
                                    static_cast<int>(action), pointer_count,
                                    time_in_ms);
}

void SyntheticGestureTargetAndroid::DispatchWebTouchEventToPlatform(
    const blink::WebTouchEvent& web_touch, const ui::LatencyInfo&) {
  JNIEnv* env = base::android::AttachCurrentThread();

  SyntheticGestureTargetAndroid::Action action =
      SyntheticGestureTargetAndroid::ActionInvalid;
  switch (web_touch.type) {
    case blink::WebInputEvent::TouchStart:
      action = SyntheticGestureTargetAndroid::ActionStart;
      break;
    case blink::WebInputEvent::TouchMove:
      action = SyntheticGestureTargetAndroid::ActionMove;
      break;
    case blink::WebInputEvent::TouchCancel:
      action = SyntheticGestureTargetAndroid::ActionCancel;
      break;
    case blink::WebInputEvent::TouchEnd:
      action = SyntheticGestureTargetAndroid::ActionEnd;
      break;
    default:
      NOTREACHED();
  }
  const unsigned num_touches = web_touch.touchesLength;
  for (unsigned i = 0; i < num_touches; ++i) {
    const blink::WebTouchPoint* point = &web_touch.touches[i];
    TouchSetPointer(env, i, point->position.x, point->position.y, point->id);
  }

  TouchInject(env, action, num_touches,
              static_cast<int64>(web_touch.timeStampSeconds * 1000.0));
}

SyntheticGestureParams::GestureSourceType
SyntheticGestureTargetAndroid::GetDefaultSyntheticGestureSourceType() const {
  return SyntheticGestureParams::TOUCH_INPUT;
}

bool SyntheticGestureTargetAndroid::SupportsSyntheticGestureSourceType(
    SyntheticGestureParams::GestureSourceType gesture_source_type) const {
  return gesture_source_type == SyntheticGestureParams::TOUCH_INPUT;
}

int SyntheticGestureTargetAndroid::GetTouchSlopInDips() const {
  float device_scale_factor =
      gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().device_scale_factor();
  return gfx::ViewConfiguration::GetTouchSlopInPixels() / device_scale_factor;
}

}  // namespace content


text:
local YwDeclare = YwDeclare
local YwClass = YwClass

local DLog = YwDebug.Log
local DLogWarn = YwDebug.LogWarning
local DLogError = YwDebug.LogError

-- Register new class LgDestroyer.
local strClassName = "LgDestroyer"
local LgDestroyer = YwDeclare(strClassName, YwClass(strClassName))

-- Member variables.

-- The c# class object.
LgDestroyer.this = false

-- The transform.
LgDestroyer.transform = false

-- The c# gameObject.
LgDestroyer.gameObject = false

-- Whether or not this gameobject should destroyed after a delay, on Awake.
LgDestroyer.m_bDestroyOnAwake = false

-- The delay for destroying it on Awake.
LgDestroyer.m_fAwakeDestroyDelay = 0.0

-- Find a child game object and delete it.
LgDestroyer.m_bFindChild = false

-- Name the child object in Inspector.
LgDestroyer.m_strNamedChild = ""

-- Awake method.
function LgDestroyer:Awake()
    --print("LgDestroyer:Awake")

    -- Check variable.
    if (not self.this) or (not self.transform) or (not self.gameObject) then
        DLogError("Init error in LgDestroyer!")
        return
    end

    -- If the gameobject should be destroyed on awake,
    if self.m_bDestroyOnAwake then
        if self.m_bFindChild then
            GameObject.Destroy(self.transform:Find(self.m_strNamedChild).gameObject)
        else
            -- ... destroy the gameobject after the delay.
            GameObject.Destroy(self.gameObject, self.m_fAwakeDestroyDelay)
        end
    end
end

-- Destroy child game object method.
function LgDestroyer:DestroyChildGameObject()
    --print("LgDestroyer:DestroyChildGameObject")

    -- Destroy this child gameobject, this can be called from an Animation Event.
    local cObj = self.transform:Find(self.m_strNamedChild).gameObject
    if not Slua.IsNull(cObj) then
        GameObject.Destroy(cObj)
    end
end

-- Disable child game object method.
function LgDestroyer:DisableChildGameObject()
    --print("LgDestroyer:DisableChildGameObject")

    -- Destroy this child gameobject, this can be called from an Animation Event.
    local cObj = self.transform:Find(self.m_strNamedChild).gameObject
    if cObj.activeSelf then
        cObj:SetActive(false)
    end
end

function LgDestroyer:DestroyGameObject()
    --print("LgDestroyer:DestroyGameObject")

    -- Destroy this gameobject, this can be called from an Animation Event.
    GameObject.Destroy(self.gameObject)
end

-- Return this class.
return LgDestroyer


text:
.sc-context-section {
  display: flex;
  flex-direction: column;
}

.sc-context-section > .se-context-content {
  flex: 1 1 0;
  overflow: auto;
}


text:
.. _exhale_function_namespacelibecpint_1af2fa15848e7d9cfe1e61fc579a94080d:

Function libecpint::realSphericalHarmonics
==========================================

- Defined in :ref:`file__Users_robertshaw_devfiles_libecpint_new_src_lib_mathutil.cpp`

Function Documentation
----------------------

.. doxygenfunction:: libecpint::realSphericalHarmonics(int, double, double)


text:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.smacgregor.foreverhome" >

    <!-- Used by instrumentation tests only. Do not include in live build ! -->
    <uses-permission android:name="android.permission.DISABLE_KEYGUARD" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission android:name="android.permission.READ_LOGS" />

</manifest>


text:
#include "tensorflow/core/kernels/cwise_ops_common.h"

namespace tensorflow {
REGISTER8(BinaryOp, CPU, "Maximum", functor::maximum, float, Eigen::half,
          bfloat16, double, uint8, int16, int32, int64);
#if GOOGLE_CUDA || TENSORFLOW_USE_ROCM
#if !defined(MLIR_GENERATED_GPU_KERNELS_ENABLED)
REGISTER6(BinaryOp, GPU, "Maximum", functor::maximum, float, Eigen::half,
          double, uint8, int16, int64);
#else
// TODO(b/172804967): We do not generate unsigned kernels for GPU via mlir.
REGISTER(BinaryOp, GPU, "Maximum", functor::maximum, uint8);
#endif

// A special GPU kernel for int32.
// TODO(b/25387198): Also enable int32 in device memory. This kernel
// registration requires all int32 inputs and outputs to be in host memory.
REGISTER_KERNEL_BUILDER(Name("Maximum")
                            .Device(DEVICE_GPU)
                            .HostMemory("x")
                            .HostMemory("y")
                            .HostMemory("z")
                            .TypeConstraint<int32>("T"),
                        BinaryOp<CPUDevice, functor::maximum<int32>>);
#endif

}  // namespace tensorflow


text:
package com.intellij.vcs.log.ui;

import com.google.common.util.concurrent.SettableFuture;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.extensions.ExtensionPointName;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.MessageType;
import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.util.NamedRunnable;
import com.intellij.openapi.vcs.ui.VcsBalloonProblemNotifier;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.wm.IdeFocusManager;
import com.intellij.util.PairFunction;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.ui.UIUtil;
import com.intellij.vcs.log.*;
import com.intellij.vcs.log.data.VcsLogData;
import com.intellij.vcs.log.impl.VcsLogImpl;
import com.intellij.vcs.log.impl.VcsLogUiProperties;
import com.intellij.vcs.log.ui.highlighters.VcsLogHighlighterFactory;
import com.intellij.vcs.log.ui.table.GraphTableModel;
import com.intellij.vcs.log.ui.table.VcsLogGraphTable;
import com.intellij.vcs.log.visible.VisiblePack;
import com.intellij.vcs.log.visible.VisiblePackChangeListener;
import com.intellij.vcs.log.visible.VisiblePackRefresher;
import org.jetbrains.annotations.NotNull;

import java.awt.*;
import java.util.ArrayList;
import java.util.Collection;
import java.util.concurrent.Future;

public abstract class AbstractVcsLogUi implements VcsLogUi, Disposable {
  private static final Logger LOG = Logger.getInstance(AbstractVcsLogUi.class);
  public static final ExtensionPointName<VcsLogHighlighterFactory> LOG_HIGHLIGHTER_FACTORY_EP =
    ExtensionPointName.create("com.intellij.logHighlighterFactory");

  @NotNull protected final Project myProject;
  @NotNull protected final VcsLogData myLogData;
  @NotNull protected final VcsLogColorManager myColorManager;
  @NotNull protected final VcsLog myLog;
  @NotNull protected final VisiblePackRefresher myRefresher;

  @NotNull protected final Collection<VcsLogListener> myLogListeners = ContainerUtil.newArrayList();
  @NotNull protected final VisiblePackChangeListener myVisiblePackChangeListener;

  @NotNull protected VisiblePack myVisiblePack;

  public AbstractVcsLogUi(@NotNull VcsLogData logData,
                          @NotNull Project project,
                          @NotNull VcsLogColorManager manager,
                          @NotNull VisiblePackRefresher refresher) {
    myProject = project;
    myLogData = logData;
    myRefresher = refresher;
    myColorManager = manager;

    Disposer.register(this, myRefresher);

    myLog = new VcsLogImpl(logData, this);
    myVisiblePack = VisiblePack.EMPTY;

    myVisiblePackChangeListener = visiblePack -> UIUtil.invokeLaterIfNeeded(() -> {
      if (!Disposer.isDisposed(this)) {
        setVisiblePack(visiblePack);
      }
    });
    myRefresher.addVisiblePackChangeListener(myVisiblePackChangeListener);
  }

  public void requestFocus() {
    // todo fix selection
    VcsLogGraphTable graphTable = getTable();
    if (graphTable.getRowCount() > 0) {
      IdeFocusManager.getInstance(myProject).requestFocus(graphTable, true).doWhenProcessed(() -> graphTable.setRowSelectionInterval(0, 0));
    }
  }

  public void setVisiblePack(@NotNull VisiblePack pack) {
    ApplicationManager.getApplication().assertIsDispatchThread();

    boolean permGraphChanged = myVisiblePack.getDataPack() != pack.getDataPack();

    myVisiblePack = pack;

    onVisiblePackUpdated(permGraphChanged);

    fireFilterChangeEvent(myVisiblePack, permGraphChanged);
    getTable().repaint();
  }

  protected abstract void onVisiblePackUpdated(boolean permGraphChanged);

  @NotNull
  public abstract VcsLogGraphTable getTable();

  @NotNull
  public abstract Component getMainComponent();

  protected abstract VcsLogFilterCollection getFilters();

  @NotNull
  public abstract VcsLogUiProperties getProperties();

  public abstract boolean isShowRootNames();

  @Override
  public boolean areGraphActionsEnabled() {
    return getTable().getRowCount() > 0;
  }

  @NotNull
  public VisiblePackRefresher getRefresher() {
    return myRefresher;
  }

  @NotNull
  public VcsLogColorManager getColorManager() {
    return myColorManager;
  }

  @NotNull
  public Project getProject() {
    return myProject;
  }

  @NotNull
  public VcsLog getVcsLog() {
    return myLog;
  }

  @NotNull
  public VcsLogData getLogData() {
    return myLogData;
  }

  @Override
  @NotNull
  public VisiblePack getDataPack() {
    ApplicationManager.getApplication().assertIsDispatchThread();
    return myVisiblePack;
  }

  @NotNull
  public Future<Boolean> jumpToCommit(@NotNull Hash commitHash, @NotNull VirtualFile root) {
    SettableFuture<Boolean> future = SettableFuture.create();
    jumpToCommit(commitHash, root, future);
    return future;
  }

  public void jumpToCommit(@NotNull Hash commitHash, @NotNull VirtualFile root, @NotNull SettableFuture<Boolean> future) {
    jumpTo(commitHash, (model, hash) -> model.getRowOfCommit(hash, root), future);
  }

  public void jumpToCommitByPartOfHash(@NotNull String commitHash, @NotNull SettableFuture<Boolean> future) {
    jumpTo(commitHash, GraphTableModel::getRowOfCommitByPartOfHash, future);
  }

  protected <T> void jumpTo(@NotNull final T commitId,
                            @NotNull final PairFunction<GraphTableModel, T, Integer> rowGetter,
                            @NotNull final SettableFuture<Boolean> future) {
    if (future.isCancelled()) return;

    GraphTableModel model = getTable().getModel();

    int row = rowGetter.fun(model, commitId);
    if (row >= 0) {
      getTable().jumpToRow(row);
      future.set(true);
    }
    else if (model.canRequestMore()) {
      model.requestToLoadMore(() -> jumpTo(commitId, rowGetter, future));
    }
    else if (!myVisiblePack.isFull()) {
      invokeOnChange(() -> jumpTo(commitId, rowGetter, future));
    }
    else {
      handleCommitNotFound(commitId, rowGetter);
      future.set(false);
    }
  }

  protected <T> void handleCommitNotFound(@NotNull T commitId, @NotNull PairFunction<GraphTableModel, T, Integer> rowGetter) {
    VcsBalloonProblemNotifier.showOverChangesView(myProject, "Commit " + commitId.toString() + " not found.", MessageType.WARNING);
  }

  protected void showWarningWithLink(@NotNull String mainText, @NotNull String linkText, @NotNull Runnable onClick) {
    VcsBalloonProblemNotifier.showOverChangesView(myProject, mainText, MessageType.WARNING,
                                                  new NamedRunnable(linkText) {
                                                    @Override
                                                    public void run() {
                                                      onClick.run();
                                                    }
                                                  });
  }

  @Override
  public void addLogListener(@NotNull VcsLogListener listener) {
    ApplicationManager.getApplication().assertIsDispatchThread();
    myLogListeners.add(listener);
  }

  @Override
  public void removeLogListener(@NotNull VcsLogListener listener) {
    ApplicationManager.getApplication().assertIsDispatchThread();
    myLogListeners.remove(listener);
  }

  protected void fireFilterChangeEvent(@NotNull VisiblePack visiblePack, boolean refresh) {
    ApplicationManager.getApplication().assertIsDispatchThread();
    Collection<VcsLogListener> logListeners = new ArrayList<>(myLogListeners);

    for (VcsLogListener listener : logListeners) {
      listener.onChange(visiblePack, refresh);
    }
  }

  public void invokeOnChange(@NotNull final Runnable runnable) {
    addLogListener(new VcsLogListener() {
      @Override
      public void onChange(@NotNull VcsLogDataPack dataPack, boolean refreshHappened) {
        runnable.run();
        removeLogListener(this);
      }
    });
  }

  @Override
  public void dispose() {
    LOG.assertTrue(ApplicationManager.getApplication().isDispatchThread());
    myRefresher.removeVisiblePackChangeListener(myVisiblePackChangeListener);
    getTable().removeAllHighlighters();
    myVisiblePack = VisiblePack.EMPTY;
  }
}


text:
namespace wgt
{
class ObjectHandle;
class Collection;

class IEnumGenerator
{
public:
	virtual ~IEnumGenerator() {}
	virtual Collection getCollection( const ObjectHandle & provider, const IDefinitionManager & definitionManager ) = 0;
};

typedef std::unique_ptr<IEnumGenerator> IEnumGeneratorPtr;
} // end namespace wgt
#endif //I_ENUM_GENERATOR_HPP


text:
set -e

# Get the postgres user or set it to a default value
if [ -n $POSTGRES_USER ]; then pg_user=$POSTGRES_USER; else pg_user="postgres"; fi
# Get the postgres db or set it to a default value
if [ -n $POSTGRES_DB ]; then pg_db=$POSTGRES_DB; else pg_db=$POSTGRES_USER; fi

if [ -n "$POSTGRES_NON_ROOT_USER" ]; then
psql -v ON_ERROR_STOP=1 --username "$pg_user" --dbname "$pg_db" <<-EOSQL
    CREATE USER $POSTGRES_NON_ROOT_USER with encrypted password '$POSTGRES_NON_ROOT_USER_PASSWORD';
    GRANT CREATE, CONNECT ON DATABASE $pg_db TO $POSTGRES_NON_ROOT_USER;
    ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT, UPDATE, INSERT, DELETE, REFERENCES ON TABLES TO $POSTGRES_NON_ROOT_USER;
EOSQL
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_NON_ROOT_USER" --dbname "$pg_db" < /docker-entrypoint-initdb.d/schema.pgsql.sql.txt
fi


text:
<?php

namespace DIISH\SComDisBundle\Entity;

use Doctrine\ORM\EntityRepository;

/**
 * PMHRepository
 *
 * This class was generated by the Doctrine ORM. Add your own custom
 * repository methods below.
 */
class PMHRepository extends EntityRepository
{
    /**
     * Save pmh
     *
     * @param \DIISH\SComDisBundle\Entity\PMH $mh
     * @throws \InvalidArgumentException
     */
    public function savePMH(PMH $pmh, $update = false)
    {
        if ($this->isExist($pmh, $update)) {
            throw new \InvalidArgumentException('Error: Duplicated PMH ID.');
        }

        $manager = $this->getEntityManager();
        $manager->persist($pmh);
        $manager->flush();
    }

    /**
     * Update pmh
     * @param \DIISH\SComDisBundle\Entity\PMH $pmh
     * @param type $update
     */
    public function updatePMH(PMH $pmh, $update = true)
    {
        $this->savePMH($pmh, $update);
    }

    /**
     * Check whether pmh already exist or not.
     *
     * @param \DIISH\SComDisBundle\Entity\PMH $pmh
     * @return boolean
     */
    public function isExist(PMH $pmh, $update = false)
    {
        $others = $this->findAll();
        foreach ($others as $other) {
            // check ID
            if ($other->getId() == $pmh->getId()) {
                if (!$update)
                    return true;
            }

            // check Client ID
            if ($other->getClinic()->getId() == $pmh->getClinic()->getId()) {
                if ($other->getId() != $pmh->getId())
                    return true;
            }
        }
        return false;
    }

    /**
     * Delete pmh.
     *
     * @param int $id
     * @throws \InvalidArgumentException
     */
    public function deletePMH($id)
    {
        $pmh = $this->find($id);
        if (!$pmh) {
            throw new \InvalidArgumentException('Error: PMH is not found.');
        }

        $manager = $this->getEntityManager();
        $manager->remove($pmh);
        $manager->flush();
    }
}


text:
.class Lcom/android/server/location/LocationBasedCountryDetector$1;
.super Ljava/lang/Object;
.source "LocationBasedCountryDetector.java"

# interfaces
.implements Landroid/location/LocationListener;

# annotations
.annotation system Ldalvik/annotation/EnclosingMethod;
    value = Lcom/android/server/location/LocationBasedCountryDetector;->detectCountry()Landroid/location/Country;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x0
    name = null
.end annotation

# instance fields
.field final synthetic this$0:Lcom/android/server/location/LocationBasedCountryDetector;

# direct methods
.method constructor <init>(Lcom/android/server/location/LocationBasedCountryDetector;)V
    .locals 0

    iput-object p1, p0, Lcom/android/server/location/LocationBasedCountryDetector$1;->this$0:Lcom/android/server/location/LocationBasedCountryDetector;

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method

# virtual methods
.method public onLocationChanged(Landroid/location/Location;)V
    .locals 1

    if-eqz p1, :cond_0

    iget-object v0, p0, Lcom/android/server/location/LocationBasedCountryDetector$1;->this$0:Lcom/android/server/location/LocationBasedCountryDetector;

    invoke-virtual {v0}, Lcom/android/server/location/LocationBasedCountryDetector;->stop()V

    iget-object v0, p0, Lcom/android/server/location/LocationBasedCountryDetector$1;->this$0:Lcom/android/server/location/LocationBasedCountryDetector;

    invoke-static {v0, p1}, Lcom/android/server/location/LocationBasedCountryDetector;->-wrap0(Lcom/android/server/location/LocationBasedCountryDetector;Landroid/location/Location;)V

    :cond_0
    return-void
.end method

.method public onProviderDisabled(Ljava/lang/String;)V
    .locals 0

    return-void
.end method

.method public onProviderEnabled(Ljava/lang/String;)V
    .locals 0

    return-void
.end method

.method public onStatusChanged(Ljava/lang/String;ILandroid/os/Bundle;)V
    .locals 0

    return-void
.end method


text:
/**
 * @requires OpenLayers/Control/Button.js
 */

/**
 * Class: OpenLayers.Control.ZoomToMaxExtent
 * The ZoomToMaxExtent control is a button that zooms out to the maximum
 * extent of the map. It is designed to be used with a
 * <OpenLayers.Control.Panel>.
 *
 * Inherits from:
 *  - <OpenLayers.Control>
 */
OpenLayers.Control.ZoomToMaxExtent = OpenLayers.Class(OpenLayers.Control.Button, {

    /**
     * Method: trigger
     *
     * Called whenever this control is being rendered inside of a panel and a
     *     click occurs on this controls element. Actually zooms to the maximum
     *     extent of this controls map.
     */
    trigger: function() {
        if (this.map) {
            this.map.zoomToMaxExtent();
        }
    },

    CLASS_NAME: "OpenLayers.Control.ZoomToMaxExtent"
});


text:
body{
	background: #0F0F0F;
	color: #fff;
}
.panel.panel-custom{
	cursor: pointer;
	background-clip: content-box;
	border:2px dashed #0001BF;
	margin-top: 20%;
}
.panel.panel-custom:hover{
	border-style: solid;
}
.panel.panel-custom .panel-heading img{
	margin: 0 auto;
	width: 250px;
}
.panel.panel-custom .panel-body{
	background: #01618F;
	color: #fff;
}


text:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>io.github.stevecrox</groupId>
    <artifactId>mirror-parent</artifactId>
    <version>0.0.2-SNAPSHOT</version>
  </parent>
  <artifactId>mirror-processors-common</artifactId>

  <dependencies>
    <dependency>
      <groupId>org.apache.camel</groupId>
      <artifactId>camel-core</artifactId>
    </dependency>
  </dependencies>

</project>