text:
module Funky
  # @api private
  module HTML
    class Page
      def get(video_id:)
        body = response_for(video_id).body

        if body.include? '<title id="pageTitle">Facebook</title>'
          raise ContentNotFound, 'Please double check the ID and try again.'
        else
          body
        end
      end

    private

      def response_for(video_id)
        uri = uri_for video_id
        request = Net::HTTP::Get.new(uri.request_uri)
        response = Net::HTTP.start(uri.host, 443, use_ssl: true) do |http|
          http.request request
        end
        if response.is_a? Net::HTTPRedirection
          request = Net::HTTP::Get.new URI.parse(URI.encode(response.header['location']))
          response = Net::HTTP.start(uri.host, 443, use_ssl: true) do |http|
            http.request request
          end
        end
        response
      rescue *server_errors => e
        raise ConnectionError, e.message
      end

      def uri_for(video_id)
        URI::HTTPS.build host:  'www.facebook.com',
                         path:  '/video.php',
                         query: "v=#{video_id}&locale=en_US"
      end

      def server_errors
        [
          OpenSSL::SSL::SSLError,
          Errno::ETIMEDOUT,
          Errno::EHOSTUNREACH,
          Errno::ENETUNREACH,
          Errno::ECONNRESET,
          Net::OpenTimeout,
          SocketError
        ]
      end
    end
  end
end


text:
package com.github.aureliano.edocs.domain.dao;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.List;

import org.junit.Before;
import org.junit.Test;

import com.github.aureliano.edocs.common.exception.ValidationException;
import com.github.aureliano.edocs.common.message.ContextMessage;
import com.github.aureliano.edocs.common.message.SeverityLevel;
import com.github.aureliano.edocs.common.persistence.DataPagination;
import com.github.aureliano.edocs.common.persistence.IDao;
import com.github.aureliano.edocs.common.persistence.IPersistenceManager;
import com.github.aureliano.edocs.common.persistence.PersistenceService;
import com.github.aureliano.edocs.domain.entity.Attachment;
import com.github.aureliano.edocs.domain.entity.Category;
import com.github.aureliano.edocs.domain.entity.Document;
import com.github.aureliano.edocs.domain.helper.DomainPersistenceManager;
import com.github.aureliano.edocs.domain.helper.PersistenceHelper;

public class AttachmentDaoTest {

	private IDao<Attachment> dao;

	public AttachmentDaoTest() {
		PersistenceHelper.instance().prepareDatabase();

		PersistenceService ps = PersistenceService.instance();
		if (ps.getPersistenceManager() == null) {
			DomainPersistenceManager pm = new DomainPersistenceManager();
			pm.setConnection(PersistenceHelper.instance().getConnection());
			PersistenceService.instance().registerPersistenceManager(pm);
		}

		this.dao = new AttachmentDao();
	}

	@Before
	public void beforeTest() throws SQLException {
		PersistenceHelper.instance().deleteAllRecords();;
	}

	@Test
	public void testValidateSaveAction() {
		this.checkInvalidName();
		this.checkInvalidUploadTime();
		this.checkInvalidTemp();
	}

	@Test
	public void testSave() {
		Attachment a = new Attachment()
			.withDocument(this.getValidDocument())
			.withName(this.getValidName())
			.withTemp(false)
			.withUploadTime(this.getToday());

		Attachment attachment = this.dao.save(a);
		assertNotNull(attachment.getId());
		assertEquals(a.getName(), attachment.getName());
		assertEquals(a.getDocument().getId(), attachment.getDocument().getId());
		assertEquals(a.getUploadTime(), attachment.getUploadTime());
	}

	@Test
	public void testDeleteByEntity() throws SQLException {
		String name = "delete-by-entity";
		Attachment a = new Attachment()
				.withDocument(this.getValidDocument())
				.withName(name)
				.withTemp(false)
				.withUploadTime(this.getToday());

		Attachment attachment = this.dao.save(a);

		ResultSet rs = PersistenceHelper.instance().executeQuery("select count(id) from attachments where name = '" + name + "'");
		rs.next();
		assertEquals(1, rs.getInt(1));
		rs.close();

		this.dao.delete(attachment);

		rs = PersistenceHelper.instance().executeQuery("select count(id) from attachments where name = '" + name + "'");
		rs.next();
		assertEquals(0, rs.getInt(1));
		rs.close();
	}

	@Test
	public void testDeleteById() throws SQLException {
		String name = "delete-by-id";
		Attachment a = new Attachment()
				.withDocument(this.getValidDocument())
				.withName(name)
				.withTemp(false)
				.withUploadTime(this.getToday());

		Attachment attachment = this.dao.save(a);

		ResultSet rs = PersistenceHelper.instance().executeQuery("select count(id) from attachments where name = '" + name + "'");
		rs.next();
		assertEquals(1, rs.getInt(1));
		rs.close();

		this.dao.delete(attachment.getId());

		rs = PersistenceHelper.instance().executeQuery("select count(id) from attachments where name = '" + name + "'");
		rs.next();
		assertEquals(0, rs.getInt(1));
		rs.close();
	}

	@Test
	public void testFind() {
		Attachment a = new Attachment()
			.withDocument(this.getValidDocument())
			.withName(this.getValidName())
			.withTemp(false)
			.withUploadTime(this.getToday());

		Attachment attachment1 = this.dao.save(a);
		Attachment attachment2 = this.dao.find(attachment1.getId());

		assertEquals(attachment1, attachment2);
	}

	@Test
	public void testSearchByEntity() {
		Attachment a = new Attachment()
			.withDocument(this.getValidDocument())
			.withName(this.getValidName())
			.withTemp(false)
			.withUploadTime(this.getToday());

		Attachment attachment1 = this.dao.save(a);
		this.dao.save(new Attachment()
			.withDocument(this.getValidDocument())
			.withName("different-one")
			.withTemp(false)
			.withUploadTime(this.getToday()));

		List<Attachment> data = this.dao.search(new DataPagination<Attachment>().withEntity(a));

		assertEquals(1, data.size());

		Attachment attachment2 = data.get(0);
		assertEquals(attachment1, attachment2);
	}

	@Test
	public void testSearchByQuery() {
		Attachment a = new Attachment()
			.withDocument(this.getValidDocument())
			.withName(this.getValidName())
			.withTemp(false)
			.withUploadTime(this.getToday());

		Attachment attachment1 = this.dao.save(a);
		this.dao.save(new Attachment()
			.withDocument(this.getValidDocument())
			.withName("different-one")
			.withTemp(false)
			.withUploadTime(this.getToday()));

		List<Attachment> data = this.dao.search("select * from attachments where name = '" + this.getValidName() + "'");

		assertEquals(1, data.size());

		Attachment attachment2 = data.get(0);
		assertEquals(attachment1, attachment2);
	}

	private void checkInvalidName() {
		Attachment a = new Attachment()
			.withDocument(new Document())
			.withTemp(false)
			.withUploadTime(new Date());
		this.validateContextMessage(a, "Expected to find a not empty text for field name.");

		a.withName("1");
		this.validateContextMessage(a, "Expected field name to have size between 5 and 250 but got 1.");

		a.withName(this.getValidName() + "1");
		this.validateContextMessage(a, "Expected field name to have size between 5 and 250 but got 251.");
	}

	private void checkInvalidUploadTime() {
		Attachment a = new Attachment()
			.withName(this.getValidName())
			.withTemp(false)
			.withDocument(new Document());
		this.validateContextMessage(a, "Expected to find a not null value for field uploadTime.");
	}

	private void checkInvalidTemp() {
		Attachment a = new Attachment()
			.withName(this.getValidName())
			.withUploadTime(new Date())
			.withDocument(new Document());
		this.validateContextMessage(a, "Expected to find a not null value for field temp.");
	}

	private void validateContextMessage(Attachment attachment, String message) {
		IPersistenceManager pm = PersistenceService.instance().getPersistenceManager();
		pm.clearContextMessages();

		try {
			this.dao.save(attachment);
		} catch (ValidationException ex) {
			assertEquals(1, pm.getContextMessages().size());

			ContextMessage m = pm.getContextMessages().iterator().next();
			assertEquals(SeverityLevel.ERROR, m.getSeverityLevel());
			assertEquals(message, m.getMessage());
		}
	}

	private Document getValidDocument() {
		Document d = new Document()
			.withName(this.getValidName())
			.withCategory(Category.AGREEMENT)
			.withDescription("description")
			.withDeleted(false)
			.withAttachments(Arrays.asList(new Attachment()));
		return new DocumentDao().save(d);
	}

	private String getValidName() {
		StringBuilder d = new StringBuilder();
		for (short i = 0; i < 200; i++) {
			d.append(".");
		}

		return d.toString();
	}

	private Date getToday() {
		Calendar c = Calendar.getInstance();
		c.set(Calendar.HOUR_OF_DAY, 0);
		c.set(Calendar.MINUTE, 0);
		c.set(Calendar.SECOND, 0);
		c.set(Calendar.MILLISECOND, 0);

		return c.getTime();
	}
}

redpajama_set_name: RedPajamaGithub


text:
.pos .popup-selection .exit {
    position: absolute;
    right: 0px;
    top: 0;
    padding: 15px;
    cursor: pointer;
    font-size: 30px;
}
.pos .modal-dialog.block {
    background-color: rgba(85, 0, 0, 0.5);
    cursor: pointer;
}
.pos .modal-dialog.block .popup-selection {
    background-color: initial;
    box-shadow: none;
    height: 250px;
    color: black;
    font-size: 65px;
}
.pos .modal-dialog.block .popup-selection p {
    margin: 0;
}
.pos .modal-dialog.block .popup-selection i {
    font-size: 150px;
}


