text:
from __future__ import absolute_import

from datetime import datetime
from time import mktime

import feedparser
import pytz

from django.conf import settings
from django.utils import html
from django.utils import timezone

from .models import Entry, Options, Group, Feed

import logging

logger = logging.getLogger('feedreader')

def build_context(request, context={}):
    """
    Find flag and id values in the request and use them
    to build a common context dictionary. Including the
    list of entries to display.
    """
    options = Options.manager.get_options()
    poll_flag = request.GET.get('poll_flag', None)
    mark_read_flag = request.GET.get('mark_read_flag', None)
    show_read_flag = request.GET.get('show_read_flag', None)

    last_entry = None
    last_entry_id = request.GET.get('entry_id', None)  # Last entry on page
    if last_entry_id:
        try:
            last_entry = Entry.objects.get(pk=last_entry_id)
        except Entry.DoesNotExist:
            pass

    context['show_read_flag'] = show_read_flag
    feed = None
    feed_id = request.GET.get('feed_id', None)
    if feed_id:
        try:
            feed = Feed.objects.get(pk=feed_id)
        except Feed.DoesNotExist:
            pass

    group = None
    group_id = request.GET.get('group_id', None)
    if group_id:
        try:
            group = Group.objects.get(pk=group_id)
        except Group.DoesNotExist:
            pass

    if feed:
        if mark_read_flag:
            entries = Entry.objects.filter(feed=feed, read_flag=False)
            entries.update(read_flag=True)
        if poll_flag:
            poll_feed(feed)
        if show_read_flag:
            entries = Entry.objects.filter(feed=feed)
        else:
            entries = Entry.objects.filter(feed=feed, read_flag=False)
        context['entries_header'] = feed.title
    elif group:
        feeds = Feed.objects.filter(group=group)
        if mark_read_flag:
            entries = Entry.objects.filter(feed__group=group, read_flag=False)
            entries.update(read_flag=True)
        if poll_flag:
            for feed in feeds:
                poll_feed(feed)
        if show_read_flag:
            entries = Entry.objects.filter(feed__group=group)
        else:
            entries = Entry.objects.filter(feed__group=group, read_flag=False)
        context['entries_header'] = group.name
    else:
        if mark_read_flag:
            entries = Entry.objects.filter(read_flag=False)
            entries.update(read_flag=True)
        if show_read_flag:
            entries = Entry.objects.all()
        else:
            entries = Entry.objects.filter(read_flag=False)
        context['entries_header'] = 'All Entries'

    if last_entry:
        entry_list = list(entries)
        if last_entry in entry_list:
            last_entry_pos = entry_list.index(last_entry)
            for i in range(last_entry_pos + 1):
                if entry_list[i].read_flag == False:
                    entry_list[i].read_flag = True
                    entry_list[i].save()
            del entry_list[:last_entry_pos + 1]
            context['entry_list'] = entry_list[:options.number_additionally_displayed]
        else:
            context['entry_list'] = []
        context['entries_header'] = None
    else:
        context['entry_list'] = entries[:options.number_initially_displayed]

    return context

def poll_feed(db_feed, verbose=False):
    """
    Read through a feed looking for new entries.
    """
    options = Options.manager.get_options()
    parsed = feedparser.parse(db_feed.xml_url)
    if hasattr(parsed.feed, 'bozo_exception'):
        # Malformed feed
        msg = 'Feedreader poll_feeds found Malformed feed, "%s": %s' % (db_feed.xml_url, parsed.feed.bozo_exception)
        logger.warning(msg)
        if verbose:
            print(msg)
        return
    if hasattr(parsed.feed, 'published_parsed'):
        published_time = datetime.fromtimestamp(mktime(parsed.feed.published_parsed))
        published_time = pytz.timezone(settings.TIME_ZONE).localize(published_time, is_dst=None)
        if db_feed.published_time and db_feed.published_time >= published_time:
            return
        db_feed.published_time = published_time
    for attr in ['title', 'title_detail', 'link']:
        if not hasattr(parsed.feed, attr):
            msg = 'Feedreader poll_feeds. Feed "%s" has no %s' % (db_feed.xml_url, attr)
            logger.error(msg)
            if verbose:
                print(msg)
            return
    if parsed.feed.title_detail.type == 'text/plain':
        db_feed.title = html.escape(parsed.feed.title)
    else:
        db_feed.title = parsed.feed.title
    db_feed.link = parsed.feed.link
    if hasattr(parsed.feed, 'description_detail') and hasattr(parsed.feed, 'description'):
        if parsed.feed.description_detail.type == 'text/plain':
            db_feed.description = html.escape(parsed.feed.description)
        else:
            db_feed.description = parsed.feed.description
    else:
        db_feed.description = ''
    db_feed.last_polled_time = timezone.now()
    db_feed.save()
    if verbose:
        print('%d entries to process in %s' % (len(parsed.entries), db_feed.title))
    for i, entry in enumerate(parsed.entries):
        if i >= options.max_entries_saved:
            break
        missing_attr = False
        for attr in ['title', 'title_detail', 'link', 'description']:
            if not hasattr(entry, attr):
                msg = 'Feedreader poll_feeds. Entry "%s" has no %s' % (entry.link, attr)
                logger.error(msg)
                if verbose:
                    print(msg)
                missing_attr = True
        if missing_attr:
            continue
        if entry.title == "":
            msg = 'Feedreader poll_feeds. Entry "%s" has a blank title' % (entry.link)
            if verbose:
                print(msg)
            logger.warning(msg)
            continue
        db_entry, created = Entry.objects.get_or_create(feed=db_feed, link=entry.link)
        if created:
            if hasattr(entry, 'published_parsed'):
                published_time = datetime.fromtimestamp(mktime(entry.published_parsed))
                published_time = pytz.timezone(settings.TIME_ZONE).localize(published_time, is_dst=None)
                now = timezone.now()
                if published_time > now:
                    published_time = now
                db_entry.published_time = published_time
            if entry.title_detail.type == 'text/plain':
                db_entry.title = html.escape(entry.title)
            else:
                db_entry.title = entry.title
            # Lots of entries are missing descrtion_detail attributes. Escape their content by default
            if hasattr(entry, 'description_detail') and entry.description_detail.type != 'text/plain':
                db_entry.description = entry.description
            else:
                db_entry.description = html.escape(entry.description)
            db_entry.save()


text:
'''Autogenerated by xml_generate script, do not edit!'''
from OpenGL import platform as _p, arrays
# Code generation uses this
from OpenGL.raw.WGL import _types as _cs
# End users want this...
from OpenGL.raw.WGL._types import *
from OpenGL.raw.WGL import _errors
from OpenGL.constant import Constant as _C

import ctypes
_EXTENSION_NAME = 'WGL_ARB_buffer_region'
def _f( function ):
    return _p.createFunction( function,_p.PLATFORM.WGL,'WGL_ARB_buffer_region',error_checker=_errors._error_checker)
WGL_BACK_COLOR_BUFFER_BIT_ARB=_C('WGL_BACK_COLOR_BUFFER_BIT_ARB',0x00000002)
WGL_DEPTH_BUFFER_BIT_ARB=_C('WGL_DEPTH_BUFFER_BIT_ARB',0x00000004)
WGL_FRONT_COLOR_BUFFER_BIT_ARB=_C('WGL_FRONT_COLOR_BUFFER_BIT_ARB',0x00000001)
WGL_STENCIL_BUFFER_BIT_ARB=_C('WGL_STENCIL_BUFFER_BIT_ARB',0x00000008)
@_f
@_p.types(_cs.HANDLE,_cs.HDC,_cs.c_int,_cs.UINT)
def wglCreateBufferRegionARB(hDC,iLayerPlane,uType):pass
@_f
@_p.types(_cs.VOID,_cs.HANDLE)
def wglDeleteBufferRegionARB(hRegion):pass
@_f
@_p.types(_cs.BOOL,_cs.HANDLE,_cs.c_int,_cs.c_int,_cs.c_int,_cs.c_int,_cs.c_int,_cs.c_int)
def wglRestoreBufferRegionARB(hRegion,x,y,width,height,xSrc,ySrc):pass
@_f
@_p.types(_cs.BOOL,_cs.HANDLE,_cs.c_int,_cs.c_int,_cs.c_int,_cs.c_int)
def wglSaveBufferRegionARB(hRegion,x,y,width,height):pass

redpajama_set_name: RedPajamaGithub


