text:
#include <QXmlStreamReader>
#include <QXmlStreamWriter>
#include <QSettings>
#include <QLayout>
#include <QTimer>
#include <QDebug>

#include "vcspeeddialproperties.h"
#include "vcpropertieseditor.h"
#include "vcspeeddial.h"
#include "vcspeeddialfunction.h"
#include "vcspeeddialpreset.h"
#include "speeddial.h"
#include "qlcmacros.h"
#include "qlcfile.h"
#include "function.h"
#include "flowlayout.h"

#define UPDATE_TIMEOUT 50

const quint8 VCSpeedDial::absoluteInputSourceId = 0;
const quint8 VCSpeedDial::tapInputSourceId = 1;
const quint8 VCSpeedDial::multInputSourceId = 2;
const quint8 VCSpeedDial::divInputSourceId = 3;
const quint8 VCSpeedDial::multDivResetInputSourceId = 4;
const quint8 VCSpeedDial::applyInputSourceId = 5;
const QSize VCSpeedDial::defaultSize(QSize(200, 175));

static const QString presetBtnSS = "QPushButton { background-color: %1; height: 32px; border: 2px solid #6A6A6A; border-radius: 5px; }"
                                   "QPushButton:pressed { border: 2px solid #0000FF; }"
                                   "QPushButton:disabled { border: 2px solid #BBBBBB; color: #8f8f8f }";

/****************************************************************************
 * Initialization
 ****************************************************************************/

VCSpeedDial::VCSpeedDial(QWidget* parent, Doc* doc)
    : VCWidget(parent, doc)
    , m_currentFactor(1)
    , m_resetFactorOnDialChange(false)
    , m_absoluteValueMin(0)
    , m_absoluteValueMax(1000 * 10)
{
    setFrameStyle(KVCFrameStyleSunken);

    QVBoxLayout* vBox = new QVBoxLayout(this);
    vBox->setMargin(0);

    QHBoxLayout* speedDialHBox = new QHBoxLayout();
    vBox->addLayout(speedDialHBox);

    m_dial = new SpeedDial(this);
    speedDialHBox->addWidget(m_dial);
    connect(m_dial, SIGNAL(valueChanged(int)), this, SLOT(slotDialValueChanged()));
    connect(m_dial, SIGNAL(tapped()), this, SLOT(slotDialTapped()));

    m_factoredValue = m_dial->value();

    setType(VCWidget::SpeedDialWidget);
    setCaption(tr("Duration"));

    QSettings settings;
    QVariant var = settings.value(SETTINGS_SPEEDDIAL_SIZE);
    if (var.isValid() == true)
        resize(var.toSize());
    else
        resize(VCSpeedDial::defaultSize);

    var = settings.value(SETTINGS_SPEEDDIAL_VALUE);
    if (var.isValid() == true)
        m_dial->setValue(var.toUInt());

    // Multiplier, factor, divider and reset box
    QHBoxLayout* multFactorDivHBox = new QHBoxLayout();

    m_divButton = new QToolButton();
    m_divButton->setIconSize(QSize(32, 32));
    m_divButton->setIcon(QIcon(":/back.png"));
    m_divButton->setToolTip(tr("Divide the current time by 2"));
    connect(m_divButton, SIGNAL(clicked()),
            this, SLOT(slotDiv()));
    multFactorDivHBox->addWidget(m_divButton, Qt::AlignVCenter | Qt::AlignLeft);

    QVBoxLayout* labelsVboxBox = new QVBoxLayout();

    m_multDivLabel = new QLabel();
    m_multDivLabel->setAlignment(Qt::AlignCenter);
    m_multDivLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
    labelsVboxBox->addWidget(m_multDivLabel, Qt::AlignVCenter | Qt::AlignLeft);

    m_multDivResultLabel = new QLabel();
    m_multDivResultLabel->setAlignment(Qt::AlignCenter);
    m_multDivResultLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
    m_multDivResultLabel->setBackgroundRole(QPalette::BrightText);
    labelsVboxBox->addWidget(m_multDivResultLabel);

    multFactorDivHBox->addLayout(labelsVboxBox);

    m_multButton = new QToolButton();
    m_multButton->setIconSize(QSize(32, 32));
    m_multButton->setIcon(QIcon(":/forward.png"));
    m_multButton->setToolTip(tr("Multiply the current time by 2"));
    connect(m_multButton, SIGNAL(clicked()),
            this, SLOT(slotMult()));
    multFactorDivHBox->addWidget(m_multButton, Qt::AlignVCenter | Qt::AlignLeft);

    m_multDivResetButton = new QToolButton();
    m_multDivResetButton->setIconSize(QSize(32, 32));
    m_multDivResetButton->setIcon(QIcon(":/fileclose.png"));
    m_multDivResetButton->setToolTip(tr("Reset the current factor to 1x"));
    connect(m_multDivResetButton, SIGNAL(clicked()),
            this, SLOT(slotMultDivReset()));
    multFactorDivHBox->addWidget(m_multDivResetButton);

    vBox->addLayout(multFactorDivHBox);

    // Update labels
    slotMultDivChanged();

    // Apply button
    m_applyButton = new QPushButton();
    m_applyButton->setStyleSheet(presetBtnSS.arg("#DDDDDD"));
    m_applyButton->setText(tr("Apply"));
    m_applyButton->setToolTip(tr("Send the current value to the function now"));
    connect(m_applyButton, SIGNAL(clicked()),
            this, SLOT(slotFactoredValueChanged()));
    vBox->addWidget(m_applyButton);

    // Presets
    m_presetsLayout = new FlowLayout(3);
    vBox->addLayout(m_presetsLayout);

    // Don't show Infinite button: it's handled by presets
    setVisibilityMask(SpeedDial::defaultVisibilityMask() & ~SpeedDial::Infinite);

    /* Update timer */
    m_updateTimer = new QTimer(this);
    connect(m_updateTimer, SIGNAL(timeout()),
            this, SLOT(slotUpdate()));
    m_updateTimer->setSingleShot(true);

    slotModeChanged(m_doc->mode());
    setLiveEdit(m_liveEdit);
}

VCSpeedDial::~VCSpeedDial()
{
    foreach(VCSpeedDialPreset* preset, m_presets)
    {
        delete preset;
    }
}

void VCSpeedDial::enableWidgetUI(bool enable)
{
    m_dial->setEnabled(enable);

    // Mult and div
    m_multButton->setEnabled(enable);
    m_divButton->setEnabled(enable);
    m_multDivResetButton->setEnabled(enable);

    // Apply
    m_applyButton->setEnabled(enable);

    // Presets enable
    foreach (QWidget *presetWidget, m_presets.keys())
        presetWidget->setEnabled(enable);

    // Presets: update state
    if (enable)
        slotUpdate();
}

/*****************************************************************************
 * Clipboard
 *****************************************************************************/

VCWidget* VCSpeedDial::createCopy(VCWidget* parent)
{
    Q_ASSERT(parent != NULL);

    VCSpeedDial* dial = new VCSpeedDial(parent, m_doc);
    if (dial->copyFrom(this) == false)
    {
        delete dial;
        dial = NULL;
    }

    return dial;
}

bool VCSpeedDial::copyFrom(const VCWidget* widget)
{
    const VCSpeedDial* dial = qobject_cast<const VCSpeedDial*> (widget);
    if (dial == NULL)
        return false;

    setFunctions(dial->functions());
    setAbsoluteValueRange(dial->absoluteValueMin(), dial->absoluteValueMax());
    setVisibilityMask(dial->visibilityMask());
    setResetFactorOnDialChange(dial->resetFactorOnDialChange());

    setTapKeySequence(dial->tapKeySequence());
    setMultKeySequence(dial->multKeySequence());
    setDivKeySequence(dial->divKeySequence());
    setMultDivResetKeySequence(dial->multDivResetKeySequence());
    setApplyKeySequence(dial->applyKeySequence());

    resetPresets();
    foreach (VCSpeedDialPreset const* preset, dial->presets())
    {
        addPreset(*preset);
    }

    /* Copy common stuff */
    return VCWidget::copyFrom(widget);
}

/*****************************************************************************
 * Properties
 *****************************************************************************/

void VCSpeedDial::editProperties()
{
    VCSpeedDialProperties sdp(this, m_doc);
    sdp.exec();
}

/*****************************************************************************
 * Caption
 *****************************************************************************/

void VCSpeedDial::setCaption(const QString& text)
{
    VCWidget::setCaption(text);

    Q_ASSERT(m_dial != NULL);
    m_dial->setTitle(text);
}

/*****************************************************************************
 * QLC Mode
 *****************************************************************************/

void VCSpeedDial::slotModeChanged(Doc::Mode mode)
{
    if (mode == Doc::Operate && isDisabled() == false)
    {
        enableWidgetUI(true);
        updateFeedback();
    }
    else
    {
        m_dial->stopTimers();
        enableWidgetUI(false);
    }
    VCWidget::slotModeChanged(mode);
}

/****************************************************************************
 * Functions
 ****************************************************************************/

void VCSpeedDial::setFunctions(const QList <VCSpeedDialFunction> & functions)
{
    m_functions = functions;
}

QList <VCSpeedDialFunction> VCSpeedDial::functions() const
{
    return m_functions;
}

void VCSpeedDial::tap()
{
    m_dial->tap();
}

void VCSpeedDial::slotDialValueChanged()
{
    // The (m_currentFactor != 1) test ensures that we don't call
    // slotMultDivChanged() 2 times
    if (m_resetFactorOnDialChange && m_currentFactor != 1)
        slotMultDivReset();
    else
        slotMultDivChanged();

    m_updateTimer->start(UPDATE_TIMEOUT);
}

void VCSpeedDial::slotDialTapped()
{
    foreach (const VCSpeedDialFunction &speeddialfunction, m_functions)
    {
        Function* function = m_doc->function(speeddialfunction.functionId);
        if (function != NULL)
        {
            if (speeddialfunction.durationMultiplier != VCSpeedDialFunction::None)
                function->tap();
        }
    }
}

void VCSpeedDial::slotUpdate()
{
    int currentValue = m_dial->value();

    for (QHash<QWidget*, VCSpeedDialPreset*>::iterator it = m_presets.begin();
            it != m_presets.end(); ++it)
    {
        QWidget* widget = it.key();
        VCSpeedDialPreset* preset = it.value();

        QPushButton* button = reinterpret_cast<QPushButton*>(widget);
        button->setDown(preset->m_value == currentValue);
    }
    updateFeedback();
}

/*********************************************************************
 * Presets
 *********************************************************************/

void VCSpeedDial::addPreset(VCSpeedDialPreset const& preset)
{
    QWidget *presetWidget = NULL;

    {
        QPushButton *presetButton = new QPushButton(this);
        presetWidget = presetButton;
        presetButton->setStyleSheet(presetBtnSS.arg("#BBBBBB"));
        presetButton->setMinimumWidth(36);
        presetButton->setMaximumWidth(80);
        presetButton->setFocusPolicy(Qt::TabFocus);
        QString btnLabel = preset.m_name;
        presetButton->setToolTip(btnLabel);
        presetButton->setText(fontMetrics().elidedText(btnLabel, Qt::ElideRight, 72));
    }

    Q_ASSERT(presetWidget != NULL);

    connect(reinterpret_cast<QPushButton*>(presetWidget), SIGNAL(clicked()),
            this, SLOT(slotPresetClicked()));

    if (mode() == Doc::Design)
        presetWidget->setEnabled(false);

    m_presets[presetWidget] = new VCSpeedDialPreset(preset);
    m_presetsLayout->addWidget(presetWidget);

    if (m_presets[presetWidget]->m_inputSource != NULL)
    {
        setInputSource(m_presets[presetWidget]->m_inputSource,
                       m_presets[presetWidget]->m_id);
    }

    m_updateTimer->start(UPDATE_TIMEOUT);
}

