text:
var router = require('../router.js');
var Category = require('../models/category.js');
var Transaction = require('../models/transaction.js');
var Run = require('./run.js');
var Money = require('../models/money.js');
var db = require('../db.js');

router.register('category', 'create', create);
router.register('category', 'get', get);
router.register('category', 'update', update);
router.register('category', 'getOrdered', getOrdered);
router.register('category', 'destroy', destroy);
router.register('category', 'deleteCategory', deleteCategory);
router.register('category', 'updateBalance', updateBalance);
router.register('category', 'getBalance', getBalance);
router.register('category', 'getStats', getStats);
router.register('category', 'updateAll', updateAll);
router.register('category', 'getLatestCredit', getLatestCredit);
getLatestCredit
module.exports = {
	destroy : destroy,
	create : create,
	get : get,
	getShortList : getShortList,
	getBalance : getBalance,
	getSmallestCredit : getSmallestCredit,
	getStats : getStats,
	updateAll : updateAll,
	getLatestCredit : getLatestCredit

};

function deleteCategory(reply, data) {
	if(data.id == undefined || data.id == 0) {
		return reply(false);
	}
	Money.findOne({ where : {categoryId:data.id }})
	.then(function(rows){
		if(rows) {
			reply({error:true, message : " Cannot remove categories that contains transactions!"});
		}else{
			destroy(reply, {id: data.id});
		}
	})
	.error(function(err){
		reply(err);
	});
}

function destroy(reply, data) {
	if(data.id == undefined) {
		return reply(false);
	}
	Category.destroy({where:data})
	.then(function(rowsAffected){
		if(rowsAffected > 0){
			reply(true);
		}else{
			reply({error:true, message : "No category found to delete!"});
		}
	})
	.error(function(err){
		reply(err);
	});
}

function create(reply, data) {
	Category.create(data)
	.then(function(category){
		reply(category);
	})
	.error(function(err){
		reply(err);
	});
}

function update(reply, data) {
	var id=data.id;
	data.id = undefined;
	Category.update(data, {where:{id:id}})
	.then(function(metadata){
		if(metadata && metadata.length > 0 && metadata[0] > 0){
			reply(true);
		}else{
			reply({error:true, message : "No category found to update!"});
		}
	})
	.error(function(err){
		reply(err);
	});
}

function get(reply, data) {
	Category.findAll({ where : data })
	.then(function(rows){
		reply(rows);
	})
	.error(function(err){
		reply(err);
	});
}

function getOrdered(reply, data) {
	Category.findAll({ where : data, order: '`categoryId` ASC, `name` ASC' })
	.then(function(rows){
		reply(rows);
	})
	.error(function(err){
		console.log(err);
		reply(err);
	});
}

function getShortList(reply, data) {
	Category.findAll({ attributes: ['id', 'name'], where : data })
	.then(function(rows){
		reply(rows);
	})
	.error(function(err){
		reply(err);
	});
}

function updateBalance(reply, data) {
	data.reply =reply;
	new Run(data,
		function(next){
			var sql = "CALL update_category_balance(:categoryId);";
			db.query(sql,
				{ replacements: {
					categoryId: this.id
				} }
			).then(next)
			.error(function(err){
				console.log(err);
				this.reply(err);
			}.bind(this))
		},

		function(next, response){
			this.reply(true);
		}
	)();
}

function getStats(reply, data) {
	data.reply =reply;
	new Run(data,
		function(next){
			var sql = "CALL get_category_monthly_stats(:categoryId);";
			db.query(sql,
				{ replacements: {
					categoryId: this.id
				}, type: db.QueryTypes.SELECT }
			).then(next)
			.error(function(err){
				console.log(err);
				this.reply(err);
			}.bind(this))
		},

		function(next, response){
			this.reply(response);
		}
	)();
}

function getBalance(reply, data) {
	data.reply =reply;
	new Run(data,

		function(next){
			var sql = "select SUM(credit - debit) as balance from money where categoryId = :id ;";
			db.query(sql,
				{ replacements: {
					id: this.id
				}, type: db.QueryTypes.SELECT }
			).then(next)
			.error(function(err){
				console.log(err);
				reply(err);
			});
		},

		function(next, response){
			this.reply(response.length > 0 ? response[0].balance : 0);
		}
	)();
}

function getSmallestCredit(reply, data) {
	data.reply =reply;
	new Run(data,
		function(next){
			var sql = "select MIN(credit - debit), money.* from money where categoryId = :id and credit > 0;";
			db.query(sql,
				{ model : Money, replacements: {
					id: this.id
				}, type: db.QueryTypes.SELECT }
			).then(next)
			.error(function(err){
				console.log(err);
				reply(err);
			});
		},

		function(next, response){
			this.reply(response[0]);
		}
	)();
}

function getLatestCredit(reply, data) {
	data.reply =reply;
	new Run(data,
		function(next){
			var sql = "select money.* from money where categoryId = :id and credit > 0 and date = (Select max(date) from money where categoryId = :id and credit > 0);";
			db.query(sql,
				{ model : Money, replacements: {
					id: this.id
				}, type: db.QueryTypes.SELECT }
			).then(next)
			.error(function(err){
				console.log(err);
				reply(err);
			});
		},

		function(next, response){
			this.reply(response[0]);
		}
	)();
}

function updateAll(reply, data) {
	data.reply =reply;
	new Run(data,
		function(next){
			var sql = " select categories.id";
				sql+= " 	from categories";
				sql+= " left outer join money on money.updatedAt > categories.updatedAt";
				sql+= "   and categories.id = money.categoryId";
				sql+= " left outer join transfers on transfers.categoryId = categories.id";
				sql+= "   OR transfers.from_categoryId = categories.id";
				sql+= " where ";
				sql+= " 	money.id IS NOT NULL OR transfers.id IS NOT NULL";

			db.query(sql, {type: db.QueryTypes.SELECT})
			.then(next)
			.error(function(err){
				console.log(err);
				this.reply(err);
			}.bind(this))
		},

		function(next, response){
			this.categories = response;
			this.index=0;
			this.nextLoop = next;
			this.nextLoop();
		},

		function(next){
			if(this.index < this.categories.length){
				updateBalance(this.nextLoop, {id:this.categories[this.index].id});
				this.index++;
			}else{
				next();
			}
		},

		function(){
			this.reply(true);
		}
	)();
}

function getUpdatedCategories(reply, data){
	data.reply =reply;
	new Run(data,
		function(next){
			var sql = " select *";
				sql+= " 	from categories";
				sql+= " where updatedAt > :fromDateTime";

			db.query(sql, {model : Category, replacements: {
					fromDateTime: this.fromDateTime
				}, type: db.QueryTypes.SELECT})
			.then(next)
			.error(function(err){
				console.log(err);
				this.reply(err);
			}.bind(this))
		},

		function(next, response){
			this.categories = response;
			this.index=0;
			this.nextLoop = next;
			this.nextLoop();
		},

		function(next){
			if(this.index < this.categories.length){
				updateBalance(this.nextLoop, {id:this.categories[this.index].id});
				this.index++;
			}else{
				next();
			}
		},

		function(){
			this.reply(true);
		}
	)();
}


text:
<?php

declare(strict_types=1);

namespace Cmfcmf\Module\MediaModule\Importer;

use Symfony\Component\Form\FormTypeInterface;
use Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface;

interface ImporterInterface
{
    /**
     * The unique importer id. Must be unique across all bundles. It is recommended to prefix it with the bundle name.
     *
     * @return string
     */
    public function getId();

    /**
     * The title of the importer.
     *
     * @return string
     */
    public function getTitle();

    /**
     * The description of the importer.
     *
     * @return string
     */
    public function getDescription();

    /**
     * All restrictions of the importer, i.e. things that can't be imported.
     *
     * @return string|null
     */
    public function getRestrictions();

    /**
     * Checks whether the importer can be used. True if it can, an error message otherwise.
     *
     * @return bool|string
     */
    public function checkRequirements();

    /**
     * @return FormTypeInterface
     */
    public function getSettingsForm();

    public function import($formData, FlashBagInterface $flashBag);
}

redpajama_set_name: RedPajamaGithub


text:
#ifndef __GAME_PVS_H__
#define __GAME_PVS_H__

/*
===================================================================================

	PVS

	Note: mirrors and other special view portals are not taken into account

===================================================================================
*/

typedef struct pvsHandle_s {
	int					i;			// index to current pvs
	unsigned int		h;			// handle for current pvs
} pvsHandle_t;

typedef struct pvsCurrent_s {
	pvsHandle_t			handle;		// current pvs handle
	byte *				pvs;		// current pvs bit string
} pvsCurrent_t;

#define MAX_CURRENT_PVS		8		// must be a power of 2

typedef enum {
	PVS_NORMAL				= 0,	// PVS through portals taking portal states into account
	PVS_ALL_PORTALS_OPEN	= 1,	// PVS through portals assuming all portals are open
	PVS_CONNECTED_AREAS		= 2		// PVS considering all topologically connected areas visible
} pvsType_t;

class idPVS {
public:
						idPVS( void );
						~idPVS( void );
						// setup for the current map
	void				Init( void );
	void				Shutdown( void );
						// get the area(s) the source is in
	int					GetPVSArea( const idVec3 &point ) const;		// returns the area number
	int					GetPVSAreas( const idBounds &bounds, int *areas, int maxAreas ) const;	// returns number of areas
						// setup current PVS for the source
	pvsHandle_t			SetupCurrentPVS( const idVec3 &source, const pvsType_t type = PVS_NORMAL ) const;
	pvsHandle_t			SetupCurrentPVS( const idBounds &source, const pvsType_t type = PVS_NORMAL ) const;
	pvsHandle_t			SetupCurrentPVS( const int sourceArea, const pvsType_t type = PVS_NORMAL ) const;
	pvsHandle_t			SetupCurrentPVS( const int *sourceAreas, const int numSourceAreas, const pvsType_t type = PVS_NORMAL ) const;
	pvsHandle_t			MergeCurrentPVS( pvsHandle_t pvs1, pvsHandle_t pvs2 ) const;
	void				FreeCurrentPVS( pvsHandle_t handle ) const;
						// returns true if the target is within the current PVS
	bool				InCurrentPVS( const pvsHandle_t handle, const idVec3 &target ) const;
	bool				InCurrentPVS( const pvsHandle_t handle, const idBounds &target ) const;
	bool				InCurrentPVS( const pvsHandle_t handle, const int targetArea ) const;
	bool				InCurrentPVS( const pvsHandle_t handle, const int *targetAreas, int numTargetAreas ) const;
						// draw all portals that are within the PVS of the source
	void				DrawPVS( const idVec3 &source, const pvsType_t type = PVS_NORMAL ) const;
	void				DrawPVS( const idBounds &source, const pvsType_t type = PVS_NORMAL ) const;
						// visualize the PVS the handle points to
	void				DrawCurrentPVS( const pvsHandle_t handle, const idVec3 &source ) const;

#if ASYNC_WRITE_PVS
	void				WritePVS( const pvsHandle_t handle, idBitMsg &msg );
	void				ReadPVS( const pvsHandle_t handle, const idBitMsg &msg );
#endif

private:
	int					numAreas;
	int					numPortals;
	bool *				connectedAreas;
	int *				areaQueue;
	byte *				areaPVS;
						// current PVS for a specific source possibly taking portal states (open/closed) into account
	mutable pvsCurrent_t currentPVS[MAX_CURRENT_PVS];
						// used to create PVS
	int					portalVisBytes;
	int					portalVisLongs;
	int					areaVisBytes;
	int					areaVisLongs;
	struct pvsPortal_s *pvsPortals;
	struct pvsArea_s *	pvsAreas;

private:
	int					GetPortalCount( void ) const;
	void				CreatePVSData( void );
	void				DestroyPVSData( void );
	void				CopyPortalPVSToMightSee( void ) const;
	void				FloodFrontPortalPVS_r( struct pvsPortal_s *portal, int areaNum ) const;
	void				FrontPortalPVS( void ) const;
	struct pvsStack_s *	FloodPassagePVS_r( struct pvsPortal_s *source, const struct pvsPortal_s *portal, struct pvsStack_s *prevStack ) const;
	void				PassagePVS( void ) const;
	void				AddPassageBoundaries( const idWinding &source, const idWinding &pass, bool flipClip, idPlane *bounds, int &numBounds, int maxBounds ) const;
	void				CreatePassages( void ) const;
	void				DestroyPassages( void ) const;
	int					AreaPVSFromPortalPVS( void ) const;
	void				GetConnectedAreas( int srcArea, bool *connectedAreas ) const;
	pvsHandle_t			AllocCurrentPVS( unsigned int h ) const;
};

