text:
'use strict';

var parser = require('../index')
  , ltx    = require('ltx')

var activityStreams = require('../lib/activity-streams')
  , atom = require('../lib/atom')
  , iodef = require('../lib/iodef')
  , buddycloud = require('../lib/media')

describe('Building ATOM feed with thread', function() {

    it('Can build an atom feed with <in-reply-to/>', function() {
        var stanza = ltx.parse('<item/>')
        var entity = {
            atom: {
                content: {
                    content: '
Where we\'re going we don\'t need roads!
',
                    lang: 'en_GB',
                    base: 'http://doc.brown.org',
                    type: 'xhtml'
                },
                title: 'Back to the future quote of the day',
                published: '2014-01-13T13:19:00.000Z',
                author: {
                    name: 'Doc Brown'
                }
            },
            'in-reply-to': {
                ref: 'item-12345-parent'
            },
            activity: {
                target: {
                    id: '12345',
                    'object-type': 'comment'
                },
                verb: 'rated',
                object: {
                    'object-type': 'comment'
                },
                author: {
                    'object-type': 'person'
                }
            },
            review: {
                rating: '5.0'
            }
        }
        parser.build(entity, stanza)
        var expected = '' +
            '<item><entry xmlns="' + atom.NS_ATOM + '" ' +
                'xmlns:' + activityStreams.PREFIX_NS_THREAD + '="' + activityStreams.NS_THREAD + '" ' +
                'xmlns:' + activityStreams.PREFIX_NS_ACTIVITY + '="' + activityStreams.NS_ACTIVITY + '" ' +
                'xmlns:' + activityStreams.PREFIX_NS_REVIEW + '="' + activityStreams.NS_REVIEW + '">' +
                '<content xml:lang="en_GB" xml:base="http://doc.brown.org" type="xhtml">' +
                    '
Where we\'re going we don\'t need roads!
' +
                '</content>' +
                '<title>Back to the future quote of the day</title>' +
                '<published>2014-01-13T13:19:00.000Z</published>' +
                '<author>' +
                    '<name>Doc Brown</name>' +
                    '<' + activityStreams.PREFIX_NS_ACTIVITY + ':object-type>' +
                        'person' +
                    '</' + activityStreams.PREFIX_NS_ACTIVITY + ':object-type>' +
                '</author>' +
                '<' + activityStreams.PREFIX_NS_THREAD + ':in-reply-to ref="item-12345-parent"/>' +
                '<' + activityStreams.PREFIX_NS_ACTIVITY + ':target>' +
                    '<id>12345</id>' +
                    '<object-type>comment</object-type>' +
                '</' + activityStreams.PREFIX_NS_ACTIVITY + ':target>' +
                '<' + activityStreams.PREFIX_NS_ACTIVITY + ':verb>rated' +
                    '</' + activityStreams.PREFIX_NS_ACTIVITY + ':verb>' +
                '<' + activityStreams.PREFIX_NS_ACTIVITY + ':object>' +
                    '<' + activityStreams.PREFIX_NS_ACTIVITY + ':object-type>comment' +
                        '</' + activityStreams.PREFIX_NS_ACTIVITY + ':object-type>' +
                '</activity:object>' +
                '<' + activityStreams.PREFIX_NS_REVIEW + ':rating>5.0' +
                    '</' + activityStreams.PREFIX_NS_REVIEW + ':rating>' +
            '</entry></item>'
        stanza.root().toString().should.equal(expected)
    })

})

describe('Parsing ATOM feed with activity streams', function() {

    it('Should parse a full stanza', function() {
        var expected = {
            atom: {
                title: 'Back to the future quote of the day',
                published: '2014-01-13T13:19:00.000Z',
                content: {
                    content: '
Where we\'re going we don\'t need roads!
',
                    lang: 'en_GB',
                    base: 'http://doc.brown.org',
                    type: 'xhtml'
                },
                author: {
                    name: 'Doc Brown'
                }
            },
            activity: {
                target: {
                    id: '12345',
                    'object-type': 'comment'
                },
                verb: 'rated',
                object: {
                    'object-type': 'comment'
                },
                author: {
                    'object-type': 'person'
                }
            },
            'in-reply-to': {
                ref: 'item-12345-parent'
            },
            review: {
                rating: 5
            }
        }
        var stanza = '' +
            '<item><entry xmlns="' + atom.NS_ATOM + '" ' +
                'xmlns:' + activityStreams.PREFIX_NS_THREAD + '="' + activityStreams.NS_THREAD + '" ' +
                'xmlns:' + activityStreams.PREFIX_NS_ACTIVITY + '="' + activityStreams.NS_ACTIVITY + '" ' +
                'xmlns:' + activityStreams.PREFIX_NS_REVIEW + '="' + activityStreams.NS_REVIEW + '">' +
                '<content xml:lang="en_GB" xml:base="http://doc.brown.org" type="xhtml">' +
                    '
Where we\'re going we don\'t need roads!
' +
                '</content>' +
                '<title>Back to the future quote of the day</title>' +
                '<published>2014-01-13T13:19:00.000Z</published>' +
                '<author>' +
                    '<name>Doc Brown</name>' +
                    '<' + activityStreams.PREFIX_NS_ACTIVITY + ':object-type>' +
                        'person' +
                    '</' + activityStreams.PREFIX_NS_ACTIVITY + ':object-type>' +
                '</author>' +
                '<' + activityStreams.PREFIX_NS_THREAD + ':in-reply-to ref="item-12345-parent"/>' +
                '<' + activityStreams.PREFIX_NS_ACTIVITY + ':target>' +
                    '<id>12345</id>' +
                    '<object-type>comment</object-type>' +
                '</' + activityStreams.PREFIX_NS_ACTIVITY + ':target>' +
                '<' + activityStreams.PREFIX_NS_ACTIVITY + ':verb>rated' +
                    '</' + activityStreams.PREFIX_NS_ACTIVITY + ':verb>' +
                '<' + activityStreams.PREFIX_NS_ACTIVITY + ':object>' +
                    '<' + activityStreams.PREFIX_NS_ACTIVITY + ':object-type>comment' +
                        '</' + activityStreams.PREFIX_NS_ACTIVITY + ':object-type>' +
                '</activity:object>' +
                '<' + activityStreams.PREFIX_NS_REVIEW + ':rating>5.0' +
                    '</' + activityStreams.PREFIX_NS_REVIEW + ':rating>' +
            '</entry></item>'
        parser.parse(ltx.parse(stanza)).should.eql(expected)
    })

})

describe('Parser injection', function() {

    var defaultParsers = parser.getParsers().slice(0)
    var parserCount = parser.getParsers().length

    beforeEach(function() {
        parser.setParsers(defaultParsers)
        parserCount = parser.getParsers().length
    })

    after(function() {
        parser.setParsers(defaultParsers)
    })

    it('Should not include iodef parser by default', function() {
        defaultParsers.should.not.include(parser.availableParsers.iodef)
    })

    it('Should add an available parser to enabled parsers', function() {
        parser.addParser(parser.availableParsers.iodef)
        parser.getParsers().should.have.length(parserCount + 1)
    })

    it('Should remove a parser from enabled parsers', function() {
        parser.removeParser(parser.availableParsers.json)
        parser.getParsers().should.have.length(parserCount - 1)
    })

    it('Should remove all enabled parsers', function() {
        parser.removeAllParsers()
        parser.getParsers().should.have.length(0)
    })

    it('Should set all enabled parsers in a single call', function() {
        parser.setParsers([parser.availableParsers.json, parser.availableParsers.iodef])
        parser.getParsers().should.have.length(2)
    })

    it('Should not add the same parser more than once', function() {
        parser.addParser(parser.availableParsers.iodef)
        parser.addParser(parser.availableParsers.iodef)
        parser.getParsers().should.have.length(parserCount + 1)
    })
})

