text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;

namespace DataLayer
{
    public class ParameterFactory
    {
        private static DataAccess _dataAccess = new DataAccess();
        public static SqlParameter[] MakeParameters(string SPName,params object[] values)
        {
            List<string> lstPramName = _dataAccess.GetParameter(SPName);
            List<SqlParameter> lst = new List<SqlParameter>();
            if (lstPramName.Count != values.Length)
                throw new Exception("Giá trị truyền không đúng số lượng Parameter");
            for (int i = 0; i < lstPramName.Count;i++ )
            {
                lst.Add(new SqlParameter(lstPramName[i],values[i]));
            }
            return lst.ToArray();
        }
    }
}


text:
namespace Okonau.Persistence {
    using System.IO;
    using FluentNHibernate.Cfg;
    using FluentNHibernate.Cfg.Db;
    using NHibernate;
    using NHibernate.ByteCode.Castle;
    using NHibernate.Cfg;
    using NHibernate.Tool.hbm2ddl;

    /// <summary>
    /// Default implementation of <see cref="IOkonauPersistence"/>.
    /// </summary>
    public class OkonauPersistence : IOkonauPersistence {
        private static readonly object _lock = new object();
        private static Configuration configuration;
        private static ISessionFactory sessionFactory;

        /// <summary>
        /// Default constructor.
        /// </summary>
        /// <param name="databaseResolver"></param>
        public OkonauPersistence(IDatabaseResolver databaseResolver) {
            CurrentDatabaseResolver = databaseResolver;
        }

        /// <summary>
        /// See <see cref="IOkonauPersistence.CurrentDatabaseResolver"/>.
        /// </summary>
        public IDatabaseResolver CurrentDatabaseResolver { get; private set; }

        /// <summary>
        /// Create the <see cref="Configuration"/> to use for the database.
        /// </summary>
        /// <returns></returns>
        private Configuration GetConfiguration() {
            lock (_lock) {
                if (configuration == null) {
                    lock (_lock) {
                        var filePath = CurrentDatabaseResolver.FilePath;
                        var liteConfiguration =
                            SQLiteConfiguration.Standard
                                .UsingFile(filePath)
                                .ProxyFactoryFactory(typeof(ProxyFactoryFactory));

                        configuration =
                            Fluently
                                .Configure()
                                .Database(liteConfiguration)
                                .Mappings(m => m.FluentMappings.AddFromAssemblyOf<OkonauPersistence>())
                                // Install the database if it doesn't exist
                                .ExposeConfiguration(config =>
                                {
                                    if (File.Exists(filePath)) return;

                                    SchemaExport export = new SchemaExport(config);
                                    export.Drop(false, true);
                                    export.Create(false, true);
                                })
                                .BuildConfiguration();

                        if (!configuration.Properties.ContainsKey("current_session_context_class")) {
                            configuration.Properties.Add("current_session_context_class", "managed_web");
                        }
                    }
                }

                return configuration;
            }
        }

        /// <summary>
        /// See <see cref="IOkonauPersistence.GetSessionFactory"/>.
        /// </summary>
        /// <returns></returns>
        public ISessionFactory GetSessionFactory() {
            if (sessionFactory == null) {
                var config = GetConfiguration();
                sessionFactory = config.BuildSessionFactory();
            }

            return sessionFactory;
        }

        /// <summary>
        /// See <see cref="IOkonauPersistence.OpenSession"/>.
        /// </summary>
        /// <returns></returns>
        public ISession OpenSession() {
            ISessionFactory factory = GetSessionFactory();
            return factory.OpenSession();
        }