text:
"""Compatibility module containing deprecated names.

"""
from __future__ import division, absolute_import, print_function

import sys
import copy
import pickle
from pickle import dump, dumps

import numpy.core.multiarray as multiarray
import numpy.core.umath as um
from numpy.core.numeric import array
from . import functions

__all__ = ['NewAxis',
           'UFuncType', 'UfuncType', 'ArrayType', 'arraytype',
           'LittleEndian', 'arrayrange', 'matrixmultiply',
           'array_constructor', 'pickle_array',
           'DumpArray', 'LoadArray', 'multiarray',
           # from cPickle
           'dump', 'dumps', 'load', 'loads',
           'Unpickler', 'Pickler'
          ]

mu = multiarray

#Use this to add a new axis to an array
#compatibility only
NewAxis = None

#deprecated
UFuncType = type(um.sin)
UfuncType = type(um.sin)
ArrayType = mu.ndarray
arraytype = mu.ndarray

LittleEndian = (sys.byteorder == 'little')

from numpy import deprecate

# backward compatibility
arrayrange = deprecate(functions.arange, 'arrayrange', 'arange')

# deprecated names
matrixmultiply = deprecate(mu.dot, 'matrixmultiply', 'dot')

def DumpArray(m, fp):
    m.dump(fp)

def LoadArray(fp):
    return pickle.load(fp)

def array_constructor(shape, typecode, thestr, Endian=LittleEndian):
    if typecode == "O":
        x = array(thestr, "O")
    else:
        x = mu.fromstring(thestr, typecode)
    x.shape = shape
    if LittleEndian != Endian:
        return x.byteswap(True)
    else:
        return x

def pickle_array(a):
    if a.dtype.hasobject:
        return (array_constructor,
                a.shape, a.dtype.char, a.tolist(), LittleEndian)
    else:
        return (array_constructor,
                (a.shape, a.dtype.char, a.tostring(), LittleEndian))

def loads(astr):
    arr = pickle.loads(astr.replace('Numeric', 'numpy.oldnumeric'))
    return arr

def load(fp):
    return loads(fp.read())

def _LoadArray(fp):
    from . import typeconv
    ln = fp.readline().split()
    if ln[0][0] == 'A': ln[0] = ln[0][1:]
    typecode = ln[0][0]
    endian = ln[0][1]
    itemsize = int(ln[0][2:])
    shape = [int(x) for x in ln[1:]]
    sz = itemsize
    for val in shape:
        sz *= val
    dstr = fp.read(sz)
    m = mu.fromstring(dstr, typeconv.convtypecode(typecode))
    m.shape = shape

    if (LittleEndian and endian == 'B') or (not LittleEndian and endian == 'L'):
        return m.byteswap(True)
    else:
        return m

if sys.version_info[0] >= 3:
    class Unpickler(pickle.Unpickler):
        # XXX: should we implement this? It's not completely straightforward
        #      to do.
        def __init__(self, *a, **kw):
            raise NotImplementedError(
                "numpy.oldnumeric.Unpickler is not supported on Python 3")
else:
    class Unpickler(pickle.Unpickler):
        def load_array(self):
            self.stack.append(_LoadArray(self))

        dispatch = copy.copy(pickle.Unpickler.dispatch)
        dispatch['A'] = load_array

class Pickler(pickle.Pickler):
    def __init__(self, *args, **kwds):
        raise NotImplementedError("Don't pickle new arrays with this")
    def save_array(self, object):
        raise NotImplementedError("Don't pickle new arrays with this")


text:
package com.zimbra.cs.taglib.tag.calendar;

import com.zimbra.common.service.ServiceException;
import com.zimbra.cs.taglib.bean.ZFileUploaderBean;
import com.zimbra.cs.taglib.tag.ZimbraSimpleTag;
import com.zimbra.client.ZMailbox;
import com.zimbra.client.ZMailbox.ZImportAppointmentsResult;

import javax.servlet.jsp.JspContext;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspTagException;
import javax.servlet.jsp.PageContext;
import java.io.IOException;

public class ImportAppointmentsTag extends ZimbraSimpleTag {

    private String mVar;
    private String mFolderId;
    private String mType = ZMailbox.APPOINTMENT_IMPORT_TYPE_ICS;
    private ZFileUploaderBean mUploader;

    public void setUploader(ZFileUploaderBean uploader) { mUploader = uploader; }

    public void setVar(String var) { mVar = var; }
    public void setFolderid(String folderid) { mFolderId = folderid; }
    public void setType(String type) { mType = type; }

    public void doTag() throws JspException, IOException {
        JspContext jctxt = getJspContext();
        try {
            ZMailbox mbox = getMailbox();
            String attachmentId = mUploader.getUploadId(mbox);
            if (attachmentId != null) {
                ZImportAppointmentsResult result = mbox.importAppointments(mFolderId, mType, attachmentId);
                jctxt.setAttribute(mVar, result, PageContext.PAGE_SCOPE);
            }
        } catch (ServiceException e) {
            throw new JspTagException(e.getMessage(), e);
        }
    }
}


text:
package im.actor.core.api.rpc;
/*
 *  Generated by the Actor API Scheme generator.  DO NOT EDIT!
 */

import im.actor.runtime.bser.*;
import im.actor.runtime.collections.*;
import static im.actor.runtime.bser.Utils.*;
import im.actor.core.network.parser.*;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.NotNull;
import com.google.j2objc.annotations.ObjectiveCName;
import java.io.IOException;
import java.util.List;
import java.util.ArrayList;
import im.actor.core.api.*;

public class RequestNotifyAboutDeviceInfo extends Request<ResponseVoid> {

    public static final int HEADER = 0xe5;
    public static RequestNotifyAboutDeviceInfo fromBytes(byte[] data) throws IOException {
        return Bser.parse(new RequestNotifyAboutDeviceInfo(), data);
    }

    private List<String> preferredLanguages;
    private String timeZone;

    public RequestNotifyAboutDeviceInfo(@NotNull List<String> preferredLanguages, @Nullable String timeZone) {
        this.preferredLanguages = preferredLanguages;
        this.timeZone = timeZone;
    }

    public RequestNotifyAboutDeviceInfo() {

    }

    @NotNull
    public List<String> getPreferredLanguages() {
        return this.preferredLanguages;
    }

    @Nullable
    public String getTimeZone() {
        return this.timeZone;
    }

    @Override
    public void parse(BserValues values) throws IOException {
        this.preferredLanguages = values.getRepeatedString(1);
        this.timeZone = values.optString(2);
    }

    @Override
    public void serialize(BserWriter writer) throws IOException {
        writer.writeRepeatedString(1, this.preferredLanguages);
        if (this.timeZone != null) {
            writer.writeString(2, this.timeZone);
        }
    }

    @Override
    public String toString() {
        String res = "rpc NotifyAboutDeviceInfo{";
        res += "preferredLanguages=" + this.preferredLanguages;
        res += ", timeZone=" + this.timeZone;
        res += "}";
        return res;
    }

    @Override
    public int getHeaderKey() {
        return HEADER;
    }
}


text:
using System;

namespace Eos.DataStructures
{
    /// <summary>
    /// Lightweight support for lazy initialization within a method that avoids the GC on LazySlim if not created.
    /// </summary>
    /// <typeparam name="T">Specifies the type of object that is being lazily initialized.</typeparam>
    public struct LazySlim<T>
        where T : class
    {
        private readonly Func<T> _valueFactory;
        private T _value;
        private bool _isValueCreated;

        public LazySlim(Func<T> valueFactory)
        {
            if (valueFactory == null)
            {
                throw new ArgumentNullException("valueFactory");
            }

            _valueFactory = valueFactory;
            _value = default(T);
            _isValueCreated = false;
        }

        public T Value
        {
            get
            {
                return GetValue();
            }
        }

        public bool IsValueCreated
        {
            get
            {
                return _isValueCreated;
            }
        }

        private T GetValue()
        {
            return _value ?? CreateValue();
        }

        private T CreateValue()
        {
            if (_valueFactory != null)
            {
                try
                {
                    _value = _valueFactory();
                    _isValueCreated = true;

                    return _value;
                }
                catch (Exception ex)
                {
                    throw new LazySlimDynamicInitializationException(typeof(T), ex);
                }
            }

            try
            {
                _value = (T)Activator.CreateInstance(typeof(T));
                _isValueCreated = true;

                return _value;
            }
            catch (MissingMethodException ex)
            {
                throw new LazySlimDynamicInitializationException(typeof(T), ex);
            }
        }
    }
}


text:
package test

type typeWithStructImpl struct {
	_        typeWithStruct `knex-provide:"resource"`
	MyStruct *ThirdPartyStruct
}

// Inject injects required dependencies
func (t *typeWithStructImpl) Inject(myStruct *ThirdPartyStruct) {
	t.MyStruct = myStruct
}


text:
import React from 'react'
import { Label } from 'react-bootstrap'

const People = React.createClass({
  render() {
    const votedPeople = this.props.people.map(p => {p})
    return (

          {votedPeople}
          Total people voted: {this.props.people.length}

    )
  }
})

export default People


text:
/**
 *  index.js 路由选择规则
 *  @author: JY
 *  @since: 2013-03-02
 */