text:
describe("mat2d", function() {
    var mat2d = require("../../src/gl-matrix/mat2d.js");

    var out, matA, matB, identity, result;

    beforeEach(function() {
        matA = [1, 2,
                3, 4,
                5, 6];

        oldA = [1, 2,
                3, 4,
                5, 6];

        matB = [7, 8,
                9, 10,
                11, 12];

        oldB = [7, 8,
                9, 10,
                11, 12];

        out =  [0, 0,
                0, 0,
                0, 0];

        identity = [1, 0,
                    0, 1,
                    0, 0];
    });

    describe("create", function() {
        beforeEach(function() { result = mat2d.create(); });
        it("should return a 6 element array initialized to a 2x3 identity matrix", function() { expect(result).toBeEqualish(identity); });
    });

    describe("clone", function() {
        beforeEach(function() { result = mat2d.clone(matA); });
        it("should return a 6 element array initialized to the values in matA", function() { expect(result).toBeEqualish(matA); });
    });

    describe("copy", function() {
        beforeEach(function() { result = mat2d.copy(out, matA); });
        it("should place values into out", function() { expect(out).toBeEqualish(matA); });
        it("should return out", function() { expect(result).toBe(out); });
    });

    describe("identity", function() {
        beforeEach(function() { result = mat2d.identity(out); });
        it("should place values into out", function() { expect(result).toBeEqualish(identity); });
        it("should return out", function() { expect(result).toBe(out); });
    });

    describe("invert", function() {
        describe("with a separate output matrix", function() {
            beforeEach(function() { result = mat2d.invert(out, matA); });

            it("should place values into out", function() { expect(out).toBeEqualish([ -2, 1, 1.5, -0.5, 1, -2 ]); });
            it("should return out", function() { expect(result).toBe(out); });
            it("should not modify matA", function() { expect(matA).toBeEqualish(oldA); });
        });

        describe("when matA is the output matrix", function() {
            beforeEach(function() { result = mat2d.invert(matA, matA); });

            it("should place values into matA", function() { expect(matA).toBeEqualish([ -2, 1, 1.5, -0.5, 1, -2 ]); });
            it("should return matA", function() { expect(result).toBe(matA); });
        });
    });

    describe("determinant", function() {
        beforeEach(function() { result = mat2d.determinant(matA); });

        it("should return the determinant", function() { expect(result).toEqual(-2); });
    });

    describe("multiply", function() {
        it("should have an alias called 'mul'", function() { expect(mat2d.mul).toEqual(mat2d.multiply); });

        describe("with a separate output matrix", function() {
            beforeEach(function() { result = mat2d.multiply(out, matA, matB); });

            it("should place values into out", function() { expect(out).toBeEqualish([31, 46, 39, 58, 52, 76]); });
            it("should return out", function() { expect(result).toBe(out); });
            it("should not modify matA", function() { expect(matA).toBeEqualish(oldA); });
            it("should not modify matB", function() { expect(matB).toBeEqualish(oldB); });
        });

        describe("when matA is the output matrix", function() {
            beforeEach(function() { result = mat2d.multiply(matA, matA, matB); });

            it("should place values into matA", function() { expect(matA).toBeEqualish([31, 46, 39, 58, 52, 76]); });
            it("should return matA", function() { expect(result).toBe(matA); });
            it("should not modify matB", function() { expect(matB).toBeEqualish(oldB); });
        });

        describe("when matB is the output matrix", function() {
            beforeEach(function() { result = mat2d.multiply(matB, matA, matB); });

            it("should place values into matB", function() { expect(matB).toBeEqualish([31, 46, 39, 58, 52, 76]); });
            it("should return matB", function() { expect(result).toBe(matB); });
            it("should not modify matA", function() { expect(matA).toBeEqualish(oldA); });
        });
    });

    describe("rotate", function() {
        describe("with a separate output matrix", function() {
            beforeEach(function() { result = mat2d.rotate(out, matA, Math.PI * 0.5); });

            it("should place values into out", function() { expect(out).toBeEqualish([3, 4, -1, -2, 5, 6]); });
            it("should return out", function() { expect(result).toBe(out); });
            it("should not modify matA", function() { expect(matA).toBeEqualish(oldA); });
        });

        describe("when matA is the output matrix", function() {
            beforeEach(function() { result = mat2d.rotate(matA, matA, Math.PI * 0.5); });

            it("should place values into matA", function() { expect(matA).toBeEqualish([3, 4, -1, -2, 5, 6]); });
            it("should return matA", function() { expect(result).toBe(matA); });
        });
    });

    describe("scale", function() {
        var vecA;
        beforeEach(function() { vecA = [2, 3]; });

        describe("with a separate output matrix", function() {
            beforeEach(function() { result = mat2d.scale(out, matA, vecA); });

            it("should place values into out", function() { expect(out).toBeEqualish([2, 4, 9, 12, 5, 6]); });
            it("should return out", function() { expect(result).toBe(out); });
            it("should not modify matA", function() { expect(matA).toBeEqualish(oldA); });
        });

        describe("when matA is the output matrix", function() {
            beforeEach(function() { result = mat2d.scale(matA, matA, vecA); });

            it("should place values into matA", function() { expect(matA).toBeEqualish([2, 4, 9, 12, 5, 6]); });
            it("should return matA", function() { expect(result).toBe(matA); });
        });
    });

    describe("translate", function() {
        var vecA;
        beforeEach(function() { vecA = [2, 3]; });

        describe("with a separate output matrix", function() {
            beforeEach(function() { result = mat2d.translate(out, matA, vecA); });

            it("should place values into out", function() { expect(out).toBeEqualish([1, 2, 3, 4, 16, 22]); });
            it("should return out", function() { expect(result).toBe(out); });
            it("should not modify matA", function() { expect(matA).toBeEqualish(oldA); });
        });

        describe("when matA is the output matrix", function() {
            beforeEach(function() { result = mat2d.translate(matA, matA, vecA); });

            it("should place values into matA", function() { expect(matA).toBeEqualish([1, 2, 3, 4, 16, 22]); });
            it("should return matA", function() { expect(result).toBe(matA); });
        });
    });

    describe("str", function() {
        beforeEach(function() { result = mat2d.str(matA); });

        it("should return a string representation of the matrix", function() { expect(result).toEqual("mat2d(1, 2, 3, 4, 5, 6)"); });
    });

   describe("frob", function() {
        beforeEach(function() { result = mat2d.frob(matA); });
        it("should return the Frobenius Norm of the matrix", function() { expect(result).toEqual( Math.sqrt(Math.pow(1, 2) + Math.pow(2, 2) + Math.pow(3, 2) + Math.pow(4, 2) + Math.pow(5, 2) + Math.pow(6, 2) + 1)); });
   });

    describe("add", function() {
        describe("with a separate output matrix", function() {
            beforeEach(function() { result = mat2d.add(out, matA, matB); });

            it("should place values into out", function() { expect(out).toBeEqualish([8, 10, 12, 14, 16, 18]); });
            it("should return out", function() { expect(result).toBe(out); });
            it("should not modify matA", function() { expect(matA).toBeEqualish(oldA); });
            it("should not modify matB", function() { expect(matB).toBeEqualish(oldB); });
        });

        describe("when matA is the output matrix", function() {
            beforeEach(function() { result = mat2d.add(matA, matA, matB); });

            it("should place values into matA", function() { expect(matA).toBeEqualish([8, 10, 12, 14, 16, 18]); });
            it("should return matA", function() { expect(result).toBe(matA); });
            it("should not modify matB", function() { expect(matB).toBeEqualish(oldB); });
        });

        describe("when matB is the output matrix", function() {
            beforeEach(function() { result = mat2d.add(matB, matA, matB); });

            it("should place values into matB", function() { expect(matB).toBeEqualish([8, 10, 12, 14, 16, 18]); });
            it("should return matB", function() { expect(result).toBe(matB); });
            it("should not modify matA", function() { expect(matA).toBeEqualish(oldA); });
        });
    });

    describe("subtract", function() {
        it("should have an alias called 'sub'", function() { expect(mat2d.sub).toEqual(mat2d.subtract); });

        describe("with a separate output matrix", function() {
            beforeEach(function() { result = mat2d.subtract(out, matA, matB); });

            it("should place values into out", function() { expect(out).toBeEqualish([-6, -6, -6, -6, -6, -6]); });
            it("should return out", function() { expect(result).toBe(out); });
            it("should not modify matA", function() { expect(matA).toBeEqualish(oldA); });
            it("should not modify matB", function() { expect(matB).toBeEqualish(oldB); });
        });

        describe("when matA is the output matrix", function() {
            beforeEach(function() { result = mat2d.subtract(matA, matA, matB); });

            it("should place values into matA", function() { expect(matA).toBeEqualish([-6, -6, -6, -6, -6, -6]); });
            it("should return matA", function() { expect(result).toBe(matA); });
            it("should not modify matB", function() { expect(matB).toBeEqualish(oldB); });
        });

        describe("when matB is the output matrix", function() {
            beforeEach(function() { result = mat2d.subtract(matB, matA, matB); });

            it("should place values into matB", function() { expect(matB).toBeEqualish([-6, -6, -6, -6, -6, -6]); });
            it("should return matB", function() { expect(result).toBe(matB); });
            it("should not modify matA", function() { expect(matA).toBeEqualish(oldA); });
        });
    });

    describe("fromValues", function() {
        beforeEach(function() { result = mat2d.fromValues(1, 2, 3, 4, 5, 6); });
        it("should return a 6 element array initialized to the values passed", function() { expect(result).toBeEqualish([1, 2, 3, 4, 5, 6]); });
    });

    describe("set", function() {
        beforeEach(function() { result = mat2d.set(out, 1, 2, 3, 4, 5, 6); });
        it("should place values into out", function() { expect(out).toBeEqualish([1, 2, 3, 4, 5, 6]); });
        it("should return out", function() { expect(result).toBe(out); });
    });

    describe("multiplyScalar", function() {
        describe("with a separate output matrix", function() {
            beforeEach(function() { result = mat2d.multiplyScalar(out, matA, 2); });

            it("should place values into out", function() { expect(out).toBeEqualish([2, 4, 6, 8, 10, 12]); });
            it("should return out", function() { expect(result).toBe(out); });
            it("should not modify matA", function() { expect(matA).toBeEqualish([1, 2, 3, 4, 5, 6]); });
        });

        describe("when matA is the output matrix", function() {
            beforeEach(function() { result = mat2d.multiplyScalar(matA, matA, 2); });

            it("should place values into matA", function() { expect(matA).toBeEqualish([2, 4, 6, 8, 10, 12]); });
            it("should return matA", function() { expect(result).toBe(matA); });
        });
    });

    describe("multiplyScalarAndAdd", function() {
        describe("with a separate output matrix", function() {
            beforeEach(function() { result = mat2d.multiplyScalarAndAdd(out, matA, matB, 0.5); });

            it("should place values into out", function() { expect(out).toBeEqualish([4.5, 6, 7.5, 9, 10.5, 12]); });
            it("should return out", function() { expect(result).toBe(out); });
            it("should not modify matA", function() { expect(matA).toBeEqualish([1, 2, 3, 4, 5, 6]); });
            it("should not modify matB", function() { expect(matB).toBeEqualish([7, 8, 9, 10, 11, 12]); });
        });

        describe("when matA is the output matrix", function() {
            beforeEach(function() { result = mat2d.multiplyScalarAndAdd(matA, matA, matB, 0.5); });

            it("should place values into matA", function() { expect(matA).toBeEqualish([4.5, 6, 7.5, 9, 10.5, 12]); });
            it("should return matA", function() { expect(result).toBe(matA); });
            it("should not modify matB", function() { expect(matB).toBeEqualish([7, 8, 9, 10, 11, 12]); });
        });

        describe("when matB is the output matrix", function() {
            beforeEach(function() { result = mat2d.multiplyScalarAndAdd(matB, matA, matB, 0.5); });

            it("should place values into matB", function() { expect(matB).toBeEqualish([4.5, 6, 7.5, 9, 10.5, 12]); });
            it("should return matB", function() { expect(result).toBe(matB); });
            it("should not modify matA", function() { expect(matA).toBeEqualish([1, 2, 3, 4, 5, 6]); });
        });
    });

    describe("exactEquals", function() {
        var matC, r0, r1;
        beforeEach(function() {
            matA = [0, 1, 2, 3, 4, 5];
            matB = [0, 1, 2, 3, 4, 5];
            matC = [1, 2, 3, 4, 5, 6];
            r0 = mat2d.exactEquals(matA, matB);
            r1 = mat2d.exactEquals(matA, matC);
        });

        it("should return true for identical matrices", function() { expect(r0).toBe(true); });
        it("should return false for different matrices", function() { expect(r1).toBe(false); });
        it("should not modify matA", function() { expect(matA).toBeEqualish([0, 1, 2, 3, 4, 5]); });
        it("should not modify matB", function() { expect(matB).toBeEqualish([0, 1, 2, 3, 4, 5]); });
    });

    describe("equals", function() {
        var matC, matD, r0, r1, r2;
        beforeEach(function() {
            matA = [0, 1, 2, 3, 4, 5];
            matB = [0, 1, 2, 3, 4, 5];
            matC = [1, 2, 3, 4, 5, 6];
            matD = [1e-16, 1, 2, 3, 4, 5];
            r0 = mat2d.equals(matA, matB);
            r1 = mat2d.equals(matA, matC);
            r2 = mat2d.equals(matA, matD);
        });
        it("should return true for identical matrices", function() { expect(r0).toBe(true); });
        it("should return false for different matrices", function() { expect(r1).toBe(false); });
        it("should return true for close but not identical matrices", function() { expect(r2).toBe(true); });
        it("should not modify matA", function() { expect(matA).toBeEqualish([0, 1, 2, 3, 4, 5]); });
        it("should not modify matB", function() { expect(matB).toBeEqualish([0, 1, 2, 3, 4, 5]); });
    });

});


text:
#include "interpreterCore/robotsPluginFacade.h"

#include <qrkernel/settingsManager.h>
#include <qrkernel/platformInfo.h>
#include <qrutils/widgets/consoleDock.h>
#include <kitBase/robotModel/portInfo.h>
#include <twoDModel/engine/twoDModelEngineInterface.h>
#include <twoDModel/engine/twoDModelGuiFacade.h>
#include <twoDModel/robotModel/twoDRobotModel.h>

#include "src/coreBlocks/coreBlocksFactory.h"
#include "src/ui/robotsSettingsPage.h"
#include "interpreterCore/managers/paletteUpdateManager.h"
#include "interpreterCore/managers/kitAutoSwitcher.h"
#include "src/managers/exerciseExportManager.h"
#include "src/managers/uiManager.h"

using namespace interpreterCore;

RobotsPluginFacade::RobotsPluginFacade()
	: mInterpreter(nullptr)
	, mKitPluginManager(qReal::PlatformInfo::invariantSettingsPath("pathToToolPlugins") + "/kitPlugins")
	, mActionsManager(mKitPluginManager, mRobotModelManager)
	, mDockDevicesConfigurer(nullptr)
	, mGraphicsWatcherManager(nullptr)
{
	connect(&mRobotModelManager, &RobotModelManager::robotModelChanged
			, &mActionsManager, &ActionsManager::onRobotModelChanged);
}

RobotsPluginFacade::~RobotsPluginFacade()
{
	delete mInterpreter;
}

