text:
package ru.job4j.cinema.controller;

import com.google.gson.Gson;
import org.json.JSONObject;
import ru.job4j.cinema.model.CinemaSize;
import ru.job4j.cinema.model.Site;
import ru.job4j.cinema.model.service.ValidateService;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collection;

public class HallinformController extends HttpServlet{
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        CinemaSize cinemaSize = ValidateService.getInstance().getCinemaSize();
        String answer =  answer = new JSONObject()
                .put("row", cinemaSize.getRow())
                .put("place", cinemaSize.getPlace()).toString();
        PrintWriter writer = new PrintWriter(resp.getOutputStream());
        writer.append(answer);
        writer.flush();

    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        Gson gson = new Gson();
        Collection<Site> result = new ArrayList<>();
        result = ValidateService.getInstance().getAll();
        String json = toString();
        json = gson.toJson(result);
        PrintWriter writer = new PrintWriter(resp.getOutputStream());
        writer.append(json);
        writer.flush();
    }
}


text:
Technologies :-
Reactjs
es2015

redpajama_set_name: RedPajamaGithub


text:
package org.jetbrains.idea.svn.commandLine;

import com.intellij.openapi.vcs.LineProcessEventListener;

/**
 * Created with IntelliJ IDEA.
 * User: Irina.Chernushina
 * Date: 2/26/13
 * Time: 10:38 AM
 */
public interface LineCommandListener extends LineProcessEventListener {

  void cancel();

  boolean isCanceled();
}


text:
import os.path
import time
import sys
import platform
import queue
from collections import namedtuple
from functools import partial

from PyQt5.QtGui import *
from PyQt5.QtCore import *
from PyQt5.QtWidgets import *

from electrum.i18n import _
from electrum.util import FileImportFailed, FileExportFailed
from electrum.paymentrequest import PR_UNPAID, PR_PAID, PR_EXPIRED

if platform.system() == 'Windows':
    MONOSPACE_FONT = 'Lucida Console'
elif platform.system() == 'Darwin':
    MONOSPACE_FONT = 'Monaco'
else:
    MONOSPACE_FONT = 'monospace'

dialogs = []

pr_icons = {
    PR_UNPAID:":icons/unpaid.png",
    PR_PAID:":icons/confirmed.png",
    PR_EXPIRED:":icons/expired.png"
}

pr_tooltips = {
    PR_UNPAID:_('Pending'),
    PR_PAID:_('Paid'),
    PR_EXPIRED:_('Expired')
}

expiration_values = [
    (_('1 hour'), 60*60),
    (_('1 day'), 24*60*60),
    (_('1 week'), 7*24*60*60),
    (_('Never'), None)
]

class Timer(QThread):
    stopped = False
    timer_signal = pyqtSignal()

    def run(self):
        while not self.stopped:
            self.timer_signal.emit()
            time.sleep(0.5)

    def stop(self):
        self.stopped = True
        self.wait()

class EnterButton(QPushButton):
    def __init__(self, text, func):
        QPushButton.__init__(self, text)
        self.func = func
        self.clicked.connect(func)

    def keyPressEvent(self, e):
        if e.key() == Qt.Key_Return:
            self.func()

class ThreadedButton(QPushButton):
    def __init__(self, text, task, on_success=None, on_error=None):
        QPushButton.__init__(self, text)
        self.task = task
        self.on_success = on_success
        self.on_error = on_error
        self.clicked.connect(self.run_task)

    def run_task(self):
        self.setEnabled(False)
        self.thread = TaskThread(self)
        self.thread.add(self.task, self.on_success, self.done, self.on_error)

    def done(self):
        self.setEnabled(True)
        self.thread.stop()

class WWLabel(QLabel):
    def __init__ (self, text="", parent=None):
        QLabel.__init__(self, text, parent)
        self.setWordWrap(True)

class HelpLabel(QLabel):

    def __init__(self, text, help_text):
        QLabel.__init__(self, text)
        self.help_text = help_text
        self.app = QCoreApplication.instance()
        self.font = QFont()

    def mouseReleaseEvent(self, x):
        QMessageBox.information(self, 'Help', self.help_text)

    def enterEvent(self, event):
        self.font.setUnderline(True)
        self.setFont(self.font)
        self.app.setOverrideCursor(QCursor(Qt.PointingHandCursor))
        return QLabel.enterEvent(self, event)

    def leaveEvent(self, event):
        self.font.setUnderline(False)
        self.setFont(self.font)
        self.app.setOverrideCursor(QCursor(Qt.ArrowCursor))
        return QLabel.leaveEvent(self, event)

class HelpButton(QPushButton):
    def __init__(self, text):
        QPushButton.__init__(self, '?')
        self.help_text = text
        self.setFocusPolicy(Qt.NoFocus)
        self.setFixedWidth(20)
        self.clicked.connect(self.onclick)

    def onclick(self):
        QMessageBox.information(self, 'Help', self.help_text)

class Buttons(QHBoxLayout):
    def __init__(self, *buttons):
        QHBoxLayout.__init__(self)
        self.addStretch(1)
        for b in buttons:
            self.addWidget(b)

class CloseButton(QPushButton):
    def __init__(self, dialog):
        QPushButton.__init__(self, _("Close"))
        self.clicked.connect(dialog.close)
        self.setDefault(True)

class CopyButton(QPushButton):
    def __init__(self, text_getter, app):
        QPushButton.__init__(self, _("Copy"))
        self.clicked.connect(lambda: app.clipboard().setText(text_getter()))

class CopyCloseButton(QPushButton):
    def __init__(self, text_getter, app, dialog):
        QPushButton.__init__(self, _("Copy and Close"))
        self.clicked.connect(lambda: app.clipboard().setText(text_getter()))
        self.clicked.connect(dialog.close)
        self.setDefault(True)

class OkButton(QPushButton):
    def __init__(self, dialog, label=None):
        QPushButton.__init__(self, label or _("OK"))
        self.clicked.connect(dialog.accept)
        self.setDefault(True)

class CancelButton(QPushButton):
    def __init__(self, dialog, label=None):
        QPushButton.__init__(self, label or _("Cancel"))
        self.clicked.connect(dialog.reject)

class MessageBoxMixin(object):
    def top_level_window_recurse(self, window=None, test_func=None):
        window = window or self
        classes = (WindowModalDialog, QMessageBox)
        if test_func is None:
            test_func = lambda x: True
        for n, child in enumerate(window.children()):
            # Test for visibility as old closed dialogs may not be GC-ed.
            # Only accept children that confirm to test_func.
            if isinstance(child, classes) and child.isVisible() \
                    and test_func(child):
                return self.top_level_window_recurse(child, test_func=test_func)
        return window

    def top_level_window(self, test_func=None):
        return self.top_level_window_recurse(test_func)

    def question(self, msg, parent=None, title=None, icon=None):
        Yes, No = QMessageBox.Yes, QMessageBox.No
        return self.msg_box(icon or QMessageBox.Question,
                            parent, title or '',
                            msg, buttons=Yes|No, defaultButton=No) == Yes

    def show_warning(self, msg, parent=None, title=None):
        return self.msg_box(QMessageBox.Warning, parent,
                            title or _('Warning'), msg)

    def show_error(self, msg, parent=None):
        return self.msg_box(QMessageBox.Warning, parent,
                            _('Error'), msg)

    def show_critical(self, msg, parent=None, title=None):
        return self.msg_box(QMessageBox.Critical, parent,
                            title or _('Critical Error'), msg)

    def show_message(self, msg, parent=None, title=None):
        return self.msg_box(QMessageBox.Information, parent,
                            title or _('Information'), msg)

    def msg_box(self, icon, parent, title, text, buttons=QMessageBox.Ok,
                defaultButton=QMessageBox.NoButton):
        parent = parent or self.top_level_window()
        if type(icon) is QPixmap:
            d = QMessageBox(QMessageBox.Information, title, str(text), buttons, parent)
            d.setIconPixmap(icon)
        else:
            d = QMessageBox(icon, title, str(text), buttons, parent)
        d.setWindowModality(Qt.WindowModal)
        d.setDefaultButton(defaultButton)
        d.setTextInteractionFlags(Qt.TextSelectableByMouse)
        return d.exec_()

class WindowModalDialog(QDialog, MessageBoxMixin):
    '''Handy wrapper; window modal dialogs are better for our multi-window
    daemon model as other wallet windows can still be accessed.'''
    def __init__(self, parent, title=None):
        QDialog.__init__(self, parent)
        self.setWindowModality(Qt.WindowModal)
        if title:
            self.setWindowTitle(title)

class WaitingDialog(WindowModalDialog):
    '''Shows a please wait dialog whilst running a task.  It is not
    necessary to maintain a reference to this dialog.'''
    def __init__(self, parent, message, task, on_success=None, on_error=None):
        assert parent
        if isinstance(parent, MessageBoxMixin):
            parent = parent.top_level_window()
        WindowModalDialog.__init__(self, parent, _("Please wait"))
        vbox = QVBoxLayout(self)
        vbox.addWidget(QLabel(message))
        self.accepted.connect(self.on_accepted)
        self.show()
        self.thread = TaskThread(self)
        self.thread.finished.connect(self.deleteLater)  # see #3956
        self.thread.add(task, on_success, self.accept, on_error)

    def wait(self):
        self.thread.wait()

    def on_accepted(self):
        self.thread.stop()

def line_dialog(parent, title, label, ok_label, default=None):
    dialog = WindowModalDialog(parent, title)
    dialog.setMinimumWidth(500)
    l = QVBoxLayout()
    dialog.setLayout(l)
    l.addWidget(QLabel(label))
    txt = QLineEdit()
    if default:
        txt.setText(default)
    l.addWidget(txt)
    l.addLayout(Buttons(CancelButton(dialog), OkButton(dialog, ok_label)))
    if dialog.exec_():
        return txt.text()