describe('IODEF support', function() {

    var iodefJson = {
        'IODEF-Document': {
            version: iodef.VERSION_IODEF,
            lang: 'en',
            formatid: 'simulation',
            Incidents: [{
                purpose: 'ext-value',
                'ext-purpose': 'new-purpose',
                lang: 'en',
                restriction: 'need-to-know',
                IncidentID: {
                    IncidentID: '189493',
                    name: 'cert.example.com',
                    instance: '5',
                    restriction: 'private',
                },
                ReportTime: {ReportTime:'2014-03-27T12:39:24+00:00'},
                Assessments: [{
                    occurrence : 'actual',
                    restriction : 'private',
                    Impacts: [{
                        lang: 'en',
                        severity: 'medium',
                        completion: 'succeeded',
                        type: 'ext-value',
                        'ext-type': 'new-type',
                        Impact: 'A new type of attack has taken all of our printers offline.',
                    }],
                }],
                Contacts: [{
                    role: 'ext-value',
                    'ext-role': 'new-role',
                    type: 'ext-value',
                    'ext-type': 'new-type',
                    restriction: 'public',
                    ContactName: {ContactName:'Bill Folds'},
                    Emails: [{
                        meaning: 'IRT group address, manned Mon-Fri 9-5 UTC',
                        Email: 'contact@cert.example.com',
                    }]
                }],
            }],
        }
    }

    var iodefXml = '' +
        '<IODEF-Document'  +
            ' version="' + iodef.VERSION_IODEF + '"' +
            ' lang="en"'+
            ' formatid="simulation"' +
            ' xmlns="' + iodef.NS_IODEF +
        '">' +
        '<Incident purpose="ext-value" ext-purpose="new-purpose" lang="en" restriction="need-to-know">' +
            '<IncidentID name="cert.example.com" instance="5" restriction="private">189493</IncidentID>' +
            '<ReportTime>2014-03-27T12:39:24+00:00</ReportTime>' +
            '<Assessment occurrence="actual" restriction="private">' +
                '<Impact lang="en" severity="medium" completion="succeeded" type="ext-value" ext-type="new-type">' +
                    'A new type of attack has taken all of our printers offline.' +
                '</Impact>' +
            '</Assessment>' +
            '<Contact role="ext-value" ext-role="new-role" '  +
                        'type="ext-value" ext-type="new-type" restriction="public">' +
                '<ContactName>Bill Folds</ContactName>' +
                '<Email meaning="IRT group address, manned Mon-Fri 9-5 UTC">contact@cert.example.com</Email>' +
            '</Contact>' +
        '</Incident>' +
        '</IODEF-Document>'

    before(function(){
        parser.addParser(parser.availableParsers.iodef)
    })

    after(function(){
        parser.removeParser(parser.availableParsers.iodef)
    })

    it('Should parse a basic IODEF document', function() {
        var iodefDocument = iodefXml
        var expected = iodefJson

        parser.parse(ltx.parse(iodefDocument)).should.eql(expected)
    })

    it('Should build a basic IODEF document', function() {
        var emptyIodefDocument = '<item/>'
        var stanza = ltx.parse(emptyIodefDocument)

        var entity = iodefJson
        var expected = iodefXml

        parser.build(entity, stanza)
        stanza.root().getChild('IODEF-Document').toString().should.equal(expected)
    })
})

describe('Buddycloud media posts', function() {

    it('Should parse a full stanza', function() {
        var expected = {
            atom: {
                title: 'Back to the future quote of the day',
                published: '2014-01-13T13:19:00.000Z',
                content: {
                    content: '
Where we\'re going we don\'t need roads!
',
                    type: 'xhtml',
                    lang: 'en_GB',
                    base: 'http://doc.brown.org'
                },
                author: {
                    name: 'Doc Brown'
                }
            },
            media: [ '12345', '67890' ]
        }
        var stanza = '' +
            '<item><entry xmlns="' + atom.NS_ATOM + '">' +
                '<content xml:lang="en_GB" xml:base="http://doc.brown.org" type="xhtml">' +
                    '
Where we\'re going we don\'t need roads!
' +
                '</content>' +
                '<title>Back to the future quote of the day</title>' +
                '<published>2014-01-13T13:19:00.000Z</published>' +
                '<author>' +
                    '<name>Doc Brown</name>' +
                    '<' + activityStreams.PREFIX_NS_ACTIVITY + ':object-type>' +
                        'person' +
                    '</' + activityStreams.PREFIX_NS_ACTIVITY + ':object-type>' +
                '</author>' +
                '<media xmlns="' + buddycloud.NS_BUDDYCLOUD_MEDIA + '">' +
                    '<item id="12345" />' +
                    '<item id="67890" />'+
                '</media>' +
            '</entry></item>'
        parser.parse(ltx.parse(stanza)).should.eql(expected)
    })

    it('Can build an atom feed with <media/>', function() {
        var stanza = ltx.parse('<item/>')
        var entity = {
            atom: {
                content: {
                    content: '
Where we\'re going we don\'t need roads!
',
                    lang: 'en_GB',
                    base: 'http://doc.brown.org',
                    type: 'xhtml'
                },
                title: 'Back to the future quote of the day',
                published: '2014-01-13T13:19:00.000Z',
                author: {
                    name: 'Doc Brown'
                }
            },
            media: [ '12345', '67890' ]
        }
        parser.build(entity, stanza)
        var expected = '' +
            '<item><entry xmlns="' + atom.NS_ATOM + '">' +
                '<content xml:lang="en_GB" xml:base="http://doc.brown.org" type="xhtml">' +
                    '
Where we\'re going we don\'t need roads!
' +
                '</content>' +
                '<title>Back to the future quote of the day</title>' +
                '<published>2014-01-13T13:19:00.000Z</published>' +
                '<author>' +
                    '<name>Doc Brown</name>' +
                '</author>' +
                '<media xmlns="http://buddycloud.org/v1/media">' +
                    '<item id="12345"/>' +
                    '<item id="67890"/>'+
                '</media>' +
            '</entry></item>'

        stanza.root().toString().should.equal(expected)
    })

})

redpajama_set_name: RedPajamaGithub


text:
package org.apache.spark.sql.execution.datasources.v2

import org.apache.spark.sql.catalyst.InternalRow
import org.apache.spark.sql.catalyst.analysis.ResolvedPartitionSpec
import org.apache.spark.sql.catalyst.expressions.Attribute
import org.apache.spark.sql.connector.catalog.{SupportsAtomicPartitionManagement, SupportsPartitionManagement}

/**
 * Physical plan node for table partition truncation.
 */
case class TruncatePartitionExec(
    table: SupportsPartitionManagement,
    partSpec: ResolvedPartitionSpec,
    refreshCache: () => Unit) extends LeafV2CommandExec {

  override def output: Seq[Attribute] = Seq.empty

  override protected def run(): Seq[InternalRow] = {
    val isTableAltered = if (table.partitionSchema.length != partSpec.names.length) {
      table match {
        case atomicPartTable: SupportsAtomicPartitionManagement =>
          val partitionIdentifiers = atomicPartTable.listPartitionIdentifiers(
            partSpec.names.toArray, partSpec.ident)
          atomicPartTable.truncatePartitions(partitionIdentifiers)
        case _ =>
          throw new UnsupportedOperationException(
            s"The table ${table.name()} does not support truncation of multiple partition.")
      }
    } else {
      table.truncatePartition(partSpec.ident)
    }
    if (isTableAltered) refreshCache()
    Seq.empty
  }
}


text:
<!DOCTYPE html>
<meta charset="utf-8">
<title>window.originAgentCluster for a top-level frame sandboxed by CSP with no Origin-Agent-Cluster header</title>


text: <!DOCTYPE html>


text:
package com.app.domain.repositories;

/**
 * imports
 */
import java.util.Collection;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import com.app.domain.model.types.Alumno;
import com.app.domain.model.types.InstanciaCurso;