void RobotsPluginFacade::init(const qReal::PluginConfigurator &configurer)
{
	mActionsManager.init(&configurer.mainWindowInterpretersInterface());

	mRobotSettingsPage = new ui::RobotsSettingsPage(mKitPluginManager, mRobotModelManager
			, configurer.logicalModelApi());

	connect(&configurer.systemEvents(), &qReal::SystemEvents::activeTabChanged
			, mRobotSettingsPage, &ui::RobotsSettingsPage::onProjectOpened);

	mDevicesConfigurationManager.reset(new DevicesConfigurationManager(
			configurer.graphicalModelApi()
			, configurer.logicalModelApi()
			, configurer.mainWindowInterpretersInterface()
			, configurer.projectManager()
			));

	if (!selectKit(configurer)) {
		/// @todo Correctly handle unselected kit.
		return;
	}

	mParser.reset(new textLanguage::RobotsBlockParser(mRobotModelManager
			, [this]() { return mInterpreter ? mInterpreter->timeElapsed() : 0; }));

	kitBase::blocksBase::BlocksFactoryInterface * const coreFactory = new coreBlocks::CoreBlocksFactory();
	coreFactory->configure(configurer.graphicalModelApi()
			, configurer.logicalModelApi()
			, mRobotModelManager
			, *configurer.mainWindowInterpretersInterface().errorReporter()
			, *mParser
			);

	mBlocksFactoryManager.addFactory(coreFactory);

	mUiManager.reset(new UiManager(mActionsManager.debugModeAction()
			, mActionsManager.editModeAction()
			, configurer.mainWindowDockInterface()
			, configurer.systemEvents()
			, mEventsForKitPlugin
			, mRobotModelManager));

	interpreter::Interpreter *interpreter = new interpreter::Interpreter(
			configurer.graphicalModelApi()
			, configurer.logicalModelApi()
			, configurer.mainWindowInterpretersInterface()
			, configurer.projectManager()
			, mBlocksFactoryManager
			, mRobotModelManager
			, *mParser
			, mActionsManager.connectToRobotAction()
			);

	mInterpreter = interpreter;

	connect(&configurer.systemEvents(), &qReal::SystemEvents::closedMainWindow
			, mInterpreter, &interpreter::InterpreterInterface::userStopRobot);
	connect(&mRobotModelManager, &RobotModelManager::robotModelChanged
			, mInterpreter, &interpreter::InterpreterInterface::userStopRobot);

	initKitPlugins(configurer);

	initSensorWidgets();

	auto paletteUpdateManager = new PaletteUpdateManager(configurer.mainWindowInterpretersInterface()
			, mBlocksFactoryManager, this);
	connect(&mRobotModelManager, &RobotModelManager::robotModelChanged
			, paletteUpdateManager, &PaletteUpdateManager::updatePalette);
	mDevicesConfigurationManager->connectDevicesConfigurationProvider(interpreter);

	// It will subscribe to all signals itself and free memory too.
	new KitAutoSwitcher(configurer.projectManager(), configurer.logicalModelApi()
			, mBlocksFactoryManager, mKitPluginManager, mRobotModelManager, this);

	mSaveAsTaskManager.reset(new ExerciseExportManager(configurer.logicalModelApi()
			, configurer.repoControlInterface(), configurer.projectManager()));

	connectInterpreterToActions();

	connectEventsForKitPlugin();

	connect(&mActionsManager.robotSettingsAction(), &QAction::triggered
			, [=] () { configurer.mainWindowInterpretersInterface().openSettingsDialog(tr("Robots")); });

	connect(&configurer.systemEvents(), &qReal::SystemEvents::activeTabChanged
			, &mActionsManager, &ActionsManager::onActiveTabChanged);

	// Just to capture them, not configurer.
	qReal::ProjectManagementInterface &projectManager = configurer.projectManager();
	qReal::gui::MainWindowInterpretersInterface &mainWindow = configurer.mainWindowInterpretersInterface();
	qReal::GraphicalModelAssistInterface &graphicalModel = configurer.graphicalModelApi();
	connect(&mActionsManager.homeAction(), &QAction::triggered, [&projectManager, &mainWindow, &graphicalModel]() {
		if (projectManager.somethingOpened()) {
			for (const qReal::Id &diagram : graphicalModel.children(qReal::Id::rootId())) {
				if (diagram.type() == qReal::Id("RobotsMetamodel", "RobotsDiagram", "RobotsDiagramNode")) {
					mainWindow.activateItemOrDiagram(diagram);
					return;
				}
			}
		} else {
			mainWindow.openStartTab();
		}
	});

	const qrRepo::LogicalRepoApi &repoApi = configurer.logicalModelApi().logicalRepoApi();

	connect(&configurer.systemEvents(), &qReal::SystemEvents::activeTabChanged, this
			, [this, &repoApi] (const qReal::TabInfo &info) {
				Q_UNUSED(info);

				mDockDevicesConfigurer->setEnabled(
						!repoApi.metaInformation("twoDModelSensorsReadOnly").toBool());

				const bool hasReadOnlyFlags = repoApi.metaInformation("twoDModelWorldReadOnly").toBool()
						| repoApi.metaInformation("twoDModelSensorsReadOnly").toBool()
						| repoApi.metaInformation("twoDModelRobotPositionReadOnly").toBool()
						| repoApi.metaInformation("twoDModelRobotConfigurationReadOnly").toBool()
						| repoApi.metaInformation("twoDModelSimulationSettingsReadOnly").toBool()
						;

				mActionsManager.exportExerciseAction().setEnabled(!hasReadOnlyFlags);
			});

	connect(&mActionsManager.exportExerciseAction(), &QAction::triggered
			, [this] () { mSaveAsTaskManager->save(); });

	sync();
}

qReal::gui::PreferencesPage *RobotsPluginFacade::robotsSettingsPage() const
{
	return mRobotSettingsPage;
}

interpreterCore::Customizer &RobotsPluginFacade::customizer()
{
	return mCustomizer;
}

ActionsManager &RobotsPluginFacade::actionsManager()
{
	return mActionsManager;
}

QObject *RobotsPluginFacade::guiScriptFacade() const
{
	const auto robotModel = dynamic_cast<twoDModel::robotModel::TwoDRobotModel *>(&mRobotModelManager.model());
	if (robotModel) {
		return &robotModel->engine()->guiFacade();
	}

	return nullptr;
}

QStringList RobotsPluginFacade::defaultSettingsFiles() const
{
	QStringList result = { ":/interpreterCoreDefaultSettings.ini" };
	for (const QString &kitId : mKitPluginManager.kitIds()) {
		for (kitBase::KitPluginInterface * const kit : mKitPluginManager.kitsById(kitId)) {
			const QString defaultSettings = kit->defaultSettingsFile();
			if (!defaultSettings.isEmpty()) {
				result << defaultSettings;
			}
		}
	}

	return result;
}

interpreter::InterpreterInterface &RobotsPluginFacade::interpreter() const
{
	return *mInterpreter;
}

void RobotsPluginFacade::connectInterpreterToActions()
{
	QObject::connect(
			&mActionsManager.runAction()
			, &QAction::triggered
			, mInterpreter
			, &interpreter::InterpreterInterface::interpret
			);

	QObject::connect(
			&mActionsManager.stopRobotAction()
			, &QAction::triggered
			, mInterpreter
			, &interpreter::InterpreterInterface::userStopRobot
			);

	QObject::connect(
			&mActionsManager.connectToRobotAction()
			, &QAction::triggered
			, mInterpreter
			, &interpreter::InterpreterInterface::connectToRobot
			);
}

bool RobotsPluginFacade::selectKit(const qReal::PluginConfigurator &configurer)
{
	/// @todo reinit it each time when robot model changes
	/// @todo: do we need this method?
	const QString selectedKit = qReal::SettingsManager::value("SelectedRobotKit").toString();
	if (selectedKit.isEmpty() && !mKitPluginManager.kitIds().isEmpty()) {
		qReal::SettingsManager::setValue("SelectedRobotKit", mKitPluginManager.kitIds()[0]);
	} else if (mKitPluginManager.kitIds().isEmpty()) {
		configurer.mainWindowInterpretersInterface().setEnabledForAllElementsInPalette(false);

		/// @todo Correctly handle unselected kit.
		return false;
	}

	return true;
}

void RobotsPluginFacade::initSensorWidgets()
{
	mDockDevicesConfigurer = new kitBase::DevicesConfigurationWidget(nullptr, true);
	mDockDevicesConfigurer->loadRobotModels(mKitPluginManager.allRobotModels());
	connect(&mRobotModelManager, &RobotModelManager::robotModelChanged
			, mDockDevicesConfigurer, &kitBase::DevicesConfigurationWidget::selectRobotModel);

	mWatchListWindow = new utils::WatchListWindow(*mParser);

	auto hideVariables = [=]() { mWatchListWindow->hideVariables(mParser->hiddenVariables()); };
	hideVariables();
	connect(&mRobotModelManager, &RobotModelManager::robotModelChanged, hideVariables);

	mGraphicsWatcherManager = new GraphicsWatcherManager(*mParser, mRobotModelManager, this);
	connect(mInterpreter, &interpreter::InterpreterInterface::started
			, mGraphicsWatcherManager, &GraphicsWatcherManager::forceStart);
	connect(mInterpreter, &interpreter::InterpreterInterface::stopped
			, mGraphicsWatcherManager, &GraphicsWatcherManager::forceStop);
	connect(mInterpreter, &interpreter::InterpreterInterface::started, mGraphicsWatcherManager, [=]() {
		mActionsManager.runAction().setVisible(false);
		mActionsManager.stopRobotAction().setVisible(mRobotModelManager.model().interpretedModel());
	});
	connect(mInterpreter, &interpreter::InterpreterInterface::stopped, mGraphicsWatcherManager, [=]() {
		mActionsManager.runAction().setVisible(mRobotModelManager.model().interpretedModel());
		mActionsManager.stopRobotAction().setVisible(false);
	});

	mUiManager->placeDevicesConfig(mDockDevicesConfigurer);
	mUiManager->placeWatchPlugins(mWatchListWindow, mGraphicsWatcherManager->widget());
	mActionsManager.appendHotKey("View.ToggleRobotConsole", tr("Toggle robot console panel")
			, *mUiManager->robotConsole().toggleViewAction());
	for (kitBase::robotModel::RobotModelInterface * const model : mKitPluginManager.allRobotModels()) {
		for (kitBase::KitPluginInterface * const kit : mKitPluginManager.kitsById(model->kitId())) {
			mUiManager->addWidgetToToolbar(*model, kit->quickPreferencesFor(*model));
		}
	}

	mDevicesConfigurationManager->connectDevicesConfigurationProvider(mRobotSettingsPage);
	mDevicesConfigurationManager->connectDevicesConfigurationProvider(mDockDevicesConfigurer);
	mDevicesConfigurationManager->connectDevicesConfigurationProvider(mGraphicsWatcherManager);
}

void RobotsPluginFacade::initKitPlugins(const qReal::PluginConfigurator &configurer)
{
	/// @todo: Check that this code works when different kit is selected
	for (const QString &kitId : mKitPluginManager.kitIds()) {
		for (kitBase::KitPluginInterface * const kit : mKitPluginManager.kitsById(kitId)) {
			kit->init(kitBase::KitPluginConfigurator(configurer
					, mRobotModelManager, *mParser, mEventsForKitPlugin, *mInterpreter));

			for (const kitBase::robotModel::RobotModelInterface *model : kit->robotModels()) {
				initFactoriesFor(kitId, model, configurer);
				connect(&mEventsForKitPlugin, &kitBase::EventsForKitPluginInterface::interpretationStarted
						, model, &kitBase::robotModel::RobotModelInterface::onInterpretationStarted);
			}

			mDevicesConfigurationManager->connectDevicesConfigurationProvider(kit->devicesConfigurationProvider());
		}
	}
}