void VCSpeedDial::resetPresets()
{
    for (QHash<QWidget*, VCSpeedDialPreset*>::iterator it = m_presets.begin();
            it != m_presets.end(); ++it)
    {
        QWidget* widget = it.key();
        m_presetsLayout->removeWidget(widget);
        delete widget;

        VCSpeedDialPreset* preset = it.value();
        if (!preset->m_inputSource.isNull())
            setInputSource(QSharedPointer<QLCInputSource>(), preset->m_id);
        delete preset;
    }
    m_presets.clear();
}

QList<VCSpeedDialPreset*> VCSpeedDial::presets() const
{
    QList<VCSpeedDialPreset*> presetsList = m_presets.values();
    qSort(presetsList.begin(), presetsList.end(), VCSpeedDialPreset::compare);
    return presetsList;
}

void VCSpeedDial::slotPresetClicked()
{
    QPushButton *btn = qobject_cast<QPushButton*>(sender());
    VCSpeedDialPreset *preset = m_presets[btn];

    Q_ASSERT(preset != NULL);

    {
        // Special case: infinite buttons should act as checkboxes
        // so the previous value can be restore when clicking 2 times on them
        if (preset->m_value == (int)Function::infiniteSpeed())
        {
            m_dial->toggleInfinite();
        }
        else // Normal case
        {
            m_dial->setValue(preset->m_value, true);
        }
    }
}

void VCSpeedDial::slotMult()
{
    if (m_currentFactor == -2)
    {
        m_currentFactor = 1;
        slotMultDivChanged();
    }
    else if (m_currentFactor > 0)
    {
        if (m_currentFactor < 2048)
        {
            m_currentFactor *= 2;
            slotMultDivChanged();
        }
    }
    else
    {
        m_currentFactor /= 2;
        slotMultDivChanged();
    }
}

void VCSpeedDial::slotDiv()
{
    if (m_currentFactor == 1)
    {
        m_currentFactor = -2;
        slotMultDivChanged();
    }
    else if (m_currentFactor > 0)
    {
        m_currentFactor /= 2;
        slotMultDivChanged();
    }
    else
    {
        if (m_currentFactor > -2048)
        {
            m_currentFactor *= 2;
            slotMultDivChanged();
        }
    }
}

void VCSpeedDial::slotMultDivReset()
{
    if (m_currentFactor != 1)
    {
        m_currentFactor = 1;
        slotMultDivChanged();
    }
}

void VCSpeedDial::slotMultDivChanged()
{
    if (m_currentFactor > 0)
    {
        m_factoredValue = m_dial->value() * m_currentFactor;
        m_multDivLabel->setText(QString("%1x").arg(m_currentFactor));
    }
    else
    {
        m_factoredValue = m_dial->value() / qAbs(m_currentFactor);
        m_multDivLabel->setText(QString("1/%1x").arg(qAbs(m_currentFactor)));
    }
    m_multDivResultLabel->setText("(" + Function::speedToString(m_factoredValue) + ")");

    slotFactoredValueChanged();
}

void VCSpeedDial::slotFactoredValueChanged()
{
    const QVector<quint32> multipliers = VCSpeedDialFunction::speedMultiplierValuesTimes1000();

    int ms = m_factoredValue;

    foreach (const VCSpeedDialFunction &speeddialfunction, m_functions)
    {
        Function* function = m_doc->function(speeddialfunction.functionId);
        if (function != NULL)
        {
            if (speeddialfunction.fadeInMultiplier != VCSpeedDialFunction::None)
            {
                if ((uint)ms != Function::infiniteSpeed())
                    function->setFadeInSpeed(ms * multipliers[speeddialfunction.fadeInMultiplier] / 1000);
                else
                    function->setFadeInSpeed(ms);
            }
            if (speeddialfunction.fadeOutMultiplier != VCSpeedDialFunction::None)
            {
                if ((uint)ms != Function::infiniteSpeed())
                    function->setFadeOutSpeed(ms * multipliers[speeddialfunction.fadeOutMultiplier] / 1000);
                else
                    function->setFadeOutSpeed(ms);
            }
            if (speeddialfunction.durationMultiplier != VCSpeedDialFunction::None)
            {
                if ((uint)ms != Function::infiniteSpeed())
                    function->setDuration(ms * multipliers[speeddialfunction.durationMultiplier] / 1000);
                else
                    function->setDuration(ms);
            }
        }
    }
}

void VCSpeedDial::setResetFactorOnDialChange(bool value)
{
    m_resetFactorOnDialChange = value;
}

bool VCSpeedDial::resetFactorOnDialChange() const
{
    return m_resetFactorOnDialChange;
}

/*****************************************************************************
 * External input
 *****************************************************************************/

void VCSpeedDial::updateFeedback()
{
    int fbv = (int)SCALE(float(m_dial->value()), float(m_absoluteValueMin),
                     float(m_absoluteValueMax), float(0), float(UCHAR_MAX));

    sendFeedback(fbv, absoluteInputSourceId);

    for (QHash<QWidget*, VCSpeedDialPreset*>::iterator it = m_presets.begin();
            it != m_presets.end(); ++it)
    {
        VCSpeedDialPreset* preset = it.value();
        if (preset->m_inputSource != NULL)
        {
            QPushButton* button = reinterpret_cast<QPushButton*>(it.key());
            if (preset->m_inputSource.isNull() == false)
                sendFeedback(button->isDown() ?
                             preset->m_inputSource->upperValue() :
                             preset->m_inputSource->lowerValue(),
                             preset->m_inputSource);
        }
    }
}

void VCSpeedDial::slotInputValueChanged(quint32 universe, quint32 channel, uchar value)
{
    /* Don't let input data through in design mode or if disabled */
    if (acceptsInput() == false)
        return;

    quint32 pagedCh = (page() << 16) | channel;

    if (checkInputSource(universe, pagedCh, value, sender(), tapInputSourceId))
    {
        if (value != 0)
            m_dial->tap();
    }
    else if (checkInputSource(universe, pagedCh, value, sender(), absoluteInputSourceId))
    {
        int ms = static_cast<int> (SCALE(qreal(value), qreal(0), qreal(255),
                                         qreal(absoluteValueMin()),
                                         qreal(absoluteValueMax())));
        m_dial->setValue(ms, true);
    }
    else if (checkInputSource(universe, pagedCh, value, sender(), multInputSourceId))
    {
        if (value != 0)
            slotMult();
    }
    else if (checkInputSource(universe, pagedCh, value, sender(), divInputSourceId))
    {
        if (value != 0)
            slotDiv();
    }
    else if (checkInputSource(universe, pagedCh, value, sender(), multDivResetInputSourceId))
    {
        if (value != 0)
            slotMultDivReset();
    }
    else if (checkInputSource(universe, pagedCh, value, sender(), applyInputSourceId))
    {
        if (value != 0)
            slotFactoredValueChanged();
    }
    else
    {
        for (QHash<QWidget*, VCSpeedDialPreset*>::iterator it = m_presets.begin();
                it != m_presets.end(); ++it)
        {
            VCSpeedDialPreset *preset = it.value();
            if (preset->m_inputSource != NULL &&
                    preset->m_inputSource->universe() == universe &&
                    preset->m_inputSource->channel() == pagedCh)
            {
                {
                    QPushButton *button = reinterpret_cast<QPushButton*>(it.key());
                    button->click();
                }
            }
        }
    }
}

/*********************************************************************
 * Tap key sequence handler
 *********************************************************************/

void VCSpeedDial::setTapKeySequence(const QKeySequence& keySequence)
{
    m_tapKeySequence = QKeySequence(keySequence);
}

QKeySequence VCSpeedDial::tapKeySequence() const
{
    return m_tapKeySequence;
}

void VCSpeedDial::setMultKeySequence(const QKeySequence& keySequence)
{
    m_multKeySequence = QKeySequence(keySequence);
}

QKeySequence VCSpeedDial::multKeySequence() const
{
    return m_multKeySequence;
}

void VCSpeedDial::setDivKeySequence(const QKeySequence& keySequence)
{
    m_divKeySequence = QKeySequence(keySequence);
}

QKeySequence VCSpeedDial::divKeySequence() const
{
    return m_divKeySequence;
}

void VCSpeedDial::setMultDivResetKeySequence(const QKeySequence& keySequence)
{
    m_multDivResetKeySequence = QKeySequence(keySequence);
}

QKeySequence VCSpeedDial::multDivResetKeySequence() const
{
    return m_multDivResetKeySequence;
}

void VCSpeedDial::setApplyKeySequence(const QKeySequence& keySequence)
{
    m_applyKeySequence = QKeySequence(keySequence);
}

QKeySequence VCSpeedDial::applyKeySequence() const
{
    return m_applyKeySequence;
}

void VCSpeedDial::slotKeyPressed(const QKeySequence& keySequence)
{
    if (acceptsInput() == false)
        return;

    if (m_tapKeySequence == keySequence)
        m_dial->tap();

    if (m_multKeySequence == keySequence)
        slotMult();
    if (m_divKeySequence == keySequence)
        slotDiv();
    if (m_multDivResetKeySequence == keySequence)
        slotMultDivReset();
    if (m_applyKeySequence == keySequence)
        slotFactoredValueChanged();

    for (QHash<QWidget*, VCSpeedDialPreset*>::iterator it = m_presets.begin();
            it != m_presets.end(); ++it)
    {
        VCSpeedDialPreset *preset = it.value();
        if (preset->m_keySequence == keySequence)
        {
            QPushButton *button = reinterpret_cast<QPushButton*>(it.key());
            button->click();
        }
    }
}

/****************************************************************************
 * Absolute value range
 ****************************************************************************/

void VCSpeedDial::setAbsoluteValueRange(uint min, uint max)
{
    m_absoluteValueMin = min;
    m_absoluteValueMax = max;
}

uint VCSpeedDial::absoluteValueMin() const
{
    return m_absoluteValueMin;
}

uint VCSpeedDial::absoluteValueMax() const
{
    return m_absoluteValueMax;
}

quint32 VCSpeedDial::visibilityMask() const
{
    return m_visibilityMask;
}

void VCSpeedDial::setVisibilityMask(quint32 mask)
{
    if (m_dial != NULL)
        m_dial->setVisibilityMask(mask);

    if (mask & MultDiv)
    {
        m_multButton->show();
        m_multDivLabel->show();
        m_divButton->show();
        m_multDivResetButton->show();
        m_multDivResultLabel->show();
    }
    else
    {
        m_multButton->hide();
        m_multDivLabel->hide();
        m_divButton->hide();
        m_multDivResetButton->hide();
        m_multDivResultLabel->hide();
    }

    if (mask & Apply)
        m_applyButton->show();
    else
        m_applyButton->hide();

    m_visibilityMask = mask;
}

/*****************************************************************************
 * Load & Save
 *****************************************************************************/

static QSharedPointer<VCSpeedDialPreset> createInfinitePreset()
{
    QSharedPointer<VCSpeedDialPreset> infinitePreset(new VCSpeedDialPreset(16));
    infinitePreset->m_value = Function::infiniteSpeed();
    infinitePreset->m_name = Function::speedToString(Function::infiniteSpeed());
    return infinitePreset;
}