var user = require('../controllers/user')
  , index = require('../controllers/index')
  , login = require('../controllers/login')
  , topic = require('../controllers/topic')
  , comment = require('../controllers/comment')
  , about  = require('../controllers/about');

module.exports = function (app) {

    app.get('/', topic.list);
    app.get('/index', topic.list);
    app.post('/', topic.list);
    app.get('/topic/category/:id', topic.list);

    app.get('/signup', login.reg);
    app.post('/signup', login.register);
    app.get('/signup/active/:active', login.active);

    app.get('/login', login.index);
    app.post('/login', login.login);
    app.get('/logout', login.logout);

    app.get('/forgot_password', login.forgot);
    app.post('/forgot_password', login.sendmail);

    app.get('/password/reset/:active', login.resetpwd);
    app.post('/password/reset/:active', login.updatepwd);

    app.get('/topic/create', topic.index);
    app.post('/topic/create', topic.create);
    app.get('/topic/:page?', topic.list);
    app.get('/topic/detail/:id', topic.detail);
    app.get('/topic/remove/:id', topic.remove);
    app.get('/topic/list/:id', topic.userlist);

    app.post('/comment/create', comment.create);

    app.get('/user/setting', user.setting);
    app.post('/user/profile', user.profile);

    app.get('/about', about.index);

    app.get('/image', user.readImage);
}


text:
#include <mitsuba/core/statistics.h>
#include <mitsuba/bidir/mut_caustic.h>

MTS_NAMESPACE_BEGIN

static StatsCounter statsAccepted("Caustic perturbation",
		"Acceptance rate", EPercentage);
static StatsCounter statsGenerated("Caustic perturbation",
		"Successful generation rate", EPercentage);

CausticPerturbation::CausticPerturbation(const Scene *scene, Sampler *sampler,
		MemoryPool &pool, Float minJump, Float coveredArea) :
	m_scene(scene), m_sampler(sampler), m_pool(pool) {

	if (!scene->getSensor()->getClass()->derivesFrom(MTS_CLASS(PerspectiveCamera)))
		Log(EError, "The caustic perturbation requires a perspective camera.");

	const PerspectiveCamera *camera = static_cast<const PerspectiveCamera *>(scene->getSensor());
	Vector2i filmSize = camera->getFilm()->getSize(),
	         cropSize = camera->getFilm()->getCropSize();

	/* Simple heuristic for choosing a jump size: assumes that each
	   pixel on the camera subtends the same area on the sphere */
	Float degPerPixel = std::min(
				camera->getXFov() / filmSize.x,
				camera->getYFov() / filmSize.y),
	      radPerPixel = degPerPixel * M_PI / 180.0f;

	Float r1 = minJump,
		  r2 = std::sqrt(coveredArea * cropSize.x*cropSize.y / M_PI); /* [Veach, p. 354] */

	/* These represent the *desired* angle change range as seen from the camera */
	m_theta1 = radPerPixel * r1;
	m_theta2 = radPerPixel * r2;
	m_logRatio = -math::fastlog(m_theta2 / m_theta1);
}

CausticPerturbation::~CausticPerturbation() { }

Mutator::EMutationType CausticPerturbation::getType() const {
	return ECausticPerturbation;
}

Float CausticPerturbation::suitability(const Path &path) const {
	int k = path.length(), m = k - 1, l = m - 1;

	if (k < 4 || !path.vertex(l)->isConnectable())
		return false;

	--l;
	while (l >= 0 && !path.vertex(l)->isConnectable())
		--l;

	return l >= 1 ? 1.0f : 0.0f;
}

bool CausticPerturbation::sampleMutation(
		Path &source, Path &proposal, MutationRecord &muRec, const MutationRecord& sourceMuRec) {
	int k = source.length(), m = k - 1, l = m - 1;

	if (k < 4 || !source.vertex(l)->isConnectable())
		return false;
	--l;

	while (l >= 0 && !source.vertex(l)->isConnectable())
		--l;

	if (l < 1)
		return false;

	muRec = MutationRecord(ECausticPerturbation, l, m, m-l,
		source.getPrefixSuffixWeight(l, m));
	statsAccepted.incrementBase();
	statsGenerated.incrementBase();

	/* Heuristic perturbation size computation (Veach, p.354) */
	Float lengthE = source.edge(m-1)->length;
	Float lengthL = 0;
	for (int i=l; i<m-1; ++i)
		lengthL += source.edge(i)->length;
	Float factor = lengthE/lengthL,
		theta1 = m_theta1 * factor,
		theta2 = m_theta2 * factor;

	Vector woSource = normalize(source.vertex(l+1)->getPosition()
			- source.vertex(l)->getPosition());
	Float phi = m_sampler->next1D() * 2 * M_PI;
	Float theta = theta2 * math::fastexp(m_logRatio * m_sampler->next1D());
	Vector wo = Frame(woSource).toWorld(sphericalDirection(theta, phi));

	/* Allocate memory for the proposed path */
	proposal.clear();
	proposal.append(source, 0, l+1);
	proposal.append(m_pool.allocEdge());
	for (int i=l+1; i<m; ++i) {
		proposal.append(m_pool.allocVertex());
		proposal.append(m_pool.allocEdge());
	}
	proposal.append(source, m, k+1);
	proposal.vertex(l) = proposal.vertex(l)->clone(m_pool);
	proposal.vertex(m) = proposal.vertex(m)->clone(m_pool);
	BDAssert(proposal.vertexCount() == source.vertexCount());
	BDAssert(proposal.edgeCount() == source.edgeCount());

	Float dist = source.edge(l)->length +
		perturbMediumDistance(m_sampler, source.vertex(l+1));

	/* Sample a perturbation and propagate it through specular interactions */
	if (!proposal.vertex(l)->perturbDirection(m_scene,
			proposal.vertex(l-1), proposal.edge(l-1),
			proposal.edge(l), proposal.vertex(l+1), wo, dist,
			source.vertex(l+1)->getType(), EImportance)) {
		proposal.release(l, m+1, m_pool);
		return false;
	}

	Vector woProposal = normalize(proposal.vertex(l+1)->getPosition()
			- source.vertex(l)->getPosition());
	theta = unitAngle(woSource, woProposal);
	if (theta >= theta2 || theta <= theta1) {
		proposal.release(l, m+1, m_pool);
		return false;
	}

	/* If necessary, propagate the perturbation through a sequence of
	   ideally specular interactions */
	for (int i=l+1; i<m-1; ++i) {
		Float dist = source.edge(i)->length +
			perturbMediumDistance(m_sampler, source.vertex(i+1));

		if (!proposal.vertex(i)->propagatePerturbation(m_scene,
				proposal.vertex(i-1), proposal.edge(i-1),
				proposal.edge(i), proposal.vertex(i+1),
				source.vertex(i)->getComponentType(), dist,
				source.vertex(i+1)->getType(), EImportance)) {
			proposal.release(l, m+1, m_pool);
			return false;
		}
	}

	if (!PathVertex::connect(m_scene,
			proposal.vertex(m-2),
			proposal.edge(m-2),
			proposal.vertex(m-1),
			proposal.edge(m-1),
			proposal.vertex(m),
			proposal.edge(m),
			proposal.vertex(m+1))) {
		proposal.release(l, m+1, m_pool);
		return false;
	}

	proposal.vertex(k-1)->updateSamplePosition(
		proposal.vertex(k-2));

	++statsGenerated;
	return true;
}

Float CausticPerturbation::Q(const Path &source, const Path &proposal,
		const MutationRecord &muRec) const {
	int m = muRec.m, l = muRec.l;

	/* Heuristic perturbation size computation (Veach, p.354) */
	Float lengthE = source.edge(m-1)->length;
	Float lengthL = 0;
	for (int i=l; i<m-1; ++i)
		lengthL += source.edge(i)->length;
	Float factor = lengthE/lengthL,
		theta1 = m_theta1 * factor,
		theta2 = m_theta2 * factor;

	Vector d1 = normalize(source.vertex(l+1)->getPosition()   - source.vertex(l)->getPosition());
	Vector d2 = normalize(proposal.vertex(l+1)->getPosition() - source.vertex(l)->getPosition());
	Float theta = unitAngle(d1, d2);
	if (theta >= theta2 || theta <= theta1)
		return 0.0f;

	Float solidAngleDensity = 1.0f / (2*M_PI * -m_logRatio * std::sin(theta) * theta);

	Spectrum weight = muRec.weight * proposal.edge(m-1)->evalCached(
		proposal.vertex(m-1), proposal.vertex(m), PathEdge::EEverything);

	for (int i=l; i<m-1; ++i) {
		const PathVertex *v0 = proposal.vertex(i),
			  *v1 = proposal.vertex(i+1);
		const PathEdge *edge = proposal.edge(i);

		weight *= edge->evalCached(v0, v1,
			PathEdge::ETransmittance | PathEdge::EValueCosineImp);

		if (v1->isMediumInteraction())
			weight /= pdfMediumPerturbation(source.vertex(i+1),
					source.edge(i), edge);
	}

	const Float lumWeight = weight.getLuminance();
	if(lumWeight <= RCPOVERFLOW)
		return 0.f;

	return solidAngleDensity / lumWeight;
}

void CausticPerturbation::accept(const MutationRecord &) {
	++statsAccepted;
}

MTS_IMPLEMENT_CLASS(CausticPerturbation, false, Mutator)
MTS_NAMESPACE_END


text:
interface FrameInfo {
  frames: { name: string; data: ArrayBuffer }[];
  videoId: number;
  workerId: number;
  width: number;
  height: number;
  startTime: number;
  end: boolean;
  size: number;
}