        /// <summary>
        /// See <see cref="IOkonauPersistence.GetCurrentSession"/>.
        /// </summary>
        /// <returns></returns>
        public ISession GetCurrentSession() {
            ISessionFactory factory = GetSessionFactory();
            return factory.GetCurrentSession();
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
from django import forms
from django.utils.translation import ugettext_lazy as _

# lfs imports
from lfs.tax.models import Tax
from lfs.voucher.models import VoucherGroup
from lfs.voucher.models import VoucherOptions
from lfs.voucher.settings import KIND_OF_CHOICES

# Forms
class VoucherOptionsForm(forms.ModelForm):
    """Form to manage voucher options.
    """
    class Meta:
        model = VoucherOptions

class VoucherGroupAddForm(forms.ModelForm):
    """Form to add a VoucherGroup.
    """
    class Meta:
        model = VoucherGroup
        fields = ("name",)

class VoucherGroupForm(forms.ModelForm):
    """Form to add a VoucherGroup.
    """
    class Meta:
        model = VoucherGroup
        fields = ("name", "position")

class VoucherForm(forms.Form):
    """Form to add a Voucher.
    """
    amount = forms.IntegerField(label=_(u"Amount"), required=True)
    value = forms.FloatField(label=_(u"Value"), required=True)
    start_date = forms.DateField(label=_(u"Start date"), required=True)
    end_date = forms.DateField(label=_(u"End date"), required=True)
    kind_of = forms.ChoiceField(label=_(u"Kind of"), choices=KIND_OF_CHOICES, required=True)
    effective_from = forms.FloatField(label=_(u"Effective from"), required=True)
    tax = forms.ChoiceField(label=_(u"Tax"), required=False)
    limit = forms.IntegerField(label=_(u"Limit"), initial=1, required=True)

    def __init__(self, *args, **kwargs):
        super(VoucherForm, self).__init__(*args, **kwargs)

        taxes = [["", "---"]]
        taxes.extend([(t.id, t.rate) for t in Tax.objects.all()])
        self.fields["tax"].choices = taxes
        self.fields["start_date"].widget.attrs = {'class': 'date-picker'}
        self.fields["end_date"].widget.attrs = {'class': 'date-picker'}


text:
"use strict";
var Promise = require('bluebird');
var parser_1 = require('./chrome/parser');
var actions_1 = require('./actions');
exports.inWebpage = chrome.panels === undefined && chrome.tabs === undefined && chrome.devtools === undefined;
var connection = null;
function connectBackground(store) {
    connection = chrome.runtime.connect({
        name: 'woerterbuch-panel'
    });
    connection.postMessage({
        type: 'initialize',
        id: chrome.devtools.inspectedWindow.tabId
    });
    connection.onMessage.addListener(function (reply) {
        if (reply.type === 'relay') {
            store.dispatch(actions_1.lookup(reply.result));
        }
    });
}
exports.connectBackground = connectBackground;
function fetch(word) {
    if (exports.inWebpage) {
        return new Promise(function (resolve, reject) {
            var xhr = new XMLHttpRequest();
            xhr.open('GET', "http://localhost:4000/search/" + word);
            xhr.addEventListener('load', function (e) {
                if (xhr.status === 200) {
                    resolve(xhr.responseText);
                }
                else {
                    reject(new Error(xhr.statusText));
                }
            });
            xhr.addEventListener('error', function (e) {
                reject(new Error("Network Error"));
            });
            xhr.send();
        });
    }
    else {
        return new Promise(function (resolve, reject) {
            if (connection) {
                var listenOnce_1 = function (reply) {
                    switch (reply.type) {
                        case 'success':
                            resolve(reply.result);
                            connection.onMessage.removeListener(listenOnce_1);
                            break;
                        case 'failure':
                            var error = new Error(reply.error.name);
                            reject(error);
                            connection.onMessage.removeListener(listenOnce_1);
                            break;
                    }
                };
                connection.onMessage.addListener(listenOnce_1);
                connection.postMessage({
                    type: 'lookup',
                    payload: word
                });
            }
            else {
                reject(new Error("Not connected with the background yet"));
            }
        });
    }
}
exports.fetch = fetch;
function fetchEntry(word) {
    return fetch(word).then(function (res) { return parser_1.default(res); });
}
exports.fetchEntry = fetchEntry;
//# sourceMappingURL=util.js.map


text:
package de.tudarmstadt.ukp.clarin.webanno.automation.project;

import java.io.IOException;
import java.io.Serializable;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import org.apache.commons.lang.exception.ExceptionUtils;
import org.apache.uima.UIMAException;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.extensions.ajax.markup.html.IndicatingAjaxButton;
import org.apache.wicket.extensions.ajax.markup.html.tabs.AjaxTabbedPanel;
import org.apache.wicket.extensions.markup.html.tabs.AbstractTab;
import org.apache.wicket.extensions.markup.html.tabs.ITab;
import org.apache.wicket.markup.html.form.Button;
import org.apache.wicket.markup.html.form.CheckBox;
import org.apache.wicket.markup.html.form.ChoiceRenderer;
import org.apache.wicket.markup.html.form.DropDownChoice;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.form.ListChoice;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.CompoundPropertyModel;
import org.apache.wicket.model.LoadableDetachableModel;
import org.apache.wicket.model.Model;
import org.apache.wicket.model.ResourceModel;
import org.apache.wicket.spring.injection.annot.SpringBean;

import de.tudarmstadt.ukp.clarin.webanno.api.AnnotationService;
import de.tudarmstadt.ukp.clarin.webanno.api.RepositoryService;
import de.tudarmstadt.ukp.clarin.webanno.api.UserDao;
import de.tudarmstadt.ukp.clarin.webanno.api.WebAnnoConst;
import de.tudarmstadt.ukp.clarin.webanno.automation.AutomationService;
import de.tudarmstadt.ukp.clarin.webanno.automation.util.AutomationException;
import de.tudarmstadt.ukp.clarin.webanno.automation.util.AutomationUtil;
import de.tudarmstadt.ukp.clarin.webanno.automation.util.TabSepDocModel;
import de.tudarmstadt.ukp.clarin.webanno.brat.controller.BratAnnotationException;
import de.tudarmstadt.ukp.clarin.webanno.model.AnnotationFeature;
import de.tudarmstadt.ukp.clarin.webanno.model.AutomationStatus;
import de.tudarmstadt.ukp.clarin.webanno.model.MiraTemplate;
import de.tudarmstadt.ukp.clarin.webanno.model.Project;
import de.tudarmstadt.ukp.clarin.webanno.model.SourceDocument;
import de.tudarmstadt.ukp.clarin.webanno.model.SourceDocumentState;
import de.tudarmstadt.ukp.clarin.webanno.model.Status;
import de.tudarmstadt.ukp.clarin.webanno.support.EntityModel;
import de.tudarmstadt.ukp.dkpro.core.api.segmentation.type.Lemma;
import de.tudarmstadt.ukp.dkpro.core.api.segmentation.type.Token;

/**
 * A Panel used to define automation properties for the {@code MIRA} machine learning algorithm
 *
 * @author Seid Muhie Yimam
 *
 */
public class ProjectMiraTemplatePanel
    extends Panel
{
    private static final long serialVersionUID = 2116717853865353733L;

    @SpringBean(name = "annotationService")
    private AnnotationService annotationService;

    @SpringBean(name = "automationService")
    private AutomationService automationService;

    @SpringBean(name = "documentRepository")
    private RepositoryService repository;

    @SpringBean(name = "userRepository")
    private UserDao userRepository;

    private MiraTrainLayerSelectionForm miraTrainLayerSelectionForm;
    private MiraTemplateDetailForm miraTemplateDetailForm;
    private OtherLayerDeatilForm otherLayerDetailForm;
    private ProjectTrainingDocumentsPanel targetLayerTarinDocumentsPanel;
    private ProjectTrainingDocumentsPanel otherLayerTarinDocumentsPanel;
    private ProjectTrainingDocumentsPanel freeTrainDocumentsPanel;
    private TargetLaerDetailForm targetLayerDetailForm;

    private final Model<Project> selectedProjectModel;

    private Model<AnnotationFeature> featureModel = new Model<AnnotationFeature>();

    private AnnotationFeature selectedFeature;
    private AnnotationFeature otherSelectedFeature = new AnnotationFeature();
    private MiraTemplate template = new MiraTemplate();

    @SuppressWarnings("unused")
    private final ApplyForm applyForm;
    private DropDownChoice<AnnotationFeature> features;
    private DropDownChoice<AnnotationFeature> otherFeatures;

    public ProjectMiraTemplatePanel(String id, final Model<Project> aProjectModel)
    {
        super(id);
        this.selectedProjectModel = aProjectModel;
        System.out.println(repository.getDir());
        for (MiraTemplate template : automationService.listMiraTemplates(selectedProjectModel.getObject())) {
            if (template.isCurrentLayer()) {
                this.template = template;
                selectedFeature = template.getTrainFeature();
                break;
            }
        }
        featureModel.setObject(selectedFeature);
        miraTrainLayerSelectionForm = new MiraTrainLayerSelectionForm("miraTrainLayerSelectionForm");
        add(miraTrainLayerSelectionForm);

        updateForm();

        add(applyForm = new ApplyForm("applyForm")
        {
            private static final long serialVersionUID = 3866085992209480718L;

            @Override
            protected void onConfigure()
            {
                super.onConfigure();
                if (template.getId() == 0) {
                    this.setVisible(false);
                }
                else {
                    this.setVisible(true);
                }
            }
        });

    }

    private void updateForm()
    {
        if (targetLayerDetailForm != null) {
            targetLayerDetailForm.remove();
        }
        targetLayerDetailForm = new TargetLaerDetailForm("targetLayerDetailForm");
        targetLayerDetailForm.setOutputMarkupPlaceholderTag(true);
        add(targetLayerDetailForm);
    }

    private class MiraTrainLayerSelectionForm
        extends Form<SelectionModel>
    {
        private static final long serialVersionUID = -1528847861284911270L;

        public MiraTrainLayerSelectionForm(String id)
        {
            super(id, new CompoundPropertyModel<SelectionModel>(new SelectionModel()));
            final Project project = selectedProjectModel.getObject();

            add(features = new DropDownChoice<AnnotationFeature>("features")
            {
                private static final long serialVersionUID = 1L;

                {
                    setChoices(new LoadableDetachableModel<List<AnnotationFeature>>()
                    {
                        private static final long serialVersionUID = 1L;

                        @Override
                        protected List<AnnotationFeature> load()
                        {
                            List<AnnotationFeature> allFeatures = annotationService
                                    .listAnnotationFeature(project);
                            List<AnnotationFeature> spanFeatures = new ArrayList<AnnotationFeature>();

                            for (AnnotationFeature feature : allFeatures) {
                                if (!feature.getLayer().isEnabled()
                                        || feature.getLayer().getName()
                                                .equals(Token.class.getName())
                                        || feature.getLayer().getName()
                                                .equals(Lemma.class.getName())) {
                                    continue;
                                }
                                if (feature.getLayer().getType().equals(WebAnnoConst.SPAN_TYPE)) {
                                    spanFeatures.add(feature);
                                }
                            }
                            return spanFeatures;
                        }
                    });
                    setChoiceRenderer(new ChoiceRenderer<AnnotationFeature>()
                    {
                        private static final long serialVersionUID = -2000622431037285685L;

                        @Override
                        public Object getDisplayValue(AnnotationFeature aObject)
                        {
                            return "[ "
                                    + aObject.getLayer().getUiName()
                                    + "] "
                                    + (aObject.getTagset() != null ? aObject.getTagset().getName()
                                            : aObject.getUiName());
                        }
                    });
                    setNullValid(false);
                }

                @Override
                public void onSelectionChanged(AnnotationFeature aNewSelection)
                {
                    selectedFeature = (AnnotationFeature) aNewSelection;
                    if (automationService.existsMiraTemplate(selectedFeature)) {
                        template = automationService.getMiraTemplate(selectedFeature);
                    }
                    else {
                        template = new MiraTemplate();
                        template.setTrainFeature((AnnotationFeature) aNewSelection);
                    }
                    featureModel.setObject(selectedFeature);
                    miraTemplateDetailForm.setModelObject(template);
                }

                @Override
                protected boolean wantOnSelectionChangedNotifications()
                {
                    return true;
                }
            }).setOutputMarkupId(true);
            features.setModelObject(selectedFeature);
        }

    }

    public class TargetLaerDetailForm
        extends Form<MiraTemplate>
    {
        private static final long serialVersionUID = -4655869081345550397L;
        @SuppressWarnings("rawtypes")
        private AjaxTabbedPanel autoTabs;

        public TargetLaerDetailForm(String id)
        {
            super(id, new CompoundPropertyModel<MiraTemplate>(new EntityModel<MiraTemplate>(
                    new MiraTemplate())));

            List<ITab> tabs = new ArrayList<ITab>();
            tabs.add(new AbstractTab(new Model<String>("Target layer"))
            {
                private static final long serialVersionUID = 6703144434578403272L;

                @Override
                public Panel getPanel(String panelId)
                {
                    return new TargetLayerPanel(panelId);
                }
            });

            tabs.add(new AbstractTab(new Model<String>("TAB-SEP target"))
            {
                private static final long serialVersionUID = 6703144434578403272L;

                @Override
                public Panel getPanel(String panelId)
                {
                    return new FreeTabSepAsTargetDocumentsPanel(panelId);
                }
            });
            tabs.add(new AbstractTab(new Model<String>("Other layers"))
            {
                private static final long serialVersionUID = 6703144434578403272L;

                @Override
                public Panel getPanel(String panelId)
                {
                    return new OtherLayerPanel(panelId);
                }
            });

            tabs.add(new AbstractTab(new Model<String>("TAB-SEP feature"))
            {
                private static final long serialVersionUID = 6703144434578403272L;

                @Override
                public Panel getPanel(String panelId)
                {
                    return new FreeTabSepAsFeatureDocumentsPanel(panelId);
                }
            });

            add(autoTabs = (AjaxTabbedPanel) new AjaxTabbedPanel<ITab>("autoTabs", tabs)
                    .setOutputMarkupPlaceholderTag(true));
        }
    }

    private class TargetLayerPanel
        extends Panel
    {
        private static final long serialVersionUID = 7336140137139501974L;

        public TargetLayerPanel(String id)
        {
            super(id);
            add(miraTemplateDetailForm = new MiraTemplateDetailForm("miraTemplateDetailForm")
            {
                private static final long serialVersionUID = 1885112841649058536L;

                @Override
                public boolean isVisible()
                {
                    return selectedFeature != null;
                }
            });
            miraTemplateDetailForm.setModelObject(template);

            add(targetLayerTarinDocumentsPanel = new ProjectTrainingDocumentsPanel(
                    "targetLayerTarinDocumentsPanel", selectedProjectModel,
                    new Model<TabSepDocModel>(new TabSepDocModel(false, false)), featureModel)
            {

                private static final long serialVersionUID = 7698999083009818310L;

                @Override
                public boolean isVisible()
                {
                    return miraTemplateDetailForm.getModelObject().getId() != 0;
                }
            });
            targetLayerTarinDocumentsPanel.setOutputMarkupPlaceholderTag(true);
        }
    }

    private class OtherLayerPanel
        extends Panel
    {
        private static final long serialVersionUID = -3649285837217362203L;

        public OtherLayerPanel(String id)
        {
            super(id);
            add(otherLayerDetailForm = new OtherLayerDeatilForm("otherLayerDetailForm")
            {
                private static final long serialVersionUID = 3192960675893574547L;

                @Override
                public boolean isVisible()
                {
                    return miraTemplateDetailForm.getModelObject().getId() != 0
                            && selectedFeature != null;
                }
            });
            SelectionModel selectedOtherModel = new SelectionModel();
            selectedOtherModel.selectedFeatures = otherSelectedFeature;
            selectedOtherModel.features = null;
            otherLayerDetailForm.setModelObject(selectedOtherModel);

            add(otherLayerTarinDocumentsPanel = new ProjectTrainingDocumentsPanel(
                    "otherLayerTarinDocumentsPanel", selectedProjectModel,
                    new Model<TabSepDocModel>(new TabSepDocModel(false, false)),
                    Model.of(otherLayerDetailForm.getModelObject().selectedFeatures))
            {
                private static final long serialVersionUID = -4663938706290521594L;

                @Override
                public boolean isVisible()
                {
                    return otherLayerDetailForm.getModelObject().selectedFeatures.getId() != 0;
                }
            });
            otherLayerTarinDocumentsPanel.setOutputMarkupPlaceholderTag(true);
        }
    }

    private class FreeTabSepAsFeatureDocumentsPanel
        extends Panel
    {
        private static final long serialVersionUID = -9173687919199803381L;

        public FreeTabSepAsFeatureDocumentsPanel(String id)
        {
            super(id);
            add(freeTrainDocumentsPanel = new ProjectTrainingDocumentsPanel(
                    "freeTabSepAsFeatureDocumentsPanel", selectedProjectModel,
                    new Model<TabSepDocModel>(new TabSepDocModel(false, true)), featureModel)
            {
                private static final long serialVersionUID = -4663938706290521594L;

                @Override
                public boolean isVisible()
                {
                    return miraTemplateDetailForm.getModelObject().getId() != 0
                            && selectedFeature != null;
                }
            });
            freeTrainDocumentsPanel.setOutputMarkupPlaceholderTag(true);
        }
    }

    private class FreeTabSepAsTargetDocumentsPanel
        extends Panel
    {
        private static final long serialVersionUID = -9173687919199803381L;

        public FreeTabSepAsTargetDocumentsPanel(String id)
        {
            super(id);
            add(freeTrainDocumentsPanel = new ProjectTrainingDocumentsPanel(
                    "freeTabSepAsTargetDocumentsPanel", selectedProjectModel,
                    new Model<TabSepDocModel>(new TabSepDocModel(true, true)), featureModel)
            {
                private static final long serialVersionUID = -4663938706290521594L;

                @Override
                public boolean isVisible()
                {
                    return miraTemplateDetailForm.getModelObject().getId() != 0
                            && selectedFeature != null;
                }
            });
            freeTrainDocumentsPanel.setOutputMarkupPlaceholderTag(true);
        }
    }

    private class MiraTemplateDetailForm
        extends Form<MiraTemplate>
    {
        private static final long serialVersionUID = -683824912741426241L;

        public MiraTemplateDetailForm(String id)
        {
            super(id, new CompoundPropertyModel<MiraTemplate>(new EntityModel<MiraTemplate>(
                    new MiraTemplate())));

            add(new CheckBox("annotateAndPredict"));

            add(new Button("save", new ResourceModel("label"))
            {
                private static final long serialVersionUID = 1L;

                @Override
                public void onSubmit()
                {
                    template = MiraTemplateDetailForm.this.getModelObject();
                    if (template.getId() == 0) {

                        // Since the layer is changed, new classifier is needed
                        for (SourceDocument sd : repository
                                .listSourceDocuments(selectedProjectModel.getObject())) {
                            sd.setProcessed(false);
                        }
                        template.setTrainFeature(selectedFeature);
                        automationService.createTemplate(template);
                        featureModel.setObject(MiraTemplateDetailForm.this.getModelObject()
                                .getTrainFeature());
                    }
                    template.setCurrentLayer(true);
                    for (MiraTemplate tmp : automationService.listMiraTemplates(selectedProjectModel
                            .getObject())) {
                        if (tmp.equals(template)) {
                            continue;
                        }
                        if (tmp.isCurrentLayer()) {
                            tmp.setCurrentLayer(false);
                        }
                    }
                    updateForm();
                }
            });
        }
    }

    /**
     * {@link AnnotationFeature} used as a feature for the current training layer
     *
     */
    private class OtherLayerDeatilForm
        extends Form<SelectionModel>
    {
        private static final long serialVersionUID = -683824912741426241L;

        public OtherLayerDeatilForm(String id)
        {
            super(id, new CompoundPropertyModel<SelectionModel>(new SelectionModel()));

            add(otherFeatures = new DropDownChoice<AnnotationFeature>("features")
            {
                private static final long serialVersionUID = -1923453084703805794L;

                {
                    setNullValid(false);
                    setChoices(new LoadableDetachableModel<List<AnnotationFeature>>()
                    {
                        private static final long serialVersionUID = -6376636005341159307L;

                        @Override
                        protected List<AnnotationFeature> load()
                        {
                            List<AnnotationFeature> features = annotationService
                                    .listAnnotationFeature(selectedProjectModel.getObject());
                            features.remove(miraTemplateDetailForm.getModelObject()
                                    .getTrainFeature());
                            features.removeAll(miraTemplateDetailForm.getModelObject()
                                    .getOtherFeatures());
                            for (AnnotationFeature feature : annotationService
                                    .listAnnotationFeature(selectedProjectModel.getObject())) {
                                if (!feature.getLayer().isEnabled()
                                        || !feature.getLayer().getType()
                                                .equals(WebAnnoConst.SPAN_TYPE)
                                        || feature.getLayer().getName()
                                                .equals(Lemma.class.getName())
                                        || feature.getLayer().getName()
                                                .equals(Token.class.getName())) {
                                    features.remove(feature);
                                }
                            }
                            return features;
                        }
                    });

                    setChoiceRenderer(new ChoiceRenderer<AnnotationFeature>()
                    {
                        private static final long serialVersionUID = 4607720784161484145L;

                        @Override
                        public Object getDisplayValue(AnnotationFeature aObject)
                        {
                            return "[ "
                                    + aObject.getLayer().getUiName()
                                    + "] "
                                    + (aObject.getTagset() != null ? aObject.getTagset().getName()
                                            : aObject.getUiName());
                        }
                    });
                }

                @Override
                protected void onSelectionChanged(AnnotationFeature aNewSelection)
                {
                    miraTemplateDetailForm.getModelObject().getOtherFeatures().add(aNewSelection);
                    automationService.createTemplate(miraTemplateDetailForm.getModelObject());
                }

                @Override
                protected boolean wantOnSelectionChangedNotifications()
                {
                    return true;
                }
            });
            otherFeatures.setModelObject(null);// always force to choose, even
                                               // after selection of
                                               // feature

            add(new ListChoice<AnnotationFeature>("selectedFeatures")
            {
                private static final long serialVersionUID = 1L;

                {
                    setChoices(new LoadableDetachableModel<List<AnnotationFeature>>()
                    {
                        private static final long serialVersionUID = 1L;

                        @Override
                        protected List<AnnotationFeature> load()
                        {
                            return new ArrayList<AnnotationFeature>(miraTemplateDetailForm
                                    .getModelObject().getOtherFeatures());
                        }
                    });

                    setChoiceRenderer(new ChoiceRenderer<AnnotationFeature>()
                    {
                        private static final long serialVersionUID = 4607720784161484145L;

                        @Override
                        public Object getDisplayValue(AnnotationFeature aObject)
                        {
                            return "[ "
                                    + aObject.getLayer().getUiName()
                                    + "] "
                                    + (aObject.getTagset() != null ? aObject.getTagset().getName()
                                            : aObject.getUiName());
                        }
                    });
                    setNullValid(false);
                }

                @Override
                protected void onSelectionChanged(AnnotationFeature aNewSelection)
                {
                    otherSelectedFeature = aNewSelection;
                    // always force to choose, even after selection of feature
                    otherFeatures.setModelObject(null);
                    updateForm();
                    targetLayerDetailForm.autoTabs.setSelectedTab(2);
                }

                @Override
                protected boolean wantOnSelectionChangedNotifications()
                {
                    return true;
                }

                @Override
                protected CharSequence getDefaultChoice(String aSelectedValue)
                {
                    return "";
                }
            });
        }
    }

    @SuppressWarnings("rawtypes")
    private class ApplyForm
        extends Form
    {
        private static final long serialVersionUID = -683824912741426241L;

        public ApplyForm(String id)
        {
            super(id);

            add(new IndicatingAjaxButton("apply", new ResourceModel("label"))
            {

                private static final long serialVersionUID = 1L;

                @Override
                protected void onSubmit(AjaxRequestTarget aTarget, Form<?> form)
                {
                    MiraTemplate template = miraTemplateDetailForm.getModelObject();
                    AutomationStatus automationStatus = new AutomationStatus();
                    try {
                        // no training document is added / no curation is done yet!
                        boolean existsTrainDocument = false;
                        for (SourceDocument document : repository
                                .listSourceDocuments(selectedProjectModel.getObject())) {
                            if (document.getState().equals(SourceDocumentState.CURATION_FINISHED)
                                    || (document.isTrainingDocument() && template.getTrainFeature()
                                            .equals(document.getFeature()))) {
                                existsTrainDocument = true;
                                break;
                            }
                        }

                        for (SourceDocument document : automationService
                                .listTabSepDocuments(selectedProjectModel.getObject())) {
                            if (document.isTrainingDocument()) {
                                existsTrainDocument = true;
                                break;
                            }
                        }
                        if (!existsTrainDocument) {
                            error("No training document exists to proceed.");
                            aTarget.appendJavaScript("alert('No training document exists to proceed.')");
                            return;
                        }
                        if (!template.isCurrentLayer()) {
                            error("Please save automation layer details to proceed.");
                            aTarget.appendJavaScript("alert('Please save automation layer details to proceed.')");
                            return;
                        }

                        // no need to re-train if no new document is added
                        boolean existUnprocessedDocument = false;
                        for (SourceDocument document : repository
                                .listSourceDocuments(selectedProjectModel.getObject())) {
                            if (!document.isProcessed()) {
                                existUnprocessedDocument = true;
                                break;
                            }
                        }
                        for (SourceDocument document : automationService
                                .listTabSepDocuments(selectedProjectModel.getObject())) {
                            if (!document.isProcessed()) {
                                existUnprocessedDocument = true;
                                break;
                            }
                        }
                        if (!existUnprocessedDocument) {
                            error("No new training/annotation document added.");
                            aTarget.appendJavaScript("alert('No new training/annotation document added.')");
                            return;
                        }

                        int annodoc = 0, trainDoc = 0;

                        for (SourceDocument document : repository
                                .listSourceDocuments(selectedProjectModel.getObject())) {
                            if ((document.isTrainingDocument() || document.getState().equals(
                                    SourceDocumentState.CURATION_FINISHED))
                                    && !document.isProcessed()) {
                                trainDoc++;
                            }
                            else if (!document.isTrainingDocument() && !document.isProcessed()) {
                                annodoc++;
                            }
                        }

                        automationStatus = automationService.existsAutomationStatus(template) ?
                                automationService.getAutomationStatus(template) : automationStatus;
                        automationStatus.setStartime(new Timestamp(new Date().getTime()));
                        automationStatus.setEndTime(new Timestamp(new Date().getTime()));
                        automationStatus.setTrainDocs(trainDoc);
                        automationStatus.setAnnoDocs(annodoc);
                        automationStatus.setTotalDocs(annodoc + trainDoc);
                        automationStatus.setTemplate(template);

                        automationService.createAutomationStatus(automationStatus);

                        template.setAutomationStarted(true);

                        automationStatus.setStatus(Status.GENERATE_TRAIN_DOC);
                        template.setResult("---");

                        AutomationUtil.addOtherFeatureTrainDocument(template, repository,
                                annotationService, automationService, userRepository);
                        AutomationUtil.otherFeatureClassifiers(template, repository,
                                automationService);

                        AutomationUtil.addTabSepTrainDocument(template, repository,
                                automationService);
                        AutomationUtil.tabSepClassifiers(template, repository, automationService);

                        AutomationUtil.generateTrainDocument(template, repository,
                                annotationService, automationService, userRepository, true);
                        AutomationUtil.generatePredictDocument(template, repository,
                                annotationService, automationService, userRepository);

                        automationStatus.setStatus(Status.GENERATE_CLASSIFIER);
                        miraTemplateDetailForm.getModelObject().setResult(
                                AutomationUtil.generateFinalClassifier(template, repository,
                                        annotationService, automationService, userRepository));
                        AutomationUtil.addOtherFeatureToPredictDocument(template, repository,
                                annotationService, automationService, userRepository);

                        automationStatus.setStatus(Status.PREDICTION);
                        AutomationUtil.predict(template, repository, automationService, userRepository);

                        template.setAutomationStarted(false);
                        automationStatus.setStatus(Status.COMPLETED);
                        automationStatus.setEndTime(new Timestamp(new Date().getTime()));
                        automationService.createTemplate(template);
                        automationService.createAutomationStatus(automationStatus);

                    }
                    catch (UIMAException e) {
                        template.setAutomationStarted(false);
                        automationStatus.setStatus(Status.INTERRUPTED);
                        automationStatus.setEndTime(new Timestamp(new Date().getTime()));
                        automationService.createTemplate(template);
                        automationService.createAutomationStatus(automationStatus);
                        aTarget.appendJavaScript("alert('" + ExceptionUtils.getRootCause(e) + "')");
                    }
                    catch (ClassNotFoundException e) {
                        template.setAutomationStarted(false);
                        automationStatus.setStatus(Status.INTERRUPTED);
                        automationStatus.setEndTime(new Timestamp(new Date().getTime()));
                        automationService.createTemplate(template);
                        automationService.createAutomationStatus(automationStatus);
                        aTarget.appendJavaScript("alert('" + e.getMessage() + "')");
                    }
                    catch (IOException e) {
                        template.setAutomationStarted(false);
                        automationStatus.setStatus(Status.INTERRUPTED);
                        automationStatus.setEndTime(new Timestamp(new Date().getTime()));
                        automationService.createTemplate(template);
                        automationService.createAutomationStatus(automationStatus);
                        aTarget.appendJavaScript("alert('" + e.getMessage() + "')");
                    }
                    catch (BratAnnotationException e) {
                        aTarget.appendJavaScript("alert('" + e.getMessage() + "')");
                    }
                    catch (AutomationException e) {
                        template.setAutomationStarted(false);
                        automationStatus.setStatus(Status.INTERRUPTED);
                        automationStatus.setEndTime(new Timestamp(new Date().getTime()));
                        automationService.createTemplate(template);
                        automationService.createAutomationStatus(automationStatus);
                        aTarget.appendJavaScript("alert('" + e.getMessage() + "')");
                    }
                    // any other exception such as Memmory heap
                    catch (Exception e) {
                        template.setAutomationStarted(false);
                        automationStatus.setStatus(Status.INTERRUPTED);
                        automationStatus.setEndTime(new Timestamp(new Date().getTime()));
                        automationService.createTemplate(template);
                        automationService.createAutomationStatus(automationStatus);
                        aTarget.appendJavaScript("alert('" + e.getMessage() + "')");
                    }
                    finally {
                        automationStatus.setStatus(Status.COMPLETED);
                        automationStatus.setEndTime(new Timestamp(new Date().getTime()));
                        template.setAutomationStarted(false);
                        automationService.createTemplate(template);
                    }
                }

                @Override
                public boolean isEnabled()
                {
                    return miraTemplateDetailForm != null
                            && !miraTemplateDetailForm.getModelObject().isAutomationStarted();
                }
            });
        }
    }

    public class SelectionModel
        implements Serializable
    {
        private static final long serialVersionUID = -4905538356691404575L;
        public AnnotationFeature features = new AnnotationFeature();
        public AnnotationFeature selectedFeatures = new AnnotationFeature();

    }
}


text:
package excx.entities;

import java.util.ArrayList;

import excx.collision.CollisionCircle;
import excx.data.SpriteSheet;
import excx.entities.boss.Boss;
import excx.entities.boss.TinyKaboom;
import excx.movement.Movement;
import excx.movement.Vector;

public abstract class Enemy extends Entity{

	public static int enemies = 0;
	private int health;

	public Enemy(double x, double y) {
		super(x, y);
		setTeam(Team.Evil);
		setCollisionType(new CollisionCircle(32));
		movement = new Movement(new Vector(0,0),null);
		setImageNode(SpriteSheet.getInstance().getSpriteNode(toString()));
	}

	@Override
	public void checkCollision(GameField world) {
		ArrayList<Sprite> copy = new ArrayList<Sprite>();
		copy.addAll(world.getEntityList());
		for(Sprite e:copy){
			if(e instanceof Bullet && (e.getTeam() == Team.Good || e.getTeam() == Team.Nature) && e != this&&isColliding((Bullet)e)){
				e.setDeletable(true);
				this.setHealth(getHealth()-1);
				if(!(this instanceof Boss)){
					setImageNode(SpriteSheet.getInstance().getSpriteNode(toString()+"_hurt"));
				}
				if(getHealth()==0){
					this.setDeletable(true);
					this.die();
				}
			}
		}
	}

	public void die(){
		getWorld().add(new TinyKaboom(getX(),getY()));
	}

	public int getHealth() {
		return health;
	}

	public void setHealth(int health) {
		this.health = health;
	}
	public String toString(){
		return "enemy";
	}
}


text:
require_relative '../bench_init'

context "Write Event" do
  stream_name = EventStore::Client::HTTP::Controls::StreamName.get 'testEventWriter'
  path = "/streams/#{stream_name}"

  writer = EventStore::Client::HTTP::EventWriter.build

  event_data = EventStore::Client::HTTP::Controls::EventData::Write.example

  writer.write event_data, stream_name

  get = EventStore::Client::HTTP::Request::Get.build
  body_text, get_response = get.("#{path}/0")

  read_data = Serialize::Read.(body_text, EventStore::Client::HTTP::EventData::Read, :json)

  __logger.data read_data.inspect

  context "Event is written" do
    test "Stream Name" do
      assert(read_data.stream_name == stream_name)
    end

    test "Stream Name" do
      assert(read_data.number == 0)
    end

    test "Data" do
      assert(read_data.data == {:some_attribute => 'some value'})
    end

    test "Metadata" do
      assert(read_data.metadata == {:some_meta_attribute => 'some meta value'})
    end
  end
end


text:
/*
 This file is part of web3.js.

 web3.js is free software: you can redistribute it and/or modify
 it under the terms of the GNU Lesser General Public License as published by
 the Free Software Foundation, either version 3 of the License, or
 (at your option) any later version.

 web3.js is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU Lesser General Public License for more details.

 You should have received a copy of the GNU Lesser General Public License
 along with web3.js.  If not, see <http://www.gnu.org/licenses/>.
 */
/**
 * @file index.js
 * @author Fabian Vogelsteller <fabian@ethereum.org>
 * @date 2017
 */

"use strict";

var _ = require('underscore');
var core = require('web3-core');
var helpers = require('web3-core-helpers');
var Subscriptions = require('web3-core-subscriptions').subscriptions;
var Method = require('web3-core-method');
var utils = require('web3-utils');
var Net = require('web3-net');

var Personal = require('web3-eth-personal');
var Contract = require('web3-eth-contract');
var Iban = require('web3-eth-iban');
var Accounts = require('web3-eth-accounts');
var abi = require('web3-eth-abi');

var getNetworkType = require('./getNetworkType.js');
var formatter = helpers.formatters;

var blockCall = function (args) {
    return (_.isString(args[0]) && args[0].indexOf('0x') === 0) ? "eth_getBlockByHash" : "eth_getBlockByNumber";
};

var transactionFromBlockCall = function (args) {
    return (_.isString(args[0]) && args[0].indexOf('0x') === 0) ? 'eth_getTransactionByBlockHashAndIndex' : 'eth_getTransactionByBlockNumberAndIndex';
};

var uncleCall = function (args) {
    return (_.isString(args[0]) && args[0].indexOf('0x') === 0) ? 'eth_getUncleByBlockHashAndIndex' : 'eth_getUncleByBlockNumberAndIndex';
};

var getBlockTransactionCountCall = function (args) {
    return (_.isString(args[0]) && args[0].indexOf('0x') === 0) ? 'eth_getBlockTransactionCountByHash' : 'eth_getBlockTransactionCountByNumber';
};

var uncleCountCall = function (args) {
    return (_.isString(args[0]) && args[0].indexOf('0x') === 0) ? 'eth_getUncleCountByBlockHash' : 'eth_getUncleCountByBlockNumber';
};

var Eth = function Eth() {
    var _this = this;

    // sets _requestmanager
    core.packageInit(this, arguments);

    // overwrite setProvider
    var setProvider = this.setProvider;
    this.setProvider = function () {
        setProvider.apply(_this, arguments);
        _this.net.setProvider.apply(_this, arguments);
        _this.personal.setProvider.apply(_this, arguments);
        _this.accounts.setProvider.apply(_this, arguments);
        _this.Contract.setProvider(_this.currentProvider, _this.accounts);
    };

    var defaultAccount = null;
    var defaultBlock = 'latest';

    Object.defineProperty(this, 'defaultAccount', {
        get: function () {
            return defaultAccount;
        },
        set: function (val) {
            if(val) {
                defaultAccount = utils.toChecksumAddress(formatter.inputAddressFormatter(val));
            }

            // also set on the Contract object
            _this.Contract.defaultAccount = defaultAccount;
            _this.personal.defaultAccount = defaultAccount;

            // update defaultBlock
            methods.forEach(function(method) {
                method.defaultAccount = defaultAccount;
            });

            return val;
        },
        enumerable: true
    });
    Object.defineProperty(this, 'defaultBlock', {
        get: function () {
            return defaultBlock;
        },
        set: function (val) {
            defaultBlock = val;
            // also set on the Contract object
            _this.Contract.defaultBlock = defaultBlock;
            _this.personal.defaultBlock = defaultBlock;

            // update defaultBlock
            methods.forEach(function(method) {
                method.defaultBlock = defaultBlock;
            });

            return val;
        },
        enumerable: true
    });

    this.clearSubscriptions = _this._requestManager.clearSubscriptions;

    // add net
    this.net = new Net(this.currentProvider);
    // add chain detection
    this.net.getNetworkType = getNetworkType.bind(this);

    // add accounts
    this.accounts = new Accounts(this.currentProvider);

    // add personal
    this.personal = new Personal(this.currentProvider);
    this.personal.defaultAccount = this.defaultAccount;

    // add contract
    this.Contract = Contract;
    this.Contract.defaultAccount = this.defaultAccount;
    this.Contract.defaultBlock = this.defaultBlock;
    this.Contract.setProvider(this.currentProvider, this.accounts);

    // add IBAN
    this.Iban = Iban;

    // add ABI
    this.abi = abi;

    var methods = [
        new Method({
            name: 'getProtocolVersion',
            call: 'eth_protocolVersion',
            params: 0
        }),
        new Method({
            name: 'getCoinbase',
            call: 'eth_coinbase',
            params: 0
        }),
        new Method({
            name: 'isMining',
            call: 'eth_mining',
            params: 0
        }),
        new Method({
            name: 'getHashrate',
            call: 'eth_hashrate',
            params: 0,
            outputFormatter: utils.hexToNumber
        }),
        new Method({
            name: 'isSyncing',
            call: 'eth_syncing',
            params: 0,
            outputFormatter: formatter.outputSyncingFormatter
        }),
        new Method({
            name: 'getGasPrice',
            call: 'eth_gasPrice',
            params: 0,
            outputFormatter: formatter.outputBigNumberFormatter
        }),
        new Method({
            name: 'getAccounts',
            call: 'eth_accounts',
            params: 0,
            outputFormatter: utils.toChecksumAddress
        }),
        new Method({
            name: 'getBlockNumber',
            call: 'eth_blockNumber',
            params: 0,
            outputFormatter: utils.hexToNumber
        }),
        new Method({
            name: 'getBalance',
            call: 'eth_getBalance',
            params: 2,
            inputFormatter: [formatter.inputAddressFormatter, formatter.inputDefaultBlockNumberFormatter],
            outputFormatter: formatter.outputBigNumberFormatter
        }),
        new Method({
            name: 'getStorageAt',
            call: 'eth_getStorageAt',
            params: 3,
            inputFormatter: [formatter.inputAddressFormatter, utils.numberToHex, formatter.inputDefaultBlockNumberFormatter]
        }),
        new Method({
            name: 'getCode',
            call: 'eth_getCode',
            params: 2,
            inputFormatter: [formatter.inputAddressFormatter, formatter.inputDefaultBlockNumberFormatter]
        }),
        new Method({
            name: 'getBlock',
            call: blockCall,
            params: 2,
            inputFormatter: [formatter.inputBlockNumberFormatter, function (val) { return !!val; }],
            outputFormatter: formatter.outputBlockFormatter
        }),
        new Method({
            name: 'getUncle',
            call: uncleCall,
            params: 2,
            inputFormatter: [formatter.inputBlockNumberFormatter, utils.numberToHex],
            outputFormatter: formatter.outputBlockFormatter,

        }),
        new Method({
            name: 'getBlockTransactionCount',
            call: getBlockTransactionCountCall,
            params: 1,
            inputFormatter: [formatter.inputBlockNumberFormatter],
            outputFormatter: utils.hexToNumber
        }),
        new Method({
            name: 'getBlockUncleCount',
            call: uncleCountCall,
            params: 1,
            inputFormatter: [formatter.inputBlockNumberFormatter],
            outputFormatter: utils.hexToNumber
        }),
        new Method({
            name: 'getTransaction',
            call: 'eth_getTransactionByHash',
            params: 1,
            inputFormatter: [null],
            outputFormatter: formatter.outputTransactionFormatter
        }),
        new Method({
            name: 'getTransactionFromBlock',
            call: transactionFromBlockCall,
            params: 2,
            inputFormatter: [formatter.inputBlockNumberFormatter, utils.numberToHex],
            outputFormatter: formatter.outputTransactionFormatter
        }),
        new Method({
            name: 'getTransactionReceipt',
            call: 'eth_getTransactionReceipt',
            params: 1,
            inputFormatter: [null],
            outputFormatter: formatter.outputTransactionReceiptFormatter
        }),
        new Method({
            name: 'getTransactionCount',
            call: 'eth_getTransactionCount',
            params: 2,
            inputFormatter: [formatter.inputAddressFormatter, formatter.inputDefaultBlockNumberFormatter],
            outputFormatter: utils.hexToNumber
        }),
        new Method({
            name: 'sendSignedTransaction',
            call: 'eth_sendRawTransaction',
            params: 1,
            inputFormatter: [null]
        }),
        new Method({
            name: 'signTransaction',
            call: 'eth_signTransaction',
            params: 1,
            inputFormatter: [formatter.inputTransactionFormatter]
        }),
        new Method({
            name: 'sendTransaction',
            call: 'eth_sendTransaction',
            params: 1,
            inputFormatter: [formatter.inputTransactionFormatter]
        }),
        new Method({
            name: 'sign',
            call: 'eth_sign',
            params: 2,
            inputFormatter: [formatter.inputSignFormatter, formatter.inputAddressFormatter],
            transformPayload: function (payload) {
                payload.params.reverse();
                return payload;
            }
        }),
        new Method({
            name: 'call',
            call: 'eth_call',
            params: 2,
            inputFormatter: [formatter.inputCallFormatter, formatter.inputDefaultBlockNumberFormatter]
        }),
        new Method({
            name: 'estimateGas',
            call: 'eth_estimateGas',
            params: 1,
            inputFormatter: [formatter.inputCallFormatter],
            outputFormatter: utils.hexToNumber
        }),
        new Method({
            name: 'getCompilers',
            call: 'eth_getCompilers',
            params: 0
        }),
        new Method({
            name: 'compile.solidity',
            call: 'eth_compileSolidity',
            params: 1
        }),
        new Method({
            name: 'compile.lll',
            call: 'eth_compileLLL',
            params: 1
        }),
        new Method({
            name: 'compile.serpent',
            call: 'eth_compileSerpent',
            params: 1
        }),
        new Method({
            name: 'submitWork',
            call: 'eth_submitWork',
            params: 3
        }),
        new Method({
            name: 'getWork',
            call: 'eth_getWork',
            params: 0
        }),
        new Method({
            name: 'getPastLogs',
            call: 'eth_getLogs',
            params: 1,
            inputFormatter: [formatter.inputLogFormatter],
            outputFormatter: formatter.outputLogFormatter
        }),

        // subscriptions
        new Subscriptions({
            name: 'subscribe',
            type: 'eth',
            subscriptions: {
                'newBlockHeaders': {
                    // TODO rename on RPC side?
                    subscriptionName: 'newHeads', // replace subscription with this name
                    params: 0,
                    outputFormatter: formatter.outputBlockFormatter
                },
                'pendingTransactions': {
                    subscriptionName: 'newPendingTransactions', // replace subscription with this name
                    params: 0
                },
                'logs': {
                    params: 1,
                    inputFormatter: [formatter.inputLogFormatter],
                    outputFormatter: formatter.outputLogFormatter,
                    // DUBLICATE, also in web3-eth-contract
                    subscriptionHandler: function (output) {
                        if(output.removed) {
                            this.emit('changed', output);
                        } else {
                            this.emit('data', output);
                        }

                        if (_.isFunction(this.callback)) {
                            this.callback(null, output, this);
                        }
                    }
                },
                'syncing': {
                    params: 0,
                    outputFormatter: formatter.outputSyncingFormatter,
                    subscriptionHandler: function (output) {
                        var _this = this;

                        // fire TRUE at start
                        if(this._isSyncing !== true) {
                            this._isSyncing = true;
                            this.emit('changed', _this._isSyncing);

                            if (_.isFunction(this.callback)) {
                                this.callback(null, _this._isSyncing, this);
                            }

                            setTimeout(function () {
                                _this.emit('data', output);

                                if (_.isFunction(_this.callback)) {
                                    _this.callback(null, output, _this);
                                }
                            }, 0);

                            // fire sync status
                        } else {
                            this.emit('data', output);
                            if (_.isFunction(_this.callback)) {
                                this.callback(null, output, this);
                            }

                            // wait for some time before fireing the FALSE
                            clearTimeout(this._isSyncingTimeout);
                            this._isSyncingTimeout = setTimeout(function () {
                                if(output.currentBlock > output.highestBlock - 200) {
                                    _this._isSyncing = false;
                                    _this.emit('changed', _this._isSyncing);

                                    if (_.isFunction(_this.callback)) {
                                        _this.callback(null, _this._isSyncing, _this);
                                    }
                                }
                            }, 500);
                        }
                    }
                }
            }
        })
    ];

    methods.forEach(function(method) {
        method.attachToObject(_this);
        method.setRequestManager(_this._requestManager, _this.accounts); // second param means is eth.accounts (necessary for wallet signing)
        method.defaultBlock = _this.defaultBlock;
        method.defaultAccount = _this.defaultAccount;
    });

};

core.addProviders(Eth);

module.exports = Eth;


text:
require 'test_helper'
require 'chimpactions'
require 'factories/raw_factory'

class ActionTest < ActiveSupport::TestCase

  context "Taking actions" do
    setup do
      action_hash
      mock_setup
      @user = User.new(:email => "subscriber@notanemail.com", :first_name => "FirstName", :last_name =>"LastName", :favorite_color => "red")
      User.any_instance.stubs(:is_great).returns(true)
      User.any_instance.stubs(:is_clean).returns(false)
      User.any_instance.stubs(:is_a_method).returns(true)
      @action1 = Chimpactions::Action.new({:action => "add_to", :list => Chimpactions.available_lists[0], :whenn => "is_great", :is => '=', :value => true})
      @action2 = Chimpactions::Action.new({:action => "move_to", :list => Chimpactions.available_lists[1], :whenn => "is_clean", :is => '=', :value => true})

    end

    should "return the appropriate class object when cast" do
      assert_equal Float, @action1.cast_value("123").class
      assert_equal Float, @action1.cast_value("123.00234").class
      assert_equal FalseClass, @action1.cast_value("false").class
      assert_equal TrueClass, @action1.cast_value("true").class
    end

    should "take a Chimpaction ActiveRecord object and create a Chimpactions::Action" do
      ar = Chimpaction.new({:action => "add_to", :list => Chimpactions.available_lists[0], :whenn => "is_a_method", :is => '=', :value => true})
      action = Chimpactions::Action.new(ar)
      assert_instance_of(Chimpactions::Action, action)
    end

    should "take a required action" do
      assert_equal true, @action1.perform?(@user)
    end

    should "not take an action that's not met" do
      assert_equal false, @action2.perform?(@user)
    end

    should "excute properly" do
      real_setup
      ar = Chimpaction.new(@action_hash)
      ar.whenn = 'favorite_color'
      ar.value = 'red'
      ar.list = "Chimpactions Registered Users"
      action = Chimpactions::Action.new(ar)
      user = User.new(:email => "subscriber@notanemail.com", :first_name => "FirstName", :last_name =>"LastName", :favorite_color => "red")
      assert_equal action.execute(user), true
    end

  end #context

end # class


text:
rm -rf .gh-pages-tmp lib  &&
mkdir .gh-pages-tmp &&

showroom-scan src &&
node node_modules/webpack/bin/webpack.js --config ./webpack.docs.config.js &&
cp -R lib/* .gh-pages-tmp &&
cp -R www/index.html .gh-pages-tmp &&

git checkout gh-pages &&
git ls-files | grep -v -e "\(^\.gitignore$\|^\.gitattributes$\|^\.gh-pages-tmp$\)" | xargs rm -rf &&
mv .gh-pages-tmp/* . &&
rm -rf .gh-pages-tmp &&
git add . &&
git commit -m "Update gh-pages" &&
git push --force origin gh-pages &&
git checkout master


text:
require 'activerecord-jdbc-adapter'
require 'jdbc-vertica'
require 'dotenv'

class JdbcTest < ActiveRecord::Base
end

# Create .env file containing
# HOSTNAME=
# PORT=
# DATABASE=
# USERNAME=
# PASSWORD=
Dotenv.load

config = {
  hostname: ENV['HOSTNAME'],
  port:     ENV['PORT'] || "5433",
  username: ENV['USERNAME'],
  password: ENV['PASSWORD'],
  database: ENV['DATABASE'] || "vmain",
}
puts config

Jdbc::Vertica.load_driver
ActiveRecord::Base.establish_connection adapter: 'jdbc',
  driver: 'com.vertica.jdbc.Driver',
  url: "jdbc:vertica://#{config[:hostname]}:#{config[:port]}/",
  username: config[:username],
  password: config[:password],
  database: config[:database],
  schema_search_path: 'sandbox'
ActiveRecord::Base.connection.execute "SET search_path TO sandbox;"

p JdbcTest.all


text:
<!doctype html>

	<link type="text/css" rel="stylesheet" href="rickshaw-master/ajax-local/libs/jqueryui/1.8/themes/base/jquery-ui.css">
	<link type="text/css" rel="stylesheet" href="rickshaw-master/src/css/graph.css">
	<link type="text/css" rel="stylesheet" href="rickshaw-master/src/css/detail.css">
	<link type="text/css" rel="stylesheet" href="rickshaw-master/src/css/legend.css">
	<link type="text/css" rel="stylesheet" href="css/extensions.css?v=2">

	<form id="side_panel">

Temperature Sensor Data

				<input type="radio" name="renderer" id="area" value="area">
				area
				<input type="radio" name="renderer" id="bar" value="bar">
				bar
				<input type="radio" name="renderer" id="line" value="line" checked>
				line
				<input type="radio" name="renderer" id="scatter" value="scatterplot">
				scatter

					<input type="radio" name="offset" id="stack" value="zero">
					stack

					<input type="radio" name="offset" id="stream" value="wiggle">
					stream

					<input type="radio" name="offset" id="pct" value="expand">
					pct

					<input type="radio" name="offset" id="value" value="value" checked>
					value

					<input type="radio" name="interpolation" id="cardinal" value="cardinal">
					cardinal

					<input type="radio" name="interpolation" id="linear" value="linear" checked>
					linear

					<input type="radio" name="interpolation" id="step" value="step-after">
					step

Smoothing

Connect to Server

				<input type="button" value="Connect" onclick="connectToServer();">

	</form>


text:
package org.andrewconner.spot.cmdrs.instance

sealed trait InstanceFilter {
  type Elem
  val accessor: EC2Instance => Elem
  def filter(elem: Elem): Boolean

  def run(instance: EC2Instance) = filter(accessor(instance))
}

object InstanceFilter {
  def memory(min: Option[Double], max: Option[Double]): InstanceFilter = RangeFilter(min, max)(_.memory)
  def ecu(min: Option[Double], max: Option[Double]): InstanceFilter = RangeFilter(min, max)(_.ecu)
  def cpu(min: Option[Double], max: Option[Double]): InstanceFilter = RangeFilter(min, max)(_.cores)
  def storageSize(min: Option[Double], max: Option[Double]): InstanceFilter = RangeFilter(min, max)(_.storage.map(_.size).getOrElse(0.0))
  def storageSsd(choice: Option[Boolean]): InstanceFilter = BooleanFilter(choice)(_.storage.exists(_.ssd))
  def arch(choices: Option[Set[EC2Arch]]): InstanceFilter = SeqSetFilter(choices)(_.arch)
  def networkPerformance(choices: Option[Set[EC2NetworkPerformance]]): InstanceFilter = SetFilter(choices)(_.networkPerformance)
  def enhancedNetworking(choice: Option[Boolean]): InstanceFilter = BooleanFilter(choice)(_.enhancedNetworking)
  def vpcOnly(choice: Option[Boolean]): InstanceFilter = BooleanFilter(choice)(_.vpcOnly)
  def linuxVirtualizationTypes(choices: Option[Set[EC2VirtualizationType]]): InstanceFilter = SeqSetFilter(choices)(_.linuxVirtualizationType)
  def ebsOptimized(choice: Option[Boolean]): InstanceFilter = BooleanFilter(choice)(_.ebsOptimized)

  // min & max given, filter based on range
  case class RangeFilter(min: Option[Double], max: Option[Double])(val accessor: EC2Instance => Double) extends InstanceFilter {
    type Elem = Double
    def filter(elem: Double) = {
      (min, max) match {
        case (None, None) => true
        case (Some(m1), None) => elem >= m1
        case (None, Some(m2)) => elem <= m2
        case (Some(m1), Some(m2)) => elem >= m1 && elem <= m2
      }
    }
  }

  // Set of valid choices given, filter single element
  case class SetFilter[T](choices: Option[Set[T]])(val accessor: EC2Instance => T) extends InstanceFilter {
    type Elem = T
    def filter(elem: T) = {
      choices match {
        case None => true
        case Some(set) => set.contains(elem)
      }
    }
  }

  // Set of valid choices given, filter such that a choice exists in elems
  case class SeqSetFilter[T](choices: Option[Set[T]])(val accessor: EC2Instance => Seq[T]) extends InstanceFilter {
    type Elem = Seq[T]
    def filter(elems: Seq[T]) = {
      choices match {
        case None => true
        case Some(set) => set.exists(elems.contains)
      }
    }
  }

  case class BooleanFilter[T](choice: Option[Boolean])(val accessor: EC2Instance => Boolean) extends InstanceFilter {
    type Elem = Boolean
    def filter(elem: Boolean) = {
      choice match {
        case None => true
        case Some(c) => elem == c
      }
    }
  }
}


text:
[![Build Status](https://travis-ci.org/innowatio/iwwa-lambda-pod-readings-api.svg?branch=master)](https://travis-ci.org/innowatio/iwwa-lambda-pod-readings-api)
[![Dependency Status](https://david-dm.org/innowatio/iwwa-lambda-pod-readings-api.svg)](https://david-dm.org/innowatio/iwwa-lambda-pod-readings-api)
[![devDependency Status](https://david-dm.org/innowatio/iwwa-lambda-pod-readings-api/dev-status.svg)](https://david-dm.org/innowatio/iwwa-lambda-pod-readings-api#info=devDependencies)

# iwwa-lambda-pod-readings-api

Takes HTTP requests coming from AWS API Gateway and emits events into AWS
Kinesis.

## Deployment

### Continuous deployment

Since the project uses TravisCI and
[`lambda-deploy`](https://github.com/innowatio/lambda-deploy/) for continuous
deployment, the following environment variables need to be set:

- `AWS_SECRET_ACCESS_KEY`
- `AWS_ACCESS_KEY_ID`
- `AWS_DEFAULT_REGION`
- `S3_BUCKET`
- `LAMBDA_NAME`
- `LAMBDA_ROLE_ARN`

WARNING: the value of those variables must be kept secret. Do not set them in
the `.travis.yml` config file, only in the Travis project's settings (where they
are kept secret).

### Configuration

The following environment variables are needed to configure the function:

- `KINESIS_STREAM_NAME`

NOTE: since the project uses `lambda-deploy`, in the build environment (Travis)
we need to define the above variables with their name prefixed by
`__FUNC_CONFIG__`.


text:
package org.apache.flink.streaming.runtime.streamrecord;

import org.apache.flink.FlinkVersion;
import org.apache.flink.api.common.typeutils.TypeSerializer;
import org.apache.flink.api.common.typeutils.TypeSerializerMatchers;
import org.apache.flink.api.common.typeutils.TypeSerializerSchemaCompatibility;
import org.apache.flink.api.common.typeutils.TypeSerializerUpgradeTestBase;
import org.apache.flink.api.common.typeutils.base.StringSerializer;

import org.hamcrest.Matcher;

import java.util.ArrayList;
import java.util.Collection;

import static org.apache.flink.streaming.util.StreamRecordMatchers.streamRecord;
import static org.hamcrest.Matchers.is;

/** Migration tests for {@link StreamElementSerializer}. */
class StreamElementSerializerUpgradeTest
        extends TypeSerializerUpgradeTestBase<StreamElement, StreamElement> {

    public Collection<TestSpecification<?, ?>> createTestSpecifications() throws Exception {

        ArrayList<TestSpecification<?, ?>> testSpecifications = new ArrayList<>();
        for (FlinkVersion flinkVersion : MIGRATION_VERSIONS) {
            testSpecifications.add(
                    new TestSpecification<>(
                            "stream-element-serializer",
                            flinkVersion,
                            StreamElementSetup.class,
                            StreamElementVerifier.class));
        }

        return testSpecifications;
    }

    // ----------------------------------------------------------------------------------------------
    //  Specification for "StreamElement-serializer"
    // ----------------------------------------------------------------------------------------------

    /**
     * This class is only public to work with {@link
     * org.apache.flink.api.common.typeutils.ClassRelocator}.
     */
    public static final class StreamElementSetup
            implements TypeSerializerUpgradeTestBase.PreUpgradeSetup<StreamElement> {
        @Override
        public TypeSerializer<StreamElement> createPriorSerializer() {
            return new StreamElementSerializer<>(StringSerializer.INSTANCE);
        }

        @Override
        public StreamElement createTestData() {
            return new StreamRecord<>("key", 123456);
        }
    }

    /**
     * This class is only public to work with {@link
     * org.apache.flink.api.common.typeutils.ClassRelocator}.
     */
    public static final class StreamElementVerifier
            implements TypeSerializerUpgradeTestBase.UpgradeVerifier<StreamElement> {
        @Override
        public TypeSerializer<StreamElement> createUpgradedSerializer() {
            return new StreamElementSerializer<>(StringSerializer.INSTANCE);
        }

        @SuppressWarnings({"unchecked", "rawtypes"})
        @Override
        public Matcher<StreamElement> testDataMatcher() {
            return (Matcher) streamRecord(is("key"), is(123456L));
        }

        @Override
        public Matcher<TypeSerializerSchemaCompatibility<StreamElement>> schemaCompatibilityMatcher(
                FlinkVersion version) {
            return TypeSerializerMatchers.isCompatibleAsIs();
        }
    }
}


text:
<!DOCTYPE html>

  <title>Application.js</title>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <meta name="viewport" content="width=device-width, target-densitydpi=160dpi, initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">
  <link rel="stylesheet" media="all" href="..\docco.css" />

Application.js

                ¶

Imports

var HttpApplication = require('../../src/HttpApplication');
var HomeController = require('./controllers/HomeController');

var Application = HttpApplication.extend({

	initialize: function(){},

	controllers: [HomeController],
	middlewares: []
});

module.exports = Application;


text:
import {gql} from "apollo-server-express";
import App from "../../../app";
import produce from "immer";
import {Location} from "../../../classes/universe/components";
import {setComponent} from "../setComponentHelper";
import {pubsub} from "../../../helpers/subscriptionManager";

const schema = gql`
  type Quaternion {
    x: Float!
    y: Float!
    z: Float!
    w: Float!
  }
  input QuaternionInput {
    x: Float!
    y: Float!
    z: Float!
    w: Float!
  }
  type EntityCoordinates {
    x: Float!
    y: Float!
    z: Float!
  }
  input EntityCoordinatesInput {
    x: Float!
    y: Float!
    z: Float!
  }
  type LocationComponent {
    inert: Boolean!
    position: EntityCoordinates!
    velocity: EntityCoordinates!
    acceleration: EntityCoordinates!
    rotation: Quaternion!
    rotationVelocity: EntityCoordinates!
    rotationAcceleration: EntityCoordinates!
  }

  extend type Entity {
    location: LocationComponent
  }
  input EntitiesLocationInput {
    id: ID!
    position: EntityCoordinatesInput!
  }
  extend type Mutation {
    entitySetLocation(
      id: ID
      position: EntityCoordinatesInput
      velocity: EntityCoordinatesInput
      acceleration: EntityCoordinatesInput
      rotation: QuaternionInput
      rotationVelocity: EntityCoordinatesInput
      rotationAcceleration: EntityCoordinatesInput
    ): String
    entitiesSetPosition(entities: [EntitiesLocationInput!]!): String
    entitySetRotationVelocityMagnitude(
      id: ID!
      rotationVelocity: CoordinatesInput!
    ): String
    # entitySetVelocityMagnitude(id: ID!, velocity: CoordinatesInput!): String
    entityRemoveLocation(id: ID!): String
  }
`;

const resolver = {
  Mutation: {
    entitySetLocation: setComponent("location"),
    entitiesSetPosition(root, {entities}, context) {
      const entity = App.entities.find(e => e.id === entities[0].id);
      const flightId = entity?.flightId;
      if (!flightId) return;

      App.entities = produce(App.entities, draft => {
        entities.forEach(e => {
          const entityIndex = draft.findIndex(ee => ee.id === e.id);
          const entity = draft[entityIndex];
          if (!entity.location) {
            entity.location = new Location({position: e.position});
          } else {
            entity.location.position = e.position;
          }
        });
      });

      pubsub.publish("entities", {
        flightId,
        template: false,
        entities: App.entities,
      });
    },
    entitySetRotationVelocityMagnitude(root, {id, rotationVelocity}) {
      const entityIndex = App.entities.findIndex(e => e.id === id);
      if (entityIndex === -1) return;

      const entity = App.entities[entityIndex];
      const flightId = entity?.flightId;
      if (!flightId) return;

      entity.location.rotationVelocity.x = rotationVelocity.x;
      entity.location.rotationVelocity.y = rotationVelocity.y;
      entity.location.rotationVelocity.z = rotationVelocity.z;
      // No need to publish
    },
    // entitySetAccelerationMagnitude(root, {id, velocity}) {
    //   const entityIndex = App.entities.findIndex(e => e.id === id);
    //   if (entityIndex === -1) return;

    //   const entity = App.entities[entityIndex];
    //   const flightId = entity?.flightId;
    //   if (!flightId) return;

    //   entity.location.velocity.x = velocity.x;
    //   entity.location.velocity.y = velocity.y;
    //   entity.location.velocity.z = velocity.z;
    //   // No need to publish
    // },
    entityRemoveLocation(root, {id}, context) {
      const entityId = id || context.entityId;
    },
  },
};

export default {schema, resolver};


text:
package com.sylvanaar.idea.Lua.lang.psi.impl.symbols;

import com.intellij.lang.ASTNode;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiElementVisitor;
import com.intellij.util.IncorrectOperationException;
import com.sylvanaar.idea.Lua.lang.psi.expressions.LuaExpression;
import com.sylvanaar.idea.Lua.lang.psi.statements.LuaAssignmentStatement;
import com.sylvanaar.idea.Lua.lang.psi.statements.LuaFunctionDefinitionStatement;
import com.sylvanaar.idea.Lua.lang.psi.statements.LuaStatementElement;
import com.sylvanaar.idea.Lua.lang.psi.symbols.LuaIdentifier;
import com.sylvanaar.idea.Lua.lang.psi.symbols.LuaSymbol;
import com.sylvanaar.idea.Lua.lang.psi.util.LuaPsiUtils;
import com.sylvanaar.idea.Lua.lang.psi.visitor.LuaElementVisitor;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

//import com.sylvanaar.idea.Lua.lang.psi.expressions.LuaVariable;

/**
 * Created by IntelliJ IDEA.
 * User: Jon S Akhtar
 * Date: Apr 11, 2010
 * Time: 2:33:37 PM
 */
public abstract class LuaIdentifierImpl extends LuaSymbolImpl implements LuaIdentifier {

    public LuaIdentifierImpl(ASTNode node) {
        super(node);
    }

    @Override
    public void accept(LuaElementVisitor visitor) {
      visitor.visitIdentifier(this);
    }

    @Override
    public void accept(@NotNull PsiElementVisitor visitor) {
        if (visitor instanceof LuaElementVisitor) {
            ((LuaElementVisitor) visitor).visitIdentifier(this);
        } else {
            visitor.visitElement(this);
        }
    }

    @Nullable
    @NonNls
    public String getName() {
      return getText();
    }

    @Override
    public String toString() {
        return "Identifier: " + getName();
    }

    @Override
    public PsiElement replaceWithExpression(LuaExpression newExpr, boolean b) {
        return LuaPsiUtils.replaceElement(this, newExpr);
    }

    @Override
    public PsiElement setName(@NonNls String name) throws IncorrectOperationException {
        return null;  //To change body of implemented methods use File | Settings | File Templates.
    }

    /** Defined Value Implementation **/
//    SoftReference<LuaExpression> definedValue = null;
//    @Override
//    public LuaExpression getAssignedValue() {
//        return definedValue == null ? null : definedValue.get();
//    }
//
//    @Override
//    public void setAssignedValue(LuaExpression value) {
//        definedValue = new SoftReference<LuaExpression>(value);
//    }

//    @NotNull
//    @Override
//    public LuaType getLuaType() {
//        if (getAssignedValue() != null)
//            return getAssignedValue().getLuaType();
//
//        return super.getLuaType();
//    }

    /** Defined Value Implementation **/

    @Override
    public boolean isAssignedTo() {
        // This should return true if this variable is being assigned to in the current statement
        // it will be used for example by the global identifier class to decide if it should resolve
        // as a declaration or not

        PsiElement parent = getParent();
        while (!(parent instanceof LuaStatementElement)) {
            parent = parent.getParent();
        }

        if (parent instanceof LuaAssignmentStatement) {
            LuaAssignmentStatement s = (LuaAssignmentStatement)parent;

            for (LuaSymbol e : s.getLeftExprs().getSymbols())
                if (e == getParent().getParent())
                    return true;
        }
        else if (parent instanceof LuaFunctionDefinitionStatement) {
            LuaFunctionDefinitionStatement s = (LuaFunctionDefinitionStatement)parent;

            if (s.getIdentifier() == getParent().getParent())
                return true;
        }

        return false;
    }

}


text:
from mock import Mock, patch
from nose.tools import assert_raises, eq_

from django.http import Http404
from django.test import TestCase

from us_ignite.common.tests import utils
from us_ignite.blog import views
from us_ignite.blog.models import Post

patch_get_object = patch('us_ignite.blog.views.get_object_or_404')

class TestPostListView(TestCase):

    @patch('us_ignite.blog.models.Post.published.select_related')
    def test_request_is_successful(self, related_mock):
        related_mock.return_value.filter.return_value = []
        related_mock.return_value.all.return_value = []
        request = utils.get_request('get', '/blog/', user=utils.get_anon_mock())
        response = views.post_list(request)
        eq_(response.status_code, 200)
        eq_(response.template_name, 'blog/object_list.html')
        eq_(sorted(response.context_data.keys()), ['featured_list', 'page'])
        eq_(related_mock.return_value.filter.call_count, 2)

class TestPostDetailView(TestCase):

    @patch_get_object
    def test_invalid_published_post_returns_404(self, mock_get):
        mock_get.side_effect = Http404
        request = utils.get_request('get', '/blog/', user=utils.get_anon_mock())
        assert_raises(Http404, views.post_detail, request, 2013, 12, 'gigabit')
        mock_get.assert_called_once_with(
            Post, slug='gigabit', publication_date__year=2013,
            publication_date__month=12)

    @patch_get_object
    def test_not_visible_post_raises_404(self, mock_get):
        mock_post = Mock(spec=Post)()
        mock_post.is_visible_by.return_value = False
        mock_get.return_value = mock_post
        user = utils.get_anon_mock()
        request = utils.get_request('get', '/blog/', user=user)
        assert_raises(Http404, views.post_detail, request, 2013, 12, 'gigabit')
        mock_get.assert_called_once_with(
            Post, slug='gigabit', publication_date__year=2013,
            publication_date__month=12)
        mock_post.is_visible_by.assert_called_once_with(user)

    @patch_get_object
    def test_published_post_request_is_successful(self, mock_get):
        mock_post = Mock(spec=Post)()
        mock_post.is_visible_by.return_value = True
        mock_get.return_value = mock_post
        request = utils.get_request('get', '/blog/', user=utils.get_anon_mock())
        response = views.post_detail(request, 2013, 12, 'gigabit')
        eq_(response.status_code, 200)
        eq_(response.template_name, 'blog/object_detail.html')
        eq_(sorted(response.context_data.keys()),
            sorted(['object', 'featured_list']))
        mock_get.assert_called_once_with(
            Post, slug='gigabit', publication_date__year=2013,
            publication_date__month=12)
        mock_post.is_visible_by.assert_called_once_with(request.user)

class TestLegacyRedirectView(TestCase):

    @patch_get_object
    def test_redirect_does_not_exists(self, mock_get):
        mock_get.side_effect = Http404
        request = utils.get_request('get', '/2014/3/foo/')
        assert_raises(Http404, views.legacy_redirect, request, 2014, 3, u'foo')
        mock_get.assert_called_once_with(
            Post.published, slug='foo', publication_date__year=2014,
            publication_date__month=3)

    @patch_get_object
    def test_legacy_redirect_exists(self, mock_get):
        mock_instance = Mock(spec=Post)
        mock_instance.get_absolute_url.return_value = '/blog/2014/3/foo/'
        mock_get.return_value = mock_instance
        request = utils.get_request('get', '/2014/3/foo/')
        response = views.legacy_redirect(request, 2014, 3, u'foo')
        eq_(response.status_code, 301)
        eq_(response['Location'], '/blog/2014/3/foo/')
        mock_get.assert_called_once_with(
            Post.published, slug='foo', publication_date__year=2014,
            publication_date__month=3)


text:
using System.Threading.Tasks;
using JetBrains.Annotations;
using Kulman.WPA81.Code;

namespace Kulman.WPA81.Interfaces
{
    public interface IDialogService
    {
        /// <summary>
        /// Shows a dialog with given message and ok/cancel buttons.
        /// </summary>
        /// <param name="message">Message</param>
        /// <param name="title">Title</param>
        /// <param name="leftButtonText">Left button text (optional)</param>
        /// <param name="rightButtonText">Right button text (optional)</param>
        /// <returns>Dialog result</returns>
        Task<DialogResult> ShowMessageDialog([NotNull] string message, [CanBeNull] string title = null, [CanBeNull] string leftButtonText = null, [CanBeNull] string rightButtonText = null);
    }
}


text:
/*
 *
 * @author MingLi (guomilo@gmail.com)
 */

/*依赖 util.js */
var IR = IR || {};
(function (IR) {
    var tools = IR.Util;
    IR.Observer = function (sender) {
        this._sender = sender;
        this._listeners = {};
    }
    IR.Observer.prototype = {
        attach: function (key, handler) {
            if (tools.isUndefined(key)) return;
            if (!tools.isFunction(handler)) return;
            if (tools.isUndefined(this._listeners[key])) {
                this._listeners[key] = [];
            }
            this._listeners[key].push(handler);
        },
        notify: function () {
            var listeners = this._listeners,
                args = Array.prototype.slice.call(arguments);

            for (var ci in listeners) {
                this.notifyByKey.apply(this, Array.prototype.concat([ci], args));
            }
        },
        notifyByKey: function (key) {
            if (tools.isUndefined(key)) return;
            var listeners = this._listeners;
            if (tools.isUndefined(listeners[key])) { return; }
            for (var i = 0, cii; cii = listeners[key][i]; i++) {
                cii.apply(this._sender, Array.prototype.slice.call(arguments, 1));
            }
        },
        remove: function (key, index) {
            if (tools.isUndefined(key)) return;
            if (tools.isUndefined(index)) {
                delete this._listeners[key];
            }
            else {
                this._listeners[key].splice(index, 1);
            }
        },
        getHandlerByKey: function (key) {
            if (tools.isUndefined(key)) return undefined;
            var listeners = this._listeners;
            if (tools.isUndefined(listeners[key])) { return undefined; }
            return listeners[key];
        },
        clear: function () {
            this._listeners = {};
        }
    }

})(IR);


text:
<md-toolbar class="author-toolbar">

</md-toolbar>
<md-content flex>
    <md-list class="books-list">
        <md-list-item class="md-2-line book-line" ng-repeat="book in books" ng-click="bookInfo($index)">

                    {{book.title}}

{{book.series}} [{{book.ser_no}}]

            <md-button class="md-fab md-primary" layout-align="right" aria-label="Download" ng-click="downloadBook(book.ID, $event)">
                <md-icon md-svg-icon="assets/icons/download.svg"></md-icon>
            </md-button>
        </md-list-item>
    </md-list>
</md-content>


text:
require 'helper'
require 'action_controller'
require 'focused_controller/rspec_helper'

module FocusedController
  module RSpecHelper
    module FakePostsController
      class Action < ActionController::Base
      end

      class Index < Action
      end

      class Show < Action
      end

      class Edit < Action
      end

      class Destroy < Action
      end
    end

    index_spec = RSpec::Core::ExampleGroup.describe FakePostsController::Index do
      include FocusedController::RSpecHelper
    end

    show_spec = nil
    inner_show_spec = nil
    RSpec::Core::ExampleGroup.describe FakePostsController do
      show_spec = describe FakePostsController::Show do
        include FocusedController::RSpecHelper

        inner_show_spec = describe 'foo' do
        end
      end
    end

    edit_spec = RSpec::Core::ExampleGroup.describe "the edit action" do
      include FocusedController::RSpecHelper
      self.controller_class = FakePostsController::Edit
    end

    describe RSpecHelper do
      it 'finds the correct controller class' do
        index_spec.controller_class.must_equal FakePostsController::Index
        show_spec.controller_class.must_equal FakePostsController::Show
        inner_show_spec.controller_class.must_equal FakePostsController::Show
        edit_spec.controller_class.must_equal FakePostsController::Edit
      end

      subject { index_spec.new }

      def must_fail(&block)
        block.must_raise RSpec::Expectations::ExpectationNotMetError
      end

      def must_succeed(&block)
        block.call
        true.must_equal true # to count the assertion
      end

      it 'has a redirect_to matcher' do
        must_fail { subject.should subject.redirect_to('/foo') }
        subject.controller.redirect_to('/foo')
        must_succeed { subject.should subject.redirect_to('/foo') }
      end

      it 'matches response type' do
        must_succeed { subject.response.should subject.be_success }
        must_fail    { subject.response.should subject.be_error }

        subject.controller.render :status => :not_found

        must_fail    { subject.response.should subject.be_success }
        must_succeed { subject.response.should subject.be_missing }
      end

      it 'has a render_template matcher' do
        subject.controller.render :foo

        must_succeed { subject.response.should subject.render_template(:foo) }
        must_fail    { subject.response.should subject.render_template(:bar) }
      end

      it 'sets the subject to be the controller instance' do
        subject.subject.must_equal subject.controller
      end
    end
  end
end


text:
- POST /API/publish : publier une photo
- GET /API/structures : liste des structures

## structures #
- GET /API/publish : récuperer la liste des liens des photos
- GET /API/publish/item : récupérer une photo ajoutée
- GET /API/users

#


text:
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="JavaScriptLibraryMappings">
    <file url="PROJECT" libraries="{JsTestDriver Assertion Framework}" />
  </component>
</project>