text:
'use strict';

var Album = require('../../models/album'),
    Post = require('../../models/post'),
    should = require('should'),
    socketer = require('socketer'),
    util = require('../util'),
    async = require('async'),
    albumUtil = require('./util'),
    app = require('../../app'),
    cityFixture = require('../fixtures/db/city'),
    request = require('supertest');

var album, album2, album3, album4, newRestaurant, newCategory, newCity, user;

describe('Album', function(done) {
    before(function(done) {
        util.loadDb(
            function(next) {
                albumUtil.loadAlbum(next);
            },
            function(err, results) {
                album = results[1].albums[0];
                album2 = results[1].albums[1];
                album3 = results[1].albums[2];
                album4 = results[1].albums[3];

                newRestaurant = results[1].restaurants[1];
                newCity = results[1].cities[1];
                newCategory = results[1].categories[1];

                user = results[1].users[0];
                var opts = {
                    _user: results[1].users[0]._id,
                    _city: results[1].cities[0]._id,
                    _restaurant: results[1].restaurants[0]._id,
                    _category: results[1].categories[0]._id
                };
                var post1 = Post({_user: user._id});
                var post2 = Post({_user: user._id});
                var post3 = Post({_user: user._id});
                async.parallel({
                    post1: function(next) {
                        post1.save(function(err, p1) {
                            next(err, p1);
                        });
                    },
                    post2: function(next) {
                        post2.save(function(err, p2) {
                            next(err, p2);
                        });
                    },
                    post3: function(next) {
                        post3.save(function(err, p3) {
                            next(err, p3);
                        });
                    },
                }, function(err, results) {
                    opts['$set'] = {'pics': [results.post1._id, results.post2._id]};
                    async.parallel({
                        album1: function(next) {
                            Album.findByIdAndUpdate(album._id, opts).populate('_restaurant').populate('_city').populate('_category').exec(function(err, doc) {
                                album = doc;
                                next(err);
                            });
                        },
                        album2: function(next) {
                            Album.findByIdAndUpdate(album2._id, opts).populate('_restaurant').populate('_city').populate('_category').exec(function(err, doc) {
                                album2 = doc;
                                next(err);
                            });
                        },
                        album3: function(next) {
                            Album.findByIdAndUpdate(album3._id, opts).populate('_restaurant').populate('_city').populate('_category').exec(function(err, doc) {
                                album3 = doc;
                                next(err);
                            });
                        },
                        album4: function(next) {
                            opts['$set'] = {'pics': [results.post3._id]};
                            Album.findByIdAndUpdate(album4._id, opts).populate('_restaurant').populate('_city').populate('_category').exec(function(err, doc) {
                                album4 = doc;
                                next(err);
                            });
                        }
                    }, function(err, results) {
                        done(err);
                    });
                });
            });
    });

    describe('can be edited by owner', function(done) {

        it('when trying to access add/edit/delete pages', function(done) {
            async.parallel([
                function(next) {
                    socketer.authRequest(app, album.editUrl, {email: user.email, password: user.profile.passwordString}, function(err, res) {
                        res.statusCode.should.be.exactly(200);
                        next(err);
                    });
                },
                function(next) {
                    socketer.authRequest(app, album.deleteUrl, {email: user.email, password: user.profile.passwordString}, function(err, res) {
                        res.statusCode.should.be.exactly(200);
                        next(err);
                    });
                },
                function(next) {
                    socketer.authRequest(app, album.addUrl, {email: user.email, password: user.profile.passwordString}, function(err, res) {
                        res.statusCode.should.be.exactly(200);
                        next(err);
                    });
                }
            ], function(err, results) {
                done(err);
            });
        });

        it('and edit page displays correct values', function(done) {
            socketer.authRequest(app, album.editUrl, {email: user.email, password: user.profile.passwordString}, function(err, res) {
                res.body.should.containEql(album._restaurant.name);
                res.body.should.containEql(album._city.name);
                res.body.should.containEql(album._category.name);
                res.body.should.containEql(album.description);
                done(err);
            });
        });

        it('by clicking save changes button on edit page which then redirects user to album page', function(done) {
            socketer.authSocket(app, {email: user.email, password: user.profile.passwordString}, function(authSocket) {
                var socket = authSocket;
                var description = 'new desc', name = 'My new title', city = 'Rio de Janeiro', restaurant = 'Copa cabanan', category = 'Mexican';
                socket.emit('album-update', {
                    id: album._id,
                    name: name,
                    city: city,
                    restaurant: restaurant,
                    category: category,
                    description: description
                });
                socket.once('album-update', function(data) {
                    socket.disconnect();
                    data[0].action.should.be.exactly('redirect');
                    data[0].url.should.be.exactly(album.url);
                    Album.findOne({_id: album._id}).populate('_city').populate('_restaurant').populate('_category').exec(function(err, doc) {
                        doc.name.should.be.exactly(name);
                        doc._city.name.should.be.exactly(city);
                        doc._restaurant.name.should.be.exactly(restaurant);
                        doc._category.name.should.be.exactly(category);
                        done(err);
                    });
                });
            });
        });

        it('and on editing city, category, restaurant, posts info gets updated if user selects apply to post', function(done) {
            Post.update({_id: album.pics[0]._id}, {$unset: {_restaurant: 1, _city: 1, _category: 1}}, function(err, doc) {
                socketer.authSocket(app, {email: user.email, password: user.profile.passwordString}, function(authSocket) {
                    var description = 'new desc', name = 'My new title', city = 'Rio de Janeiro', restaurant = 'Copa cabanan', category = 'Mexican';
                    authSocket.emit('album-update', {
                        id: album._id,
                        name: name,
                        city: city,
                        restaurant: restaurant,
                        category: category,
                        description: description,
                        applyToPost: 'true'
                    });
                    authSocket.once('album-update', function(data) {
                        authSocket.disconnect();
                        Post.findOne({_id: album.pics[0]}).populate('_city').populate('_restaurant').populate('_category').exec(function(err, doc) {
                            doc._city.name.should.be.exactly(city);
                            doc._restaurant.name.should.be.exactly(restaurant);
                            doc._category.name.should.be.exactly(category);
                            done(err);
                        });
                    });
                });
            });
        });;

        it('and on editing city, category, restaurant, posts info doesn\'t get updated if empty', function(done) {
            Post.collection.update({_id: album4.pics[0]._id}, {$unset: {_restaurant: 1, _city: 1, _category: 1}}, function(err, doc) {
                socketer.authSocket(app, {email: user.email, password: user.profile.passwordString}, function(authSocket) {
                    var description = 'new desc', name = 'My new title', city = 'Rio de Janeiro', restaurant = 'Copa cabanan', category = 'Mexican';
                    authSocket.emit('album-update', {
                        id: album._id,
                        name: name,
                        city: city,
                        restaurant: restaurant,
                        category: category,
                        description: description
                    });
                    authSocket.once('album-update', function(data) {
                        authSocket.disconnect();
                        Post.findOne({_id: album4.pics[0]}).populate('_city').populate('_restaurant').populate('_category').exec(function(err, doc) {
                            (!!doc._city).should.not.be.ok;
                            (!!doc._restaurant).should.not.be.ok;
                            (!!doc._category).should.not.be.ok;
                            done(err);
                        });
                    });
                });
            });
        });;

        it('and on editing city, category, restaurant, posts info doesn\'t get updated if not empty', function(done) {
            Post.update({_id: album.pics[0]}, {$set: {_restaurant: newRestaurant._id, _city: newCity._id, _category: newCategory._id}}, function(err, doc) {
                socketer.authSocket(app, {email: user.email, password: user.profile.passwordString}, function(authSocket) {
                    var description = 'new desc', name = 'My new title', city = 'Rio de Janeiro', restaurant = 'Copa cabanan', category = 'Mexican';
                    authSocket.emit('album-update', {
                        id: album._id,
                        name: name,
                        city: city,
                        restaurant: restaurant,
                        category: category,
                        description: description
                    });
                    authSocket.once('album-update', function(data) {
                        authSocket.disconnect();
                        Post.findOne({_id: album.pics[0]}).populate('_city').populate('_restaurant').populate('_category').exec(function(err, doc) {
                            doc._city.name.should.not.be.exactly(city);
                            doc._restaurant.name.should.not.be.exactly(restaurant);
                            doc._category.name.should.not.be.exactly(category);
                            done(err);
                        });
                    });
                });
            });
        });;

        it('and on editing city, category, restaurant, posts info doesn\'t get updated if user selects don\'t apply to post', function(done) {
            Post.update({_id: album.pics[0]}, {$set: {_restaurant: newRestaurant._id, _city: newCity._id, _category: newCategory._id}}, function(err, doc) {
                socketer.authSocket(app, {email: user.email, password: user.profile.passwordString}, function(authSocket) {
                    var description = 'new desc', name = 'My new title', city = 'Rio de Janeiro', restaurant = 'Copa cabanan', category = 'Mexican';
                    authSocket.emit('album-update', {
                        id: album._id,
                        name: name,
                        city: city,
                        restaurant: restaurant,
                        category: category,
                        description: description,

                    });
                    authSocket.once('album-update', function(data) {
                        authSocket.disconnect();
                        Post.findOne({_id: album.pics[0]}).populate('_city').populate('_restaurant').populate('_category').exec(function(err, doc) {
                            doc._city.name.should.not.be.exactly(city);
                            doc._restaurant.name.should.not.be.exactly(restaurant);
                            doc._category.name.should.not.be.exactly(category);
                            done(err);
                        });
                    });
                });
            });
        });;

    });

    describe('cannot be edited by anonymous user', function(done) {

        it('when trying to access add/edit/delete pages', function(done) {
            async.parallel([
                function(next) {
                    socketer.anonRequest(app, album.addUrl, function(err, res) {
                        res.statusCode.should.be.exactly(403);
                        next(err);
                    });
                },
                function(next) {
                    socketer.anonRequest(app, album.editUrl, function(err, res) {
                        res.statusCode.should.be.exactly(403);
                        next(err);
                    });
                },
                function(next) {
                    socketer.anonRequest(app, album.deleteUrl, function(err, res) {
                        res.statusCode.should.be.exactly(403);
                        next(err);
                    });
                }
            ], function(err, results) {
                done(err);
            });
        });

        it('when trying to click on save changes button', function(done) {
            socketer.anonSocket(app, function(anonSocket) {
                var description = 'ddd', name = 'My alt title', city = 'Sydney', restaurant = 'Blablaresto', category = 'Australian';
                anonSocket.emit('album-update', {
                    id: album._id,
                    name: name,
                    city: city,
                    restaurant: restaurant,
                    category: category,
                    description: description
                });
                anonSocket.once('album-update', function(data) {
                    anonSocket.disconnect();
                    data.error.should.be.eql('Permission denied');
                    Album.findOne({_id: album._id}).populate('_city').populate('_restaurant').populate('_category').exec(function(err, doc) {
                        doc.name.should.not.be.eql(name);
                        doc._city.name.should.not.be.eql(city);
                        doc._restaurant.name.should.not.be.eql(restaurant);
                        doc._category.name.should.not.be.eql(category);
                        done(err);
                    });
                });
            });
        });

    });

    describe('can be deleted', function(done) {

        it('by owner but the pictures can remain and user should be redirected to profile page', function(done) {
            socketer.authSocket(app, {email: user.email, password: user.profile.passwordString}, function(authSocket) {
                authSocket.emit('album-delete', {
                    id: album._id,
                    deletePics: 'false'
                });
                authSocket.once('album-delete', function(data) {
                    authSocket.disconnect();
                    data[0].action.should.be.eql('redirect');
                    data[0].url.should.be.eql(user.url);
                    Album.findOne({_id: album._id}, function(err, doc) {
                        (!!doc).should.not.be.ok;
                        Post.findOne({_id: album.pics[0]}, function(err, post) {
                            (!!post).should.be.ok;
                            done(err);
                        });
                    });
                });
            });
        });

        it('by owner and all the pictures be deleted as well and user should be redirected to profile page', function(done) {
            socketer.authSocket(app, {email: user.email, password: user.profile.passwordString}, function(authSocket) {
                authSocket.emit('album-delete', {
                    id: album2._id,
                    deletePics: 'true'
                });
                authSocket.once('album-delete', function(data) {
                    authSocket.disconnect();
                    data[0].action.should.be.eql('redirect');
                    data[0].url.should.be.eql(user.url);
                    Album.findOne({_id: album2._id}, function(err, doc) {
                        (!!doc).should.not.be.ok;
                        Post.findOne({_id: album2.pics[0]}, function(err, post) {
                            (!!post).should.not.be.ok;
                            done(err);
                        });
                    });
                });
            });
        });
    });

    describe('cannot be deleted', function(done) {

        it('by anonymous user', function(done) {
            socketer.anonSocket(app, function(anonSocket) {
                anonSocket.emit('album-delete', {
                    id: album3._id,
                    deletePics: 'true'
                });
                anonSocket.once('album-delete', function(data) {
                    anonSocket.disconnect();
                    data.error.should.be.eql('Permission denied');
                    Album.findOne({_id: album3._id}, function(err, doc) {
                        (!!doc).should.be.ok;
                        done(err);
                    });
                });
            });
        });

    });

    after(util.after);

});