def text_dialog(parent, title, label, ok_label, default=None, allow_multi=False):
    from .qrtextedit import ScanQRTextEdit
    dialog = WindowModalDialog(parent, title)
    dialog.setMinimumWidth(600)
    l = QVBoxLayout()
    dialog.setLayout(l)
    l.addWidget(QLabel(label))
    txt = ScanQRTextEdit(allow_multi=allow_multi)
    if default:
        txt.setText(default)
    l.addWidget(txt)
    l.addLayout(Buttons(CancelButton(dialog), OkButton(dialog, ok_label)))
    if dialog.exec_():
        return txt.toPlainText()

class ChoicesLayout(object):
    def __init__(self, msg, choices, on_clicked=None, checked_index=0):
        vbox = QVBoxLayout()
        if len(msg) > 50:
            vbox.addWidget(WWLabel(msg))
            msg = ""
        gb2 = QGroupBox(msg)
        vbox.addWidget(gb2)

        vbox2 = QVBoxLayout()
        gb2.setLayout(vbox2)

        self.group = group = QButtonGroup()
        for i,c in enumerate(choices):
            button = QRadioButton(gb2)
            button.setText(c)
            vbox2.addWidget(button)
            group.addButton(button)
            group.setId(button, i)
            if i==checked_index:
                button.setChecked(True)

        if on_clicked:
            group.buttonClicked.connect(partial(on_clicked, self))

        self.vbox = vbox

    def layout(self):
        return self.vbox

    def selected_index(self):
        return self.group.checkedId()

def address_field(addresses):
    hbox = QHBoxLayout()
    address_e = QLineEdit()
    if addresses and len(addresses) > 0:
        address_e.setText(addresses[0])
    else:
        addresses = []
    def func():
        try:
            i = addresses.index(str(address_e.text())) + 1
            i = i % len(addresses)
            address_e.setText(addresses[i])
        except ValueError:
            # the user might have changed address_e to an
            # address not in the wallet (or to something that isn't an address)
            if addresses and len(addresses) > 0:
                address_e.setText(addresses[0])
    button = QPushButton(_('Address'))
    button.clicked.connect(func)
    hbox.addWidget(button)
    hbox.addWidget(address_e)
    return hbox, address_e

def filename_field(parent, config, defaultname, select_msg):

    vbox = QVBoxLayout()
    vbox.addWidget(QLabel(_("Format")))
    gb = QGroupBox("format", parent)
    b1 = QRadioButton(gb)
    b1.setText(_("CSV"))
    b1.setChecked(True)
    b2 = QRadioButton(gb)
    b2.setText(_("json"))
    vbox.addWidget(b1)
    vbox.addWidget(b2)

    hbox = QHBoxLayout()

    directory = config.get('io_dir', os.path.expanduser('~'))
    path = os.path.join( directory, defaultname )
    filename_e = QLineEdit()
    filename_e.setText(path)

    def func():
        text = filename_e.text()
        _filter = "*.csv" if text.endswith(".csv") else "*.json" if text.endswith(".json") else None
        p, __ = QFileDialog.getSaveFileName(None, select_msg, text, _filter)
        if p:
            filename_e.setText(p)

    button = QPushButton(_('File'))
    button.clicked.connect(func)
    hbox.addWidget(button)
    hbox.addWidget(filename_e)
    vbox.addLayout(hbox)

    def set_csv(v):
        text = filename_e.text()
        text = text.replace(".json",".csv") if v else text.replace(".csv",".json")
        filename_e.setText(text)

    b1.clicked.connect(lambda: set_csv(True))
    b2.clicked.connect(lambda: set_csv(False))

    return vbox, filename_e, b1

class ElectrumItemDelegate(QStyledItemDelegate):
    def createEditor(self, parent, option, index):
        return self.parent().createEditor(parent, option, index)

class MyTreeWidget(QTreeWidget):

    def __init__(self, parent, create_menu, headers, stretch_column=None,
                 editable_columns=None):
        QTreeWidget.__init__(self, parent)
        self.parent = parent
        self.config = self.parent.config
        self.stretch_column = stretch_column
        self.setContextMenuPolicy(Qt.CustomContextMenu)
        self.customContextMenuRequested.connect(create_menu)
        self.setUniformRowHeights(True)
        # extend the syntax for consistency
        self.addChild = self.addTopLevelItem
        self.insertChild = self.insertTopLevelItem

        self.icon_cache = IconCache()

        # Control which columns are editable
        self.editor = None
        self.pending_update = False
        if editable_columns is None:
            editable_columns = {stretch_column}
        else:
            editable_columns = set(editable_columns)
        self.editable_columns = editable_columns
        self.setItemDelegate(ElectrumItemDelegate(self))
        self.itemDoubleClicked.connect(self.on_doubleclick)
        self.update_headers(headers)
        self.current_filter = ""

        self.setRootIsDecorated(False)  # remove left margin
        self.toolbar_shown = False

    def update_headers(self, headers):
        self.setColumnCount(len(headers))
        self.setHeaderLabels(headers)
        self.header().setStretchLastSection(False)
        for col in range(len(headers)):
            sm = QHeaderView.Stretch if col == self.stretch_column else QHeaderView.ResizeToContents
            self.header().setSectionResizeMode(col, sm)

    def editItem(self, item, column):
        if column in self.editable_columns:
            try:
                self.editing_itemcol = (item, column, item.text(column))
                # Calling setFlags causes on_changed events for some reason
                item.setFlags(item.flags() | Qt.ItemIsEditable)
                QTreeWidget.editItem(self, item, column)
                item.setFlags(item.flags() & ~Qt.ItemIsEditable)
            except RuntimeError:
                # (item) wrapped C/C++ object has been deleted
                pass

    def keyPressEvent(self, event):
        if event.key() in [ Qt.Key_F2, Qt.Key_Return ] and self.editor is None:
            self.on_activated(self.currentItem(), self.currentColumn())
        else:
            QTreeWidget.keyPressEvent(self, event)

    def permit_edit(self, item, column):
        return (column in self.editable_columns
                and self.on_permit_edit(item, column))

    def on_permit_edit(self, item, column):
        return True

    def on_doubleclick(self, item, column):
        if self.permit_edit(item, column):
            self.editItem(item, column)

    def on_activated(self, item, column):
        # on 'enter' we show the menu
        pt = self.visualItemRect(item).bottomLeft()
        pt.setX(50)
        self.customContextMenuRequested.emit(pt)

    def createEditor(self, parent, option, index):
        self.editor = QStyledItemDelegate.createEditor(self.itemDelegate(),
                                                       parent, option, index)
        self.editor.editingFinished.connect(self.editing_finished)
        return self.editor

    def editing_finished(self):
        # Long-time QT bug - pressing Enter to finish editing signals
        # editingFinished twice.  If the item changed the sequence is
        # Enter key:  editingFinished, on_change, editingFinished
        # Mouse: on_change, editingFinished
        # This mess is the cleanest way to ensure we make the
        # on_edited callback with the updated item
        if self.editor:
            (item, column, prior_text) = self.editing_itemcol
            if self.editor.text() == prior_text:
                self.editor = None  # Unchanged - ignore any 2nd call
            elif item.text(column) == prior_text:
                pass # Buggy first call on Enter key, item not yet updated
            else:
                # What we want - the updated item
                self.on_edited(*self.editing_itemcol)
                self.editor = None

            # Now do any pending updates
            if self.editor is None and self.pending_update:
                self.pending_update = False
                self.on_update()

    def on_edited(self, item, column, prior):
        '''Called only when the text actually changes'''
        key = item.data(0, Qt.UserRole)
        text = item.text(column)
        self.parent.wallet.set_label(key, text)
        self.parent.history_list.update_labels()
        self.parent.update_completions()

    def update(self):
        # Defer updates if editing
        if self.editor:
            self.pending_update = True
        else:
            self.setUpdatesEnabled(False)
            scroll_pos = self.verticalScrollBar().value()
            self.on_update()
            self.setUpdatesEnabled(True)
            # To paint the list before resetting the scroll position
            self.parent.app.processEvents()
            self.verticalScrollBar().setValue(scroll_pos)
        if self.current_filter:
            self.filter(self.current_filter)

    def on_update(self):
        pass

    def get_leaves(self, root):
        child_count = root.childCount()
        if child_count == 0:
            yield root
        for i in range(child_count):
            item = root.child(i)
            for x in self.get_leaves(item):
                yield x

    def filter(self, p):
        columns = self.__class__.filter_columns
        p = p.lower()
        self.current_filter = p
        for item in self.get_leaves(self.invisibleRootItem()):
            item.setHidden(all([item.text(column).lower().find(p) == -1
                                for column in columns]))

    def create_toolbar(self, config=None):
        hbox = QHBoxLayout()
        buttons = self.get_toolbar_buttons()
        for b in buttons:
            b.setVisible(False)
            hbox.addWidget(b)
        hide_button = QPushButton('x')
        hide_button.setVisible(False)
        hide_button.pressed.connect(lambda: self.show_toolbar(False, config))
        self.toolbar_buttons = buttons + (hide_button,)
        hbox.addStretch()
        hbox.addWidget(hide_button)
        return hbox

    def save_toolbar_state(self, state, config):
        pass  # implemented in subclasses

    def show_toolbar(self, state, config=None):
        if state == self.toolbar_shown:
            return
        self.toolbar_shown = state
        if config:
            self.save_toolbar_state(state, config)
        for b in self.toolbar_buttons:
            b.setVisible(state)
        if not state:
            self.on_hide_toolbar()

    def toggle_toolbar(self, config=None):
        self.show_toolbar(not self.toolbar_shown, config)

