text:
/* $Id$ */

/*
 * This file is part of the RTF library of the FOP project, which was originally
 * created by Bertrand Delacretaz <bdelacretaz@codeconsult.ch> and by other
 * contributors to the jfor project (www.jfor.org), who agreed to donate jfor to
 * the FOP project.
 */

package org.apache.fop.render.rtf.rtflib.testdocs;

import java.io.IOException;

import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfDocumentArea;
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfSection;
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfTable;
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfParagraph;
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfTableRow;
import org.apache.fop.render.rtf.rtflib.rtfdoc.RtfTableCell;

/**  Generates an RTF document to test nested tables with the jfor rtflib package.
 *  @author Bertrand Delacretaz bdelacretaz@codeconsult.ch
 */

class NestedTable extends TestDocument {
    private static final int MM_TO_TWIPS = (int)(1440f / 25.4f);

    /** generate the body of the test document */
    protected void generateDocument(RtfDocumentArea rda, RtfSection sect)
    throws IOException {
        sect.newParagraph().newText("This document demonstrates pseudo-nested "
                + "tables created using merged table cells");

        firstTestTable(sect);
        RtfParagraph p = sect.newParagraph();
        p.newText("Test continues on next page.");
        p.newPageBreak();
        secondTestTable(sect);

        p = sect.newParagraph();
        p.newText("Test continues on next page.");
        p.newPageBreak();
        thirdTestTable(sect);

        sect.newParagraph().newText("End of nested tables test document");
    }

    private void firstTestTable(RtfSection sect)
    throws IOException {

        sect.newParagraph().newText("First test: table with one nested table in cell 1,1");
        final RtfTable tbl = sect.newTable(new DummyTableColumnsInfo());
        // first row, normal
        {
            RtfTableRow r = tbl.newTableRow();
            RtfTableCell c = r.newTableCell(160 * MM_TO_TWIPS);
            c.newParagraph().newText("cell 0,0, width 160mm, only cell in this row.");
        }

        // second row contains nested table
        {
            RtfTableRow r = tbl.newTableRow();
            r.newTableCell(40 * MM_TO_TWIPS).newParagraph().newText
                    ("cell 1,0, width 40mm, to the left of nested table.");

            final RtfTableCell c = r.newTableCell(80 * MM_TO_TWIPS);
            c.newParagraph().newText("cell 1,1, width 80mm, this text is "
                    + "followed by a nested table in the same cell, followed "
                    + "by text that says 'AFTER NESTED TABLE'.");
            fillNestedTable(c.newTable(new DummyTableColumnsInfo()), 1);
            c.newParagraph().newText("AFTER NESTED TABLE");

            r.newTableCell(40 * MM_TO_TWIPS).newParagraph().newText
                    ("cell 1,2, width 40mm, to the right of nested table.");
        }

        // third row, normal
        {
            RtfTableRow r = tbl.newTableRow();
            r.newTableCell(80 * MM_TO_TWIPS).newParagraph().newText
                    ("cell 2,0, width 80mm, this row has two cells.");
            r.newTableCell(80 * MM_TO_TWIPS).newParagraph().newText
                    ("cell 2,1, width 80mm, last cell.");
        }

    }

    private void secondTestTable(RtfSection sect)
    throws IOException {
        sect.newParagraph().newText("Second test: table with two nested tables in cell 1,1");
        final RtfTable tbl = sect.newTable(new DummyTableColumnsInfo());
        // first row, normal
        {
            RtfTableRow r = tbl.newTableRow();
            RtfTableCell c = r.newTableCell(160 * MM_TO_TWIPS);
            c.newParagraph().newText("second test table: cell 0,0, width 160mm, "
                    + "only cell in this row.");
        }

        // second row contains nested table
        {
            RtfTableRow r = tbl.newTableRow();
            r.newTableCell(40 * MM_TO_TWIPS).newParagraph().newText
                    ("cell 1,0, width 40mm, to the left of nested tables.");

            final RtfTableCell c = r.newTableCell(80 * MM_TO_TWIPS);
            c.newParagraph().newText("cell 1,1, width 80mm, this text is "
                    + "followed by a nested table in the same cell, followed "
                    + "by text that says 'BETWEEN', then another table, then 'AFTER'.");
            fillNestedTable(c.newTable(new DummyTableColumnsInfo()), 2);
            c.newParagraph().newText("BETWEEN");
            fillNestedTable(c.newTable(new DummyTableColumnsInfo()), 3);
            c.newParagraph().newText("AFTER");

            r.newTableCell(40 * MM_TO_TWIPS).newParagraph().newText
                    ("cell 1,2, width 40mm, to the right of nested table.");
        }

        // third row, normal
        {
            RtfTableRow r = tbl.newTableRow();
            r.newTableCell(80 * MM_TO_TWIPS).newParagraph().newText
                    ("cell 2,0, width 80mm, this row has two cells.");
            r.newTableCell(80 * MM_TO_TWIPS).newParagraph().newText
                    ("cell 2,1, width 80mm, last cell.");
        }
    }

    private void thirdTestTable(RtfSection sect)
    throws IOException {
        sect.newParagraph().newText("Third test: table with two nested tables "
                + "in cell 1,1 and one nested table in cell 0,1");
        final RtfTable tbl = sect.newTable(new DummyTableColumnsInfo());
        // first row, normal
        {
            RtfTableRow r = tbl.newTableRow();
            RtfTableCell c = r.newTableCell(80 * MM_TO_TWIPS);
            c.newParagraph().newText("third test table: cell 0,0, width 40mm, "
                    + "the cell to its right contains a nested table with no other text.");
            c = r.newTableCell(80 * MM_TO_TWIPS);
            fillNestedTable(c.newTable(new DummyTableColumnsInfo()), 4);
        }

        // second row contains nested table
        {
            RtfTableRow r = tbl.newTableRow();
            r.newTableCell(40 * MM_TO_TWIPS).newParagraph().newText
                    ("cell 1,0, width 40mm, to the left of nested tables.");

            final RtfTableCell c = r.newTableCell(80 * MM_TO_TWIPS);
            c.newParagraph().newText("cell 1,1, width 80mm, this text is "
                    + "followed by a nested table in the same cell, followed "
                    + "by text that says 'BETWEEN', then another table, then 'AFTER'.");
            fillNestedTable(c.newTable(new DummyTableColumnsInfo()), 5);
            c.newParagraph().newText("BETWEEN");
            fillNestedTable(c.newTable(new DummyTableColumnsInfo()), 6);
            c.newParagraph().newText("AFTER");

            r.newTableCell(40 * MM_TO_TWIPS).newParagraph().newText
                    ("cell 1,2, width 40mm, to the right of nested table.");
        }

        // third row, normal
        {
            RtfTableRow r = tbl.newTableRow();
            r.newTableCell(80 * MM_TO_TWIPS).newParagraph().newText
                    ("cell 2,0, width 80mm, this row has two cells.");
            r.newTableCell(80 * MM_TO_TWIPS).newParagraph().newText
                    ("cell 2,1, width 80mm, last cell.");
        }
    }

    /** fill the nested table */
    private void fillNestedTable(RtfTable tbl, int index)
    throws IOException {
        final String id = "TABLE " + index;
        {
            RtfTableRow r = tbl.newTableRow();
            r.newTableCell(80 * MM_TO_TWIPS).newParagraph().newText(
            id + ":nested cell 0,0. Nested table contains 3 rows with 1,2 and 3 cells respectively"
            );
        }

        {
            RtfTableRow r = tbl.newTableRow();
            r.newTableCell(40 * MM_TO_TWIPS).newParagraph().newText(id + ":nested cell 1,0, 40mm.");
            r.newTableCell(40 * MM_TO_TWIPS).newParagraph().newText(id + ":nested cell 1,1, 40mm.");
        }

        {
            RtfTableRow r = tbl.newTableRow();
            r.newTableCell(30 * MM_TO_TWIPS).newParagraph().newText(id + ":nested cell 2,0, 30mm.");
            r.newTableCell(30 * MM_TO_TWIPS).newParagraph().newText(id + ":nested cell 2,1, 30mm.");
            r.newTableCell(20 * MM_TO_TWIPS).newParagraph().newText(id + ":nested cell 2,2, 20mm.");
        }
    }
}


text:
package collabware.collaboration.internal;

import static org.easymock.EasyMock.anyObject;
import static org.easymock.EasyMock.capture;
import static org.easymock.EasyMock.createMock;
import static org.easymock.EasyMock.createNiceMock;
import static org.easymock.EasyMock.expect;
import static org.easymock.EasyMock.expectLastCall;
import static org.easymock.EasyMock.replay;
import static org.easymock.EasyMock.verify;
import static org.junit.Assert.assertEquals;

import java.util.ArrayList;
import java.util.List;

import org.easymock.Capture;
import org.easymock.IAnswer;
import org.junit.Test;

import collabware.api.operations.ComplexOperation;
import collabware.api.operations.ComplexOperationImpl;
import collabware.api.operations.PrimitiveOperation;
import collabware.api.operations.context.Context;
import collabware.api.operations.context.ContextualizedComplexOperation;
import collabware.api.operations.context.ContextualizedComplexOperationImpl;
import collabware.collaboration.Client;
import collabware.collaboration.ConflictingOperationsException;
import collabware.collaboration.Participant;
import collabware.collaboration.internal.context.ContextVector;
import collabware.collaboration.internal.context.VectorBasedContext;
import collabware.userManagement.User;

public class ClientProxyTest {

	@Test
	public void fistClientOperationReceivesInitialContext() throws Exception {
		int clientNumber = 2;
		int serverSequenceNumber = 0;
		VectorBasedContext initialContext = new VectorBasedContext(clientNumber, new ContextVector(new int[]{5,3,1,7}));
		ModifyableCollaboration collaboration = createCollaborationExpectingOperationsWithContexts(initialContext);

		Client clientProxy = new ClientProxy(collaboration, someParticipant(), initialContext);
		clientProxy.applyChangeToCollaboration(serverSequenceNumber, mockComplexOperationWithNPrimitives(3));

		verify(collaboration);
	}

	private Participant someParticipant() {
		Participant participant = createMock(Participant.class);
		expect(participant.getUser()).andReturn(createMock(User.class)).anyTimes();
		replay(participant);
		return participant;
	}

	@Test
	public void secondClientOperationReceivesInitialContextPlusOne() throws Exception {
		int clientNumber = 2;
		int serverSequenceNumber = 0;
		VectorBasedContext initialContext = new VectorBasedContext(clientNumber, new ContextVector(new int[]{5,3,1,7}));
		ModifyableCollaboration collaboration = createCollaborationExpectingOperationsWithContexts(initialContext, initialContext.including(initialContext));

		Client clientProxy = new ClientProxy(collaboration, someParticipant(), initialContext);
		clientProxy.applyChangeToCollaboration(serverSequenceNumber, mockComplexOperationWithNPrimitives(3));
		clientProxy.applyChangeToCollaboration(serverSequenceNumber, mockComplexOperationWithNPrimitives(3));

		verify(collaboration);
	}

	@Test
	public void clientOperationHasServerOperationInItsContext() throws Exception {
		int clientNumber = 2;
		int serverSequenceNumber = 1;
		ModifyableCollaboration collaboration = createCollaborationExpectingOperationsWithContexts(new VectorBasedContext(clientNumber, new int[]{5,4,1,7}));
		VectorBasedContext initialState = new VectorBasedContext(clientNumber, new ContextVector(new int[]{5,3,1,7}));
		ClientProxy clientProxy = new ClientProxy(collaboration, someParticipant(), initialState);
		clientProxy.sendToClient(new ContextualizedComplexOperationImpl(new VectorBasedContext(1, new int[]{5,3,1,7}), mockComplexOperationWithNPrimitives(3)));
		clientProxy.applyChangeToCollaboration(serverSequenceNumber, mockComplexOperationWithNPrimitives(3));

		verify(collaboration);
	}

	@Test(expected=IllegalArgumentException.class)
	public void serverSequenceNumberMustNotDecreaseOverTime() throws Exception {
		int clientNumber = 1;
		int serverSequenceNumber = 1;
		ModifyableCollaboration collaboration = createNiceMock(ModifyableCollaboration.class);

		ClientProxy clientProxy = new ClientProxy(collaboration, someParticipant(), new VectorBasedContext(clientNumber, new ContextVector(new int[]{5,3,1,7})));
		clientProxy.sendToClient(new ContextualizedComplexOperationImpl(new VectorBasedContext(1, new int[]{5,3,1,7}), mockComplexOperationWithNPrimitives(3)));
		clientProxy.applyChangeToCollaboration(serverSequenceNumber, mockComplexOperationWithNPrimitives(3));
		clientProxy.applyChangeToCollaboration(serverSequenceNumber-1, mockComplexOperationWithNPrimitives(3));
	}