bool VCSpeedDial::loadXML(QXmlStreamReader &root)
{
    if (root.name() != KXMLQLCVCSpeedDial)
    {
        qWarning() << Q_FUNC_INFO << "SpeedDial node not found";
        return false;
    }

    /* Widget commons */
    loadXMLCommon(root);

    // Compatibility with old workspace files:
    // Get old style speedtype selection
    VCSpeedDialFunction::SpeedMultiplier defaultFadeInMultiplier = VCSpeedDialFunction::None;
    VCSpeedDialFunction::SpeedMultiplier defaultFadeOutMultiplier = VCSpeedDialFunction::None;
    VCSpeedDialFunction::SpeedMultiplier defaultDurationMultiplier = VCSpeedDialFunction::One;
    if (root.attributes().hasAttribute(KXMLQLCVCSpeedDialSpeedTypes))
    {
        SpeedTypes speedTypes = SpeedTypes(root.attributes().value(KXMLQLCVCSpeedDialSpeedTypes).toString().toInt());
        defaultFadeInMultiplier = speedTypes & FadeIn ? VCSpeedDialFunction::One : VCSpeedDialFunction::None;
        defaultFadeOutMultiplier = speedTypes & FadeOut ? VCSpeedDialFunction::One : VCSpeedDialFunction::None;
        defaultDurationMultiplier = speedTypes & Duration ? VCSpeedDialFunction::One : VCSpeedDialFunction::None;
    }

    // Sorted list for new presets
    QList<VCSpeedDialPreset> newPresets;
    // legacy: transform the infinite checkbox into an infinite preset
    QSharedPointer<VCSpeedDialPreset> infinitePreset(NULL);

    /* Children */
    while (root.readNextStartElement())
    {
        //qDebug() << "VC Speed Dial tag:" << root.name();
        if (root.name() == KXMLQLCFunction)
        {
            // Function
            VCSpeedDialFunction speeddialfunction;
            if (speeddialfunction.loadXML(root, defaultFadeInMultiplier,
                                          defaultFadeOutMultiplier,
                                          defaultDurationMultiplier))
            {
                m_functions.append(speeddialfunction);
            }
        }
        else if (root.name() == KXMLQLCWindowState)
        {
            int x = 0, y = 0, w = 0, h = 0;
            bool visible = true;
            loadXMLWindowState(root, &x, &y, &w, &h, &visible);
            setGeometry(x, y, w, h);
        }
        else if (root.name() == KXMLQLCVCWidgetAppearance)
        {
            loadXMLAppearance(root);
        }
        else if (root.name() == KXMLQLCVCSpeedDialAbsoluteValue)
        {
            // Value range
            QXmlStreamAttributes vAttrs = root.attributes();
            if (vAttrs.hasAttribute(KXMLQLCVCSpeedDialAbsoluteValueMin) &&
                vAttrs.hasAttribute(KXMLQLCVCSpeedDialAbsoluteValueMax))
            {
                uint min = vAttrs.value(KXMLQLCVCSpeedDialAbsoluteValueMin).toString().toUInt();
                uint max = vAttrs.value(KXMLQLCVCSpeedDialAbsoluteValueMax).toString().toUInt();
                setAbsoluteValueRange(min, max);
            }
            loadXMLSources(root, absoluteInputSourceId);
        }
        else if (root.name() == KXMLQLCVCSpeedDialTap)
        {
            loadXMLSources(root, tapInputSourceId);
        }
        else if (root.name() == KXMLQLCVCSpeedDialResetFactorOnDialChange)
        {
            // Reset factor on dial change
            setResetFactorOnDialChange(root.readElementText() == KXMLQLCTrue);
        }
        else if (root.name() == KXMLQLCVCSpeedDialMult)
        {
            loadXMLSources(root, multInputSourceId);
        }
        else if (root.name() == KXMLQLCVCSpeedDialDiv)
        {
            loadXMLSources(root, divInputSourceId);
        }
        else if (root.name() == KXMLQLCVCSpeedDialMultDivReset)
        {
            loadXMLSources(root, multDivResetInputSourceId);
        }
        else if (root.name() == KXMLQLCVCSpeedDialApply)
        {
            loadXMLSources(root, applyInputSourceId);
        }
        else if (root.name() == KXMLQLCVCSpeedDialTapKey)
        {
            setTapKeySequence(stripKeySequence(QKeySequence(root.readElementText())));
        }
        else if (root.name() == KXMLQLCVCSpeedDialMultKey)
        {
            setMultKeySequence(stripKeySequence(QKeySequence(root.readElementText())));
        }
        else if (root.name() == KXMLQLCVCSpeedDialDivKey)
        {
            setDivKeySequence(stripKeySequence(QKeySequence(root.readElementText())));
        }
        else if (root.name() == KXMLQLCVCSpeedDialMultDivResetKey)
        {
            setMultDivResetKeySequence(stripKeySequence(QKeySequence(root.readElementText())));
        }
        else if (root.name() == KXMLQLCVCSpeedDialApplyKey)
        {
            setApplyKeySequence(stripKeySequence(QKeySequence(root.readElementText())));
        }
        else if (root.name() == KXMLQLCVCSpeedDialInfinite)
        {
            // Legacy: infinite checkbox input
            if (!infinitePreset)
                infinitePreset = createInfinitePreset();

            loadXMLInfiniteLegacy(root, infinitePreset);
        }
        else if (root.name() == KXMLQLCVCSpeedDialInfiniteKey)
        {
            // Legacy: infinite checkbox key sequence
            if (!infinitePreset)
                infinitePreset = createInfinitePreset();

            infinitePreset->m_keySequence = stripKeySequence(QKeySequence(root.readElementText()));
        }
        else if(root.name() == KXMLQLCVCSpeedDialPreset)
        {
            VCSpeedDialPreset preset(0xff);
            if (preset.loadXML(root))
                newPresets.insert(qLowerBound(newPresets.begin(), newPresets.end(), preset), preset);
        }
        else if (root.name() == KXMLQLCVCSpeedDialVisibilityMask)
        {
            quint32 mask = root.readElementText().toUInt();

            // legacy: infinite checkbox
            if (mask & SpeedDial::Infinite)
            {
                mask &= ~SpeedDial::Infinite;
                if (!infinitePreset)
                    infinitePreset = createInfinitePreset();
            }

            setVisibilityMask(mask);
        }
        else if (root.name() == KXMLQLCVCSpeedDialTime)
        {
            m_dial->setValue(root.readElementText().toUInt());
        }
        else
        {
            qWarning() << Q_FUNC_INFO << "Unknown speed dial tag:" << root.name().toString();
            root.skipCurrentElement();
        }
    }

    if (infinitePreset && newPresets.size() > 0)
    {
        qWarning() << Q_FUNC_INFO << "Can't have an infinite checkbox + presets";
        return false;
    }

    if (infinitePreset)
        addPreset(*infinitePreset);
    else
    {
        foreach (VCSpeedDialPreset const& preset, newPresets)
            addPreset(preset);
    }

    return true;
}

bool VCSpeedDial::loadXMLInfiniteLegacy(QXmlStreamReader &root, QSharedPointer<VCSpeedDialPreset> preset)
{
    while (root.readNextStartElement())
    {
        if (root.name() == KXMLQLCVCWidgetInput)
        {
            quint32 uni = QLCInputSource::invalidUniverse;
            quint32 ch = QLCInputSource::invalidChannel;
            if (loadXMLInput(root, &uni, &ch) == true)
            {
                preset->m_inputSource = QSharedPointer<QLCInputSource>(new QLCInputSource(uni, ch));
            }
        }
        else
        {
            qWarning() << Q_FUNC_INFO << "Unknown Frame Source tag" << root.name().toString();
            root.skipCurrentElement();
        }
    }
    return true;
}

bool VCSpeedDial::saveXML(QXmlStreamWriter *doc)
{
    Q_ASSERT(doc != NULL);

    doc->writeStartElement(KXMLQLCVCSpeedDial);

    saveXMLCommon(doc);

    /* Window state */
    saveXMLWindowState(doc);

    /* Appearance */
    saveXMLAppearance(doc);

    if (m_visibilityMask != SpeedDial::defaultVisibilityMask())
    {
        doc->writeTextElement(KXMLQLCVCSpeedDialVisibilityMask, QString::number(m_visibilityMask));
    }

    /* Absolute input */
    doc->writeStartElement(KXMLQLCVCSpeedDialAbsoluteValue);
    doc->writeAttribute(KXMLQLCVCSpeedDialAbsoluteValueMin, QString::number(absoluteValueMin()));
    doc->writeAttribute(KXMLQLCVCSpeedDialAbsoluteValueMax, QString::number(absoluteValueMax()));
    saveXMLInput(doc, inputSource(absoluteInputSourceId));
    doc->writeEndElement();

    /* Tap input */
    QSharedPointer<QLCInputSource> tapSrc = inputSource(tapInputSourceId);
    if (!tapSrc.isNull() && tapSrc->isValid())
    {
        doc->writeStartElement(KXMLQLCVCSpeedDialTap);
        saveXMLInput(doc, tapSrc);
        doc->writeEndElement();
    }

    // MultDiv options
    if (m_resetFactorOnDialChange)
        doc->writeTextElement(KXMLQLCVCSpeedDialResetFactorOnDialChange, KXMLQLCTrue);

    /* Mult input */
    QSharedPointer<QLCInputSource> multSrc = inputSource(multInputSourceId);
    if (!multSrc.isNull() && multSrc->isValid())
    {
        doc->writeStartElement(KXMLQLCVCSpeedDialMult);
        saveXMLInput(doc, multSrc);
        doc->writeEndElement();
    }

    /* Div input */
    QSharedPointer<QLCInputSource> divSrc = inputSource(divInputSourceId);
    if (!divSrc.isNull() && divSrc->isValid())
    {
        doc->writeStartElement(KXMLQLCVCSpeedDialDiv);
        saveXMLInput(doc, divSrc);
        doc->writeEndElement();
    }

    /* MultDiv Reset input */
    QSharedPointer<QLCInputSource> resetSrc = inputSource(multDivResetInputSourceId);
    if (!resetSrc.isNull() && resetSrc->isValid())
    {
        doc->writeStartElement(KXMLQLCVCSpeedDialMultDivReset);
        saveXMLInput(doc, resetSrc);
        doc->writeEndElement();
    }

    /* Apply input */
    QSharedPointer<QLCInputSource> applySrc = inputSource(applyInputSourceId);
    if (!applySrc.isNull() && applySrc->isValid())
    {
        doc->writeStartElement(KXMLQLCVCSpeedDialApply);
        saveXMLInput(doc, applySrc);
        doc->writeEndElement();
    }

    /* Save time */
    doc->writeTextElement(KXMLQLCVCSpeedDialTime, QString::number(m_dial->value()));

    /* Tap key sequence */
    if (m_tapKeySequence.isEmpty() == false)
        doc->writeTextElement(KXMLQLCVCSpeedDialTapKey, m_tapKeySequence.toString());

    /* Mult key sequence */
    if (m_multKeySequence.isEmpty() == false)
        doc->writeTextElement(KXMLQLCVCSpeedDialMultKey, m_multKeySequence.toString());

    /* Div key sequence */
    if (m_divKeySequence.isEmpty() == false)
        doc->writeTextElement(KXMLQLCVCSpeedDialDivKey, m_divKeySequence.toString());

    /* MultDiv Reset key sequence */
    if (m_multDivResetKeySequence.isEmpty() == false)
        doc->writeTextElement(KXMLQLCVCSpeedDialMultDivResetKey, m_multDivResetKeySequence.toString());

    /* MultDiv Reset key sequence */
    if (m_applyKeySequence.isEmpty() == false)
        doc->writeTextElement(KXMLQLCVCSpeedDialApplyKey, m_applyKeySequence.toString());

    /* Functions */
    foreach (const VCSpeedDialFunction &speeddialfunction, m_functions)
        speeddialfunction.saveXML(doc);

    // Presets
    foreach(VCSpeedDialPreset *preset, presets())
        preset->saveXML(doc);

    /* End the <SpeedDial> tag */
    doc->writeEndElement();

    return true;
}