class ButtonsWidget(QWidget):

    def __init__(self):
        super(QWidget, self).__init__()
        self.buttons = []

    def resizeButtons(self):
        frameWidth = self.style().pixelMetric(QStyle.PM_DefaultFrameWidth)
        x = self.rect().right() - frameWidth
        y = self.rect().bottom() - frameWidth
        for button in self.buttons:
            sz = button.sizeHint()
            x -= sz.width()
            button.move(x, y - sz.height())

    def addButton(self, icon_name, on_click, tooltip):
        button = QToolButton(self)
        button.setIcon(QIcon(icon_name))
        button.setStyleSheet("QToolButton { border: none; hover {border: 1px} pressed {border: 1px} padding: 0px; }")
        button.setVisible(True)
        button.setToolTip(tooltip)
        button.clicked.connect(on_click)
        self.buttons.append(button)
        return button

    def addCopyButton(self, app):
        self.app = app
        self.addButton(":icons/copy.png", self.on_copy, _("Copy to clipboard"))

    def on_copy(self):
        self.app.clipboard().setText(self.text())
        QToolTip.showText(QCursor.pos(), _("Text copied to clipboard"), self)

class ButtonsLineEdit(QLineEdit, ButtonsWidget):
    def __init__(self, text=None):
        QLineEdit.__init__(self, text)
        self.buttons = []

    def resizeEvent(self, e):
        o = QLineEdit.resizeEvent(self, e)
        self.resizeButtons()
        return o

class ButtonsTextEdit(QPlainTextEdit, ButtonsWidget):
    def __init__(self, text=None):
        QPlainTextEdit.__init__(self, text)
        self.setText = self.setPlainText
        self.text = self.toPlainText
        self.buttons = []

    def resizeEvent(self, e):
        o = QPlainTextEdit.resizeEvent(self, e)
        self.resizeButtons()
        return o

class TaskThread(QThread):
    '''Thread that runs background tasks.  Callbacks are guaranteed
    to happen in the context of its parent.'''

    Task = namedtuple("Task", "task cb_success cb_done cb_error")
    doneSig = pyqtSignal(object, object, object)

    def __init__(self, parent, on_error=None):
        super(TaskThread, self).__init__(parent)
        self.on_error = on_error
        self.tasks = queue.Queue()
        self.doneSig.connect(self.on_done)
        self.start()

    def add(self, task, on_success=None, on_done=None, on_error=None):
        on_error = on_error or self.on_error
        self.tasks.put(TaskThread.Task(task, on_success, on_done, on_error))

    def run(self):
        while True:
            task = self.tasks.get()
            if not task:
                break
            try:
                result = task.task()
                self.doneSig.emit(result, task.cb_done, task.cb_success)
            except BaseException:
                self.doneSig.emit(sys.exc_info(), task.cb_done, task.cb_error)

    def on_done(self, result, cb_done, cb_result):
        # This runs in the parent's thread.
        if cb_done:
            cb_done()
        if cb_result:
            cb_result(result)

    def stop(self):
        self.tasks.put(None)

class ColorSchemeItem:
    def __init__(self, fg_color, bg_color):
        self.colors = (fg_color, bg_color)

    def _get_color(self, background):
        return self.colors[(int(background) + int(ColorScheme.dark_scheme)) % 2]

    def as_stylesheet(self, background=False):
        css_prefix = "background-" if background else ""
        color = self._get_color(background)
        return "QWidget {{ {}color:{}; }}".format(css_prefix, color)

    def as_color(self, background=False):
        color = self._get_color(background)
        return QColor(color)

class ColorScheme:
    dark_scheme = False

    GREEN = ColorSchemeItem("#117c11", "#8af296")
    YELLOW = ColorSchemeItem("#897b2a", "#ffff00")
    RED = ColorSchemeItem("#7c1111", "#f18c8c")
    BLUE = ColorSchemeItem("#123b7c", "#8cb3f2")
    DEFAULT = ColorSchemeItem("black", "white")

    @staticmethod
    def has_dark_background(widget):
        brightness = sum(widget.palette().color(QPalette.Background).getRgb()[0:3])
        return brightness < (255*3/2)

    @staticmethod
    def update_from_widget(widget):
        if ColorScheme.has_dark_background(widget):
            ColorScheme.dark_scheme = True

class AcceptFileDragDrop:
    def __init__(self, file_type=""):
        assert isinstance(self, QWidget)
        self.setAcceptDrops(True)
        self.file_type = file_type

    def validateEvent(self, event):
        if not event.mimeData().hasUrls():
            event.ignore()
            return False
        for url in event.mimeData().urls():
            if not url.toLocalFile().endswith(self.file_type):
                event.ignore()
                return False
        event.accept()
        return True

    def dragEnterEvent(self, event):
        self.validateEvent(event)

    def dragMoveEvent(self, event):
        if self.validateEvent(event):
            event.setDropAction(Qt.CopyAction)

    def dropEvent(self, event):
        if self.validateEvent(event):
            for url in event.mimeData().urls():
                self.onFileAdded(url.toLocalFile())

    def onFileAdded(self, fn):
        raise NotImplementedError()

def import_meta_gui(electrum_window, title, importer, on_success):
    filter_ = "JSON (*.json);;All files (*)"
    filename = electrum_window.getOpenFileName(_("Open {} file").format(title), filter_)
    if not filename:
        return
    try:
        importer(filename)
    except FileImportFailed as e:
        electrum_window.show_critical(str(e))
    else:
        electrum_window.show_message(_("Your {} were successfully imported").format(title))
        on_success()

def export_meta_gui(electrum_window, title, exporter):
    filter_ = "JSON (*.json);;All files (*)"
    filename = electrum_window.getSaveFileName(_("Select file to save your {}").format(title),
                                               'electrum_{}.json'.format(title), filter_)
    if not filename:
        return
    try:
        exporter(filename)
    except FileExportFailed as e:
        electrum_window.show_critical(str(e))
    else:
        electrum_window.show_message(_("Your {0} were exported to '{1}'")
                                     .format(title, str(filename)))

def get_parent_main_window(widget):
    """Returns a reference to the ElectrumWindow this widget belongs to."""
    from .main_window import ElectrumWindow
    for _ in range(100):
        if widget is None:
            return None
        if not isinstance(widget, ElectrumWindow):
            widget = widget.parentWidget()
        else:
            return widget
    return None

class SortableTreeWidgetItem(QTreeWidgetItem):
    DataRole = Qt.UserRole + 1

    def __lt__(self, other):
        column = self.treeWidget().sortColumn()
        if None not in [x.data(column, self.DataRole) for x in [self, other]]:
            # We have set custom data to sort by
            return self.data(column, self.DataRole) < other.data(column, self.DataRole)
        try:
            # Is the value something numeric?
            return float(self.text(column)) < float(other.text(column))
        except ValueError:
            # If not, we will just do string comparison
            return self.text(column) < other.text(column)

class IconCache:

    def __init__(self):
        self.__cache = {}

    def get(self, file_name):
        if file_name not in self.__cache:
            self.__cache[file_name] = QIcon(file_name)
        return self.__cache[file_name]

if __name__ == "__main__":
    app = QApplication([])
    t = WaitingDialog(None, 'testing ...', lambda: [time.sleep(1)], lambda x: QMessageBox.information(None, 'done', "done"))
    t.start()
    app.exec_()


text:
package uk.gov.gchq.gaffer.analytic.operation.handler;

import uk.gov.gchq.gaffer.analytic.operation.AddAnalytic;
import uk.gov.gchq.gaffer.analytic.operation.AnalyticDetail;
import uk.gov.gchq.gaffer.analytic.operation.UIMappingDetail;
import uk.gov.gchq.gaffer.analytic.operation.handler.cache.AnalyticCache;
import uk.gov.gchq.gaffer.named.operation.NamedOperationDetail;
import uk.gov.gchq.gaffer.named.operation.cache.exception.CacheOperationFailedException;
import uk.gov.gchq.gaffer.operation.OperationException;
import uk.gov.gchq.gaffer.store.Context;
import uk.gov.gchq.gaffer.store.Store;
import uk.gov.gchq.gaffer.store.operation.handler.OperationHandler;
import uk.gov.gchq.gaffer.store.operation.handler.named.cache.NamedOperationCache;

import java.util.Map;

public class AddAnalyticHandler implements OperationHandler<AddAnalytic> {
    private final AnalyticCache cache;

    public AddAnalyticHandler() {
        this(new AnalyticCache());
    }

    public AddAnalyticHandler(final AnalyticCache cache) {
        this.cache = cache;
    }

    /**
     * Adds an Analytic to a cache which must be specified in the operation
     * declarations file. An AnalyticDetail is built using the fields on the
     * AddAnalytic. The operation name and operation chain fields must be set and
     * cannot be left empty, or the build() method will fail and a runtime exception
     * will be thrown. The handler then adds/overwrites the Analytic according toa
     * an overwrite flag.
     *
     * @param operation the {@link uk.gov.gchq.gaffer.operation.Operation} to be
     *                  executed
     * @param context   the operation chain context, containing the user who
     *                  executed the operation
     * @param store     the {@link Store} the operation should be run on
     * @return null (since the output is void)
     * @throws OperationException if the operation on the cache fails
     */
    @Override
    public Void doOperation(final AddAnalytic operation, final Context context, final Store store)
            throws OperationException {
        try {
            final AnalyticDetail analyticOperationDetail = new AnalyticDetail.Builder()
                    .analyticName(operation.getAnalyticName()).operationName(operation.getOperationName())
                    .creatorId(context.getUser().getUserId()).readers(operation.getReadAccessRoles())
                    .writers(operation.getWriteAccessRoles()).description(operation.getDescription())
                    .uiMapping(operation.getUiMapping()).metaData(operation.getMetaData())
                    .outputVisualisation(operation.getOutputVisualisation())
                    .score(operation.getScore()).options(operation.getOptions())
                    .build();

            validate(analyticOperationDetail);
            cache.addAnalyticOperation(analyticOperationDetail, operation.isOverwriteFlag(), context.getUser(),
                    store.getProperties().getAdminAuth());

        } catch (final CacheOperationFailedException e) {
            throw new OperationException(e.getMessage(), e);
        }
        return null;
    }