importScripts('visual_design_service_web_assembly_api.js');
const ctx: any = self;

let wait: number = 0;
let count: number = 0;
let frameInfoArray: FrameInfo[] = [];

/** Analyzes the input frames and output caculated crop windows for each frame*/
onmessage = function (e: MessageEvent): void {
  let frameInfo = e.data;
  console.log(`AUTOFLIP: check if the video(${frameInfo.videoId}) are expected`);
  count++;
  if (wait !== frameInfo.videoId) {
    console.log(`AUTOFLIP: video(${frameInfo.videoId}) is not as expected. wait ${wait}`);
    console.log(`AUTOFLIP: store video(${frameInfo.videoId}) in array`);
    frameInfoArray[frameInfo.videoId] = frameInfo;
    console.log(frameInfoArray[frameInfo.videoId]);
    if (frameInfo.size !== count) return;
  } else {
    console.log(`AUTOFLIP: video(${frameInfo.videoId}) can be processed as wait ${wait}`);
    handleFrames(frameInfo);
  }
  if (frameInfo.size === count) {
    while (wait < frameInfo.size) {
      frameInfo = frameInfoArray[wait];
      handleFrames(frameInfo);
    }
    const endStatus = ctx.Module.__finish();
    if (!endStatus.ok) {
      console.error('loopHandleFrames', endStatus);
      throw new Error('Mediapipe had an error!');
    }
    let shots = ctx.Module.__fetchBoundaries();
    if (!shots.ok) {
      console.error('loopHandleFrames', shots);
      throw new Error('Mediapipe had an error!');
    }
    let windows = ctx.Module.__fetchCropWindows();
    if (!windows.ok) {
      console.error('loopHandleFrames', windows);
      throw new Error('Mediapipe had an error!');
    }
    console.log(endStatus, shots, windows);
    let resultCropWindows = [];
    for (let i = 0; i < windows.value.size(); i++) {
      resultCropWindows.push(windows.value.get(i));
    }
    let resultShots = [];
    for (let i = 0; i < shots.value.size(); i++) {
      resultShots.push(shots.value.get(i));
    }
    // This posts the analysis result back to main script
    ctx.postMessage({
      type: 'finishedAnalysis',
      cropWindows: resultCropWindows,
      startTime: frameInfo.startTime,
      videoId: frameInfo.videoId,
      workerId: frameInfo.workerId,
      shots: resultShots,
    });
  }
};

/** Processes input frames with autoflip wasm*/
function handleFrames(frameInfo: FrameInfo): void {
  console.log(`AUTOFLIP: video (${frameInfo.videoId}) received from main`, frameInfo);

  const frames = frameInfo.frames;
  const info = { width: frameInfo.width, height: frameInfo.height };

  for (let i = 0; i < frames.length; i++) {
    const image = frames[i].data; // Array buffer from FFmpeg, .tiff <-
    // Saving array buffer to the wasm heap memory.
    const numBytes = image.byteLength;
    const ptr = ctx.Module._malloc(numBytes);
    const heapBytes = new Uint8Array(ctx.Module.HEAPU8.buffer, ptr, numBytes);
    const uint8Image = new Uint8Array(image);
    heapBytes.set(uint8Image);
    // end saving memory.
    // This is making a fake proto so that Autoflip can find the image.
    const proto = `[${ptr}, ${info.width}, ${info.height}, 16, ${numBytes}]`;
    const status = ctx.Module.__addYuvImageToBuffer(proto);
    // Do this to check if it saved correctly.
    if (!status.ok) {
      console.error(status);
      throw new Error('Autoflip had an error!');
    }
    // Finish.
    ctx.Module._free(heapBytes.byteOffset);
  }
  wait++;
}


text:
The dones module can be used to mark whether a key is "done" and check whether
a key has been marked "done".  Keys can also be unmarked, so that they are no
longer "done".  Also, all keys can be unmarked by clearing the Dones.
Keys are kept in their own namespace to avoid conflicts with other
sets of other keys and to make it easy to implement clearing.

Why?  I use `dones` to keep track of what I've already done.  More
specifically, I run large computations (a few million tasks) on a large cluster
(a few thousand cores) with a slow filesystem (Isilon).  When tasks inevitably
fail, perhaps because the network storage goes offline, or a computer dies, or
another user overwhelms the database with connections, I need to resubmit the
tasks to the batch queuing system (LSF) of the cluster that are not already
done.

The solution in this module fits my constraints.  It handles the concurrent
writes of a thousand jobs marking things done (not all at once).  It is
reasonably fast for reading and writing up to millions of jobs.  This is
important because or batch queue (LSF) only handles a few thousand jobs at a
time gracefully.  Finally, `dones` uses MySQL as a backend, which is important
because I cannot run a key-value server like Redis on the cluster I use.

## Contribute

Feel free to make a pull request on github.

## Testing

Awkwardly, `dones` is configured with a MySQL database url from the
environment, so to test it, you need to add a url.  For example:

    DONES_DB_URL=mysql://myuser:password@localhost/mydb nosetests

## Requirements

- Probably Python 2.7 (since that is the only version it has been tested with.)
- MySQL-python PyPI package.

## Installation

### Install from pypi.python.org

Download and install using pip:

    pip install dones

### Install from github.com

Using github, one can clone and install a specific version of the package:

    cd ~
    git clone git@github.com:todddeluca/dones.git
    cd dones
    python setup.py install

Or use pip:

    pip install git+git://github.com/todddeluca/dones.git#egg=dones

## Usage

    import dones

    if not dones.get('my_pipeline').done('task1'):
        dotask('task1')
        dones.get('my_pipleline').mark('task1')


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

Editing Form Records

How to view and edit records that have been submitted to a form created using the Form and List module.

Select  <![CDATA[ ]]> Show Records from the Form and List module actions menu.

Click the Edit <![CDATA[ ]]> button beside the record to be edited.

Edit the record as required.

Click the Update button. This displays the message "Your submission was successful."


text:
namespace ds {
	template<typename T>
	class Trie;

	template<typename T>
	class TrieNode {
	public:
		friend class Trie<T>;

	public:
		TrieNode() = default;
		TrieNode(const TrieNode&) = delete;
		TrieNode(TrieNode&&) = delete;
		~TrieNode() = default;
		TrieNode& operator=(const TrieNode&) = delete;
		TrieNode& operator=(TrieNode&&) = delete;

	private:
		std::unordered_map<T, std::shared_ptr<TrieNode>> children_;
		bool end_ = false;
	};

	template<typename T>
	class Trie {
	public:
		Trie() = default;
		Trie(const Trie&) = delete;
		Trie(Trie&&) = delete;
		Trie& operator=(const Trie&) = delete;
		Trie& operator=(Trie&&) = delete;
		void insert(const std::basic_string<T>& key);
		bool search(const std::basic_string<T>& key);
		bool remove(const std::basic_string<T>& key);
		std::vector<std::basic_string<T>> predict(const std::basic_string<T>& key);
		void clear();
		auto size() { return this->size_; }

	private:
		static std::vector<std::basic_string<T>> predict_helper(
			const std::pair<const T, std::shared_ptr<TrieNode<T>>>& map_entry);
		std::shared_ptr<TrieNode<T>> root_{ std::make_shared<TrieNode<T>>() };
		std::uintmax_t size_{ 0 };
	};

	template<typename T>
	void Trie<T>::insert(const std::basic_string<T>& key) {
		std::shared_ptr<TrieNode<T>> current{ root_ };
		for (const T& c : key) {
			if (current->children_.find(c) == current->children_.end())
				current->children_[c] = std::make_shared<TrieNode<T>>();
			current = current->children_[c];
		}
		if (!current->end_ && current != root_) {
			current->end_ = true;
			++this->size_;
		}
	}

	template<typename T>
	bool Trie<T>::search(const std::basic_string<T>& key) {
		std::shared_ptr<TrieNode<T>> current{ root_ };
		for (const T& c : key) {
			if (current->children_.empty()) return false;
			current = current->children_[c];
			if (!current) return false;
		}
		return current->end_;
	}

	template<typename T>
	bool Trie<T>::remove(const std::basic_string<T>& key) {
		std::shared_ptr<TrieNode<T>> current{ root_ };
		std::stack<std::shared_ptr<TrieNode<T>>> stack;
		stack.push(current);
		for (const T& c : key) {
			if (current->children_.empty()) return false;
			current = current->children_[c];
			if (!current) return false;
			stack.push(current);
		}
		// If No Prefix is matched or The prefix is not a Legit word.
		if (stack.size() <= 1 || !stack.top()->end_) return false;
		stack.top()->end_ = false;
		auto r_it = key.rbegin();
		// remove a Node Iteratively when it is not a word and it has no children.
		while (!stack.top()->end_ && stack.top()->children_.empty() &&
			r_it != key.rend()) {
			stack.pop();
			stack.top()->children_.erase(*r_it);
			++r_it;
		}
		--this->size_;
		return true;
	}

	template<typename T>
	void Trie<T>::clear() {
		this->root_->children_.clear();
		this->size_ = 0;
	}