@Repository
/**
 * @author David Romero Alcaide
 *
 */
public interface InstanciaCursoRepository extends JpaRepository<InstanciaCurso, Integer> {

	@Query("select c.alumnos from InstanciaCurso c where c.id = ?1")
	Collection<Alumno> getAlumnosEnCurso(Integer cursoId);

	@Query("select c from InstanciaCurso c where c.curso.nivel=?1 and c.curso.nivelEducativo=?2 and c.curso.identificador=?3")
	InstanciaCurso findCurso(int nivel, String nivelEducativo, char identificador);

	@Query("select c from InstanciaCurso c where c.cursoAcademico.id = ?1")
	Collection<InstanciaCurso> findCursosAnioAcademico(int cursoAcademicoId);

}


text:
package org.apache.nifi.attribute.expression.language.evaluation.functions;

import java.util.Map;
import java.util.UUID;

import org.apache.nifi.attribute.expression.language.evaluation.Evaluator;
import org.apache.nifi.attribute.expression.language.evaluation.QueryResult;
import org.apache.nifi.attribute.expression.language.evaluation.StringEvaluator;
import org.apache.nifi.attribute.expression.language.evaluation.StringQueryResult;

public class UuidEvaluator extends StringEvaluator {

    @Override
    public QueryResult<String> evaluate(final Map<String, String> attributes) {
        return new StringQueryResult(UUID.randomUUID().toString());
    }

    @Override
    public Evaluator<?> getSubjectEvaluator() {
        return null;
    }

}


text:
$ErrorActionPreference = 'Stop'

$toolsDir = Split-Path $MyInvocation.MyCommand.Definition

$packageArgs = @{
  packageName    = 'audacity'
  fileType       = 'exe'
  file           = gi "$toolsDir\*.exe"
  silentArgs     = '/VERYSILENT'
  validExitCodes = @(0, 1223)
}
Install-ChocolateyInstallPackage @packageArgs
rm ($toolsDir + '\*.' + $packageArgs.fileType)

$packageName = $packageArgs.packageName
$installLocation = Get-AppInstallLocation $packageName
if ($installLocation)  {
    Write-Host "$packageName installed to '$installLocation'"
    Register-Application "$installLocation\$packageName.exe"
    Write-Host "$packageName registered as $packageName"
}
else { Write-Warning "Can't find $PackageName install location" }


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
null

#### Original name
Olpidium lauderiae Gran

### Remarks
null


text:
using AutoMapper;
using sapHowmuch.Api.Business.Events;
using sapHowmuch.Api.Business.Models.Requests;
using sapHowmuch.Api.Infrastructure.Models.Requests;
using sapHowmuch.Api.Infrastructure.RequestHandlers;

namespace sapHowmuch.Api.Business.RequestHandlers
{
	public class JournalVoucherCreateRequestHandler : BaseRequestHandler<JournalVoucherCreateRequest, JournalVoucherCreatedEvent>
	{
		protected override JournalVoucherCreatedEvent OnCreatingEvent(BaseRequest request)
		{
			var @event = Mapper.Map<JournalVoucherCreatedEvent>(request as JournalVoucherCreateRequest);

			return @event;
		}
	}
}


text:
'use strict';

/**
 * Module dependencies.
 */
var _ = require('lodash'),
	errorHandler = require('../errors.server.controller.js'),
	mongoose = require('mongoose'),
	passport = require('passport'),
	User = mongoose.model('User');

/**
* Sequelize Dependiences
*/
var db = require('../../../config/sequelize'),
	sequelize = db.sequelize,
	schema = db.schema,
	Bought = schema.Bought,
	AuctionItem = schema.AuctionItem;

/**
 * Update user details
 */
exports.update = function(req, res) {
	// Init Variables
	var user = req.user;
	var message = null;

	// For security measurement we remove the roles from the req.body object
	delete req.body.roles;

	if (user) {
		// Merge existing user
		user = _.extend(user, req.body);
		user.updated = Date.now();
		user.displayName = user.firstName + ' ' + user.lastName;

		user.save(function(err) {
			if (err) {
				return res.status(400).send({
					message: errorHandler.getErrorMessage(err)
				});
			} else {
				req.login(user, function(err) {
					if (err) {
						res.status(400).send(err);
					} else {
						res.json(user);
					}
				});
			}
		});
	} else {
		res.status(400).send({
			message: 'User is not signed in'
		});
	}
};

/**
 * Send User
 */
exports.me = function(req, res) {
	res.json(req.user || null);
};

/**
* Get User's Orders
*/
exports.orders = function(req, res) {
	console.log("ORDERSASDFGHJKJHGF");
	var username = req.user.username;
	Bought.findAll({where: {buyer_name: username}}).success(function(boughtItems){
		if(!boughtItems) return res.jsonp("{message: No order nothing}");
		console.log("Inside orders");
		console.log(boughtItems);
		req.orders = boughtItems;
		res.jsonp(boughtItems);
	}).error(function(err){
		res.jsonp(err);
	});
};

/**
** Get User's won auctions
*/
exports.wonauctions = function(req, res) {
	console.log("Inside won auctions");
	var username = req.user.username;
	AuctionItem.findAll({where: {buyer_name: username, auction_ended: true}}).success(function(wonauctions){
		console.log(wonauctions);
		req.wonauctions = wonauctions;
		res.jsonp(wonauctions);
	}).error(function(err){
		res.jsonp(err);
	});
};


text:
package hellofs

import (
	"context"
	"io"
	"os"
	"strings"

	"github.com/jacobsa/fuse"
	"github.com/jacobsa/fuse/fuseops"
	"github.com/jacobsa/fuse/fuseutil"
	"github.com/jacobsa/timeutil"
)

// Create a file system with a fixed structure that looks like this:
//
//	hello
//	dir/
//	    world
//
// Each file contains the string "Hello, world!".
func NewHelloFS(clock timeutil.Clock) (fuse.Server, error) {
	fs := &helloFS{
		Clock: clock,
	}

	return fuseutil.NewFileSystemServer(fs), nil
}

type helloFS struct {
	fuseutil.NotImplementedFileSystem

	Clock timeutil.Clock
}

const (
	rootInode fuseops.InodeID = fuseops.RootInodeID + iota
	helloInode
	dirInode
	worldInode
)

type inodeInfo struct {
	attributes fuseops.InodeAttributes

	// File or directory?
	dir bool

	// For directories, children.
	children []fuseutil.Dirent
}

// We have a fixed directory structure.
var gInodeInfo = map[fuseops.InodeID]inodeInfo{
	// root
	rootInode: inodeInfo{
		attributes: fuseops.InodeAttributes{
			Nlink: 1,
			Mode:  0555 | os.ModeDir,
		},
		dir: true,
		children: []fuseutil.Dirent{
			fuseutil.Dirent{
				Offset: 1,
				Inode:  helloInode,
				Name:   "hello",
				Type:   fuseutil.DT_File,
			},
			fuseutil.Dirent{
				Offset: 2,
				Inode:  dirInode,
				Name:   "dir",
				Type:   fuseutil.DT_Directory,
			},
		},
	},

	// hello
	helloInode: inodeInfo{
		attributes: fuseops.InodeAttributes{
			Nlink: 1,
			Mode:  0444,
			Size:  uint64(len("Hello, world!")),
		},
	},

	// dir
	dirInode: inodeInfo{
		attributes: fuseops.InodeAttributes{
			Nlink: 1,
			Mode:  0555 | os.ModeDir,
		},
		dir: true,
		children: []fuseutil.Dirent{
			fuseutil.Dirent{
				Offset: 1,
				Inode:  worldInode,
				Name:   "world",
				Type:   fuseutil.DT_File,
			},
		},
	},

	// world
	worldInode: inodeInfo{
		attributes: fuseops.InodeAttributes{
			Nlink: 1,
			Mode:  0444,
			Size:  uint64(len("Hello, world!")),
		},
	},
}