void VCSpeedDial::postLoad()
{
    /* Remove such function IDs that don't exist */
    QMutableListIterator <VCSpeedDialFunction> it(m_functions);
    while (it.hasNext() == true)
    {
        it.next();
        Function* function = m_doc->function(it.value().functionId);
        if (function == NULL)
            it.remove();
    }
}


This page displays sold house prices for Alderton Place in Leeds.
Alderton Place in Leeds LS17 consists predominantly of semi-detached houses. Properties on Alderton Place typically have values around £150,000 - £150,000, ranging upwards of £150,000 for larger semi-detached houses.
Map showing Alderton Place in Leeds.


text:
United Methodist Church Proposes New Position Statement Saying "We Support Abortion"
on September 7, 2018, 9:46 AM	/ in Opinion
By REV. PAUL STALLWORTH | Life News.com Due to action of The United Methodist Church's 2012 General Conference and to negotiation of church leaders, the General Board of Church and Society held listening sessions on the Social Principles throughout the church. From them, Church and Society learned that the Social Principles need to become "more theologically grounded, more globally relevant, and […]
Regime Change — American Style
The campaign to overturn the 2016 election and bring down President Trump shifted into high gear this week. Inspiration came Saturday morning from the altar of the National Cathedral where our establishment came to pay homage to John McCain. Gathered there were all the presidents from 1993 to 2017, Bill Clinton, George W. Bush and Barack Obama, Vice Presidents Al […]
Elderly Christian still being harassed for billboard by 'moaning and groaning' LGBT activis
on September 7, 2018, 9:32 AM	/ in National News, Opinion
Damn Good Idea! By James Risdon PETROLIA, Ontario, (LifeSiteNews) — Homosexual activists are still calling and harassing an 81-year-old Ontario man even though his Christian-themed billboard they deemed offensive has been down for more than a week. "They call up, moaning and groaning and pretending they're doing it with sheep and goats," said Ralph Baker in an interview Thursday. "It's who […]
HOPE For the Next Generation
Are we doing a modern day sacrifice of our children to Moloch by sending them to the public school system? Jackie Juntti WGEN idzrus@earthlink.net By Rob Pue | Wisconsin Christian News The news can often be quite depressing — and distressing — especially when we see what has become of the young people of this nation. We are seeing pre-school […]
Serena Williams to face Naomi Osaka in U.S. Open final
on September 7, 2018, 9:18 AM	/ in Tennis
Serena Williams beat No. 19 seed Anastasija Sevastova of Latvia 6-3, 6-0 to advance to Saturday's U.S. Open final against Japan's Naomi Osaka, who defeated American Madison Keys 6-2, 6-4 in the other semifinal. It is Osaka's first final at Flushing Meadows, and Williams' ninth. Williams is seeking her 24th major singles title to tie Margaret Court for the most […]
North Korean charged in crippling Sony hack, WannaCry virus
on September 7, 2018, 9:15 AM	/ in International News
Federal prosecutors said Thursday they had charged a computer programmer working for the North Korean government, Park Jin Hyok, with cyberattacks that infected computers in 150 countries with the WannaCry ransomware virus. The hacking targeted Sony Pictures Entertainment in 2014 and spread from there. Park, who is believed to be in North Korea, also was charged with conspiring to launch […]
Leading Brazilian presidential candidate stabbed at rally
A man stabbed the leading candidate in Brazil's presidential election, lawmaker Jair Bolsonaro, at a campaign rally on Thursday. Bolsonaro became the frontrunner in the Oct. 7 first round after Brazil's electoral court last week barred the left's leading candidate, former president Luiz Inácio Lula da Silva, from running due to corruption charges. Bolsonaro is a controversial figure who has […]
Immature Resistance
on September 7, 2018, 8:00 AM	/ in Bedtime Stories
Art by Michael Ramirez
Russian Nuclear Bombers Intercepted Near Alaska
on September 7, 2018, 7:49 AM	/ in International News, National News
Tu-95s intruded into U.S. air defense zone By Bill Gertz | Washington Free Beacon Two Russian nuclear-capable bombers were intercepted by American F-22 jets near Alaska on Saturday, the North American Aerospace Defense Command disclosed. The bombers were detected flying near the Aleutian Islands, said Michael Kucharek, a spokesman for the Northern Command and North American Aerospace Defense Command (NORAD). "Two Alaskan-based […]
Campaigning with the President
on September 7, 2018, 7:35 AM	/ in National News
Last night at a rally in Billings, Mont., Trump took aim at Sen. Jon Tester (D-Mont.). Trump attacked Tester for voting against the GOP's tax cuts; for sinking his pick to be Veterans Affairs secretary; and for supporting ObamaCare. "Jon Tester talks like he's from Montana but he votes like Nancy Pelosi." – Trump Trump swung through Montana in support […]
And What would you Have done with Them?
An animal-rights group filed a lawsuit against the U.S. Department of Agriculture seeking additional information about the government's euthanasia of thousands of cats used in experiments at a facility in Maryland over many years (The Washington Post). "A total of 2,988 cats have been used in these research efforts that began in 1982," a USDA administrator told Congress in May. […]
New rulemaking for Illegal Migrants
The Trump administration proposed new rulemaking Thursday that would allow the government to detain indefinitely any young migrants captured entering the United States illegally. The new interpretation of immigration law is an effort to finesse a 1997 court agreement that has guided U.S. policy for more than two decades, but is considered by the administration to be flawed (Bloomberg)
The Supreme Battle Ground… Children will play.
Two potential Democratic presidential contenders fired the starting pistol on 2020 on Thursday. Sens. Cory Booker (D-N.J.) and Kamala Harris (D-Calif.), whispering to each other throughout and appearing as allies, unloaded on Trump's Supreme Court nominee Brett Kavanaugh on the final day of hearings in a last-ditch effort to delay or derail his confirmation. It does not appear that any […]
Burt Reynolds, star of film, television and tabloids, dies at 82
By JOHN ROGERS | The Associated Press Burt Reynolds, the handsome film and television star known for his acclaimed performances in "Deliverance" and "Boogie Nights," commercial hits such as "Smokey and the Bandit" and for an active off-screen love life which included relationships with Loni Anderson and Sally Field, has died at age 82. His death was confirmed Thursday by […]
VAXXED, A Cover Up
In 2013, biologist Dr. Brian Hooker received a call from a Senior Scientist at the U.S. Centers for Disease Control and Prevention (CDC) who led the agency's 2004 study on the Measles-Mumps-Rubella (MMR) vaccine and its link to autism. The scientist, Dr. William Thompson, confessed that the CDC had omitted crucial data in their final report that revealed a causal […]
Love for the Brethren
on September 7, 2018, 6:39 AM	/ in Opinion, Religion
by Adam Grey | Faith & Heritage What is Christian brotherhood if it is not mutual allegiance, love, and practical aid? In Romans 14:19 St. Paul tells us that we are to overlook our differences of opinion in order to have genuine unity amongst one another, and to mutually edify one another. Yet simple observation of the pro-white movement — let alone […]
Amsterdam Stabbing, You Have Your Own Opinion, But Not Your Own Facts
Ft Collins, CO –-(Ammoland.com)- "That's a fact, Jack!" "John" (played by Bill Murray), in the 1981 feature film "Stripes" Last Friday, two American tourists were singled-out, attacked, and stabbed by a 19-year-old Afghan Jihadi within a busy train station in Amsterdam. Central Station is, in fact, the entry and exit point for most visitors to Amsterdam. The suspect, knife still in […]
Democrats' Disgusting Cross-Examination Show
Art by A.F. Branco
My Sin
When desire has conceived, it gives birth to sin; and sin, when it is full-grown, brings forth death. —James 1:15 Read: Genesis 3:1-6 Eve explained the rules to the tempter. She and Adam could eat the fruit of any tree in the Garden of Eden, except for the special one in the middle. Just touching it, she said, would bring death. […]
Sundays With the Sentinel: Ken Hucherson: I am Second
on September 7, 2018, 6:00 AM	/ in People, Religion
Kenneth Lee Hutcherson (July 14, 1952 – December 18, 2013) was an American football linebacker in the National Football League and senior pastor at Antioch Bible Church in Kirkland, Washington, where he had been since 1985. His nickname from his NFL days was "The Hutch". Hutcherson died on December 18, 2013, after more than a decade-long battle with prostate and bone cancer.[1] Ken Hutcherson was survived by his mother, […]

redpajama_set_name: RedPajamaCommonCrawl


text:
Q: What are good jQuery plugins to highlight code and XML content? I have a couple of web-pages where I write out some code c#, and some XML. I'd like to find a way to highlight the syntax of the different content to make it easier to read - very much like here on Stackoverflow?
I already use a bit of jQuery so something that plugs into that would be a nice fit.

A: Hm, I don't see where jQuery fits in there too well (because it is for DOM modification, not based on the textual content of the DOM).
Still, you might want to take a look at the very cool google-code-prettify. As far as I know, it is also used here at StackOverflow and it works like a charm for many languages. I use it myself and it's really easy to integrate.

A: You might want to look into Alex Gorbatchev's SyntaxHighlighter. It's one of the nicest formatters out there, and supports tons of syntaxes if you ever decide to format code in a new language.

A: *

*highlight.js supports 118 languages and 54 styles out of the box. It is BSD-licensed.

*Google's Javascript code prettifier also supports XML, License: Apache 2.0

*Alex Gorbatchev's SyntaxHighlighter

redpajama_set_name: RedPajamaStackExchange