	template<typename T>
	std::vector<std::basic_string<T>>
		Trie<T>::predict_helper(const std::pair<const T, std::shared_ptr<TrieNode<T>>>& map_entry) {
		std::vector<std::basic_string<T>> result;
		if (!map_entry.second->children_.empty()) {
			std::vector<std::vector<std::basic_string<T>>> result2d;
			std::transform(
				map_entry.second->children_.begin(), map_entry.second->children_.end(),
				std::back_inserter(result2d), ds::Trie<T>::predict_helper);
			std::for_each(result2d.begin(), result2d.end(),
				[&result](std::vector<std::basic_string<T>>& d) {
					std::move(d.begin(), d.end(), std::back_inserter(result));
				});
			std::for_each(result.begin(), result.end(),
				[&map_entry](std::basic_string<T>& d) {
					d.insert(0, &(map_entry.first), 1);
				});
		}

		// If the suffix ending at this node is a legit word by itself and also has
		// other children. Eg (cat, cattle) If Prefix = ca, Output should also
		// include cat & cattle.
		if (map_entry.second->end_) {
			std::basic_string<T> str(1, map_entry.first);
			result.push_back(str);
		}
		return result;
	}

	template<typename T>
	std::vector<std::basic_string<T>> Trie<T>::predict(const std::basic_string<T>& key) {
		std::shared_ptr<TrieNode<T>> current{ root_ };
		for (const T& c : key) {
			if (current->children_.empty()) return {};
			current = current->children_[c];
			if (!current) return {};
		}
		if (current->children_.empty()) return {};
		std::vector<std::basic_string<T>> result;
		std::vector<std::vector<std::basic_string<T>>> result2d;

		// Recursively return all the Legit Words of every direct child in this node
		// (i.e. a vector for every node & thus a 2D vector to collect all the
		// predicted Suffixes.
		std::transform(current->children_.begin(), current->children_.end(),
			std::back_inserter(result2d),
			ds::Trie<T>::predict_helper);

		// Flatten out the 2D-Array.
		std::for_each(result2d.begin(), result2d.end(),
			[&result](std::vector<std::basic_string<T>>& d) {
				std::move(d.begin(), d.end(), std::back_inserter(result));
			});

		// Append the input prefix to the found suffixes.
		std::for_each(result.begin(), result.end(),
			[&key](std::basic_string<T>& d) { d.insert(0, key); });

		return result;
	}

}


text:
fn main() {
    call_me(3);
}

fn call_me(num:i32) {
    for i in 0..num {
        println!("Ring! Call number {}", i + 1);
    }
}

// Rust requires that all parts of a function's signature have type annotations,
// but `call_me` is missing the type annotation of `num`.


text:
package com.rest4hub;

public class Configuration {
  private static ApiClient defaultApiClient = new ApiClient();

  /**
   * Get the default API client, which would be used when creating API
   * instances without providing an API client.
   */
  public static ApiClient getDefaultApiClient() {
    return defaultApiClient;
   }

  /**
   * Set the default API client, which would be used when creating API
   * instances without providing an API client.
   */
  public static void setDefaultApiClient(ApiClient apiClient) {
    defaultApiClient = apiClient;
  }
}


text:
==============================
Binary Functions and Operators
==============================

Binary Operators
----------------

The ``||`` operator performs concatenation.

Binary Functions
----------------

.. function:: length(binary) -> bigint
    :noindex:

    Returns the length of ``binary`` in bytes.

.. function:: concat(binary1, ..., binaryN) -> varbinary
    :noindex:

    Returns the concatenation of ``binary1``, ``binary2``, ``...``, ``binaryN``.
    This function provides the same functionality as the
    SQL-standard concatenation operator (``||``).

.. function:: substr(binary, start) -> varbinary
    :noindex:

    Returns the rest of ``binary`` from the starting position ``start``,
    measured in bytes. Positions start with ``1``. A negative starting position
    is interpreted as being relative to the end of the string.

.. function:: substr(binary, start, length) -> varbinary
    :noindex:

    Returns a substring from ``binary`` of length ``length`` from the starting
    position ``start``, measured in bytes. Positions start with ``1``. A
    negative starting position is interpreted as being relative to the end of
    the string.

.. function:: to_base64(binary) -> varchar

    Encodes ``binary`` into a base64 string representation.

.. function:: from_base64(string) -> varbinary

    Decodes binary data from the base64 encoded ``string``.

.. function:: to_base64url(binary) -> varchar

    Encodes ``binary`` into a base64 string representation using the URL safe alphabet.

.. function:: from_base64url(string) -> varbinary

    Decodes binary data from the base64 encoded ``string`` using the URL safe alphabet.

.. function:: to_hex(binary) -> varchar

    Encodes ``binary`` into a hex string representation.

.. function:: from_hex(string) -> varbinary

    Decodes binary data from the hex encoded ``string``.

.. function:: to_big_endian_64(bigint) -> varbinary

    Encodes ``bigint`` in a 64-bit 2's complement big endian format.

.. function:: from_big_endian_64(binary) -> bigint

    Decodes ``bigint`` value from a 64-bit 2's complement big endian ``binary``.

.. function:: to_big_endian_32(integer) -> varbinary

    Encodes ``integer`` in a 32-bit 2's complement big endian format.

.. function:: from_big_endian_32(binary) -> integer

    Decodes ``integer`` value from a 32-bit 2's complement big endian ``binary``.

.. function:: to_ieee754_32(real) -> varbinary

    Encodes ``real`` in a 32-bit big-endian binary according to IEEE 754 single-precision floating-point format.

.. function:: from_ieee754_32(binary) -> real

    Decodes the 32-bit big-endian ``binary`` in IEEE 754 single-precision floating-point format.

.. function:: to_ieee754_64(double) -> varbinary

    Encodes ``double`` in a 64-bit big-endian binary according to IEEE 754 double-precision floating-point format.

.. function:: from_ieee754_64(binary) -> double

    Decodes the 64-bit big-endian ``binary`` in IEEE 754 double-precision floating-point format.

.. function:: lpad(binary, size, padbinary) -> varbinary
    :noindex:

    Left pads ``binary`` to ``size`` bytes with ``padbinary``.
    If ``size`` is less than the length of ``binary``, the result is
    truncated to ``size`` characters. ``size`` must not be negative
    and ``padbinary`` must be non-empty.

.. function:: rpad(binary, size, padbinary) -> varbinary
    :noindex:

    Right pads ``binary`` to ``size`` bytes with ``padbinary``.
    If ``size`` is less than the length of ``binary``, the result is
    truncated to ``size`` characters. ``size`` must not be negative
    and ``padbinary`` must be non-empty.

.. function:: crc32(binary) -> bigint

    Computes the CRC-32 of ``binary``. For general purpose hashing, use
    :func:`xxhash64`, as it is much faster and produces a better quality hash.

.. function:: md5(binary) -> varbinary

    Computes the md5 hash of ``binary``.

.. function:: murmur3_x64_128(binary) -> varbinary

    Computes a hash of ``binary`` that is equivalent to C++ MurmurHash3_x64_128 (Murmur3F) of the same ``binary``.

.. function:: sha1(binary) -> varbinary

    Computes the sha1 hash of ``binary``.

.. function:: sha256(binary) -> varbinary

    Computes the sha256 hash of ``binary``.

.. function:: sha512(binary) -> varbinary

    Computes the sha512 hash of ``binary``.

.. function:: xxhash64(binary) -> varbinary

    Computes the xxhash64 hash of ``binary``.

.. function:: spooky_hash_v2_32(binary) -> varbinary

    Computes the 32-bit SpookyHashV2 hash of ``binary``.

.. function:: spooky_hash_v2_64(binary) -> varbinary

    Computes the 64-bit SpookyHashV2 hash of ``binary``.

.. function:: hmac_md5(binary, key) -> varbinary

    Computes HMAC with md5 of ``binary`` with the given ``key``.

.. function:: hmac_sha1(binary, key) -> varbinary

    Computes HMAC with sha1 of ``binary`` with the given ``key``.

.. function:: hmac_sha256(binary, key) -> varbinary

    Computes HMAC with sha256 of ``binary`` with the given ``key``.

.. function:: hmac_sha512(binary, key) -> varbinary

    Computes HMAC with sha512 of ``binary`` with the given ``key``.

.. function:: reverse(binary) -> varbinary
    :noindex:

    Returns ``binary`` with the bytes in reverse order.


text:
package com.dcjet.${ddata.solution.solutionName}.common;

public interface IFrontendSearch {
	public String getPage() ;

	public void setPage(String page);

	public String getRows() ;

	public void setRows(String rows) ;

	public String getSort() ;

	public void setSort(String sort) ;

	public String getOrder() ;

	public void setOrder(String order) ;

	public String getCallback() ;

	public void setCallback(String callback) ;
}


text:
package com.cookingfox.rxbus_eventbus;

/**
 * Operations for emitting events.
 */
public interface RxBusEmitter {

    /**
     * Alias for {@link #emit(Object)}.
     *
     * @see #emit(Object)
     */
    <T> void dispatch(T event);

    /**
     * Emit an event object to all observers.
     *
     * @param event The event.
     */
    <T> void emit(T event);

    /**
     * Alias for {@link #emit(Object)}.
     *
     * @see #emit(Object)
     */
    <T> void post(T event);

}


text:
<?php

namespace Dmcs\NotesManagerBundle\Entity;

use Doctrine\ORM\EntityRepository;

/**
 * NoteRepository
 *
 * This class was generated by the Doctrine ORM. Add your own custom
 * repository methods below.
 */
class NoteRepository extends EntityRepository
{

}


text:
import sublime_plugin