func findChildInode(
	name string,
	children []fuseutil.Dirent) (fuseops.InodeID, error) {
	for _, e := range children {
		if e.Name == name {
			return e.Inode, nil
		}
	}

	return 0, fuse.ENOENT
}

func (fs *helloFS) patchAttributes(
	attr *fuseops.InodeAttributes) {
	now := fs.Clock.Now()
	attr.Atime = now
	attr.Mtime = now
	attr.Crtime = now
}

func (fs *helloFS) StatFS(
	ctx context.Context,
	op *fuseops.StatFSOp) error {
	return nil
}

func (fs *helloFS) LookUpInode(
	ctx context.Context,
	op *fuseops.LookUpInodeOp) error {
	// Find the info for the parent.
	parentInfo, ok := gInodeInfo[op.Parent]
	if !ok {
		return fuse.ENOENT
	}

	// Find the child within the parent.
	childInode, err := findChildInode(op.Name, parentInfo.children)
	if err != nil {
		return err
	}

	// Copy over information.
	op.Entry.Child = childInode
	op.Entry.Attributes = gInodeInfo[childInode].attributes

	// Patch attributes.
	fs.patchAttributes(&op.Entry.Attributes)

	return nil
}

func (fs *helloFS) GetInodeAttributes(
	ctx context.Context,
	op *fuseops.GetInodeAttributesOp) error {
	// Find the info for this inode.
	info, ok := gInodeInfo[op.Inode]
	if !ok {
		return fuse.ENOENT
	}

	// Copy over its attributes.
	op.Attributes = info.attributes

	// Patch attributes.
	fs.patchAttributes(&op.Attributes)

	return nil
}

func (fs *helloFS) OpenDir(
	ctx context.Context,
	op *fuseops.OpenDirOp) error {
	// Allow opening any directory.
	return nil
}

func (fs *helloFS) ReadDir(
	ctx context.Context,
	op *fuseops.ReadDirOp) error {
	// Find the info for this inode.
	info, ok := gInodeInfo[op.Inode]
	if !ok {
		return fuse.ENOENT
	}

	if !info.dir {
		return fuse.EIO
	}

	entries := info.children

	// Grab the range of interest.
	if op.Offset > fuseops.DirOffset(len(entries)) {
		return fuse.EIO
	}

	entries = entries[op.Offset:]

	// Resume at the specified offset into the array.
	for _, e := range entries {
		n := fuseutil.WriteDirent(op.Dst[op.BytesRead:], e)
		if n == 0 {
			break
		}

		op.BytesRead += n
	}

	return nil
}

func (fs *helloFS) OpenFile(
	ctx context.Context,
	op *fuseops.OpenFileOp) error {
	// Allow opening any file.
	return nil
}

func (fs *helloFS) ReadFile(
	ctx context.Context,
	op *fuseops.ReadFileOp) error {
	// Let io.ReaderAt deal with the semantics.
	reader := strings.NewReader("Hello, world!")

	var err error
	op.BytesRead, err = reader.ReadAt(op.Dst, op.Offset)

	// Special case: FUSE doesn't expect us to return io.EOF.
	if err == io.EOF {
		return nil
	}

	return err
}


text:
using System;
using NUnit.Framework.Api;

namespace NUnit.Framework.Internal
{
    [TestFixture]
    public class TestXmlTests
    {
        private TestSuite testSuite;
        private TestFixture testFixture;
        private TestMethod testMethod;

        [SetUp]
        public void SetUp()
        {
            testFixture = new TestFixture(typeof(DummyFixture));
            testFixture.Properties.Set(PropertyNames.Description, "Fixture description");
            testFixture.Properties.Add(PropertyNames.Category, "Fast");
            testFixture.Properties.Add("Value", 3);

            testMethod = new TestMethod(typeof(DummyFixture).GetMethod("DummyMethod"), testFixture);
            testMethod.Properties.Set(PropertyNames.Description, "Test description");
            testMethod.Properties.Add(PropertyNames.Category, "Dubious");
            testMethod.Properties.Set("Priority", "low");

            testFixture.Tests.Add(testMethod);

            testSuite = new TestSuite(typeof(DummyFixture));
            testSuite.Properties.Set(PropertyNames.Description, "Suite description");
        }

        [Test]
        public void TestTypeTests()
        {
            Assert.That(testMethod.TestType,
                Is.EqualTo("TestMethod"));
            Assert.That(testFixture.TestType,
                Is.EqualTo("TestFixture"));
            Assert.That(testSuite.TestType,
                Is.EqualTo("TestSuite"));
            Assert.That(new TestAssembly(System.Reflection.Assembly.GetExecutingAssembly(), "junk").TestType,
                Is.EqualTo("Assembly"));
            Assert.That(new ParameterizedMethodSuite(typeof(DummyFixture).GetMethod("ParameterizedMethod")).TestType,
                Is.EqualTo("ParameterizedMethod"));
            Assert.That(new ParameterizedFixtureSuite(typeof(DummyFixture)).TestType,
                Is.EqualTo("ParameterizedFixture"));
#if CLR_2_0 || CLR_4_0
            Assert.That(new ParameterizedMethodSuite(typeof(DummyFixture).GetMethod("GenericMethod")).TestType,
                Is.EqualTo("GenericMethod"));
            Type genericType = typeof(DummyGenericFixture<int>).GetGenericTypeDefinition();
            Assert.That(new ParameterizedFixtureSuite(genericType).TestType,
                Is.EqualTo("GenericFixture"));
#endif
        }

        [Test]
        public void TestMethodToXml()
        {
            CheckXmlForTest(testMethod, false);
        }

        [Test]
        public void TestFixtureToXml()
        {
            CheckXmlForTest(testFixture, false);
        }

        [Test]
        public void TestFixtureToXml_Recursive()
        {
            CheckXmlForTest(testFixture, true);
        }

        [Test]
        public void TestSuiteToXml()
        {
            CheckXmlForTest(testSuite, false);
        }

        [Test]
        public void TestSuiteToXml_Recursive()
        {
            CheckXmlForTest(testSuite, true);
        }

        #region Helper Methods For Checking XML

        private void CheckXmlForTest(Test test, bool recursive)
        {
            XmlNode topNode = test.ToXml(true);
            CheckXmlForTest(test, topNode, recursive);
        }

        private void CheckXmlForTest(Test test, XmlNode topNode, bool recursive)
        {
            Assert.NotNull(topNode);

            //if (test is TestSuite)
            //{
            //    Assert.That(topNode.Name, Is.EqualTo("test-suite"));
            //    Assert.That(topNode.Attributes["type"].Value, Is.EqualTo(test.XmlElementName));
            //}
            //else
            //{
            //    Assert.That(topNode.Name, Is.EqualTo("test-case"));
            //}

            Assert.That(topNode.Name, Is.EqualTo(test.XmlElementName));
            Assert.That(topNode.Attributes["id"], Is.EqualTo(test.Id.ToString()));
            Assert.That(topNode.Attributes["name"], Is.EqualTo(test.Name));
            Assert.That(topNode.Attributes["fullname"], Is.EqualTo(test.FullName));

            int expectedCount = test.Properties.Count;
            if (expectedCount > 0)
            {
                string[] expectedProps = new string[expectedCount];
                int count = 0;
                foreach (PropertyEntry entry in test.Properties)
                    expectedProps[count++] = entry.ToString();

                XmlNode propsNode = topNode.FindDescendant("properties");
                Assert.NotNull(propsNode);

                int actualCount = propsNode.ChildNodes.Count;
                string[] actualProps = new string[actualCount];
                for (int i = 0; i < actualCount; i++)
                {
                    XmlNode node = propsNode.ChildNodes[i] as XmlNode;
                    string name = node.Attributes["name"];
                    string value = node.Attributes["value"];
                    actualProps[i] = name + "=" + value.ToString();
                }

                Assert.That(actualProps, Is.EquivalentTo(expectedProps));
            }

            if (recursive)
            {
                TestSuite suite = test as TestSuite;
                if (suite != null)
                {
                    foreach (Test child in suite.Tests)
                    {
                        string xpathQuery = string.Format("{0}[@id={1}]", child.XmlElementName, child.Id);
                        XmlNode childNode = topNode.FindDescendant(xpathQuery);
                        Assert.NotNull(childNode, "Expected node for test with ID={0}, Name={1}", child.Id, child.Name);

                        CheckXmlForTest(child, childNode, recursive);
                    }
                }
            }
        }