	@Test
	public void serverSequenceNumberMayJump() throws Exception {
		int clientNumber = 1;
		int serverSequenceNumber = 0;
		ModifyableCollaboration collaboration = createCollaborationExpectingOperationsWithContexts(new VectorBasedContext(clientNumber, new int[]{5,3,1,7}), new VectorBasedContext(clientNumber, new int[]{5,4,1,10}));

		ClientProxy clientProxy = new ClientProxy(collaboration, someParticipant(), new VectorBasedContext(clientNumber, new ContextVector(new int[]{5,3,1,7})));
		clientProxy.sendToClient(new ContextualizedComplexOperationImpl(new VectorBasedContext(3, new int[]{5,3,1,7}), mockComplexOperationWithNPrimitives(3)));
		clientProxy.sendToClient(new ContextualizedComplexOperationImpl(new VectorBasedContext(3, new int[]{5,3,1,8}), mockComplexOperationWithNPrimitives(3)));
		clientProxy.sendToClient(new ContextualizedComplexOperationImpl(new VectorBasedContext(3, new int[]{5,3,1,9}), mockComplexOperationWithNPrimitives(3)));
		clientProxy.applyChangeToCollaboration(serverSequenceNumber, mockComplexOperationWithNPrimitives(3));
		clientProxy.applyChangeToCollaboration(serverSequenceNumber+3, mockComplexOperationWithNPrimitives(3));

		verify(collaboration);
	}

	@Test(expected=IllegalArgumentException.class)
	public void serverSequenceMustNotExceedNumberOfComplexOperationSentToClient() throws Exception {
		int clientNumber = 1;
		int serverSequenceNumber = 0;
		ModifyableCollaboration collaboration = createCollaborationExpectingOperationsWithContexts(new VectorBasedContext(clientNumber, new int[]{5,3,1,7}), new VectorBasedContext(clientNumber, new int[]{5,6,1,16}));

		ClientProxy clientProxy = new ClientProxy(collaboration, someParticipant(), new VectorBasedContext(clientNumber, new ContextVector(new int[]{5,3,1,7})));
		clientProxy.sendToClient(new ContextualizedComplexOperationImpl(new VectorBasedContext(3, new int[]{5,3,1,7}), mockComplexOperationWithNPrimitives(3)));
		clientProxy.sendToClient(new ContextualizedComplexOperationImpl(new VectorBasedContext(3, new int[]{5,3,1,10}), mockComplexOperationWithNPrimitives(3)));
		clientProxy.sendToClient(new ContextualizedComplexOperationImpl(new VectorBasedContext(3, new int[]{5,3,1,13}), mockComplexOperationWithNPrimitives(3)));
		clientProxy.applyChangeToCollaboration(serverSequenceNumber+4, mockComplexOperationWithNPrimitives(3));

		verify(collaboration);
	}

	private ComplexOperation mockComplexOperationWithNPrimitives(int n) {
		List<PrimitiveOperation> primitives = new ArrayList<PrimitiveOperation>();
		for (int i = 0; i < n; i++) {
			PrimitiveOperation op = createMock(PrimitiveOperation.class);
			replay(op);
			primitives.add(op);
		}
		ComplexOperation complex = new ComplexOperationImpl("", primitives);
		return complex;
	}

	private ModifyableCollaboration createCollaborationExpectingOperationsWithContexts(Context ... expectedContexts) throws ConflictingOperationsException {
		ModifyableCollaboration collaboration = createMock(ModifyableCollaboration.class);
		for (final Context expectedContext: expectedContexts) {
			final Capture<ContextualizedComplexOperation> op = new Capture<ContextualizedComplexOperation>();
			collaboration.apply(capture(op), anyObject(User.class));
			expectLastCall().andAnswer(new IAnswer<Object>() {
				@Override
				public Object answer() throws Throwable {
					assertEquals(expectedContext, op.getValue().getContext());
					return null;
				}
			});
		}

		replay(collaboration);
		return collaboration;
	}

}

redpajama_set_name: RedPajamaGithub


text:
using System;

namespace Emulator6502.Components
{
    internal abstract class OpcodeExecuterBase
    {
        private readonly ICpu _cpu;

        protected OpcodeExecuterBase(ICpu cpu)
        {
            _cpu = cpu;
        }

        public ICpu Cpu { get { return _cpu; } }

        public abstract void Register(CpuInstruction[] opcodeHandlers);

        protected void SetNegativeZeroFlags(byte changedValue)
        {
            byte value = (byte)(((changedValue == 0) ? StatusFlagBits.ZeroFlagBit : 0x0) | (changedValue & StatusFlagBits.NegativeFlagBit));
            Cpu.Status = (byte)((Cpu.Status & StatusFlagBits.ZeroNegativeMask) | value);
        }

        protected byte GetRegisterZeroPage()
        {
            byte location = Cpu.GetNextByte();
            byte register = Cpu.Ram.ReadByte(location);
            SetNegativeZeroFlags(register);
            return register;
        }

        protected byte GetRegisterZeroPageX(byte x)
        {
            Int16 location = GetZeroPageXAddress(Cpu.GetNextByte(), x);
            byte register = Cpu.Ram.ReadByte(location);
            SetNegativeZeroFlags(register);
            return register;
        }

        protected Int16 GetZeroPageXAddress(byte zeroPage, byte x)
        {
            Int16 location = (Int16) ((zeroPage + x) & 0xFF);
            return location;
        }

        protected byte GetRegisterAbsolute()
        {
            Int16 location = Cpu.GetNextWord();
            byte value = Cpu.Ram.ReadByte(location);
            SetNegativeZeroFlags(value);
            return value;
        }

        protected Int16 GetAbsoluteXAddress(Int16 absoluteLocation, byte x)
        {
            return (Int16) (absoluteLocation + x);
        }

        protected byte GetRegisterAbsoluteX(byte x)
        {
            Int16 location = GetAbsoluteXAddress(Cpu.GetNextWord(), x);
            byte value = Cpu.Ram.ReadByte(location);
            SetNegativeZeroFlags(value);
            return value;
        }

        protected Int16 GetIndirectXAddress(byte zeroPageAddress, byte x)
        {
            Int16 zeroPageLocation = (Int16)(zeroPageAddress + x);
            Int16 location = Cpu.Ram.ReadWord(zeroPageLocation);
            return location;
        }

        protected Int16 GetIndirectYAddress(byte zeroPageAddress, byte y)
        {
            Int16 location = (Int16)(Cpu.Ram.ReadWord(zeroPageAddress) + Cpu.Y);
            return location;
        }
    }
}


text:
package com.tsaplin.autojava;

import com.google.common.collect.Lists;
import com.tsaplin.autojava.trait.Trait;

import java.util.List;

@Trait
public class ConcreteObservable implements Observable {

    private final List<Observer> observers = Lists.newArrayList();

    @Override
    public void addObserver(Observer observer) {
        observers.add(observer);
    }

    @Override
    public void removeObserver(Observer observer) {
        observers.remove(observer);
    }

    @Override
    public void notifyObservers(Observable observable) {
        for (Observer observer : observers) {
            observer.onChange(observable);
        }
    }
}


text:
<LINK REL="stylesheet" HREF="../static/styles.css">

<TITLE>FMOD_OUTPUT_INIT_CALLBACK</TITLE>

Firelight Technologies FMOD Studio API

FMOD_OUTPUT_INIT_CALLBACK

Initialization callback which is called when the user calls System::init.

C/C++ Syntax

FMOD_RESULT F_CALLBACK FMOD_OUTPUT_INIT_CALLBACK(
  FMOD_OUTPUT_STATE *output_state,
  int selecteddriver,
  FMOD_INITFLAGS flags,
  int *outputrate,
  FMOD_SPEAKERMODE *speakermode,
  int *speakermodechannels,
  FMOD_SOUND_FORMAT *outputformat,
  int dspbufferlength,
  int dspnumbuffers,
  void *extradriverdata
);

Parameters

output_state

Pointer to the plugin state.  The user can use this variable to access runtime plugin specific variables and plugin writer user data.

selecteddriver

This is the selected driver id that the user chose from calling System::setDriver.

flags

Initialization flags passed in by the user.

outputrate

Output rate selected by the user.  If not possible, change the rate to the closest match. FMOD will resample from the rate requested to your rate if they do not match.

speakermode

Speaker mode selected by the user.  If not possible, change the speaker mode to the closest match.  FMOD will upmix or downmix to the requested speaker mode if they do not match.

speakermodechannels

Speaker mode channel count selected by the user. For example 1 = mono output.  2 = stereo output. Needed if supporting FMOD_SPEAKERMODE_RAW, otherwise it is informational.

outputformat

Sound format supported by output mode.  For example, FMOD_SOUND_FORMAT_PCM16 would be normal. FMOD will convert from FMOD_SOUND_FORMAT_PCMFLOAT (the mixer buffer format) to whatever you specify.

dspbufferlength

Size of the buffer fmod will mix to in one mix update.  This value is in PCM samples.

dspnumbuffers

Number of buffers fmod will mix to in a circular fashion.  Multiply this by dspbufferlength to get the total size of the output sound buffer to allocate.

extradriverdata

Data passed in by the user specific to this driver.  May be used for any purpose.

Return Values

If the function succeeds then the return value is FMOD_OK.

If the function fails then the return value will be one of the values defined in the FMOD_RESULT enumeration.

Remarks

Remember to return FMOD_OK at the bottom of the function, or an appropriate error code from FMOD_RESULT.

See Also

FMOD_RESULT

System::init

System::setDriver

Version 1.08.02 Built on Apr 14, 2016


text:
layout: default
title: Testing Chained Luigi Tasks
---