    private void validate(final AnalyticDetail analyticOperationDetail) throws OperationException {

        if (null != analyticOperationDetail.getUiMapping()) {
            Map<String, UIMappingDetail> uiMap = analyticOperationDetail.getUiMapping();
            for (final String current : analyticOperationDetail.getUiMapping().keySet()) {
                if (uiMap.get(current).getLabel() == null) {
                    throw new OperationException("UIMapping: label not specified.");
                } else if (uiMap.get(current).getParameterName() == null) {
                    throw new OperationException("UIMapping: parameterName not specified.");
                } else if (uiMap.get(current).getUserInputType() == null) {
                    throw new OperationException("UIMapping: userInputType not specified.");
                } else {
                    NamedOperationCache noc = new NamedOperationCache();
                    try {
                        NamedOperationDetail nod = noc.getFromCache(analyticOperationDetail.getOperationName());
                        if (nod.getParameters() == null) {
                            throw new OperationException("UIMapping exists, parameters should not be null");
                        }
                        if (nod.getParameters().get(uiMap.get(current).getParameterName()) == null) {
                            throw new OperationException("UIMapping: parameter '"
                                    + uiMap.get(current).getParameterName() + "' does not exist in Named Operation");
                        }
                    } catch (final CacheOperationFailedException e) {
                        throw new OperationException(e.getMessage());
                    }
                }
            }
        }

        if (null == analyticOperationDetail.getMetaData()) {
            throw new OperationException("Missing metaData field in AddAnalyticOperation");
        }
    }
}


text:
package org.apache.camel.util;

import java.io.FileInputStream;

import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;

import junit.framework.TestCase;

public class XmlLineNumberParserTest extends TestCase {

    public void testParse() throws Exception {
        FileInputStream fis = new FileInputStream("src/test/resources/org/apache/camel/util/camel-context.xml");
        Document dom = XmlLineNumberParser.parseXml(fis);
        assertNotNull(dom);

        NodeList list = dom.getElementsByTagName("beans");
        assertEquals(1, list.getLength());
        Node node = list.item(0);

        String lineNumber = (String) node.getUserData(XmlLineNumberParser.LINE_NUMBER);
        String lineNumberEnd = (String) node.getUserData(XmlLineNumberParser.LINE_NUMBER_END);

        assertEquals("24", lineNumber);
        assertEquals("49", lineNumberEnd);
    }

    public void testParseCamelContext() throws Exception {
        FileInputStream fis = new FileInputStream("src/test/resources/org/apache/camel/util/camel-context.xml");
        Document dom = XmlLineNumberParser.parseXml(fis, null, "camelContext", null);
        assertNotNull(dom);

        NodeList list = dom.getElementsByTagName("camelContext");
        assertEquals(1, list.getLength());
        Node node = list.item(0);

        String lineNumber = (String) node.getUserData(XmlLineNumberParser.LINE_NUMBER);
        String lineNumberEnd = (String) node.getUserData(XmlLineNumberParser.LINE_NUMBER_END);

        assertEquals("29", lineNumber);
        assertEquals("47", lineNumberEnd);
    }

    public void testParseCamelContextForceNamespace() throws Exception {
        FileInputStream fis = new FileInputStream("src/test/resources/org/apache/camel/util/camel-context.xml");
        Document dom = XmlLineNumberParser.parseXml(fis, null, "camelContext", "http://camel.apache.org/schema/spring");
        assertNotNull(dom);

        NodeList list = dom.getElementsByTagName("camelContext");
        assertEquals(1, list.getLength());
        Node node = list.item(0);

        String lineNumber = (String) node.getUserData(XmlLineNumberParser.LINE_NUMBER);
        String lineNumberEnd = (String) node.getUserData(XmlLineNumberParser.LINE_NUMBER_END);

        String ns = node.getNamespaceURI();
        assertEquals("http://camel.apache.org/schema/spring", ns);

        assertEquals("29", lineNumber);
        assertEquals("47", lineNumberEnd);

        // and there are two routes
        list = dom.getElementsByTagName("route");
        assertEquals(2, list.getLength());
        Node node1 = list.item(0);
        Node node2 = list.item(1);

        String lineNumber1 = (String) node1.getUserData(XmlLineNumberParser.LINE_NUMBER);
        String lineNumberEnd1 = (String) node1.getUserData(XmlLineNumberParser.LINE_NUMBER_END);
        assertEquals("31", lineNumber1);
        assertEquals("37", lineNumberEnd1);

        String lineNumber2 = (String) node2.getUserData(XmlLineNumberParser.LINE_NUMBER);
        String lineNumberEnd2 = (String) node2.getUserData(XmlLineNumberParser.LINE_NUMBER_END);
        assertEquals("39", lineNumber2);
        assertEquals("45", lineNumberEnd2);
    }

}


text:
namespace Toolbox.Core
{
    public interface IConsoleTool
    {
        Categories Category { get; }

        string Name { get;  }

        string Description { get;  }

        void Run();

    }
}


text:
package com.flipkart.flux.examples.decision;

import com.flipkart.flux.client.model.Promise;

/**
 * Dummy Task Data that is produced as a result of performing a simple task
 *
 */
public class TaskData {

    private Promise<Long> id;

    public boolean isGood() {
        return false;
    }

    public Promise<Long> getId() {
        return id;
    }
}


text:
package by.premiya.olga.project.util;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;

/**
 * This class is used for holding {@code ApplicationContext} and for getting beans if
 * {@code @Autowired} or {@code @Inject} annotations doesn't work.
 *
 * @see org.springframework.context.ApplicationContextAware
 * @see org.springframework.beans.factory.Aware
 * @see org.springframework.beans.factory.annotation.Autowired
 * @see javax.inject.Inject
 *
 * @author vlad
 */
@Component
public class ApplicationContextHolder implements ApplicationContextAware {
    private static ApplicationContext context;

    public static ApplicationContext getContext() {
        return context;
    }

    /**
     * Method is works similar to {@code @Autowired} or {@code @Inject} annotations,
     * but if this annotations doesn't work - this method will help you.
     *
     * @param beanName bean name that you want to take.
     * @return specified bean with name {@code beanName}
     * @throws org.springframework.beans.factory.NoSuchBeanDefinitionException if bean with name {@code beanName} doesn't exists in application context
     *
     * @see org.springframework.beans.factory.annotation.Autowired
     * */
    public static Object getBean(String beanName) throws NoSuchBeanDefinitionException {
        Object bean = context.getBean(beanName);
        if (bean == null) {
            throw new NoSuchBeanDefinitionException(beanName);
        }
        return bean;
    }

    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        context = applicationContext;
    }
}


text:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<feed><tipo>Rua</tipo><logradouro>B</logradouro><bairro>Santa Lúcia</bairro><cidade>Montes Claros</cidade><uf>MG</uf><cep>39402077</cep></feed>


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using BGAssist.Braille.Client.Logic;

namespace BGAssist.Braille.Client.Controls
{
    public partial class ContainerBox : Box
    {
        private List<ContentBox> contentBoxes;

        public List<ContentBox> ContentBoxes
        {
            get
            {
                return contentBoxes;
            }
        }

        public ContainerBox(int rows, int cells)
            :base(rows, cells)
        {
            if (ContentBoxes == null)
            {
                contentBoxes = new List<ContentBox>();
            }
        }

        public void InsertContenBox(ContentBox box)
        {
            if (box.Rows > this.Rows)
            {
                MessageBox.Show("You are creating a content box with more rows than the page! The maximum rows count is " + this.Rows, "Error", MessageBoxButton.OK);
            }
            else if (box.Cells > this.Cells)
            {
                MessageBox.Show("You are creating a content box with more cells than the page! The maximum cells count is " + this.Cells, "Error", MessageBoxButton.OK);
            }
            else
            {
                contentBoxes.Add(box);
            }
        }

        public static ContainerBox CreateDefaultPage()
        {
            int contentWidth = Properties.Settings.Default.PageCells - (Properties.Settings.Default.PagePadding * 2);
            int footerHeight = Properties.Settings.Default.PageRows - (Properties.Settings.Default.HeaderHeight + Properties.Settings.Default.ContentHeight);

            ContainerBox cb = new ContainerBox(Properties.Settings.Default.PageRows, Properties.Settings.Default.PageCells);

            ContentBox header = new ContentBox(Properties.Settings.Default.HeaderHeight, contentWidth);
            header.Type = ContentBoxType.Header;

            ContentBox pageContent = new ContentBox(Properties.Settings.Default.ContentHeight, contentWidth);
            pageContent.Type = ContentBoxType.PageContent;

            ContentBox footer = new ContentBox(footerHeight, contentWidth);
            footer.Type = ContentBoxType.Footer;

            cb.InsertContenBox(header);
            cb.InsertContenBox(pageContent);
            cb.InsertContenBox(footer);

            return cb;
        }
    }
}


text:
package mouse;

import java.awt.event.*;
import java.awt.geom.*;
import representation.*;

/**
 * @author dmutti@gmail.com
 * http://www.java.happycodings.com/Java2D/code4.html
 */
public class MethodRepresentationListener  extends MouseAdapter {
    private MethodRepresentation parent;

    public MethodRepresentationListener(MethodRepresentation arg) {
        this.parent = arg;
    }

    @Override
    public void mouseClicked(MouseEvent e) {
        Line2D line = parent.getBranchInformation().getAsLine2D();
        if (distanceToSegment(line.getP1(), line.getP2(), e.getPoint()) < 3) {
            System.out.println(parent.getMethodDescription().getClassName() + "." + parent.getMethodDescription().getName());
        }
    }