#endif /* !__GAME_PVS_H__ */


text:
package com.pcloud.networking.serialization;

import com.pcloud.networking.protocol.ProtocolReader;
import com.pcloud.networking.protocol.ProtocolWriter;

import java.io.IOException;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.util.Map;
import java.util.Objects;

class ClassTypeAdapter<T> extends TypeAdapter<T> {
    private final ClassFactory<T> classFactory;
    private final Map<String, Binding> nameToBindingMap;

    ClassTypeAdapter(ClassFactory<T> classFactory, Map<String, Binding> fieldsMap) {
        this.classFactory = classFactory;
        this.nameToBindingMap = fieldsMap;
    }

    @Override
    public T deserialize(ProtocolReader reader) throws IOException {
        T result;
        try {
            result = classFactory.newInstance();
        } catch (InstantiationException e) {
            throw new RuntimeException(e);
        } catch (InvocationTargetException e) {
            Throwable targetException = e.getTargetException();
            if (targetException instanceof RuntimeException) throw (RuntimeException) targetException;
            if (targetException instanceof Error) throw (Error) targetException;
            throw new RuntimeException(targetException);
        } catch (IllegalAccessException e) {
            throw new AssertionError();
        }

        try {
            reader.beginObject();
            while (reader.hasNext()) {
                String name = reader.readString();
                Binding binding = nameToBindingMap.get(name);
                if (binding != null) {
                    binding.read(reader, result);
                } else {
                    reader.skipValue();
                }
            }
            reader.endObject();
            return result;
        } catch (IllegalAccessException e) {
            throw new AssertionError();
        }
    }

    @Override
    public void serialize(ProtocolWriter writer, T value) throws IOException {
        try {
            for (Binding binding : nameToBindingMap.values()) {
                binding.write(writer, value);
            }
        } catch (IllegalAccessException e) {
            throw new AssertionError();
        }
    }

    @Override
    public String toString() {
        return "TypeAdapter[" + classFactory.getClass().getName() + "]";
    }

    abstract static class Binding {
        final String name;
        final Field field;

        Binding(String name, Field field) {
            this.name = name;
            this.field = field;
        }

        abstract void read(ProtocolReader reader, Object target) throws IOException, IllegalAccessException;

        abstract void write(ProtocolWriter writer, Object target) throws IllegalAccessException, IOException;

        @Override
        public boolean equals(Object o) {
            if (this == o) return true;
            if (!(o instanceof Binding)) return false;
            Binding binding = (Binding) o;
            return Objects.equals(name, binding.name);
        }

        @Override
        public int hashCode() {
            return Objects.hash(name);
        }
    }
}


text:
namespace v8 {
namespace internal {

// Defined in heap.cc.
V8_EXPORT_PRIVATE bool Heap_PageFlagsAreConsistent(HeapObject object);
V8_EXPORT_PRIVATE void Heap_GenerationalBarrierSlow(HeapObject object,
                                                    Address slot,
                                                    HeapObject value);
V8_EXPORT_PRIVATE void Heap_WriteBarrierForCodeSlow(Code host);

V8_EXPORT_PRIVATE void Heap_GenerationalBarrierForCodeSlow(Code host,
                                                           RelocInfo* rinfo,
                                                           HeapObject object);

V8_EXPORT_PRIVATE void Heap_GenerationalEphemeronKeyBarrierSlow(
    Heap* heap, EphemeronHashTable table, Address slot);

// Do not use these internal details anywhere outside of this file. These
// internals are only intended to shortcut write barrier checks.
namespace heap_internals {

struct MemoryChunk {
  static constexpr uintptr_t kFlagsOffset = kSizetSize;
  static constexpr uintptr_t kHeapOffset = kSizetSize + kUIntptrSize;
  static constexpr uintptr_t kMarkingBit = uintptr_t{1} << 18;
  static constexpr uintptr_t kFromPageBit = uintptr_t{1} << 3;
  static constexpr uintptr_t kToPageBit = uintptr_t{1} << 4;
  static constexpr uintptr_t kReadOnlySpaceBit = uintptr_t{1} << 21;

  V8_INLINE static heap_internals::MemoryChunk* FromHeapObject(
      HeapObject object) {
    DCHECK(!V8_ENABLE_THIRD_PARTY_HEAP_BOOL);
    return reinterpret_cast<MemoryChunk*>(object.ptr() & ~kPageAlignmentMask);
  }

  V8_INLINE bool IsMarking() const { return GetFlags() & kMarkingBit; }

  V8_INLINE bool InYoungGeneration() const {
    if (V8_ENABLE_THIRD_PARTY_HEAP_BOOL) return false;
    constexpr uintptr_t kYoungGenerationMask = kFromPageBit | kToPageBit;
    return GetFlags() & kYoungGenerationMask;
  }

  V8_INLINE uintptr_t GetFlags() const {
    return *reinterpret_cast<const uintptr_t*>(reinterpret_cast<Address>(this) +
                                               kFlagsOffset);
  }

  V8_INLINE Heap* GetHeap() {
    Heap* heap = *reinterpret_cast<Heap**>(reinterpret_cast<Address>(this) +
                                           kHeapOffset);
    DCHECK_NOT_NULL(heap);
    return heap;
  }

  V8_INLINE bool InReadOnlySpace() const {
    return GetFlags() & kReadOnlySpaceBit;
  }
};

inline void GenerationalBarrierInternal(HeapObject object, Address slot,
                                        HeapObject value) {
  DCHECK(Heap_PageFlagsAreConsistent(object));
  heap_internals::MemoryChunk* value_chunk =
      heap_internals::MemoryChunk::FromHeapObject(value);
  heap_internals::MemoryChunk* object_chunk =
      heap_internals::MemoryChunk::FromHeapObject(object);

  if (!value_chunk->InYoungGeneration() || object_chunk->InYoungGeneration()) {
    return;
  }

  Heap_GenerationalBarrierSlow(object, slot, value);
}

inline void GenerationalEphemeronKeyBarrierInternal(EphemeronHashTable table,
                                                    Address slot,
                                                    HeapObject value) {
  DCHECK(Heap::PageFlagsAreConsistent(table));
  heap_internals::MemoryChunk* value_chunk =
      heap_internals::MemoryChunk::FromHeapObject(value);
  heap_internals::MemoryChunk* table_chunk =
      heap_internals::MemoryChunk::FromHeapObject(table);

  if (!value_chunk->InYoungGeneration() || table_chunk->InYoungGeneration()) {
    return;
  }

  Heap_GenerationalEphemeronKeyBarrierSlow(table_chunk->GetHeap(), table, slot);
}

}  // namespace heap_internals

inline void WriteBarrierForCode(Code host, RelocInfo* rinfo, Object value) {
  DCHECK(!HasWeakHeapObjectTag(value));
  if (!value.IsHeapObject()) return;
  WriteBarrierForCode(host, rinfo, HeapObject::cast(value));
}

inline void WriteBarrierForCode(Code host, RelocInfo* rinfo, HeapObject value) {
  GenerationalBarrierForCode(host, rinfo, value);
  WriteBarrier::Marking(host, rinfo, value);
}

inline void WriteBarrierForCode(Code host) {
  Heap_WriteBarrierForCodeSlow(host);
}

inline void GenerationalBarrier(HeapObject object, ObjectSlot slot,
                                Object value) {
  if (V8_ENABLE_THIRD_PARTY_HEAP_BOOL) return;
  DCHECK(!HasWeakHeapObjectTag(value));
  if (!value.IsHeapObject()) return;
  GenerationalBarrier(object, slot, HeapObject::cast(value));
}

inline void GenerationalBarrier(HeapObject object, ObjectSlot slot,
                                HeapObject value) {
  if (V8_ENABLE_THIRD_PARTY_HEAP_BOOL) return;
  DCHECK(!HasWeakHeapObjectTag(*slot));
  heap_internals::GenerationalBarrierInternal(object, slot.address(),
                                              HeapObject::cast(value));
}

inline void GenerationalEphemeronKeyBarrier(EphemeronHashTable table,
                                            ObjectSlot slot, Object value) {
  if (V8_ENABLE_THIRD_PARTY_HEAP_BOOL) return;
  DCHECK(!HasWeakHeapObjectTag(*slot));
  DCHECK(!HasWeakHeapObjectTag(value));
  DCHECK(value.IsHeapObject());
  heap_internals::GenerationalEphemeronKeyBarrierInternal(
      table, slot.address(), HeapObject::cast(value));
}

inline void GenerationalBarrier(HeapObject object, MaybeObjectSlot slot,
                                MaybeObject value) {
  if (V8_ENABLE_THIRD_PARTY_HEAP_BOOL) return;
  HeapObject value_heap_object;
  if (!value->GetHeapObject(&value_heap_object)) return;
  heap_internals::GenerationalBarrierInternal(object, slot.address(),
                                              value_heap_object);
}

inline void GenerationalBarrierForCode(Code host, RelocInfo* rinfo,
                                       HeapObject object) {
  if (V8_ENABLE_THIRD_PARTY_HEAP_BOOL) return;
  heap_internals::MemoryChunk* object_chunk =
      heap_internals::MemoryChunk::FromHeapObject(object);
  if (!object_chunk->InYoungGeneration()) return;
  Heap_GenerationalBarrierForCodeSlow(host, rinfo, object);
}

inline WriteBarrierMode GetWriteBarrierModeForObject(
    HeapObject object, const DisallowHeapAllocation* promise) {
  if (FLAG_disable_write_barriers) return SKIP_WRITE_BARRIER;
  DCHECK(Heap_PageFlagsAreConsistent(object));
  heap_internals::MemoryChunk* chunk =
      heap_internals::MemoryChunk::FromHeapObject(object);
  if (chunk->IsMarking()) return UPDATE_WRITE_BARRIER;
  if (chunk->InYoungGeneration()) return SKIP_WRITE_BARRIER;
  return UPDATE_WRITE_BARRIER;
}

inline bool ObjectInYoungGeneration(Object object) {
  // TODO(rong): Fix caller of this function when we deploy
  // v8_use_third_party_heap.
  if (FLAG_single_generation) return false;
  if (object.IsSmi()) return false;
  return heap_internals::MemoryChunk::FromHeapObject(HeapObject::cast(object))
      ->InYoungGeneration();
}

inline bool IsReadOnlyHeapObject(HeapObject object) {
  if (V8_ENABLE_THIRD_PARTY_HEAP_BOOL) return ReadOnlyHeap::Contains(object);
  heap_internals::MemoryChunk* chunk =
      heap_internals::MemoryChunk::FromHeapObject(object);
  return chunk->InReadOnlySpace();
}

base::Optional<Heap*> WriteBarrier::GetHeapIfMarking(HeapObject object) {
  if (V8_ENABLE_THIRD_PARTY_HEAP_BOOL) return {};
  heap_internals::MemoryChunk* chunk =
      heap_internals::MemoryChunk::FromHeapObject(object);
  if (!chunk->IsMarking()) return {};
  return chunk->GetHeap();
}

void WriteBarrier::Marking(HeapObject host, ObjectSlot slot, Object value) {
  DCHECK(!HasWeakHeapObjectTag(value));
  if (!value.IsHeapObject()) return;
  Marking(host, HeapObjectSlot(slot), HeapObject::cast(value));
}

void WriteBarrier::Marking(HeapObject host, MaybeObjectSlot slot,
                           MaybeObject value) {
  HeapObject value_heap_object;
  if (!value->GetHeapObject(&value_heap_object)) return;
  Marking(host, HeapObjectSlot(slot), value_heap_object);
}

void WriteBarrier::Marking(HeapObject host, HeapObjectSlot slot,
                           HeapObject value) {
  auto heap = GetHeapIfMarking(host);
  if (!heap) return;
  MarkingSlow(*heap, host, slot, value);
}

void WriteBarrier::Marking(Code host, RelocInfo* reloc_info, HeapObject value) {
  auto heap = GetHeapIfMarking(host);
  if (!heap) return;
  MarkingSlow(*heap, host, reloc_info, value);
}

void WriteBarrier::Marking(JSArrayBuffer host,
                           ArrayBufferExtension* extension) {
  if (!extension) return;
  auto heap = GetHeapIfMarking(host);
  if (!heap) return;
  MarkingSlow(*heap, host, extension);
}

void WriteBarrier::Marking(DescriptorArray descriptor_array,
                           int number_of_own_descriptors) {
  auto heap = GetHeapIfMarking(descriptor_array);
  if (!heap) return;
  MarkingSlow(*heap, descriptor_array, number_of_own_descriptors);
}

}  // namespace internal
}  // namespace v8