        #endregion

        public class DummyFixture
        {
            public void DummyMethod() { }
            public void ParameterizedMethod(int x) { }
#if CLR_2_0 || CLR_4_0
            public void GenericMethod<T>(T x) { }
#endif
        }

#if CLR_2_0 || CLR_4_0
       public class DummyGenericFixture<T>
        {
        }
#endif
    }
}


text:
<Alloy>
    <Window  class="container" onOpen="alAbrir" exitOnClose="true">
        <ActivityIndicator id="actInd" message="Cargando datos..."/>
        <ScrollView id="categoryScrollView" onClick="onClicScroll" />
    </Window>
</Alloy>


text:
layout: page
title: gp-Guadeloupe
---
{% include postbycat key="gp" %}


text:
import base64
import json

from tests.factories import (
    BMSServerFactory, MappingFactory, OperationDetailsFactory,
    OperationFactory, ProjectFactory, SourceDBFactory, WaveFactory
)

message = {
    'message': {
        'attributes': {
            'key': 'value'
        },
        'data': {},
        'messageId': '2070443601311540',
        'message_id': '2070443601311540',
        'publishTime': '2021-02-26T19:13:55.749Z',
        'publish_time': '2021-02-26T19:13:55.749Z',
    },
    'subscription': 'projects/myproject/subscriptions/mysubscription'
}

def encode(data):
    """Function to encode data for pubsub message."""
    data['timestamp'] = 123456789
    data = base64.urlsafe_b64encode(json.dumps(data).encode()).decode()
    return data

def test_step_is_optional(client):
    pr = ProjectFactory()
    wave = WaveFactory(project=pr)
    db_1 = SourceDBFactory(project=pr, wave=wave)
    bms_1 = BMSServerFactory(name='oracle-bms-vm1')
    map_1 = MappingFactory(source_db=db_1, bms=bms_1)
    op_1 = OperationFactory(wave=wave)
    op_details = OperationDetailsFactory(
        wave=wave,
        mapping=map_1,
        operation=op_1
    )

    msg_data = {'wave_id': wave.id, 'operation_id': op_1.id}
    message['message']['data'] = encode(msg_data)

    client.post(f'/webhooks/status', json=message)

    assert op_details.step == 'PRE_DEPLOYMENT'

def test_correct_host_update(client):
    pr = ProjectFactory()
    wave = WaveFactory(project=pr)
    bms_1 = BMSServerFactory()
    bms_2 = BMSServerFactory()
    bms_3 = BMSServerFactory()
    map_1 = MappingFactory(bms=bms_1)
    map_2 = MappingFactory(bms=bms_2)
    map_3 = MappingFactory(bms=bms_3)
    op_1 = OperationFactory(wave=wave)
    op_details_1 = OperationDetailsFactory(
        wave=wave,
        mapping=map_1,
        operation=op_1
    )
    op_details_2 = OperationDetailsFactory(
        wave=wave,
        mapping=map_2,
        operation=op_1
    )
    op_details_3 = OperationDetailsFactory(
        wave=wave,
        mapping=map_3,
        operation=op_1
    )

    msg_data = {'wave_id': wave.id,
                'operation_id': op_1.id,
                'hostnames': [bms_2.name, bms_3.name],
                'step': 'STEP1'}
    message['message']['data'] = encode(msg_data)

    client.post(f'/webhooks/status', json=message)

    assert op_details_1.step == 'PRE_DEPLOYMENT'
    assert op_details_2.step == 'STEP1'
    assert op_details_3.step == 'STEP1'

    assert not op_details_1.step_upd_at
    assert op_details_2.step_upd_at
    assert op_details_3.step_upd_at


text:
SYNONYM

#### According to
Index Fungorum

#### Published in
Handbuck zur Erkennung der Nutzbarsten und am Häufigsten Vorkommenden Gewächse 3: 341, 487 (1833)

#### Original name
Nematocolla Link

### Remarks
null


text:
///////////////////////////////////////////////////////////
//
//  This file is part of RTArduLink
//
//  Copyright (c) 2014-2015 richards-tech
//
//  Permission is hereby granted, free of charge,
//  to any person obtaining a copy of
//  this software and associated documentation files
//  (the "Software"), to deal in the Software without
//  restriction, including without limitation the rights
//  to use, copy, modify, merge, publish, distribute,
//  sublicense, and/or sell copies of the Software, and
//  to permit persons to whom the Software is furnished
//  to do so, subject to the following conditions:
//
//  The above copyright notice and this permission notice
//  shall be included in all copies or substantial portions
//  of the Software.
//
//  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
//  ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
//  TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
//  PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
//  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
//  CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
//  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
//  IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
//  DEALINGS IN THE SOFTWARE.

#include <string.h>
#include "RTArduLinkHAL.h"

//----------------------------------------------------------
//
//  Arduino HAL

//  The global config structure

RTARDULINKHAL_EEPROM RTArduLinkHALConfig;

bool RTArduLinkHALAddHardwarePort(RTARDULINKHAL_PORT *port, long portSpeed, unsigned char hardwarePort);

//  Port speed map array

unsigned long RTArduLinkHALSpeedMap[] = {0, 9600, 19200, 38400, 57600, 115200};

bool RTArduLinkHALConfigurePort(RTARDULINKHAL_PORT *port, int portIndex)
{
    if (RTArduLinkHALConfig.portSpeed[portIndex] == RTARDULINK_PORT_SPEED_OFF)
        return false;                                       // port is not enabled

    return RTArduLinkHALAddHardwarePort(port, RTArduLinkHALSpeedMap[RTArduLinkHALConfig.portSpeed[portIndex]],
                    RTArduLinkHALConfig.hardwarePort[portIndex]);
}

int RTArduLinkHALPortAvailable(RTARDULINKHAL_PORT *port)
{
    return port->serialPort->available();
}

unsigned char RTArduLinkHALPortRead(RTARDULINKHAL_PORT *port)
{
    return port->serialPort->read();
}

void RTArduLinkHALPortWrite(RTARDULINKHAL_PORT *port, unsigned char *data, unsigned char length)
{
    port->serialPort->write(data, length);
}

bool RTArduLinkHALAddHardwarePort(RTARDULINKHAL_PORT *port, long portSpeed, unsigned char hardwarePort)
{
    HardwareSerial *hardPort;

    switch (hardwarePort) {
        case 0:
#if defined(USBCON)
            /* Leonardo support */
            hardPort = &Serial1;
#else
            hardPort = &Serial;
#endif
            break;

        case 1:
#if defined(UBRR1H)
            hardPort = &Serial1;
#else
            return false;
#endif
            break;

        case 2:
#if defined(UBRR2H)
            hardPort = &Serial2;
#else
            return false;
#endif
            break;

        case 3:
#if defined(UBRR3H)
            hardPort = &Serial3;
#else
            return false;
#endif
            break;

        default:
            return false;
    }

    port->serialPort = hardPort;
    hardPort->begin(portSpeed);                             // start the port
    return true;
}

bool RTArduLinkHALEEPROMValid()
{
    RTArduLinkHALEEPROMRead();                              // see what it really is
    return (RTArduLinkHALConfig.sig0 == RTARDULINKHAL_SIG0) &&
        (RTArduLinkHALConfig.sig1 == RTARDULINKHAL_SIG1);
}