    public static double distanceToSegment(Point2D p1, Point2D p2, Point2D p3) {

        final double xDelta = p2.getX() - p1.getX();
        final double yDelta = p2.getY() - p1.getY();

        if ((xDelta == 0) && (yDelta == 0)) {
            throw new IllegalArgumentException("p1 e p2 nao podem ser o mesmo ponto!");
        }

        final double u = ((p3.getX() - p1.getX()) * xDelta + (p3.getY() - p1.getY()) * yDelta) / (xDelta * xDelta + yDelta * yDelta);

        final Point2D closestPoint;
        if (u < 0) {
            closestPoint = p1;
        } else if (u > 1) {
            closestPoint = p2;
        } else {
            closestPoint = new Point2D.Double(p1.getX() + u * xDelta, p1.getY() + u * yDelta);
        }

        return closestPoint.distance(p3);
    }
}


text:
const Promise = require("es6-promise").Promise;
const istanbul = require("istanbul");
const fs = require("fs");

class IstanbulReport {

    constructor(settings) {
        this.settings = settings || {};
        this.settings.rootDir = this.settings.rootDir || "./";
        this.settings.coverageFiles = this.settings.coverageFiles || ["coverage/coverage-final.json"];
        this.settings.summaryFile = this.settings.summaryFile || "coverage/coverage-summary.json";
        this.sanitizeThreshold(this.settings.threshold);
        if (this.settings.coverageFiles.length === 0) {
            throw new Error("Require at least one coverage istanbul file (settings.coverageFiles)");
        }
    }

    sanitizeThreshold(threshold) {
        if (typeof this.settings.threshold === "undefined") {
            this.settings.threshold = 80;
        } else if (threshold > 100) {
            this.settings.threshold = 100;
        } else if (threshold < 0) {
            this.settings.threshold = 0;
        }
    }

    generateSummary() {
        let files = this.settings.coverageFiles.map((file) => `${this.settings.rootDir}/${file}`);
        return new Promise((resolve, reject) => {
            const collector = new istanbul.Collector();
            const reporter = new istanbul.Reporter();
            reporter.addAll(['json-summary']);
            try {
                files.forEach((file) => collector.add(JSON.parse(fs.readFileSync(file, 'utf8'))));
                reporter.write(collector, false, () => {
                    return resolve();
                });
            } catch (e) {
                reject(new Error('Error reading coverage files. Generate istanbul report(s) first'));
            }
        });
    }

    processSummary() {
        let coverageSummary = `${this.settings.rootDir}/${this.settings.summaryFile}`;
        let readFile = new Promise((resolve, reject) => {
            fs.readFile(coverageSummary, 'utf-8', (err, data) => {
                if (err) {
                    reject(new Error(`Error processing file: ${this.settings.summaryFile}`));
                }
                resolve(data);
            })
        });
        return readFile
            .then((json) => {
                let summary = JSON.parse(json);
                let coverage = {
                    statements: summary.total.statements.pct,
                    branches: summary.total.branches.pct,
                    lines: summary.total.lines.pct,
                    functions: summary.total.functions.pct
                };
                coverage.project = (coverage.branches + coverage.statements + coverage.lines + coverage.functions) / 4;
                coverage.project = parseFloat(coverage.project.toFixed(2));
                coverage.threshold = this.settings.threshold;
                coverage.success = this.settings.threshold <= coverage.project;
                return Promise.resolve(coverage);
            });
    }
}

module.exports = IstanbulReport;


text:
<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/ads/googleads/v12/enums/listing_group_type.proto

namespace Google\Ads\GoogleAds\V12\Enums;

use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\Internal\GPBUtil;

/**
 * Container for enum describing the type of the listing group.
 *
 * Generated from protobuf message google.ads.googleads.v12.enums.ListingGroupTypeEnum
 */
class ListingGroupTypeEnum extends \Google\Protobuf\Internal\Message
{

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Ads\GoogleAds\V12\Enums\ListingGroupType::initOnce();
        parent::__construct($data);
    }

}


text:
PLAYER_NS_BEGIN
class PlayerTaskMac;
PLAYER_NS_END

@interface PlayerTaskPrivate : NSObject
{
    NSFileHandle *fileHandle;
}

@property (assign) NSTask *buildTask;
@property (assign) BOOL isRunning;
@property (assign) int exitCode;
@property (retain) NSString *output;

- (void) runScriptAsyn:(NSString *)absScriptPath withArguments:(NSArray *) arguments;
@end

PLAYER_NS_BEGIN

class PlayerTaskMac : public PlayerTask
{
public:
    static PlayerTaskMac *create(const std::string &name,
                                 const std::string &executePath,
                                 const std::string &commandLineArguments);

    virtual ~PlayerTaskMac();

    virtual bool run();
    virtual void stop();
    virtual void runInTerminal();

    // check task status
    virtual void update(float dt);

    void appendOutput(const char *data);
protected:
    PlayerTaskMac(const std::string &name,
                  const std::string &executePath,
                  const std::string &commandLineArguments);

    void cleanup();
    std::u16string makeCommandLine() const;

    PlayerTaskPrivate  *_taskPrivate;
};

class PlayerTaskServiceMac : public PlayerTaskServiceProtocol
{
public:
    PlayerTaskServiceMac();
    virtual ~PlayerTaskServiceMac();

    virtual PlayerTask *createTask(const std::string &name,
                                   const std::string &executePath,
                                   const std::string &commandLineArguments);
    virtual PlayerTask *getTask(const std::string &name);
    virtual void removeTask(const std::string &name);

protected:
    cocos2d::Map<std::string, PlayerTaskMac*> _tasks;
};

PLAYER_NS_END

#endif // __PLAYER_TASK_SERVICE_MAC_H_


text:
ConsoleUI::ConsoleUI(Controller & cont): _cont(cont)
{
}

void ConsoleUI::run() {

	while (1) {
		this->clear();
		std::vector<std::string> options = { "1. Administrator", "2. User", "3. Back", "0. Exit" };
		int i = 0;
		for (auto &e : options) {
			ConsoleUI::gotoxy(25, 7 + i);
			std::cout << e << "\n";
			i++;
		}
		char key = _getch();
		switch (key - '0') {
			case 1:
				this->handleAdminUI();
				break;
			case 2:
				std::cout << "User";
				break;
			case 3:
				return;
				break;
			case 0:
				exit(0);
				break;
			default:
				break;
		}
	}
}

void ConsoleUI::handleAdminUI() {
	std::vector<std::string> options = { "1 - ADD", "2 - DELETE", "3 - UPDATE", "4 - BACK", "<- Previous Next ->" };

	int currentIndex = 0;
	Cloth *current;
	while (1) {
		this->clear();

		if (this->_cont.getAllClothes().size() > 1) {
			ConsoleUI::gotoxy(0, 8);
			std::cout << "Showing " << (currentIndex % this->_cont.getAllClothes().size()) + 1 << " out of " << this->_cont.getAllClothes().size() << "\n";
			current = &this->_cont.getAllClothes()[currentIndex % this->_cont.getAllClothes().size()]; // save cpu by not force copying
			this->alignAndPrintCloth(*current);
			for (int i = 0; i < options.size(); i++) {
				ConsoleUI::gotoxy(0, 23 - options.size() + i); // 23 is the max len for my console, not a magical number.
				std::cout << options[i];
			}
		}
		else {
			std::cout << "No clothes to show \n";
		}
		char key = _getch();

		switch (key) {
			case 'M':
				currentIndex++;
				break;
			case 'K':
				currentIndex--;
				if (currentIndex == -1)
					currentIndex = this->_cont.getAllClothes().size() - 1;
				break;
			case '1':
				std::cout << "Admin";

				break;
			case '2':
				std::cout << "User";
				break;
			case '3':
				std::cout << "User";
				break;
			case '4':
				return;
				break;
			default:
				//return;
				break;
		}
	}
	std::cout << "Admin";
	this->alignAndPrintCloth(this->_cont.getAllClothes()[0]);
}

void ConsoleUI::alignAndPrintCloth(Cloth el) {
	int middle = 0;
	ConsoleUI::gotoxy(middle, 10);
	std::cout << "ID: " << el.getID() << '\n';
	ConsoleUI::gotoxy(middle, 11);
	std::cout << "Size: " << el.getSize() << '\n';
	ConsoleUI::gotoxy(middle, 12);
	std::cout << "Color: " << el.getColor() << '\n';
	ConsoleUI::gotoxy(middle, 13);
	std::cout << "Price: " << el.getPrice() << '\n';
	ConsoleUI::gotoxy(middle, 14);
	std::cout << "Quantity: " << el.getQuantity() << '\n';
	ConsoleUI::gotoxy(middle, 15);
	std::cout << "Photograph: " << el.getPhoto() << '\n';
}

void ConsoleUI::clear() {
	COORD topLeft = { 0, 0 };
	HANDLE console = GetStdHandle(STD_OUTPUT_HANDLE);
	CONSOLE_SCREEN_BUFFER_INFO screen;
	DWORD written;

	GetConsoleScreenBufferInfo(console, &screen);
	FillConsoleOutputCharacterA(
		console, ' ', screen.dwSize.X * screen.dwSize.Y, topLeft, &written
		);
	FillConsoleOutputAttribute(
		console, FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_BLUE,
		screen.dwSize.X * screen.dwSize.Y, topLeft, &written
		);
	SetConsoleCursorPosition(console, topLeft);
}

void ConsoleUI::gotoxy(int xpos, int ypos)
{
	COORD scrn;
	HANDLE hOuput = GetStdHandle(STD_OUTPUT_HANDLE);
	scrn.X = xpos;
	scrn.Y = ypos;
	SetConsoleCursorPosition(hOuput, scrn);
}
ConsoleUI::~ConsoleUI()
{
}


text:
/**
 *
 */
package br.com.dlp.jazzomr.omr;

/**
 * Posicoes padrao para as particulas de referencia
 * @author darcio
 *
 */
public enum EParticlePosition {

	TOP_LEFT, TOP_RIGHT, BOTTOM_RIGHT, BOTTOM_LEFT

}