void RobotsPluginFacade::initFactoriesFor(const QString &kitId
		, const kitBase::robotModel::RobotModelInterface *model
		, const qReal::PluginConfigurator &configurer)
{
	// Pulling each robot model to each kit plugin with same ids. We need it for supporting
	// plugin-based blocks set extension for concrete roobt model.
	for (kitBase::KitPluginInterface * const kit : mKitPluginManager.kitsById(kitId)) {
		kitBase::blocksBase::BlocksFactoryInterface * const factory = kit->blocksFactoryFor(model);
		if (factory) {
			/// @todo Non-obvious dependency on mParser, which may or may not be constructed here.
			///       More functional style will be helpful here.
			factory->configure(configurer.graphicalModelApi()
					, configurer.logicalModelApi()
					, mRobotModelManager
					, *configurer.mainWindowInterpretersInterface().errorReporter()
					, *mParser
					);

			mBlocksFactoryManager.addFactory(factory, model);
		}
	}
}

void RobotsPluginFacade::connectEventsForKitPlugin()
{
	QObject::connect(
			mInterpreter
			, &interpreter::InterpreterInterface::started
			, &mEventsForKitPlugin
			, &kitBase::EventsForKitPluginInterface::interpretationStarted
			);

	QObject::connect(
			mInterpreter
			, &interpreter::InterpreterInterface::stopped
			, &mEventsForKitPlugin
			, &kitBase::EventsForKitPluginInterface::interpretationStopped
			);

	QObject::connect(
			&mRobotModelManager
			, &RobotModelManager::robotModelChanged
			, [this](kitBase::robotModel::RobotModelInterface &model) {
				emit mEventsForKitPlugin.robotModelChanged(model.name());
			}
			);
}

void RobotsPluginFacade::sync()
{
	mRobotModelManager.sync();
}


text:
NSString* const kMMPNumberTableViewCellIdentifier = @"MMPNumberTableViewCell";

@implementation MMPNumberTableViewCell

@end


text:
package com.dethemium.syncserver;

import com.dethemium.syncserver.message.ChatMessage;
import com.dethemium.syncserver.message.LoginMessage;
import com.dethemium.syncserver.message.Message;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;
import io.netty.channel.group.ChannelGroup;
import io.netty.channel.group.DefaultChannelGroup;
import io.netty.util.concurrent.GlobalEventExecutor;

public class SyncServerHandler extends SimpleChannelInboundHandler<Message> {
    public boolean loggedIn = false;
    public static final ChannelGroup channels = new DefaultChannelGroup(GlobalEventExecutor.INSTANCE);

    @Override
    protected void channelRead0(ChannelHandlerContext channelHandlerContext, Message message) throws Exception {
        if (!(message instanceof LoginMessage) && !loggedIn) {
            System.out.println("Message out of sequence!");
            channelHandlerContext.channel().close();
        } else {
            message.handle();
            if (message instanceof LoginMessage){
                loggedIn = ((LoginMessage)message).loggedIn;
            }
        }
    }

    @Override
    public void channelReadComplete(ChannelHandlerContext ctx) {
        ctx.flush();
    }

    @Override
    public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
        cause.printStackTrace();
        ctx.close();
    }
}


text:
EXE=./tester
ROOT=../clientbazil/root
#ROOT=tests/data

for i in 2k 4k 16k 256k 4m 16m 64m
do
 $EXE SingleAccess $ROOT/blob-$i 1
 $EXE SingleAccess $ROOT/blob-$i 20
 $EXE SingleReadWrite $ROOT/blob-$i r 5
 $EXE SingleReadWrite $ROOT/blob-$i w 5
done


text:
<!doctype html>

        <meta charset="utf-8">
        <meta http-equiv="x-ua-compatible" content="ie=edge">
        <title></title>
        <meta name="description" content="">
        <meta name="viewport" content="width=device-width, initial-scale=1">

        <link rel="apple-touch-icon" href="apple-touch-icon.png">

        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">

        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css" integrity="sha384-fLW2N01lMqjakBkx3l/M9EahuwpSfeNvV63J5ezn3uZzapT0u7EYsXMjQV+0En5r" crossorigin="anonymous">

        <link rel="stylesheet" href="css/app.css">

      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
        Toggle navigation

      </button>
      Aron Prenovost

About Me (current)

Projects

Contact

Action

Another action

Something else here

Separated link

One more separated link

          Dropdown

Action

Another action

Something else here

Separated link


text:
package org.thymeleaf.spring6.webflow.view;

import java.io.IOException;
import java.util.Locale;

import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.servlet.View;
import org.springframework.web.servlet.view.RedirectView;
import org.springframework.webflow.context.servlet.AjaxHandler;
import org.springframework.webflow.context.servlet.DefaultAjaxHandler;
import org.thymeleaf.exceptions.ConfigurationException;
import org.thymeleaf.spring6.view.ThymeleafViewResolver;

/**
 *

 *   Subclass of {@link ThymeleafViewResolver} adding compatibility with AJAX-based events
 *   (redirects) in Spring WebFlow.
 *

 *

 *   Important: Spring WebFlow dependencies are OPTIONAL. If you are not using WebFlow
 *   in your application, then you should be using {@link ThymeleafViewResolver} directly.
 *

 *
 * @author Daniel Fernández
 *
 * @since 3.0.3
 *
 */
public class AjaxThymeleafViewResolver
        extends ThymeleafViewResolver {

    private static final Logger vrlogger = LoggerFactory.getLogger(AjaxThymeleafViewResolver.class);

    private AjaxHandler ajaxHandler = new DefaultAjaxHandler();

    public AjaxThymeleafViewResolver() {
        super();
    }

    /**
     *

     *   Return the AJAX handler (from Spring Javascript) used
     *   to determine whether a request is an AJAX request or not
     *   in views resolved by this resolver.
     *

     *

     *   An instance of {@link DefaultAjaxHandler} is set by default.
     *

     *
     * @return the AJAX handler.
     */
    public AjaxHandler getAjaxHandler() {
        return this.ajaxHandler;
    }

    /**
     *

     *   Sets the AJAX handler (from Spring Javascript) used
     *   to determine whether a request is an AJAX request or not
     *   in views resolved by this resolver.
     *

     *

     *   An instance of {@link DefaultAjaxHandler} is set by default.
     *

     *
     * @param ajaxHandler the AJAX handler.
     */
    public void setAjaxHandler(final AjaxHandler ajaxHandler) {
        this.ajaxHandler = ajaxHandler;
    }

    @Override
    protected View createView(final String viewName, final Locale locale) throws Exception {

        if (!canHandle(viewName, locale)) {
            return null;
        }

        if (this.ajaxHandler == null) {
            throw new ConfigurationException("[THYMELEAF] AJAX Handler set into " +
                    AjaxThymeleafViewResolver.class.getSimpleName() + " instance is null.");
        }

        // Check for special "redirect:" prefix.
        if (viewName.startsWith(REDIRECT_URL_PREFIX)) {
            vrlogger.trace(
                    "[THYMELEAF] View {} is a redirect. An AJAX-enabled RedirectView implementation will " +
            		"be handling the request.", viewName);
            final String redirectUrl = viewName.substring(REDIRECT_URL_PREFIX.length());
            return new AjaxRedirectView(
                    this.ajaxHandler, redirectUrl, isRedirectContextRelative(), isRedirectHttp10Compatible());
        }

        final View view = super.createView(viewName, locale);

        if (view instanceof AjaxEnabledView) {
            // Set the AJAX handler into view, if it is an AjaxThymeleafView.

            final AjaxEnabledView ajaxEnabledView = (AjaxEnabledView) view;

            if (ajaxEnabledView.getAjaxHandler() == null && getAjaxHandler() != null) {
                ajaxEnabledView.setAjaxHandler(getAjaxHandler());
            }

        }

        return view;

    }

    private static class AjaxRedirectView extends RedirectView {

        private static final Logger vlogger = LoggerFactory.getLogger(AjaxRedirectView.class);

        private AjaxHandler ajaxHandler = new DefaultAjaxHandler();

        AjaxRedirectView(final AjaxHandler ajaxHandler, final String redirectUrl,
                final boolean redirectContextRelative, final boolean redirectHttp10Compatible) {
            super(redirectUrl, redirectContextRelative, redirectHttp10Compatible);
            this.ajaxHandler = ajaxHandler;
        }

        @Override
        protected void sendRedirect(final HttpServletRequest request, final HttpServletResponse response,
                final String targetUrl, final boolean http10Compatible)
                throws IOException {

            if (this.ajaxHandler == null) {
                throw new ConfigurationException("[THYMELEAF] AJAX Handler set into " +
                        AjaxThymeleafViewResolver.class.getSimpleName() + " instance is null.");
            }

            if (this.ajaxHandler.isAjaxRequest(request, response)) {
                if (vlogger.isTraceEnabled()) {
                    vlogger.trace(
                            "[THYMELEAF] RedirectView for URL \"{}\" is an AJAX request. AjaxHandler of class {} " +
                            "will be in charge of processing the request.", targetUrl, this.ajaxHandler.getClass().getName());
                }
                this.ajaxHandler.sendAjaxRedirect(targetUrl, request, response, false);
            } else {
                vlogger.trace(
                        "[THYMELEAF] RedirectView for URL \"{}\" is not an AJAX request. Request will be handled " +
                        "as a normal redirect", targetUrl);
                super.sendRedirect(request, response, targetUrl, http10Compatible);
            }
        }

    }

}


text:
package com.halo.spring.data.jpa.example.chapter5;

import org.springframework.data.repository.RepositoryDefinition;

import com.halo.spring.data.jpa.example.chapter4.User;

@RepositoryDefinition(domainClass = User.class, idClass = Long.class)
public interface UserRepositoryDefinition {

    /**
     * Spring data 根据方法名规则的定义查询用户信息
     *
     * @param username
     * @return
     */
    User findByUsername(String username);

    void save(User user);
}


text:
package de.fhg.iais.asc.workflow;

import static de.fhg.iais.cortex.report.common.sip.ErrorSip.SECTION_TRANSFORM;

import java.io.File;
import java.util.Iterator;

import org.apache.commons.io.FileUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import de.fhg.iais.asc.commons.AscConfigEval;
import de.fhg.iais.asc.commons.AscConfiguration;
import de.fhg.iais.asc.commons.AscContext;
import de.fhg.iais.asc.commons.LogMessageBuilder;
import de.fhg.iais.asc.commons.PathNameUtils;
import de.fhg.iais.asc.commons.state.ASCState;
import de.fhg.iais.asc.contexts.AscProviderIngest;
import de.fhg.iais.asc.directories.AscDirectory;
import de.fhg.iais.asc.logging.ILogVocabulary;
import de.fhg.iais.asc.sipmaker.ISipMaker;
import de.fhg.iais.asc.sipmaker.SipMakerFactory;
import de.fhg.iais.asc.sipmaker.SipMakerKey;
import de.fhg.iais.asc.transformer.TransformationContext;
import de.fhg.iais.asc.transformer.jdom.AbstractTransformer;
import de.fhg.iais.asc.transformer.jdom.TransformDoc;
import de.fhg.iais.asc.transformer.jdom.TransformDocBuilder;
import de.fhg.iais.asc.transformer.jdom.TransformDocContextImpl;
import de.fhg.iais.asc.transformer.jdom.splitter.AscSplitLimitExceededException;
import de.fhg.iais.asc.viewspreview.ViewFilesGenerator;
import de.fhg.iais.commons.time.StopWatch;
import de.fhg.iais.cortex.report.common.sip.ErrorSip;

/**
 * This class manages the transformation processes of the Augmented SIP Creator (ASC)
 *
 * @author hjh, cto, kst
 */
final class ASCTransform {
    private static final Logger LOG = LoggerFactory.getLogger(ASCTransform.class);

    private static final String[] INBOX_EXTENSIONS = {
        "xml", "XML"
    };

    private final AscConfiguration config;
    private final ISipMaker maker;

    public ASCTransform(AscConfiguration config, SipMakerFactory makerFactory) {
        this.config = config;
        this.maker = loadMaker(makerFactory);
    }

    protected final ISipMaker loadMaker(SipMakerFactory factory) {
        String def = this.config.get(AscConfiguration.FORMAT, "");
        SipMakerKey description = SipMakerKey.fromCommaSeparated(def);
        return factory.getSipMaker(description, true, this.config);
    }