Barbara Wildenboer's exhibition, titled Vanitas, created for her Masters of Fine Art studies at the Michaelis School of fine art, UCT in December 2007 and subsequently held at the Association for Visual Arts (AVA) in January 2008, is indeed a treat for serious lovers of photography and the Conceptualist Art genre. Wildenboer is a Conceptualist, using various photographic processes and techniques to bring over ideas of memory held and lost and the imprint of fleeting life recorded.
Most of the pieces in this body of work have grown out of a combination of mixed media with photography as an integral element to the concept, underlining notions of time, as well as the paradoxical relationship between past and present states of being. Photographs are foremost examples of the icons that we keep to refer to what we had, and yet remind us of the loss of that very thing. Because of the historic melancholic iconography of the Vanitas genre of still life, she has found it to be suitable for her own expression of ideas of loss and yearning. Wildenboer considers melancholy and the related experiences of loss and longing as explanatory concepts from which to interpret her own creative endeavors. She emphasizes that mood and personal experience play a formative role in determining the outcome of her work. Interested in the idea of a 'present absence' and an 'absent presence' (on which the title and content of her thesis dissertation is based) within the items we collect to preserve our memories, Wildenboer recreates the memorabilia of incubation, pregnancy and cocooning which are profound vessels in the process of the creation of life, but which lose the created entities after birth.
Wildenboer states that she experiences melancholy as an emotion that is fed by loss and longing and often consisting of contradicting emotions. "It can be differentiated from mourning in that it is not always necessarily linked to a specific loss but can surface even at the most arbitrary moments. In such a case I see it as expressive of a more general fear experienced when facing existential instability or change." As profoundly, Wildenboer would like her pieces in Vanitas series to associate the viewer with notions of impermanence and disappearance. She hints that they could be seen as indirectly speaking of the fear of death but in a passive manner characterized by a bittersweet awareness of change, decay, and things coming to an end.
The still life or Vanitas features as a predominant theme in Wildenboer's work, both in two-dimensional and three-dimensional form. These range from traditional format of still life arrangements (but with non-traditional objects), to flower studies (executed through photography and layered with three dimension pressed flowers and transparent materials), to sculptural installations that echo still life pieces. The still life compositions that make up the body of work are mostly compiled from a variety of collected objects. Groups of empty shells from hatched birds with photographic fossil- like images are delicately tied in soft, porous material so referential of the amniotic female birthing sac, yet the eggs themselves are all broken, post-hatched and past their usefulness. This is a very sad piece, nostalgic for the intimacy of the incubation period yet exquisite in the fragility of the gathering of the delicate broken residues which themselves form this still life after-life.
The exhibition as a whole dissects notions of fragility, disappearance and impermanence. Some of her pieces combine the actual objects of fascination (the subject/object of the lens) with the photographs of the same. After photographing indigenous flowers, Wildenboer has pressed them, both killing and preserving them. These pieces, with pressed flowers and delicate material layered on top of carefully photographed 2 dimensional versions of the same, hold a dichotomy of life and death with the preservation of their beauty and colour through the pressing process yet their obvious lack of life. They seem exactly as in life, yet their life is absent. The layer which is photographic echoes this duality exactly with the idea of photography that captures the lifelike version in all its glory, yet it is no more, it is not alive but only a piece of paper. Pinned with common sewing pins as a layer onto the photographic print, the pieces are also very feminine reminiscent of seamstresses and the delicate patching of garments or embroidered craft pieces.
Wildenboer has enjoyed working with medium format cameras. She owns an old 35mm Pentax as well, but also loves working with Digital photographic techniques. Her Silver Gelatine prints have been exposed onto substrates such as shells, wood, rock and glass to create the suggestion of proof of residue life forces. These imprints or prints accentuate the fossil like effect of archeological finding. Often combining the two dimensional image with 3 dimensional natural and crafted objects, Wildenboer defies the limited perception of the static wall hung photograph. Many of her pieces are installations into which the viewer can walk, or sculptural creations around which the viewer can circle. However even the wall hung framed photographs are layered with each layer leading to another related theme in the concept.
Wildenboer lives in Woodstock, Cape Town with her two sons Lucas and Ivan. Being pregnant and having given birth to both children while doing her Masters degree did not hamper her studies. While in her first pregnancy she traveled to Darat Al Funun in Amman, Jordan, taking up an artist's residency for a few months and exhibiting the work she did there. The pregnancies also fed directly into Vanitas as through this period, she experienced the cycle of incubation first hand, being the cocoon, the embryonic host of creation. Her work connects itself directly to this experience of intense intimacy with the created entity and then the separation from and loss of the being to its own life.Barbara Wildenboer is indeed a young contemporary artist to watch. She attained a distinction for her Masters degree and is highly dedicated to the expression of her concepts through the medium of photography.


New Vision Engineering Group, Inc., a professional IT consulting firm in Falls Church, Va., was recently awarded two new contracts by the Defense Contract Management Agency (DCMA) and the Naval Facilities Engineering Command (NAVFAC).
April 16, 2009 - PRLog -- FALLS CHURCH, VA – New Vision Engineering Group, Inc., was recently awarded two new contracts to provide IT services to national defense organizations. The awards follow on New Vision's success as a primary contractor to the U.S. Department of Veterans Affairs (VA) and as a supplier to Lockheed Martin in support of the Department of Defense (DoD).
The new Defense Contract Management Agency (DCMA) award calls upon New Vision to provide integrated, seamless support for DCMA's Telecom Division in Boston. New Vision will support acquisition and billing of telecommunications systems and services by developing, drafting, and tracking acquisition requirements; developing cost estimates; reviewing acquisition packages for accuracy and compliance; budget planning and forecasting; supporting and developing bill payment processes; and resolving billing issues. A DoD component with nearly 10,000 personnel, DCMA performs contract administration services for DoD and other Federal agencies.
In a separate contract award, the Naval Facilities Engineering Command (NAVFAC) has chosen New Vision to provide maintenance and technical support for audiovisual (AV) systems at 12 locations throughout the Washington, D.C., area. New Vision will provide "on call" emergency service and maintenance as well as regular repair and replacement of parts and equipment for Video Telecommunication (VTC) systems and Audio Visual Information Portal (AVIP) that allow NAVFAC Washington field offices to teleconference and to receive command information. With 1,500 employees, NAVFAC Washington manages shore facilities for the U.S. Navy, U.S. Marine Corps, and other Federal clients in the District of Columbia, Maryland, and Northern Virginia.
About New Vision Engineering Group, Inc.
New Vision Engineering Group, Inc., provides professional IT services to government agencies, corporations, and nonprofits. Core services include application development; business intelligence; program and project management; and system design and integration. Founded in 2000, New Vision is a certified SBA 8(a), veteran-owned company headquartered in Falls Church, Va. At New Vision, we see something all together different! See what we see at http://www.nveg.com.
Professional IT services for government agencies, corporations, nonprofits. Services include application development; business intelligence; program & project management; system design & integration. Certified SBA 8(a) & veteran-owned. Founded in 2000.


Just how do you hunt vampires? Apparently all you need is a stovepipe hat and a big honking axe.
While Seth Grahame-Smith's Pride and Prejudice and Zombies may be languishing in Film Development Hell, Abraham Lincoln: Vampire Hunter has managed to glide through the movie-making process with hardly a problem. That's probably due to the fact that Tim Burton is producing it and Timur Bekmambetov (of Wanted and Nightwatch fame) is directing. Up until now, not much has been seen of the film, but its first trailer has just appeared on the Web and it looks about as crazy ridiculous as you'd probably expect a movie about a president who moonlights as a vampire hunter would be.
Since this is a teaser trailer, we're not given a whole lot of plot to go with. Instead, there are a lot of over-the-top action sequences on display. "Just how over the top?" you might find yourself asking. Well, there's a bit where Dominic West is apparently battling a vampire in the midst of what looks like a horse stampede at sunset.
Abraham Lincoln: Vampire Hunter tells the story of America's 16th president, based on "secret diaries" that document his campaign against the Children of the Night. In the book, he hangs out with Edgar Allen Poe, though it looks like that friendship may have been omitted for the film adaptation. That said, Rufus Sewell is going to play Adam, the lead vampire villain, and Alan Tudyk will portray Illinois statesman Stephen A. Douglas, who earned the real life nickname of "Little Giant" because was such a political powerhouse.
Abraham Lincoln: Vampire Hunter is due out in theaters on June 22nd.


This section of the submission was completed by the Rethink the Link alliance.
WAG objects to both the failure of WestConnex to meet its stated core objectives and the manner in which these objectives were formulated.
PREMIER Mike Baird has been slammed for misleading the NSW public about WestCONnex yet again as he was forced to defend the way residents and business owners have been treated during the WestCONnex compulsory acquisition process.


text:
Q: How to access an MFC control from a worker thread? What is the best way to access an MFC control from a worker thread?
What is the MFC idiomatic way of accessing a control?
I read here http://www.flounder.com/workerthreads.htm the following approach but I do not like very much the new of the CString, how can I be sure the CString will be properly deleted?
typedef struct tagTP
{
   HWND hwnd;
   int n;
} TP;

BEGIN_MESSAGE_MAP(CMyDlg, CDialog)
   // ...
   ON_MESSAGE( UWM_UPDATE_RESULTS, OnUpdateResults )
END_MESSAGE_MAP()

void CMyDlg::OnBnClickedDoWork()
{
   TP* tp = new TP;
   tp->hwnd = m_hWnd;
   tp->n = 42;

   AfxBeginThread( doWork, tp );
}

UINT CMyDlg::doWork(LPVOID p)
{
   TP* tp = reinterpret_cast< TP* >(p);
   CWnd* dlg = FromHandle( tp->hwnd );

   if ( tp->n == 42 ) {
      CString* s = new CString( "Is the Answer to the Ultimate Question of Life, the Universe, and Everything" );
      dlg->PostMessage( UWM_UPDATE_STATUS, 0, reinterpret_cast< LPARAM >(s) );
   }

   return 0;
}

LRESULT CMyDlg::OnUpdateResults(WPARAM,LPARAM lParam)
{
   CString* s = reinterpret_cast<CString *>(lParam);
   m_result.AddString( *s );// m_result is a CListBox
   delete s;
   UpdateData( FALSE );
   return 0;
}

A: Using PostMessage(..) is correct. Consider using SendMessage(..) - which block until finished.
Passing a pointer to a newed object is common - check the return value of the PostMessage(..) to check whether it was posted or not.

how can I be sure the CString will be properly deleted ?

As mentioned, check the return value of PostMessage(..) and work up the whole message queue in case of quiting the message loop.

A: As a general rule, MFC controls can only be accessed from the thread that created them.  This is the reason why the sample you found goes through the extra step of passing a message.  The message is received and processed by the thread that created the control.
The CString is properly deleted in OnUpdateResults().

A: In addition to @Simon's answer, if you have a more complicated scenario where it's harder to figure out who should delete the CString (or whatever type), consider std::tr1::shared_ptr.  It will take care of deleting.


"Caspr3 and Caspr4, two novel members of the Caspr family are expressed in the nervous system and interact with PDZ domains."
Spiegel I., Salomon D., Erne B., Schaeren-Wiemers N., Peles E.
Cited for: NUCLEOTIDE SEQUENCE [LARGE SCALE MRNA] (ISOFORM 2), VARIANT HIS-845.
AB051501 mRNA Translation: BAB21805.2 Different initiation.
AL162501 Genomic DNA No translation available.
AL353729 Genomic DNA No translation available.


I found a list of 50 criteria designed to expand your "reading comfort zone" – genres and authors I wouldn't otherwise pick up, different formats like plays and graphic novels, and old books that might have been forgotten. I decided to turn this reading list into my 2015 "To Do" list, and I've been working my way through it since January 1st. Here are some select reviews from the books I read during January and February.
One of the perks at working at a bookstore is that there are hundreds and hundreds of galleys – manuscripts from the publishers that haven't reached the final round of editing. The story is complete and only a few formatting errors remain, so galleys are sent out to bookstores so that they can determine which books they want to stock when it becomes available to the public. It's pretty much a VIP book club. I can't quote the books that aren't published yet without express permission, so I will review the books in haiku form.
Published by Scribner, September 2013.
A book your mom loves: A House in the Sky, by Amanda Lindhout and Sara Corbett.
Held four hundred sixty days.
Published by Howard Books, February 2015.
A book based on a true story: The Accidental Empress, by Allison Pataki.
Book is kind of bland.
Published by Plume, February 2014.
A book set somewhere you've always wanted to visit: Madam, by Cari Lynn and Kellie Martin.
E. J. Bellocq, Jelly Roll.
Published by St. Martin's Press, September 2014.
A memoir: Another Side of Bob Dylan, by Victor and Jacob Maymudes.
This entry was posted in Books and Literature, Exploring our World, Reviews and tagged Allison Pataki, Amanda Lindhout, Bob Dylan, Cari Lynn, Howard Books, Jacob Maymudes, Kellie Martin, New Orleans, Plume, Sara Corbett, Scribner, St. Martin's Press, Victor Maymudes. Bookmark the permalink.