#endif  // V8_HEAP_HEAP_WRITE_BARRIER_INL_H_


text:
<?php
namespace app\core\frontend;

use yii;
use app\core\base\BaseController;

class BaseFrontendController extends BaseController{

}


text:
import copy
import time
import json
from threading import Thread
from flask import Flask, render_template, session, request, flash
from flask.ext.socketio import SocketIO, emit, join_room, leave_room, close_room, disconnect

from mongoengine import *
from models.models import *

app = Flask(__name__)
app.debug = True
app.config['SECRET_KEY'] = 'B3ac0nStr33t'
socketio = SocketIO(app)
thread = None

connect('Beaconor')

'''
TODO: break out all the config into a separate file/s for local, staging, and deployment versions
as well as making a deployment script
'''

'''
def background_thread():
    # Example of how to send server generated events to clients.
    count = 0
'''

@app.route('/')
def index():
    '''
    global thread
    if thread is None:
        thread = Thread(target=background_thread)
        thread.start()
    '''
    return render_template('index.html')

@app.route('/apiX', methods = ['POST', 'GET'])
def apiX():

    x = request.form['X']
    socketio.emit('response',
         {'data': x, 'count': 0}, namespace='/beaconsim')
    return str(x)

@app.route('/api', methods = ['POST', 'GET'])
def api():

    #print 'BULBS'
    #print request.data

    requestObj = json.loads( request.data )

    dataBulbs = requestObj['bulbs']
    #print 'BULBS'
    #print request.form['bulbs'][0]['color']['r']
    beaconFeed = BeaconFeed.objects(title='beacon0').first()

    for dBulb in dataBulbs:
        beaconFeed.bulbs[dBulb['id']].color.r = dBulb['color']['r']
        beaconFeed.bulbs[dBulb['id']].color.g = dBulb['color']['g']
        beaconFeed.bulbs[dBulb['id']].color.b = dBulb['color']['b']

    beaconFeed.save()

    #flash(beaconFeed.to_json())

    beaconFeedJSON = json.loads( beaconFeed.to_json() )

    socketio.emit('bulbUpdate',
         {'data': beaconFeedJSON, 'count': 0}, namespace='/beaconsim')

    returnObj = {'success':True}

    return json.dumps(returnObj)

@app.route('/test', methods = ['POST', 'GET'])
def test():

    beaconFeed = BeaconFeed(title='beacon0')
    beaconFeed.save()
    return beaconFeed.to_json()

@socketio.on('requestState', namespace='/beaconsim')
def requestState(message):
    session['receive_count'] = session.get('receive_count', 0) + 1
    feedName = message['data']['feedName']
    beaconFeed = BeaconFeed.objects(title=feedName)[0]

    beaconFeedJSON = json.loads( beaconFeed.to_json() )

    #socketio.emit('bulbUpdate', {'data': beaconFeedJSON, 'count': 0}, namespace='/beaconsim')

    return {'data': beaconFeedJSON, 'count': 0}

'''
@socketio.on('my broadcast event', namespace='/beaconsim')
def test_broadcast_message(message):
    session['receive_count'] = session.get('receive_count', 0) + 1
    emit('response',
         {'data': message['data'], 'count': session['receive_count']},
         broadcast=True)

@socketio.on('leave', namespace='/beaconsim')
def leave(message):
    leave_room(message['room'])
    session['receive_count'] = session.get('receive_count', 0) + 1
    emit('response',
         {'data': 'In rooms: ' + ', '.join(request.namespace.rooms),
          'count': session['receive_count']})

@socketio.on('close room', namespace='/beaconsim')
def close(message):
    session['receive_count'] = session.get('receive_count', 0) + 1
    emit('response', {'data': 'Room ' + message['room'] + ' is closing.',
                         'count': session['receive_count']},
         room=message['room'])
    close_room(message['room'])

@socketio.on('my room event', namespace='/beaconsim')
def send_room_message(message):
    session['receive_count'] = session.get('receive_count', 0) + 1
    emit('response',
         {'data': message['data'], 'count': session['receive_count']},
         room=message['room'])
'''

@socketio.on('disconnect request', namespace='/beaconsim')
def disconnect_request():
    session['receive_count'] = session.get('receive_count', 0) + 1
    emit('response',
         {'data': 'Disconnected!', 'count': session['receive_count']})
    disconnect()

@socketio.on('connect', namespace='/beaconsim')
def test_connect():
    emit('response', {'data': 'Connected', 'count': 0})

@socketio.on('disconnect', namespace='/beaconsim')
def test_disconnect():
    print('Client disconnected')

if __name__ == '__main__':
    # for localhost:port only
    #socketio.run(app, port=5005)
    # for use on local network
    socketio.run(app, host='0.0.0.0', port=5005)


text:
<?xml version="1.0" ?>

<container xmlns="http://symfony.com/schema/dic/services"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">

    <services>
        <service id="puli.twig.extension" class="Puli\TwigExtension\PuliExtension" public="false">
            <argument type="service" id="puli.repository" />
            <argument type="service" id="puli.url_generator" />
            <argument>true</argument>
            <tag name="twig.extension" />
        </service>

        <service id="puli.twig.template_loader" class="Puli\TwigExtension\PuliTemplateLoader" public="false">
            <argument type="service" id="puli.repository" />
            <tag name="twig.loader"/>
        </service>

        <service id="puli.twig.cache_warmer" class="Puli\TwigExtension\CacheWarmer\TwigTemplateCacheWarmer" public="false">
            <argument type="service" id="puli.repository" />
            <argument type="service" id="twig" />
            <tag name="kernel.cache_warmer" />
        </service>
    </services>
</container>


text:
<!DOCTYPE HTML>

        <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"/>

        <link href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.2.2/css/bootstrap-combined.min.css" rel="stylesheet">
        <link href="http://twitter.github.com/bootstrap/assets/js/google-code-prettify/prettify.css" rel="stylesheet" />
        <link href="css/main.css" type="text/css" rel="stylesheet" />

        <title>touchSwipe</title>

property: allowPageScroll

You can set how page scrolling is handled by the browser when the user is interacting with a touchSwipe object.

There are 4 possible settings for the allowPageScroll option. These can be strings, or use the plugin constants in $.fn.swipe.pageScroll

auto or $.fn.swipe.pageScroll.AUTO
scrolling will only occur if a user swipes in a direction for which you have NOT defined a swipe handler. E.g If only swipeLeft is defined, then a RIGHT, UP or DOWN swipe would cause the page to scroll.

none or $.fn.swipe.pageScroll.NONE
scrolling will never occur.

horizontal or $.fn.swipe.pageScroll.HORIZONTAL
horizontal swipes will cause the page to scroll.

vertical or $.fn.swipe.pageScroll.VERTICAL
vertical swipes will cause the page to scroll.

					NOTE: if the general swipe or swipeStatus handlers are specificed, then allowPageScroll will be dissabled by default, as they detect swipes in all directions.
					To use scrolling AND the swipe handler, set allowPageScroll to the direction you want the user to be able to scroll.

			<button class='btn btn-small btn-info example_btn'>Jump to Example</button>

			allowPageScroll = "auto" or $.fn.swipe.pageScroll.AUTO

Swipe Left or Right The swipe will trigger but the page will NOT scroll.

Swipe Up or Down The page will scroll as there is no up or down swipe handler.

Swipe me

			allowPageScroll = "none" or $.fn.swipe.pageScroll.NONE

Swipe Left The swipe will trigger but the page will NOT scroll.

Swipe right, Up or Down No swipe handler is defined, so nothihng happens and the page will NOT scroll.

Swipe me

			allowPageScroll = "horizontal" or $.fn.swipe.pageScroll.HORIZONTAL

Swipe left and right are triggered

Swipe me

			allowPageScroll = "vertical" or $.fn.swipe.pageScroll.VERTICAL

			With the general swipe or swipeStatus handlers

These enable all 4 directions, but here we have set allowPageScroll to "vertical" so the user can scroll up and down, and swipe left and right with the general swipe handler.

Note how the vertical swipe is hit and miss. As soon as the page starts scrolling, the user is no longer swiping across the object.

Swipe me

			allowPageScroll = "vertical" or $.fn.swipe.pageScroll.HORIZONTAL

			Vertical, but WITH the general swipe or swipeStatus handlers

These enable all 4 directions, but here we have set allowPageScroll to "vertical" so the user can scroll up and down, and swipe left and right with the general swipe handler.

Note how the vertical swipe is hit and miss. As soon as the page starts scrolling, the user is no longer swiping across the object.

Swipe me


text:
<?php

namespace Drupal\Tests\rest\Functional\EntityResource\ImageStyle;