    /**
     * Transforms a single ingest.
     *
     * @param ingest The ingest to process, non-{@code null}.
     * @param parentAscContext The ASC context in which this method is executed, non-{@code null}.
     */
    public void run(AscProviderIngest ingest, AscContext parentAscContext) {
        AscContext ascContext = new AscContext(ILogVocabulary.EVENT_INGEST + "(" + ingest.getIngestEventId() + ")");
        try {
            AscConfiguration config = ingest.getConfiguration();
            ASCState ascState = config.getASCState();

            logInfoAndDisplayMessage("Removing errors from previous transformations ...", ascContext);
            ingest.removeOldErrors(ErrorSip.SECTION_TRANSFORM);

            if ( AscConfigEval.isCleanupEnabled(config) ) {
                logInfoAndDisplayMessage("Removing result directories from previous transformations ...", ascContext);
                ingest.removeDirectory(AscDirectory.WORKSPACE);
                ingest.removeDirectory(AscDirectory.OUTBOX);
            }

            logInfoAndDisplayMessage("Transforming ...", ascContext);
            executeTransformations(ingest, ascContext);

            // Interrupt if needed.
            if ( ascState.isCancelRequested() ) {
                return;
            }

            // For debugging, generate HTML files out of the views of the generated SIPs.
            if ( this.config.get(AscConfiguration.GENERATEHTMLPREVIEWS, false) ) {
                String folder = ingest.checkedGetDirectory(AscDirectory.OUTBOX).getPath();
                logInfoAndDisplayMessage("Generating previews", ascContext);
                logInfoAndDisplayMessage("Folder is " + folder, ascContext);
                new ViewFilesGenerator(folder, config).generateViewFiles();
            }
        } catch ( Exception e ) {
            logWarnAndReportProblem("The transformation process of ingest event " + ingest.getIngestEventId() + " failed", ascContext);

            // Write an error SIP.
            // At this point, we don't have a filename, so leave it empty.
            ingest.writeErrorSip(ErrorSip.SECTION_TRANSFORM, "", e);
        }
    }

    private void executeTransformations(AscProviderIngest ingest, AscContext parentAscContext) {
        TransformationContext transContext = new TransformationContext(ingest);
        transContext.register();
        try {
            executeTransformations(transContext, parentAscContext);
        } finally {
            transContext.unregister();
        }
    }

    private void executeTransformations(final TransformationContext transContext, AscContext parentAscContext) {
        StopWatch s = StopWatch.start();

        final int maxFileCount = this.config.get(AscConfiguration.MAX_FILES_EACH, Integer.MAX_VALUE);
        int remainingFileCount = maxFileCount;

        final AbstractTransformer transformer = this.maker.getRootTransformer();

        final TransformDocContextImpl transDocContext = new TransformDocContextImpl(transContext, this.maker.getInputSchema());
        final TransformDocBuilder builder = new TransformDocBuilder().withContext(transDocContext);

        final File root = transDocContext.getInboxRoot().getAbsoluteFile();

        final Iterator<File> fileIter = FileUtils.iterateFiles(root, INBOX_EXTENSIONS, true);

        while ( fileIter.hasNext() ) {
            if ( --remainingFileCount < 0 ) {
                LOG.info("Transformation stopped by " + AscConfiguration.MAX_FILES_EACH + "=" + maxFileCount, parentAscContext);
                break;
            }

            final File f = fileIter.next();
            final String relativePath = PathNameUtils.unbase(f, root);
            AscContext ascContext = new AscContext(ILogVocabulary.INPUT + "(" + relativePath + ")", parentAscContext);
            try {
                final TransformDoc transformDoc = builder.withPath(relativePath).build();
                try {
                    transformer.transform(transformDoc, ascContext);
                } catch ( AscSplitLimitExceededException e ) {
                    LOG.info(LogMessageBuilder.getMessage(e));
                }
            } catch ( Exception e ) {
                transContext.getIngest().writeErrorSip(SECTION_TRANSFORM, relativePath, e);
                builder.withPath(relativePath).build().updateAscErrorLoggingStatistic(transformer.getName(), e);
                LOG.error(LogMessageBuilder.getMessage("Transformation of " + relativePath + " failed", ascContext), e);
            }
        }
        s.stop("Time used for transformations");

    }

    private void logInfoAndDisplayMessage(String message, AscContext ascContext) {
        message = LogMessageBuilder.getMessage(message, ascContext);
        LOG.info(message);
        if ( this.config != null && this.config.getASCState() != null ) {
            this.config.getASCState().displayMessage(message);
        }
    }

    private void logWarnAndReportProblem(String message, AscContext ascContext) {
        message = LogMessageBuilder.getMessage(message, ascContext);
        LOG.warn(message);
        if ( this.config != null && this.config.getASCState() != null ) {
            this.config.getASCState().reportProblem(message);
        }
    }

}


text:
layout: page
title: Wiki
description: 人越学越觉得自己无知
keywords: 维基, Wiki

menu: 维基
permalink: /wiki/
---

> Place to record and integrate some basic commands and usage...

{% for wiki in site.wiki %}
{% if wiki.title != "Wiki Template" %}

{{ wiki.title }}

{% endif %}
{% endfor %}


text:
namespace elang {

ZoneOwner::ZoneOwner(ZoneOwner&& other) : zone_(std::move(other.zone_)) {
}

ZoneOwner::ZoneOwner() {
}

ZoneOwner::~ZoneOwner() {
}

ZoneOwner& ZoneOwner::operator=(ZoneOwner&& other) {
  zone_ = std::move(other.zone_);
  return *this;
}

void* ZoneOwner::Allocate(size_t size) {
  return zone()->Allocate(size);
}

}  // namespace elang


text:
package getter

import (
	"bytes"
	"net/http"
	"time"

	"github.com/pkg/errors"

	"helm.sh/helm/v3/pkg/cli"
	"helm.sh/helm/v3/pkg/registry"
)

// options are generic parameters to be provided to the getter during instantiation.
//
// Getters may or may not ignore these parameters as they are passed in.
type options struct {
	url                   string
	certFile              string
	keyFile               string
	caFile                string
	unTar                 bool
	insecureSkipVerifyTLS bool
	username              string
	password              string
	passCredentialsAll    bool
	userAgent             string
	version               string
	registryClient        *registry.Client
	timeout               time.Duration
	transport             *http.Transport
}

// Option allows specifying various settings configurable by the user for overriding the defaults
// used when performing Get operations with the Getter.
type Option func(*options)

// WithURL informs the getter the server name that will be used when fetching objects. Used in conjunction with
// WithTLSClientConfig to set the TLSClientConfig's server name.
func WithURL(url string) Option {
	return func(opts *options) {
		opts.url = url
	}
}

// WithBasicAuth sets the request's Authorization header to use the provided credentials
func WithBasicAuth(username, password string) Option {
	return func(opts *options) {
		opts.username = username
		opts.password = password
	}
}

func WithPassCredentialsAll(pass bool) Option {
	return func(opts *options) {
		opts.passCredentialsAll = pass
	}
}

// WithUserAgent sets the request's User-Agent header to use the provided agent name.
func WithUserAgent(userAgent string) Option {
	return func(opts *options) {
		opts.userAgent = userAgent
	}
}

// WithInsecureSkipVerifyTLS determines if a TLS Certificate will be checked
func WithInsecureSkipVerifyTLS(insecureSkipVerifyTLS bool) Option {
	return func(opts *options) {
		opts.insecureSkipVerifyTLS = insecureSkipVerifyTLS
	}
}

// WithTLSClientConfig sets the client auth with the provided credentials.
func WithTLSClientConfig(certFile, keyFile, caFile string) Option {
	return func(opts *options) {
		opts.certFile = certFile
		opts.keyFile = keyFile
		opts.caFile = caFile
	}
}

// WithTimeout sets the timeout for requests
func WithTimeout(timeout time.Duration) Option {
	return func(opts *options) {
		opts.timeout = timeout
	}
}

func WithTagName(tagname string) Option {
	return func(opts *options) {
		opts.version = tagname
	}
}

func WithRegistryClient(client *registry.Client) Option {
	return func(opts *options) {
		opts.registryClient = client
	}
}

func WithUntar() Option {
	return func(opts *options) {
		opts.unTar = true
	}
}

// WithTransport sets the http.Transport to allow overwriting the HTTPGetter default.
func WithTransport(transport *http.Transport) Option {
	return func(opts *options) {
		opts.transport = transport
	}
}

// Getter is an interface to support GET to the specified URL.
type Getter interface {
	// Get file content by url string
	Get(url string, options ...Option) (*bytes.Buffer, error)
}

// Constructor is the function for every getter which creates a specific instance
// according to the configuration
type Constructor func(options ...Option) (Getter, error)

// Provider represents any getter and the schemes that it supports.
//
// For example, an HTTP provider may provide one getter that handles both
// 'http' and 'https' schemes.
type Provider struct {
	Schemes []string
	New     Constructor
}

// Provides returns true if the given scheme is supported by this Provider.
func (p Provider) Provides(scheme string) bool {
	for _, i := range p.Schemes {
		if i == scheme {
			return true
		}
	}
	return false
}

// Providers is a collection of Provider objects.
type Providers []Provider

// ByScheme returns a Provider that handles the given scheme.
//
// If no provider handles this scheme, this will return an error.
func (p Providers) ByScheme(scheme string) (Getter, error) {
	for _, pp := range p {
		if pp.Provides(scheme) {
			return pp.New()
		}
	}
	return nil, errors.Errorf("scheme %q not supported", scheme)
}

var httpProvider = Provider{
	Schemes: []string{"http", "https"},
	New:     NewHTTPGetter,
}

var ociProvider = Provider{
	Schemes: []string{registry.OCIScheme},
	New:     NewOCIGetter,
}

// All finds all of the registered getters as a list of Provider instances.
// Currently, the built-in getters and the discovered plugins with downloader
// notations are collected.
func All(settings *cli.EnvSettings) Providers {
	result := Providers{httpProvider, ociProvider}
	pluginDownloaders, _ := collectPlugins(settings)
	result = append(result, pluginDownloaders...)
	return result
}


text:
from org.apache.flink.api.common.functions import FlatMapFunction, ReduceFunction
from org.apache.flink.api.java.functions import KeySelector
from org.apache.flink.streaming.api.windowing.time.Time import milliseconds

from utils import constants
from utils.python_test_base import TestBase

class Tokenizer(FlatMapFunction):
    def flatMap(self, value, collector):
        collector.collect((1, value))

class Sum(ReduceFunction):
    def reduce(self, input1, input2):
        count1, val1 = input1
        count2, val2 = input2
        return (count1 + count2, val1)

class Selector(KeySelector):
    def getKey(self, input):
        return input[1][0]

class Main(TestBase):
    def __init__(self):
        super(Main, self).__init__()

    def run(self):
        elements = [("Alice", 111) if iii % 2 == 0 else ("Bob", 2222) for iii in range(constants.NUM_ELEMENTS_IN_TEST)]

        env = self._get_execution_environment()
        env.from_elements(*elements) \
            .flat_map(Tokenizer()) \
            .key_by(Selector()) \
            .time_window(milliseconds(10)) \
            .reduce(Sum()) \
            .print()

        result = env.execute("MyJob", True)
        print("Job completed, job_id={}".format(result.jobID))

def main():
    Main().run()

if __name__ == '__main__':
    main()


text:
<?xml version="1.0" encoding="UTF-8" ?>
<!--
  Copyright (c) 2014 The Chromium Authors. All rights reserved.
  Use of this source code is governed by a BSD-style license that can be
  found in the LICENSE file.