NEW YORK – Legendary CBS journalist Mike Wallace, the "60 Minutes" correspondent whose probing interviews were a veritable right of passage for newsmakers the world over, has died at 93.
Wallace, who won his 21st and final Emmy Award at 89, died Saturday in the New Canaan, Conn., care facility where he had lived the last few years of his life.
The veteran newsman built a reputation as a fearless interviewer, known for asking skeptical follow-up questions and researching his subjects in and out.
"It almost didn't matter what stories he was covering, you just wanted to hear what he would ask next," Jeff Fager, CBSNews chairman and executive producer of "60 Minutes," said in a statement.
The "60 Minutes" journalist's reputation as a pitiless inquisitor was so fearsome that it was often said that the words "Mike Wallace is here to see you" were the most dreaded in the English language.
Wallace didn't just interview people. He interrogated them. He cross-examined them. Sometimes he eviscerated them. His weapons were many: thorough research, a cocked eyebrow, a skeptical "Come on" and a question so direct sometimes it took your breath away.
"His extraordinary contribution as a broadcaster is immeasurable and he has been a force within the television industry throughout its existence," said Leslie Moonves, president and CEO of CBS. "His loss will be felt by all of us at CBS."
Wallace said then that he had long vowed to retire "when my toes turn up" and "they're just beginning to curl a trifle. ... It's become apparent to me that my eyes and ears, among other appurtenances, aren't quite what they used to be."
Wallace was born Myron Wallace on May 9, 1918, in Brookline, Massachusetts. He began his news career in Chicago in the 1940s, first as radio news writer for the Chicago Sun and then as reporter for WMAQ. He started at CBS in 1951. In all, his television career spanned six decades.
"He'd seen everything. He'd done everything. He'd been everywhere and, you know, he retired very late in life because he still had the magic ingredient. He still found things interesting. He still had a passion for the things he covered," said Fox News Senior Political Analyst Brit Hume.
"It's hard to believe that he won't be on television another Sunday night, or at the end of the telephone line to talk through the stories of the week," Nancy Reagan added.
Wallace was the first man hired when late CBS news producer Don Hewitt put together the staff of "60 Minutes" at the TV news magazine's inception in 1968. The show wasn't a hit at first, but it worked its way up to the top 10 in the 1977-78 season and remained there, season after season, with Wallace as one of its mainstays. Among other things, it proved there could be big profits in TV journalism.
The show pioneered the use of "ambush interviews," with reporter and camera crew corralling alleged wrongdoers in parking lots, hallways, wherever a comment -- or at least a stricken expression -- might be harvested from someone dodging the reporters' phone calls.
"I don't recall anybody ever saying to me, 'He took a cheap shot' or 'he did the obvious,' or that he was, you know, was playing some kind of game," said Fox News Chairman Roger Ailes. "He actually was trying to serve the audience and that's what made him great."
Such tactics were phased out over time -- Wallace said they provided drama but not much good information.
Late in his career, he interviewed Russian President Vladimir Putin, and challenged him: "This isn't a real democracy, come on!" Putin's aides tried to halt the interview; Putin said he was the president, he'll decide what to do.
"I'm a slow learner," Streisand told him.
Wallace said he didn't think he had an unfair advantage over his interview subjects: "The person I'm interviewing has not been subpoenaed. He's in charge of himself, and he lives with his subject matter every day. All I'm armed with is research."
Operating on a tip, The New York Times reported that "60 Minutes" planned to excise Wigand's interview from its tobacco expose. CBS said Wigand had signed a nondisclosure agreement with his former company, and the network feared that by airing what he had to say, "60 Minutes" could be sued along with him.
In 1949, he appeared as Myron Wallace in a show called "Majority Rules." In the early 1950s, he was an announcer and game show host for programs such as "What's in a Word?" He also found time to act in a 1954 Broadway play, "Reclining Figure," directed by Abe Burrows.
Wrote Coronet magazine in 1957: "Wallace's interrogation had the intensity of a third degree, often the candor of a psychoanalytic session. Nothing like it had ever been known on TV. ... To Wallace, no guest is sacred, and he frankly dotes on controversy."
Sample "Night Beat" exchange, with colorful restaurateur Toots Shor. Wallace: "Toots, why do people call you a slob?" Shor: "Me? Jiminy crickets, they `musta' been talking about Jackie Gleason."
In those days, Wallace said, "interviews by and large were virtual minuets. ... Nobody dogged, nobody pushed." He said that was why "Night Beat" `'got attention that hadn't been given to interview broadcasts before."
It was also around then that Wallace did a bit as a TV newsman in the 1957 Hollywood drama "A Face in the Crowd," which starred Andy Griffith as a small-town Southerner who becomes a political phenomenon through his folksy television appearances. Two years later, Wallace helped create "The Hate That Hate Produced," a highly charged program about the Nation of Islam -- a black Muslim organization -- that helped make a national celebrity out of Malcolm X and was later criticized as biased and inflammatory.
He said it was the death of his 19-year-old son, Peter, in an accident in 1962 that made him decide to stick to serious journalism from then on.
Wallace had a short stint reporting from Vietnam, and took a sock in the jaw while covering the tumultuous 1968 Democratic Party convention in Chicago. But he didn't fit the stereotype of the Eastern liberal journalist. He was a close friend of the Reagans and was once offered the job of Richard Nixon's press secretary. He called his politics moderate.
In 1996, he appeared before the Senate's Special Committee on Aging to urge more federal funds for depression research, saying that he had felt "lower, lower, lower than a snake's belly" but had recovered through psychiatry and antidepressant drugs. He later disclosed that he once tried to commit suicide during that dark period. Wallace, columnist Art Buchwald and author William Styron were friends who commiserated often enough about depression to call themselves "The Blues Brothers," according to a 2011 memoir by Styron's daughter, Alexandra.
Wallace called his 1984 book, written with Gary Paul Gates, "Close Encounters." He described it as "one mostly lucky man's encounters with growing up professionally."
He was married four times. In 1986, he wed Mary Yates Wallace, the widow of his close friend and colleague, Ted Yates, who had died in 1967. Besides his wife, Wallace is survived by his son, Chris -- the anchor of "Fox News Sunday" -- a stepdaughter, Pauline Dora, and stepson Eames Yates.
"They think they're wide-eyed commies. Liberals," the elder Wallace replied, a notion he dismissed as "damned foolishness."


text:
import {HttpClientTestingModule} from '@angular/common/http/testing';
import {TestBed} from '@angular/core/testing';
import { AuthService } from './auth.service';
import {IUserLogin} from '../../shared/interfaces';
import {HttpRequest} from '@angular/common/http';

describe('AuthService', () => {
  let service: AuthService;
  let token: string;
  let userLogin: IUserLogin;

  beforeEach(() => {
    TestBed.configureTestingModule({
      providers: [AuthService],
      imports: [ HttpClientTestingModule]
    });
  });
  beforeEach(() => {
    token = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVC' +
    'J9.eyJzdWIiOiJqb2huRG9lIiwibmFtZSI6IkpvaG4g' +
      'RG9lIiwiaWF0IjoxNTE2MjM5MDIyLCJleHAiOjE3MTYyMzkwMjJ9.Ab4-2LjNKuJciqFfeTy5shRajqlOg91BgJijckd5cck';
    service = TestBed.get(AuthService);
    localStorage.setItem('access_token', token);
    localStorage.setItem('auth-code', 'test-code');
    userLogin = {
      password: 'passTest',
      username: 'userTest',
    };
  });
  afterEach(() => {
    localStorage.clear();
  });
  it('should get fake token', () => {
    expect(service.getToken()).toBe(token);
    expect(service.getAuthCode()).toBe('test-code');
  });
  it('should get users name', () => {
    expect(service.getUserName()).toBe('johnDoe');
  });
  it('should get expiration', () => {
    expect(service.getExpiration()).toBe(1716239022);
  });
  it('should token to be cleared', () => {
    service.logout();
    expect(service.getToken()).toBe(null);
    expect(service.getAuthCode()).toBe(null);
  });
  it('should be authenticated', () => {
    expect(service.isAuthenticated()).toBe(true);
  });
  it('should login', () => {
    service.loginLdap(userLogin);
    service.login(userLogin);
  });
  it('should check admin and authType', () => {
    service.isAdmin();
    service.getAuthType();
  });
  it('should register login', () => {
    service.register(userLogin);
  });
  it('should check sso login',  () =>  {
    expect(service.isSsoLogin(new HttpRequest('GET', '/api/login/openid'))).toBe(true);
  });
});

redpajama_set_name: RedPajamaGithub


If you have a property, then you understand that one of the basic investments you can make is of a functioning plumbing system. Factoring in a home without a plumbing system can just a messy living because you are also exposed to unhealthy environments. One of the reasons why the plumbing system is important is because it helps to convey both clean and unclean water to the appropriate destinations and you can imagine the mess that can cause if there's no system to help in that. It is very critical to always inspect and know that the plumbing system is functioning completely and conveying the water different destinations because, without it, you will have to deal with issues such as blockages and flooding which can cost you more money. The best thing is that there are residential plumbing companies you can engage for such services. Here are some of the best ways to know the best residential plumbing company to work with.
Reading more about the contractors will help you a lot when it comes to choosing the best because you can compare the information. The truth is that there are many plumbing companies you can work with, but not everyone can offer you the specific solution you are looking for and that is why it is necessary that you dig deep and take your time to choose them. Customer reviews can help you a lot to know more about the company and this information you can find online today because most of these companies have a website. Referrals can also be a great source of information for these companies especially considering that people around you engage them and the continuous the best.
Don't forget that experienced the company has can tell you a lot about what they can offer you and that is why it is important to consider this aspect. It is important to remember that the company that has been here for a long time can only offer you the best because the of handle many projects and they can only use the expertise on these to offer you what you need. On the same note of professionalism always work with companies that are certified of a residential plumbing service. It is also wise of you that work with an insured company because this will save you a lot of stress especially it comes to finances because in case damages and injuries happen which is something that is uncertain will not have to worry about the cost. The quality of services you can receive from this company also depends a lot on the plumbing equipment they have that is why you also need to consider if they are using the current plumbing tools.


A fully packed Best of ECR programme has now been finalised for the 48th Brazilian Congress of Radiology (CBR 2019) which takes place in Fortaleza on October 10-12, 2019. The initiative, which will debut for the first time at CBR, will feature a diverse range of speakers bringing their lectures from the European Congress of Radiology to a new setting. It is the result of efforts by the European Society of Radiology (ESR) to bring the most innovative and groundbreaking elements of Europe's largest radiological congress to a wider audience outside of Europe.
Featuring 10 of the best speakers from ECR, the Best of ECR programme will see experts sharing their experience with those CBR attendees who were unable to attend ECR in person. The programme will have a total of six scientific sessions, featuring state-of-the-art talks on Chest, MSK, GI/GU and Breast imaging. Special highlights will include a talk from Prof. Wiro Niessen from Rotterdam/NL on the 'Challenges and opportunities of Artificial Intelligence in radiology' and another from Prof. Andrea Rockall from London/UK on 'Recent updates in Gadolinium contrast media'. Furthermore, ESR President, Prof. Boris Brkljačić from Zagreb/HR, will give an exclusive lecture on the 'History and Partnership' between ESR and CBR during the congress Opening Ceremony which is not to be missed.
The decision to debut the Best of ECR tour in Brazil arose from growing collaboration efforts between the ESR and the Brazilian College of Radiology and Diagnostic Imaging (CBR). Last year, the two societies signed a Memorandum of Understanding (MoU) agreeing to develop long-term cooperation strategies to increase the sharing of radiological knowledge and practices between Europe and Brazil.
The Best of ECR is an initiative by the ESR to disseminate important radiological updates globally to a wider audience. The initiative is expected to continue its tour across the world in the future. The next stop will be the Canadian Association of Radiologists (CAR) Annual Scientific Meeting in Montreal taking place on April 16-19, 2020.
The 48th Brazilian Congress of Radiology will take place on October 10-12, 2019 in Fortaleza. For further details or to register for the congress click here.


text:
# Laravel Localization

[![Join the chat at https://gitter.im/mcamara/laravel-localization](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/mcamara/laravel-localization?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

[![Latest Stable Version](https://poser.pugx.org/mcamara/laravel-localization/version.png)](https://packagist.org/packages/mcamara/laravel-localization) [![Total Downloads](https://poser.pugx.org/mcamara/laravel-localization/d/total.png)](https://packagist.org/packages/mcamara/laravel-localization) [![Build Status](https://travis-ci.org/mcamara/laravel-localization.png)](https://travis-ci.org/mcamara/laravel-localization)

Easy i18n localization for Laravel, an useful tool to combine with Laravel localization classes.

## Table of Contents

- Installation
    - Composer
    - Manually
    - Laravel
- Usage
    - Middleware
    - Sessions
- Helpers
- Translated Routes
- Config
    - Config files
    - Service providers
- Changelog
- License

## Laravel compatibility

Laravel 5 is released!!

 Laravel  | laravel-localization
:---------|:----------
 4.0.x    | 0.13.x
 4.1.x    | 0.13.x
 4.2.x    | 0.15.x
 5.x.x    | 1.0.x

## Installation

### Composer

Add Laravel Localization to your `composer.json` file.

    "mcamara/laravel-localization": "1.0.*"

Run `composer install` to get the latest version of the package.

### Manually

It's recommended that you use Composer, however you can download and install from this repository.

### Laravel

Laravel Localization comes with a service provider for Laravel. You'll need to add it to your `composer.json` as mentioned in the above steps, then register the service provider with your application.

Open `config/app.php` and find the `providers` key. Add `LaravelLocalizationServiceProvider` to the array.

```php
	...
	Mcamara\LaravelLocalization\LaravelLocalizationServiceProvider::class
	...