use Drupal\Tests\rest\Functional\CookieResourceTestTrait;

/**
 * @group rest
 */
class ImageStyleJsonCookieTest extends ImageStyleResourceTestBase {

  use CookieResourceTestTrait;

  /**
   * {@inheritdoc}
   */
  protected static $format = 'json';

  /**
   * {@inheritdoc}
   */
  protected static $mimeType = 'application/json';

  /**
   * {@inheritdoc}
   */
  protected static $auth = 'cookie';

}


text:
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System;
using System.Collections.Immutable;
using System.Diagnostics.CodeAnalysis;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.CodeActions;
using Microsoft.CodeAnalysis.CodeFixes;
using Microsoft.CodeAnalysis.Editing;
using Microsoft.CodeAnalysis.Shared.Extensions;

namespace Microsoft.CodeAnalysis.MakeClassAbstract
{
    internal abstract class AbstractMakeClassAbstractCodeFixProvider<TClassDeclarationSyntax> : SyntaxEditorBasedCodeFixProvider
        where TClassDeclarationSyntax : SyntaxNode
    {
        protected abstract bool IsValidRefactoringContext(SyntaxNode? node, [NotNullWhen(true)] out TClassDeclarationSyntax? classDeclaration);

        internal sealed override CodeFixCategory CodeFixCategory => CodeFixCategory.Compile;

        public sealed override Task RegisterCodeFixesAsync(CodeFixContext context)
        {
            if (IsValidRefactoringContext(context.Diagnostics[0].Location?.FindNode(context.CancellationToken), out _))
            {
                context.RegisterCodeFix(
                    new MyCodeAction(c => FixAsync(context.Document, context.Diagnostics[0], c)),
                    context.Diagnostics);
            }

            return Task.CompletedTask;
        }

        protected sealed override Task FixAllAsync(Document document, ImmutableArray<Diagnostic> diagnostics, SyntaxEditor editor,
            CancellationToken cancellationToken)
        {
            for (var i = 0; i < diagnostics.Length; i++)
            {
                if (IsValidRefactoringContext(diagnostics[i].Location?.FindNode(cancellationToken), out var classDeclaration))
                {
                    editor.ReplaceNode(classDeclaration,
                        (currentClassDeclaration, generator) => generator.WithModifiers(currentClassDeclaration, DeclarationModifiers.Abstract));
                }
            }

            return Task.CompletedTask;
        }

        private class MyCodeAction : CodeAction.DocumentChangeAction
        {
            public MyCodeAction(Func<CancellationToken, Task<Document>> createChangedDocument)
                : base(FeaturesResources.Make_class_abstract, createChangedDocument, FeaturesResources.Make_class_abstract)
            {
            }
        }
    }
}


text: function add(a,b){return a+b;}


text:
require 'narray'

module ObjectTable::Column

  def self.length_of(array)
    case array
    when Array then array.length
    when NArray then (array.shape.last or 0)
    else nil
    end
  end

  def self.stack(*columns); _stack(columns); end

  def self._stack(columns)
    columns = columns.reject(&:empty?)
    return NArray[] if columns.empty?
    return columns[0].clone if columns.length == 1

    if columns.map{|x| x.shape}.uniq.length == 1
      new_col = NArray.to_na(columns)
      new_col = new_col.reshape(*new_col.shape[0...-2], new_col.shape[-2] * new_col.shape[-1])
      return new_col
    end

    new_rows = columns.map{|x| x.shape[-1]}.reduce(:+)
    first_col = columns.first
    new_col = NArray.new(first_col.typecode, *first_col.shape[0...-1], new_rows)

    columns.reduce(0) do |row, col|
      end_row = row + col.shape[-1]
      new_col[false, row ... end_row] = col
      end_row
    end

    new_col
  end

end


text:
/**
 * Definition of TreeNode:
 * class TreeNode {
 * public:
 *     int val;
 *     TreeNode *left, *right;
 *     TreeNode(int val) {
 *         this->val = val;
 *         this->left = this->right = NULL;
 *     }
 * }
 */
class Solution {
public:
    /**
     * @param root: a TreeNode, the root of the binary tree
     * @return: nothing
     */
    void invertBinaryTree(TreeNode *root) {
        // write your code here
		if (NULL == root) {
			return;
		}
		invertBinaryTree(root->left);
		invertBinaryTree(root->right);
		TreeNode *temp = root->left;
		root->left = root->right;
		root->right = temp;
    }
};


text:
var expect = chai.expect;
var called;

// XXX: super lame hack

page('/', function(){
  called = true;
})

describe('page', function(){
  describe('on page load', function(){
    it('should invoke the matching callback', function(){
      expect(called).to.equal(true);
    })
  })

  describe('ctx.querystring', function(){
    it('should default to ""', function(done){
      page('/querystring-default', function(ctx){
        expect(ctx.querystring).to.equal('');
        done();
      });

      page('/querystring-default');
    })

    it('should expose the query string', function(done){
      page('/querystring', function(ctx){
        expect(ctx.querystring).to.equal('hello=there');
        done();
      });

      page('/querystring?hello=there');
    })
  })

  describe('ctx.pathname', function(){
    it('should default to ctx.path', function(done){
      page('/pathname-default', function(ctx){
        expect(ctx.pathname).to.equal('/pathname-default');
        done();
      });

      page('/pathname-default');
    })

    it('should omit the query string', function(done){
      page('/pathname', function(ctx){
        expect(ctx.pathname).to.equal('/pathname');
        done();
      });

      page('/pathname?hello=there');
    })
  })

  describe('dispatcher', function(){
    it('should ignore query strings', function(done){
      page('/qs', function(ctx){
        done();
      });

      page('/qs?test=true');
    })

    it('should ignore query strings with params', function(done){
      page('/qs/:name', function(ctx){
        expect(ctx.params.name).to.equal('tobi');
        done();
      });

      page('/qs/tobi?test=true');
    })

    it('should invoke the matching callback', function(done){
      page('/user/:name', function(ctx){
        done();
      })

      page('/user/tj');
    })

    it('should populate ctx.params', function(done){
      page('/blog/post/:name', function(ctx){
        expect(ctx.params.name).to.equal('something');
        done();
      })

      page('/blog/post/something');
    })

    describe('when next() is invoked', function(){
      it('should invoke subsequent matching middleware', function(done){
        page('/forum/*', function(ctx, next){
          ctx.fullPath = ctx.params[0];
          next();
        });

        page('/user', function(){

        });

        page('/forum/:fid/thread/:tid', function(ctx){
          expect(ctx.fullPath).to.equal('1/thread/2');
          expect(ctx.params.tid).to.equal('2');
          done();
        });

        page('/forum/1/thread/2');
      })
    })
  })

  after(function(){
    page('/');
  })
})

page();


text:
package hudson.logging;

import hudson.FeedAdapter;
import hudson.Functions;
import hudson.init.Initializer;
import static hudson.init.InitMilestone.PLUGINS_PREPARED;
import hudson.model.AbstractModelObject;
import jenkins.model.Jenkins;
import hudson.model.RSS;
import hudson.util.CopyOnWriteMap;
import jenkins.model.JenkinsLocationConfiguration;
import jenkins.model.ModelObjectWithChildren;
import jenkins.model.ModelObjectWithContextMenu.ContextMenu;
import org.apache.commons.io.filefilter.WildcardFileFilter;
import org.kohsuke.stapler.QueryParameter;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerResponse;
import org.kohsuke.stapler.HttpResponse;
import org.kohsuke.stapler.HttpRedirect;
import org.kohsuke.stapler.interceptor.RequirePOST;

import javax.servlet.ServletException;
import java.io.File;
import java.io.FileFilter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.LogRecord;
import java.util.logging.Logger;

/**
 * Owner of {@link LogRecorder}s, bound to "/log".
 *
 * @author Kohsuke Kawaguchi
 */
public class LogRecorderManager extends AbstractModelObject implements ModelObjectWithChildren {
    /**
     * {@link LogRecorder}s keyed by their {@linkplain LogRecorder#name name}.
     */
    public transient final Map<String,LogRecorder> logRecorders = new CopyOnWriteMap.Tree<String,LogRecorder>();

    public String getDisplayName() {
        return Messages.LogRecorderManager_DisplayName();
    }

    public String getSearchUrl() {
        return "/log";
    }

    public LogRecorder getDynamic(String token) {
        return getLogRecorder(token);
    }

    public LogRecorder getLogRecorder(String token) {
        return logRecorders.get(token);
    }

    static File configDir() {
        return new File(Jenkins.getInstance().getRootDir(), "log");
    }

    /**
     * Loads the configuration from disk.
     */
    public void load() throws IOException {
        logRecorders.clear();
        File dir = configDir();
        File[] files = dir.listFiles((FileFilter)new WildcardFileFilter("*.xml"));
        if(files==null)     return;
        for (File child : files) {
            String name = child.getName();
            name = name.substring(0,name.length()-4);   // cut off ".xml"
            LogRecorder lr = new LogRecorder(name);
            lr.load();
            logRecorders.put(name,lr);
        }
    }

    /**
     * Creates a new log recorder.
     */
    @RequirePOST
    public HttpResponse doNewLogRecorder(@QueryParameter String name) {
        Jenkins.checkGoodName(name);

        logRecorders.put(name,new LogRecorder(name));

        // redirect to the config screen
        return new HttpRedirect(name+"/configure");
    }

    public ContextMenu doChildrenContextMenu(StaplerRequest request, StaplerResponse response) throws Exception {
        ContextMenu menu = new ContextMenu();
        menu.add("all","All Jenkins Logs");
        for (LogRecorder lr : logRecorders.values()) {
            menu.add(lr.getSearchUrl(), lr.getDisplayName());
        }
        return menu;
    }

    /**
     * Configure the logging level.
     */
    @edu.umd.cs.findbugs.annotations.SuppressWarnings("LG_LOST_LOGGER_DUE_TO_WEAK_REFERENCE")
    public HttpResponse doConfigLogger(@QueryParameter String name, @QueryParameter String level) {
        Jenkins.getInstance().checkPermission(Jenkins.ADMINISTER);
        Level lv;
        if(level.equals("inherit"))
            lv = null;
        else
            lv = Level.parse(level.toUpperCase(Locale.ENGLISH));
        Logger.getLogger(name).setLevel(lv);
        return new HttpRedirect("levels");
    }

    /**
     * RSS feed for log entries.
     */
    public void doRss( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException {
        doRss(req, rsp, Jenkins.logRecords);
    }

    /**
     * Renders the given log recorders as RSS.
     */
    /*package*/ static void doRss(StaplerRequest req, StaplerResponse rsp, List<LogRecord> logs) throws IOException, ServletException {
        // filter log records based on the log level
        String level = req.getParameter("level");
        if(level!=null) {
            Level threshold = Level.parse(level);
            List<LogRecord> filtered = new ArrayList<LogRecord>();
            for (LogRecord r : logs) {
                if(r.getLevel().intValue() >= threshold.intValue())
                    filtered.add(r);
            }
            logs = filtered;
        }

        RSS.forwardToRss("Hudson log","", logs, new FeedAdapter<LogRecord>() {
            public String getEntryTitle(LogRecord entry) {
                return entry.getMessage();
            }

            public String getEntryUrl(LogRecord entry) {
                return "log";   // TODO: one URL for one log entry?
            }

            public String getEntryID(LogRecord entry) {
                return String.valueOf(entry.getSequenceNumber());
            }

            public String getEntryDescription(LogRecord entry) {
                return Functions.printLogRecord(entry);
            }

            public Calendar getEntryTimestamp(LogRecord entry) {
                GregorianCalendar cal = new GregorianCalendar();
                cal.setTimeInMillis(entry.getMillis());
                return cal;
            }

            public String getEntryAuthor(LogRecord entry) {
                return JenkinsLocationConfiguration.get().getAdminAddress();
            }
        },req,rsp);
    }

    @Initializer(before=PLUGINS_PREPARED)
    public static void init(Jenkins h) throws IOException {
        h.getLog().load();
    }
}


text:
using System;
using System.Collections.Generic;
using System.Text;
using System.Reflection;
using System.Diagnostics;
using System.Collections;
using System.IO;
using System.Xml;
using System.Xml.Schema;
using Common;
using System.Collections.ObjectModel;
using System.Security;

namespace Randoop
{