When doing statistical programming, aka Data Science, I found myself
chaining together a series of scripts to complete my analysis. [Luigi](http://luigi.readthedocs.org/en/latest/index.html) helped me to track
those tasks, handle failures, etc. Using the [edx-analytics-pipeline](https://github.com/edx/edx-analytics-pipeline) as a helpful point of
reference, I began building out our own analytics pipeline at work.

When I began trying to test my first tasks, I found that it was hard
for me to independently test a task that `requires` other tasks. After
checking the [Luigi Google Group](), I saw that someone had already
asked about writing integration and/or unit tests for Luigi jobs (See:
[question 2](https://groups.google.com/forum/#!topic/luigi-user/lYjunyRX4rY)). It would have been helpful when I was first researching this
problem to have a blog post with more detail.

We can start by assuming the following two tasks:

```python

    import luigi

    class A(luigi.Task):

	    def output(self):
			return MockTarget('foo.txt')

	    def run(self):
			with self.output().open('w') as f:
				f.write('hello world')

	class B(luigi.Task):

		def output(self):
			return MockTarget('bar.txt')

	    def requires(self):
			return A()

	    def run(self):
			with self.output().open('w') as infile:
				data = self.input().open('r').read()
				infile.write(data)
```

You can see that task `B` requires task `A`.


text:
import itertools

from django.conf import settings
from django.db import models

from django.utils import translation as translation_utils

from olympia.addons.query import IndexCompiler, IndexQuery

def order_by_translation(qs, fieldname):
    """
    Order the QuerySet by the translated field, honoring the current and
    fallback locales.  Returns a new QuerySet.

    The model being sorted needs a get_fallback() classmethod that describes
    the fallback locale.  get_fallback() can return a string or a Field.
    """
    if fieldname.startswith('-'):
        desc = True
        fieldname = fieldname[1:]
    else:
        desc = False

    qs = qs.all()
    model = qs.model
    field = model._meta.get_field(fieldname)

    # connection is a tuple (lhs, table, join_cols)
    connection = (model._meta.db_table, field.rel.to._meta.db_table,
                  field.rel.field_name)

    # Doing the manual joins is flying under Django's radar, so we need to make
    # sure the initial alias (the main table) is set up.
    if not qs.query.tables:
        qs.query.get_initial_alias()

    # Force two new joins against the translation table, without reusing any
    # aliases. We'll hook up the language fallbacks later.
    # Passing `reuse=set()` force new joins, and passing `nullable=True`
    # forces django to make LEFT OUTER JOINs (otherwise django, because we are
    # building the query manually, does not detect that an inner join would
    # remove results and happily simplifies the LEFT OUTER JOINs to
    # INNER JOINs)
    qs.query = qs.query.clone(TranslationQuery)
    t1 = qs.query.join(connection, join_field=field, reuse=set(),
                       nullable=True)
    t2 = qs.query.join(connection, join_field=field, reuse=set(),
                       nullable=True)
    qs.query.translation_aliases = {field: (t1, t2)}

    f1, f2 = '%s.`localized_string`' % t1, '%s.`localized_string`' % t2
    name = 'translated_%s' % field.column
    ifnull = 'IFNULL(%s, %s)' % (f1, f2)
    prefix = '-' if desc else ''
    return qs.extra(select={name: ifnull},
                    where=['(%s IS NOT NULL OR %s IS NOT NULL)' % (f1, f2)],
                    order_by=[prefix + name])

class TranslationQuery(IndexQuery):
    """
    Overrides sql.Query to hit our special compiler that knows how to JOIN
    translations.
    """

    def clone(self, klass=None, **kwargs):
        # Maintain translation_aliases across clones.
        c = super(TranslationQuery, self).clone(klass, **kwargs)
        c.translation_aliases = self.translation_aliases
        return c

    def get_compiler(self, using=None, connection=None):
        # Call super to figure out using and connection.
        c = super(TranslationQuery, self).get_compiler(using, connection)
        return SQLCompiler(self, c.connection, c.using)

class SQLCompiler(IndexCompiler):
    """Overrides get_from_clause to LEFT JOIN translations with a locale."""

    def get_from_clause(self):
        # Temporarily remove translation tables from query.tables so Django
        # doesn't create joins against them.
        old_tables = list(self.query.tables)
        for table in itertools.chain(*self.query.translation_aliases.values()):
            self.query.tables.remove(table)

        joins, params = super(SQLCompiler, self).get_from_clause()

        # fallback could be a string locale or a model field.
        params.append(translation_utils.get_language())
        if hasattr(self.query.model, 'get_fallback'):
            fallback = self.query.model.get_fallback()
        else:
            fallback = settings.LANGUAGE_CODE
        if not isinstance(fallback, models.Field):
            params.append(fallback)

        # Add our locale-aware joins.  We're not respecting the table ordering
        # Django had in query.tables, but that seems to be ok.
        for field, aliases in self.query.translation_aliases.items():
            t1, t2 = aliases
            joins.append(self.join_with_locale(t1))
            joins.append(self.join_with_locale(t2, fallback))

        self.query.tables = old_tables
        return joins, params

    def join_with_locale(self, alias, fallback=None):
        # This is all lifted from the real sql.compiler.get_from_clause(),
        # except for the extra AND clause.  Fun project: fix Django to use Q
        # objects here instead of a bunch of strings.
        qn = self.quote_name_unless_alias
        qn2 = self.connection.ops.quote_name
        mapping = self.query.alias_map[alias]
        # name, alias, join_type, lhs, lhs_col, col, nullable = mapping
        name, alias, join_type, lhs, join_cols, _, join_field = mapping
        lhs_col = join_field.column
        rhs_col = join_cols
        alias_str = '' if alias == name else (' %s' % alias)

        if isinstance(fallback, models.Field):
            fallback_str = '%s.%s' % (qn(self.query.model._meta.db_table),
                                      qn(fallback.column))
        else:
            fallback_str = '%s'

        return ('%s %s%s ON (%s.%s = %s.%s AND %s.%s = %s)' %
                (join_type, qn(name), alias_str,
                 qn(lhs), qn2(lhs_col), qn(alias), qn2(rhs_col),
                 qn(alias), qn('locale'), fallback_str))


text:
var gulp = require('gulp'),
    gulpif = require('gulp-if'),
    useref = require('gulp-useref'),
    autoprefixer = require('gulp-autoprefixer'),
    uglify = require('gulp-uglify'),
    minifyCss = require('gulp-minify-css'),
    copy = require('gulp-copy'),
    del = require('del'),
    merge = require('merge-stream'),
    ngAnnotate = require('gulp-ng-annotate');

gulp.task('minify', ['copy'], function () {
    return gulp.src('app/views/*.ejs')
        .pipe(useref({ searchPath: 'public/'}))
        .pipe(gulpif('*.js', ngAnnotate()))
        .pipe(gulpif('*.js', uglify()))
        .pipe(gulpif('*.css', autoprefixer()))
        .pipe(gulpif('*.css', minifyCss({processImport: false})))
        .pipe(gulp.dest('dist/'));
});

gulp.task('copy', ['clean'], function () {
    return gulp.src(['server.js', 'config/*', 'app/**/*', 'node_modules/**/*', 'public/partials/*', 'public/assets/img/**/*'])
        .pipe(copy('dist/'));
});

gulp.task('moveViews', ['cleanViews'], function () {
    return gulp.src('dist/*.ejs')
    .pipe(gulp.dest('dist/app/views'));
});

gulp.task('moveAssets', ['moveViews'],  function () {
    var cssMin = gulp.src('dist/css/*')
        .pipe(gulp.dest('dist/public/css'));

    var jsMin = gulp.src('dist/js/*')
        .pipe(gulp.dest('dist/public/js'));

     return merge(cssMin, jsMin);
});

gulp.task('cleanViews', ['minify'], function () {
    return del(['./dist/app/views/*.ejs']);
});

gulp.task('cleanFiles', ['moveAssets'], function () {
    return del([
        'dist/css/',
        'dist/js/',
        'dist/*.ejs'
      ]);
});

gulp.task('clean', function () {
    return del(['dist']);
});

gulp.task('default', ['clean' , 'copy' , 'minify', 'moveViews', 'moveAssets', 'cleanFiles']);


text:
require 'spec_helper'

describe 'postgresql::config' do
  let(:facts) { default_test_facts }

  it do
    should include_class('boxen::config')
  end
end


text:
var __extends = this.__extends || function (d, b) {
    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
    function __() { this.constructor = d; }
    __.prototype = b.prototype;
    d.prototype = new __();
};
var Resource = (function () {
    function Resource(handle) {
        this.loaded = false;
        this.handle = handle;
    }
    return Resource;
})();
var FileResource = (function (_super) {
    __extends(FileResource, _super);
    function FileResource(handle, filename) {
        this.filename = filename;
        this.content = "";
        _super.call(this, handle);
    }
    return FileResource;
})(Resource);
var ShaderResource = (function (_super) {
    __extends(ShaderResource, _super);
    function ShaderResource(handle, vert, frag, uniforms) {
        var _this = this;
        this.vert = vert;
        this.frag = frag;
        this.uniforms = uniforms;
        this.interval = setInterval(function () {
            var vertOk = _this.vert == null || _this.vert.loaded;
            var fragOk = _this.frag == null || _this.frag.loaded;
            if (vertOk && fragOk) {
                clearInterval(_this.interval);
                _this.shader = new Shader(_this.vert == null ? null : _this.vert.content, _this.frag == null ? null : _this.frag.content);
                _this.shader.customUniforms = _this.uniforms;
                _this.loaded = true;
                Loader.CheckLoaded();
            }
        }, 100);
        _super.call(this, handle);
    }
    return ShaderResource;
})(Resource);
var TextureResource = (function (_super) {
    __extends(TextureResource, _super);
    function TextureResource(handle, filename, options) {
        var _this = this;
        if (options === void 0) { options = null; }
        this.filename = filename;
        this.options = options;
        this.image = new Image();
        this.image.onload = function () {
            _this.texture = new Texture(_this.image, false, _this.options);
            _this.loaded = true;
            Loader.CheckLoaded();
        };
        this.image.src = filename;
        _super.call(this, handle);
    }
    return TextureResource;
})(Resource);
var MusicResource = (function (_super) {
    __extends(MusicResource, _super);
    function MusicResource(handle, filename, options) {
        var _this = this;
        if (options === void 0) { options = null; }
        this.filename = filename;
        this.options = options;
        this.audio = new Audio();
        this.audio.src = this.filename;
        this.audio.load();
        this.audio.onloadeddata = function () {
            _this.music = new Music(_this.audio, (options != null ? options["loop"] : false));
            _this.loaded = true;
            Loader.CheckLoaded();
        };
        _super.call(this, handle);
    }
    return MusicResource;
})(Resource);
var SoundResource = (function (_super) {
    __extends(SoundResource, _super);
    function SoundResource(handle, filename, count, options) {
        var _this = this;
        if (options === void 0) { options = null; }
        this.filename = filename;
        this.options = options;
        this.audios = [];
        this.loadCount = count;
        for (var i = 0; i < count; i++) {
            this.audios[i] = new Audio();
            this.audios[i].src = this.filename;
            this.audios[i].load();
            this.audios[i].onloadeddata = function () {
                _this.loadCount--;
                if (_this.loadCount == 0) {
                    _this.sound = new Sound(_this.audios);
                    _this.loaded = true;
                    Loader.CheckLoaded();
                }
            };
        }
        _super.call(this, handle);
    }
    return SoundResource;
})(Resource);
var Loader = (function () {
    function Loader() {
    }
    Loader.CheckLoaded = function () {
        for (var id in Loader.Resources) {
            var res = Loader.Resources[id];
            if (!res.loaded) {
                Loader.Loaded = false;
                return;
            }
        }
        Loader.Loaded = true;
    };
    Loader.ReadShaderResource = function (vert, frag, uniforms) {
        if (uniforms === void 0) { uniforms = null; }
        var vertResource = Loader.ReadFileResource(vert);
        var fragResource = Loader.ReadFileResource(frag);
        var handle = Loader.Resources.length;
        var resource = new ShaderResource(handle, vertResource, fragResource, uniforms);
        Loader.Resources.push(resource);
        Loader.CheckLoaded();
        return resource;
    };
    Loader.ReadTextureResource = function (filename, options) {
        if (options === void 0) { options = null; }
        var handle = Loader.Resources.length;
        var resource = new TextureResource(handle, filename, options);
        Loader.Resources.push(resource);
        Loader.CheckLoaded();
        return resource;
    };
    Loader.ReadSoundResource = function (filename, count) {
        var handle = Loader.Resources.length;
        console.log(handle);
        var resource = new SoundResource(handle, filename, count);
        Loader.Resources.push(resource);
        Loader.CheckLoaded();
        return resource;
    };
    Loader.ReadMusicResource = function (filename, options) {
        if (options === void 0) { options = null; }
        var handle = Loader.Resources.length;
        console.log(handle);
        var resource = new MusicResource(handle, filename, options);
        Loader.Resources.push(resource);
        Loader.CheckLoaded();
        return resource;
    };
    Loader.ReadFileResource = function (filename) {
        var handle = Loader.Resources.length;
        var resource = new FileResource(handle, filename);
        Loader.Resources.push(resource);
        Loader.CheckLoaded();
        var request = new XMLHttpRequest();
        request.onreadystatechange = function (event) {
            if (request.readyState != 4 || request.status != 200)
                return;
            resource.content = request.responseText;
            resource.loaded = true;
            Loader.CheckLoaded();
        };
        request.open("get", filename, true);
        request.send();
        return resource;
    };
    Loader.Loaded = false;
    Loader.Resources = [];
    return Loader;
})();
//class FileTask extends Task<FileData> {
//    constructor(request: XMLHttpRequest) {
//        console.log("new file");
//        super(() => {
//            console.error("error");
//        });
//    }
//}
//class FileData {
//    filename: string
//    content: string
//}
//class Loader {
//    static ReadFileAsync(filename: string)
//        : Task<FileData>
//    {
//        var request = new XMLHttpRequest();
//        request.onload = (event: Event) => {
//            console.log(event);
//        };
//        request.open("get", filename, true);
//        request.send();
//        return new FileTask(request);
//    }
//}
//# sourceMappingURL=loader.js.map


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <title>Infinite Library</title>
    <link
      href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"
      rel="stylesheet"
      integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN"
      crossorigin="anonymous"
    >


text:
package com.haulmont.cuba.web.sys.navigation.accessfilter;

import com.haulmont.cuba.gui.config.WindowConfig;
import com.haulmont.cuba.gui.navigation.NavigationState;
import com.haulmont.cuba.web.AppUI;
import com.haulmont.cuba.web.WebConfig;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

import javax.inject.Inject;
import java.util.Objects;

@Component
@Order(NavigationFilter.LOWEST_PLATFORM_PRECEDENCE)
public class CubaLoginScreenFilter implements NavigationFilter {

    @Inject
    protected WindowConfig windowConfig;
    @Inject
    protected WebConfig webConfig;

    @Override
    public AccessCheckResult allowed(NavigationState fromState, NavigationState toState) {
        String loginWindowRoute = windowConfig.findRoute(webConfig.getLoginScreenId());

        if (!Objects.equals(loginWindowRoute, toState.getRoot())) {
            return AccessCheckResult.allowed();
        }

        boolean authenticated = AppUI.getCurrent().hasAuthenticatedSession();

        return authenticated
                ? AccessCheckResult.rejected()
                : AccessCheckResult.allowed();
    }
}


text:
#ifndef CONFTREEMODEL_H_
#define CONFTREEMODEL_H_

/*
 * $Id$
 */

#include <wx/wx.h>
#include <wx/dataview.h>

#include "conftreenode.h"

class CConfTreeModel:public wxDataViewModel {
  public:
    CConfTreeModel();
    ~CConfTreeModel();
    CConfTreeModel(CNutConfDoc *doc, NUTCOMPONENT *root_component);

    enum {
        MODEL_COLUMN_ITEM,
        MODEL_COLUMN_VALUE,
        MODEL_COLUMN_MAX
    };

    void AddChildItems(NUTCOMPONENT * compo, CConfTreeNode *parent);

    virtual unsigned int GetColumnCount() const;
    virtual wxString GetColumnType(unsigned int col) const;

    virtual void GetValue(wxVariant &variant, const wxDataViewItem &item, unsigned int col) const;
    virtual bool SetValue(const wxVariant &variant, const wxDataViewItem &item, unsigned int col);
    wxDataViewItem GetRootItem() const;
    virtual wxDataViewItem GetParent(const wxDataViewItem &item) const;
    virtual bool IsContainer(const wxDataViewItem &item) const;
    virtual bool IsEnabled(const wxDataViewItem &item, unsigned int col) const;
    virtual unsigned int GetChildren(const wxDataViewItem &parent, wxDataViewItemArray &array) const;
    virtual unsigned GetRow(const wxDataViewItem &item) const;
    wxDataViewItem GetItem(unsigned int row) const;
    void ToggleItem(const wxDataViewItem &item);
    wxDataViewItem SearchNext(wxDataViewItem& item, const wxString& text, bool checkFirst, bool matchCase, bool matchWord);
private:
    CNutConfDoc* m_config;
    CConfTreeNode* m_root_node;
    wxDataViewItem SearchRecursive(wxDataViewItem& root, const wxString& text, bool checkFirst, bool matchCase, bool matchWord);
    wxDataViewItem SearchSiblings(wxDataViewItem& item, wxDataViewItem& parent, const wxString& text, bool checkFirst, bool matchCase, bool matchWord);
};

#endif


text:
#ifndef S2_TEMPNAME_H
# define S2_TEMPNAME_H

# ifdef HAVE_CONFIG_H
# include "config.h"
# endif

# ifndef alloca
#  ifdef HAVE_ALLOCA_H
#   include <alloca.h>
#  elif defined __GNUC__
#   define alloca __builtin_alloca
#  elif defined _AIX
#   define alloca __alloca
#  else
#   include <stddef.h>
void *alloca (size_t);
#  endif
# endif

#include <Eina.h>
#include <Shotgun.h>

typedef enum
{
   S2_MODULE_TYPE_AUTH, /**< credential storage */
   S2_MODULE_TYPE_LOGIN, /**< creates connection, login window */
   S2_MODULE_TYPE_LIST, /**< creates list view */
   S2_MODULE_TYPE_CHAT, /**< creates chat view */
   S2_MODULE_TYPE_UTIL, /**< misc functionality */
   S2_MODULE_TYPE_LAST, /**< iterator */
} S2_Module_Type;

typedef struct S2_Auth
{
   EINA_INLIST;
   unsigned int id;
   Shotgun_Auth *auth;
   Eina_Hash *contacts;
   Eina_List *message_send_listeners;
   Eina_Bool global_otr : 1;
   Eina_Bool mail_notifications : 1;
} S2_Auth;

typedef struct S2_Contact
{
   S2_Auth *auth;
   Eina_Stringshare *jid;
   Eina_Stringshare *send_jid; //user-selected
   Eina_Stringshare *name;
   Eina_List *groups;
   Shotgun_Presence_Type ptype;
   Shotgun_User_Subscription subscription;
   Eina_List *presences;
   void *list_item;
   struct
   {
      const char *full_name;
      struct
        {
           const char *type;
           const char *sha1;
           void *data;
           size_t size;
        } photo;
   } info;
   Eina_Bool subscription_pending : 1;
   Eina_Bool xhtml_im : 1;
} S2_Contact;

typedef void (*S2_Message_Send_Listener_Cb)(S2_Auth *sa, S2_Contact *sc, const char *msg, Shotgun_Message_Status status, Eina_Bool xhtml_im);

EAPI extern int S2_EVENT_CONTACT_ADD;
EAPI extern int S2_EVENT_CONTACT_UPDATE;
EAPI extern int S2_EVENT_CONTACT_CHAT;
EAPI extern int S2_EVENT_CONTACT_PRESENCE_ADD;
EAPI extern int S2_EVENT_CONTACT_PRESENCE_UPDATE;
EAPI extern int S2_EVENT_CONTACT_PRESENCE_DEL;
EAPI extern int S2_EVENT_CONTACT_DEL;

EAPI S2_Contact *ui_contact_find(S2_Auth *sa, const char *jid);
EAPI void ui_contact_chat_open(S2_Contact *sc);
EAPI S2_Auth *ui_shotgun_find(const char *jid);
EAPI S2_Auth *ui_shotgun_find_by_id(unsigned int id);
EAPI Eina_Bool ui_shotgun_userinfo_eq(S2_Contact *sc, Shotgun_User_Info *info);
EAPI void ui_shotgun_message_send(S2_Auth *sa, S2_Contact *sc, const char *msg, Shotgun_Message_Status status, Eina_Bool xhtml_im);;
EAPI void ui_shotgun_message_send_listener_add(S2_Auth *sa, S2_Message_Send_Listener_Cb cb);
EAPI void ui_shotgun_message_send_listener_del(S2_Auth *sa, S2_Message_Send_Listener_Cb cb);

static inline Eina_Stringshare *
ui_contact_name_get(const S2_Contact *sc)
{
   if (!sc) return NULL;
   if (sc->name && sc->name[0])
     return sc->name;
   if (sc->info.full_name && sc->info.full_name[0])
     return sc->info.full_name;
   return sc->jid;
}

static inline Eina_Stringshare *
ui_contact_send_jid_get(const S2_Contact *sc)
{
   EINA_SAFETY_ON_NULL_RETURN_VAL(sc, NULL);
   if (sc->send_jid) return sc->send_jid;
   if (sc->presences)
     {
        Shotgun_Event_Presence *p;

        p = eina_list_data_get(sc->presences);
        return p->jid;
     }
   return sc->jid;
}

static inline const char *
ui_jid_base_get(const char *jid)
{
   static char buf[4096];
   const char *p;

   p = strchr(jid, '/');
   if (!p) return jid;

   memcpy(buf, jid, p - jid);
   buf[p - jid] = 0;
   return buf;
}

#endif


text: {{ page.content }}


text:
package uk.co.itmoore.intellisubsteps.psi;

import com.intellij.extapi.psi.ASTWrapperPsiElement;
import com.intellij.lang.ASTNode;
import org.jetbrains.annotations.NotNull;

/**
 * Created by ian on 24/07/15.
 */
public abstract class SubstepsNamedElementImpl extends ASTWrapperPsiElement implements SubstepsNamedElement {

    public SubstepsNamedElementImpl(@NotNull ASTNode node) {
        super(node);
    }
}


text:
#include <stdbool.h>

#include "mphalport.h"

#include "py/mperrno.h"
#include "py/runtime.h"

#include "common-hal/microcontroller/Pin.h"
#include "shared-bindings/sdioio/SDCard.h"
#include "shared-bindings/microcontroller/Pin.h"
#include "shared-bindings/microcontroller/__init__.h"
#include "supervisor/port.h"
#include "supervisor/shared/translate/translate.h"

#include "peripherals/broadcom/cpu.h"
#include "peripherals/broadcom/defines.h"
#include "peripherals/broadcom/gpio.h"

#include "lib/sdmmc/include/sdmmc_cmd.h"

void osal_task_delay(uint32_t msec) {
    mp_hal_delay_ms(msec);
}

/*!< Host function to initialize the driver */
STATIC sdmmc_err_t _init(void) {
    return SDMMC_OK;
}

/*!< host function to set bus width */
STATIC sdmmc_err_t _set_bus_width(int slot, size_t width) {
    if (width == 4) {
        EMMC->CONTROL0_b.HCTL_DWIDTH = true;
    } else if (width == 8) {
        EMMC->CONTROL0_b.HCTL_8BIT = true;
    }
    return SDMMC_OK;
}

/*!< host function to get the maximum bus width of a particular slot */
STATIC size_t _get_bus_width(int slot) {
    return 4;
}

/*!< host function to set card clock frequency */
STATIC sdmmc_err_t _set_card_clk(int slot, uint32_t freq_khz) {
    uint32_t base_clock = 125000000;
    uint32_t frequency = freq_khz * 1000;
    uint64_t start_ticks = port_get_raw_ticks(NULL);
    while ((EMMC->STATUS_b.CMD_INHIBIT || EMMC->STATUS_b.DAT_INHIBIT) && (port_get_raw_ticks(NULL) - start_ticks) < 1024) {
    }
    if (EMMC->STATUS_b.CMD_INHIBIT || EMMC->STATUS_b.DAT_INHIBIT) {
        return SDMMC_ERR_TIMEOUT;
    }

    EMMC->CONTROL1_b.CLK_EN = false;

    uint32_t divisor = base_clock / frequency;
    // + 1 to ensure we round the frequency down.
    if (base_clock % frequency > 0) {
        divisor += 1;
    }
    // Only even divisors are supported
    uint32_t register_value = divisor / 2;
    if (divisor % 2 == 1) {
        register_value += 1;
    }

    // The divisor is stored with bits swapped.
    EMMC->CONTROL1_b.CLK_FREQ8 = divisor & 0xff;
    EMMC->CONTROL1_b.CLK_FREQ_MS2 = (divisor >> 8) & 0x3;

    EMMC->CONTROL1_b.CLK_EN = true;
    start_ticks = port_get_raw_ticks(NULL);
    while (!EMMC->CONTROL1_b.CLK_STABLE && (port_get_raw_ticks(NULL) - start_ticks) < 1024) {
    }
    if (!EMMC->CONTROL1_b.CLK_STABLE) {
        return SDMMC_ERR_TIMEOUT;
    }
    return SDMMC_OK;
}

/*!< host function to do a transaction */
STATIC sdmmc_err_t _do_transaction(int slot, sdmmc_command_t *cmdinfo) {
    if (EMMC->STATUS_b.CMD_INHIBIT) {
        return SDMMC_ERR_BUSY;
    }

    // Clear interrupts and then send the command
    EMMC->INTERRUPT = 0xffffffff;
    EMMC->ARG1 = cmdinfo->arg;

    uint32_t cmd_flags = 0;
    bool read = (cmdinfo->flags & SCF_CMD_READ) != 0;
    if (SCF_CMD(cmdinfo->flags) == SCF_CMD_ADTC ||
        SCF_CMD(cmdinfo->flags) == (SCF_CMD_ADTC | SCF_CMD_READ)) {
        if (EMMC->STATUS_b.DAT_INHIBIT) {
            return SDMMC_ERR_BUSY;
        }
        cmd_flags = EMMC_CMDTM_TM_BLKCNT_EN_Msk | EMMC_CMDTM_CMD_ISDATA_Msk;
        if (cmdinfo->datalen > cmdinfo->blklen) {
            cmd_flags |= EMMC_CMDTM_TM_MULTI_BLOCK_Msk;
            if ((cmdinfo->flags & SCF_AUTO_STOP) != 0) {
                cmd_flags |= 1 << EMMC_CMDTM_TM_AUTO_CMD_EN_Pos;
            }
        }
        if (read) {
            cmd_flags |= EMMC_CMDTM_TM_DAT_DIR_Msk;
        }
        EMMC->BLKSIZECNT = (cmdinfo->datalen / cmdinfo->blklen) << EMMC_BLKSIZECNT_BLKCNT_Pos |
            cmdinfo->blklen << EMMC_BLKSIZECNT_BLKSIZE_Pos;
    }

    uint32_t response_type = EMMC_CMDTM_CMD_RSPNS_TYPE_RESPONSE_48BITS;
    uint32_t crc = 0;
    if ((cmdinfo->flags & SCF_RSP_CRC) != 0) {
        crc |= EMMC_CMDTM_CMD_CRCCHK_EN_Msk;
    }
    if ((cmdinfo->flags & SCF_RSP_IDX) != 0) {
        crc |= EMMC_CMDTM_CMD_IXCHK_EN_Msk;
    }
    if ((cmdinfo->flags & SCF_RSP_136) != 0) {
        response_type = EMMC_CMDTM_CMD_RSPNS_TYPE_RESPONSE_136BITS;
    } else if ((cmdinfo->flags & SCF_RSP_BSY) != 0) {
        response_type = EMMC_CMDTM_CMD_RSPNS_TYPE_RESPONSE_48BITS_USING_BUSY;
    } else if ((cmdinfo->flags & SCF_RSP_PRESENT) == 0) {
        response_type = EMMC_CMDTM_CMD_RSPNS_TYPE_RESPONSE_NONE;
    }
    uint32_t full_cmd = cmd_flags | crc |
        cmdinfo->opcode << EMMC_CMDTM_CMD_INDEX_Pos |
        response_type << EMMC_CMDTM_CMD_RSPNS_TYPE_Pos;
    EMMC->CMDTM = full_cmd;

    // Wait for an interrupt to indicate completion of the command.
    uint64_t start_ticks = port_get_raw_ticks(NULL);
    while (EMMC->INTERRUPT == 0 && (port_get_raw_ticks(NULL) - start_ticks) < (size_t)cmdinfo->timeout_ms) {
    }
    if (!EMMC->INTERRUPT_b.CMD_DONE) {
        cmdinfo->response[0] = 0;
        // Reset the command circuit
        EMMC->CONTROL1_b.SRST_CMD = true;
        // Wait for the bit to clear
        start_ticks = port_get_raw_ticks(NULL);
        while (EMMC->CONTROL1_b.SRST_CMD && (port_get_raw_ticks(NULL) - start_ticks) < (size_t)cmdinfo->timeout_ms) {
        }
        return SDMMC_ERR_TIMEOUT;
    } else {
        EMMC->INTERRUPT = EMMC_INTERRUPT_CMD_DONE_Msk;
    }

    // Transfer the data.
    // TODO: Use DMA
    if (cmd_flags != 0) {
        if (read) {
            for (size_t i = 0; i < cmdinfo->datalen / sizeof(uint32_t); i++) {
                start_ticks = port_get_raw_ticks(NULL);
                while (!EMMC->INTERRUPT_b.READ_RDY && (port_get_raw_ticks(NULL) - start_ticks) < (size_t)cmdinfo->timeout_ms) {
                }
                if (!EMMC->INTERRUPT_b.READ_RDY) {
                    return SDMMC_ERR_TIMEOUT;
                }
                ((uint32_t *)cmdinfo->data)[i] = EMMC->DATA;
            }
        } else {
            for (size_t i = 0; i < cmdinfo->datalen / sizeof(uint32_t); i++) {
                start_ticks = port_get_raw_ticks(NULL);
                while (!EMMC->INTERRUPT_b.WRITE_RDY && (port_get_raw_ticks(NULL) - start_ticks) < (size_t)cmdinfo->timeout_ms) {
                }
                if (!EMMC->INTERRUPT_b.WRITE_RDY) {
                    return SDMMC_ERR_TIMEOUT;
                }
                EMMC->DATA = ((uint32_t *)cmdinfo->data)[i];
            }
        }
        uint32_t data_done_mask = EMMC_INTERRUPT_ERR_Msk | EMMC_INTERRUPT_DATA_DONE_Msk;
        start_ticks = port_get_raw_ticks(NULL);
        while ((EMMC->INTERRUPT & data_done_mask) == 0 && (port_get_raw_ticks(NULL) - start_ticks) < (size_t)cmdinfo->timeout_ms) {
        }
        if (!EMMC->INTERRUPT_b.DATA_DONE) {
            cmdinfo->response[0] = 0;
            // Reset the command circuit
            EMMC->CONTROL1_b.SRST_DATA = true;
            // Wait for the bit to clear
            start_ticks = port_get_raw_ticks(NULL);
            while (EMMC->CONTROL1_b.SRST_DATA && (port_get_raw_ticks(NULL) - start_ticks) < (size_t)cmdinfo->timeout_ms) {
            }
            return SDMMC_ERR_TIMEOUT;
        }
    }

    cmdinfo->response[0] = EMMC->RESP0;
    if (response_type == EMMC_CMDTM_CMD_RSPNS_TYPE_RESPONSE_136BITS) {
        // Rotate one more byte for some reason.
        cmdinfo->response[3] = EMMC->RESP3 << 8 | ((EMMC->RESP2 >> 24) & 0xff);
        cmdinfo->response[2] = EMMC->RESP2 << 8 | ((EMMC->RESP1 >> 24) & 0xff);
        cmdinfo->response[1] = EMMC->RESP1 << 8 | ((EMMC->RESP0 >> 24) & 0xff);
        cmdinfo->response[0] <<= 8;
    }
    return SDMMC_OK;
}

/*!< host function to deinitialize the driver, called with the `slot` */
STATIC sdmmc_err_t _deinit(int slot) {
    return SDMMC_OK;
}

void common_hal_sdioio_sdcard_construct(sdioio_sdcard_obj_t *self,
    const mcu_pin_obj_t *clock, const mcu_pin_obj_t *command,
    uint8_t num_data, const mcu_pin_obj_t **data, uint32_t frequency) {

    if (clock != NULL) {
        gpio_set_function(clock->number, GPIO_GPFSEL4_FSEL48_SD1_CLK);
        gpio_set_pull(clock->number, BP_PULL_NONE);
        self->clock_pin = clock->number;
        gpio_set_function(command->number, GPIO_GPFSEL4_FSEL49_SD1_CMD);
        gpio_set_pull(command->number, BP_PULL_UP);
        self->command_pin = command->number;
        gpio_set_function(data[0]->number, GPIO_GPFSEL5_FSEL50_SD1_DAT0);
        gpio_set_pull(data[0]->number, BP_PULL_UP);
        self->data_pins[0] = data[0]->number;
        gpio_set_function(data[1]->number, GPIO_GPFSEL5_FSEL51_SD1_DAT1);
        gpio_set_pull(data[1]->number, BP_PULL_UP);
        self->data_pins[1] = data[1]->number;
        gpio_set_function(data[2]->number, GPIO_GPFSEL5_FSEL52_SD1_DAT2);
        gpio_set_pull(data[2]->number, BP_PULL_UP);
        self->data_pins[2] = data[2]->number;
        gpio_set_function(data[3]->number, GPIO_GPFSEL5_FSEL53_SD1_DAT3);
        gpio_set_pull(data[3]->number, BP_PULL_UP);
        self->data_pins[3] = data[3]->number;
    } else {
        // Switch the sdcard to use the old arasan interface.
        GPIO->EXTRA_MUX_b.SDIO = GPIO_EXTRA_MUX_SDIO_ARASAN;
    }

    COMPLETE_MEMORY_READS;

    self->host_info = (sdmmc_host_t) {
        .flags = SDMMC_HOST_FLAG_1BIT | SDMMC_HOST_FLAG_4BIT | SDMMC_HOST_FLAG_DEINIT_ARG,
        .slot = 0,
        .max_freq_khz = SDMMC_FREQ_HIGHSPEED,
        .io_voltage = 3.3f,
        .command_timeout_ms = 0,
        .init = _init,
        .set_bus_width = _set_bus_width,
        .get_bus_width = _get_bus_width,
        .set_bus_ddr_mode = NULL,
        .set_card_clk = _set_card_clk,
        .do_transaction = _do_transaction,
        .deinit_p = _deinit,
    };

    // Reset the peripheral.
    EMMC->CONTROL0 = 0;
    EMMC->CONTROL1_b.SRST_HC = true;
    // Wait for the bit to clear
    while (EMMC->CONTROL1_b.SRST_HC) {

    }
    // Set max timeout
    EMMC->CONTROL1 |= EMMC_CONTROL1_CLK_INTLEN_Msk | (0xe << EMMC_CONTROL1_DATA_TOUNIT_Pos);

    EMMC->IRPT_MASK = 0xffffffff;

    // Start clocking the card.
    _set_card_clk(0, 400);

    sdmmc_err_t err = SDMMC_ERR_INVALID_RESPONSE;
    size_t tries = 3;
    while (err == SDMMC_ERR_INVALID_RESPONSE && tries > 0) {
        err = sdmmc_card_init(&self->host_info, &self->card_info);
        if (err != SDMMC_OK) {
            mp_printf(&mp_plat_print, "SD card init failed %d\n", err);
        } else if (tries < 3) {
            mp_printf(&mp_plat_print, "SD card init success\n");
        }
        tries--;
    }

    self->init = err == SDMMC_OK;

    self->capacity = self->card_info.csd.capacity;
    COMPLETE_MEMORY_READS;
}

uint32_t common_hal_sdioio_sdcard_get_count(sdioio_sdcard_obj_t *self) {
    return self->capacity;
}

uint32_t common_hal_sdioio_sdcard_get_frequency(sdioio_sdcard_obj_t *self) {
    return self->frequency;
}

uint8_t common_hal_sdioio_sdcard_get_width(sdioio_sdcard_obj_t *self) {
    return self->num_data;
}

STATIC void check_whole_block(mp_buffer_info_t *bufinfo) {
    if (bufinfo->len % 512) {
        mp_raise_ValueError(translate("Buffer length must be a multiple of 512"));
    }
}

int common_hal_sdioio_sdcard_writeblocks(sdioio_sdcard_obj_t *self, uint32_t start_block, mp_buffer_info_t *bufinfo) {
    if (!self->init) {
        return -EIO;
    }
    check_whole_block(bufinfo);
    self->state_programming = true;

    COMPLETE_MEMORY_READS;
    sdmmc_err_t error = sdmmc_write_sectors(&self->card_info, bufinfo->buf,
        start_block, bufinfo->len / 512);
    COMPLETE_MEMORY_READS;

    if (error != SDMMC_OK) {
        mp_printf(&mp_plat_print, "write sectors result %d\n", error);
        return -EIO;
    }

    return 0;
}

int common_hal_sdioio_sdcard_readblocks(sdioio_sdcard_obj_t *self, uint32_t start_block, mp_buffer_info_t *bufinfo) {
    if (!self->init) {
        return -EIO;
    }
    check_whole_block(bufinfo);
    COMPLETE_MEMORY_READS;
    sdmmc_err_t error = sdmmc_read_sectors(&self->card_info, bufinfo->buf,
        start_block, bufinfo->len / 512);
    COMPLETE_MEMORY_READS;

    if (error != SDMMC_OK) {
        mp_printf(&mp_plat_print, "read sectors result %d when reading block %d for %d\n", error, start_block, bufinfo->len / 512);
        return -EIO;
    }

    return 0;
}

bool common_hal_sdioio_sdcard_configure(sdioio_sdcard_obj_t *self, uint32_t frequency, uint8_t bits) {
    if (!self->init) {
        return false;
    }
    return true;
}

bool common_hal_sdioio_sdcard_deinited(sdioio_sdcard_obj_t *self) {
    return self->command_pin == COMMON_HAL_MCU_NO_PIN;
}

void common_hal_sdioio_sdcard_deinit(sdioio_sdcard_obj_t *self) {
    reset_pin_number(self->command_pin);
    reset_pin_number(self->clock_pin);
    reset_pin_number(self->data_pins[0]);
    reset_pin_number(self->data_pins[1]);
    reset_pin_number(self->data_pins[2]);
    reset_pin_number(self->data_pins[3]);

    self->command_pin = COMMON_HAL_MCU_NO_PIN;
    self->clock_pin = COMMON_HAL_MCU_NO_PIN;
    self->data_pins[0] = COMMON_HAL_MCU_NO_PIN;
    self->data_pins[1] = COMMON_HAL_MCU_NO_PIN;
    self->data_pins[2] = COMMON_HAL_MCU_NO_PIN;
    self->data_pins[3] = COMMON_HAL_MCU_NO_PIN;
    self->init = false;
}

void common_hal_sdioio_sdcard_never_reset(sdioio_sdcard_obj_t *self) {
    never_reset_pin_number(self->command_pin);
    never_reset_pin_number(self->clock_pin);
    never_reset_pin_number(self->data_pins[0]);
    never_reset_pin_number(self->data_pins[1]);
    never_reset_pin_number(self->data_pins[2]);
    never_reset_pin_number(self->data_pins[3]);
}


text:
package im.AfriChat.messenger.app.util.images.common;

/**
 * Image Format
 */
public enum ImageFormat {
    JPEG, PNG, BMP, GIF, WEBP, UNKNOWN
}


text:
namespace mojo {
namespace examples {

ResourceCreationImpl::ResourceCreationImpl() {}

ResourceCreationImpl::~ResourceCreationImpl() {}

PP_Resource ResourceCreationImpl::CreateFileIO(PP_Instance instance) {
  NOTIMPLEMENTED();
  return 0;
}

PP_Resource ResourceCreationImpl::CreateFileRef(
    PP_Instance instance,
    const ppapi::FileRefCreateInfo& create_info) {
  NOTIMPLEMENTED();
  return 0;
}

PP_Resource ResourceCreationImpl::CreateFileSystem(
    PP_Instance instance,
    PP_FileSystemType type) {
  NOTIMPLEMENTED();
  return 0;
}

PP_Resource ResourceCreationImpl::CreateIMEInputEvent(
    PP_Instance instance,
    PP_InputEvent_Type type,
    PP_TimeTicks time_stamp,
    struct PP_Var text,
    uint32_t segment_number,
    const uint32_t* segment_offsets,
    int32_t target_segment,
    uint32_t selection_start,
    uint32_t selection_end) {
  NOTIMPLEMENTED();
  return 0;
}

PP_Resource ResourceCreationImpl::CreateKeyboardInputEvent_1_0(
    PP_Instance instance,
    PP_InputEvent_Type type,
    PP_TimeTicks time_stamp,
    uint32_t modifiers,
    uint32_t key_code,
    struct PP_Var character_text) {
  NOTIMPLEMENTED();
  return 0;
}

PP_Resource ResourceCreationImpl::CreateKeyboardInputEvent_1_2(
    PP_Instance instance,
    PP_InputEvent_Type type,
    PP_TimeTicks time_stamp,
    uint32_t modifiers,
    uint32_t key_code,
    struct PP_Var character_text,
    struct PP_Var code) {
  NOTIMPLEMENTED();
  return 0;
}

PP_Resource ResourceCreationImpl::CreateMouseInputEvent(
    PP_Instance instance,
    PP_InputEvent_Type type,
    PP_TimeTicks time_stamp,
    uint32_t modifiers,
    PP_InputEvent_MouseButton mouse_button,
    const PP_Point* mouse_position,
    int32_t click_count,
    const PP_Point* mouse_movement) {
  NOTIMPLEMENTED();
  return 0;
}

PP_Resource ResourceCreationImpl::CreateTouchInputEvent(
    PP_Instance instance,
    PP_InputEvent_Type type,
    PP_TimeTicks time_stamp,
    uint32_t modifiers) {
  NOTIMPLEMENTED();
  return 0;
}

PP_Resource ResourceCreationImpl::CreateTrueTypeFont(
    PP_Instance instance,
    const PP_TrueTypeFontDesc_Dev* desc) {
  NOTIMPLEMENTED();
  return 0;
}

PP_Resource ResourceCreationImpl::CreateURLLoader(PP_Instance instance) {
  NOTIMPLEMENTED();
  return 0;
}

PP_Resource ResourceCreationImpl::CreateURLRequestInfo(
    PP_Instance instance) {
  NOTIMPLEMENTED();
  return 0;
}

PP_Resource ResourceCreationImpl::CreateWheelInputEvent(
    PP_Instance instance,
    PP_TimeTicks time_stamp,
    uint32_t modifiers,
    const PP_FloatPoint* wheel_delta,
    const PP_FloatPoint* wheel_ticks,
    PP_Bool scroll_by_page) {
  NOTIMPLEMENTED();
  return 0;
}

PP_Resource ResourceCreationImpl::CreateAudio1_0(
    PP_Instance instance,
    PP_Resource config_id,
    PPB_Audio_Callback_1_0 audio_callback,
    void* user_data) {
  NOTIMPLEMENTED();
  return 0;
}

PP_Resource ResourceCreationImpl::CreateAudio(
    PP_Instance instance,
    PP_Resource config_id,
    PPB_Audio_Callback audio_callback,
    void* user_data) {
  NOTIMPLEMENTED();
  return 0;
}

PP_Resource ResourceCreationImpl::CreateAudioTrusted(PP_Instance instance) {
  NOTIMPLEMENTED();
  return 0;
}

PP_Resource ResourceCreationImpl::CreateAudioConfig(
    PP_Instance instance,
    PP_AudioSampleRate sample_rate,
    uint32_t sample_frame_count) {
  NOTIMPLEMENTED();
  return 0;
}

PP_Resource ResourceCreationImpl::CreateCompositor(PP_Instance instance) {
  NOTIMPLEMENTED();
  return 0;
}

PP_Resource ResourceCreationImpl::CreateFileChooser(
    PP_Instance instance,
    PP_FileChooserMode_Dev mode,
    const PP_Var& accept_types) {
  NOTIMPLEMENTED();
  return 0;
}

PP_Resource ResourceCreationImpl::CreateGraphics2D(PP_Instance instance,
                                                   const PP_Size* size,
                                                   PP_Bool is_always_opaque) {
  NOTIMPLEMENTED();
  return 0;
}

PP_Resource ResourceCreationImpl::CreateGraphics3D(
    PP_Instance instance,
    PP_Resource share_context,
    const int32_t* attrib_list) {
  return (new Graphics3DResource(instance))->GetReference();
}

PP_Resource ResourceCreationImpl::CreateGraphics3DRaw(
    PP_Instance instance,
    PP_Resource share_context,
    const int32_t* attrib_list,
    base::SharedMemoryHandle* shared_state) {
  NOTIMPLEMENTED();
  return 0;
}

PP_Resource ResourceCreationImpl::CreateHostResolver(PP_Instance instance) {
  NOTIMPLEMENTED();
  return 0;
}

PP_Resource ResourceCreationImpl::CreateHostResolverPrivate(
    PP_Instance instance) {
  NOTIMPLEMENTED();
  return 0;
}

PP_Resource ResourceCreationImpl::CreateImageData(
    PP_Instance instance,
    PP_ImageDataFormat format,
    const PP_Size* size,
    PP_Bool init_to_zero) {
  NOTIMPLEMENTED();
  return 0;
}

PP_Resource ResourceCreationImpl::CreateImageDataSimple(
    PP_Instance instance,
    PP_ImageDataFormat format,
    const PP_Size* size,
    PP_Bool init_to_zero) {
  NOTIMPLEMENTED();
  return 0;
}

PP_Resource ResourceCreationImpl::CreateMediaStreamVideoTrack(
    PP_Instance instance) {
  NOTIMPLEMENTED();
  return 0;
}

PP_Resource ResourceCreationImpl::CreateNetAddressFromIPv4Address(
    PP_Instance instance,
    const PP_NetAddress_IPv4* ipv4_addr) {
  NOTIMPLEMENTED();
  return 0;
}

PP_Resource ResourceCreationImpl::CreateNetAddressFromIPv6Address(
    PP_Instance instance,
    const PP_NetAddress_IPv6* ipv6_addr) {
  NOTIMPLEMENTED();
  return 0;
}

PP_Resource ResourceCreationImpl::CreateNetAddressFromNetAddressPrivate(
    PP_Instance instance,
    const PP_NetAddress_Private& private_addr) {
  NOTIMPLEMENTED();
  return 0;
}

PP_Resource ResourceCreationImpl::CreateNetworkMonitor(
    PP_Instance instance) {
  NOTIMPLEMENTED();
  return 0;
}

PP_Resource ResourceCreationImpl::CreateOutputProtectionPrivate(
    PP_Instance instance) {
  NOTIMPLEMENTED();
  return 0;
}

PP_Resource ResourceCreationImpl::CreatePrinting(PP_Instance instance) {
  NOTIMPLEMENTED();
  return 0;
}

PP_Resource ResourceCreationImpl::CreateTCPServerSocketPrivate(
    PP_Instance instance) {
  NOTIMPLEMENTED();
  return 0;
}

PP_Resource ResourceCreationImpl::CreateTCPSocket1_0(
    PP_Instance instance) {
  NOTIMPLEMENTED();
  return 0;
}

PP_Resource ResourceCreationImpl::CreateTCPSocket(
    PP_Instance instance) {
  NOTIMPLEMENTED();
  return 0;
}

PP_Resource ResourceCreationImpl::CreateTCPSocketPrivate(
    PP_Instance instance) {
  NOTIMPLEMENTED();
  return 0;
}

PP_Resource ResourceCreationImpl::CreateUDPSocket(PP_Instance instance) {
  NOTIMPLEMENTED();
  return 0;
}

PP_Resource ResourceCreationImpl::CreateUDPSocketPrivate(
    PP_Instance instance) {
  NOTIMPLEMENTED();
  return 0;
}

PP_Resource ResourceCreationImpl::CreateVideoDecoder(PP_Instance instance) {
  NOTIMPLEMENTED();
  return 0;
}

PP_Resource ResourceCreationImpl::CreateVideoDestination(
    PP_Instance instance) {
  NOTIMPLEMENTED();
  return 0;
}

PP_Resource ResourceCreationImpl::CreateVideoSource(
    PP_Instance instance) {
  NOTIMPLEMENTED();
  return 0;
}

PP_Resource ResourceCreationImpl::CreateWebSocket(PP_Instance instance) {
  NOTIMPLEMENTED();
  return 0;
}

PP_Resource ResourceCreationImpl::CreateX509CertificatePrivate(
    PP_Instance instance) {
  NOTIMPLEMENTED();
  return 0;
}

#if !defined(OS_NACL)
PP_Resource ResourceCreationImpl::CreateAudioInput(
    PP_Instance instance) {
  NOTIMPLEMENTED();
  return 0;
}

PP_Resource ResourceCreationImpl::CreateBroker(PP_Instance instance) {
  NOTIMPLEMENTED();
  return 0;
}

PP_Resource ResourceCreationImpl::CreateBrowserFont(
    PP_Instance instance,
    const PP_BrowserFont_Trusted_Description* description) {
  NOTIMPLEMENTED();
  return 0;
}

PP_Resource ResourceCreationImpl::CreateBuffer(PP_Instance instance,
                                                uint32_t size) {
  NOTIMPLEMENTED();
  return 0;
}

PP_Resource ResourceCreationImpl::CreateFlashDRM(PP_Instance instance) {
  NOTIMPLEMENTED();
  return 0;
}

PP_Resource ResourceCreationImpl::CreateFlashFontFile(
    PP_Instance instance,
    const PP_BrowserFont_Trusted_Description* description,
    PP_PrivateFontCharset charset) {
  NOTIMPLEMENTED();
  return 0;
}

PP_Resource ResourceCreationImpl::CreateFlashMenu(
    PP_Instance instance,
    const PP_Flash_Menu* menu_data) {
  NOTIMPLEMENTED();
  return 0;
}

PP_Resource ResourceCreationImpl::CreateFlashMessageLoop(
    PP_Instance instance) {
  NOTIMPLEMENTED();
  return 0;
}

PP_Resource ResourceCreationImpl::CreatePlatformVerificationPrivate(
    PP_Instance instance) {
  NOTIMPLEMENTED();
  return 0;
}

PP_Resource ResourceCreationImpl::CreateScrollbar(PP_Instance instance,
                                                   PP_Bool vertical) {
  NOTIMPLEMENTED();
  return 0;
}

PP_Resource ResourceCreationImpl::CreateTalk(PP_Instance instance) {
  NOTIMPLEMENTED();
  return 0;
}

PP_Resource ResourceCreationImpl::CreateVideoCapture(PP_Instance instance) {
  NOTIMPLEMENTED();
  return 0;
}

PP_Resource ResourceCreationImpl::CreateVideoDecoderDev(
    PP_Instance instance,
    PP_Resource context3d_id,
    PP_VideoDecoder_Profile profile) {
  NOTIMPLEMENTED();
  return 0;
}
#endif  // !defined(OS_NACL)

}  // namespace examples
}  // namespace mojo


text:
using System.Xml;

#endregion

namespace DotNetNuke.UI.Skins
{
    public class InstalledSkinInfo
    {
        public bool InUse { get; set; }

        public string SkinFile { get; set; }

        public string SkinName { get; set; }

        public void WriteXml(XmlWriter writer)
        {
			//Write start of main elemenst
            writer.WriteStartElement("skin");

            writer.WriteElementString("skinName", SkinName);
            writer.WriteElementString("inUse", InUse.ToString());

            //Write end of Host Info
            writer.WriteEndElement();
        }
    }
}


text:
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="AppNexusAppService.cs" company="Rare Crowds Inc">
// Copyright 2012-2013 Rare Crowds, Inc.
//
//   Licensed under the Apache License, Version 2.0 (the "License");
//   you may not use this file except in compliance with the License.
//   You may obtain a copy of the License at
//
//       http://www.apache.org/licenses/LICENSE-2.0
//
//   Unless required by applicable law or agreed to in writing, software
//   distributed under the License is distributed on an "AS IS" BASIS,
//   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//   See the License for the specific language governing permissions and
//   limitations under the License.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------

using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Net;
using System.ServiceModel;
using System.ServiceModel.Activation;
using System.ServiceModel.Web;
using System.Text;
using System.Web;
using System.Xml;
using Activities;
using AppNexusUtilities;
using DataServiceUtilities;
using DynamicAllocationUtilities;
using EntityUtilities;
using Newtonsoft.Json;

namespace ApiLayer
{
    /// Service for AppNexus App specific functionality
    /// <remarks>The ServiceBase assumes InstanceContextMode.PerCall</remarks>
    [ServiceContract]
    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
    [ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall)]
    public class AppNexusAppService : ServiceBase
    {
        /// Registration service POST handler
        /// <param name="postBody">JSON string of the post</param>
        /// <returns>Response stream for HTTP response</returns>
        [WebInvoke(UriTemplate = "register", Method = "POST")]
        public Stream RegisterUser(Stream postBody)
        {
            this.Context.BuildRequestContext(postBody);
            var request = new ActivityRequest
            {
                Task = AppNexusActivityTasks.AppUserRegistration,
                Values =
                {
                    { EntityActivityValues.AuthUserId, this.NameIdentifierClaimValue },
                    { EntityActivityValues.MessagePayload, this.Context.RequestData }
                }
            };
            this.ProcessActivity(request, false);

            // Always return an empty response body
            return new MemoryStream();
        }

        /// GET handler for AppNexus app creatives
        /// <returns>Response stream for HTTP response</returns>
        [WebGet(UriTemplate = "creatives")]
        [SuppressMessage("Microsoft.Design", "CA1024", Justification = "Should be method rather than property for consistency")]
        public Stream GetCreatives()
        {
            var companyId = WebContext.IncomingRequest.UriTemplateMatch.QueryParameters["Company"];
            var campaignId = WebContext.IncomingRequest.UriTemplateMatch.QueryParameters["Campaign"];
            var request = new ActivityRequest
            {
                Task = AppNexusActivityTasks.GetCreatives,
                Values =
                {
                    { EntityActivityValues.AuthUserId, this.NameIdentifierClaimValue },
                    { EntityActivityValues.CompanyEntityId, companyId },
                    { EntityActivityValues.CampaignEntityId, campaignId },
                }
            };
            return this.ProcessActivity(request, false);
        }

        /// GET handler for AppNexus app segment data costs CSV
        /// <returns>Response stream for HTTP response</returns>
        [WebGet(UriTemplate = "datacost.csv")]
        [SuppressMessage("Microsoft.Design", "CA1024", Justification = "Should be method rather than property for consistency")]
        public Stream GetDataCostCsv()
        {
            var request = new ActivityRequest
            {
                Task = AppNexusActivityTasks.GetDataCostCsv,
                Values =
                {
                    { EntityActivityValues.AuthUserId, this.NameIdentifierClaimValue }
                }
            };
            return this.ProcessActivity(request, false, 30000);
        }

        /// Builds the data response from the activity result.
        /// <remarks>This is the only place from which the response needs to be built.</remarks>
        /// <param name="result">Result returned from the activity</param>
        /// <returns>Stream that contains the json response to be returned</returns>
        protected override Stream BuildResponse(ActivityResult result)
        {
            using (var writer = new StringWriter(CultureInfo.InvariantCulture))
            {
                this.WriteResponse(result, writer);
                writer.Flush();
                return new MemoryStream(Encoding.UTF8.GetBytes(writer.ToString()));
            }
        }

        ///
        /// Writes the data service results to the response
        /// and sets the status code and content type
        ///
        /// <param name="result">Result returned from the activity</param>
        /// <param name="writer">Text writer to which the response is to be written</param>
        protected override void WriteResponse(ActivityResult result, TextWriter writer)
        {
            WebOperationContext.Current.OutgoingResponse.StatusCode = this.Context.ResponseCode;
            WebOperationContext.Current.OutgoingResponse.Headers.Add(HttpResponseHeader.CacheControl, "private,no-cache");
            WebOperationContext.Current.OutgoingResponse.ContentType = "application/json";

            if (result != null && result.Values != null && result.Values.Count > 0)
            {
                writer.Write(result.Values.First().Value);
            }
        }
    }
}


text:
package cogx.compiler.codegenerator.opencl.hyperkernels.domaintransform

import cogx.compiler.codegenerator.opencl.fragments._
import cogx.platform.types.{VirtualFieldRegister, FieldType}
import cogx.compiler.parser.op.DomainTransformRowsOp
import cogx.platform.opencl.WorkGroupParameters
import cogx.cogmath.algebra.real.Logarithm
import cogx.compiler.codegenerator.common.FieldPolicies._

/** Implements the domain transform on the rows of a tensor field. See the paper
  * "Domain transform for edge-aware image and video processing," Gastal and
  * Oliveira, 2011, for a description.
  *
  * NOTE: This will only handle small tensor fields, where "small" means each
  * tensor has no more than 4 elements. This is due to local memory
  * limitations.
  *
  * NOTE: Unlike for color fields, the tensor elements are handled
  * independently.
  *
  * @param in The input virtual field register driving this kernel.
  * @param operation The binary opcode for this operation.
  * @param resultType The FieldType of the result of this kernel.
  * @param addressMode Addressing mode for this kernel (must be small tensor).
  *
  * @author Greg Snider
  */
private[cogx]
class TensorDomainTransformRowsHyperKernel private (in: VirtualFieldRegister,
                                                   operation: DomainTransformRowsOp,
                                                   resultType: FieldType,
                                                   addressMode: AddressingMode)
        extends HyperKernel(operation, Array(in), resultType, addressMode, ClampToEdge)
        with Logarithm
{
  require(in.fieldType.fieldShape.dimensions == 2, "only works on 2D fields")
  require(addressMode == BigTensorAddressing)

  /** Max threads per workgroup, which is hardware dependent. We need a better
    * way of finding this out for a given target.
    */
  val MaxThreadsPerWorkGroup = 1024
  private val rows = in.fieldType.rows
  private val columns = in.fieldType.columns
  require(rows <= MaxThreadsPerWorkGroup, "image too big for this operator")
  require(columns <= MaxThreadsPerWorkGroup, "image too big for this operator")

  // Work group computation.
  // Our strategy is for each work group to work on a single row of the
  // image, with one thread for each pixel in the row.
  override lazy val workGroup =
    new WorkGroupParameters(2,
      globalLayers  = 1,
      globalRows    = rows,
      globalColumns = columns,
      localLayers  = 1,
      localRows    = 1,
      localColumns = columns
    )

  // Parameters for kernel.
  val scale = operation.spaceSigma / operation.rangeSigma
  val doublingIterations = log2(roundUpPowerOf2(columns)).toInt

  // The kernel code
  val code =
    """
      | // Outer loop, over all tensor elements.
      | for (tensorElement = 0; tensorElement < _tensorElements; tensorElement++) {
      |
      |   // Read in a row of the image (usually a scalar or vector field).
      |   __local float imageRow[%rowLength%];
      |   imageRow[_column] = readElement(@in0);
      |   barrier(CLK_LOCAL_MEM_FENCE);
      |
      |   // Compute the derivative of the domain transform, eqn (12).
      |   __local float transformA[%rowLength%];
      |   float g = fabs(imageRow[_column] - imageRow[max(_column - 1, 0)]);
      |   float ctPrime = g * %scale% + 1.0f;
      |   transformA[_column] = ctPrime;
      |   barrier(CLK_LOCAL_MEM_FENCE);
      |
      |   // Integrate using recursive doubling to get the domain transform,
      |   // eqn (11). We alternate between the transformA buffer and a second
      |   // buffer, transformB, that we create here. For a description of
      |   // recursive doubling, see "Fast summed-area table generation and its
      |   // applications," Hensley et al, 2005.
      |
      |   __local float transformB[%rowLength%];
      |   __local float* buffer1 = transformA;
      |   __local float* buffer2 = transformB;
      |   __local float* temp;
      |
      |   int stride = 1;
      |   for (int i = 0; i < %doublingIterations%; i++) {
      |     float center = buffer1[_column];
      |     float left;
      |     int leftIndex = _column - stride;
      |     if (leftIndex >= 0)
      |       left = buffer1[leftIndex];
      |     else
      |       left = 0.0f;
      |     buffer2[_column] = center + left;
      |     barrier(CLK_LOCAL_MEM_FENCE);
      |
      |     // Double the stride each iteration.
      |     stride = stride << 1;
      |
      |     // Swap buffers
      |     temp = buffer1;
      |     buffer1 = buffer2;
      |     buffer2 = temp;
      |   }
      |   barrier(CLK_LOCAL_MEM_FENCE);
      |
      |   // Write out the domain transform, ct.
      |   @outElement0 = buffer1[_column];
      | }
    """
  val codeString = code.toString.stripMargin.
          replaceAll("%rowLength%", columns.toString).
          replaceAll("%doublingIterations%", doublingIterations.toString).
          replaceAll("%scale%", scale.toString)
  addCode(codeString)
  //debugCompile
}

/** Factory for DomainTransformRowsHyperKernel. */
private[cogx]
object TensorDomainTransformRowsHyperKernel {

  /** Create a hyperkernel that implements the domain transform for the rows
    * of an input color field.
    *
    * @param in The input virtual field register driving this kernel.
    * @param operation The binary opcode for this operation.
    * @param resultType The FieldType of the result of this kernel.
    * @return Synthesized hyperkernel for the operation.
    */
  def apply(in: Array[VirtualFieldRegister],
            operation: DomainTransformRowsOp,
            resultType: FieldType): HyperKernel =
  {
    require(in.length == 1)
    require(in(0).fieldType.dimensions == 2)
    require(!isColorField(in(0).fieldType))
    val expectedResultType = in(0).fieldType
    require(resultType == expectedResultType)
    val addressing = BigTensorAddressing
    new TensorDomainTransformRowsHyperKernel(in(0), operation, resultType, addressing)
  }
}


text:
package hudson.util;

import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.NoExternalUse;

import edu.umd.cs.findbugs.annotations.CheckForNull;
import edu.umd.cs.findbugs.annotations.NonNull;
import java.util.Arrays;
import java.util.concurrent.Callable;
import java.util.function.BiFunction;
import java.util.function.BiPredicate;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.stream.Stream;

/**
 * This class implements a process of doing some action repeatedly synchronously until it is performed successfully.
 * You can set the number of attempts, the action to perform, the milliseconds to wait for, the definition of success,
 * the exceptions that are considered as a failed action, but not an unexpected exception in the action and also the
 * listener to manage the expected exceptions happened, just in case it is helpful.
 * @param <V> The return type of the action to perform.
 */

// Limit the use of this class until it is mature enough
@Restricted(NoExternalUse.class)
public class Retrier <V>{
    private static final Logger LOGGER = Logger.getLogger(Retrier.class.getName());

    private int attempts;
    private long delay;
    private Callable<V> callable;
    private BiPredicate<Integer, V> checkResult;
    private String action;
    private BiFunction<Integer, Exception, V> duringActionExceptionListener;
    private Class<?>[] duringActionExceptions;

    private Retrier(Builder<V> builder){
        this.attempts = builder.attempts;
        this.delay = builder.delay;
        this.callable = builder.callable;
        this.checkResult = builder.checkResult;
        this.action = builder.action;
        this.duringActionExceptionListener = builder.duringActionExceptionListener;
        this.duringActionExceptions = builder.duringActionExceptions;
    }

    /**
     * Start to do retries to perform the set action.
     * @return the result of the action, it could be null if there was an exception or if the action itself returns null
     * @throws Exception If a unallowed exception is raised during the action
     */
    public @CheckForNull V start() throws Exception {
        V result = null;
        int currentAttempt = 0;
        boolean success = false;

        while (currentAttempt < attempts && !success) {
            currentAttempt++;
            try {
                if (LOGGER.isLoggable(Level.INFO)) {
                    LOGGER.log(Level.INFO, Messages.Retrier_Attempt(currentAttempt, action));
                }
                result = callable.call();

            } catch (Exception e) {
                if(duringActionExceptions == null || Stream.of(duringActionExceptions).noneMatch(exception -> exception.isAssignableFrom(e.getClass()))) {
                    // if the raised exception is not considered as a controlled exception doing the action, rethrow it
                    LOGGER.log(Level.WARNING, Messages.Retrier_ExceptionThrown(currentAttempt, action), e);
                    throw e;
                } else {
                    // if the exception is considered as a failed action, notify it to the listener
                    LOGGER.log(Level.INFO, Messages.Retrier_ExceptionFailed(currentAttempt, action), e);
                    if (duringActionExceptionListener != null) {
                        LOGGER.log(Level.INFO, Messages.Retrier_CallingListener(e.getLocalizedMessage(), currentAttempt, action));
                        result = duringActionExceptionListener.apply(currentAttempt, e);
                    }
                }
            }

            // After the call and the call to the listener, which can change the result, test the result
            success = checkResult.test(currentAttempt, result);
            if (!success) {
                if (currentAttempt < attempts) {
                    LOGGER.log(Level.WARNING, Messages.Retrier_AttemptFailed(currentAttempt, action));
                    LOGGER.log(Level.FINE, Messages.Retrier_Sleeping(delay, action));
                    try {
                        Thread.sleep(delay);
                    } catch (InterruptedException ie) {
                        LOGGER.log(Level.FINE, Messages.Retrier_Interruption(action));
                        Thread.currentThread().interrupt(); // flag this thread as interrupted
                        currentAttempt = attempts; // finish
                    }
                } else {
                    // Failed to perform the action
                    LOGGER.log(Level.INFO, Messages.Retrier_NoSuccess(action, attempts));
                }
            } else {
                LOGGER.log(Level.INFO, Messages.Retrier_Success(action, currentAttempt));
            }
        }

        return result;
    }

    /**
     * Builder to create a Retrier object. The action to perform, the way of check whether is was
     * successful and the name of the action are required.
     * @param <V> The return type of the action to perform.
     */
    public static class Builder <V> {
        private Callable<V> callable;
        private String action;
        private BiPredicate<Integer, V> checkResult;

        private int attempts = 3;
        private long delay = 1000;
        private BiFunction<Integer, Exception, V> duringActionExceptionListener;
        private Class<?>[] duringActionExceptions;

        /**
         * Set the number of attempts trying to perform the action.
         * @param attempts number of attempts
         * @return this builder
         */
        public @NonNull Builder<V> withAttempts(int attempts) {
            this.attempts = attempts;
            return this;
        }

        /**
         * Set the time in milliseconds to wait for the next attempt.
         * @param millis milliseconds to wait
         * @return this builder
         */
        public @NonNull Builder<V> withDelay(long millis) {
            this.delay = millis;
            return this;
        }

        /**
         * Set all the exceptions that are allowed and indicate that the action was failed. When an exception of this
         * type or a child type is raised, a listener can be called ({@link #withDuringActionExceptionListener(BiFunction)}).
         * In any case, the retrier continues its process, retrying to perform the action again, as it was a normal failure.
         * @param exceptions exceptions that indicate that the action was failed.
         * @return this builder
         */
        public @NonNull Builder<V> withDuringActionExceptions(@CheckForNull Class<?>[] exceptions) {
            this.duringActionExceptions = exceptions != null ? Arrays.copyOf(exceptions, exceptions.length) : null;
            return this;
        }

        /**
         * Set the listener to be executed when an allowed exception is raised when performing the action. The listener
         * could even change the result of the action if needed.
         * @param exceptionListener the listener to call to
         * @return this builder
         */
        public @NonNull Builder<V> withDuringActionExceptionListener(@NonNull BiFunction<Integer, Exception, V>  exceptionListener) {
            this.duringActionExceptionListener = exceptionListener;
            return this;
        }

        /**
         * Constructor of the builder with the required parameters.
         * @param callable Action to perform
         * @param checkResult Method to check if the result of the action was a success
         * @param action name of the action to perform, for messages purposes.
         */

        public Builder(@NonNull Callable<V> callable, @NonNull BiPredicate<Integer, V> checkResult, @NonNull String action) {
            this.callable = callable;
            this.action = action;
            this.checkResult = checkResult;
        }

        /**
         * Create a Retrier object with the specification set in this builder.
         * @return the retrier
         */
        public @NonNull Retrier<V> build() {
            return new Retrier<>(this);
        }
    }
}


text:
package frmr.scyig.webapp.snippet
package admin

import frmr.scyig.db._
import frmr.scyig.webapp.auth.AuthenticationHelpers._
import frmr.scyig.webapp.snippet.SnippetHelpers._
import net.liftweb.common._
import net.liftweb.common.BoxLogging._
import net.liftweb.http._
import net.liftweb.http.js._
import net.liftweb.http.js.JsCmds._
import net.liftweb.sitemap._
import net.liftweb.sitemap.Loc._
import net.liftweb.util._
import net.liftweb.util.Helpers._
import slick.jdbc.MySQLProfile.api._

object UserForm {
  import SnippetHelpers._

  val createMenu = Menu.i("Create User") / "admin" / "users" / "create" >>
    validateSuperuser >>
    TemplateBox( () => Templates("admin" :: "users" :: "form" :: Nil) )

  val editMenu = Menu.param[User](
    "Edit User",
    "Edit User",
    idToUser,
    _.id.getOrElse("").toString
  ) / "admin" / "users" / "edit" / * >>
    validateSuperuser >>
    TemplateBox( () => Templates("admin" :: "users" :: "form" :: Nil) )
}

class UserForm(user: User) {
  def this() = this(User(None, "", "", "", false))

  var currentUser = user
  var specifiedSponsorIds = Seq[Int]()

  private[this] def setSponsorsForCreatedOrUpdatedUser(createdUserId: Option[Int]) = {
    createdUserId match {
      case Some(newUserId) =>
        specifiedSponsorIds.map { sponsorId =>
          UsersSponsors += ("", newUserId, sponsorId)
        }

      case None =>
        user.setSponsors(specifiedSponsorIds)
    }
  }

  private[this] def saveUser(): JsCmd = {
    if (currentUser.id.isDefined || currentUser.passwordHash.nonEmpty) {
      DB.runAwait((Users returning Users.map(_.id)).insertOrUpdate(currentUser))
        .map(createdUserId => setSponsorsForCreatedOrUpdatedUser(createdUserId))
        .map(_ => RedirectTo(UserList.menu.loc.calcDefaultHref, () => S.notice("User was saved")))
        .logEmptyBox("Failed to save user")
        .openOr(Alert("Failed to save user. Please see log."))
    } else {
      S.error("New users are requied to have a password.")
    }
  }

  private[this] def setUserPassword(newPassword: String) = {
    Option(newPassword).filter(_.nonEmpty) match {
      case Some(newPassword) =>
        currentUser = currentUser.copy(passwordHash = Users.hashpw(newPassword))

      case _ =>
    }
  }

  private[this] def setSuperuserStatus(status: Box[Boolean]) = {
    val newStatus = status.openOr(false)
    currentUser = currentUser.copy(superuser = newStatus)
  }

  def render = {
    val superuserStatuses = Seq(
      ("#enabled-superuser-status" -> true),
      ("#disabled-superuser-status" -> false)
    )

    val sponsors = {
      DB.runAwait(Sponsors.to[Seq].result)
        .logFailure("Couldn't get sponsors")
        .openOr(Seq())
    }

    val sponsorOptions = {
      for {
        sponsor <- sponsors
        sponsorId <- sponsor.id
      } yield {
        SHtml.SelectableOption(sponsorId, sponsor.name)
      }
    }

    SHtml.makeFormsAjax andThen
    "#user-name" #> SHtml.text(user.name, v => currentUser = currentUser.copy(name = v)) &
    "#user-email" #> SHtml.text(user.email, v => currentUser = currentUser.copy(email = v)) &
    "#user-new-password" #> SHtml.password("", setUserPassword) &
    SHtml.radioCssSel[Boolean](Full(user.superuser), setSuperuserStatus _)(superuserStatuses: _*) &
    "#sponsors" #> SHtml.multiSelectObj[Int](sponsorOptions, user.sponsorIds, specifiedSponsorIds = _) &
    ".save" #> SHtml.ajaxOnSubmit(saveUser _)
  }
}


text: Rails.application.config.session_store :cookie_store, key: '_gentelella_on_rails_session'


text:
try {
   var autobahn = require('autobahn');
} catch (e) {
   // when running in browser, AutobahnJS will
   // be included without a module system
}

var connection = new autobahn.Connection({
   url: 'ws://127.0.0.1:8080/ws',
   realm: 'realm1'}
);

connection.onopen = function (session) {

   function on_heartbeat(args, kwargs, details) {
      console.log("Got heartbeat (publication ID " + details.publication + ")");
   }

   session.subscribe('com.myapp.heartbeat', on_heartbeat);

   function on_topic2(args, kwargs) {
      console.log("Got event:", args, kwargs);
   }

   session.subscribe('com.myapp.topic2', on_topic2);

   setTimeout(function () {
      console.log("Closing ..");
      connection.close();
   }, 5000);
};

connection.open();


text:
package com.pivotal.gemfirexd.app.tpce.jpa.ejb;

import javax.ejb.Local;

import com.pivotal.gemfirexd.app.tpce.TPCETxnInterface;

@Local
public interface EjbBrokerVolumeLocal extends TPCETxnInterface {
}


text:
package org.apache.helix.provisioning.yarn;

import java.util.HashMap;
import java.util.Map;

import org.apache.hadoop.yarn.api.ApplicationConstants.Environment;
import org.apache.log4j.Logger;

/**
 * Convenient method to pass information to containers
 * The methods simply sets up environment variables
 */
public class AppMasterConfig {
  private static Logger LOG = Logger.getLogger(AppMasterConfig.class);
  private Map<String, String> _envs;

  public enum AppEnvironment {
    APP_MASTER_PKG("APP_MASTER_PKG"),
    APP_SPEC_FILE("APP_SPEC_FILE"),
    APP_NAME("APP_NAME"),
    APP_ID("APP_ID"),
    APP_SPEC_FACTORY("APP_SPEC_FACTORY"),
    TASK_CONFIG_FILE("TASK_CONFIG_FILE");
    String _name;

    private AppEnvironment(String name) {
      _name = name;
    }

    public String toString() {
      return _name;
    }
  }

  public AppMasterConfig() {
    _envs = new HashMap<String, String>();
  }

  private String get(String key) {
    String value = (_envs.containsKey(key)) ? _envs.get(key) : System.getenv().get(key);
    LOG.info("Returning value:" + value + " for key:'" + key + "'");

    return value;
  }

  public void setAppId(int id) {
    _envs.put(AppEnvironment.APP_ID.toString(), "" + id);
  }

  public String getAppName() {
    return get(AppEnvironment.APP_NAME.toString());
  }

  public int getAppId() {
    return Integer.parseInt(get(AppEnvironment.APP_ID.toString()));
  }

  public String getClassPath(String serviceName) {
    return get(serviceName + "_classpath");
  }

  public String getMainClass(String serviceName) {
    return get(serviceName + "_mainClass");
  }

  public String getZKAddress() {
    return get(Environment.NM_HOST.name()) + ":2181";
  }

  public String getContainerId() {
    return get(Environment.CONTAINER_ID.name());
  }

  public Map<String, String> getEnv() {
    return _envs;
  }

  public void setAppName(String appName) {
    _envs.put(AppEnvironment.APP_NAME.toString(), appName);

  }

  public void setClasspath(String serviceName, String classpath) {
    _envs.put(serviceName + "_classpath", classpath);
  }

  public void setTaskConfigFile(String configName, String path) {
    _envs.put(AppEnvironment.TASK_CONFIG_FILE.toString() + "_" + configName, path);
  }

  public String getTaskConfigFile(String configName) {
    return get(AppEnvironment.TASK_CONFIG_FILE.toString() + "_" + configName);
  }

  public String getApplicationSpecConfigFile() {
    return get(AppEnvironment.APP_SPEC_FILE.toString());
  }

  public String getApplicationSpecFactory() {
    return get(AppEnvironment.APP_SPEC_FACTORY.toString());
  }

  public void setApplicationSpecFactory(String className) {
    _envs.put(AppEnvironment.APP_SPEC_FACTORY.toString(), className);

  }

  public void setMainClass(String serviceName, String serviceMainClass) {
    _envs.put(serviceName + "_mainClass", serviceMainClass);
  }
}