text:
import subprocess
import os
import os.path
import json

#Key value class
class Details:
    def __init__(self,line):
        v = line.split(":", 2)
        self.Tag = v[0].strip()
        self.Value = v[1].strip()

#Entry class container for data with some category
class Entry:
    def __init__(self,category):
        self.Category = category
        self.Details = []

#GenericInfo class container for collected data
class GenericInfo:
    def __init__(self):
        self.Entries = []

    def toJSON(self):
        return json.dumps(self, default=lambda o: o.__dict__, sort_keys=True)

def esxCall(configFile, section, cmd, subcmd):
    p = subprocess.Popen('esxcli -c '+ configFile+' '+ section + ' '+ cmd +' '+ subcmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
    p.wait()
    out, err = p.communicate()

    if p.returncode:
        return "" # mean error
    return out.decode("utf-8")

def handleESXResult(categoryName, data):
    c = Entry(categoryName)
    result = []
    lines = data.splitlines()
    for l in lines:
        if l.startswith("  "):
            d = Details(l)
            c.Details.append(d)
        else:
            if len(c.Details) > 0:
                result.append(c)
            c = Entry(categoryName)

    if len(c.Details) > 0:
        result.append(c)

    return result

def handleESXPackages(data):
    fileds = ["Name", "Version", "Vendor", "Acceptance-Level", "Install-Date"]
    result = []
    lines = data.splitlines()
    if len(lines) <= 2:
        return result
    lines = lines[2:]
    for line in lines:
        words = line.split()
        if len(words) != len(fileds):
            continue

        entry = Entry(words[0])
        for i in range(len(words)):
            if i == 0:
                continue #skip name

            entry.Details.append(Details(fileds[i]+":"+words[i]))
        result.append(entry)

    return result

CONFIG_FILE = os.path.join(os.path.dirname(__file__), "esx.config")

if not os.path.exists(CONFIG_FILE):
    quit() #miss config file

GenInfo = GenericInfo()

#get process information
res = esxCall(CONFIG_FILE, "vm", "process", "list")
if len(res) > 0:
    GenInfo.Entries.append(handleESXResult("VMs", res))

#get cpu information
res = esxCall(CONFIG_FILE, "hardware", "cpu", "list")
if len(res) > 0:
    GenInfo.Entries.append(handleESXResult("CPUs", res))

#get memory information
res = esxCall(CONFIG_FILE,  "hardware", "memory", "get")
if len(res) > 0:
    GenInfo.Entries.append(handleESXResult("Memory", res))

#get pci information
res = esxCall(CONFIG_FILE,  "hardware", "pci", "list")
if len(res) > 0:
    GenInfo.Entries.append(handleESXResult("PCI", res))

#get UUID of system
res = esxCall(CONFIG_FILE,  "system", "uuid", "get")
if len(res) > 0:
    vnUUID = Entry("VM-UUID")
    vnUUID.Details.append(Details("UUID:"+ res))
    GenInfo.Entries.append(vnUUID)

#get system version
res = esxCall(CONFIG_FILE, "system", "version", "get")
if len(res) > 0:
    GenInfo.Entries.append(handleESXResult("Version", res)[0])

#get software information
res = esxCall(CONFIG_FILE, "software", "vib", "list")
if len(res) > 0:
    GenInfo.Entries.append(handleESXPackages(res))

print(GenInfo.toJSON())

redpajama_set_name: RedPajamaGithub


text:
<body>
Provides classes that support a multithreaded kernel.
</body>


text:
<?xml version="1.0" encoding="UTF-8"?>
<MetaDataObject xmlns="http://v8.1c.ru/8.3/MDClasses" xmlns:app="http://v8.1c.ru/8.2/managed-application/core" xmlns:cfg="http://v8.1c.ru/8.1/data/enterprise/current-config" xmlns:cmi="http://v8.1c.ru/8.2/managed-application/cmi" xmlns:ent="http://v8.1c.ru/8.1/data/enterprise" xmlns:lf="http://v8.1c.ru/8.2/managed-application/logform" xmlns:style="http://v8.1c.ru/8.1/data/ui/style" xmlns:sys="http://v8.1c.ru/8.1/data/ui/fonts/system" xmlns:v8="http://v8.1c.ru/8.1/data/core" xmlns:v8ui="http://v8.1c.ru/8.1/data/ui" xmlns:web="http://v8.1c.ru/8.1/data/ui/colors/web" xmlns:win="http://v8.1c.ru/8.1/data/ui/colors/windows" xmlns:xen="http://v8.1c.ru/8.3/xcf/enums" xmlns:xpr="http://v8.1c.ru/8.3/xcf/predef" xmlns:xr="http://v8.1c.ru/8.3/xcf/readable" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.1">
	<Subsystem uuid="bb0424b8-dfd1-4a27-bd66-9dea3ffc77c4">
		<Properties>
			<Name>ДатыЗапретаИзменения</Name>
			<Synonym>
				<v8:item>
					<v8:lang>ru</v8:lang>
					<v8:content>Даты запрета изменения</v8:content>
				</v8:item>
			</Synonym>
			<Comment/>
			<IncludeHelpInContents>false</IncludeHelpInContents>
			<IncludeInCommandInterface>false</IncludeInCommandInterface>
			<Explanation/>
			<Picture/>
			<Content>
				<xr:Item xsi:type="xr:MDObjectRef">CommonModule.ДатыЗапретаИзменения</xr:Item>
				<xr:Item xsi:type="xr:MDObjectRef">InformationRegister.ДатыЗапретаИзменения</xr:Item>
				<xr:Item xsi:type="xr:MDObjectRef">CommonModule.ДатыЗапретаИзмененияСлужебныйПовтИсп</xr:Item>
				<xr:Item xsi:type="xr:MDObjectRef">ChartOfCharacteristicTypes.РазделыДатЗапретаИзменения</xr:Item>
				<xr:Item xsi:type="xr:MDObjectRef">CommonModule.ДатыЗапретаИзмененияСлужебный</xr:Item>
				<xr:Item xsi:type="xr:MDObjectRef">CommonModule.ДатыЗапретаИзмененияПереопределяемый</xr:Item>
				<xr:Item xsi:type="xr:MDObjectRef">Report.ДатыЗапретаИзменения</xr:Item>
				<xr:Item xsi:type="xr:MDObjectRef">Enum.ВидыНазначенияДатЗапрета</xr:Item>
				<xr:Item xsi:type="xr:MDObjectRef">CommonPicture.ПиктограммыПланОбменаУзел</xr:Item>
				<xr:Item xsi:type="xr:MDObjectRef">Report.ДатыЗапретаЗагрузки</xr:Item>
				<xr:Item xsi:type="xr:MDObjectRef">SessionParameter.ПропуститьПроверкуЗапретаИзменения</xr:Item>
				<xr:Item xsi:type="xr:MDObjectRef">DefinedType.АдресатЗапретаИзменения</xr:Item>
				<xr:Item xsi:type="xr:MDObjectRef">Constant.ВерсияДатЗапретаИзменения</xr:Item>
				<xr:Item xsi:type="xr:MDObjectRef">SessionParameter.ОбновитьВерсиюДатЗапретаИзмененияПослеЗагрузкиДанных</xr:Item>
				<xr:Item xsi:type="xr:MDObjectRef">EventSubscription.ОбновлениеВерсииДатЗапретаИзмененияПослеЗагрузкиДанных</xr:Item>
				<xr:Item xsi:type="xr:MDObjectRef">SessionParameter.ДействующиеДатыЗапретаИзменения</xr:Item>
				<xr:Item xsi:type="xr:MDObjectRef">Constant.ИспользоватьДатыЗапретаЗагрузки</xr:Item>
				<xr:Item xsi:type="xr:MDObjectRef">Constant.ИспользоватьДатыЗапретаИзменения</xr:Item>
				<xr:Item xsi:type="xr:MDObjectRef">Role.ДобавлениеИзменениеДатЗапретаИзменения</xr:Item>
				<xr:Item xsi:type="xr:MDObjectRef">FunctionalOption.ИспользоватьДатыЗапретаЗагрузки</xr:Item>
				<xr:Item xsi:type="xr:MDObjectRef">FunctionalOption.ИспользоватьДатыЗапретаИзменения</xr:Item>
				<xr:Item xsi:type="xr:MDObjectRef">CommonModule.ДатыЗапретаИзмененияСлужебныйКлиентСервер</xr:Item>
			</Content>
		</Properties>
		<ChildObjects/>
	</Subsystem>
</MetaDataObject>


text:
package org.apache.deltaspike.test.jsf.impl.scope.mapped.beans;

import javax.faces.bean.RequestScoped;
import javax.inject.Named;
import java.io.Serializable;

/**
 * JSF RequestScoped sample backing bean.
 * This Bean will get mapped to it's corresponding CDI scope
 * via our {@link org.apache.deltaspike.jsf.impl.scope.mapped.MappedJsf2ScopeExtension}
 */
@RequestScoped
@Named
public class JsfRequestScopedBackingBean implements Serializable
{
    private int i = 0;

    public int getI()
    {
        return i;
    }

    public void setI(int i)
    {
        this.i = i;
    }
}


text:
    MSGPACK_PP_IF( \
        MSGPACK_PP_IS_BEGIN_PARENS(elem), \
        elem, \
        (MSGPACK_PP_STRINGIZE(elem))(elem) \
    )

#define MSGPACK_DEFINE_MAP_IMPL(...) \
    MSGPACK_PP_SEQ_TO_TUPLE( \
        MSGPACK_PP_SEQ_FOR_EACH( \
            MSGPACK_DEFINE_MAP_EACH_PROC, \
            0, \
            MSGPACK_PP_VARIADIC_TO_SEQ(__VA_ARGS__) \
        ) \
    )

#define MSGPACK_DEFINE_MAP(...) \
    template <typename Packer> \
    void msgpack_pack(Packer& pk) const \
    { \
        msgpack::type::make_define_map \
            MSGPACK_DEFINE_MAP_IMPL(__VA_ARGS__) \
            .msgpack_pack(pk); \
    } \
    void msgpack_unpack(msgpack::object const& o) \
    { \
        msgpack::type::make_define_map \
            MSGPACK_DEFINE_MAP_IMPL(__VA_ARGS__) \
            .msgpack_unpack(o); \
    }\
    template <typename MSGPACK_OBJECT> \
    void msgpack_object(MSGPACK_OBJECT* o, msgpack::zone& z) const \
    { \
        msgpack::type::make_define_map \
            MSGPACK_DEFINE_MAP_IMPL(__VA_ARGS__) \
            .msgpack_object(o, z); \
    }

#define MSGPACK_BASE_MAP(base) \
    (MSGPACK_PP_STRINGIZE(base))(*const_cast<base *>(static_cast<base const*>(this)))

namespace msgpack {
/// @cond
MSGPACK_API_VERSION_NAMESPACE(v1) {
/// @endcond
namespace type {

template <typename Tuple, std::size_t N>
struct define_map_imp {
    template <typename Packer>
    static void pack(Packer& pk, Tuple const& t) {
        define_map_imp<Tuple, N-1>::pack(pk, t);
        pk.pack(std::get<N-1>(t));
    }
    static void unpack(
        msgpack::object const& o, Tuple const& t,
        std::map<std::string, msgpack::object const*> const& kvmap) {
        define_map_imp<Tuple, N-2>::unpack(o, t, kvmap);
        auto it = kvmap.find(std::get<N-2>(t));
        if (it != kvmap.end()) {
            it->second->convert(std::get<N-1>(t));
        }
    }
    static void object(msgpack::object* o, msgpack::zone& z, Tuple const& t) {
        define_map_imp<Tuple, N-2>::object(o, z, t);
        o->via.map.ptr[(N-1)/2].key = msgpack::object(std::get<N-2>(t), z);
        o->via.map.ptr[(N-1)/2].val = msgpack::object(std::get<N-1>(t), z);
    }
};

template <typename Tuple>
struct define_map_imp<Tuple, 0> {
    template <typename Packer>
    static void pack(Packer&, Tuple const&) {}
    static void unpack(
        msgpack::object const&, Tuple const&,
        std::map<std::string, msgpack::object const*> const&) {}
    static void object(msgpack::object*, msgpack::zone&, Tuple const&) {}
};

template <typename... Args>
struct define_map {
    define_map(Args&... args) :
        a(args...) {}
    template <typename Packer>
    void msgpack_pack(Packer& pk) const
    {
        static_assert(sizeof...(Args) % 2 == 0, "");
        pk.pack_map(sizeof...(Args) / 2);

        define_map_imp<std::tuple<Args&...>, sizeof...(Args)>::pack(pk, a);
    }
    void msgpack_unpack(msgpack::object const& o) const
    {
        if(o.type != msgpack::type::MAP) { throw msgpack::type_error(); }
        std::map<std::string, msgpack::object const*> kvmap;
        for (uint32_t i = 0; i < o.via.map.size; ++i) {
            kvmap.emplace(
                std::string(
                    o.via.map.ptr[i].key.via.str.ptr,
                    o.via.map.ptr[i].key.via.str.size),
                &o.via.map.ptr[i].val);
        }
        define_map_imp<std::tuple<Args&...>, sizeof...(Args)>::unpack(o, a, kvmap);
    }
    void msgpack_object(msgpack::object* o, msgpack::zone& z) const
    {
        static_assert(sizeof...(Args) % 2 == 0, "");
        o->type = msgpack::type::MAP;
        o->via.map.ptr = static_cast<msgpack::object_kv*>(z.allocate_align(sizeof(msgpack::object_kv)*sizeof...(Args)/2));
        o->via.map.size = sizeof...(Args) / 2;

        define_map_imp<std::tuple<Args&...>, sizeof...(Args)>::object(o, z, a);
    }

    std::tuple<Args&...> a;
};

template <typename... Args>
define_map<Args...> make_define_map(Args&... args)
{
    return define_map<Args...>(args...);
}

}  // namespace type
/// @cond
}  // MSGPACK_API_VERSION_NAMESPACE(v1)
/// @endcond
}  // namespace msgpack

#endif // MSGPACK_CPP11_DEFINE_MAP_HPP


text:
package com.zeroleaf.tools.progressbar;

import com.zeroleaf.tools.progressbar.renderings.BarRendering;
import com.zeroleaf.tools.progressbar.renderings.CurrentRendering;
import com.zeroleaf.tools.progressbar.renderings.DlSpeedRendering;
import com.zeroleaf.tools.progressbar.renderings.ElapsedRendering;
import com.zeroleaf.tools.progressbar.renderings.EtaRendering;
import com.zeroleaf.tools.progressbar.renderings.PercentRendering;
import com.zeroleaf.tools.progressbar.renderings.Rendering;
import com.zeroleaf.tools.progressbar.renderings.TotalRendering;

import java.util.HashSet;
import java.util.Set;

/**
 *
 *
 * @author zeroleaf
 */
public class ProgressBarImpl implements ProgressBar {

    private static final char CARRIAGE_RETURN = '\r';

    private final String format;

    private final Progress progress;
    private final Config   config;

    private final static Set<Rendering> renderings;

    static {
        renderings = new HashSet<>();
        renderings.add(new BarRendering());
        renderings.add(new CurrentRendering());
        renderings.add(new ElapsedRendering());
        renderings.add(new EtaRendering());
        renderings.add(new PercentRendering());
        renderings.add(new TotalRendering());
        renderings.add(new DlSpeedRendering());
    }

    private ProgressBarImpl(final String format, final Config config) {
        this.format   = format;
        this.config   = config;
        this.progress = new Progress(config.getTotalStep(),
                                     config.getUpdateInterval());
    }

    public static ProgressBarImpl newInstance(String format, Config config) {
        return new ProgressBarImpl(format, config);
    }

    public static ProgressBarImpl newInstance(String format, long totalStep) {
        Config config = new Config.Builder().totalStep(totalStep).build();
        return new ProgressBarImpl(format, config);
    }

    private static final String DEFAULT_TASK_FORMAT =
        ":current :elapsed [:bar] :percent%";

    public static ProgressBarImpl newTaskProgressBar(long totalStep) {
        return newInstance(DEFAULT_TASK_FORMAT, totalStep);
    }

    private static final String DEFAULT_DOWNLOAD_FORMAT =
        ":current :dlspeed :elapsed [:bar] :percent%";

    public static ProgressBarImpl newDownloadProgressBar(long totalStep) {
        return newInstance(DEFAULT_DOWNLOAD_FORMAT, totalStep);
    }

    @Override
    public void start() {
        progress.setStartTime(System.currentTimeMillis());
        showProgressBar();
    }

    @Override
    public void tick() {
        tick(1);
    }

    @Override
    public void tick(long step) {
        if (!progress.isComplete()) {
            progress.addStep(step);
            updateProgressBarIfNeeded();
        }
    }

    private void updateProgressBarIfNeeded() {
        if (progress.updateNeeded()) {
            showProgressBar();
        }
    }

    private void showProgressBar() {
        final String realContent = renderBar(format);
        config.getStream().print(realContent);
        config.getStream().print(CARRIAGE_RETURN);
    }

    private String renderBar(final String format) {
        String result = format;
        for (Rendering rendering : renderings) {
            if (format.contains(rendering.getToken())) {
                result = result.replace(
                    rendering.getToken(), rendering.render(config, progress));
            }
        }
        return result;
    }

    @Override
    public void keepResult(String rf) {
        if (rf == null || rf.isEmpty()) {
            rf = this.format;
        }
        config.getStream().println(renderBar(rf));
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content">

     <FrameLayout
  		android:layout_marginTop="10dp"
        android:id="@+id/line1"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/quickaction_top_frame"/>

     <ImageView
        android:id="@+id/arrowUp"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/quickaction_arrow_up" />

    <HorizontalScrollView
        android:id="@+id/scroll"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:fadingEdgeLength="0dp"
        android:layout_below="@id/line1"
        android:background="#FFAAAAAA"
        android:scrollbars="none">

        <LinearLayout
            android:id="@+id/itemGroup"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:paddingTop="4dp"
            android:paddingBottom="4dp"
            android:orientation="horizontal">

            <ImageView
                android:layout_width="wrap_content"
                android:layout_height="fill_parent"
                android:src="@drawable/quickaction_slider_grip_left" />

            <ImageView
                android:layout_width="wrap_content"
                android:layout_height="fill_parent"
                android:src="@drawable/quickaction_slider_grip_right" />

        </LinearLayout>

    </HorizontalScrollView>

    <FrameLayout
        android:id="@+id/line2"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/scroll"
        android:background="@drawable/quickaction_bottom_frame" />

    <ImageView
        android:id="@+id/arrowDown"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:paddingTop="-1dp"
        android:layout_below="@id/line2"
        android:src="@drawable/quickaction_arrow_down" />

</RelativeLayout>


text:
Resultat {{resultat.id}}

    <jhi-alert-error></jhi-alert-error>

Code

            {{resultat.code}}

    <button type="submit" id="resultat-detail-component-back"
            (click)="previousState()"
            class="btn btn-info">
          Back
    </button>

    <button type="button" id="resultat-detail-component-edit"
            [routerLink]="['/', { outlets: { popup: 'resultat/'+ resultat.id + '/edit'} }]"
            replaceUrl="true"
            queryParamsHandling="merge"
            class="btn btn-primary">
          Edit
    </button>


text:
namespace Abot {

	GroupPtr Group::GetDescendants(bool andSelf, bool depthFirst, GroupPtr group) {
		if (group == nullptr) {
			group = Create();
		}

		std::list<NodePtr> nodesStack;

		for (auto node : nodes) {
			nodesStack.push_front(node);

			while (nodesStack.size() != 0) {
				auto descendant = nodesStack.front();

				nodesStack.pop_front();

				if (descendant != node || andSelf) {
					group->nodes.push_back(descendant);
				}

				nodesStack.insert(
					depthFirst ? nodesStack.begin() : nodesStack.end(),
					descendant->GetNodes().begin(),
					descendant->GetNodes().end()
					);
			}
		}

		return group;
	}

	GroupPtr Group::GetAncestors(bool andSelf, GroupPtr group) {
		if (group == nullptr) {
			group = Create();
		}
		for (auto node : nodes) {
			if (andSelf)
				group->nodes.push_back(node);

			while (node != nullptr) {
				if (node->GetParent() != nullptr)
					group->nodes.push_back(node->GetParent());
				node = node->GetParent();
			}
		}

		return group;
	}

	GroupPtr Group::GetChildren(bool andSelf, GroupPtr group) {
		if (group == nullptr) {
			group = Create();
		}

		for (auto node : nodes) {
			if (andSelf)
				group->nodes.push_back(node);

			group->nodes.insert(group->nodes.end(), node->GetNodes().begin(), node->GetNodes().end());
		}

		return group;
	}

	GroupPtr Group::GetGroupFrom(std::function<bool(std::shared_ptr<Node>)> filter, GroupPtr group) {
		if (group == nullptr)
			group = Create();

		for (auto node : nodes) {
			if (filter(node)) {
				group->nodes.push_back(node);
			}
		}
		return group;
	}

	GroupPtr Group::GetRoots(GroupPtr group) {
		if (group == nullptr)
			group = Create();

		for (auto node : nodes)
			if (std::find(group->nodes.begin(), group->nodes.end(), node->GetRoot()) == group->nodes.end())
				group->nodes.push_back(node->GetRoot());

		return group;
	}

}


text:
package main

const (
	errorMySofieHelp = "use 'mysophie --help' for detailed instructions"
)


text:
package com.intellij.java.codeInsight.template.postfix.templates;

import org.jetbrains.annotations.NotNull;

public class SwitchExpressionPostfixTemplateTest extends PostfixTemplateTestCase {
  @NotNull
  @Override
  protected String getSuffix() {
    return "switch";
  }

  public void testIntExprInit() {
    doTest();
  }

  public void testIntExprAssign() {
    doTest();
  }

  public void testByteExprInit() {
    doTest();
  }

  public void testByteExprAssign() {
    doTest();
  }

  public void testCharExprReturn() {
    doTest();
  }

  public void testCharExprArg() {
    doTest();
  }

  public void testShortExprReturn() {
    doTest();
  }

  public void testShortExprArg() {
    doTest();
  }

  public void testEnumExprInit() {
    doTest();
  }

  public void testEnumExprAssign() {
    doTest();
  }

  public void testStringExprInit() {
    doTest();
  }

  public void testStringExprAssign() {
    doTest();
  }

  public void testCompositeExprInit() {
    doTest();
  }

  public void testCompositeExprAssign() {
    doTest();
  }
}


text:
import { AccountsLockout } from 'meteor/lucasantoniassi:accounts-lockout';

new AccountsLockout({
  knownUsers: {
    failuresBeforeLockout:
      process.env.ACCOUNTS_LOCKOUT_KNOWN_USERS_FAILURES_BEFORE || 3,
    lockoutPeriod: process.env.ACCOUNTS_LOCKOUT_KNOWN_USERS_PERIOD || 60,
    failureWindow:
      process.env.ACCOUNTS_LOCKOUT_KNOWN_USERS_FAILURE_WINDOW || 15,
  },
  unknownUsers: {
    failuresBeforeLockout:
      process.env.ACCOUNTS_LOCKOUT_UNKNOWN_USERS_FAILURES_BERORE || 3,
    lockoutPeriod:
      process.env.ACCOUNTS_LOCKOUT_UNKNOWN_USERS_LOCKOUT_PERIOD || 60,
    failureWindow:
      process.env.ACCOUNTS_LOCKOUT_UNKNOWN_USERS_FAILURE_WINDOW || 15,
  },
}).startup();


text:
package net.sf.mmm.code.api.item;

import net.sf.mmm.code.api.CodeFile;
import net.sf.mmm.code.api.comment.CodeComment;

/**
 * {@link CodeItem} that has an optional {@link #getComment() comment}.
 *
 * @author Joerg Hohwiller (hohwille at users.sourceforge.net)
 * @since 1.0.0
 */
public abstract interface CodeItemWithComment extends CodeItem {

  /**
   * @return the {@link CodeComment} comment above this item (e.g. header of {@link CodeFile}). Will be an
   *         empty instance as fallback to avoid {@link NullPointerException}s.
   */
  CodeComment getComment();

}


text:
package com.ibq2d.engine.geometry;

import com.ibq2d.engine.Application;
import com.ibq2d.engine.core.Sprite;

public class Rect extends Shape {
    private float width;
    private float height;

    public Rect(float w, float h, Vector2 position) {
        super(position);
        width = w;
        height = h;

        calculateCoordinates();
    }

    public Rect(float width, float height) {
        super();
        this.width = width;
        this.height = height;

        calculateCoordinates();
    }

    public Rect(Sprite sprite) {
        super(sprite.getPosition());
        this.width = sprite.getWidth();
        this.height = sprite.getHeight();

        calculateCoordinates();

        rotate(sprite.getRotation());
        scale(sprite.getScale().getX(), sprite.getScale().getY());
    }

    @Override
    public boolean vectorInside(Vector2 vector) {
        if (getRotation() != 0) {
            Edge extreme = new Edge(new Vector2(Application.WIDTH, vector.getY()), vector);
            int count = 0;
            for (Edge rectEdge : this.edges) {
                if (extreme.intersectsWith(rectEdge)) count++;
            }
            return (count&1) == 1;
        }
        float rectX = getPosition().getX();
        float rectY = getPosition().getY();
        float subWidth = getWidth()/2;
        float subHeight = getHeight()/2;

        return Geometry.pointWithin(vector.getX(), rectX - subWidth, rectX + subWidth) &&
                Geometry.pointWithin(vector.getY(), rectY - subHeight, rectY + subHeight);
    }

    @Override
    public boolean intersectsWith(Circle circle) {
        if (Math.pow(this.getOuterCircleRadius() + circle.getRadius(), 2) < Vector2.subtract(this.getPosition(), circle.getPosition()).sqrMagnitude())
            return false;
        Vector2 dir = Vector2.subtract(this.getPosition(), circle.getPosition()).normalized();
        Vector2 outerPoint = Vector2.add(circle.getPosition(), dir.multiplyBy(circle.getRadius()));
        return this.vectorInside(outerPoint);
    }

    @Override
    public boolean intersectsWith(Rect rect) {
        if (rect.getRotation() == 0 && this.getRotation() == 0) {
            Vector2 a1 = new Vector2(this.vertices.get(0).getX(), this.vertices.get(0).getY());
            Vector2 a2 = new Vector2(this.vertices.get(2).getX(), this.vertices.get(2).getY());
            Vector2 b1 = new Vector2(rect.vertices.get(0).getX(), rect.vertices.get(0).getY());
            Vector2 b2 = new Vector2(rect.vertices.get(2).getX(), rect.vertices.get(2).getY());

            return (a1.getX() < b2.getX() && a2.getX() > b1.getX() && a1.getY() < b2.getY() && a2.getY() > b1.getY());
        }
        return false;
    }

    @Override
    public boolean intersectsWith(Polygon polygon) {
        // TODO: IMPLEMENT SAT
        return false;
    }

    @Override
    public boolean intersectsWith(Edge edge) {
        return edge.intersectsWith(this);
    }

    public float getWidth() {
        return width;
    }

    public float getHeight() {
        return height;
    }

    public float getOuterCircleRadius() {
        return (Vector2.subtract(getPosition(), vertices.get(0))).magnitude();
    }

    private void calculateCoordinates() {
        float xMin = getPosition().getX() - width/2.0f;
        float xMax = xMin + width;
        float yMin = getPosition().getY() - height/2.0f;
        float yMax = yMin + height;

        // clockwise
        vertices.add(new Vector2(xMin, yMin));
        vertices.add(new Vector2(xMin, yMax));
        vertices.add(new Vector2(xMax, yMax));
        vertices.add(new Vector2(xMax, yMin));

        for(int i = 0; i < 3; i++) {
            edges.add(new Edge(vertices.get(i), vertices.get(i+1)));
        }
        edges.add(new Edge(vertices.get(3), vertices.get(0)));
    }
}


text:
#ifndef CARTOGRAPHER_MAPPING_2D_SUBMAPS_H_
#define CARTOGRAPHER_MAPPING_2D_SUBMAPS_H_

#include <memory>
#include <vector>

#include "Eigen/Core"
#include "cartographer/common/lua_parameter_dictionary.h"
#include "cartographer/mapping/proto/submap_visualization.pb.h"
#include "cartographer/mapping/submaps.h"
#include "cartographer/mapping/trajectory_node.h"
#include "cartographer/mapping_2d/laser_fan_inserter.h"
#include "cartographer/mapping_2d/map_limits.h"
#include "cartographer/mapping_2d/probability_grid.h"
#include "cartographer/mapping_2d/proto/submaps_options.pb.h"
#include "cartographer/sensor/laser.h"
#include "cartographer/transform/rigid_transform.h"

namespace cartographer {
namespace mapping_2d {

ProbabilityGrid ComputeCroppedProbabilityGrid(
    const ProbabilityGrid& probability_grid);

proto::SubmapsOptions CreateSubmapsOptions(
    common::LuaParameterDictionary* parameter_dictionary);

struct Submap : public mapping::Submap {
  Submap(const MapLimits& limits, const Eigen::Vector2f& origin,
         int begin_laser_fan_index);

  ProbabilityGrid probability_grid;
};

// A container of Submaps.
class Submaps : public mapping::Submaps {
 public:
  explicit Submaps(const proto::SubmapsOptions& options);

  Submaps(const Submaps&) = delete;
  Submaps& operator=(const Submaps&) = delete;

  const Submap* Get(int index) const override;
  int size() const override;
  void SubmapToProto(
      int index, const std::vector<mapping::TrajectoryNode>& trajectory_nodes,
      const transform::Rigid3d& global_submap_pose,
      mapping::proto::SubmapQuery::Response* response) const override;

  // Inserts 'laser_fan' into the Submap collection.
  void InsertLaserFan(const sensor::LaserFan& laser_fan);

 private:
  void FinishSubmap(int index);
  void AddSubmap(const Eigen::Vector2f& origin);

  const proto::SubmapsOptions options_;

  std::vector<std::unique_ptr<Submap>> submaps_;
  LaserFanInserter laser_fan_inserter_;

  // Number of LaserFans inserted.
  int num_laser_fans_ = 0;

  // Number of LaserFans inserted since the last Submap was added.
  int num_laser_fans_in_last_submap_ = 0;
};

}  // namespace mapping_2d
}  // namespace cartographer

#endif  // CARTOGRAPHER_MAPPING_2D_SUBMAPS_H_


text:
namespace Harnet.Dto
{
    public class CreatorDto
    {
        public string name { get; set; }
        public string version { get; set; }
        public string comment { get; set; }
    }
}