-->
<plugin xmlns="http://cordova.apache.org/ns/plugins/1.0"
    id="cordova-plugin-chrome-apps-bluetooth"
    version="1.1.6-dev">
  <engines>
    <engine name="cordova" version=">=3.0.0" />
  </engines>

  <name>Chrome Apps Bluetooth API</name>
  <keywords>chrome,bluetooth</keywords>
  <repo>https://github.com/MobileChromeApps/cordova-plugin-chrome-apps-bluetooth.git</repo>
  <issue>https://github.com/MobileChromeApps/cordova-plugin-chrome-apps-bluetooth/issues</issue>

  <dependency id="cordova-plugin-chrome-apps-common@1" />

  <js-module src="bluetooth.js" name="bluetooth">
    <clobbers target="chrome.bluetooth" />
  </js-module>

  <platform name="android">
    <source-file src="src/android/ChromeBluetooth.java" target-dir="src/org/chromium" />
    <source-file src="src/android/libs/blescan.jar" target-dir="libs" />
    <!-- Required by blescan.jar -->
    <framework src="com.android.support:support-v4:+" />

    <config-file target="AndroidManifest.xml" parent="/manifest">
      <uses-permission android:name="android.permission.WAKE_LOCK" />
    </config-file>
    <config-file target="AndroidManifest.xml" parent="/manifest">
      <uses-permission android:name="android.permission.BLUETOOTH" />
    </config-file>
    <config-file target="AndroidManifest.xml" parent="/manifest">
      <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
    </config-file>
    <config-file target="AndroidManifest.xml" parent="/manifest">
      <uses-feature android:name="android.hardware.bluetooth_le" android:required="true" />
    </config-file>
    <config-file target="AndroidManifest.xml" parent="/manifest">
      <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="21" />
    </config-file>

    <config-file target="AndroidManifest.xml" parent="/manifest/application">
      <service
          android:name="org.uribeacon.scan.compat.ScanWakefulService"
          android:exported="false" />
      <receiver android:name="org.uribeacon.scan.compat.ScanWakefulBroadcastReceiver" />
    </config-file>

    <config-file target="res/xml/config.xml" parent="/widget">
      <feature name="ChromeBluetooth">
        <param name="android-package" value="org.chromium.ChromeBluetooth" />
      </feature>
    </config-file>
  </platform>

  <platform name="ios">
    <framework src="CoreBluetooth.framework" />
    <source-file src="src/ios/ChromeBluetooth.h" />
    <source-file src="src/ios/ChromeBluetooth.m" />

    <config-file target="config.xml" parent="/widget">
      <feature name="ChromeBluetooth">
        <param name="ios-package" value="ChromeBluetooth"/>
      </feature>
    </config-file>
  </platform>
</plugin>


text:
@implementation ManUtdTeamData

- (instancetype) initFullNamePlayer:(NSString *)fullName
               andSquadNumberPlayer:(NSNumber *)squadNumber
                  andPositionPlayer:(NSString *)positionPlayer{

    if (self = [super init]) {
        self.fullNamePlayer = fullName;
        self.squadNumberPlayer = squadNumber;
        self.positionPlayer = positionPlayer;
        NSLog(@"%@",fullName);
    }
    return self;
}

@end


text:
using Android.App;
using Cirrious.MvvmCross.Android.Views;

namespace Cheesebaron.HorizontalListView.Droid
{
    [Activity(Label = "Horizontal ListView Demo", MainLauncher = true, NoHistory = true, Icon = "@drawable/icon")]
    public class SplashScreenActivity
        : MvxBaseSplashScreenActivity
    {
        public SplashScreenActivity()
            : base(Resource.Layout.SplashScreen)
        {
        }
    }
}


text:
\section{proof-of-concept architecture}

%$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
%$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
% 일반적인 매니코어 또는 Scale-server의 scalability 대한 설명과 이번장에 대한 설명
%$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
As noted earlier, the major problems of Spark scalability are
GC overhead and remote memory access, and it can be removed by the Docker container-based
partitioning approach, which divides the
original scale-up server into small logical servers that treats the partitioned
cores as a cluster node and moves shared-memory system workers to distributed system
workers that communicate via message-passing.

This section explains design consideration for architecture and our proposed proof-of-concept
architecture to solve GC and memory latency.
%We identify two design principles: (1) make shared resource to small size group
%as much as possible, (2) make Spark infrastructure hardware-neutral.

% and small logical servers should
%run as distributed system concept.

%As result of, the small size CPU groups can mitigate the thread
%serialized problem caused by GC pause time, and these partitioned group may
%only access to local NUMA memory.
%The reason for using partitioning method is that
%Spark library and run-time engine can be bottleneck by GC and remote memory access
%because Spark has not focused on scale-up server environment.
%However, modification of the spark internals library and the runtime engine is
%difficult.
%To achieve Spark performance scalability, we use the Docker container-based
%partitioning method to eliminate the GC and remote memory access overheads.
%The fundamental solution for scaling spark make a new designed spark
%libary and runtime engine scale for scale-up server.

\subsection{Design Consideration}

%$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
%$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
% 파티션닝의 장점 1: GC의 serialization 되는 부분을 줄인다.
%$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
%Indeed, GC leads to many of the advantages of high-level languages because of
%an increase in productivity, while it is a double-edged sword because GC pauses may
%lead a serialized operation.
In order to reduce the GC pause time, minimizing CPU counts is a simple method,
while it is a double-edged sword because small size of CPU counts may lead
communicating bottlenecks.
Therefore, the first design consideration is what is
best-fit CPU counts for reducing the GC pause time.

%a serialized operation.
%but too small size of CPU counts

The second design consideration is the straggler tasks(i.e, tasks take
significantly longer than expected to complete) problem.
Even though small size of partitioning may reduce GC,
its benefit does not come for free because it may cause straggler tasks
problem.
Thus, in order to scale Spark, a straggler monitor and a run-time core injector are needed.

%$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
%$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
% 파티션닝의 장점 2: DRAM access latency를 최대화 한다.
%$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
In addition to finding the best-fit CPU counts and reducing the straggler tasks problem,
the NUMA locality is next design consideration.
Due to the fact that threads are scheduled by the OS to execute on any core, and
partitioning approach can prevent to migrate other socket, so it is necessary to
divide by per-socket.

%Indeed, the modern operating systems have a NUMA balancing feature for
%enhancement of memory locality, but partitioning method can more superior
%performance regarding the large scale-up server(8 socket)~\cite{AutoNUMA}.

%$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
%$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
% 파티션닝의 장점 3: DRAM access latency를 최대화 한다.
% Linux kernel scalability (lock, cache cohearnci, scheduler)등등 OS 노이즈에 대한 설명
%$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
Operating systems noise can pose scalability
bottlenecks because modern operating systems have been designed for shared-memory
systems; therefore, the final design consideration is to avoid operating systems
noise.
For example, single address space sharing
problem~\cite{AustinTClements2012RCUBalancedTrees}~\cite{Clements2013RadixVM}
between multi-threaded applications, scheduler bottlenecks~\cite{Lozi2016LSD}
and cache communication
bottlenecks~\cite{SilasBoydWickizerPth}~\cite{Hendler2010FC} are major problems
in manycore scale-up server operating systems.
These problems are caused by sharing resource, so the architecture should consider
the operating systems noise.

%$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
%$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
% 스파크는 결국 : shared memory system -> distributed system 처럼해야한다.
%$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
%To satisfy these factors such as GC, NUMA and operating system
%bottlenecks, Spark on scale-up server should run
%as distributed system concept.
%Therefore, we use the partitioning approach that treats the partitioned cores
%as a cluster node and moves shared-memory system workers to distributed system
%workers that communicate via message-passing thereby eliminating GC and remote
%memory access overheads.
%We identify two design principles: (1) make shared resource to small size group
%as much as possible, (2) make Spark infrastructure hardware-neutral.
%As result of, the small size CPU groups can mitigate the thread
%serialized problem caused by GC pause time, and these partitioned group may
%only access to local NUMA memory.

%$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
%$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
% 스파크는 적당한 파티션닝이 중요하다.
%$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$

\subsection{Architecture}

\begin{figure}[tb]
  \begin{center}
     \includegraphics[width=0.5\textwidth]{fig/jaildocker}
  \end{center}
  \caption{The proof-of-concept architecture}
  \label{fig:basic}
\end{figure}

%$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
%$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
% 제안하는 구조 framework 설명
%$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
This section describes our vision that will accommodate the previous
mentioned design consideration.
Our proposed scalable partitioning architecture is figure~\ref{fig:basic} with the
necessary features.
The left side of figure shows our proposed architecture, and the right side of
figure shows isolated Docker containers and per-socket CPU with memory.

%The main components of the framwork are the decistion engine.
Decision engine is one of the most important features
since all partitioning policy come from the decision engine component.
The basic function of the decision engine chooses whether or not the job
run on the Docker container.
The necessity of the auto-tuner is that performance scalability depending on partitioning
size commonly differs from each server architecture.
To maximized CPU utilization, the straggler monitor and core injector are needed
because straggler tasks prolong job completion times, so the
early finished CPUs should inject to other Docker containers, which
contains the straggler tasks.


text:
package com.vxml.tag;

import org.w3c.dom.Node;

import com.vxml.browser.event.Event;
import com.vxml.core.browser.VxmlBrowser;
import com.vxml.core.browser.VxmlScriptEngine;
import com.vxml.dtmf.DtmfInput;
import com.vxml.parser.VxmlDoc;

public class ChoiceTag extends AbstractTag {

	public ChoiceTag(Node node) {
		super(node);
	}

	@Override
	public void execute() throws Event {
		String dtmf = getAttribute("dtmf");
		String dtmfInput = (String) VxmlBrowser.getContext().getScriptVar(VxmlScriptEngine.SCRIPT_EXECUTION_NAME_SPACE + ".dtmfInput");
		if (dtmfInput == null) {
		    dtmfInput = new DtmfInput(VxmlBrowser.getContext().getDtmfSource()).read();
		    if (dtmfInput != null) {
		        VxmlBrowser.getContext().assignScriptVar(VxmlScriptEngine.SCRIPT_EXECUTION_NAME_SPACE + ".dtmfInput" , dtmfInput);
		    }
		}
		if (dtmf.equals(dtmfInput)) {
		    String expr = getAttribute("expr");
		    Object target = VxmlBrowser.getContext().executeScript(expr);
		    new VxmlDoc(target.toString()).play();
		}
	}
}


text:
package project4.jdbc.bean;

public class UserInfoBean {
	private int id;
	private String first_name;
	private String last_name;
	private String address;
	private String email;

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getFirst_name() {
		return first_name;
	}

	public void setFirst_name(String first_name) {
		this.first_name = first_name;
	}

	public String getLast_name() {
		return last_name;
	}

	public void setLast_name(String last_name) {
		this.last_name = last_name;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}
}


text:
'use strict';

var fs = require('fs');
var path = require('path');

var cachedModulePaths = {};
var globalModulesPath = process.env.NODE_PATH;
var appFilePath = require.main.filename;
var appModulesPath = path.join(path.dirname(fs.realpathSync(appFilePath)), 'node_modules');

function getApplicationModulePath(name) {
  if (name in cachedModulePaths) {
    return cachedModulePaths[name];
  }

  var result = false;

  var modulePaths = [
    path.join(appModulesPath, name)
  ];

  if (globalModulesPath) {
    modulePaths.push(path.join(globalModulesPath, name));
  }

  while (modulePaths.length) {
    var modulePath = modulePaths.shift();
    if (fs.existsSync(modulePath)) {
      result = modulePath;
      break;
    }
  }

  cachedModulePaths[name] = result;

  return result;
}

/**
 * Gets the version of a module loaded at application level (process).
 *
 * @method
 * @private
 *
 * @param {string} name - Name of the module that you want to resolve the version for.
 *
 * @return {string} Module version, or false if the module couldn't be found.
 */
module.exports = function getApplicationModuleVersion(name) {
  var modulePath = getApplicationModulePath(name);

  if (modulePath) {
    var loadedModule = require(path.join(modulePath, 'package.json'));
    if (loadedModule) {
      return loadedModule.version;
    }
  }

  return false;
};


text:
""" Main entry point for simulator functionality """

import baseevents, windowevents, filechooserevents, treeviewevents, miscevents, gtk, storytext.guishared
import types, inspect
from storytext.gtktoolkit.widgetadapter import WidgetAdapter
from .. import treeviewextract
import xml.dom.minidom