text:
namespace MovieLib.Windows
{
    partial class MainForm
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose( bool disposing )
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.components = new System.ComponentModel.Container();
            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
            this.menuStrip = new System.Windows.Forms.MenuStrip();
            this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.quitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.movieToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.addToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.editToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.deleteToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.helpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this._movieGrid = new System.Windows.Forms.DataGridView();
            this._bindSrc = new System.Windows.Forms.BindingSource(this.components);
            this.titleDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.descriptionDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.lengthDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.isOwnedDataGridViewCheckBoxColumn = new System.Windows.Forms.DataGridViewCheckBoxColumn();
            this.idDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
            this.menuStrip.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this._movieGrid)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this._bindSrc)).BeginInit();
            this.SuspendLayout();
            //
            // menuStrip
            //
            this.menuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
            this.fileToolStripMenuItem,
            this.movieToolStripMenuItem,
            this.helpToolStripMenuItem});
            this.menuStrip.Location = new System.Drawing.Point(0, 0);
            this.menuStrip.Name = "menuStrip";
            this.menuStrip.Size = new System.Drawing.Size(684, 24);
            this.menuStrip.TabIndex = 0;
            this.menuStrip.Text = "menuStrip1";
            //
            // fileToolStripMenuItem
            //
            this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
            this.quitToolStripMenuItem});
            this.fileToolStripMenuItem.Name = "fileToolStripMenuItem";
            this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20);
            this.fileToolStripMenuItem.Text = "File";
            //
            // quitToolStripMenuItem
            //
            this.quitToolStripMenuItem.Name = "quitToolStripMenuItem";
            this.quitToolStripMenuItem.Size = new System.Drawing.Size(92, 22);
            this.quitToolStripMenuItem.Text = "Exit";
            this.quitToolStripMenuItem.Click += new System.EventHandler(this.OnFileExit);
            //
            // movieToolStripMenuItem
            //
            this.movieToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
            this.addToolStripMenuItem,
            this.editToolStripMenuItem,
            this.deleteToolStripMenuItem});
            this.movieToolStripMenuItem.Name = "movieToolStripMenuItem";
            this.movieToolStripMenuItem.Size = new System.Drawing.Size(52, 20);
            this.movieToolStripMenuItem.Text = "Movie";
            //
            // addToolStripMenuItem
            //
            this.addToolStripMenuItem.Name = "addToolStripMenuItem";
            this.addToolStripMenuItem.Size = new System.Drawing.Size(107, 22);
            this.addToolStripMenuItem.Text = "Add";
            this.addToolStripMenuItem.Click += new System.EventHandler(this.OnAdd);
            //
            // editToolStripMenuItem
            //
            this.editToolStripMenuItem.Name = "editToolStripMenuItem";
            this.editToolStripMenuItem.Size = new System.Drawing.Size(107, 22);
            this.editToolStripMenuItem.Text = "Edit";
            this.editToolStripMenuItem.Click += new System.EventHandler(this.OnEdit);
            //
            // deleteToolStripMenuItem
            //
            this.deleteToolStripMenuItem.Name = "deleteToolStripMenuItem";
            this.deleteToolStripMenuItem.Size = new System.Drawing.Size(107, 22);
            this.deleteToolStripMenuItem.Text = "Delete";
            this.deleteToolStripMenuItem.Click += new System.EventHandler(this.OnDelete);
            //
            // helpToolStripMenuItem
            //
            this.helpToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
            this.aboutToolStripMenuItem});
            this.helpToolStripMenuItem.Name = "helpToolStripMenuItem";
            this.helpToolStripMenuItem.Size = new System.Drawing.Size(44, 20);
            this.helpToolStripMenuItem.Text = "Help";
            //
            // aboutToolStripMenuItem
            //
            this.aboutToolStripMenuItem.Name = "aboutToolStripMenuItem";
            this.aboutToolStripMenuItem.Size = new System.Drawing.Size(107, 22);
            this.aboutToolStripMenuItem.Text = "About";
            this.aboutToolStripMenuItem.Click += new System.EventHandler(this.OnHelpAbout);
            //
            // _movieGrid
            //
            this._movieGrid.AllowUserToAddRows = false;
            this._movieGrid.AllowUserToDeleteRows = false;
            this._movieGrid.AllowUserToResizeRows = false;
            dataGridViewCellStyle1.BackColor = System.Drawing.Color.LightGray;
            dataGridViewCellStyle1.ForeColor = System.Drawing.Color.Black;
            dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.MenuHighlight;
            dataGridViewCellStyle1.SelectionForeColor = System.Drawing.Color.White;
            this._movieGrid.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1;
            this._movieGrid.AutoGenerateColumns = false;
            this._movieGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
            this._movieGrid.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
            this.titleDataGridViewTextBoxColumn,
            this.descriptionDataGridViewTextBoxColumn,
            this.lengthDataGridViewTextBoxColumn,
            this.isOwnedDataGridViewCheckBoxColumn,
            this.idDataGridViewTextBoxColumn});
            this._movieGrid.DataSource = this._bindSrc;
            this._movieGrid.Dock = System.Windows.Forms.DockStyle.Fill;
            this._movieGrid.EditMode = System.Windows.Forms.DataGridViewEditMode.EditProgrammatically;
            this._movieGrid.Location = new System.Drawing.Point(0, 24);
            this._movieGrid.Name = "_movieGrid";
            this._movieGrid.RowHeadersVisible = false;
            this._movieGrid.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
            this._movieGrid.Size = new System.Drawing.Size(684, 337);
            this._movieGrid.TabIndex = 1;
            this._movieGrid.CellDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.OnRowDoubleClick);
            this._movieGrid.KeyDown += new System.Windows.Forms.KeyEventHandler(this.OnKeyDown);
            //
            // _bindSrc
            //
            this._bindSrc.DataSource = typeof(MovieLib.Movie);
            //
            // titleDataGridViewTextBoxColumn
            //
            this.titleDataGridViewTextBoxColumn.DataPropertyName = "Title";
            this.titleDataGridViewTextBoxColumn.FillWeight = 200F;
            this.titleDataGridViewTextBoxColumn.Frozen = true;
            this.titleDataGridViewTextBoxColumn.HeaderText = "Title";
            this.titleDataGridViewTextBoxColumn.MinimumWidth = 100;
            this.titleDataGridViewTextBoxColumn.Name = "titleDataGridViewTextBoxColumn";
            this.titleDataGridViewTextBoxColumn.Width = 200;
            //
            // descriptionDataGridViewTextBoxColumn
            //
            this.descriptionDataGridViewTextBoxColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
            this.descriptionDataGridViewTextBoxColumn.DataPropertyName = "Description";
            this.descriptionDataGridViewTextBoxColumn.FillWeight = 200F;
            this.descriptionDataGridViewTextBoxColumn.HeaderText = "Description";
            this.descriptionDataGridViewTextBoxColumn.MinimumWidth = 100;
            this.descriptionDataGridViewTextBoxColumn.Name = "descriptionDataGridViewTextBoxColumn";
            //
            // lengthDataGridViewTextBoxColumn
            //
            this.lengthDataGridViewTextBoxColumn.DataPropertyName = "Length";
            this.lengthDataGridViewTextBoxColumn.FillWeight = 200F;
            this.lengthDataGridViewTextBoxColumn.HeaderText = "Length";
            this.lengthDataGridViewTextBoxColumn.MinimumWidth = 50;
            this.lengthDataGridViewTextBoxColumn.Name = "lengthDataGridViewTextBoxColumn";
            this.lengthDataGridViewTextBoxColumn.Width = 150;
            //
            // isOwnedDataGridViewCheckBoxColumn
            //
            this.isOwnedDataGridViewCheckBoxColumn.DataPropertyName = "IsOwned";
            this.isOwnedDataGridViewCheckBoxColumn.FillWeight = 50F;
            this.isOwnedDataGridViewCheckBoxColumn.HeaderText = "Is Owned";
            this.isOwnedDataGridViewCheckBoxColumn.MinimumWidth = 50;
            this.isOwnedDataGridViewCheckBoxColumn.Name = "isOwnedDataGridViewCheckBoxColumn";
            this.isOwnedDataGridViewCheckBoxColumn.Resizable = System.Windows.Forms.DataGridViewTriState.False;
            this.isOwnedDataGridViewCheckBoxColumn.Width = 50;
            //
            // idDataGridViewTextBoxColumn
            //
            this.idDataGridViewTextBoxColumn.DataPropertyName = "Id";
            this.idDataGridViewTextBoxColumn.FillWeight = 10F;
            this.idDataGridViewTextBoxColumn.HeaderText = "Id";
            this.idDataGridViewTextBoxColumn.Name = "idDataGridViewTextBoxColumn";
            this.idDataGridViewTextBoxColumn.Visible = false;
            this.idDataGridViewTextBoxColumn.Width = 5;
            //
            // MainForm
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(684, 361);
            this.Controls.Add(this._movieGrid);
            this.Controls.Add(this.menuStrip);
            this.MainMenuStrip = this.menuStrip;
            this.Name = "MainForm";
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
            this.Text = "Movie Library";
            this.Load += new System.EventHandler(this.MainForm_Load);
            this.menuStrip.ResumeLayout(false);
            this.menuStrip.PerformLayout();
            ((System.ComponentModel.ISupportInitialize)(this._movieGrid)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this._bindSrc)).EndInit();
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.MenuStrip menuStrip;
        private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem;
        private System.Windows.Forms.ToolStripMenuItem quitToolStripMenuItem;
        private System.Windows.Forms.ToolStripMenuItem movieToolStripMenuItem;
        private System.Windows.Forms.ToolStripMenuItem addToolStripMenuItem;
        private System.Windows.Forms.ToolStripMenuItem editToolStripMenuItem;
        private System.Windows.Forms.ToolStripMenuItem deleteToolStripMenuItem;
        private System.Windows.Forms.ToolStripMenuItem helpToolStripMenuItem;
        private System.Windows.Forms.ToolStripMenuItem aboutToolStripMenuItem;
        private System.Windows.Forms.DataGridView _movieGrid;
        private System.Windows.Forms.BindingSource _bindSrc;
        private System.Windows.Forms.DataGridViewTextBoxColumn titleDataGridViewTextBoxColumn;
        private System.Windows.Forms.DataGridViewTextBoxColumn descriptionDataGridViewTextBoxColumn;
        private System.Windows.Forms.DataGridViewTextBoxColumn lengthDataGridViewTextBoxColumn;
        private System.Windows.Forms.DataGridViewCheckBoxColumn isOwnedDataGridViewCheckBoxColumn;
        private System.Windows.Forms.DataGridViewTextBoxColumn idDataGridViewTextBoxColumn;
    }
}