    /// <summary>
    /// An exploring egine that randomly explores the plan space in its exploration context.
    /// </summary>
    public class RandomExplorer //: ExplorationContext
    {

        /// <summary>
        /// Parsed user-supplied arguments.
        /// </summary>
        //UserParams fuserParams;

        public long startTime;

        private IReflectionFilter filter;

        private int arrayMaxSize;

        private StatsManager stats;

        private ActionSet actions;

        #region Data structures for fair Randoop

        //set of types that have at least one method active
        Dictionary<Type, bool> activeTypes = new Dictionary<Type, bool>();
        //the set of active methods for each type
        Dictionary<Type, List<MemberInfo>> activeMembers = new Dictionary<Type, List<MemberInfo>>();

        //there are builder plans that generate objects of this type
        Dictionary<Type, bool> typesWithObjects = new Dictionary<Type, bool>();

        //map from each member (method or constructor) to the set of argument types with no objects (dynamic map)
        Dictionary<MemberInfo, List<Type>> member2pendingTypes = new Dictionary<MemberInfo, List<Type>>();
        //maps each type to the set of methods that depend on an object of the type (Static map)
        Dictionary<Type, List<MemberInfo>> type2pendingMembers = new Dictionary<Type, List<MemberInfo>>();

        //temporary hack to redirect the stats dmp to a file, from the std output
        static TextWriter fairOptLog = null;

        #endregion

        /// <summary>
        /// Initializes all the components of the explorer.
        /// </summary>
        /// <param name="userParams"></param>
        public RandomExplorer(Collection<Type> types, IReflectionFilter filter, bool exceptionLearning,
            int randomSeed, int arrayMaxSize, StatsManager stats, ActionSet actions)
        //: base(types, filter)
        {
            this.actions = actions;
            this.filter = filter;
            this.arrayMaxSize = arrayMaxSize;
            this.stats = stats;
        }

        /// <summary>
        /// Note that Explore can silently fail (exits with 1), if a second chance AV happens
        /// </summary>
        /// <param name="timer"></param>
        /// <param name="planManager"></param>
        /// <param name="methodWeigthing"></param>
        /// <param name="forbidNull"></param>
        /// <param name="mutateFields"></param>
        public void Explore(ITimer timer, PlanManager planManager, MethodWeighing methodWeigthing,
            bool forbidNull, bool mutateFields, bool fairOpt)
        {
            int currentPlans = planManager.Plans;
            int currentRedundantAdds = planManager.RedundantAdds;

            // Start timing test generation.
            Timer.QueryPerformanceCounter(ref TimeTracking.generationStartTime);

            //exercise the fair option
            if (fairOpt)
            {
                Console.WriteLine("Using the fair option ....");

                //fairOptLog = new StreamWriter("Randoop.fairopt.log");

                //compute the initial working set and the active methods for each class
                InitializeActiveMemberAndDependency(planManager);

                for (; ; )
                {

                    //field setting
                    if (mutateFields && this.actions.fieldList.Count > 0 && Common.Enviroment.Random.Next(2) == 0)
                        NewFieldSettingPlan(this.actions.RandomField(), planManager, forbidNull);

                    //If the active set is recomputed from scratch
                    //InitializeActiveMemberAndDependency(planManager);

                    //copy the keys
                    Dictionary<Type, bool>.KeyCollection keys = new Dictionary<Type, bool>.KeyCollection(activeTypes);
                    List<Type> activeList = new List<Type>();
                    foreach (Type t in keys) activeList.Add(t);

                    RandoopPrintFairStats("Randoop.RandomExplore::Explore", "Starting a round of the fair workset algorithm with " + activeTypes.Count + "activeTypes");

                    foreach (Type t in activeList)
                    {
                        //pick up an active method of the type

                        MemberInfo m;

                        try
                        {
                            m = this.actions.RandomActiveMethodorConstructor(activeMembers, t);
                        }
                        catch (Exception e)
                        {
                            Console.WriteLine("Exception raised from RandomActiveMethodorConstructor is {0}", e.ToString());
                            continue;
                        }

                        //Console.WriteLine("Picked up method {0}::{1}", m.DeclaringType,m.Name );
                        int prevBuilderPlanCnt = planManager.builderPlans.NumPlans;

                        //Randoop step
                        ExploreMemberInternal(timer, planManager, forbidNull, m);

                        //need to know if the object creation was succesful, since we know the type
                        //we do it indirectly by looking at the builder plans
                        if (planManager.builderPlans.NumPlans > prevBuilderPlanCnt)
                        {
                            Type retType;
                            if (m is MethodInfo)
                            {
                                retType = (m as MethodInfo).ReturnType;
                            }
                            else if (m is ConstructorInfo)
                            {
                                retType = (m as ConstructorInfo).DeclaringType;
                            }
                            else
                            {
                                throw new RandoopBug("Constructor or Method expected");
                            }

                            //use the return type of the method/constructor to incrementally activate more methods/classes
                            try
                            {
                                UpdateActiveMethodsAndClasses(retType);
                            }
                            catch (Exception e) // had a nasty bug in the updateActiveMethodsAndClasses, so using try-catch
                            {
                                Console.WriteLine("Exception raised from UpdateActiveMethodsAndClasses is {0}", e.ToString());
                            }
                        }

                        if (timer.TimeToStop())
                        {
                            //get the size of # of active members
                            int size = 0;
                            foreach (KeyValuePair<Type, List<MemberInfo>> kv in activeMembers)
                            {
                                List<MemberInfo> l = kv.Value;
                                size = size + l.Count;
                            }

                            //stats printing
                            Console.WriteLine("Finishing the fair exploration...printing activity stats");
                            Console.WriteLine("Stats: <#ActiveTypes, #ActiveMembers, #BuilderPlans, #typesWithObjs> = <{0},{1},{2},{3}>",
                                activeTypes.Count, size, planManager.builderPlans.NumPlans, typesWithObjects.Count);
                            //fairOptLog.Close();

                            return;
                        }
                    }
                }
            }
            else
            {
                #region Old code for the Randoop exploration
                for (; ; )
                {

                    //field setting
                    if (mutateFields && this.actions.fieldList.Count > 0 && Common.Enviroment.Random.Next(2) == 0)
                        NewFieldSettingPlan(this.actions.RandomField(), planManager, forbidNull);

                    MemberInfo m;
                    if (methodWeigthing == MethodWeighing.RoundRobin)
                    {
                        m = this.actions.RandomMethodOrConstructorRoundRobin();
                    }
                    else if (methodWeigthing == MethodWeighing.Uniform)
                    {
                        m = this.actions.RandomMethodOrConstructorUniform();
                    }
                    else
                        throw new RandoopBug("Unrecognized method weighting option.");

                    ExploreMemberInternal(timer, planManager, forbidNull, m);

                    if (timer.TimeToStop())
                    {
                        // this computation gives us the activity stats for the non-fair option
                        InitializeActiveMemberAndDependency(planManager);
                        //get the size of # of active members
                        int size = 0;
                        foreach (KeyValuePair<Type, List<MemberInfo>> kv in activeMembers)
                        {
                            List<MemberInfo> l = kv.Value;
                            size = size + l.Count;
                        }

                        //stats printing
                        Console.WriteLine("Finishing the non-fair exploration...printing activity stats");
                        Console.WriteLine("Stats: <#ActiveTypes, #ActiveMembers, #BuilderPlans, #typesWithObjs> = <{0},{1},{2},{3}>",
                            activeTypes.Count, size, planManager.builderPlans.NumPlans, typesWithObjects.Count);
                        //fairOptLog.Close();

                        return;
                    }
                }
                #endregion
            }
        }

        /// <summary>
        /// Incrementally updates the pending set of types each method requires to be active
        /// Updates the set of active types and active members
        /// </summary>
        /// <param name="retType"></param>
        private void UpdateActiveMethodsAndClasses(Type retType)
        {
            //check if the type had ways to already create objects
            if (typesWithObjects.ContainsKey(retType)) return;

            typesWithObjects[retType] = true;

            List<MemberInfo> pendingMembers;
            type2pendingMembers.TryGetValue(retType, out pendingMembers);

            if (pendingMembers == null) return; // no one cares about this type

            RandoopPrintFairStats("UpdateActiveMethodsAndClasses", "Come to updateActiveMembers for <" +  retType + ">" + "with" + pendingMembers.Count + " size depMembers");

            foreach (MemberInfo mi in pendingMembers)
            {
                //remove retType from the list of pending types for this member
                List<Type> depTypes;
                member2pendingTypes.TryGetValue(mi, out depTypes);

                //Debug.Assert(depTypes != null);
                //Debug.Assert(depTypes.Contains(retType), "Invariant broken on the type2DependantMembers and memberPendingArgTypes");

                int size_prev = depTypes.Count;
                depTypes.Remove(retType);

                if (depTypes.Count == 0)
                {

                    //make the member and its declaring class active
                    if (!activeTypes.ContainsKey(mi.DeclaringType))
                    {
                        RandoopPrintFairStats("UpdateActiveMethodsAndClasses", "Adding to ActiveTypes:: with member <" + mi + ">  and type " + mi.DeclaringType);
                        activeTypes[mi.DeclaringType] = true;
                    }

                    List<MemberInfo> activeList;
                    activeMembers.TryGetValue(mi.DeclaringType, out activeList);

                    //Debug.Assert(!activeList.Contains(mi), "The member with a pending argument type can't already be active");
                    if (activeList == null)
                    {
                        activeList = new List<MemberInfo>();
                        activeList.Add(mi);
                    }
                    else
                    {
                        activeList.Add(mi);
                    }
                    activeMembers[mi.DeclaringType] = activeList;

                    //take it out of the memberPendingArgTypes
                    member2pendingTypes.Remove(mi);
                }
                else
                {
                    //do we really need this?
                    member2pendingTypes[mi] = depTypes;
                }

            }

            return;
        }