```

You can also add an alias to the list of class aliases in the same file.

```php
	...
	'LaravelLocalization'	=> Mcamara\LaravelLocalization\Facades\LaravelLocalization::class
	...
```

## Usage

Laravel Localization uses the URL given for the request. In order to achieve this purpose, a route group should be added into the `routes.php` file. It will filter all pages that must be localized.

```php
	// app/Http/routes.php

	Route::group(['prefix' => LaravelLocalization::setLocale()], function()
	{
		/** ADD ALL LOCALIZED ROUTES INSIDE THIS GROUP **/
		Route::get('/', function()
		{
			return View::make('hello');
		});

		Route::get('test',function(){
			return View::make('test');
		});
	});

	/** OTHER PAGES THAT SHOULD NOT BE LOCALIZED **/

```

Once this route group is added to the routes file, a user can access all locales added into `supportedLocales` ('en' and 'es' by default, look at the config section to change that option). For example, a user can now access two different locales, using the following addresses:

```
	http://url-to-laravel/en
	http://url-to-laravel/es
	http://url-to-laravel
```

If the locale is not present in the url or it is not defined in `supportedLocales`, the system will use the application default locale or the user's browser default locale (if defined in config file).

Once the locale is defined, the locale variable will be stored in a session (if the middleware is enabled), so it is not necessary to write the /lang/ section in the url after defining it once, using the last known locale for the user. If the user accesses to a different locale this session value would be changed, translating any other page he visits with the last chosen locale.

Template files and all locale files should follow the [Lang class](http://laravel.com/docs/5.0/localization).

### Middleware

Moreover, this package includes a middleware object to redirect all "non-localized" routes to the corresponding "localized".

So, if a user navigates to http://url-to-laravel/test and the system has this middleware active and 'en' as the current locale for this user, it would redirect (301) him automatically to http://url-to-laravel/en/test. This is mainly used to avoid duplicate content and improve SEO performance.

To do so, you have to register the middleware in the `app/Http/Kernel.php` file like this:

```php
	<?php namespace App\Http;

	use Illuminate\Foundation\Http\Kernel as HttpKernel;

	class Kernel extends HttpKernel {
		/**
		 * The application's route middleware.
		 *
		 * @var array
		 */
		protected $routeMiddleware = [
			/**** OTHER MIDDLEWARE ****/
			'localize' => \Mcamara\LaravelLocalization\Middleware\LaravelLocalizationRoutes::class,
			'localizationRedirect' => \Mcamara\LaravelLocalization\Middleware\LaravelLocalizationRedirectFilter::class,
			'localeSessionRedirect' => \Mcamara\LaravelLocalization\Middleware\LocaleSessionRedirect::class
			// REDIRECTION MIDDLEWARE
		];

	}
```

```php
	// app/Http/routes.php

	Route::group(
	[
		'prefix' => LaravelLocalization::setLocale(),
		'middleware' => [ 'localeSessionRedirect', 'localizationRedirect' ]
	],
	function()
	{
		/** ADD ALL LOCALIZED ROUTES INSIDE THIS GROUP **/
		Route::get('/', function()
		{
			return View::make('hello');
		});

		Route::get('test',function(){
			return View::make('test');
		});
	});

	/** OTHER PAGES THAT SHOULD NOT BE LOCALIZED **/

```

In order to activate it, you just have to attach this middleware to the routes you want to be accessible localized.

If you want to hide the default locale but always show other locales in the url, switch the `hideDefaultLocaleInURL` config value to true. Once it's true, if the default locale is en (english) all URLs containing /en/ would be redirected to the same url without this fragment '/' but maintaining the locale as en (English).

**IMPORTANT** - When `hideDefaultLocaleInURL` is set to true, the unlocalized root is treated as the applications default locale `app.locale`.  Because of this language negotiation using the Accept-Language header will **NEVER** occur when `hideDefaultLocaleInURL` is true.

## Helpers

This package comes with some useful functions, like:

### Get URL for an specific locale

```php
	/**
	 * Returns an URL adapted to $locale
	 *
	 * @param  string|boolean 	$locale	   	Locale to adapt, false to remove locale
	 * @param  string|false		$url		URL to adapt in the current language. If not passed, the current url would be taken.
	 * @param  array 			$attributes	Attributes to add to the route, if empty, the system would try to extract them from the url.
	 *
	 * @throws UnsupportedLocaleException
	 *
	 * @return string|false				URL translated, False if url does not exist
	 */
	public function getLocalizedURL($locale = null, $url = null, $attributes = array())

	//Should be called in a view like this:
	{{ LaravelLocalization::getLocalizedURL(optional string $locale, optional string $url, optional array $attributes) }}
```

It returns a URL localized to the desired locale.

### Get Clean routes

```php
	/**
	 * It returns an URL without locale (if it has it)
	 * Convenience function wrapping getLocalizedURL(false)
	 *
	 * @param  string|false 	$url	  URL to clean, if false, current url would be taken
	 *
	 * @return string		   URL with no locale in path
	 */
	public function getNonLocalizedURL($url = null)

	//Should be called in a view like this:
	{{ LaravelLocalization::getNonLocalizedURL(optional string $url) }}
```

It returns a URL clean of any localization.

### Get URL for an specific translation key

```php
	/**
	 * Returns an URL adapted to the route name and the locale given
	 *
     * @throws UnsupportedLocaleException
     *
	 * @param  string|boolean 	$locale 			Locale to adapt
	 * @param  string 			$transKeyName  		Translation key name of the url to adapt
	 * @param  array 			$attributes  		Attributes for the route (only needed if transKeyName needs them)
	 *
	 * @return string|false 	URL translated
	 */
	public function getURLFromRouteNameTranslated($locale, $transKeyName, $attributes = array())

	//Should be called in a view like this:
	{{ LaravelLocalization::getURLFromRouteNameTranslated(string $locale, optional array $transKeyNames, optional array $attributes) }}
```

It returns a route, localized to the desired locale using the locale passed. If the translation key does not exist in the locale given, this function will return false.

### Get Supported Locales

```php
	/**
     * Return an array of all supported Locales
     *
     * @return array
     */
     public function getSupportedLocales()

	//Should be called like this:
	{{ LaravelLocalization::getSupportedLocales() }}
```

This function will return all supported locales and their properties as an array.

### Get Supported Locales Keys

```php
	/**
	 * Returns supported languages language key
	 *
	 * @return array 	keys of supported languages
	 */
	public function getSupportedLanguagesKeys()

	//Should be called like this:
	{{ LaravelLocalization::getSupportedLanguagesKeys() }}
```

This function will return an array with all the keys for the supported locales.

### Set Locale

```php
	/**
     * Set and return current locale
     *
     * @param  string $locale	        Locale to set the App to (optional)
     *
     * @return string 			        Returns locale (if route has any) or null (if route does not have a locale)
     */
    public function setLocale($locale = null)

	//Should be called in a view like this:
	{{ LaravelLocalization::setLocale(optional string $locale) }}
```

This function will change the application's current locale.
If the locale is not passed, the locale will be determined via a cookie (if stored previously), the session (if stored previously), browser Accept-Language header or the default application locale (depending on your config file).

The function has to be called in the prefix of any route that should be translated (see Filters sections for further information).

### Get Current Locale

```php
    /**
     * Returns current language
     *
     * @return string current language
     */
    public function getCurrentLocale()

	//Should be called in a view like this:
	{{ LaravelLocalization::getCurrentLocale() }}
```

This function will return the key of the current locale.

### Get Current Locale Name

```php
	/**
	 * Returns current locale name
	 *
	 * @return string current locale name
	 */
	public function getCurrentLocaleName()

	//Should be called in a view like this:
	{{ LaravelLocalization::getCurrentLocaleName() }}
```

This function will return current locale's name as string (English/Spanish/Arabic/ ..etc).

### Get Current Locale Direction

```php
	/**
	 * Returns current locale direction
	 *
	 * @return string current locale direction
	 */
	public function getCurrentLocaleDirection()

	//Should be called in a view like this:
	{{ LaravelLocalization::getCurrentLocaleDirection() }}
```

This function will return current locale's direction as string (ltr/rtl).

### Get Current Locale Script

```php
	/**
	 * Returns current locale script
	 *
	 * @return string current locale script
	 */
	public function getCurrentLocaleScript()

	//Should be called in a view like this:
	{{ LaravelLocalization::getCurrentLocaleScript() }}
```

This function will return the [ISO 15924](http://www.unicode.org/iso15924) code for the current locale script as a string; "Latn", "Cyrl", "Arab", etc.

## Creating a language selector

If you're supporting multiple locales in your project you will probably want to provide the users with a way to change language. Below is a simple example of blade template code you can use to create your own language selector.

```
<ul class="language_bar_chooser">
	@foreach(LaravelLocalization::getSupportedLocales() as $localeCode => $properties)
        <li>
            <a rel="alternate" hreflang="{{$localeCode}}" href="{{LaravelLocalization::getLocalizedURL($localeCode) }}">
                {{{ $properties['native'] }}}
            </a>
        </li>
	@endforeach
</ul>
```

## Translated Routes

You can adapt your URLs depending on the language you want to show them. For example, http://url/en/about and http://url/es/acerca (acerca is about in spanish) or http://url/en/view/5 and http://url/es/ver/5 (view == ver in spanish) would be redirected to the same controller using the proper filter and setting up the translation files as follows:

As it is a middleware, first you have to register in on your `app/Http/Kernel.php` file like this:

```php
	<?php namespace App\Http;

	use Illuminate\Foundation\Http\Kernel as HttpKernel;

	class Kernel extends HttpKernel {
		/**
		 * The application's route middleware.
		 *
		 * @var array
		 */
		protected $routeMiddleware = [
			/**** OTHER MIDDLEWARE ****/
			'localize' => 'Mcamara\LaravelLocalization\Middleware\LaravelLocalizationRoutes',
			// TRANSLATE ROUTES MIDDLEWARE
		];

	}
```

```php
	// app/Http/routes.php

	Route::group(
	[
		'prefix' => LaravelLocalization::setLocale(),
		'middleware' => [ 'localize' ] // Route translate middleware
	],
	function()
	{
      /** ADD ALL LOCALIZED ROUTES INSIDE THIS GROUP **/
      Route::get('/', function()
      {
      	// This routes is useless to translate
      	return View::make('hello');
      });

      Route::get(LaravelLocalization::transRoute('routes.about'),function(){
          return View::make('about');
      });
      Route::get(LaravelLocalization::transRoute('routes.view'),function($id){
          return View::make('view',['id'=>$id]);
      });
	});

	/** OTHER PAGES THAT SHOULD NOT BE LOCALIZED **/