text:
<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">

    <title>PHPXRef 0.7.1 : Unnamed Project : Variable Reference: $2</title>
    <link rel="stylesheet" href="../sample.css" type="text/css">
    <link rel="stylesheet" href="../sample-print.css" type="text/css" media="print">

    <meta http-equiv="content-type" content="text/html;charset=iso-8859-1">

            [ Index ]

PHP Cross Reference of Unnamed Project

[ Show Explorer ]
[ Hide Navbar ]

[Top level directory]

title

Body

[close]

Variable Cross Reference

$2

Defined at:

/bonfire/helpers/markdown_helper.php  ->  line 920

/bonfire/helpers/markdown_helper.php  ->  line 2252

Referenced 54 times:

/public/assets/js/modernizr-2.5.3.js  ->  line 1258

/public/themes/admin/js/jquery-1.7.2.js  ->  line 5944

/public/themes/admin/js/jquery-1.7.2.js  ->  line 6391

/public/themes/admin/js/jquery-1.7.2.js  ->  line 7997

/bonfire/helpers/markdown_helper.php  ->  line 360

/bonfire/helpers/markdown_helper.php  ->  line 472

/bonfire/helpers/markdown_helper.php  ->  line 493

/bonfire/helpers/markdown_helper.php  ->  line 512

/bonfire/helpers/markdown_helper.php  ->  line 685

/bonfire/helpers/markdown_helper.php  ->  line 704

/bonfire/helpers/markdown_helper.php  ->  line 733

/bonfire/helpers/markdown_helper.php  ->  line 807

/bonfire/helpers/markdown_helper.php  ->  line 828

/bonfire/helpers/markdown_helper.php  ->  line 920

/bonfire/helpers/markdown_helper.php  ->  line 965

/bonfire/helpers/markdown_helper.php  ->  line 1064

/bonfire/helpers/markdown_helper.php  ->  line 1851

/bonfire/helpers/markdown_helper.php  ->  line 2059

/bonfire/helpers/markdown_helper.php  ->  line 2069

/bonfire/helpers/markdown_helper.php  ->  line 2237

/bonfire/helpers/markdown_helper.php  ->  line 2252

/bonfire/helpers/markdown_helper.php  ->  line 2304

/bonfire/helpers/markdown_helper.php  ->  line 2331

/bonfire/helpers/markdown_helper.php  ->  line 2422

/bonfire/helpers/markdown_helper.php  ->  line 2494

/bonfire/helpers/markdown_helper.php  ->  line 2657

/bonfire/helpers/markdown_helper.php  ->  line 2795

/public/themes/admin/js/modernizr-2.5.3.js  ->  line 1258

/bonfire/libraries/CSSMin.php  ->  line 2770

/bonfire/libraries/CSSMin.php  ->  line 3550

/bonfire/libraries/CSSMin.php  ->  line 3640

/application/config/routes.php  ->  line 51

/application/config/routes.php  ->  line 54

/application/config/routes.php  ->  line 55

/application/config/routes.php  ->  line 56

/application/config/routes.php  ->  line 57

/application/config/routes.php  ->  line 58

/public/themes/admin/js/jquery-1.7.2.min.js  ->  line 4

/public/themes/admin/js/jquery-1.7.2.min.js  ->  line 4

/public/themes/admin/js/jquery-1.7.2.min.js  ->  line 4

/tests/simpletest/extensions/testdox.php  ->  line 41

/tests/simpletest/extensions/testdox.php  ->  line 42

/public/assets/js/jquery-1.7.2.js  ->  line 5944

/public/assets/js/jquery-1.7.2.js  ->  line 6391

/public/assets/js/jquery-1.7.2.js  ->  line 7997

/bonfire/codeigniter/libraries/Typography.php  ->  line 177

/bonfire/codeigniter/libraries/Typography.php  ->  line 207

/bonfire/codeigniter/libraries/Typography.php  ->  line 292

/application/libraries/Lex/Parser.php  ->  line 281

/application/libraries/Lex/Parser.php  ->  line 722

/public/assets/js/jquery-1.7.2.min.js  ->  line 4

/public/assets/js/jquery-1.7.2.min.js  ->  line 4

/public/assets/js/jquery-1.7.2.min.js  ->  line 4

/bonfire/codeigniter/core/Security.php  ->  line 641

Generated: Thu Oct 23 18:57:41 2014
	Cross-referenced by PHPXref 0.7.1


text:
ConvertFrom-StringData @'
    XenDesktopSDKNotFoundError = Citrix XenDesktop 7.x Powershell SDK/Snap-in was not found.
    CreatingXDSite = Creating Citrix XenDesktop 7.x Site '{0}'.
    InvokingScriptBlock = Invoking script block.
    ResourceInDesiredState = Citrix XenDesktop 7.x Site '{0}' is in the desired state.
    ResourceNotInDesiredState = Citrix XenDesktop 7.x Site '{0}' is NOT in the desired state.
    InvokingScriptBlockWithParams = Invoking script block with parameters: '{0}'.
'@


text:
# Copyright (c) 2016 The Caroline authors. All rights reserved.
# Use of this source file is governed by a MIT license that can be found in the
# LICENSE file.
# Author: Glazachev Vladimir <glazachev.vladimir@gmail.com>

#ifndef INTERVAL_H
#define INTERVAL_H

#include "precision.h"
#include "value.h"

#include "flint/arb.h"

#include <iostream>

/*
    This file contains  C++ wrapper of Arb library arb_t type for arbitary
    precision real interval representation.
    Now implemented only arithmetical and comparision operations.
*/

namespace interval {

// Class to work with interval values.
class ArbInterval {
public:

    // Constructors.
    ArbInterval() {
        arb_init(data_);
        arb_zero(data_);
    }

    ArbInterval(double value, double rad)
    : ArbInterval() {
        arb_set_d(data_, value);
        mag_set_d(arb_radref(data_), rad);
    }

    ArbInterval(double value)
    : ArbInterval() {
        arb_set_d(data_, value);
    }

    ArbInterval(const ArbInterval& other)
    : ArbInterval() {
        arb_set(data_, other.data_);
    }

    ArbInterval(const Value& value)
    : ArbInterval() {
        arb_set_arf(data_, value.data_);
    }

    ArbInterval(const Value& value, const Value& rad)
    : ArbInterval() {
        arb_set_arf(data_, value.data_);
        arf_get_mag(arb_radref(data_), rad.data_);
    }

    // Destructor.
    ~ArbInterval() {
        arb_clear(data_);
    }

    // Swap and assignment.
    void swap(ArbInterval& other) {
        arb_swap(data_, other.data_);
    }

    ArbInterval& operator=(const ArbInterval& other) {
        ArbInterval temp(other);
        swap(temp);

        return *this;
    }

    // Arithmetical operations.
    ArbInterval& operator+=(const ArbInterval& x) {
        arb_add(data_, data_, x.data_, getPrecision());
        return *this;
    }

    ArbInterval& operator-=(const ArbInterval& x) {
        arb_sub(data_, data_, x.data_, getPrecision());
        return *this;
    }

    ArbInterval& operator*=(const ArbInterval& x) {
        arb_mul(data_, data_, x.data_, getPrecision());
        return *this;
    }
    ArbInterval& operator*=(int x) {
        slong s = x;
        arb_mul_si(data_, data_, x, getPrecision());

    }

    ArbInterval& operator/=(const ArbInterval& x) {
        arb_div(data_, data_, x.data_, getPrecision());
        return *this;
    }

    // Sets the interval to its negation.
    void neg() {
        arb_neg(data_, data_);
    }

    // Returns value value.
    Value val() const {
        Value temp;
        arf_set(temp.data_, arb_midref(data_));

        return temp;
    }

    // Returns error value.
    Value error() const {
        Value temp;
        arf_set_mag(temp.data_, arb_radref(data_));

        return temp;
    }

    // Returns right bound of absolute value of the interval.
    Value abs_ubound() const {
        Value temp;
        arb_get_abs_ubound_arf(temp.data_, data_, getPrecision());

        return temp;
    }

    // Returns left bound of absolute value of the interval.
    Value abs_lbound() const {
        Value temp;
        arb_get_abs_lbound_arf(temp.data_, data_, getPrecision());

        return temp;
    }

    // Sets the interval to zero.
    void zero() {
        arb_zero(data_);
    }

    // Sets the interval to its absolute value.
    void abs() {
        arb_abs(data_, data_);
    }

    // Returns data_ value. Need to refactor this.
    arb_t& data() { return data_; }

    // Comparision functions.
    bool eq(const ArbInterval& x) const { return (arb_eq(data_, x.data_)); }
    bool ne(const ArbInterval& x) const { return (arb_ne(data_, x.data_)); }
    bool lt(const ArbInterval& x) const { return (arb_lt(data_, x.data_)); }
    bool le(const ArbInterval& x) const { return (arb_le(data_, x.data_)); }
    bool gt(const ArbInterval& x) const { return (arb_gt(data_, x.data_)); }
    bool ge(const ArbInterval& x) const { return (arb_ge(data_, x.data_)); }

    // Returns true if contains zero; otherwise returns false.
    bool contains_zero() const { return arb_contains_zero(data_); }