class ShowResponseCommand(sublime_plugin.WindowCommand):
    default_syntax = 'Packages/JavaScript/JSON.tmLanguage'

    def run(self, title="", text=""):
        request_view = self.window.active_view()
        request_view_group, request_view_index = \
            self.window.get_view_index(request_view)

        self.window.run_command('set_layout', {
            'cols':  [0.0, 0.5, 1.0],
            'rows':  [0.0, 1.0],
            'cells': [[0, 0, 1, 1], [1, 0, 2, 1]]
         })

        self.window.set_view_index(
            request_view, request_view_group,
            request_view_index)

        self.window.focus_group(1)

        panel = self.window.new_file()
        panel.set_name('RESPONSE: {}'.format(title))
        panel.set_scratch(True)
        panel.set_syntax_file(self.default_syntax)
        panel.set_scratch(True)
        panel.set_read_only(False)
        panel.settings().set('gutter', True)
        panel.settings().set('line_numbers', True)
        panel.settings().set('word_wrap', False)
        panel.run_command('append', {'characters': text})
        panel.set_read_only(True)

        views = self.window.views_in_group(self.window.active_group())
        for view in views:
            if panel.id() != view.id() and request_view.id() != view.id():
                self.window.focus_view(view)
                self.window.run_command("close_file")

        self.window.focus_group(request_view_group)
        self.window.focus_view(request_view)


text:
<!DOCTYPE HTML>

	<title>Mansfield MtnGuides : Trekking</title>
	<link REL="Stylesheet" HREF="mansfieldMtnGuides.css"  TYPE="text/css">

Mansfield MtnGuides

						Home

						About

						Mountaineering

						Rock Climbing

						Trekking

Trekking / Backpacking / Hiking

				Sometimes, you want to give your arms a break from all the rock, ice, and snow climbing, and just let them swing idly at your side like some sort of carefree sasquatch. We can help. Grab your backpack (or rent gear from us), pack up a tent, sleeping bag, and stove, and hit the trail. Mansfield MtnGuides offers guided dayhikes and backpacking trips of >= 1 day(s), in any locale on this great earth.

				Meander along scenic coastal trails in the Pacific Northwest. Slog up Mt. Whitney, the tallest mountain in the lower 48. Climb Kilimanjaro, the tallest mountain in all of Africa and a perfect non-technical giant. Hike scenic, rural pathways through Italy, France, and Switzerland among the mountains and villages alike. Walk to the north pole on a frozen sea using nordic skis, though this is offered for a limited time only, due to the melting ice and ever-shortening passable season. The choice is entirely yours.

				We'll work with you to determine a level of difficulty that will be manageable and safe, while giving you the challenge you're looking for. Hiking can be a spiritually satisfying, challenging activity that you can continue to participate in for the rest of your life. Trekking means different things to different people, from summiting massive, yet non-technical mountains, to hiking gently rolling hills or beaches for miles upon miles.

				Get in touch with Mansfield MtnGuides today and begin to wander this great Earth of ours.

					Home

					About

					Mountaineering

					Rock Climbing

					Trekking

			Site design and code by Marshall Ehlinger for Spring 2015 Web Development @ Mansfield Univerity.

			This is a fake business. Any resemblence to a real business is purely coincidental.


text:
Read a row from the CSV file without mapping columns to fields.

## Synopsis

uses('csv-import');

public function array [[CSVImport]]::rowFlat()

## Return Value

An indexed array of values read from the file, or `null` if
the end of file is reached.


text:
<?php

namespace Webforge\Doctrine\Test;

use Doctrine\ORM\EntityManager;
use Mockery as m;

class Mocker
{
    protected $test;

    public function __construct(\PHPUnit_Framework_TestCase $testCase)
    {
        $this->test = $testCase;
    }

    /**
     * Creates an dumb EntityManager for testing purposes.
     *
     * @return Doctrine\ORM\EntityManager
     */
    public function createEntityManager(array $connectionConfig = array())
    {
        $em = m::mock('Doctrine\ORM\EntityManager');
        $connection = m::mock('Doctrine\DBAL\Connection');

        if (isset($connectionConfig['database'])) {
            $connection->shouldReceive('getDatabase')->byDefault()->andReturn($connectionConfig['database']);
        }

        $em->shouldReceive('getConnection')->byDefault()->andReturn($connection);

        return $em;
    }

    public function createSchemaTool(EntityManager $em)
    {
        return $this->test->getMockBuilder('Doctrine\ORM\Tools\SchemaTool')->disableOriginalConstructor()->getMock();
    }
}


text:
.class Landroid/os/IVibratorService$Stub$Proxy;
.super Ljava/lang/Object;
.source "IVibratorService.java"

# interfaces
.implements Landroid/os/IVibratorService;

# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Landroid/os/IVibratorService$Stub;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0xa
    name = "Proxy"
.end annotation

# instance fields
.field private mRemote:Landroid/os/IBinder;

# direct methods
.method constructor <init>(Landroid/os/IBinder;)V
    .locals 0
    .param p1, "remote"    # Landroid/os/IBinder;

    .prologue
    .line 102
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 103
    iput-object p1, p0, Landroid/os/IVibratorService$Stub$Proxy;->mRemote:Landroid/os/IBinder;

    .line 104
    return-void
.end method

# virtual methods
.method public asBinder()Landroid/os/IBinder;
    .locals 1

    .prologue
    .line 107
    iget-object v0, p0, Landroid/os/IVibratorService$Stub$Proxy;->mRemote:Landroid/os/IBinder;

    return-object v0
.end method

.method public cancelVibrate(Landroid/os/IBinder;)V
    .locals 5
    .param p1, "token"    # Landroid/os/IBinder;
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Landroid/os/RemoteException;
        }
    .end annotation

    .prologue
    .line 169
    invoke-static {}, Landroid/os/Parcel;->obtain()Landroid/os/Parcel;

    move-result-object v0

    .line 170
    .local v0, "_data":Landroid/os/Parcel;
    invoke-static {}, Landroid/os/Parcel;->obtain()Landroid/os/Parcel;

    move-result-object v1

    .line 172
    .local v1, "_reply":Landroid/os/Parcel;
    :try_start_0
    const-string v2, "android.os.IVibratorService"

    invoke-virtual {v0, v2}, Landroid/os/Parcel;->writeInterfaceToken(Ljava/lang/String;)V

    .line 173
    invoke-virtual {v0, p1}, Landroid/os/Parcel;->writeStrongBinder(Landroid/os/IBinder;)V

    .line 174
    iget-object v2, p0, Landroid/os/IVibratorService$Stub$Proxy;->mRemote:Landroid/os/IBinder;

    const/4 v3, 0x4

    const/4 v4, 0x0

    invoke-interface {v2, v3, v0, v1, v4}, Landroid/os/IBinder;->transact(ILandroid/os/Parcel;Landroid/os/Parcel;I)Z

    .line 175
    invoke-virtual {v1}, Landroid/os/Parcel;->readException()V
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    .line 178
    invoke-virtual {v1}, Landroid/os/Parcel;->recycle()V

    .line 179
    invoke-virtual {v0}, Landroid/os/Parcel;->recycle()V

    .line 181
    return-void

    .line 178
    :catchall_0
    move-exception v2

    invoke-virtual {v1}, Landroid/os/Parcel;->recycle()V

    .line 179
    invoke-virtual {v0}, Landroid/os/Parcel;->recycle()V

    throw v2
.end method

.method public getInterfaceDescriptor()Ljava/lang/String;
    .locals 1

    .prologue
    .line 111
    const-string v0, "android.os.IVibratorService"

    return-object v0
.end method

.method public hasVibrator()Z
    .locals 7
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Landroid/os/RemoteException;
        }
    .end annotation

    .prologue
    const/4 v2, 0x1

    const/4 v3, 0x0

    .line 115
    invoke-static {}, Landroid/os/Parcel;->obtain()Landroid/os/Parcel;

    move-result-object v0

    .line 116
    .local v0, "_data":Landroid/os/Parcel;
    invoke-static {}, Landroid/os/Parcel;->obtain()Landroid/os/Parcel;

    move-result-object v1

    .line 119
    .local v1, "_reply":Landroid/os/Parcel;
    :try_start_0
    const-string v4, "android.os.IVibratorService"

    invoke-virtual {v0, v4}, Landroid/os/Parcel;->writeInterfaceToken(Ljava/lang/String;)V

    .line 120
    iget-object v4, p0, Landroid/os/IVibratorService$Stub$Proxy;->mRemote:Landroid/os/IBinder;

    const/4 v5, 0x1

    const/4 v6, 0x0

    invoke-interface {v4, v5, v0, v1, v6}, Landroid/os/IBinder;->transact(ILandroid/os/Parcel;Landroid/os/Parcel;I)Z

    .line 121
    invoke-virtual {v1}, Landroid/os/Parcel;->readException()V

    .line 122
    invoke-virtual {v1}, Landroid/os/Parcel;->readInt()I
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    move-result v4

    if-eqz v4, :cond_0

    .line 125
    .local v2, "_result":Z
    :goto_0
    invoke-virtual {v1}, Landroid/os/Parcel;->recycle()V

    .line 126
    invoke-virtual {v0}, Landroid/os/Parcel;->recycle()V

    .line 128
    return v2

    .end local v2    # "_result":Z
    :cond_0
    move v2, v3

    .line 122
    goto :goto_0

    .line 125
    :catchall_0
    move-exception v3

    invoke-virtual {v1}, Landroid/os/Parcel;->recycle()V

    .line 126
    invoke-virtual {v0}, Landroid/os/Parcel;->recycle()V

    throw v3
.end method