void RTArduLinkHALEEPROMDisplay()
{
    Serial.println();

    if ((RTArduLinkHALConfig.sig0 != RTARDULINKHAL_SIG0) ||
        (RTArduLinkHALConfig.sig1 != RTARDULINKHAL_SIG1)) {
        Serial.println("Invalid config");
        return;
    }
    Serial.print("Identity: ");
    Serial.println(RTArduLinkHALConfig.identity);

    for (int i = 0; i < RTARDULINKHAL_MAX_PORTS; i++)
        RTArduLinkHALEEPROMDisplayPort(i, true);
}

void RTArduLinkHALEEPROMDisplayPort(int index, bool suppress)
{
    if (suppress && (RTArduLinkHALConfig.portSpeed[index] == RTARDULINK_PORT_SPEED_OFF))
        return;
    Serial.print("Port index ");
    Serial.print(index);
    Serial.print(" speed=");
    Serial.print(RTArduLinkHALConfig.portSpeed[index]);
    Serial.print(", ");
    Serial.print("hardware port number=");
    Serial.println(RTArduLinkHALConfig.hardwarePort[index]);
}

void RTArduLinkHALEEPROMDefault()
{
    RTArduLinkHALConfig.sig0 = RTARDULINKHAL_SIG0;       // set to valid signature
    RTArduLinkHALConfig.sig1 = RTARDULINKHAL_SIG1;
    strcpy(RTArduLinkHALConfig.identity, "RTArduLink_Arduino");

    RTArduLinkHALConfig.portSpeed[0] = RTARDULINK_PORT_SPEED_115200;
    for (int i = 1; i < RTARDULINKHAL_MAX_PORTS; i++)
        RTArduLinkHALConfig.portSpeed[i] = RTARDULINK_PORT_SPEED_OFF;

    for (int i = 0; i < RTARDULINKHAL_MAX_PORTS; i++)
        RTArduLinkHALConfig.hardwarePort[i] = i;

    RTArduLinkHALEEPROMWrite();
}

void RTArduLinkHALEEPROMRead()
{
    unsigned char *data;

    data = (unsigned char *)&RTArduLinkHALConfig;

    for (int i = 0; i < (int)sizeof(RTARDULINKHAL_EEPROM); i++)
        *data++ = EEPROM.read(i + RTARDULINKHAL_EEPROM_OFFSET);
}

void RTArduLinkHALEEPROMWrite()
{
    unsigned char *data;

    data = (unsigned char *)&RTArduLinkHALConfig;

    for (int i = 0; i < (int)sizeof(RTARDULINKHAL_EEPROM); i++)
        EEPROM.write(i + RTARDULINKHAL_EEPROM_OFFSET, *data++);
}


text:
class UpdateTester extends eg.Game {

    public UpdateCount: number;

    private _onUpdateLimit: Function;
    private _updateLimit: number;

    constructor(updateRate: number, onUpdateLimit: Function, updateLimit: number)
    {
        super();

        this.Configuration.UpdateRate = updateRate;
        this.UpdateCount = 0;
        this._onUpdateLimit = onUpdateLimit;
        this._updateLimit = updateLimit;
    }

    public Update(gameTime: eg.GameTime) {
        this.UpdateCount++;
        if (this.UpdateCount === this._updateLimit) {
            this._onUpdateLimit();
        }
    }
}

class DrawTester extends eg.Game {
    public DrawCount: number;

    private _onDrawLimit: Function;
    private _drawLimit: number;

    constructor(onDrawLimit: Function, drawLimit: number) {
        super();

        this.DrawCount = 0;
        this._onDrawLimit = onDrawLimit;
        this._drawLimit = drawLimit;
    }

    public Draw(context: CanvasRenderingContext2D) {
        this.DrawCount++;
        if (this.DrawCount === this._drawLimit) {
            this._onDrawLimit();
        }
    }
}

class CollisionManagerGame extends eg.Game
{
    constructor() {
        super();
    }
    public MonitorCollision(obj: eg.Collision.Collidable): void
    {
        this.CollisionManager.Monitor(obj);
    }

    public RegisterCollisionEvent(e: (first: eg.Collision.Collidable, second: eg.Collision.Collidable) => void): void
    {
        this.CollisionManager.OnCollision.Bind(e);
    }
}


text:
package org.apache.kafka.common.security.plain;

import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.Arrays;
import java.util.Map;

import javax.security.auth.callback.CallbackHandler;
import javax.security.sasl.Sasl;
import javax.security.sasl.SaslException;
import javax.security.sasl.SaslServer;
import javax.security.sasl.SaslServerFactory;

import org.apache.kafka.common.network.LoginType;
import org.apache.kafka.common.security.JaasUtils;

/**
 * Simple SaslServer implementation for SASL/PLAIN. In order to make this implementation
 * fully pluggable, authentication of username/password is fully contained within the
 * server implementation.
 *

 * Valid users with passwords are specified in the Jaas configuration file. Each user
 * is specified with user_<username> as key and <password> as value. This is consistent
 * with Zookeeper Digest-MD5 implementation.
 *

 * To avoid storing clear passwords on disk or to integrate with external authentication
 * servers in production systems, this module can be replaced with a different implementation.
 *
 */
public class PlainSaslServer implements SaslServer {

    public static final String PLAIN_MECHANISM = "PLAIN";
    private static final String JAAS_USER_PREFIX = "user_";

    private boolean complete;
    private String authorizationID;

    public PlainSaslServer(CallbackHandler callbackHandler) {
    }

    @Override
    public byte[] evaluateResponse(byte[] response) throws SaslException {
        /*
         * Message format (from https://tools.ietf.org/html/rfc4616):
         *
         * message   = [authzid] UTF8NUL authcid UTF8NUL passwd
         * authcid   = 1*SAFE ; MUST accept up to 255 octets
         * authzid   = 1*SAFE ; MUST accept up to 255 octets
         * passwd    = 1*SAFE ; MUST accept up to 255 octets
         * UTF8NUL   = %x00 ; UTF-8 encoded NUL character
         *
         * SAFE      = UTF1 / UTF2 / UTF3 / UTF4
         *                ;; any UTF-8 encoded Unicode character except NUL
         */

        String[] tokens;
        try {
            tokens = new String(response, "UTF-8").split("\u0000");
        } catch (UnsupportedEncodingException e) {
            throw new SaslException("UTF-8 encoding not supported", e);
        }
        if (tokens.length != 3)
            throw new SaslException("Invalid SASL/PLAIN response: expected 3 tokens, got " + tokens.length);
        authorizationID = tokens[0];
        String username = tokens[1];
        String password = tokens[2];

        if (username.isEmpty()) {
            throw new SaslException("Authentication failed: username not specified");
        }
        if (password.isEmpty()) {
            throw new SaslException("Authentication failed: password not specified");
        }
        if (authorizationID.isEmpty())
            authorizationID = username;

        try {
            String expectedPassword = JaasUtils.jaasConfig(LoginType.SERVER.contextName(), JAAS_USER_PREFIX + username);
            if (!password.equals(expectedPassword)) {
                throw new SaslException("Authentication failed: Invalid username or password");
            }
        } catch (IOException e) {
            throw new SaslException("Authentication failed: Invalid JAAS configuration", e);
        }
        complete = true;
        return new byte[0];
    }

    @Override
    public String getAuthorizationID() {
        if (!complete)
            throw new IllegalStateException("Authentication exchange has not completed");
        return authorizationID;
    }

    @Override
    public String getMechanismName() {
        return PLAIN_MECHANISM;
    }

    @Override
    public Object getNegotiatedProperty(String propName) {
        if (!complete)
            throw new IllegalStateException("Authentication exchange has not completed");
        return null;
    }

    @Override
    public boolean isComplete() {
        return complete;
    }

    @Override
    public byte[] unwrap(byte[] incoming, int offset, int len) throws SaslException {
        if (!complete)
            throw new IllegalStateException("Authentication exchange has not completed");
        return Arrays.copyOfRange(incoming, offset, offset + len);
    }