```
In the routes file you just have to add the `LaravelLocalizationRoutes` filter and the `LaravelLocalization::transRoute` function to every route you want to translate using the translation key.

Then you have to create the translation files and add there every key you want to translate. I suggest to create a routes.php file inside your resources/lang/language_abbreviation folder. For the previous example, I have created two translations files, these two files would look like:
```php
	// resources/lang/en/routes.php
    return [
      "about" 		=> 	"about",
      "view" 		=> 	"view/{id}", //we add a route parameter
      // other translated routes
	];
```
```php
	// resources/lang/es/routes.php
    return [
      "about" 		=> 	"acerca",
      "view" 		=> 	"ver/{id}", //we add a route parameter
      // other translated routes
	];
```

Once files are saved, you can access to http://url/en/about , http://url/es/acerca , http://url/en/view/5 and http://url/es/ver/5 without any problem. The `getLanguageBar` function would work as desired and it will translate the routes to all translated languages (don't forget to add any new route to the translation file).

## Events

You can capture the URL parameters during translation if you wish to translate them too. To do so, just create an event listener for the `routes.translation` event like so:

```php
Event::listen('routes.translation', function($locale, $attributes)
{
	// Do your magic

    return $attributes;
});
```

Be sure to pass the locale and the attributes as parameters to the closure. You may also use Event Subscribers, see: [http://laravel.com/docs/events#event-subscribers](http://laravel.com/docs/events#event-subscribers)

## Config

### Config Files

In order to edit the default configuration for this package you may execute:

```
php artisan vendor:publish --provider="Mcamara\LaravelLocalization\LaravelLocalizationServiceProvider"
```

After that, `config/laravellocalization.php` will be created. Inside this file you will find all the fields that can be edited in this package.

### Service Providers

Otherwise, you can use `ConfigServiceProviders` (check this file for more info).

For example, editing the default config service provider that Laravel loads when it's installed. This file is placed in `app/providers/ConfigServicePovider.php` and would look like this:

```php
	<?php namespace App\Providers;

	use Illuminate\Support\ServiceProvider;

	class ConfigServiceProvider extends ServiceProvider {
		public function register()
		{
			config([
				'laravellocalization.supportedLocales' => [
					'ace' => array( 'name' => 'Achinese', 'script' => 'Latn', 'native' => 'Aceh' ),
					'ca'  => array( 'name' => 'Catalan', 'script' => 'Latn', 'native' => 'català' ),
					'en'  => array( 'name' => 'English', 'script' => 'Latn', 'native' => 'English' ),
				],

				'laravellocalization.useAcceptLanguageHeader' => true,

				'laravellocalization.hideDefaultLocaleInURL' => true
			]);
		}

	}
```

This config would add Catalan and Achinese as languages and override any other previous supported locales and all the other options in the package.

You can create your own config providers and add them on your application config file (check the providers array in `config/app.php`).

## Changelog
View changelog here -> [changelog](CHANGELOG.md)

## License

Laravel Localization is an open-sourced laravel package licensed under the MIT license


During a state dinner last night in Buckingham Palace, on the first official day of the king and queen of Spain's visit to the United Kingdom, Queen Elizabeth stated that none of the challenges currently facing the two countries would affect their good bilateral relationship.
The banquet, which unusually was attended by the majority of the British royal family, was held after Spain's King Felipe VI had addressed a joint session of the House of Commons and the House of Lords in Westminster. During his speech in parliament, which he delivered in English, he had tackled the thorny issues of Gibraltar and Brexit, and also paid tribute to Ignacio Echevarría, the Spaniard who was killed in the recent terrorist attack on London Bridge.
As well as members of the British royal family, a total of 150 guests attended last night's dinner, including politicians, diplomats, business leaders and other representatives of civil society. The executive chairman of Santander bank, Ana Botín, was present, as were representatives from other Spanish companies such as Pablo Isla from Inditex (the parent company of clothing retailer Zara), José María Álvarez-Pallet, from telecoms giant Telefónica, and Antonio Vázquez from IAG (the holding company that owns former flag carriers British Airways and Iberia, among other airlines).
As he had done earlier in parliament, he expressed Spain's solidarity with the British people. "There is no doubt that Spaniards will always be together with our British friends and allies, shoulder to shoulder in the fight against terrorism," he said. The king ended his speech with a toast to Queen Elizabeth, the Duke of Edinburgh and the people of the United Kingdom, after which the British national anthem, God Save the Queen, was played.


text:
Noelle Lambert
Noelle Lambert knows that in order to thrive in an athletic environment, you need to hit the ground running. She manages to do that in spite of only having one leg and continues to overcome the odds everyday. The former Division I lacrosse player had lost most of her left leg in a freak moped accident in 2016. Afterwards, the courageous young athlete underwent many months of physical training and received a running blade, a leg prosthetic designed for athletes, at the end of her sophomore year through the Challenged Athletes Foundation. By her junior year, she was back on the lacrosse field learning how to run and play all over again.
While playing the sport she loves remained her focus, playing with a disability broadened the young athlete's focus. She created a charity, The Born to Run Foundation, which donates prosthetics to other young athletes in need of a limb. She graduated from her college, UMass-Lowell, in May 2019 and decided to take up a sport she had never tried before, sprinting. She traveled to Tempe, Arizona to compete in her first para-athletic track meet, the Desert Challenge Games. She ended up winning her class and beating the top U.S. female in the same class. In August 2019, at the World Para Athletics Grand Prix meet in Paris, she qualified for the U.S. National Team by running the 100-meter race in 16.85 seconds. She is now a member of the U.S. Paralympic team and is currently training for the 2021 Paralympics in Tokyo in the 100-meter race in Track and Field.
Book Noelle Lambert


text:
EngenuitySC to deliver imaginative, hands-on Career Expo for Richland One students
Adair Boroughs raises over $700,000 in 2019
38th Annual Pink Ice Gala, Columbia SC
ReCover Initiative to Begin Replacement of 100 Roofs in Richland County
America's Great Divide: From Obama to Trump, Part 2
Tom Steyer Picks Up 3 Black Surrogates From the Carolinas
The wrong type of billionaire: Why Tom Steyer is a threat to status quo Democrats
EngenuitySC to Host Midlands Regional Competitiveness Week, Jan. 24-31
Allen University to break ground for the Good Samaritan-Waverly Hospital Project
Candidates & Campaigns
Eye On 2020
How 'Eye' See It
SC Midterms 2018
Voting Rights & Issues
Entrepreneurial Eye
Music, Movies & Media
Hip Hop Culture
Travel & Luxury
The Week in A Blink
The Weekend Wink
About TMMP
Home/All-Posts/Moore School's Center for Executive Succession recognizes retired Aetna CEO, leadership consultant and author
All-Posts
Moore School's Center for Executive Succession recognizes retired Aetna CEO, leadership consultant and author
Sharon Sanders Follow on Twitter Send an email October 16, 2019
Facebook Twitter LinkedIn Tumblr Pinterest Reddit WhatsApp Share via Email
The Moore School will present the Center for Executive Succession's 2019 Leadership Legacy Award to former Aetna Inc. chairman and CEO, Ronald A. Williams. Williams will accept the award and present a keynote at a Nov. 4 event in the Moore School's W.W. "Hootie" Johnson Performance Hall from 6-7 p.m.
Williams was named president of Aetna in 2002; he served as the board's chairman and CEO from 2002-2011. Under Williams' leadership, Aetna was named Fortune's most admired company in the Health Care: Insurance and Managed Care category for three consecutive years. The company's market capitalization grew to $15.3 billion in 2011 from $4.7 billion in 2001. The company ranked 77th in 2011 on the Fortune 100 list.
Currently chairman and CEO of RW2 Enterprises, LLC, Williams counsels C-Suite executives on strategy and transformational leadership; he is a director of American Express, The Boeing Company and Johnson & Johnson. He is also the bestselling author of "Learning to Lead: The Journey to Leading Yourself, Leading Others, and Leading an Organization," which features leadership advice from Williams' own experience as well as the experiences of some of America's leading CEOs through engaging stories and practical steps for values-based leadership and transformational change.
His selection was primarily based on his ongoing commitment to help future leaders with their personal development. As part of his award, the Center for Executive Succession will donate $10,000 to the charity of Williams' choosing.
Williams' award presentation and keynote from 6-7 p.m. is open to UofSC students, faculty, staff and the general public. To register for the Nov. 4 event, visit 2019leadershiplegacyaward.eventbrite.com.
Sharon Sanders
Sharon Sanders is Co-Founder, Co-owner of the The MinorityEye. She is also a Digital Engagement Strategist and a Curator of information at The Minorityeye and the President of Clairvoyant, LLC which specializes in strategic communications and multimedia services. She has a B.A. in Psychology from Argosy University and she specializes in "Online Consumer Psychology." Sharon provides companies with research and insight into the processes underlying consumer behavior in online environments…
Advanced Technology Company Expands Operations in Richland County
Q&A Questionnaire
The MinorityEye Launches New Voter Mobilization Initiative
The COMET announces real-time information available through new partner app Transit
About The MinorityEye (TME)
The MinorityEye is an online news and information hub that focuses exclusively on issues relevant to minority communities. We believe "you can't be, what you can't see." That's why we are dedicated to introducing all communities to current and emerging entrepreneurs, entertainers, political, community and thought leaders of color. It is our sincere hope to inspire the next generation of our leaders. We invite you to learn more about the people, issues, events and causes that matter to our community.
Celebrate the legacy of Martin Luther King Jr. at Music and the Movement
South Carolina Commission for Minority Affairs to Host 2020 Black History Month Celebration
About TME
About The MinorityEye
Our Strategy & Algorithm
Subscriber Demographics
TME Community Calendar
Web Series & Podcast
The Minority Marketplace
Beyond February
The MinorityVoice
Subscribe to Our:
Weekly Events Notification
Community Action Text Notification
Contracting & Procurement Opportunities
SC's Minority Community Presswire
© Copyright 2020, TME Media Group: Powered by Eye M.A.P.P.S.
Facebook Twitter LinkedIn WhatsApp Telegram Viber


text:
THE CLASSIFIED FILE Marks the Highest Opening Score for 2015 Local Releases
Writerby Sonia KIL
Local Films Expected to Recover from the Long Slump
Crime drama The Classified File marked the highest opening score for all local films released this year.
The KWAK Kyung-taek film opened last Thursday (June 18) and amassed $1.25 million from 181,739 admissions on the opening day alone, beating all earlier local titles' opening scores this year: Gangnam Blues (152,571 admissions); Detective K: The Secret of the Lost Island (113,443); Twenty (151,161); The Treacherous (83,605); and The Chronicles of Evil (114,544). The Classified File has since Thursday amassed $8.56 million from 1.16 million admissions.
The director's previous release Friend: The Great Legacy scored $9.33 million from 1.37 admissions in the first week and grossed a total of $19.81 during the theatrical run in 2013. 2005's Typhoon, which earned $20.18 million, is currently KWAK's highest-grossing film.
Opening on the same day, another local newcomer The Silenced landed in third spot, amassing $1.83 million over four days. Though far weaker than The Classified File the mystery drama set under Japanese occupation has already exceeded director LEE Hae-young's previous title Foxy Festival which managed $1.38 million in 2010.
Three big local titles Minority Opinion, Intimate Enemies and Northern Limit Line are set to hit cinemas this week.
KWAK Kyung-taek
LEE Hae-young
Foxy Festival
Northern Limit Line
Friend : The Great Legacy
The Silenced
The Treacherous
The Chronicles of Evil
Detective K : Secret of the Lost Island
[News] BELIEVER Director LEE Hae-young Begins Shoot on Spy Thriller PHANTOM