        /// <summary>
        /// Initializes the data structures for Active members, types, and the dependency of methods on types
        /// </summary>
        /// <param name="planManager"></param>
        ///
        ///
        private void InitializeActiveMemberAndDependency(PlanManager planManager)
        {

            //reset all the maps
            activeMembers.Clear();
            activeTypes.Clear();
            typesWithObjects.Clear();
            member2pendingTypes.Clear();
            type2pendingMembers.Clear();

            //get the set of types for which the builderPlans can create an object
            Dictionary<Plan, bool>.KeyCollection plans = planManager.builderPlans.planSet.Keys;
            //we simply look at the return type of the last method of each builder plan. This is sufficient
            //because any intermediate method in a plan will appear as the last method of some prefix plan
            //in the builder plan database
            foreach (Plan plan in plans)
            {
                Transformer tr = plan.transformer;
                Type t;

                if (tr is MethodCall)
                {
                    t = (tr as MethodCall).method.ReturnType;
                    typesWithObjects[t] = true;
                    RandoopPrintFairStats("InitializeActiveMemberDependency", "[Method]" + t.ToString() + " class is ACTIVE");
                }
                else if (tr is ConstructorCallTransformer)
                {
                    t = (tr as ConstructorCallTransformer).fconstructor.DeclaringType;
                    typesWithObjects[t] = true;
                    RandoopPrintFairStats("InitializeActiveMemberDependency", "[Constructor]" + t.ToString() + " class is ACTIVE");

                }
                else if (tr is PrimitiveValueTransformer) //for primitive values and string
                {
                    t = (tr as PrimitiveValueTransformer).ftype;
                    typesWithObjects[t] = true;
                    RandoopPrintFairStats("InitializeActiveMemberDependency", "[Constant]" + t.ToString() + " class is ACTIVE");
                }
                else
                {
                    //TODO: ignoring field setters and Array constructors
                }

            }

            //we are only going to try to activate the non-filtered types/methods only
            foreach (ConstructorInfo ci in actions.GetConstructors())
            {
                bool activeMember = true;
                ParameterInfo[] args = ci.GetParameters();
                //check if all the arguments can be provided an object
                for (int i = 0; i < args.Length; ++i)
                {
                    ParameterInfo pi = args[i];
                    if (!typesWithObjects.ContainsKey(pi.ParameterType))
                    {
                        RandoopPrintFairStats("InitializeActiveMemberAndDependency", "Can't find argument of type" + pi.ParameterType + "for constructor <" + ci.ToString() + ">");
                        activeMember = false;

                        //compute the dependency of method --> pending types
                        List<Type> output;
                        member2pendingTypes.TryGetValue(ci, out output);
                        if (output == null)
                        {
                            List<Type> l = new List<Type>();
                            l.Add(pi.ParameterType);
                            member2pendingTypes[ci] = l;
                        }
                        else if (!output.Contains(pi.ParameterType))
                        {
                            member2pendingTypes[ci].Add(pi.ParameterType);
                        }

                        //compute the dependency of type --> methods
                        List<MemberInfo> members;
                        type2pendingMembers.TryGetValue(pi.ParameterType, out members);
                        if (members == null)
                        {
                            List<MemberInfo> l = new List<MemberInfo>();
                            l.Add(ci);
                            type2pendingMembers[pi.ParameterType] = l;
                        }
                        else if (!members.Contains(ci))
                        {
                            type2pendingMembers[pi.ParameterType].Add(ci);
                        }

                    }
                }

                if (activeMember) // add it to the active member set and update active types
                {
                    Type ti = ci.DeclaringType;

                    List<MemberInfo> memberList;
                    activeMembers.TryGetValue(ti, out memberList);
                    if (memberList == null)
                    {
                        memberList = new List<MemberInfo>();
                        memberList.Add(ci);
                        activeMembers[ti] = memberList;
                    }
                    else
                    {
                        //there can't be any repeats
                        activeMembers[ti].Add(ci);
                    }

                    //activate the type
                    activeTypes[ti] = true;
                    RandoopPrintFairStats("InitializeActiveMemberAndDependency", "Adding <ActiveType, ActiveMember>: <" + ti.ToString() + "," + ci.ToString() + ">");

                }
            }

            foreach (MethodInfo mi in actions.GetMethods())
            {
                bool activeMember = true;

                //receiver is treated separately
                if (!typesWithObjects.ContainsKey(mi.DeclaringType))
                {

                    Type ti = mi.DeclaringType;

                    RandoopPrintFairStats("InitializeActiveMemberAndDependency", "Can't find argument of type" + ti + "for method <" + mi.ToString() + ">");

                    activeMember = false;

                    //compute the dependency of method --> pending types
                    List<Type> output;
                    member2pendingTypes.TryGetValue(mi, out output);
                    if (output == null)
                    {
                        List<Type> l = new List<Type>();
                        l.Add(ti);
                        member2pendingTypes[mi] = l;
                    }
                    else if (!output.Contains(ti))
                    {
                        member2pendingTypes[mi].Add(ti);
                    }

                    //compute the dependency of type --> methods
                    List<MemberInfo> memberList;
                    type2pendingMembers.TryGetValue(ti, out memberList);
                    if (memberList == null)
                    {
                        List<MemberInfo> l = new List<MemberInfo>();
                        l.Add(mi);
                        type2pendingMembers[ti] = l;
                    }
                    else if (!memberList.Contains(mi))
                    {
                        type2pendingMembers[ti].Add(mi);
                    }

                }

                //check if all the arguments can be provided an object
                ParameterInfo[] args = mi.GetParameters();
                for (int i = 0; i < args.Length; ++i)
                {
                    ParameterInfo pi = args[i];
                    if (!typesWithObjects.ContainsKey(pi.ParameterType))
                    {
                        RandoopPrintFairStats("InitializeActiveMemberAndDependency", "Can't find argument of type" + pi.ParameterType + "for method <" + mi.ToString() + ">");
                        activeMember = false;

                        //compute the dependency of method --> pending types
                        List<Type> output;
                        member2pendingTypes.TryGetValue(mi, out output);
                        if (output == null)
                        {
                            List<Type> l = new List<Type>();
                            l.Add(pi.ParameterType);
                            member2pendingTypes[mi] = l;
                        }
                        else if (!output.Contains(pi.ParameterType))
                        {
                            member2pendingTypes[mi].Add(pi.ParameterType);
                        }

                        //compute the dependency of type --> methods
                        List<MemberInfo> members;
                        type2pendingMembers.TryGetValue(pi.ParameterType, out members);
                        if (members == null)
                        {
                            List<MemberInfo> l = new List<MemberInfo>();
                            l.Add(mi);
                            type2pendingMembers[pi.ParameterType] = l;
                        }
                        else if (!members.Contains(mi))
                        {
                            type2pendingMembers[pi.ParameterType].Add(mi);
                        }

                    }
                }

                if (activeMember)
                {
                    Type ti = mi.DeclaringType;

                    List<MemberInfo> memberList;
                    activeMembers.TryGetValue(ti, out memberList);
                    if (memberList == null)
                    {
                        memberList = new List<MemberInfo>();
                        memberList.Add(mi);
                        activeMembers[ti] = memberList;
                    }
                    else
                    {
                        //there can't be any repeats
                        activeMembers[ti].Add(mi);
                    }

                    //activate the type
                    activeTypes[ti] = true;
                    RandoopPrintFairStats("InitializeActiveMemberAndDependency", "Adding <ActiveType, ActiveMember>: <" + ti.ToString() + "," + mi.ToString() + ">");

                }

            }
        }

        private static void RandoopPrintFairStats(string method, string s)
        {
#if PRINT_FAIR_RANDOOP_LOG
            Console.WriteLine("Method: {0} :: {1}", method, s);
#endif
            //fairOptLog.WriteLine("Method: {0} :: {1}", method, s);
            //fairOptLog.Flush();
        }

        private void ExploreMemberInternal(ITimer timer, PlanManager planManager, bool forbidNull,
            MemberInfo m)
        {
            Type[] sugg = GetParameterTypeSuggestions(m, planManager);

            if (m is ConstructorInfo)
            {
                NewConstructorPlan((m as ConstructorInfo).DeclaringType, m as ConstructorInfo, planManager,
                    forbidNull, sugg);
            }
            else
            {
                Util.Assert(m is MethodInfo);
                NewMethodPlan((m as MethodInfo).DeclaringType, m as MethodInfo, planManager, forbidNull, sugg);
            }
        }

        // For methods, it only picks receiver of type m.methodInfo.DeclaringType.
        private Type[] GetParameterTypeSuggestions(MemberInfo m, PlanManager planManager)
        {

            if (m is ConstructorInfo)
            {
                ConstructorInfo constructor = m as ConstructorInfo;
                ParameterInfo[] constructorParameters = constructor.GetParameters();

                Type[] constructorArgumentTypes = new Type[constructorParameters.Length];
                for (int i = 0; i < constructorParameters.Length; i++)
                    constructorArgumentTypes[i] = constructorParameters[i].ParameterType;

                return constructorArgumentTypes;
            }
            else
            {
                Util.Assert(m is MethodInfo);
                MethodInfo method = m as MethodInfo;
                ParameterInfo[] methodParameters = method.GetParameters();

                Type[] methodArgumentTypes = new Type[methodParameters.Length];
                for (int i = 0; i < methodParameters.Length; i++)
                    methodArgumentTypes[i] = methodParameters[i].ParameterType;

                Type[] oneResult = new Type[methodArgumentTypes.Length + 1];
                oneResult[0] = method.DeclaringType;
                Array.Copy(methodArgumentTypes, 0, oneResult, 1, methodArgumentTypes.Length);
                return oneResult;
            }
        }

        /// <summary>
        /// Tries to construct a new plan that calls a method on a
        /// receiver of the type given. May fail if there are no
        /// applicable methods or receivers available.
        /// </summary>
        /// <param name="type"></param>
        /// <param name="plan"></param>
        /// <returns></returns>
        private void NewMethodPlan(Type type, MethodInfo method, PlanManager planManager,
            bool forbidNull, Type[] methodArgumentTypes)
        {
            this.stats.Selected(MethodCall.Get(method).ToString());

            PlanFilter f;
            if (forbidNull)
            {
                f = delegate(Plan p, int i)
                {
                    if (!method.IsStatic && i == 0 && p.transformer is PrimitiveValueTransformer)
                        return false;

                    // Non-null heuristic
                    if (!methodArgumentTypes[i].IsValueType && (p.transformer is PrimitiveValueTransformer))
                        return false;

                    return true;
                };
            }
            else
            {
                f = delegate(Plan p, int i)
              {
                  if (!method.IsStatic && i == 0 && p.transformer is PrimitiveValueTransformer)
                      return false;
                  return true;
              };
            }

            RandomPlansResult r;
            if (!RandomPlans(out r, methodArgumentTypes, f, planManager.builderPlans, forbidNull, method))
            {
                stats.CreatedNew(CreationResult.NoInputs);
                return;
            }
            //Console.WriteLine("\t\t A plan has been created");

            Plan plan = new Plan(MethodCall.Get(method),
                r.fplans, r.fparameterChoosers);

            planManager.AddMaybeExecutingIfNeeded(plan, this.stats);
        }