.method public vibrate(ILjava/lang/String;JLandroid/os/IBinder;)V
    .locals 5
    .param p1, "uid"    # I
    .param p2, "packageName"    # Ljava/lang/String;
    .param p3, "milliseconds"    # J
    .param p5, "token"    # Landroid/os/IBinder;
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Landroid/os/RemoteException;
        }
    .end annotation

    .prologue
    .line 132
    invoke-static {}, Landroid/os/Parcel;->obtain()Landroid/os/Parcel;

    move-result-object v0

    .line 133
    .local v0, "_data":Landroid/os/Parcel;
    invoke-static {}, Landroid/os/Parcel;->obtain()Landroid/os/Parcel;

    move-result-object v1

    .line 135
    .local v1, "_reply":Landroid/os/Parcel;
    :try_start_0
    const-string v2, "android.os.IVibratorService"

    invoke-virtual {v0, v2}, Landroid/os/Parcel;->writeInterfaceToken(Ljava/lang/String;)V

    .line 136
    invoke-virtual {v0, p1}, Landroid/os/Parcel;->writeInt(I)V

    .line 137
    invoke-virtual {v0, p2}, Landroid/os/Parcel;->writeString(Ljava/lang/String;)V

    .line 138
    invoke-virtual {v0, p3, p4}, Landroid/os/Parcel;->writeLong(J)V

    .line 139
    invoke-virtual {v0, p5}, Landroid/os/Parcel;->writeStrongBinder(Landroid/os/IBinder;)V

    .line 140
    iget-object v2, p0, Landroid/os/IVibratorService$Stub$Proxy;->mRemote:Landroid/os/IBinder;

    const/4 v3, 0x2

    const/4 v4, 0x0

    invoke-interface {v2, v3, v0, v1, v4}, Landroid/os/IBinder;->transact(ILandroid/os/Parcel;Landroid/os/Parcel;I)Z

    .line 141
    invoke-virtual {v1}, Landroid/os/Parcel;->readException()V
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    .line 144
    invoke-virtual {v1}, Landroid/os/Parcel;->recycle()V

    .line 145
    invoke-virtual {v0}, Landroid/os/Parcel;->recycle()V

    .line 147
    return-void

    .line 144
    :catchall_0
    move-exception v2

    invoke-virtual {v1}, Landroid/os/Parcel;->recycle()V

    .line 145
    invoke-virtual {v0}, Landroid/os/Parcel;->recycle()V

    throw v2
.end method