performInterceptions = miscevents.performInterceptions
origDialog = gtk.Dialog
origFileChooserDialog = gtk.FileChooserDialog
origBuilder = gtk.Builder

class DialogHelper:
    uiMap = None
    def initialise(self):
        self.dialogRunLevel = 0
        self.handlers = []
        self.tryMonitor()

    def tryMonitor(self):
        if self.uiMap.scriptEngine.active():
            self.connect_for_real = self.connect
            self.connect = self.store_connect
            self.disconnect_for_real = self.disconnect
            handlerAttrs = [ "disconnect", "handler_is_connected", "handler_disconnect",
                             "handler_block", "handler_unblock" ]
            for attrName in handlerAttrs:
                setattr(self, attrName, self.handlerWrap(attrName))

    def store_connect(self, signalName, *args):
        return windowevents.ResponseEvent.storeApplicationConnect(self, signalName, *args)

    def handlerWrap(self, attrName):
        method = getattr(self, attrName)
        def wrapped_handler(handler):
            return method(self.handlers[handler])
        return wrapped_handler

    def connect_and_store(self, signalName, method, *args):
        def wrapped_method(*methodargs, **kw):
            baseevents.DestroyIntercept.inResponseHandler = True
            try:
                method(*methodargs, **kw)
            finally:
                baseevents.DestroyIntercept.inResponseHandler = False
        self.handlers.append(self.connect_for_real(signalName, wrapped_method, *args))

    def run(self):
        if gtk.main_level() == 0 or not hasattr(self, "connect_for_real"):
            # Dialog.run can be used instead of the mainloop, don't interfere then
            return origDialog.run(self)

        origModal = self.get_modal()
        self.set_modal(True)
        self.dialogRunLevel += 1
        self.uiMap.monitorAndStoreWindow(self)
        self.connect_for_real("response", self.runResponse)
        self.show_all()
        self.response_received = None
        while self.response_received is None:
            self.uiMap.scriptEngine.replayer.runMainLoopWithReplay()

        self.dialogRunLevel -= 1
        self.set_modal(origModal)
        baseevents.GtkEvent.disableIntercepts(self)
        return self.response_received

    def runResponse(self, dialog, response):
        self.response_received = response

class Dialog(DialogHelper, origDialog):
    def __init__(self, *args, **kw):
        origDialog.__init__(self, *args, **kw)
        self.initialise()

class FileChooserDialog(DialogHelper, origFileChooserDialog):
    def __init__(self, *args, **kw):
        origFileChooserDialog.__init__(self, *args, **kw)
        self.initialise()

class Builder(origBuilder):
    def __init__(self, *args, **kw):
        origBuilder.__init__(self, *args, **kw)
        self.filesRead = []

    def get_object(self, *args):
        WidgetAdapter.builderEnabled = True
        realObject = origBuilder.get_object(self, *args)
        if isinstance(realObject, origDialog):
            realObject.uiMap = DialogHelper.uiMap
            self.graftMethods(realObject, DialogHelper)
            realObject.initialise()
        elif isinstance(realObject, gtk.TreeView):
            documents = map(xml.dom.minidom.parse, self.filesRead)
            for column in realObject.get_columns():
                self.graftMethods(column, treeviewextract.TreeViewColumn)
                xmlElement = self.findXmlElement(documents, gtk.Buildable.get_name(column))
                children = xmlElement.getElementsByTagName("child")
                for renderer, child in zip(column.get_cell_renderers(), children):
                    attrs = {}
                    for node in child.getElementsByTagName("attribute"):
                        attrs[node.getAttribute("name")] = int(node.childNodes[0].nodeValue)
                    column.add_model_extractors(renderer, **attrs)
        return realObject

    def graftMethods(self, obj, fromClass):
        for name, member in inspect.getmembers(fromClass, inspect.ismethod):
            newMethod = types.MethodType(member.__func__, obj)
            setattr(obj, name, newMethod)

    def findXmlElement(self, documents, elementId):
        for document in documents:
            for obj in document.getElementsByTagName("object"):
                if obj.getAttribute("id") == elementId:
                    return obj

    def add_from_file(self, file, *args):
        origBuilder.add_from_file(self, file, *args)
        treeviewextract.reverseInterceptions(eventTypes) # These are bad in a builder-based world...
        self.filesRead.append(file)

class UIMap(storytext.guishared.UIMap):
    ignoreWidgetTypes = [ "Label" ]
    def __init__(self, *args):
        storytext.guishared.UIMap.__init__(self, *args)
        gtk.Builder = Builder
        gtk.Dialog = Dialog
        DialogHelper.uiMap = self
        gtk.FileChooserDialog = FileChooserDialog

    def monitorChildren(self, widget, *args, **kw):
        if widget.getName() != "Shortcut bar" and \
               not widget.isInstanceOf(gtk.FileChooser) and not widget.isInstanceOf(gtk.ToolItem):
            storytext.guishared.UIMap.monitorChildren(self, widget, *args, **kw)

    def monitorWindow(self, window):
        if window.isInstanceOf(origDialog):
            # Do the dialog contents before we do the dialog itself. This is important for FileChoosers
            # as they have things that use the dialog signals
            self.logger.debug("Monitoring children for dialog with title " + repr(window.getTitle()))
            self.monitorChildren(window, excludeWidgets=self.getResponseWidgets(window, window.action_area))
            self.monitorWidget(window)
            windowevents.ResponseEvent.connectStored(window)
        else:
            storytext.guishared.UIMap.monitorWindow(self, window)

    def getResponseWidgets(self, dialog, widget):
        widgets = []
        for child in widget.get_children():
            if dialog.get_response_for_widget(child) != gtk.RESPONSE_NONE:
                widgets.append(child)
        return widgets

eventTypes = [
        (gtk.Button           , [ baseevents.SignalEvent ]),
        (gtk.ToolButton       , [ baseevents.SignalEvent ]),
        (gtk.MenuItem         , [ miscevents.MenuItemSignalEvent ]),
        (gtk.CheckMenuItem    , [ miscevents.MenuActivateEvent ]),
        (gtk.ToggleButton     , [ miscevents.ActivateEvent ]),
        (gtk.ToggleToolButton , [ miscevents.ActivateEvent ]),
        (gtk.ComboBoxEntry    , []), # just use the entry, don't pick up ComboBoxEvents
        (gtk.ComboBox         , [ miscevents.ComboBoxEvent ]),
        (gtk.Entry            , [ miscevents.EntryEvent,
                                  baseevents.SignalEvent ]),
        (gtk.TextView         , [ miscevents.TextViewEvent ]),
        (gtk.FileChooser      , [ filechooserevents.FileChooserFileSelectEvent,
                                  filechooserevents.FileChooserFolderChangeEvent,
                                  filechooserevents.FileChooserEntryEvent ]),
        (gtk.Dialog           , [ windowevents.ResponseEvent,
                                  windowevents.DeletionEvent ]),
        (gtk.Window           , [ windowevents.DeletionEvent ]),
        (gtk.Notebook         , [ miscevents.NotebookPageChangeEvent ]),
        (gtk.TreeView         , [ treeviewevents.RowActivationEvent,
                                  treeviewevents.TreeSelectionEvent,
                                  treeviewevents.RowExpandEvent,
                                  treeviewevents.RowCollapseEvent,
                                  treeviewevents.RowRightClickEvent,
                                  treeviewevents.CellToggleEvent,
                                  treeviewevents.CellEditEvent,
                                  treeviewevents.TreeColumnClickEvent ])
]

universalEventClasses = [ baseevents.LeftClickEvent, baseevents.RightClickEvent ]
fallbackEventClass = baseevents.SignalEvent


text:
/*
 * Functions defined in vinumutil.c, which is used both in userland
 * and in the kernel.
 */
char *drive_state(enum drivestate);
char *volume_state(enum volumestate);
char *plex_state(enum plexstate);
char *plex_org(enum plexorg);
char *sd_state(enum sdstate);
enum drivestate DriveState(char *text);
enum sdstate SdState(char *text);
enum plexstate PlexState(char *text);
enum volumestate VolState(char *text);


text:
'use strict';

// MODULES //

var fs = require( 'fs' ),
	path = require( 'path' ),
	dirtree = require( 'dirtree' ),
	yeoman = require( 'yeoman-generator' ),
	yosay = require( 'yosay' ),
	shell = require( 'shelljs' ),
	chalk = require( 'chalk' );

// FUNCTIONS //

/**
* FUNCTION: git( path )
*	Initializes and runs git.
*
* @private
* @param {String} path - repo path; i.e., 'username/reponame'
*/
function git( path ) {
	var cmd = 'git remote add origin https://github.com/' + path + '.git';

	// Initialize the repository:
	shell.exec( 'git init' );
	shell.exec( cmd );
	shell.exec( 'git add -A' );
	shell.exec( 'git commit -m "[INIT]"' );
} // end FUNCTION git()

// GENERATOR //