        /// <summary>
        /// Tries to construct a new plan that calls a constructor
        /// of the type given. May fail if there are no
        /// applicable constructors.
        /// </summary>
        /// <param name="type"></param>
        /// <param name="plan"></param>
        /// <returns></returns>
        private void NewConstructorPlan(Type type, ConstructorInfo constructor, PlanManager planManager,
            bool forbidNull, Type[] constructorArgumentTypes)
        {
            this.stats.Selected(ConstructorCallTransformer.Get(constructor).ToString());

            PlanFilter f;
            if (forbidNull)
            {
                f = delegate(Plan p, int i)
                {
                    // Non-null heuristic
                    if (!constructorArgumentTypes[i].IsValueType && (p.transformer is PrimitiveValueTransformer))
                        return false;

                    return true;
                };
            }
            else
            {
                f = delegate(Plan p, int i)
              {
                  return true;
              };

            }

            RandomPlansResult r;
            if (!RandomPlans(out r, constructorArgumentTypes, f, planManager.builderPlans, forbidNull, null))
            {
                stats.CreatedNew(CreationResult.NoInputs);
                return;
            }
            Plan plan = new Plan(ConstructorCallTransformer.Get(constructor),
                r.fplans, r.fparameterChoosers);

            planManager.AddMaybeExecutingIfNeeded(plan, this.stats);
        }

        /// <summary>
        /// Tries to construct a new plan that sets a field for a
        /// receiver of the type given. May fail if there are no
        /// applicable receivers.
        /// </summary>
        /// <param name="type"></param>
        /// <param name="plan"></param>
        /// <returns></returns>
        private void NewFieldSettingPlan(FieldInfo field, PlanManager planManager, bool forbidNull)
        {
            this.stats.Selected(FieldSettingTransformer.Get(field).ToString());

            Type[] parameterTypes = new Type[2];
            parameterTypes[0] = field.DeclaringType;
            parameterTypes[1] = field.FieldType;

            RandomPlansResult r;
            if (!RandomPlans(out r, parameterTypes,
                delegate(Plan p, int i)
                {
                    if (i == 0 && p.transformer is PrimitiveValueTransformer)
                        return false;
                    return true;
                }, planManager.builderPlans, forbidNull, null))
            {
                stats.CreatedNew(CreationResult.NoInputs);
                return;
            }

            Plan plan = new Plan(FieldSettingTransformer.Get(field),
                r.fplans, r.fparameterChoosers);
            planManager.AddMaybeExecutingIfNeeded(plan, this.stats);
        }

        /// <summary>
        /// The result of calling method RandomPlans is an array fplans of plans
        /// and their corresponding parameter choosers.
        /// </summary>
        internal class RandomPlansResult
        {
            public readonly Plan[] fplans;
            public readonly Plan.ParameterChooser[] fparameterChoosers;

            public RandomPlansResult(Plan[] plans, Plan.ParameterChooser[] parameterMap)
            {
                this.fplans = plans;
                this.fparameterChoosers = parameterMap;
            }
        }

        private delegate bool PlanFilter(Plan p, int position);

        /// <summary>
        /// Selects random plans (from planDB) that yield results specified
        /// in typesDesired. Only consider plans for which filter returns true.
        /// </summary>
        private bool RandomPlans(out RandomPlansResult result, Type[] typesDesired, PlanFilter filter,
            PlanDataBase planDB, bool forbidNull, MethodInfo method)
        {
            List<Plan> plans = new List<Plan>();
            Plan.ParameterChooser[] parameterMap = new Plan.ParameterChooser[typesDesired.Length];

            for (int i = 0; i < typesDesired.Length; i++)
            {
                Type typeDesired = typesDesired[i];

                if (typeDesired.IsArray || typeDesired.Equals(typeof(ArrayList)))
                {
                    int randArrayLength = Common.Enviroment.Random.Next(this.arrayMaxSize + 1);

                    Transformer t;
                    Type baseType = null;
                    if (typeDesired.IsArray)
                    {
                        baseType = typeDesired.GetElementType();
                        t = ArrayBuilderTransformer.Get(baseType, randArrayLength);
                    }
                    else
                    {
                        baseType = typeof(object);
                        t = ArrayListBuilderTransformer.Get(typeof(object), randArrayLength);
                    }

                    RandomPlansResult arrayResult;

                    PlanFilter f;

                    if (forbidNull)
                    {
                        f = delegate(Plan p, int x)
                        {
                            // Non-null heuristic
                            if (baseType.IsValueType && (p.transformer is PrimitiveValueTransformer)
                                && (p.transformer as PrimitiveValueTransformer).IsNull)
                                return false;

                            return true;
                        };
                    }
                    else
                        f = delegate(Plan dontCareP, int dontCareInt) { return true; };

                    if (!RandomPlans(out arrayResult, t.ParameterTypes, f, planDB, forbidNull, null))
                    {
                        //Util.Warning("\tNo array plans for type " + typeDesired.Name + " created");
                        result = null;
                        return false;
                    }

                    plans.Add(new Plan(t, arrayResult.fplans, arrayResult.fparameterChoosers));
                    parameterMap[i] = new Plan.ParameterChooser(i, 0);

                }
                else
                {
                    // Types for which default plans are not created
                    // Don't want to create a plan for a value type which is just a type defn.
                    if (typeDesired.IsValueType && typeDesired.IsGenericTypeDefinition)
                    {
                        result = null; return false;
                    }

                    //Array.createInstance can't create arrays of these types
                    if (typeDesired.Name.Equals("TypedReference") ||
                        typeDesired.Name.Equals("ArgIterator") ||
                        typeDesired.Name.Equals("ByRef") ||
                        typeDesired.Name.Equals("RuntimeArgumentHandle"))
                    {
                        result = null;
                        return false;
                    }

                    if (typeDesired.IsPointer)
                    {
                        result = null;
                        return false;
                    }

                    Plan chosenplan;
                    if (i == 0 && method != null && method.IsStatic)
                    {
                        chosenplan = new Plan(DummyTransformer.Get(typeDesired), new Plan[0], new Randoop.Plan.ParameterChooser[0]);
                    }
                    else
                    {

                        chosenplan = planDB.RandomPlan(typeDesired);
                        if (chosenplan == null)
                        {
                            // No plans for type typeDesired created.
                            result = null;
                            return false;
                        }

                        if (!filter(chosenplan, i))
                        {
                            result = null;
                            return false;
                        }

                        // If plan represents "null" return false.
                        if (forbidNull && (chosenplan.transformer is PrimitiveValueTransformer)
                                       && (chosenplan.transformer as PrimitiveValueTransformer).IsNull)
                        {
                            result = null;
                            return false;
                        }

                    }
                    plans.Add(chosenplan);

                    Collection<int> possibleResultIndices = PossibleResultTupleIndices(chosenplan, typeDesired);
                    if (possibleResultIndices.Count == 0)
                    {
                        result = null;
                        return false;
                    }

                    parameterMap[i] =
                        new Plan.ParameterChooser(i, possibleResultIndices[Common.Enviroment.Random.Next(possibleResultIndices.Count)]);

                }
            }

            result = new RandomPlansResult(plans.ToArray(), parameterMap);
            return true;
        }

        private Collection<int> PossibleResultTupleIndices(Plan chosenplan, Type typeDesired)
        {
            // Now, figure out the result element that we'll pick from this plan.
            Collection<int> possibleResultIndices = new Collection<int>();
            for (int j = 0; j < chosenplan.transformer.TupleTypes.Length; j++)
            {
                Type resultType = chosenplan.transformer.TupleTypes[j];

                if (typeDesired.IsInterface)
                {
                    if (resultType.IsInterface && typeDesired.Equals(resultType))
                        possibleResultIndices.Add(j);
                    else
                    {
                        foreach (Type interfaceType in resultType.GetInterfaces())
                            if (interfaceType.Equals(typeDesired))
                            {
                                possibleResultIndices.Add(j);
                                break;
                            }
                    }
                }
                else
                {
                    if (resultType.Equals(typeDesired) || ReflectionUtils.IsSubclassOrEqual(resultType, typeDesired))
                        possibleResultIndices.Add(j);
                }
            }

            Util.Assert(possibleResultIndices.Count > 0);

            Collection<int> activePossible = new Collection<int>();
            foreach (int i in possibleResultIndices)
                if (chosenplan.IsActiveTupleElement(i))
                    activePossible.Add(i);

            //Util.Assert(activePossible.Count > 0);

            return activePossible;
        }
    }
}


text:
/*
Error: File to import not found or unreadable: true.
       Load path: /Users/eric/Sites/accoutrement/maps/test
        on line 4 of test.scss

1: // Arrow Tests
2: // ===========
3:
4: @import "true";
5:
6: // Test Module
7: // -----------
8:
9: @include test-module('Map Helpers') {

Backtrace:
test.scss:4
/Users/eric/Sites/.venvs/accoutrement/rubygems/gems/sass-3.4.8/lib/sass/tree/import_node.rb:66:in `rescue in import'
/Users/eric/Sites/.venvs/accoutrement/rubygems/gems/sass-3.4.8/lib/sass/tree/import_node.rb:45:in `import'
/Users/eric/Sites/.venvs/accoutrement/rubygems/gems/sass-3.4.8/lib/sass/tree/import_node.rb:28:in `imported_file'
/Users/eric/Sites/.venvs/accoutrement/rubygems/gems/sass-3.4.8/lib/sass/tree/import_node.rb:37:in `css_import?'
/Users/eric/Sites/.venvs/accoutrement/rubygems/gems/sass-3.4.8/lib/sass/tree/visitors/perform.rb:301:in `visit_import'
/Users/eric/Sites/.venvs/accoutrement/rubygems/gems/sass-3.4.8/lib/sass/tree/visitors/base.rb:36:in `visit'
/Users/eric/Sites/.venvs/accoutrement/rubygems/gems/sass-3.4.8/lib/sass/tree/visitors/perform.rb:158:in `block in visit'
/Users/eric/Sites/.venvs/accoutrement/rubygems/gems/sass-3.4.8/lib/sass/stack.rb:79:in `block in with_base'
/Users/eric/Sites/.venvs/accoutrement/rubygems/gems/sass-3.4.8/lib/sass/stack.rb:115:in `with_frame'
/Users/eric/Sites/.venvs/accoutrement/rubygems/gems/sass-3.4.8/lib/sass/stack.rb:79:in `with_base'
/Users/eric/Sites/.venvs/accoutrement/rubygems/gems/sass-3.4.8/lib/sass/tree/visitors/perform.rb:158:in `visit'
/Users/eric/Sites/.venvs/accoutrement/rubygems/gems/sass-3.4.8/lib/sass/tree/visitors/base.rb:52:in `block in visit_children'
/Users/eric/Sites/.venvs/accoutrement/rubygems/gems/sass-3.4.8/lib/sass/tree/visitors/base.rb:52:in `map'
/Users/eric/Sites/.venvs/accoutrement/rubygems/gems/sass-3.4.8/lib/sass/tree/visitors/base.rb:52:in `visit_children'
/Users/eric/Sites/.venvs/accoutrement/rubygems/gems/sass-3.4.8/lib/sass/tree/visitors/perform.rb:167:in `block in visit_children'
/Users/eric/Sites/.venvs/accoutrement/rubygems/gems/sass-3.4.8/lib/sass/tree/visitors/perform.rb:179:in `with_environment'
/Users/eric/Sites/.venvs/accoutrement/rubygems/gems/sass-3.4.8/lib/sass/tree/visitors/perform.rb:166:in `visit_children'
/Users/eric/Sites/.venvs/accoutrement/rubygems/gems/sass-3.4.8/lib/sass/tree/visitors/base.rb:36:in `block in visit'
/Users/eric/Sites/.venvs/accoutrement/rubygems/gems/sass-3.4.8/lib/sass/tree/visitors/perform.rb:186:in `visit_root'
/Users/eric/Sites/.venvs/accoutrement/rubygems/gems/sass-3.4.8/lib/sass/tree/visitors/base.rb:36:in `visit'
/Users/eric/Sites/.venvs/accoutrement/rubygems/gems/sass-3.4.8/lib/sass/tree/visitors/perform.rb:157:in `visit'
/Users/eric/Sites/.venvs/accoutrement/rubygems/gems/sass-3.4.8/lib/sass/tree/visitors/perform.rb:8:in `visit'
/Users/eric/Sites/.venvs/accoutrement/rubygems/gems/sass-3.4.8/lib/sass/tree/root_node.rb:36:in `css_tree'
/Users/eric/Sites/.venvs/accoutrement/rubygems/gems/sass-3.4.8/lib/sass/tree/root_node.rb:29:in `render_with_sourcemap'
/Users/eric/Sites/.venvs/accoutrement/rubygems/gems/sass-3.4.8/lib/sass/engine.rb:368:in `_render_with_sourcemap'
/Users/eric/Sites/.venvs/accoutrement/rubygems/gems/sass-3.4.8/lib/sass/engine.rb:285:in `render_with_sourcemap'
/Users/eric/Sites/.venvs/accoutrement/rubygems/gems/sass-3.4.8/lib/sass/exec/sass_scss.rb:396:in `run'
/Users/eric/Sites/.venvs/accoutrement/rubygems/gems/sass-3.4.8/lib/sass/exec/sass_scss.rb:62:in `process_result'
/Users/eric/Sites/.venvs/accoutrement/rubygems/gems/sass-3.4.8/lib/sass/exec/base.rb:52:in `parse'
/Users/eric/Sites/.venvs/accoutrement/rubygems/gems/sass-3.4.8/lib/sass/exec/base.rb:19:in `parse!'
/Users/eric/Sites/.venvs/accoutrement/rubygems/gems/sass-3.4.8/bin/sass:13:in `<top (required)>'
/Users/eric/Sites/.venvs/accoutrement/rubygems/bin/sass:23:in `load'
/Users/eric/Sites/.venvs/accoutrement/rubygems/bin/sass:23:in `<main>'
*/
body:before {
  white-space: pre;
  font-family: monospace;
  content: "Error: File to import not found or unreadable: true.\A        Load path: /Users/eric/Sites/accoutrement/maps/test\A         on line 4 of test.scss\A \A 1: // Arrow Tests\A 2: // ===========\A 3: \A 4: @import \"true\";\A 5: \A 6: // Test Module\A 7: // -----------\A 8: \A 9: @include test-module('Map Helpers') {"; }


text:
package com.stripe.example.activity;

import android.os.Bundle;
import android.support.v4.app.DialogFragment;
import android.support.v4.app.FragmentActivity;

import com.stripe.android.Stripe;
import com.stripe.android.TokenCallback;
import com.stripe.android.model.Card;
import com.stripe.android.model.Token;
import com.stripe.example.PaymentForm;
import com.stripe.example.R;
import com.stripe.example.TokenList;
import com.stripe.example.dialog.ErrorDialogFragment;
import com.stripe.example.dialog.ProgressDialogFragment;

public class PaymentActivity extends FragmentActivity {