    @Override
    public byte[] wrap(byte[] outgoing, int offset, int len) throws SaslException {
        if (!complete)
            throw new IllegalStateException("Authentication exchange has not completed");
        return Arrays.copyOfRange(outgoing, offset, offset + len);
    }

    @Override
    public void dispose() throws SaslException {
    }

    public static class PlainSaslServerFactory implements SaslServerFactory {

        @Override
        public SaslServer createSaslServer(String mechanism, String protocol, String serverName, Map<String, ?> props, CallbackHandler cbh)
            throws SaslException {

            if (!PLAIN_MECHANISM.equals(mechanism)) {
                throw new SaslException(String.format("Mechanism \'%s\' is not supported. Only PLAIN is supported.", mechanism));
            }
            return new PlainSaslServer(cbh);
        }

        @Override
        public String[] getMechanismNames(Map<String, ?> props) {
            String noPlainText = (String) props.get(Sasl.POLICY_NOPLAINTEXT);
            if ("true".equals(noPlainText))
                return new String[]{};
            else
                return new String[]{PLAIN_MECHANISM};
        }
    }
}


text:
https://projecteuler.net/problem=31

In England the currency is made up of pound, £, and pence, p, and there are eight coins in general circulation:

1p, 2p, 5p, 10p, 20p, 50p, £1 (100p) and £2 (200p).
It is possible to make £2 in the following way:

1×£1 + 1×50p + 2×20p + 1×5p + 1×2p + 3×1p
How many different ways can £2 be made using any number of coins?


text:
package org.drools.workbench.screens.scorecardxls.client.editor;

import java.util.function.Consumer;

import javax.enterprise.context.Dependent;
import javax.inject.Inject;

import com.google.gwt.user.client.ui.IsWidget;
import org.drools.workbench.screens.scorecardxls.client.type.ScoreCardXLSResourceType;
import org.drools.workbench.screens.scorecardxls.service.ScoreCardXLSContent;
import org.drools.workbench.screens.scorecardxls.service.ScoreCardXLSService;
import org.guvnor.common.services.shared.metadata.MetadataService;
import org.jboss.errai.common.client.api.Caller;
import org.jboss.errai.common.client.api.RemoteCallback;
import org.kie.workbench.common.widgets.client.popups.validation.ValidationPopup;
import org.kie.workbench.common.widgets.metadata.client.KieEditor;
import org.uberfire.backend.vfs.ObservablePath;
import org.uberfire.client.annotations.WorkbenchEditor;
import org.uberfire.client.annotations.WorkbenchMenu;
import org.uberfire.client.annotations.WorkbenchPartTitle;
import org.uberfire.client.annotations.WorkbenchPartTitleDecoration;
import org.uberfire.client.annotations.WorkbenchPartView;
import org.uberfire.ext.widgets.common.client.callbacks.CommandErrorCallback;
import org.uberfire.ext.widgets.common.client.common.BusyIndicatorView;
import org.uberfire.lifecycle.OnClose;
import org.uberfire.lifecycle.OnStartup;
import org.uberfire.mvp.Command;
import org.uberfire.mvp.PlaceRequest;
import org.uberfire.workbench.model.menu.Menus;

@Dependent
@WorkbenchEditor(identifier = ScoreCardXLSEditorPresenter.EDITOR_ID, supportedTypes = {ScoreCardXLSResourceType.class})
public class ScoreCardXLSEditorPresenter
        extends KieEditor<ScoreCardXLSContent>
        implements ScoreCardXLSEditorView.Presenter {

    public static final String EDITOR_ID = "ScoreCardXLSEditor";

    @Inject
    protected Caller<ScoreCardXLSService> scoreCardXLSService;

    @Inject
    protected Caller<MetadataService> metadataService;

    @Inject
    protected ValidationPopup validationPopup;

    @Inject
    private BusyIndicatorView busyIndicatorView;

    @Inject
    private ScoreCardXLSResourceType type;

    private ScoreCardXLSEditorView view;

    @Inject
    public ScoreCardXLSEditorPresenter(final ScoreCardXLSEditorView baseView) {
        super(baseView);
        view = baseView;
    }

    @OnStartup
    public void onStartup(final ObservablePath path,
                          final PlaceRequest place) {
        super.init(path,
                   place,
                   type);
        view.init(this);
    }

    @Override
    protected void loadContent() {
        scoreCardXLSService.call(getModelSuccessCallback(),
                                 getNoSuchFileExceptionErrorCallback()).loadContent(versionRecordManager.getCurrentPath());
    }

    private RemoteCallback<ScoreCardXLSContent> getModelSuccessCallback() {
        return new RemoteCallback<ScoreCardXLSContent>() {
            @Override
            public void callback(ScoreCardXLSContent content) {
                resetEditorPages(content.getOverview());

                view.setPath(versionRecordManager.getCurrentPath());
                view.setReadOnly(isReadOnly);
            }
        };
    }

    @Override
    protected void onValidate(final Command finished) {
        scoreCardXLSService.call(
                validationPopup.getValidationCallback(finished),
                new CommandErrorCallback(finished)).validate(versionRecordManager.getCurrentPath(),
                                                             versionRecordManager.getCurrentPath());
    }

    @Override
    protected void save(String commitMessage) {
        metadataService.call(getSaveSuccessCallback(metadata.hashCode()))
                .saveMetadata(versionRecordManager.getCurrentPath(),
                              metadata,
                              commitMessage);
    }

    @Override
    protected String getEditorIdentifier() {
        return EDITOR_ID;
    }

    @OnClose
    @Override
    public void onClose() {
        this.versionRecordManager.clear();
        super.onClose();
    }

    @WorkbenchPartTitleDecoration
    public IsWidget getTitle() {
        return super.getTitle();
    }

    @WorkbenchPartTitle
    public String getTitleText() {
        return super.getTitleText();
    }

    @WorkbenchPartView
    public IsWidget getWidget() {
        return super.getWidget();
    }

    @WorkbenchMenu
    public void getMenus(final Consumer<Menus> menusConsumer) {
        super.getMenus(menusConsumer);
    }
}


text:
package com.thebluealliance.androidclient.activities;

import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.view.ViewTreeObserver;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;

import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import androidx.core.view.ViewCompat;

import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.thebluealliance.androidclient.R;
import com.thebluealliance.androidclient.TbaLogger;
import com.thebluealliance.androidclient.helpers.TeamHelper;
import com.thebluealliance.androidclient.imgur.ImgurSuggestionService;
import com.thebluealliance.androidclient.imgur.ImgurUtils;

import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;

import butterknife.BindView;
import butterknife.ButterKnife;
import rx.Observable;
import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;

public class ConfirmImageSuggestionActivity extends AppCompatActivity implements View.OnClickListener {

    private static final String EXTRA_IMAGE_URI = "image_uri";
    private static final String EXTRA_TEAM_KEY = "team_key";
    private static final String EXTRA_YEAR = "year";

    private static final String SAVED_TEMP_FILE_PATH = "saved_file_url";

    @BindView(R.id.toolbar) Toolbar mToolbar;
    @BindView(R.id.header) TextView mHeader;
    @BindView(R.id.image) ImageView mImageView;
    @BindView(R.id.progress) ProgressBar mProgressBar;
    @BindView(R.id.confirm_fab) FloatingActionButton mConfirmFab;
    @BindView(R.id.cancel_fab) FloatingActionButton mCancelFab;

    private Uri mUri;
    private String mTeamKey;
    private int mYear;

    private File mImageFile;

    public static Intent newIntent(Context context, Uri imageUri, String teamKey, int year) {
        Bundle extras = new Bundle();
        extras.putParcelable(EXTRA_IMAGE_URI, imageUri);
        extras.putString(EXTRA_TEAM_KEY, teamKey);
        extras.putInt(EXTRA_YEAR, year);
        Intent intent = new Intent(context, ConfirmImageSuggestionActivity.class);
        intent.putExtras(extras);
        return intent;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.activity_confirm_image_suggestion);
        ButterKnife.bind(this);