var Generator = yeoman.generators.Base.extend({

	/**
	* METHOD: init()
	*	Generator initialization.
	*/
	init: function() {
		var flg = this.options[ 'skip-message' ];

		this.pkg = require( '../package.json' );
		this.year = ( new Date() ).getFullYear();

		if ( typeof flg === 'undefined' || !flg ) {
			this.log( yosay( 'Welcome to the application boilerplate generator...' ) );
		}
	},

	/**
	* METHOD: promptUser()
	*	Prompts a user for input relevant to the application.
	*/
	promptUser: function() {
		var next = this.async(),
			flg,
			dirname,
			prompts,
			git,
			user,
			email;

		// Output flag:
		flg = this.options[ 'skip-message' ];

		// Initialize defaults:
		user = '';
		email = '';

		// Check if the user has Git:
		git = shell.which( 'git' );

		if ( git ) {
			user = shell.exec( 'git config --get user.name', { silent: true } ).output.trim();
			email = shell.exec( 'git config --get user.email', { silent: true } ).output.trim();
		}

		// Get the current directory name:
		dirname = path.basename( process.cwd() );

		// Specify the input prompts required in order to tailor the application...
		prompts = [
			{
				'type': 'input',
				'name': 'name',
				'message': 'What is the application name?',
				'default': dirname
			},
			{
				'type': 'confirm',
				'name': 'git',
				'message': 'Create a new git repository?',
				'default': true,
				validate: function( answer ) {
					if ( answer && !git ) {
						return 'Unable to find git. Ensure that you have git installed.';
					}
					return true;
				}
			},
			{
				when: function( answers ) {
					if ( answers.git ) {
						return true;
					}
					return false;
				},
				'type': 'input',
				'name': 'repo',
				'message': 'Git repository path?'
			},
			{
				'type': 'input',
				'name': 'author',
				'message': 'Primary author\'s name?'
			},
			{
				'type': 'input',
				'name': 'email',
				'message': 'Primary author\'s contact e-mail?',
				default: function( answers ) {
					return ( answers.git ) ? email : '';
				}
			},
			{
				'type': 'input',
				'name': 'license_holder',
				'message': 'Author name(s) to include in the license file?',
				default: function( answers ) {
					return answers.author;
				}
			},
			{
				'type': 'input',
				'name': 'description',
				'message': 'Application description:',
				'default': 'Application.'
			}
		];

		// Prompt the user for responses:
		this.prompt( prompts, function onAnswers( answers ) {
			this.author = answers.author;
			this.email = answers.email;
			this.license_holder = answers.license_holder;
			this.appName = answers.name;
			this.description = answers.description;
			this.git = answers.git;
			this.repo = answers.repo;

			next();
		}.bind( this ) );
	}, // end METHOD promptUser()

	/**
	* METHOD: mkdirs()
	*	Creates application directories.
	*/
	mkdirs: function() {
		var tree = dirtree(),
			dirs,
			len,
			i;

		// Set the tree root...
		tree.root( __dirname + '/templates' );

		// Only map the `app` directory:
		tree.include( 'dirs', /app/ );

		// Create a tree:
		tree.create();

		// Get all the relative paths:
		dirs = tree.leaves();

		// Create each directory...
		len = dirs.length;
		for ( i = 0; i < len; i++ ) {
			this.mkdir( 'app/' + dirs[ i ] );
		}
	}, // end METHOD mkdirs()

	/**
	* METHOD: dotFiles()
	*	Copies over base dot files.
	*/
	dotFiles: function() {
		var tree = dirtree(),
			files,
			name,
			len,
			i;

		tree.root( __dirname + '/templates' );

		tree.exclude( 'dirs', /.*/ );
		tree.exclude( 'files', /^_/ );

		files = tree.leaves();

		for ( i = 0; i < len; i++ ) {
			name = files[ i ];
			this.copy( name, '.' + name );
		}
	}, // end METHOD dotfiles()

	/**
	* METHOD: makefile()
	*	Copies over base Makefile.
	*/
	makefile: function() {
		this.copy( '_Makefile', 'Makefile' );
	}, // end METHOD makefile()

	/**
	* METHOD: license()
	*	Creates a license file.
	*/
	license: function() {
		var context = {
			'holder': this.license_holder,
			'year': this.year
		};

		this.template( '_LICENSE', 'LICENSE', context );
	}, // end METHOD license()

	/**
	* METHOD: package()
	*	Creates a `package.json` file.
	*/
	package: function() {
		var context = {
			'name': this.appName,
			'repo': this.repo,
			'author': this.author,
			'email': this.email,
			'description': this.description
		};

		this.template( '_package.json', 'package.json', context );
	}, // end METHOD package()

	/**
	* METHOD: todo()
	*	Copies over a TODO file.
	*/
	todo: function() {
		this.copy( '_TODO.md', 'TODO.md' );
	}, // end METHOD todo()

	/**
	* METHOD: readme()
	*	Creates a boilerplate README.
	*/
	readme: function() {
		var context = {
			'title': this.appName,
			'name': this.appName,
			'repo': this.repo,
			'holder': this.license_holder,
			'year': this.year,
			'description': this.description
		};

		this.template( '_README.md', 'README.md', context );
	}, // end METHOD readme()

	/**
	* METHOD: app()
	*	Creates a boilerplate application entry-point.
	*/
	app: function() {
		this.copy( 'app/_index.js', 'app/index.js' );
	}, // end METHOD app()

	/**
	* METHOD: mw()
	*	Creates application middleware.
	*/
	mw: function() {
		// Middleware entry-point:
		this.template( 'app/middleware/_index.js', 'app/middleware/index.js', context );

		// Error middleware:
		this.template( 'app/middleware/error/_index.js', 'app/middleware/error/index.js', context );

		// Finish middleware:
		this.template( 'app/middleware/finish/_index.js', 'app/middleware/finish/index.js', context );

		// Start middleware:
		this.template( 'app/middleware/start/_index.js', 'app/middleware/start/index.js', context );

		// Logs middleware:
		this.template( 'app/middleware/logs/_index.js', 'app/middleware/logs/index.js', context );

		this.template( 'app/middleware/logs/_logs.js', 'app/middleware/logs/logs.js', context );

		this.template( 'app/middleware/logs/_okay.js', 'app/middleware/logs/okay.js', context );

		// Log-level middleware:
		this.template( 'app/middleware/loglevel/_index.js', 'app/middleware/loglevel/index.js', context );

		this.template( 'app/middleware/loglevel/_level.js', 'app/middleware/loglevel/level.js', context );

		this.template( 'app/middleware/loglevel/_okay.js', 'app/middleware/loglevel/okay.js', context );

		this.template( 'app/middleware/loglevel/_validate.js', 'app/middleware/loglevel/validate.js', context );

		// Monitor middleware:
		this.template( 'app/middleware/monitor/_index.js', 'app/middleware/monitor/index.js', context );

		this.template( 'app/middleware/monitor/_monitor.js', 'app/middleware/monitor/monitor.js', context );

		this.template( 'app/middleware/monitor/_json.js', 'app/middleware/monitor/json.js', context );

		this.template( 'app/middleware/monitor/plugins/_response_stats.js', 'app/middleware/monitor/plugins/response_stats.js', context );

		this.template( 'app/middleware/monitor/plugins/_response_stats.json', 'app/middleware/monitor/plugins/response_stats.json', context );
	}, // end METHOD mw()

	/**
	* METHOD: node_modules()
	*	Creates application node modules.
	*/
	node_modules: function() {
		var context = {
			'name': this.appName,
			'author': this.author,
			'email': this.email,
			'description': this.description,
			'year': this.year
		};

		// Application node modules...
		this.template( 'app/node_modules/config/_index.js', 'app/node_modules/config/index.js', context );

		this.template( 'app/node_modules/config/_runners.json', 'app/node_modules/config/runners.json', context );

		this.template( 'app/node_modules/logger/_index.js', 'app/node_modules/logger/index.js', context );

		this.template( 'app/node_modules/server/_index.js', 'app/node_modules/server/index.js', context );
	}, // end METHOD node_modules()

	/**
	* METHOD: test()
	*	Creates a test boilerplate.
	*/
	test: function() {

		// Node modules...
		this.copy( 'test/app/utils/_test.server.js', 'test/app/utils/test.server.js' );

		// Middleware tests...
		this.copy( 'test/app/middleware/_test.js', 'test/app/middleware/test.js' );

		// Error middleware:
		this.copy( 'test/app/middleware/error/_test.js', 'test/app/middleware/error/test.js' );

		// Finish middleware:
		this.copy( 'test/app/middleware/finish/_test.js', 'test/app/middleware/finish/test.js' );

		// Start middleware:
		this.copy( 'test/app/middleware/start/_test.js', 'test/app/middleware/start/test.js' );

		// Logs middleware:
		this.copy( 'test/app/middleware/logs/_test.logs.js', 'test/app/middleware/logs/test.logs.js' );

		this.copy( 'test/app/middleware/logs/_test.okay.js', 'test/app/middleware/logs/test.okay.js' );

		this.copy( 'test/app/middleware/logs/_test.post.js', 'test/app/middleware/logs/test.post.js' );

		// Log level middleware:
		this.copy( 'test/app/middleware/loglevel/_test.put.js', 'test/app/middleware/loglevel/test.put.js' );

		this.copy( 'test/app/middleware/loglevel/_test.level.js', 'test/app/middleware/loglevel/test.level.js' );

		this.copy( 'test/app/middleware/loglevel/_test.okay.js', 'test/app/middleware/loglevel/test.okay.js' );

		this.copy( 'test/app/middleware/loglevel/_test.validate.js', 'test/app/middleware/loglevel/test.validate.js' );

		// Monitor middleware:
		this.copy( 'test/app/middleware/monitor/_test.get.js', 'test/app/middleware/monitor/test.get.js' );

		this.copy( 'test/app/middleware/monitor/_test.json.js', 'test/app/middleware/monitor/test.json.js' );

		this.copy( 'test/app/middleware/monitor/_test.monitor.js', 'test/app/middleware/monitor/test.monitor.js' );

		this.copy( 'test/app/middleware/monitor/plugins/_test.response_stats.js', 'test/app/middleware/monitor/plugins/test.response_stats.js' );

		this.copy( 'test/app/middleware/monitor/plugins/_mock.json', 'test/app/middleware/monitor/plugins/mock.json' );
	}, // end METHOD test()

	/**
	* METHOD: test_utils()
	*	Creates test utilities.
	*/
	test_utils: function() {
		this.copy( 'test/utils/_existing_server.js', 'test/utils/existing_server.js' );
	}, // end METHOD test_utils()

	/**
	* METHOD: bin()
	*	Copies boilerplate executables.
	*/
	bin: function() {
		var context = {
			'name': this.appName,
			'author': this.author,
			'email': this.email,
			'year': this.year
		};

		this.template( 'bin/_server', 'bin/server', context );
	}, // end METHOD bin()

	/**
	* METHOD: etc()
	*	Copies boilerplate configuration files.
	*/
	etc: function() {
		this.copy( 'etc/_dev.json', 'etc/dev.json' );
		this.copy( 'etc/_test.json', 'etc/test.json' );
	}, // end METHOD etc()

	/**
	* METHOD: install()
	*	Initializes git and installs dependencies.
	*/
	install: function() {
		var config = {
			'bower': false,
			'npm': true,
			'skipInstall': this.options[ 'skip-install' ],
			'skipMessage': false,
			'callback': function onFinish() {
				console.log( '\n...finished.\n' );
			}
		};

		this.on( 'end', function onEnd() {
			if ( this.git ) {
				console.log( '\n...initializing git...\n' );
				git( this.repo );
				console.log( '\n...initialized git.\n' );
			}
			this.installDependencies( config );
		});
	} // end METHOD install()

});

// EXPORTS //

module.exports = Generator;


text:
class ManageIQ::Providers::ConfigurationManager::InventoryRootGroup < ManageIQ::Providers::ConfigurationManager::InventoryGroup
  has_many :configuration_scripts
  has_many :configured_systems

  virtual_column :total_configured_systems, :type => :integer

  def total_configured_systems
    Rbac.filtered(configured_systems).count
  end
end


text:
<?php

/*
 *
 * Configuration
 *
 */

// set your base colour names and also in base.scss
// prepend with "c-" to avoid problems with named CSS colors https://github.com/sass/sass/issues/1256
$base_colours = array(
  'c-green',
  'c-lime',
  'c-fuchsia',
  'c-orange',
);

// set the increment value here and also in colour.scss
$increment = 5;

?>
<!DOCTYPE html>

  <meta name="charset" charset="utf-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>Palette</title>
  <link rel="stylesheet" type="text/css" href="css/colour.css">

cfpicker

A handy colour picker for designing in the browser with Sass. Clicking on a colour selects the text so that you can copy and paste it into your editor.

Read the associated blog post.

View on GitHub.

   <?php foreach ($base_colours as $colour) : ?>

    <?php for($i=(100/$increment)-1; $i>0; $i--): ?>
      <?php $percentage = $i * $increment ?>
      <div class="box <?php echo $colour.'-tint-'.$percentage ?>">
        <textarea>colour(<?php echo $colour ?>,tint,<?php echo $percentage ?>%)</textarea>

    <?php endfor; ?>
    <div class="box <?php echo $colour.'-base' ?>">
      <textarea>colour(<?php echo $colour ?>)</textarea>

    <?php for($i=1; $i<(100/$increment); $i++): ?>
      <?php $percentage = $i * $increment ?>
      <div class="box <?php echo $colour.'-shade-'.$percentage ?>">
        <textarea>colour(<?php echo $colour ?>,shade,<?php echo $percentage ?>%)</textarea>

    <?php endfor; ?>

  <?php endforeach ?>


text:
package com.github.st1hy.countthemcalories.core.activityresult;

import android.support.v4.app.Fragment;

import com.github.st1hy.countthemcalories.core.fragments.FragmentLocation;
import com.github.st1hy.countthemcalories.core.fragments.FragmentTransactionModule;

import java.util.Map;

import dagger.Binds;
import dagger.Module;
import dagger.Provides;
import dagger.Reusable;
import dagger.multibindings.IntoMap;
import dagger.multibindings.StringKey;

@Module(includes = FragmentTransactionModule.class)
public abstract class ActivityLauncherModule {

    @Binds
    @Reusable
    public abstract ActivityLauncher activityLauncher(ActivityLauncherImp activityLauncherImp);

    @Binds
    public abstract ActivityLauncherSubject activityLauncherSubject(IntentHandlerFragment fragment);

    @Provides
    @IntoMap
    @StringKey(IntentHandlerFragment.TAG)
    public static FragmentLocation intentHandlerClass() {
        return new FragmentLocation.Builder<>(IntentHandlerFragment.class, IntentHandlerFragment.TAG).build();
    }

    @Provides
    @Reusable
    public static IntentHandlerFragment intentHandlerFragment(Map<String, Fragment> fragments) {
        return (IntentHandlerFragment) fragments.get(IntentHandlerFragment.TAG);
    }
}