    /*
     * Change this to your publishable key.
     *
     * You can get your key here: https://manage.stripe.com/account/apikeys
     */
    public static final String PUBLISHABLE_KEY = "pk_test_6YJWQTonUjyrlt4O4OvlMEv4";

    private ProgressDialogFragment progressFragment;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.payment_activity);

        progressFragment = ProgressDialogFragment.newInstance(R.string.progressMessage);
    }

    public void saveCreditCard(PaymentForm form) {

        Card card = new Card(
                form.getCardNumber(),
                form.getExpMonth(),
                form.getExpYear(),
                form.getCvc());
        card.setCurrency(form.getCurrency());

        boolean validation = card.validateCard();
        if (validation) {
            startProgress();
            new Stripe().createToken(
                    card,
                    PUBLISHABLE_KEY,
                    new TokenCallback() {
                    public void onSuccess(Token token) {
                        getTokenList().addToList(token);
                        finishProgress();
                        }
                    public void onError(Exception error) {
                            handleError(error.getLocalizedMessage());
                            finishProgress();
                        }
                    });
        } else if (!card.validateNumber()) {
        	handleError("The card number that you entered is invalid");
        } else if (!card.validateExpiryDate()) {
        	handleError("The expiration date that you entered is invalid");
        } else if (!card.validateCVC()) {
        	handleError("The CVC code that you entered is invalid");
        } else {
        	handleError("The card details that you entered are invalid");
        }
    }

    private void startProgress() {
        progressFragment.show(getSupportFragmentManager(), "progress");
    }

    private void finishProgress() {
        progressFragment.dismiss();
    }

    private void handleError(String error) {
        DialogFragment fragment = ErrorDialogFragment.newInstance(R.string.validationErrors, error);
        fragment.show(getSupportFragmentManager(), "error");
    }

    private TokenList getTokenList() {
        return (TokenList)(getSupportFragmentManager().findFragmentById(R.id.token_list));
    }
}


text:
package MIDIBlocks;

/**
 * Simple interface that defines things that tick
 *
 * @author Aidan
 *
 */
public interface Tickable {

    /**
     * Do something time based
     */
    public void tick();
}


text:
module.exports = function(grunt) {

  var obj = {};
  grunt.registerTask('finalize', 'Print all option values.', function() {
    console.log('###' + JSON.stringify(obj) + '###');
  });

  // Create a per-CLI-option task that stores the value of that option
  // to be output via the "finalize" task.
  Object.keys(grunt.cli.optlist).forEach(function(name) {
    grunt.registerTask(name, 'Store the current "' + name + '" option value.', function() {
      obj[this.name] = grunt.option(this.name);
    });
  });

  // Store the value of the `name` option to be output via
  // the "finalize" task.
  grunt.registerTask('print-option', function(name){
    obj[name] = grunt.option(name);
  });

};


text:
package com.mystore.common.persistence.jdbc.generator;

public class SqlGeneratorTest {

	public static void main(String[] args) {

		String tableName ="user";
		String where = "userId=?";
		String[] columns = new String[] { "userId", "userName" };
		InsertSqlGenerator insertSqlGenerator = new InsertSqlGenerator();
		out(insertSqlGenerator.gen(tableName, columns));
		SelectSqlGenerator selectSqlGenerator = new SelectSqlGenerator();
		out(selectSqlGenerator.gen(tableName, columns, where));
		UpdateSqlGenerator updateSqlGenerator = new UpdateSqlGenerator();
		out(updateSqlGenerator.gen(tableName, columns, where));
		DeleteSqlGenerator deleteSqlGenerator = new DeleteSqlGenerator();
		out(deleteSqlGenerator.gen(tableName, where));
	}

	public static void out(String outMsg) {
		System.out.println(outMsg);
	}
}


text:
import {bootstrap} from '@angular/platform-browser-dynamic';
import {AppComponent} from "./app.component";
import {LoggingService} from "./services/logging.service";

bootstrap(AppComponent, [LoggingService]);


text:
![](http://evil-icons.io/assets/images/social.png)

Free 'plug and play' set of SVG icons designed specifically for web projects. Available as a Node.js package or a Ruby gem (for Rails). Just use icon names with your templates and styles — and all the rest will be done automagically.

[evil-icons.io](http://evil-icons.io)

Made by [Alexander Madyankin] and [Roman Shamin].

[Alexander Madyankin]:  https://twitter.com/outpunk
[Roman Shamin]:         https://twitter.com/romanshamin

## Usage

### Rails

Add the `'evil_icons'` gem to your Gemfile:
```ruby
gem 'evil_icons'
```

Add the Evil Icons require to your `application.css`:
```css
//= require evil-icons
```

Next, you have to render the evil-icons sprite in your template (or, in your layout):
```erb
<%= evil_icons_sprite %>
```

Finally, you can render the icon using the `icon` helper.
Here are some examples:
```erb
<%= evil_icon 'ei-search' %>
<%= evil_icon 'ei-arrow-right', size: :m %>
<%= evil_icon 'ei-envelope', size: :l, class: "custom-class" %>
```

### Sinatra

Add the `'evil_icons'` gem to your Gemfile:
```ruby
gem 'evil_icons'
```
And require it:
```
require 'evil_icons'
```

Add the helpers to your application:
```ruby
helpers EvilIcons::Helpers
```

Next, you have to render the evil-icons sprite in your template (or, in your layout):
```erb
<%= evil_icons_sprite %>
```

Finally, you can render the icon using the `icon` helper.
Here are some examples:
```erb
<%= evil_icon 'ei-search' %>
<%= evil_icon 'ei-arrow-right', size: :m %>
<%= evil_icon 'ei-envelope', size: :l, class: "custom-class" %>
```

In order to use the stylesheets, you have to add Sprockets to your application.
Add `sinatra-asset-pipeline` to your Gemfile:
```ruby
gem 'sinatra-asset-pipeline'
```

And register it:
```ruby
require 'sinatra/asset_pipeline'
register Sinatra::AssetPipeline
```

Finally, add the evil icons require to your `application.css`:
```css
//= require evil-icons
```

Also, you can take a look at [example app] by [@aderyabin].
[example app]: https://github.com/aderyabin/evil_icons_sinatra_example/
[@aderyabin]: https://github.com/aderyabin

## npm

Add the `'evil-icons'` package to your project:
```bash
npm install evil-icons
```

Add the Evil Icons styles to your pages:
```html
<link rel="stylesheet" type="text/css" href="./node_modules/evil-icons/assets/css/evil-icons.css">
```

Require `evil-icons` in your JavaScript code:
```js
var icons = require("evil-icons")
```

Finally, you can render the icons in your page using helpers.
Here are some examples:
```js
/* A string with SVG sprite */
icons.sprite;

/* Icons rendering */
icons.icon("ei-search");
icons.icon("ei-arrow-right", {size: "m"});
icons.icon("ei-envelope", {size: "l", class: "custom-class"});
```

### Styling

Every icon has the `.icon` class and its modifier including the icon name. For example, the facebook icon has the `.icon--ei-facebook` modifier.

In addition, an icon may have a size modifier. But we do recommend to change the size using helper's `size` parameter instead. Evil Icons have some predefined sizes: `s` (25x25, default), `m` (50×50), `l` (100×100), `xl` (150×150) and `xxl` (200×200). You may want to add more sizes, we recommend to keep the sizes multiple to 25.
```js
icons.icon("ei-arrow-right", {size: "m"})
```

Also you may want to add a custom class for an icon.
You can do this using the `class` parameter:
```js
icons.icon("ei-envelope", {class: "custom-class"})
```

An icon's color can be changed in CSS:
```css
.icon {
  fill: green;
}
.icon--ei-facebook {
  fill: blue;
}
```

## Roadmap
* Custom icons
* Grunt plugin
* Gulp plugin
* Bower package
* CDN version
* More styles


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal">
    <TextView
        android:id="@+id/name"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:padding="5dp"
        android:layout_gravity="center_vertical"
        android:layout_weight="1"/>
    <Spinner
        android:id="@+id/value"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_weight="0"
        android:padding="5dp"
        android:singleLine="true"
        android:maxLines="1"
        />
</LinearLayout>