    // Output functions.
    friend std::ostream& operator<<(std::ostream& os, const ArbInterval& x);
    void print() {
        arb_print(data_);
    }

private:
    arb_t data_;
};

// Comparision functions.
inline bool operator==(const ArbInterval& x, const ArbInterval& y) {
    return x.eq(y);
}

inline bool operator!=(const ArbInterval& x, const ArbInterval& y) {
    return x.ne(y);
}

inline bool operator<(const ArbInterval& x, const ArbInterval& y) {
    return x.lt(y);
}

inline bool operator<=(const ArbInterval& x, const ArbInterval& y) {
    return x.le(y);
}

inline bool operator>(const ArbInterval& x, const ArbInterval& y) {
    return x.gt(y);
}

inline bool operator>=(const ArbInterval& x, const ArbInterval& y) {
    return x.ge(y);
}

// Arithmetic operations.
inline ArbInterval operator+(ArbInterval x, const ArbInterval& y) {
    x += y;
    return x;
}

inline ArbInterval operator-(ArbInterval x, const ArbInterval& y) {
    x -= y;
    return x;
}

inline ArbInterval operator*(ArbInterval x, const ArbInterval& y) {
    x *= y;
    return x;
}

inline ArbInterval operator/(ArbInterval x, const ArbInterval& y) {
    x /= y;
    return x;
}

inline ArbInterval operator-(ArbInterval x) {
    x.neg();
    return x;
}

// To stream.
std::ostream& operator<<(std::ostream& os, const ArbInterval& x) {
    os << arb_get_str(x.data_, 10, ARB_STR_MORE);
    return os;
}

// Outer swap function.
void swap(ArbInterval& x, ArbInterval& y) {
    x.swap(y);
}

}  // interval

#endif  // INTERVAL_H


text:
const testDBConnection = function testDBConnection() {
  const MongoClient = require('mongodb').MongoClient,
        assert = require('assert'),
        // Connection URL
        url = 'mongodb://localhost:27017/app',
        message = "Connected successfully to MongoDB server.";
  // Use connect method to connect to the server
  MongoClient.connect(url, function(err, db){
     assert.equal(null, err);
     db.close();
  });
  return message
};

module.exports = testDBConnection


text:
require "djikstra/version"
require "djikstra/parser"
require "djikstra/edge"
require "djikstra/node"
require "djikstra/graph"
require 'pry'

module Djikstra
  class CLI

    def run
      if ARGV.size < 3
        puts "Missing command line arguments\n$ djikstra {graph_filename} {start} {end}"
      else
        find_shortest_path(*ARGV)
      end
    end

    def find_shortest_path(file_name, from_node, to_node)
      edge_text = File.read(file_name)
      from_node = from_node
      to_node = to_node

      graph = Djikstra::Graph.build(edge_text)

      route = graph.shortest_route(from_node, to_node)
      distance = graph.distance(to_node)

      puts "Shortest path is [#{route.join(',')}] with total cost #{distance}"
    end

  end
end


text:
Semaphore::Semaphore(int permits) {

    SDL_sem* sem = SDL_CreateSemaphore((Uint32) permits);
    semaphore = (void*) sem;
}

Semaphore::~Semaphore() {

    SDL_sem* sem = (SDL_sem*) semaphore;
    SDL_DestroySemaphore(sem);
}

bool Semaphore::tryAcquire() {

    SDL_sem* sem = (SDL_sem*) semaphore;
    int err = SDL_SemTryWait(sem);

    if (err == 0) {
        return true;
    } else if (err == -1) {
        throw "Error while acquiring semaphore lock.";
    } else {
        return false;
    }
}

void Semaphore::acquire() {

    SDL_sem* sem = (SDL_sem*) semaphore;
    int err = SDL_SemWait(sem);

    if (err != 0) {
        throw "Error while acquiring semaphore lock.";
    }
}

void Semaphore::release() {

    SDL_sem* sem = (SDL_sem*) semaphore;
    int err = SDL_SemPost(sem);

    if (err != 0) {
        throw "Error while releasing semaphore lock.";
    }
}


text:
You want to run a test or test suite that you've written for your project (or several tests or test suites).

## Solution

The `test` goal will run any tests contained in the specified target. Here's an example:

    ::bash
    $ ./pants test src/python/myproject/example:tests

For Scala and Java, test suites are defined in `junit_tests` target definitions, while Python test suites are defined in `python_tests` definitions. More on these target types can be found in [[Specify a Test Suite|pants('src/docs/common_tasks:test_suite')]].

## Discussion

When you run a test using `pants test`, the output will indicate whether the test (or set of tests) has succeeded or failed and it will also provide a URL that you can navigate to to see a full report from the test, for example:

> http://localhost:57466/run/pants_run_2016_05_22_18_12_43_104


text:
'use strict';

exports.type = 'full';

exports.active = true;

exports.description = 'minifies styles and removes unused styles based on usage data';

exports.params = {
    // ... CSSO options goes here

    // additional
    usage: {
        force: false,  // force to use usage data even if it unsafe (document contains <script> or on* attributes)
        ids: true,
        classes: true,
        tags: true
    }
};

var csso = require('csso');

/**
 * Minifies styles (<style> element + style attribute) using CSSO
 *
 * @author strarsis <strarsis@gmail.com>
 */
exports.fn = function(ast, options) {
    options = options || {};

    var minifyOptionsForStylesheet = cloneObject(options);
    var minifyOptionsForAttribute = cloneObject(options);
    var elems = findStyleElems(ast);

    minifyOptionsForStylesheet.usage = collectUsageData(ast, options);
    minifyOptionsForAttribute.usage = null;

    elems.forEach(function(elem) {
        if (elem.isElem('style')) {
            // <style> element
            var styleCss = elem.content[0].text || elem.content[0].cdata || [];
            var DATA = styleCss.indexOf('>') >= 0 || styleCss.indexOf('<') >= 0 ? 'cdata' : 'text';

            elem.content[0][DATA] = csso.minify(styleCss, minifyOptionsForStylesheet).css;
        } else {
            // style attribute
            var elemStyle = elem.attr('style').value;

            elem.attr('style').value = csso.minifyBlock(elemStyle, minifyOptionsForAttribute).css;
        }
    });

    return ast;
};

function cloneObject(obj) {
    var result = {};

    for (var key in obj) {
        result[key] = obj[key];
    }

    return result;
}

function findStyleElems(ast) {

    function walk(items, styles) {
        for (var i = 0; i < items.content.length; i++) {
            var item = items.content[i];

            // go deeper
            if (item.content) {
                walk(item, styles);
            }

            if (item.isElem('style') && !item.isEmpty()) {
                styles.push(item);
            } else if (item.isElem() && item.hasAttr('style')) {
                styles.push(item);
            }
        }

        return styles;
    }

    return walk(ast, []);
}

function shouldFilter(options, name) {
    if ('usage' in options === false) {
        return true;
    }

    if (options.usage && name in options.usage === false) {
        return true;
    }

    return Boolean(options.usage && options.usage[name]);
}

function collectUsageData(ast, options) {

    function walk(items, usageData) {
        for (var i = 0; i < items.content.length; i++) {
            var item = items.content[i];

            // go deeper
            if (item.content) {
                walk(item, usageData);
            }

            if (item.isElem('script')) {
                safe = false;
            }

            if (item.isElem()) {
                usageData.tags[item.elem] = true;

                if (item.hasAttr('id')) {
                    usageData.ids[item.attr('id').value] = true;
                }

                if (item.hasAttr('class')) {
                    item.attr('class').value.replace(/^\s+|\s+$/g, '').split(/\s+/).forEach(function(className) {
                        usageData.classes[className] = true;
                    });
                }

                if (item.attrs && Object.keys(item.attrs).some(function(name) { return /^on/i.test(name); })) {
                    safe = false;
                }
            }
        }

        return usageData;
    }

    var safe = true;
    var usageData = {};
    var hasData = false;
    var rawData = walk(ast, {
        ids: Object.create(null),
        classes: Object.create(null),
        tags: Object.create(null)
    });

    if (!safe && options.usage && options.usage.force) {
        safe = true;
    }

    for (var key in rawData) {
        if (shouldFilter(options, key)) {
            usageData[key] = Object.keys(rawData[key]);
            hasData = true;
        }
    }

    return safe && hasData ? usageData : null;
}


text:
layout: post
unique_id: chili
title: Chili
categories: []
locations:
---

YESTERDAY:
* asian box for lunch
  * pretty filling!
* work in afternoon
* made chili!
* guitar recording
* bachata practice
* watched greatest showman

TODAY:
* got to work early

LEARNINGS:
* _.get does not do what it does


text:
//v2.2 copyright Comine.com 20160701F0736
#ifndef MCommandArg_h
#define MCommandArg_h

///////////////////////////////////////////////////////
class MCommandArg
	{
	int mArg;											// Total Number of argum
	char **mArgv;										// Argument List
	char *mBlock;										// Block of memory for all args
	int mStartIndex;									// starting index
	bool mUnitTestOutput;								// unit test output

	////////////////////////////////////////////////
	void ClearObject(void);

	////////////////////////////////////////////////
	public:
	MCommandArg(void);
	MCommandArg(int arg,const char *argv[]);	// AutoCreate
	MCommandArg(int arg,char **argv);
	MCommandArg(const char *arguments);
	~MCommandArg(void);
	bool Create(int arg,const char *argv[]);
	bool Create(int arg,char **argv);
	bool Create(const char *arguments);
	bool Destroy(void);
	bool CheckArgHelp(void);
	bool CheckRemoveHelp(void);							// Check If Help Is Called
	bool RemoveArg(int index);
	int GetArgCount(void);
	const char *GetArg(int index);
	bool IsArgument(const char *argvalue,bool casesensitive=false);
	bool RemoveArg(const char *argvalue,bool casesensitive=false);
	bool CheckRemoveArg(const char *argvalue,bool casesense=false);
	bool GetNameValue(const char *name,const char *&value
			,int &index,bool casesense=false);//name="-size="
	bool Show(void);									// Show all the arguments
	};

#endif // MCommandArg_h