.method public vibratePattern(ILjava/lang/String;[JILandroid/os/IBinder;)V
    .locals 5
    .param p1, "uid"    # I
    .param p2, "packageName"    # Ljava/lang/String;
    .param p3, "pattern"    # [J
    .param p4, "repeat"    # I
    .param p5, "token"    # Landroid/os/IBinder;
    .annotation system Ldalvik/annotation/Throws;
        value = {
            Landroid/os/RemoteException;
        }
    .end annotation

    .prologue
    .line 150
    invoke-static {}, Landroid/os/Parcel;->obtain()Landroid/os/Parcel;

    move-result-object v0

    .line 151
    .local v0, "_data":Landroid/os/Parcel;
    invoke-static {}, Landroid/os/Parcel;->obtain()Landroid/os/Parcel;

    move-result-object v1

    .line 153
    .local v1, "_reply":Landroid/os/Parcel;
    :try_start_0
    const-string v2, "android.os.IVibratorService"

    invoke-virtual {v0, v2}, Landroid/os/Parcel;->writeInterfaceToken(Ljava/lang/String;)V

    .line 154
    invoke-virtual {v0, p1}, Landroid/os/Parcel;->writeInt(I)V

    .line 155
    invoke-virtual {v0, p2}, Landroid/os/Parcel;->writeString(Ljava/lang/String;)V

    .line 156
    invoke-virtual {v0, p3}, Landroid/os/Parcel;->writeLongArray([J)V

    .line 157
    invoke-virtual {v0, p4}, Landroid/os/Parcel;->writeInt(I)V

    .line 158
    invoke-virtual {v0, p5}, Landroid/os/Parcel;->writeStrongBinder(Landroid/os/IBinder;)V

    .line 159
    iget-object v2, p0, Landroid/os/IVibratorService$Stub$Proxy;->mRemote:Landroid/os/IBinder;

    const/4 v3, 0x3

    const/4 v4, 0x0

    invoke-interface {v2, v3, v0, v1, v4}, Landroid/os/IBinder;->transact(ILandroid/os/Parcel;Landroid/os/Parcel;I)Z

    .line 160
    invoke-virtual {v1}, Landroid/os/Parcel;->readException()V
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    .line 163
    invoke-virtual {v1}, Landroid/os/Parcel;->recycle()V

    .line 164
    invoke-virtual {v0}, Landroid/os/Parcel;->recycle()V

    .line 166
    return-void

    .line 163
    :catchall_0
    move-exception v2

    invoke-virtual {v1}, Landroid/os/Parcel;->recycle()V

    .line 164
    invoke-virtual {v0}, Landroid/os/Parcel;->recycle()V

    throw v2
.end method


text:
from .base import class_names_apc2016  # NOQA
from .jsk import JskAPC2016Dataset  # NOQA
from .mit import MitAPC2016Dataset  # NOQA

if __name__ == '__main__':
    from ...utils import view_class_seg_dataset
    import argparse

    datasets = [
        'JskAPC2016Dataset',
        'MitAPC2016Dataset',
    ]

    parser = argparse.ArgumentParser()
    parser.add_argument('-d', '--dataset', choices=datasets, required=True)
    parser.add_argument('--split', default='valid')
    parser.add_argument('--locations', nargs='+', default=['shelf'])
    args = parser.parse_args()

    if args.dataset == 'JskAPC2016Dataset':
        dataset = JskAPC2016Dataset(args.split)
    elif args.dataset == 'MitAPC2016Dataset':
        dataset = MitAPC2016Dataset(args.split, locations=args.locations)
    view_class_seg_dataset(dataset)


text:
package edu.gemini.gsa.query

import edu.gemini.gsa.query.JsonCodecs._
import edu.gemini.spModel.dataset.{DatasetQaState, DatasetLabel, DatasetMd5, DatasetGsaState}

import argonaut.{CodecJson, DecodeResult}

import org.scalacheck.Prop.forAll
import org.scalacheck.{Gen, Arbitrary}
import org.specs2.ScalaCheck
import org.specs2.mutable.Specification

import java.time.Instant

import scalaz.syntax.id._

object JsonCodecsSpec extends Specification with ScalaCheck with Arbitraries {

  import GsaQaUpdateQuery.EitherQaResponse

  implicit val arbArchiveResponse: Arbitrary[EitherQaResponse] =
    Arbitrary {
      Gen.oneOf(Gen.alphaStr.map(_.left), arbQaResponse.arbitrary.map(_.right))
    }

  def roundTrip[A: CodecJson: Arbitrary](implicit mf: Manifest[A]) =
    mf.runtimeClass.getName ! forAll { (value: A) =>
      val c = implicitly[CodecJson[A]]
      c.decodeJson(c.encode(value)) must_== DecodeResult.ok(value)
    }

  "JSON Codecs" >> {
    roundTrip[DatasetGsaState]
    roundTrip[DatasetLabel]
    roundTrip[DatasetMd5]
    roundTrip[DatasetQaState]
    roundTrip[GsaRecord]
    roundTrip[GsaFile]
    roundTrip[Instant]
    roundTrip[QaResponse]
    roundTrip[EitherQaResponse]
  }

}


text:
<?php

/**
 * The "zoneOperations" collection of methods.
 * Typical usage is:
 *  <code>
 *   $replicapoolupdaterService = new Google_Service_Replicapoolupdater(...);
 *   $zoneOperations = $replicapoolupdaterService->zoneOperations;
 *  </code>
 */
class Google_Service_Replicapoolupdater_Resource_ZoneOperations extends Google_Service_Resource
{
  /**
   * Retrieves the specified zone-specific operation resource.
   * (zoneOperations.get)
   *
   * @param string $project Name of the project scoping this request.
   * @param string $zone Name of the zone scoping this request.
   * @param string $operation Name of the operation resource to return.
   * @param array $optParams Optional parameters.
   * @return Google_Service_Replicapoolupdater_Operation
   */
  public function get($project, $zone, $operation, $optParams = array())
  {
    $params = array('project' => $project, 'zone' => $zone, 'operation' => $operation);
    $params = array_merge($params, $optParams);
    return $this->call('get', array($params), "Google_Service_Replicapoolupdater_Operation");
  }
  /**
   * Retrieves the list of Operation resources contained within the specified
   * zone. (zoneOperations.listZoneOperations)
   *
   * @param string $project Name of the project scoping this request.
   * @param string $zone Name of the zone scoping this request.
   * @param array $optParams Optional parameters.
   *
   * @opt_param string filter Optional. Filter expression for filtering listed
   * resources.
   * @opt_param string maxResults Optional. Maximum count of results to be
   * returned. Maximum value is 500 and default value is 500.
   * @opt_param string pageToken Optional. Tag returned by a previous list request
   * truncated by maxResults. Used to continue a previous list request.
   * @return Google_Service_Replicapoolupdater_OperationList
   */
  public function listZoneOperations($project, $zone, $optParams = array())
  {
    $params = array('project' => $project, 'zone' => $zone);
    $params = array_merge($params, $optParams);
    return $this->call('list', array($params), "Google_Service_Replicapoolupdater_OperationList");
  }
}


text:
*`geojsonProject(geojson, func, context)`*
* `geojson` is `Feature` or `FeatureCollection`
* `func` is the project function, takes in one coordinate pair,
         returns it transformed
* `context` _optional_ - transform function's `this`

returns transformed copy of GeoJSON

## Usage
```js
var geojsonProject = require('geojson-project');

geojsonProject({
  type: 'FeatureCollection',
    features: [{
      type: 'Feature',
      properties: {a : 1},
      geometry: {
        type: 'Point',
        coordinates: [6, 6]
      }
    }, {
      type: 'Feature',
      properties: {a : 2},
      geometry: {
        type: 'Point',
        coordinates: [4, 4]
      }
    }]
  }, function(coord) {
    return [coords[0]/2, coords[1]/2];
  });

```

will result in

```js
{
  type: 'FeatureCollection',
  features: [{
    type: 'Feature',
    properties: {a : 1},
    geometry: {
      type: 'Point',
      coordinates: [3, 3]
    }
  }, {
    type: 'Feature',
    properties: {a : 2},
    geometry: {
      type: 'Point',
      coordinates: [2, 2]
    }
  }]
}
```

## Test

```shell
$ npm test
```

## License

The MIT License (MIT)

Copyright (c) 2016 Alexander Milevski

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.


text:
<?php
q("CREATE TABLE `config` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `config_key` varchar(64),
  `config_value` varchar(128),
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8");

q("CREATE TABLE `account` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `email` varchar(256) NOT NULL,
  `password` varchar(128) NOT NULL,
  `active` enum('no','yes') DEFAULT 'yes' NOT NULL,
  `access_type` varchar(32) DEFAULT 'admin',
  `created_on` datetime NOT NULL,
  `name` varchar(64) DEFAULT NULL,
  `deleted` enum('no','yes') DEFAULT 'no' NOT NULL,
  `karma` int not null default 0,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8");

q("INSERT INTO `account` SET
  `email`='dan@marginallyclever.com',
  `password`=md5('Q@#(RJasdfj843jkdf71'),
  `active`='yes',
  `access_type`='admin',
  `created_on`=NOW(),
  `name`='Dan'");
?>


text:
import { createReducer } from 'redux-immutablejs';
import { createSelector } from 'reselect';
import Immutable from 'immutable';

import constants from './constants';

// Constants
const {
  EDITOR_POST_EDIT,
} = constants;

// Initial State
const initialState = Immutable.fromJS({
  postEditorContent: '',
});

// Actions
export const updatePostEditorContent = postContent => dispatch =>
  dispatch({ type: EDITOR_POST_EDIT, payload: { postContent } });

// Reducer
export default createReducer(initialState, {
  [EDITOR_POST_EDIT]: (state, action) => state.set('postEditorContent', action.payload.postContent),
});

// Selectors
const postEditor = state => state.postEditor;

export const getPostEditorContent = createSelector(
  postEditor,
  p => p.get('postEditorContent'),
);


text:
from django.contrib import admin

from .models import ParkingSpace, FixedAvailability, RepeatingAvailability, Reservation

class FixedAvailabilityAdmin(admin.ModelAdmin):
    list_display = ('parking_space', 'get_start', 'get_end', 'get_pricing')
    ordering = ('start_datetime',)

    def get_start(self, obj):
        return obj.start_datetime
    get_start.short_description = 'start'

    def get_end(self, obj):
        return obj.end_datetime
    get_end.short_description = 'end'

    def get_pricing(self, obj):
        return '$' + str((obj.pricing * 12)/100) + ' / hr'
    get_pricing.short_description = 'price'

class RepeatingAvailabilityAdmin(admin.ModelAdmin):
    list_display = ('parking_space', 'start_time', 'end_time', 'repeating_days', 'get_pricing')

    def get_pricing(self, obj):
        return '$' + str((obj.pricing * 12)/100) + ' / hr'
    get_pricing.short_description = 'price'

admin.site.register(ParkingSpace)
admin.site.register(FixedAvailability, FixedAvailabilityAdmin)
admin.site.register(RepeatingAvailability, RepeatingAvailabilityAdmin)
admin.site.register(Reservation)


text:
/*
module pattern
- its like classes in Java
- provides loose coupling between components
- provides encapsulation- protecting private states and behavior from being access by other classes
- allows public and private declarations
- closure is created using IIFE
*/

var foo = (function(){

    var privateVar = "hi";
    var privateFunc = function(){
        console.log(privateVar);
    };

    return {
        publicFunc: function(){
            privateFunc();
        }
    };

})();

foo.publicFunc(); // hi
console.log(foo.privateVar); // undefined


text:
<?xml version='1.0' encoding='utf-8'?>
<widget id="com.ionicframework.starter" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
    <name>SwimTracker</name>
    <description>
        An app to track your swims.
    </description>
    <author email="underhilllabs@gmail.com" href="http://ionicframework.com/">
        Underhill Labs
    </author>
    <content src="index.html" />
    <access origin="*" />
    <preference name="fullscreen" value="true" />
    <preference name="webviewbounce" value="false" />
    <preference name="UIWebViewBounce" value="false" />
    <preference name="DisallowOverscroll" value="true" />
</widget>


text:
<?php
namespace RBac\Controller;

use Zend\Mvc\Controller\AbstractActionController;
use RBac\Entity\User;
use RBac\Entity\Permission;
use RBac\Entity\HierarchicalRole;

class RBacController extends AbstractActionController
{
    protected $userTable;
    protected $permissionTable;
    protected $hierarchicalroleTable;

    public function getUserTable() {
        if (!$this->userTable) {
            $sm = $this->getServiceLocator();
            $this->userTable = $sm->get('RBac\Entity\UserTable');
        }
        return $this->userTable;
    }
    public function getPermissionTable() {
        if (!$this->permissionTable) {
            $sm = $this->getServiceLocator();
            $this->permissionTable = $sm->get('RBac\Entity\PermissionTable');
        }
        return $this->permissionTable;
    }
    public function getHierarchicalRoleTable() {
        if (!$this->hierarchicalroleTable) {
            $sm = $this->getServiceLocator();
            $this->hierarchicalroleTable = $sm->get('RBac\Entity\HierarchicalRoleTable');
        }
        return $this->hierarchicalroleTable;
    }
}


text:
--------------------------------
-- @function [parent=#Skeleton] setBlendFunc
-- @param self
-- @param #cc.BlendFunc blendfunc

--------------------------------
-- @function [parent=#Skeleton] onDraw
-- @param self
-- @param #cc.Mat4 mat4
-- @param #bool bool

--------------------------------
-- @function [parent=#Skeleton] setSlotsToSetupPose
-- @param self

--------------------------------
-- @function [parent=#Skeleton] getBlendFunc
-- @param self
-- @return BlendFunc#BlendFunc ret (return value: cc.BlendFunc)

--------------------------------
-- @function [parent=#Skeleton] setSkin
-- @param self
-- @param #char char
-- @return bool#bool ret (return value: bool)

--------------------------------
-- @function [parent=#Skeleton] setBonesToSetupPose
-- @param self

--------------------------------
-- @function [parent=#Skeleton] getBoundingBox
-- @param self
-- @return rect_table#rect_table ret (return value: rect_table)

--------------------------------
-- @function [parent=#Skeleton] onEnter
-- @param self

--------------------------------
-- @function [parent=#Skeleton] onExit
-- @param self

return nil


text:
 /**
 * Name : ActiveResources.js
 * Module : Norris::Lib::DataLayer
 * Location : /norris/lib/dataLayer
 *
 * History :
 * Version       Date           Programmer
 * =================================================
 *  0.0.2     2015/05/14    Meneguzzo Francesco
 * -------------------------------------------------
 *  Revisone modulo
 * =================================================
 *  0.0.1     2015/05/07    Meneguzzo Francesco
 * -------------------------------------------------
 *  Codifica modulo
 * =================================================
 */
'use strict';

var ActiveResources = (function() {
  //Stores two associative arrays of references to active objects
  var graphs = [];
  var pages = [];
  //Returns a reference to the two data arrays
  return { graphs: graphs
         , pages: pages
         };
})();

module.exports = ActiveResources;


text:
<?php

class Core_library_Database_Structure_Database_Object
  extends Core_Library_Database_Structure_Database {

  function __construct($object, $xml){
    $this->object = $object;
    parent::__construct($xml);
  }

  function getObjectName(){
    return (string) $this->object['name'];
  }

  function getTableName(){
    return (string) $this->object['table_name'];
  }

  function getToStringField(){
    return (string) $this->object['to_string_field'];
  }

  function getFields(){
    return $this->object->field;
  }

  function getFieldNumber(){
    return (int) count($this->getFields());
  }

  function getPrimaryKey(){
    foreach ($this->object->field as $field){
      if ($field['type'] == 'id'){
        return (string) $field['name'];
      }
    }
  }

  function hasChildObject(){
    foreach ($this->object->field as $field){
      if ($field['type'] == 'object'){
        return true;
      }
    }
  }

  function getChildObjectFields(){
    foreach ($this->object->field as $field){
      if ($field['type'] == 'object'){
        $list[] = (string) $field['name'];
      }
    }
    return $list;
  }

  function getChildObjectName($fieldName){
    foreach ($this->object->field as $field){
      if ($field['name'] == $fieldName){
        return (string) $field['object_name'];
      }
    }
  }

  function getChildObjectStringField($fieldName){
    foreach ($this->object->field as $field){
      if ($field['name'] == $fieldName){
        return (string) $this->getObject($field['object_name'])->getToStringField();
      }
    }
  }
}