        mConfirmFab.setOnClickListener(this);
        mCancelFab.setOnClickListener(this);

        // Disable the "confirm" FAB until we have a valid file to submit
        mConfirmFab.setEnabled(false);

        ViewCompat.setElevation(mToolbar, getResources().getDimension(R.dimen.toolbar_elevation));
        setSupportActionBar(mToolbar);
        // TODO don't use hardcoded string
        getSupportActionBar().setTitle("Confirm suggestion");

        Bundle extras = getIntent().getExtras() == null ? new Bundle() : getIntent().getExtras();
        if (!extras.containsKey(EXTRA_IMAGE_URI)
                || !extras.containsKey(EXTRA_TEAM_KEY)
                || !extras.containsKey(EXTRA_YEAR)) {
            throw new IllegalArgumentException("ConfirmImageSuggestionActivity is missing required extras");
        }

        mUri = extras.getParcelable(EXTRA_IMAGE_URI);
        mTeamKey = extras.getString(EXTRA_TEAM_KEY);
        mYear = extras.getInt(EXTRA_YEAR);

        // Validate intent extras
        if (!TeamHelper.validateTeamKey(mTeamKey)) {
            throw new IllegalArgumentException("Invalid team key!");
        }
        if (mUri == null) {
            throw new IllegalArgumentException("URI is null!");
        }

        if (savedInstanceState != null && savedInstanceState.containsKey(SAVED_TEMP_FILE_PATH)) {
            mImageFile = new File(savedInstanceState.getString(SAVED_TEMP_FILE_PATH));
        }

        // Set up the header view, which displays "Team NUMBER (YEAR)"
        mHeader.setText(getString(R.string.imgur_confirm_image_header, TeamHelper.getTeamNumber(mTeamKey), mYear));

        // Don't begin caching and loading the image until layout is complete; the ImageView must
        // have a defined width and height in order to compute inSampleSize for loading the bitmap
        ViewTreeObserver vto = mImageView.getViewTreeObserver();
        vto.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
            @Override
            public void onGlobalLayout() {
                mImageView.getViewTreeObserver().removeOnGlobalLayoutListener(this);
                cacheAndLoadImage();
            }
        });
    }

    /**
     * Loads the image from {@code mUri} into our cache directory and displays it in this activity.
     * The caching part is important because the image at {@code mUri} is not guaranteed to be in
     * local storage; for instance, it could be an image that needs to be loaded from Google Drive.
     * We need to store it in a local file so that {@link ImgurSuggestionService}
     * can upload it properly.
     * <p>
     * This should not be called until after initial layout is complete; loading the Bitmap into
     * memory efficiently requires that we know how big the target ImageView so we can scale it
     * properly during the decoding process.
     */
    private void cacheAndLoadImage() {
        Observable<File> fileObservable;

        if (mImageFile != null) {
            fileObservable = Observable.just(mImageFile);
        } else {
            fileObservable = Observable.just(mUri).map((uri) -> {
                mImageFile = ImgurUtils.createFile(uri, ConfirmImageSuggestionActivity.this);
                if (mImageFile == null) {
                    // TODO error handling!
                    TbaLogger.e("Image was null!");
                }
                return mImageFile;
            });
        }

        fileObservable.map((file) -> {
            try {
                BitmapFactory.Options options = new BitmapFactory.Options();
                options.inJustDecodeBounds = true;
                InputStream stream = new BufferedInputStream(new FileInputStream(file));
                BitmapFactory.decodeStream(stream, null, options);
                stream.close();

                options.inSampleSize = calculateInSampleSize(options, mImageView.getWidth(), mImageView.getHeight());

                options.inJustDecodeBounds = false;
                stream = new BufferedInputStream(new FileInputStream(file));
                Bitmap bitmap = BitmapFactory.decodeStream(stream, null, options);
                stream.close();
                return bitmap;
            } catch (IOException e) {
                throw new RuntimeException("Error reading bitmap");
            }
        }).subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(bitmap -> {
                    mImageView.setImageBitmap(bitmap);

                    // Fade ImageView in and ProgressBar out
                    mImageView.setAlpha(0.0f);
                    mImageView.animate().alpha(1.0f).setDuration(500).start();
                    mProgressBar.setAlpha(1.0f);
                    mProgressBar.animate().alpha(0.0f).setDuration(500).start();

                    mConfirmFab.setEnabled(true);
                });
    }

    @Override
    protected void onSaveInstanceState(Bundle outState) {
        super.onSaveInstanceState(outState);

        if (mImageFile != null) {
            outState.putString(SAVED_TEMP_FILE_PATH, mImageFile.getAbsolutePath());
        }
    }

    private static int calculateInSampleSize(BitmapFactory.Options options, int reqWidth, int reqHeight) {
        // Raw height and width of image
        final int height = options.outHeight;
        final int width = options.outWidth;
        int inSampleSize = 1;

        if (height > reqHeight || width > reqWidth) {

            final int halfHeight = height / 2;
            final int halfWidth = width / 2;

            // Calculate the largest inSampleSize value that is a power of 2 and keeps both
            // height and width larger than the requested height and width.
            while ((halfHeight / inSampleSize) > reqHeight
                    && (halfWidth / inSampleSize) > reqWidth) {
                inSampleSize *= 2;
            }
        }

        return inSampleSize;
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.confirm_fab:
                Toast.makeText(this, "Your image will be uploaded in the background!", Toast.LENGTH_SHORT).show();
                startService(ImgurSuggestionService.newIntent(this, mImageFile.getAbsolutePath(), mTeamKey, mYear));
                this.finish();
                break;
            case R.id.cancel_fab:
                Toast.makeText(this, "Submission cancelled", Toast.LENGTH_SHORT).show();
                // Delete the cached image file to free up storage space
                if (mImageFile != null) {
                    mImageFile.delete();
                }
                this.finish();
                break;
        }
    }
}


text:
YUI().use(
    'base',
    'oop',
    'mojito-resource-store',
    'addon-rs-yui',
    'addon-rs-dispatch-helper',
    'json',
    'test',
    function(Y) {

    var suite = new YUITest.TestSuite('mojito-addon-rs-dispatch-helper-tests'),
        libpath = require('path'),
        mojitoRoot = libpath.join(__dirname, '../../../../../../lib'),
        A = Y.Assert;

    suite.add(new YUITest.TestCase({

        name: 'dispatch-helper rs addon tests',

        'augment getMojitTypeDetails with AC addons': function() {
            var fixtures = libpath.join(__dirname, '../../../../../fixtures/gsg5');
            var store = new Y.mojito.ResourceStore({ root: fixtures, mojitoRoot: mojitoRoot });
            store.preload();

            var details = store.getMojitTypeDetails('server', {}, 'PagedFlickr');

            // order matters
            A.areSame(5, details.acAddons.length, 'number of AC addons');
            A.areSame(JSON.stringify(['config','intl','params','url','models']), JSON.stringify(details.acAddons), 'correct order');
        }

    }));

    Y.Test.Runner.add(suite);

});


text:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE logback>
<configuration>

    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
        <encoder>
            <pattern>%date{HH:mm:ss.SSS} [%thread] %-5level %logger{15}#%line %msg\n</pattern>
        </encoder>
    </appender>

    <logger name="com.nkwebapps.shipit">
        <level value="debug"/>
        <appender-ref ref="STDOUT"/>
    </logger>

    <logger name="org.springframework">
        <level value="warn"/>
        <appender-ref ref="STDOUT"/>
    </logger>

    <logger name="org.hibernate">
        <level value="warn"/>
        <appender-ref ref="STDOUT"/>
    </logger>

    <root>
        <level value="error"/>
        <appender-ref ref="STDOUT"/>
    </root>

</configuration>