text:
#ifdef DARWIN
#ifndef IPHONE

#include "mach_override.h"

#include <mach-o/dyld.h>
#include <mach/mach_host.h>
#include <mach/mach_init.h>
#include <mach/vm_map.h>
#include <sys/mman.h>

#include <CoreServices/CoreServices.h>

/**************************
*
*	Constants
*
**************************/
#pragma mark	-
#pragma mark	(Constants)

#if defined(__ppc__) || defined(__POWERPC__)

long kIslandTemplate[] = {
	0x9001FFFC,	//	stw		r0,-4(SP)
	0x3C00DEAD,	//	lis		r0,0xDEAD
	0x6000BEEF,	//	ori		r0,r0,0xBEEF
	0x7C0903A6,	//	mtctr	r0
	0x8001FFFC,	//	lwz		r0,-4(SP)
	0x60000000,	//	nop		; optionally replaced
	0x4E800420 	//	bctr
};

#define kAddressHi			3
#define kAddressLo			5
#define kInstructionHi		10
#define kInstructionLo		11

#elif defined(__i386__) || defined(__x86_64__)

#define kOriginalInstructionsSize 16

char kIslandTemplate[] = {
	// kOriginalInstructionsSize nop instructions so that we
	// should have enough space to host original instructions
	0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90,
	0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90,
	// Now the real jump instruction
	0xE9, 0xEF, 0xBE, 0xAD, 0xDE
};

#define kInstructions	0
#define kJumpAddress    kInstructions + kOriginalInstructionsSize + 1
#endif

#define	kAllocateHigh		1
#define	kAllocateNormal		0

/**************************
*
*	Data Types
*
**************************/
#pragma mark	-
#pragma mark	(Data Types)

typedef	struct	{
	char	instructions[sizeof(kIslandTemplate)];
	int		allocatedHigh;
}	BranchIsland;

/**************************
*
*	Funky Protos
*
**************************/
#pragma mark	-
#pragma mark	(Funky Protos)

	mach_error_t
allocateBranchIsland(
		BranchIsland	**island,
		int				allocateHigh );

	mach_error_t
freeBranchIsland(
		BranchIsland	*island );

#if defined(__ppc__) || defined(__POWERPC__)
	mach_error_t
setBranchIslandTarget(
		BranchIsland	*island,
		const void		*branchTo,
		long			instruction );
#endif

#if defined(__i386__)
mach_error_t
setBranchIslandTarget_i386(
						   BranchIsland	*island,
						   const void		*branchTo,
						   char*			instructions );
void
atomic_mov64(
		uint64_t *targetAddress,
		uint64_t value );

	static Boolean
eatKnownInstructions(
	unsigned char	*code,
	uint64_t		*newInstruction,
	int				*howManyEaten,
	char			*originalInstructions );
#endif

/*******************************************************************************
*
*	Interface
*
*******************************************************************************/
#pragma mark	-
#pragma mark	(Interface)

	mach_error_t
mach_override(
		char *originalFunctionSymbolName,
		const char *originalFunctionLibraryNameHint,
		const void *overrideFunctionAddress,
		void **originalFunctionReentryIsland )
{
	assert( originalFunctionSymbolName );
	assert( strlen( originalFunctionSymbolName ) );
	assert( overrideFunctionAddress );

	//	Lookup the original function's code pointer.
	long	*originalFunctionPtr;
	if( originalFunctionLibraryNameHint )
		_dyld_lookup_and_bind_with_hint(
			originalFunctionSymbolName,
			originalFunctionLibraryNameHint,
			(void*) &originalFunctionPtr,
			NULL );
	else
		_dyld_lookup_and_bind(
			originalFunctionSymbolName,
			(void*) &originalFunctionPtr,
			NULL );

	return mach_override_ptr( originalFunctionPtr, overrideFunctionAddress,
		originalFunctionReentryIsland );
}

    mach_error_t
mach_override_ptr(
	void *originalFunctionAddress,
    const void *overrideFunctionAddress,
    void **originalFunctionReentryIsland )
{
	assert( originalFunctionAddress );
	assert( overrideFunctionAddress );

	long	*originalFunctionPtr = (long*) originalFunctionAddress;
	mach_error_t	err = err_none;

#if defined(__ppc__) || defined(__POWERPC__)
	//	Ensure first instruction isn't 'mfctr'.
	#define	kMFCTRMask			0xfc1fffff
	#define	kMFCTRInstruction	0x7c0903a6

	long	originalInstruction = *originalFunctionPtr;
	if( !err && ((originalInstruction & kMFCTRMask) == kMFCTRInstruction) )
		err = err_cannot_override;
#elif defined (__i386__)
	int eatenCount = 0;
	char originalInstructions[kOriginalInstructionsSize];
	uint64_t jumpRelativeInstruction = 0; // JMP

	Boolean overridePossible = eatKnownInstructions ((unsigned char *)originalFunctionPtr,
										&jumpRelativeInstruction, &eatenCount, originalInstructions);
	if (eatenCount > kOriginalInstructionsSize) {
		//printf ("Too many instructions eaten\n");
		overridePossible = false;
	}
	if (!overridePossible) err = err_cannot_override;
#endif

	//	Make the original function implementation writable.
	if( !err ) {
		err = vm_protect( mach_task_self(),
				(vm_address_t) originalFunctionPtr,
				sizeof(long), false, (VM_PROT_ALL | VM_PROT_COPY) );
		if( err )
			err = vm_protect( mach_task_self(),
					(vm_address_t) originalFunctionPtr, sizeof(long), false,
					(VM_PROT_DEFAULT | VM_PROT_COPY) );
	}

	//	Allocate and target the escape island to the overriding function.
	BranchIsland	*escapeIsland = NULL;
	if( !err )
		err = allocateBranchIsland( &escapeIsland, kAllocateHigh );

#if defined(__ppc__) || defined(__POWERPC__)
	if( !err )
		err = setBranchIslandTarget( escapeIsland, overrideFunctionAddress, 0 );

	//	Build the branch absolute instruction to the escape island.
	long	branchAbsoluteInstruction = 0; // Set to 0 just to silence warning.
	if( !err ) {
		long escapeIslandAddress = ((long) escapeIsland) & 0x3FFFFFF;
		branchAbsoluteInstruction = 0x48000002 | escapeIslandAddress;
	}
#elif defined (__i386__)
	if( !err )
		err = setBranchIslandTarget_i386( escapeIsland, overrideFunctionAddress, 0 );

	// Build the jump relative instruction to the escape island
	if (!err) {
		int32_t addressOffset = ((int32_t)escapeIsland - (int32_t)originalFunctionPtr - 5);
		addressOffset = OSSwapInt32(addressOffset);

		jumpRelativeInstruction |= 0xE900000000000000LL;
		jumpRelativeInstruction |= ((uint64_t)addressOffset & 0xffffffff) << 24;
		jumpRelativeInstruction = OSSwapInt64(jumpRelativeInstruction);
	}
#endif

	//	Optionally allocate & return the reentry island.
	BranchIsland	*reentryIsland = NULL;
	if( !err && originalFunctionReentryIsland ) {
		err = allocateBranchIsland( &reentryIsland, kAllocateNormal );
		if( !err )
			*originalFunctionReentryIsland = reentryIsland;
	}

#if defined(__ppc__) || defined(__POWERPC__)
	//	Atomically:
	//	o If the reentry island was allocated:
	//		o Insert the original instruction into the reentry island.
	//		o Target the reentry island at the 2nd instruction of the
	//		  original function.
	//	o Replace the original instruction with the branch absolute.
	if( !err ) {
		int escapeIslandEngaged = false;
		do {
			if( reentryIsland )
				err = setBranchIslandTarget( reentryIsland,
						(void*) (originalFunctionPtr+1), originalInstruction );
			if( !err ) {
				escapeIslandEngaged = CompareAndSwap( originalInstruction,
										branchAbsoluteInstruction,
										(UInt32*)originalFunctionPtr );
				if( !escapeIslandEngaged ) {
					//	Someone replaced the instruction out from under us,
					//	re-read the instruction, make sure it's still not
					//	'mfctr' and try again.
					originalInstruction = *originalFunctionPtr;
					if( (originalInstruction & kMFCTRMask) == kMFCTRInstruction)
						err = err_cannot_override;
				}
			}
		} while( !err && !escapeIslandEngaged );
	}
#elif defined (__i386__)
	// Atomically:
	//	o If the reentry island was allocated:
	//		o Insert the original instructions into the reentry island.
	//		o Target the reentry island at the first non-replaced
	//        instruction of the original function.
	//	o Replace the original first instructions with the jump relative.
	//
	// Note that on i386, we do not support someone else changing the code under our feet
	if ( !err ) {
		if( reentryIsland )
			err = setBranchIslandTarget_i386( reentryIsland,
										 (void*) ((char *)originalFunctionPtr+eatenCount), originalInstructions );
		if ( !err )
			atomic_mov64((uint64_t *)originalFunctionPtr, jumpRelativeInstruction);
	}
#endif

	//	Clean up on error.
	if( err ) {
		if( reentryIsland )
			freeBranchIsland( reentryIsland );
		if( escapeIsland )
			freeBranchIsland( escapeIsland );
	}

	return err;
}

/*******************************************************************************
*
*	Implementation
*
*******************************************************************************/
#pragma mark	-
#pragma mark	(Implementation)

/***************************************************************************//**
	Implementation: Allocates memory for a branch island.

	@param	island			<-	The allocated island.
	@param	allocateHigh	->	Whether to allocate the island at the end of the
								address space (for use with the branch absolute
								instruction).
	@result					<-	mach_error_t

	***************************************************************************/

	mach_error_t
allocateBranchIsland(
		BranchIsland	**island,
		int				allocateHigh )
{
	assert( island );

	mach_error_t	err = err_none;

	if( allocateHigh ) {
		vm_size_t pageSize;
		err = host_page_size( mach_host_self(), &pageSize );
		if( !err ) {
			assert( sizeof( BranchIsland ) <= pageSize );
			vm_address_t first = 0xfeffffff;
			vm_address_t last = 0xfe000000 + pageSize;
			vm_address_t page = first;
			int allocated = 0;
			vm_map_t task_self = mach_task_self();

			while( !err && !allocated && page != last ) {
				err = vm_allocate( task_self, &page, pageSize, 0 );
				if( err == err_none )
					allocated = 1;
				else if( err == KERN_NO_SPACE ) {
					page += pageSize;
					err = err_none;
				}
			}
			if( allocated )
				*island = (void*) page;
			else if( !allocated && !err )
				err = KERN_NO_SPACE;
		}
	} else {
		void *block = malloc( sizeof( BranchIsland ) );
		if( block )
			*island = block;
		else
			err = KERN_NO_SPACE;
	}
	if( !err )
		(**island).allocatedHigh = allocateHigh;

	return err;
}

/***************************************************************************//**
	Implementation: Deallocates memory for a branch island.

	@param	island	->	The island to deallocate.
	@result			<-	mach_error_t

	***************************************************************************/

	mach_error_t
freeBranchIsland(
		BranchIsland	*island )
{
	assert( island );
	assert( (*(long*)&island->instructions[0]) == kIslandTemplate[0] );
	assert( island->allocatedHigh );

	mach_error_t	err = err_none;

	if( island->allocatedHigh ) {
		vm_size_t pageSize;
		err = host_page_size( mach_host_self(), &pageSize );
		if( !err ) {
			assert( sizeof( BranchIsland ) <= pageSize );
			err = vm_deallocate(
					mach_task_self(),
					(vm_address_t) island, pageSize );
		}
	} else {
		free( island );
	}

	return err;
}

/***************************************************************************//**
	Implementation: Sets the branch island's target, with an optional
	instruction.

	@param	island		->	The branch island to insert target into.
	@param	branchTo	->	The address of the target.
	@param	instruction	->	Optional instruction to execute prior to branch. Set
							to zero for nop.
	@result				<-	mach_error_t

	***************************************************************************/
#if defined(__ppc__) || defined(__POWERPC__)
	mach_error_t
setBranchIslandTarget(
		BranchIsland	*island,
		const void		*branchTo,
		long			instruction )
{
	//	Copy over the template code.
    bcopy( kIslandTemplate, island->instructions, sizeof( kIslandTemplate ) );

    //	Fill in the address.
    ((short*)island->instructions)[kAddressLo] = ((long) branchTo) & 0x0000FFFF;
    ((short*)island->instructions)[kAddressHi]
    	= (((long) branchTo) >> 16) & 0x0000FFFF;

    //	Fill in the (optional) instuction.
    if( instruction != 0 ) {
        ((short*)island->instructions)[kInstructionLo]
        	= instruction & 0x0000FFFF;
        ((short*)island->instructions)[kInstructionHi]
        	= (instruction >> 16) & 0x0000FFFF;
    }

    //MakeDataExecutable( island->instructions, sizeof( kIslandTemplate ) );
	msync( island->instructions, sizeof( kIslandTemplate ), MS_INVALIDATE );

    return err_none;
}
#endif

#if defined(__i386__)
	mach_error_t
setBranchIslandTarget_i386(
	BranchIsland	*island,
	const void		*branchTo,
	char*			instructions )
{

	//	Copy over the template code.
    bcopy( kIslandTemplate, island->instructions, sizeof( kIslandTemplate ) );

	// copy original instructions
	if (instructions) {
		bcopy (instructions, island->instructions + kInstructions, kOriginalInstructionsSize);
	}

    //	Fill in the address.
	int32_t addressOffset = (char *)branchTo - (island->instructions + kJumpAddress + 4);
	*((int32_t *)(island->instructions + kJumpAddress)) = addressOffset;

    //MakeDataExecutable( island->instructions, sizeof( kIslandTemplate ) );
	msync( island->instructions, sizeof( kIslandTemplate ), MS_INVALIDATE );

    return err_none;
}
#endif

#if defined (__i386__)
// simplistic instruction matching
typedef struct {
	unsigned int length; // max 15
	unsigned char mask[15]; // sequence of bytes in memory order
	unsigned char constraint[15]; // sequence of bytes in memory order
}	AsmInstructionMatch;

static AsmInstructionMatch possibleInstructions[] = {
	{ 0x1, {0xFF}, {0x90} },							// nop
	{ 0x1, {0xFF}, {0x55} },							// push %esp
	{ 0x2, {0xFF, 0xFF}, {0x89, 0xE5} },				// mov %esp,%ebp
	{ 0x1, {0xFF}, {0x53} },							// push %ebx
	{ 0x3, {0xFF, 0xFF, 0x00}, {0x83, 0xEC, 0x00} },	// sub 0x??, %esp
	{ 0x1, {0xFF}, {0x57} },							// push %edi
	{ 0x1, {0xFF}, {0x56} },							// push %esi
	{ 0x0 }
};

static Boolean codeMatchesInstruction(unsigned char *code, AsmInstructionMatch* instruction)
{
	Boolean match = true;

	int i;
	for (i=0; i<instruction->length; i++) {
		unsigned char mask = instruction->mask[i];
		unsigned char constraint = instruction->constraint[i];
		unsigned char codeValue = code[i];
		match = ((codeValue & mask) == constraint);
		if (!match) break;
	}

	return match;
}

	static Boolean
eatKnownInstructions(
	unsigned char *code,
	uint64_t* newInstruction,
	int* howManyEaten,
	char* originalInstructions )
{
	Boolean allInstructionsKnown = true;
	int totalEaten = 0;
	unsigned char* ptr = code;
	int remainsToEat = 5; // a JMP instruction takes 5 bytes

	if (howManyEaten) *howManyEaten = 0;
	while (remainsToEat > 0) {
		Boolean curInstructionKnown = false;

		// See if instruction matches one  we know
		AsmInstructionMatch* curInstr = possibleInstructions;
		do {
			if ((curInstructionKnown = codeMatchesInstruction(ptr, curInstr))) break;
			curInstr++;
		} while (curInstr->length > 0);

		// if all instruction matches failed, we don't know current instruction then, stop here
		if (!curInstructionKnown) {
			allInstructionsKnown = false;
			break;
		}

		// At this point, we've matched curInstr
		int eaten = curInstr->length;
		ptr += eaten;
		remainsToEat -= eaten;
		totalEaten += eaten;
	}

	if (howManyEaten) *howManyEaten = totalEaten;

	if (originalInstructions) {
		Boolean enoughSpaceForOriginalInstructions = (totalEaten < kOriginalInstructionsSize);

		if (enoughSpaceForOriginalInstructions) {
			memset(originalInstructions, 0x90 /* NOP */, kOriginalInstructionsSize); // fill instructions with NOP
			bcopy(code, originalInstructions, totalEaten);
		} else {
			// printf ("Not enough space in island to store original instructions. Adapt the island definition and kOriginalInstructionsSize\n");
			return false;
		}
	}

	if (allInstructionsKnown) {
		// save last 3 bytes of first 64bits of codre we'll replace
		uint64_t currentFirst64BitsOfCode = *((uint64_t *)code);
		currentFirst64BitsOfCode = OSSwapInt64(currentFirst64BitsOfCode); // back to memory representation
		currentFirst64BitsOfCode &= 0x0000000000FFFFFFLL;

		// keep only last 3 instructions bytes, first 5 will be replaced by JMP instr
		*newInstruction &= 0xFFFFFFFFFF000000LL; // clear last 3 bytes
		*newInstruction |= (currentFirst64BitsOfCode & 0x0000000000FFFFFFLL); // set last 3 bytes
	}

	return allInstructionsKnown;
}

asm(
			".text;"
			".align 2, 0x90;"
			".globl _atomic_mov64;"
			"_atomic_mov64:;"
			"	pushl %ebp;"
			"	movl %esp, %ebp;"
			"	pushl %esi;"
			"	pushl %ebx;"
			"	pushl %ecx;"
			"	pushl %eax;"
			"	pushl %edx;"

			// atomic push of value to an address
			// we use cmpxchg8b, which compares content of an address with
			// edx:eax. If they are equal, it atomically puts 64bit value
			// ecx:ebx in address.
			// We thus put contents of address in edx:eax to force ecx:ebx
			// in address
			"	mov		8(%ebp), %esi;"  // esi contains target address
			"	mov		12(%ebp), %ebx;"
			"	mov		16(%ebp), %ecx;" // ecx:ebx now contains value to put in target address
			"	mov		(%esi), %eax;"
			"	mov		4(%esi), %edx;"  // edx:eax now contains value currently contained in target address
			"	lock; cmpxchg8b	(%esi);" // atomic move.

			// restore registers
			"	popl %edx;"
			"	popl %eax;"
			"	popl %ecx;"
			"	popl %ebx;"
			"	popl %esi;"
			"	popl %ebp;"
			"	ret"
);

#endif
#endif
#endif


text:
An fsocket backend must implement the following:

### `(defun file-socket-connect (filename &key protocol element-type local-filename))`

This is the file socket equivalent of `socket-connect`. The arguments are the same except that
there is `local-filename` to bind the local addresss rather than `local-host` and `local-port`.
And `filename` is used for the remote address rather than a host and port.

### `(defun file-socket-listen (filename &key backlog element-type))`

This is the file socket equivalent of `socket-listen`. `filename` is the file to bind to,
`backlog` and `element-type` are the same as for `socket-listen`.

### `(defmethod socket-send ((fsocket datagram-fsocket) buffer length &key filename))`

The usocket method for socket-send doesn't work for datagram file sockets, because it assumes
the address is a host and port. Therefore the fsocket backend must implement the socket-send
method using the filename as the remote address if so desired.

### `(defmethod get-local-filename ((fsocket fsocket)))`

Accessor to get the locally bound filename for the socket.

### `(defmethod get-peer-filename ((fsocket stream-fsocket)))`

Accessor to get the remote filename for a stream socket.

redpajama_set_name: RedPajamaGithub


text:
// This file is automatically generated.

package adila.db;

/*
 * Freebox Freebox Mini 4K
 *
 * DEVICE: fbx6lcv2
 * MODEL: Freebox Player Mini v2
 */
final class fbx6lcv2 {
    public static final String DATA = "Freebox|Freebox Mini 4K|";
}


text:
package aima.test.core.experiment.logic.propositional.algorithms;

import org.junit.Test;

import aima.core.logic.propositional.inference.WalkSAT;
import aima.core.logic.propositional.kb.KnowledgeBase;
import aima.core.logic.propositional.kb.data.Model;
import aima.core.logic.propositional.parsing.PLParser;
import aima.core.logic.propositional.transformations.ConvertToConjunctionOfClauses;

/**
 * @author Ravi Mohan
 *
 */
public class WalkSATExperiment {

	private PLParser parser = new PLParser();

	// NOT REALLY A JUNIT TESTCASE BUT written as one to allow easy execution
	@Test
	public void testWalkSat() {
		WalkSAT walkSAT = new WalkSAT();
		Model m = walkSAT.walkSAT(ConvertToConjunctionOfClauses.apply(parser.parse("A & B"))
				.getClauses(), 0.5, 1000);
		if (m == null) {
			System.out.println("failure");
		} else {
			m.print();
		}
	}

	@Test
	public void testWalkSat2() {
		WalkSAT walkSAT = new WalkSAT();
		Model m = walkSAT.walkSAT(ConvertToConjunctionOfClauses.apply(parser.parse("A & ~B"))
				.getClauses(), 0.5, 1000);
		if (m == null) {
			System.out.println("failure");
		} else {
			m.print();
		}
	}

	@Test
	public void testAIMAExample() {
		KnowledgeBase kb = new KnowledgeBase();
		kb.tell("P => Q");
		kb.tell("L & M => P");
		kb.tell("B & L => M");
		kb.tell("A & P => L");
		kb.tell("A & B => L");
		kb.tell("A");
		kb.tell("B");
		WalkSAT walkSAT = new WalkSAT();
		Model m = walkSAT.walkSAT(ConvertToConjunctionOfClauses.apply(kb.asSentence())
				.getClauses(), 0.5, 1000);
		if (m == null) {
			System.out.println("failure");
		} else {
			m.print();
		}
	}
}


text:
from django.conf import settings
from django.core.mail import send_mail

from django_cronium import CronJobBase, Schedule
from django_cronium.models import CronJobLog
from django_cronium.management.commands.runcrons import get_class

class FailedRunsNotificationCronJob(CronJobBase):
    """
        Send email if cron failed to run X times in a row
    """
    RUN_EVERY_MINS = 30

    schedule = Schedule(run_every_mins=RUN_EVERY_MINS)
    code = 'django_cronium.FailedRunsNotificationCronJob'

    def do(self):

        CRONS_TO_CHECK = map(lambda x: get_class(x), settings.CRON_CLASSES)
        EMAILS = [admin[1] for admin in settings.ADMINS]

        try:
            FAILED_RUNS_CRONJOB_EMAIL_PREFIX = settings.FAILED_RUNS_CRONJOB_EMAIL_PREFIX
        except:
            FAILED_RUNS_CRONJOB_EMAIL_PREFIX = ''

        for cron in CRONS_TO_CHECK:

            try:
                min_failures = cron.MIN_NUM_FAILURES
            except AttributeError:
                min_failures = 10

            failures = 0

            jobs = CronJobLog.objects.filter(code=cron.code).order_by('-end_time')[:min_failures]

            message = ''

            for job in jobs:
                if not job.is_success:
                    failures += 1
                    message += 'Job ran at %s : \n\n %s \n\n' % (job.start_time, job.message)

            if failures == min_failures:

                send_mail(
                    '%s%s failed %s times in a row!' % (FAILED_RUNS_CRONJOB_EMAIL_PREFIX, cron.code, \
                        min_failures), message,
                    settings.DEFAULT_FROM_EMAIL, EMAILS
                )


text:
title: Independence of the Axiom of Choice (for programmers)
author: patrick
layout: post
comments: true
redirect_from:
  - /independence-of-choice/
categories:
  - mathematical_summary
---

So you've heard that the Axiom of Choice is magical and special and unprovable and independent of set theory,
and you're here to work out what that means.
Let's not get too hung up on what the Axiom of Choice (or "AC") actually is, because you probably don't care.
Let's instead discuss what it means for something to be "independent".

Often I hear the layperson say things like "AC is unprovable".
This is true in a sense, but it's misleading.

Take an object $$n$$ of the type "integer" - so $$5$$, $$-100$$, that kind of thing.
Here is what I will call the Positivity Hypothesis (or "PH"):

> $$n$$ is (strictly) greater than $$0$$.

Of course, depending on how we chose $$n$$, PH might be true or it might be false, although it can't be both.
So, while maths might let us prove which of PH or not-PH holds for our given $$n$$,
maths will emphatically not let us prove that PH is always true, and it will not let us prove that PH is always false.
(Maths would be stupid if it did that, because PH is neither always true nor always false.
The integers $$5$$ and $$-100$$ witness that PH can be true and can be false respectively.)

Therefore PH is independent of integer theory.
It's not magic: there is no god-given reason why PH mysteriously resists all efforts to prove it.
It's simply not always true, but it's not always false either.

Let's go back to the Axiom of Choice.

The usual system of set theory (which is used as a foundation for all of maths) is a collection of nine axioms,
together comprising what is known as ZF.
(If we add Choice to that collection as a tenth axiom, we obtain the set theory called ZFC.)
In the "integers" analogy above, "the integer type" plays the role of ZF.

Now, just as we may pick an object of type "integer", we may pick a set-theory of type "ZF".
A "set theory of type ZF" is my informal phrasing for what is usually called "a model of ZF".
(I'm eliding the question of the consistency of ZF, and I'll just assume it's consistent.)
In the "integers" analogy, the number $$5$$ plays the role of one of these set theories,
as does the number $$-100$$.
We can ask of this set theory whether it obeys AC (for which we substituted PH in the analogy).

And it turns out that for some models of set theory, AC holds, and for some models, it doesn't.
It's quite hard to describe models of set theory, because set theory supports so much complexity;
the integers are much easier to specify.
However, if you want the names of two models: in the model which contains precisely the "constructible sets", AC holds, while in Solovay's model, AC fails.

That's all there is to it.
Maths won't let us prove AC, because it's not true of every set theory of the type "ZF".
Maths won't let us prove AC is false, because there are some set theories of the type "ZF" in which it is true.


text:
FROM phpdockerio/php71-fpm:latest

# Install selected extensions and other stuff
RUN apt-get update \
    && apt-get -y --no-install-recommends install git php7.1-mysql php7.1-pgsql php7.1-redis php7.1-bz2 php7.1-gd php7.1-igbinary php7.1-imap php7.1-intl php7.1-mbstring php7.1-tidy php7.1-bcmath \
    && apt-get clean; rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/*

WORKDIR "/app"


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Net.Mail;

namespace ChildCare
{
    public class SendEmail
            {
        public SendEmail()
        {

        }
        public bool SendMail(string From, string To, string Subject, string Message)
        {
            try
            {
                MailMessage mail = new MailMessage();
                SmtpClient SmtpServer = new SmtpClient("smtp.gmail.com");

                mail.From = new MailAddress(From);
                mail.To.Add(To);
                mail.Subject = Subject;
                mail.Body = Message;

                SmtpServer.Port = 587;
                SmtpServer.Credentials = new System.Net.NetworkCredential("afterschoolcareapp", "afterschoolcareapp");
                SmtpServer.EnableSsl = true;

                SmtpServer.Send(mail);
                return true;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
    }
}


text:
/**
 *
 */
package gsloginemulator;

import java.io.File;
import java.io.FileNotFoundException;
//import gsloginemulatorDatabase.*;
import java.io.*;
import java.util.Scanner;

/**
 * @author roun512
 *
 */
public class Config {
	private static String IniLocation = System.getProperty("user.dir") + "/config.ini";
	public static String path = System.getProperty("user.dir");

	public Config() {
		//Check File IniLocation Exists
		File config_file = new File(Config.IniLocation);
		if(config_file.exists() && !config_file.isDirectory())
			return;
		System.out.println("config.ini File doesn\'t exist");

	}

	public static String getLine(String Key) throws FileNotFoundException {
		File config = new File(Config.IniLocation);
		Scanner in = null;
		String value = "";
		String result;

		in = new Scanner(new FileReader(config));
		while(in.hasNextLine()) {
			result = in.nextLine();
			String[] word = result.trim().split("");
			if(word[0] == Key) {
				value = word[1];
				break;
			} else {
				in.next();
			}
		}
		in.close();
		return value;

	}

	//public static DatabaseEngine GetDatabaseEngine() {
		//return "test";
	//}
}


text:
package com.github.bjoern2.photo.organizer.duplicate;

import java.nio.file.Path;

import com.github.bjoern2.photo.organizer.utils.ImageUtils;

public class RotateDuplicateDetector implements DuplicateDetector {

	@Override
	public boolean isDuplicate(Path source, Path target) throws Exception {
		return ImageUtils.isRotatedOrEquals(source, target);
	}

}


text:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>cache on rushiagr</title>
    <link>http://www.rushiagr.com/tags/cache/</link>
    <description>Recent content in cache on rushiagr</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-us</language>
    <copyright>Rushi Agrawal</copyright>
    <lastBuildDate>Fri, 05 Jun 2015 00:00:00 +0000</lastBuildDate>

	<atom:link href="http://www.rushiagr.com/tags/cache/index.xml" rel="self" type="application/rss+xml" />

    <item>
      <title>Cache APT packages with Squid proxy</title>
      <link>http://www.rushiagr.com/blog/2015/06/05/cache-apt-packages-with-squid-proxy/</link>
      <pubDate>Fri, 05 Jun 2015 00:00:00 +0000</pubDate>

      <guid>http://www.rushiagr.com/blog/2015/06/05/cache-apt-packages-with-squid-proxy/</guid>
      <description>TL;DR: Know how to install and set up Squid proxy, so that you can cache packages, and hence save bandwidth if you want to install those packages again and again. Also works if you are already behind a squid proxy.
Problem: Repetitive download. Slow. If you deal with virtual machines a lot, you might know the pain of managing packages on each one of them. Every time I had to create a new VM, I would run apt-get update (to get information about all the latest packages available for my Ubuntu system), apt-get dist-upgrade (to install latest versions of all packages already installed), and also install some packages not present in stock Ubuntu image, like git (yes, it's 2015 and Ubuntu still doesn't come pre-installed with git), ipython, bwm-ng and some others.</description>
    </item>

  </channel>
</rss>


text:
// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: google/spanner/v1/spanner.proto

package com.google.spanner.v1;

public interface ExecuteSqlRequestOrBuilder extends
    // @@protoc_insertion_point(interface_extends:google.spanner.v1.ExecuteSqlRequest)
    com.google.protobuf.MessageOrBuilder {

  /**
   *

   * Required. The session in which the SQL query should be performed.
   *

   *
   * string session = 1;
   */
  java.lang.String getSession();
  /**
   *

   * Required. The session in which the SQL query should be performed.
   *

   *
   * string session = 1;
   */
  com.google.protobuf.ByteString
      getSessionBytes();

  /**
   *

   * The transaction to use. If none is provided, the default is a
   * temporary read-only transaction with strong concurrency.
   *

   *
   * .google.spanner.v1.TransactionSelector transaction = 2;
   */
  boolean hasTransaction();
  /**
   *

   * The transaction to use. If none is provided, the default is a
   * temporary read-only transaction with strong concurrency.
   *

   *
   * .google.spanner.v1.TransactionSelector transaction = 2;
   */
  com.google.spanner.v1.TransactionSelector getTransaction();
  /**
   *

   * The transaction to use. If none is provided, the default is a
   * temporary read-only transaction with strong concurrency.
   *

   *
   * .google.spanner.v1.TransactionSelector transaction = 2;
   */
  com.google.spanner.v1.TransactionSelectorOrBuilder getTransactionOrBuilder();

  /**
   *

   * Required. The SQL query string.
   *

   *
   * string sql = 3;
   */
  java.lang.String getSql();
  /**
   *

   * Required. The SQL query string.
   *

   *
   * string sql = 3;
   */
  com.google.protobuf.ByteString
      getSqlBytes();

  /**
   *

   * The SQL query string can contain parameter placeholders. A parameter
   * placeholder consists of `'@'` followed by the parameter
   * name. Parameter names consist of any combination of letters,
   * numbers, and underscores.
   * Parameters can appear anywhere that a literal value is expected.  The same
   * parameter name can be used more than once, for example:
   *   `"WHERE id > @msg_id AND id < @msg_id + 100"`
   * It is an error to execute an SQL query with unbound parameters.
   * Parameter values are specified using `params`, which is a JSON
   * object whose keys are parameter names, and whose values are the
   * corresponding parameter values.
   *

   *
   * .google.protobuf.Struct params = 4;
   */
  boolean hasParams();
  /**
   *

   * The SQL query string can contain parameter placeholders. A parameter
   * placeholder consists of `'@'` followed by the parameter
   * name. Parameter names consist of any combination of letters,
   * numbers, and underscores.
   * Parameters can appear anywhere that a literal value is expected.  The same
   * parameter name can be used more than once, for example:
   *   `"WHERE id > @msg_id AND id < @msg_id + 100"`
   * It is an error to execute an SQL query with unbound parameters.
   * Parameter values are specified using `params`, which is a JSON
   * object whose keys are parameter names, and whose values are the
   * corresponding parameter values.
   *

   *
   * .google.protobuf.Struct params = 4;
   */
  com.google.protobuf.Struct getParams();
  /**
   *

   * The SQL query string can contain parameter placeholders. A parameter
   * placeholder consists of `'@'` followed by the parameter
   * name. Parameter names consist of any combination of letters,
   * numbers, and underscores.
   * Parameters can appear anywhere that a literal value is expected.  The same
   * parameter name can be used more than once, for example:
   *   `"WHERE id > @msg_id AND id < @msg_id + 100"`
   * It is an error to execute an SQL query with unbound parameters.
   * Parameter values are specified using `params`, which is a JSON
   * object whose keys are parameter names, and whose values are the
   * corresponding parameter values.
   *

   *
   * .google.protobuf.Struct params = 4;
   */
  com.google.protobuf.StructOrBuilder getParamsOrBuilder();

  /**
   *

   * It is not always possible for Cloud Spanner to infer the right SQL type
   * from a JSON value.  For example, values of type `BYTES` and values
   * of type `STRING` both appear in [params][google.spanner.v1.ExecuteSqlRequest.params] as JSON strings.
   * In these cases, `param_types` can be used to specify the exact
   * SQL type for some or all of the SQL query parameters. See the
   * definition of [Type][google.spanner.v1.Type] for more information
   * about SQL types.
   *

   *
   * map<string, .google.spanner.v1.Type> param_types = 5;
   */
  int getParamTypesCount();
  /**
   *

   * It is not always possible for Cloud Spanner to infer the right SQL type
   * from a JSON value.  For example, values of type `BYTES` and values
   * of type `STRING` both appear in [params][google.spanner.v1.ExecuteSqlRequest.params] as JSON strings.
   * In these cases, `param_types` can be used to specify the exact
   * SQL type for some or all of the SQL query parameters. See the
   * definition of [Type][google.spanner.v1.Type] for more information
   * about SQL types.
   *

   *
   * map<string, .google.spanner.v1.Type> param_types = 5;
   */
  boolean containsParamTypes(
      java.lang.String key);
  /**
   * Use {@link #getParamTypesMap()} instead.
   */
  @java.lang.Deprecated
  java.util.Map<java.lang.String, com.google.spanner.v1.Type>
  getParamTypes();
  /**
   *

   * It is not always possible for Cloud Spanner to infer the right SQL type
   * from a JSON value.  For example, values of type `BYTES` and values
   * of type `STRING` both appear in [params][google.spanner.v1.ExecuteSqlRequest.params] as JSON strings.
   * In these cases, `param_types` can be used to specify the exact
   * SQL type for some or all of the SQL query parameters. See the
   * definition of [Type][google.spanner.v1.Type] for more information
   * about SQL types.
   *

   *
   * map<string, .google.spanner.v1.Type> param_types = 5;
   */
  java.util.Map<java.lang.String, com.google.spanner.v1.Type>
  getParamTypesMap();
  /**
   *

   * It is not always possible for Cloud Spanner to infer the right SQL type
   * from a JSON value.  For example, values of type `BYTES` and values
   * of type `STRING` both appear in [params][google.spanner.v1.ExecuteSqlRequest.params] as JSON strings.
   * In these cases, `param_types` can be used to specify the exact
   * SQL type for some or all of the SQL query parameters. See the
   * definition of [Type][google.spanner.v1.Type] for more information
   * about SQL types.
   *

   *
   * map<string, .google.spanner.v1.Type> param_types = 5;
   */

  com.google.spanner.v1.Type getParamTypesOrDefault(
      java.lang.String key,
      com.google.spanner.v1.Type defaultValue);
  /**
   *

   * It is not always possible for Cloud Spanner to infer the right SQL type
   * from a JSON value.  For example, values of type `BYTES` and values
   * of type `STRING` both appear in [params][google.spanner.v1.ExecuteSqlRequest.params] as JSON strings.
   * In these cases, `param_types` can be used to specify the exact
   * SQL type for some or all of the SQL query parameters. See the
   * definition of [Type][google.spanner.v1.Type] for more information
   * about SQL types.
   *

   *
   * map<string, .google.spanner.v1.Type> param_types = 5;
   */

  com.google.spanner.v1.Type getParamTypesOrThrow(
      java.lang.String key);

  /**
   *

   * If this request is resuming a previously interrupted SQL query
   * execution, `resume_token` should be copied from the last
   * [PartialResultSet][google.spanner.v1.PartialResultSet] yielded before the interruption. Doing this
   * enables the new SQL query execution to resume where the last one left
   * off. The rest of the request parameters must exactly match the
   * request that yielded this token.
   *

   *
   * bytes resume_token = 6;
   */
  com.google.protobuf.ByteString getResumeToken();

  /**
   *

   * Used to control the amount of debugging information returned in
   * [ResultSetStats][google.spanner.v1.ResultSetStats]. If [partition_token][google.spanner.v1.ExecuteSqlRequest.partition_token] is set, [query_mode][google.spanner.v1.ExecuteSqlRequest.query_mode] can only
   * be set to [QueryMode.NORMAL][google.spanner.v1.ExecuteSqlRequest.QueryMode.NORMAL].
   *

   *
   * .google.spanner.v1.ExecuteSqlRequest.QueryMode query_mode = 7;
   */
  int getQueryModeValue();
  /**
   *

   * Used to control the amount of debugging information returned in
   * [ResultSetStats][google.spanner.v1.ResultSetStats]. If [partition_token][google.spanner.v1.ExecuteSqlRequest.partition_token] is set, [query_mode][google.spanner.v1.ExecuteSqlRequest.query_mode] can only
   * be set to [QueryMode.NORMAL][google.spanner.v1.ExecuteSqlRequest.QueryMode.NORMAL].
   *

   *
   * .google.spanner.v1.ExecuteSqlRequest.QueryMode query_mode = 7;
   */
  com.google.spanner.v1.ExecuteSqlRequest.QueryMode getQueryMode();

  /**
   *

   * If present, results will be restricted to the specified partition
   * previously created using PartitionQuery().  There must be an exact
   * match for the values of fields common to this message and the
   * PartitionQueryRequest message used to create this partition_token.
   *

   *
   * bytes partition_token = 8;
   */
  com.google.protobuf.ByteString getPartitionToken();
}


text:
module.exports = [{
    appointmentAt: null,
    updatedAt: null,
    trainerName: 'Johnny Cash',
    trainerFacility: 'Tribeca',
    clientName: 'Donna Summer',
    clientId: 100000,
    isSigned: false,
    isSubmitted: false,
    documents: []
}];


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

		<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
		<title>basic-1 testing Reference Package equals</title>
		<link rel="stylesheet" type="text/css" href="../stylesheet.css" title="style" />

        	equals

Classes

            	ArrayEquality


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<TITLE>
VoteDaoImplJDBC
</TITLE>

<META NAME="keywords" CONTENT="tot.dao.jdbc.VoteDaoImplJDBC class">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">

      概述
      软件包
    类
      使用
      树
      已过时
      索引
      帮助

 上一个类
 下一个类

  框架
 无框架

  所有类

  摘要: 嵌套 | 字段 | 构造函数 | 方法

详细信息: 字段 | 构造函数 | 方法

tot.dao.jdbc

类 VoteDaoImplJDBC

java.lang.Object
  tot.dao.AbstractDao
      tot.dao.jdbc.VoteDaoImplJDBC

public class VoteDaoImplJDBC
extends AbstractDao

构造函数摘要

VoteDaoImplJDBC()

          Creates a new instance of VoteDaoImplJDBC

方法摘要

 boolean
addVote(int id,
        java.lang.String title,
        int optionnum,
        int optiontype,
        int status,
        java.sql.Timestamp expirestime,
        java.sql.Timestamp moditime)

          add vote

 boolean
addVoteItem(int voteid,
            java.lang.String[] items)

 boolean
delVote(int id)

 boolean
delVoteItem(int voteid)

 int
getLastId()

 int
getTotalCount()

 DataField
getVote(int id)

 int[]
getVoteItemHits(int voteid)

 java.util.Collection
getVoteItems(int voteid)

 java.util.Collection
getVoteList_Limit(int currentpage,
                  int pagesize)

 java.util.Collection
getVotes()

 boolean
isExpired(int id)

 boolean
modVote(int id,
        java.lang.String title,
        int optionnum,
        int optiontype,
        int status,
        java.sql.Timestamp expirestime,
        java.sql.Timestamp moditime)

 boolean
modVoteItem(int voteid,
            java.lang.String[] items)

 boolean
updateHits(int id)

从类 tot.dao.AbstractDao 继承的方法

bat, exe, exeTransaction, findByPrimaryKey, getData, getDataCount, getDataList_Limit_Normal, getDataList_mysqlLimit, getFirstData

从类 java.lang.Object 继承的方法

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

构造函数详细信息

VoteDaoImplJDBC

public VoteDaoImplJDBC()

Creates a new instance of VoteDaoImplJDBC

方法详细信息

getLastId

public int getLastId()

addVote

public boolean addVote(int id,
                       java.lang.String title,
                       int optionnum,
                       int optiontype,
                       int status,
                       java.sql.Timestamp expirestime,
                       java.sql.Timestamp moditime)

add vote

modVote

public boolean modVote(int id,
                       java.lang.String title,
                       int optionnum,
                       int optiontype,
                       int status,
                       java.sql.Timestamp expirestime,
                       java.sql.Timestamp moditime)

addVoteItem

public boolean addVoteItem(int voteid,
                           java.lang.String[] items)

getVoteItemHits

public int[] getVoteItemHits(int voteid)

modVoteItem

public boolean modVoteItem(int voteid,
                           java.lang.String[] items)
                    throws ObjectNotFoundException,
                           DatabaseException

抛出:

ObjectNotFoundException

DatabaseException

delVote

public boolean delVote(int id)
                throws ObjectNotFoundException,
                       DatabaseException

抛出:

ObjectNotFoundException

DatabaseException

delVoteItem

public boolean delVoteItem(int voteid)
                    throws ObjectNotFoundException,
                           DatabaseException

抛出:

ObjectNotFoundException

DatabaseException

getVotes

public java.util.Collection getVotes()

getVoteItems

public java.util.Collection getVoteItems(int voteid)

getVoteList_Limit

public java.util.Collection getVoteList_Limit(int currentpage,
                                              int pagesize)

getVote

public DataField getVote(int id)

getTotalCount

public int getTotalCount()

updateHits

public boolean updateHits(int id)
                   throws ObjectNotFoundException,
                          DatabaseException

抛出:

ObjectNotFoundException

DatabaseException

isExpired

public boolean isExpired(int id)

      概述
      软件包
    类
      使用
      树
      已过时
      索引
      帮助

 上一个类
 下一个类

  框架
 无框架

  所有类

  摘要: 嵌套 | 字段 | 构造函数 | 方法

详细信息: 字段 | 构造函数 | 方法


text:
// Portions copyright Hiroshi Ito. Licensed under Apache 2.0 license

package com.gs.fw.common.mithra.attribute;

import com.gs.fw.common.mithra.AggregateData;
import com.gs.fw.common.mithra.MithraBusinessException;
import com.gs.fw.common.mithra.MithraDataObject;
import com.gs.fw.common.mithra.MithraNullPrimitiveException;
import com.gs.fw.common.mithra.aggregate.attribute.IntegerAggregateAttribute;
import com.gs.fw.common.mithra.attribute.calculator.AbsoluteValueCalculatorInteger;
import com.gs.fw.common.mithra.attribute.calculator.IntegerToStringCalculator;
import com.gs.fw.common.mithra.attribute.calculator.ModCalculatorInteger;
import com.gs.fw.common.mithra.attribute.calculator.aggregateFunction.AverageCalculatorNumeric;
import com.gs.fw.common.mithra.attribute.calculator.aggregateFunction.MaxCalculatorNumeric;
import com.gs.fw.common.mithra.attribute.calculator.aggregateFunction.MinCalculatorNumeric;
import com.gs.fw.common.mithra.attribute.calculator.aggregateFunction.SumCalculatorNumeric;
import com.gs.fw.common.mithra.attribute.calculator.arithmeticCalculator.ConstAdditionCalculatorBigDecimal;
import com.gs.fw.common.mithra.attribute.calculator.arithmeticCalculator.ConstAdditionCalculatorDouble;
import com.gs.fw.common.mithra.attribute.calculator.arithmeticCalculator.ConstAdditionCalculatorInteger;
import com.gs.fw.common.mithra.attribute.calculator.arithmeticCalculator.ConstDivisionCalculatorBigDecimal;
import com.gs.fw.common.mithra.attribute.calculator.arithmeticCalculator.ConstDivisionCalculatorDouble;
import com.gs.fw.common.mithra.attribute.calculator.arithmeticCalculator.ConstDivisionCalculatorInteger;
import com.gs.fw.common.mithra.attribute.calculator.arithmeticCalculator.ConstMultiplicationCalculatorBigDecimal;
import com.gs.fw.common.mithra.attribute.calculator.arithmeticCalculator.ConstMultiplicationCalculatorDouble;
import com.gs.fw.common.mithra.attribute.calculator.arithmeticCalculator.ConstMultiplicationCalculatorInteger;
import com.gs.fw.common.mithra.attribute.numericType.BigDecimalNumericType;
import com.gs.fw.common.mithra.attribute.numericType.DoubleNumericType;
import com.gs.fw.common.mithra.attribute.numericType.FloatNumericType;
import com.gs.fw.common.mithra.attribute.numericType.IntegerNumericType;
import com.gs.fw.common.mithra.attribute.numericType.LongNumericType;
import com.gs.fw.common.mithra.attribute.numericType.NumericType;
import com.gs.fw.common.mithra.attribute.update.AttributeUpdateWrapper;
import com.gs.fw.common.mithra.attribute.update.IntegerNullUpdateWrapper;
import com.gs.fw.common.mithra.databasetype.DatabaseType;
import com.gs.fw.common.mithra.extractor.BigDecimalExtractor;
import com.gs.fw.common.mithra.extractor.DoubleExtractor;
import com.gs.fw.common.mithra.extractor.Extractor;
import com.gs.fw.common.mithra.extractor.IntExtractor;
import com.gs.fw.common.mithra.extractor.LongExtractor;
import com.gs.fw.common.mithra.finder.None;
import com.gs.fw.common.mithra.finder.Operation;
import com.gs.fw.common.mithra.finder.orderby.IntegerOrderBy;
import com.gs.fw.common.mithra.finder.orderby.OrderBy;
import com.gs.fw.common.mithra.util.HashUtil;
import com.gs.fw.common.mithra.util.MutableInteger;
import com.gs.fw.common.mithra.util.MutableNumber;
import com.gs.fw.common.mithra.util.Nullable;
import com.gs.fw.common.mithra.util.serializer.ReladomoSerializationContext;
import com.gs.fw.common.mithra.util.serializer.SerialWriter;
import org.eclipse.collections.api.set.primitive.IntSet;
import org.eclipse.collections.api.set.primitive.MutableIntSet;
import org.eclipse.collections.impl.set.mutable.primitive.IntHashSet;

import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.math.BigDecimal;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.text.Format;
import java.text.ParseException;
import java.util.List;
import java.util.Map;
import java.util.TimeZone;

public abstract class IntegerAttribute<T> extends PrimitiveNumericAttribute<T, Integer> implements com.gs.fw.finder.attribute.IntegerAttribute<T>,
        IntExtractor<T, Integer>, LongExtractor<T, Integer>, DoubleExtractor<T, Integer>, BigDecimalExtractor<T, Integer>
{
    private transient OrderBy ascendingOrderBy;
    private transient OrderBy descendingOrderBy;

    private static final long serialVersionUID = -4174808420300734279L;

    @Override
    public Class valueType()
    {
        return Integer.class;
    }

    @Override
    protected void serializedNonNullValue(T o, ObjectOutput out) throws IOException
    {
        out.writeInt(this.intValueOf(o));
    }

    @Override
    protected void deserializedNonNullValue(T o, ObjectInput in) throws IOException
    {
        this.setIntValue(o, in.readInt());
    }

    @Override
    public Operation nonPrimitiveEq(Object other)
    {
        if (other == null) return this.isNull();
        return this.eq(((Number) other).intValue());
    }

    /**
     * extracts the int values represented by this attribute from the list and puts them in a set.
     * If the int attribute is null, it's ignored.
     * @param list incoming list
     * @return the set
     */
    public MutableIntSet asGscSet(List<T> list)
    {
        return asSet(list, this, new IntHashSet());
    }

    /**
     * extracts the int values represented by this attribute from the list and adds them to the setToAppend.
     * If the int attribute is null, it's ignored.
     * @param list incoming list
     * @param setToAppend the set to append to
     */
    public MutableIntSet asSet(List<T> list, MutableIntSet setToAppend)
    {
        asSet(list, this, setToAppend);
        return setToAppend;
    }

    public abstract Operation eq(int other);

    public abstract Operation eq(long other);

    public abstract Operation notEq(int other);

    @Override
    public abstract Operation in(IntSet intSet);

    @Override
    public abstract Operation notIn(IntSet intSet);

    public abstract Operation greaterThan(int target);

    public abstract Operation greaterThanEquals(int target);

    public abstract Operation lessThan(int target);

    public abstract Operation lessThanEquals(int target);

    // join operation:
    /**
     * @deprecated use joinEq or filterEq instead
     * @param other Attribute to join to
     * @return Operation corresponding to the join
     **/
    /**
     * @param other Attribute to join to
     * @return Operation corresponding to the join
     * @deprecated use joinEq or filterEq instead
     */
    @Deprecated
    public abstract Operation eq(IntegerAttribute other);

    public abstract Operation joinEq(IntegerAttribute other);

    public abstract Operation filterEq(IntegerAttribute other);

    public abstract Operation notEq(IntegerAttribute other);

    @Override
    public void copyValueFrom(T dest, T src)
    {
        if (this.isAttributeNull(src))
        {
            this.setValueNull(dest);
        }
        else
        {
            this.setValue(dest, this.intValueOf(src));
        }
    }

    public Integer valueOf(T o)
    {
        return (this.isAttributeNull(o)) ? null : Integer.valueOf(this.intValueOf(o));
    }

    public void setValue(T o, Integer newValue)
    {
        this.setIntValue(o, newValue.intValue());
    }

    public int valueHashCode(T o)
    {
        return (this.isAttributeNull(o)) ? HashUtil.NULL_HASH : HashUtil.hash(this.intValueOf(o));
    }

    @Override
    protected boolean primitiveValueEquals(T first, T second)
    {
        return this.intValueOf(first) == this.intValueOf(second);
    }

    @Override
    protected <O> boolean primitiveValueEquals(T first, O second, Extractor<O, Integer> secondExtractor)
    {
        return this.intValueOf(first) == ((IntExtractor) secondExtractor).intValueOf(second);
    }

    @Override
    public OrderBy ascendingOrderBy()
    {
        if (this.ascendingOrderBy == null)
        {
            this.ascendingOrderBy = new IntegerOrderBy(this, true);
        }
        return this.ascendingOrderBy;
    }

    @Override
    public OrderBy descendingOrderBy()
    {
        if (this.descendingOrderBy == null)
        {
            this.descendingOrderBy = new IntegerOrderBy(this, false);
        }
        return this.descendingOrderBy;
    }

    @Override
    public Operation in(final List objects, final Extractor extractor)
    {
        final IntExtractor integerExtractor = (IntExtractor) extractor;
        final IntSet set = asSet(objects, integerExtractor);
        return this.in(set);
    }

    private IntSet asSet(List objects, IntExtractor integerExtractor)
    {
        return this.asSet(objects, integerExtractor, new IntHashSet());
    }

    private MutableIntSet asSet(List objects, IntExtractor integerExtractor, MutableIntSet intSet)
    {
        for (int i = 0, n = objects.size(); i < n; i++)
        {
            final Object o = objects.get(i);
            if (!integerExtractor.isAttributeNull(o))
            {
                intSet.add(integerExtractor.intValueOf(o));
            }
        }
        return intSet;
    }

    @Override
    public Operation in(final Iterable objects, final Extractor extractor)
    {
        final IntExtractor integerExtractor = (IntExtractor) extractor;
        final MutableIntSet set = new IntHashSet();
        for (Object o : objects)
        {
            if (!integerExtractor.isAttributeNull(o))
            {
                set.add(integerExtractor.intValueOf(o));
            }
        }
        return this.in(set);
    }

    @Override
    public Operation zInWithMax(int maxInClause, List objects, Extractor extractor)
    {
        IntExtractor integerExtractor = (IntExtractor) extractor;
        MutableIntSet set = new IntHashSet();
        for (int i = 0; i < objects.size(); i++)
        {
            Object o = objects.get(i);
            if (!integerExtractor.isAttributeNull(o))
            {
                set.add(integerExtractor.intValueOf(o));
                if (set.size() > maxInClause)
                {
                    return new None(this);
                }
            }
        }
        return this.in(set);
    }

    @Override
    public void parseNumberAndSet(double value, T data, int lineNumber) throws ParseException
    {
        if (value > Integer.MAX_VALUE || value < Integer.MIN_VALUE || Math.floor(value) != value)
        {
            throw new ParseException("Incorrect int value " + value + " on line " +
                    lineNumber + " for attribute " + this.getClass().getName(), lineNumber);
        }
        this.setIntValue(data, (int) value);
    }

    @Override
    public void parseStringAndSet(String value, T data, int lineNumber, Format format) throws ParseException
    {
        this.setIntValue(data, Integer.parseInt(value));
    }

    @Override
    public void setValueUntil(T o, Integer newValue, Timestamp exclusiveUntil)
    {
        this.setUntil(o, newValue.intValue(), exclusiveUntil);
    }

    protected void setUntil(Object o, int i, Timestamp exclusiveUntil)
    {
        throw new RuntimeException("not implemented");
    }

    public StringAttribute<T> convertToStringAttribute()
    {
        return new CalculatedStringAttribute(new IntegerToStringCalculator(this));
    }

    public long longValueOf(T o)
    {
        return this.intValueOf(o);
    }

    public void setLongValue(T o, long newValue)
    {
        this.setIntValue(o, (int) newValue);
    }

    public String valueOfAsString(T object, Formatter formatter)
    {
        return formatter.format(this.intValueOf(object));
    }

    @Override
    public int zCountUniqueInstances(MithraDataObject[] dataObjects)
    {
        if (this.isAttributeNull((T) dataObjects[0]))
        {
            return 1;
        }
        int firstValue = this.intValueOf((T) dataObjects[0]);
        MutableIntSet set = null;
        for (int i = 1; i < dataObjects.length; i++)
        {
            int nextValue = this.intValueOf((T) dataObjects[i]);
            if (set != null)
            {
                set.add(nextValue);
            }
            else if (nextValue != firstValue)
            {
                set = new IntHashSet();
                set.add(firstValue);
                set.add(nextValue);
            }
        }
        if (set != null)
        {
            return set.size();
        }
        return 1;
    }

    @Override
    public void zPopulateValueFromResultSet(int resultSetPosition, int dataPosition, ResultSet rs, AggregateData data, TimeZone databaseTimezone, DatabaseType dt)
            throws SQLException
    {
        MutableInteger obj;
        int i = rs.getInt(resultSetPosition);
        if (rs.wasNull())
        {
            obj = new MutableInteger();
        }
        else
        {
            obj = new MutableInteger(i);
        }
        data.setValueAt(dataPosition, obj);
    }

    @Override
    public void zPopulateValueFromResultSet(int resultSetPosition, int dataPosition, ResultSet rs, Object object, Method method, TimeZone databaseTimezone, DatabaseType dt, Object[] tempArray) throws SQLException
    {
        int i = rs.getInt(resultSetPosition);
        if (rs.wasNull())
        {
            tempArray[0] = null;
        }
        else
        {
            tempArray[0] = i;
        }
        try
        {
            method.invoke(object, tempArray);
        }
        catch (IllegalArgumentException e)
        {
            if (tempArray[0] == null && method.getParameterTypes()[0].isPrimitive())
            {
                throw new MithraNullPrimitiveException("Aggregate result returned null for " + method.getName() + " of class " + object.getClass().getName() + " which cannot be set as primitive", e);
            }
            throw new MithraBusinessException("Invalid argument " + tempArray[0] + " passed in invoking method " + method.getName() + "  of class " + object.getClass().getName(), e);
        }
        catch (IllegalAccessException e)
        {
            throw new MithraBusinessException("No valid access to invoke method " + method.getName() + " of class " + object.getClass().getName(), e);
        }
        catch (InvocationTargetException e)
        {
            throw new MithraBusinessException("Error invoking method " + method.getName() + "of class " + object.getClass().getName(), e);
        }
    }

    @Override
    public void zPopulateAggregateDataValue(int position, Object value, AggregateData data)
    {
        data.setValueAt((position), new MutableInteger((Integer) value));
    }

    @Override
    public void serializeNonNullAggregateDataValue(Nullable valueWrappedInNullable, ObjectOutput out) throws IOException
    {
        out.writeInt(((MutableNumber)valueWrappedInNullable).intValue());
    }

    @Override
    public Nullable deserializeNonNullAggregateDataValue(ObjectInput in) throws IOException, ClassNotFoundException
    {
        return new MutableInteger(in.readInt());
    }

    public NumericType getNumericType()
    {
        return IntegerNumericType.getInstance();
    }

    public void increment(Object o, double increment)
    {
        this.setDoubleValue((T) o, this.doubleValueOf((T) o) + increment);
    }

    public void incrementUntil(Object o, double increment, Timestamp exclusiveUntil)
    {
        throw new RuntimeException("This method can only be called on objects with asof attributes");
    }

    public void increment(T o, BigDecimal increment)
    {
        this.setBigDecimalValue(o, this.bigDecimalValueOf(o).add(increment));
    }

    public void incrementUntil(T o, BigDecimal increment, Timestamp exclusiveUntil)
    {
        throw new RuntimeException("This method can only be called on objects with asof attributes");
    }

    // ByteAttribute operands

    public IntegerAttribute plus(com.gs.fw.finder.attribute.ByteAttribute attribute)
    {
        return IntegerNumericType.getInstance().createCalculatedAttribute(IntegerNumericType.getInstance().createAdditionCalculator(this, (ByteAttribute) attribute));
    }

    public IntegerAttribute minus(com.gs.fw.finder.attribute.ByteAttribute attribute)
    {
        return IntegerNumericType.getInstance().createCalculatedAttribute(IntegerNumericType.getInstance().createSubtractionCalculator(this, (ByteAttribute) attribute));
    }

    public IntegerAttribute times(com.gs.fw.finder.attribute.ByteAttribute attribute)
    {
        return IntegerNumericType.getInstance().createCalculatedAttribute(IntegerNumericType.getInstance().createMultiplicationCalculator(this, (ByteAttribute) attribute));
    }

    public IntegerAttribute dividedBy(com.gs.fw.finder.attribute.ByteAttribute attribute)
    {
        return IntegerNumericType.getInstance().createCalculatedAttribute(IntegerNumericType.getInstance().createDivisionCalculator(this, (ByteAttribute) attribute));
    }

    // ShortAttribute operands

    public IntegerAttribute plus(com.gs.fw.finder.attribute.ShortAttribute attribute)
    {
        return IntegerNumericType.getInstance().createCalculatedAttribute(IntegerNumericType.getInstance().createAdditionCalculator(this, (ShortAttribute) attribute));
    }

    public IntegerAttribute minus(com.gs.fw.finder.attribute.ShortAttribute attribute)
    {
        return IntegerNumericType.getInstance().createCalculatedAttribute(IntegerNumericType.getInstance().createSubtractionCalculator(this, (ShortAttribute) attribute));
    }

    public IntegerAttribute times(com.gs.fw.finder.attribute.ShortAttribute attribute)
    {
        return IntegerNumericType.getInstance().createCalculatedAttribute(IntegerNumericType.getInstance().createMultiplicationCalculator(this, (ShortAttribute) attribute));
    }

    public IntegerAttribute dividedBy(com.gs.fw.finder.attribute.ShortAttribute attribute)
    {
        return IntegerNumericType.getInstance().createCalculatedAttribute(IntegerNumericType.getInstance().createDivisionCalculator(this, (ShortAttribute) attribute));
    }

    // IntegerAttribute operands

    public IntegerAttribute plus(com.gs.fw.finder.attribute.IntegerAttribute attribute)
    {
        return IntegerNumericType.getInstance().createCalculatedAttribute(IntegerNumericType.getInstance().createAdditionCalculator(this, (IntegerAttribute) attribute));
    }

    public IntegerAttribute minus(com.gs.fw.finder.attribute.IntegerAttribute attribute)
    {
        return IntegerNumericType.getInstance().createCalculatedAttribute(IntegerNumericType.getInstance().createSubtractionCalculator(this, (IntegerAttribute) attribute));
    }

    public IntegerAttribute times(com.gs.fw.finder.attribute.IntegerAttribute attribute)
    {
        return IntegerNumericType.getInstance().createCalculatedAttribute(IntegerNumericType.getInstance().createMultiplicationCalculator(this, (IntegerAttribute) attribute));
    }

    public IntegerAttribute dividedBy(com.gs.fw.finder.attribute.IntegerAttribute attribute)
    {
        return IntegerNumericType.getInstance().createCalculatedAttribute(IntegerNumericType.getInstance().createDivisionCalculator(this, (IntegerAttribute) attribute));
    }

    // LongAttribute operands

    public LongAttribute plus(com.gs.fw.finder.attribute.LongAttribute attribute)
    {
        return LongNumericType.getInstance().createCalculatedAttribute(LongNumericType.getInstance().createAdditionCalculator(this, (LongAttribute) attribute));
    }

    public LongAttribute minus(com.gs.fw.finder.attribute.LongAttribute attribute)
    {
        return LongNumericType.getInstance().createCalculatedAttribute(LongNumericType.getInstance().createSubtractionCalculator(this, (LongAttribute) attribute));
    }

    public LongAttribute times(com.gs.fw.finder.attribute.LongAttribute attribute)
    {
        return LongNumericType.getInstance().createCalculatedAttribute(LongNumericType.getInstance().createMultiplicationCalculator(this, (LongAttribute) attribute));
    }

    public LongAttribute dividedBy(com.gs.fw.finder.attribute.LongAttribute attribute)
    {
        return LongNumericType.getInstance().createCalculatedAttribute(LongNumericType.getInstance().createDivisionCalculator(this, (LongAttribute) attribute));
    }

    // FloatAttribute operands

    public FloatAttribute plus(com.gs.fw.finder.attribute.FloatAttribute attribute)
    {
        return FloatNumericType.getInstance().createCalculatedAttribute(FloatNumericType.getInstance().createAdditionCalculator(this, (FloatAttribute) attribute));
    }

    public FloatAttribute minus(com.gs.fw.finder.attribute.FloatAttribute attribute)
    {
        return FloatNumericType.getInstance().createCalculatedAttribute(FloatNumericType.getInstance().createSubtractionCalculator(this, (FloatAttribute) attribute));
    }

    public FloatAttribute times(com.gs.fw.finder.attribute.FloatAttribute attribute)
    {
        return FloatNumericType.getInstance().createCalculatedAttribute(FloatNumericType.getInstance().createMultiplicationCalculator(this, (FloatAttribute) attribute));
    }

    public FloatAttribute dividedBy(com.gs.fw.finder.attribute.FloatAttribute attribute)
    {
        return FloatNumericType.getInstance().createCalculatedAttribute(FloatNumericType.getInstance().createDivisionCalculator(this, (FloatAttribute) attribute));
    }

    // DoubleAttribute operands

    public DoubleAttribute plus(com.gs.fw.finder.attribute.DoubleAttribute attribute)
    {
        return DoubleNumericType.getInstance().createCalculatedAttribute(DoubleNumericType.getInstance().createAdditionCalculator(this, (DoubleAttribute) attribute));
    }

    public DoubleAttribute minus(com.gs.fw.finder.attribute.DoubleAttribute attribute)
    {
        return DoubleNumericType.getInstance().createCalculatedAttribute(DoubleNumericType.getInstance().createSubtractionCalculator(this, (DoubleAttribute) attribute));
    }

    public DoubleAttribute times(com.gs.fw.finder.attribute.DoubleAttribute attribute)
    {
        return DoubleNumericType.getInstance().createCalculatedAttribute(DoubleNumericType.getInstance().createMultiplicationCalculator(this, (DoubleAttribute) attribute));
    }

    public DoubleAttribute dividedBy(com.gs.fw.finder.attribute.DoubleAttribute attribute)
    {
        return DoubleNumericType.getInstance().createCalculatedAttribute(DoubleNumericType.getInstance().createDivisionCalculator(this, (DoubleAttribute) attribute));
    }

    // BigDecimalAttribute operands

    public BigDecimalAttribute plus(BigDecimalAttribute attribute)
    {
        return BigDecimalNumericType.getInstance().createCalculatedAttribute(BigDecimalNumericType.getInstance().createAdditionCalculator(this, attribute));
    }

    public BigDecimalAttribute minus(BigDecimalAttribute attribute)
    {
        return BigDecimalNumericType.getInstance().createCalculatedAttribute(BigDecimalNumericType.getInstance().createSubtractionCalculator(this, attribute));
    }

    public BigDecimalAttribute times(BigDecimalAttribute attribute)
    {
        return BigDecimalNumericType.getInstance().createCalculatedAttribute(BigDecimalNumericType.getInstance().createMultiplicationCalculator(this, attribute));
    }

    public BigDecimalAttribute dividedBy(BigDecimalAttribute attribute)
    {
        return BigDecimalNumericType.getInstance().createCalculatedAttribute(BigDecimalNumericType.getInstance().createDivisionCalculator(this, attribute, attribute.getScale()));
    }

    @Override
    public IntegerAttribute absoluteValue()
    {
        return new CalculatedIntegerAttribute(new AbsoluteValueCalculatorInteger(this));
    }

    public NumericAttribute zDispatchAddTo(NumericAttribute firstAddend)
    {
        return firstAddend.plus(this);
    }

    public NumericAttribute zDispatchSubtractFrom(NumericAttribute minuend)
    {
        return minuend.minus(this);
    }

    public NumericAttribute zDispatchMultiplyBy(NumericAttribute firstMultiplicand)
    {
        return firstMultiplicand.times(this);
    }

    public NumericAttribute zDispatchDivideInto(NumericAttribute divdend)
    {
        return divdend.dividedBy(this);
    }

    @Override
    public String zGetSqlForDatabaseType(DatabaseType databaseType)
    {
        return databaseType.getSqlDataTypeForInt();
    }

    public IntegerAttribute mod(int divisor)
    {
        return new CalculatedIntegerAttribute(new ModCalculatorInteger(this, divisor));
    }

    @Override
    public AttributeUpdateWrapper zConstructNullUpdateWrapper(MithraDataObject data)
    {
        return new IntegerNullUpdateWrapper(this, data);
    }

    @Override
    public Operation zGetOperationFromOriginal(Object original, Attribute left, Map tempOperationPool)
    {
        if (left.isAttributeNull(original))
        {
            return this.isNull();
        }
        return this.eq(((IntegerAttribute) left).intValueOf(original));
    }

    @Override
    public Operation zGetPrototypeOperation(Map<Attribute, Object> tempOperationPool)
    {
        return this.eq(0);
    }

    @Override
    public Operation zGetOperationFromResult(T result, Map<Attribute, Object> tempOperationPool)
    {
        if (this.isAttributeNull(result))
        {
            return this.isNull();
        }
        return this.eq(this.intValueOf(result));
    }

    public double doubleValueOf(T o)
    {
        return intValueOf(o);
    }

    public void setDoubleValue(T o, double newValue)
    {
        this.setIntValue(o, (int) newValue);
    }

    public BigDecimal bigDecimalValueOf(T o)
    {
        return BigDecimal.valueOf(intValueOf(o));
    }

    public void setBigDecimalValue(T o, BigDecimal newValue)
    {
        this.setIntValue(o, newValue.intValue());
    }

    public IntegerAttribute plus(int addend)
    {
        return new CalculatedIntegerAttribute(new ConstAdditionCalculatorInteger(this, addend));
    }

    public IntegerAttribute minus(int addend)
    {
        return this.plus(-addend);
    }

    public IntegerAttribute times(int multiplicand)
    {
        return new CalculatedIntegerAttribute(new ConstMultiplicationCalculatorInteger(this, multiplicand));
    }

    public IntegerAttribute dividedBy(int divisor)
    {
        return new CalculatedIntegerAttribute(new ConstDivisionCalculatorInteger(this, divisor));
    }

    public DoubleAttribute plus(double addend)
    {
        return new CalculatedDoubleAttribute(new ConstAdditionCalculatorDouble(this, addend));
    }

    public DoubleAttribute minus(double addend)
    {
        return this.plus(-addend);
    }

    public DoubleAttribute times(double multiplicand)
    {
        return new CalculatedDoubleAttribute(new ConstMultiplicationCalculatorDouble(this, multiplicand));
    }

    public DoubleAttribute dividedBy(double divisor)
    {
        return new CalculatedDoubleAttribute(new ConstDivisionCalculatorDouble(this, divisor));
    }

    public BigDecimalAttribute plus(BigDecimal addend)
    {
        return new CalculatedBigDecimalAttribute(new ConstAdditionCalculatorBigDecimal(this, addend));
    }

    public BigDecimalAttribute minus(BigDecimal addend)
    {
        return this.plus(addend.negate());
    }

    public BigDecimalAttribute times(BigDecimal multiplicand)
    {
        return new CalculatedBigDecimalAttribute(new ConstMultiplicationCalculatorBigDecimal(this, multiplicand));
    }

    public BigDecimalAttribute dividedBy(BigDecimal divisor)
    {
        return new CalculatedBigDecimalAttribute(new ConstDivisionCalculatorBigDecimal(this, divisor));
    }

    @Override
    public IntegerAggregateAttribute min()
    {
        return new IntegerAggregateAttribute(new MinCalculatorNumeric(this));
    }

    @Override
    public IntegerAggregateAttribute max()
    {
        return new IntegerAggregateAttribute(new MaxCalculatorNumeric(this));
    }

    public IntegerAggregateAttribute sum()
    {
        return new IntegerAggregateAttribute(new SumCalculatorNumeric(this));
    }

    public IntegerAggregateAttribute avg()
    {
        return new IntegerAggregateAttribute(new AverageCalculatorNumeric(this));
    }

    @Override
    protected void zWriteNonNullSerial(ReladomoSerializationContext context, SerialWriter writer, T reladomoObject) throws IOException
    {
        writer.writeInt(context, this.getAttributeName(), this.intValueOf(reladomoObject));
    }
}


text:
#ifndef __DAE__
#define __DAE__

#include <dae/daeTypes.h>
#include <dae/daeError.h>
#include <dae/daeInterface.h>
#include <dae/daeDatabase.h>
#include <dae/daeIOPlugin.h>
#include <dae/daeIntegrationObject.h>

class daeIDRefResolver;
class domCOLLADA;

/**
 * The @c DAE class implements a standard interface to the
 * COLLADA runtime database.
 *
 * @c DAE serves as a wrapper for the entire pipeline ensuring
 * a consistent interface, regardless of extensions to or replacements
 * for the various API components. It provides methods to load, store,
 * translate and query COLLADA elements. A @c DAE object automatically creates
 * and initializes default versions of the COLLADA backend, the COLLADA
 * runtime database, and registered integration libraries.
 */
class DAE : public daeInterface
{
public:
	/**
	*  Constructor.
	*/
	DLLSPEC DAE();
	/**
	* Destructor.
	*/
	virtual DLLSPEC ~DAE();

	/**
	 * Releases all static meta information associated with the COLLADA DOM.
	 * Ff there are no remaining instances of a @c DAE cleanup happens automatically.
	 * @note This function is useless if called by the application in a non-static
	 * context.
	 */
	static DLLSPEC void cleanup();

	// Abstract Interface Class for the daeDatabase front end
public:
	// Database setup
	virtual DLLSPEC daeDatabase* getDatabase();
	virtual DLLSPEC daeInt setDatabase(daeDatabase* database);

	// IO Plugin setup
	virtual DLLSPEC daeIOPlugin* getIOPlugin();
	virtual DLLSPEC daeInt setIOPlugin(daeIOPlugin* plugin);

	// Integration Library Setup
	virtual DLLSPEC daeIntegrationLibraryFunc getIntegrationLibrary();
	virtual DLLSPEC daeInt setIntegrationLibrary(daeIntegrationLibraryFunc regFunc);

	// batch file operations
	virtual DLLSPEC daeInt load(daeString name, daeString docBuffer = NULL);
	virtual DLLSPEC daeInt save(daeString documentName, daeBool replace=true);
	virtual DLLSPEC daeInt save(daeUInt documentIndex, daeBool replace=true);
	virtual DLLSPEC daeInt saveAs(daeString name, daeString documentName, daeBool replace=true);
	virtual DLLSPEC daeInt saveAs(daeString name, daeUInt documentIndex=0, daeBool replace=true);

	virtual DLLSPEC daeInt unload(daeString name);
	virtual DLLSPEC daeInt clear();

	// Load/Save Progress
	virtual DLLSPEC void getProgress(daeInt* bytesParsed,
		daeInt* lineNumber,
		daeInt* totalBytes,
		daeBool reset = false );

	// Simple Query
	virtual DLLSPEC domCOLLADA* getDom(daeString name);
	virtual DLLSPEC daeString getDomVersion();
	virtual DLLSPEC daeInt setDom(daeString name, domCOLLADA* dom);

private:
	daeDatabase *database;
	daeIOPlugin *plugin;
	daeURIResolver* resolver;
	daeIDRefResolver* idResolver;
	bool defaultDatabase;
	bool defaultPlugin;
	daeIntegrationLibraryFunc registerFunc;
	static daeMetaElement *topMeta;
};

#endif // __DAE_INTERFACE__


text:
pysal.explore.spaghetti.NetworkK.validatedistribution
=====================================================

.. currentmodule:: pysal.explore.spaghetti

.. automethod:: NetworkK.validatedistribution


text:
All contributors sending pull requests (PRs) must have a Contributor
License Agreement on file as either an
[individual](https://www.cloudfoundry.org/pdfs/CFF_Individual_CLA.pdf)
or via their
[employer](https://www.cloudfoundry.org/pdfs/CFF_Corporate_CLA.pdf).

All new Github issues and PRs will be reviewed by the Project Management
Committee (PMC) on the
[Weekly Call](https://github.com/openservicebrokerapi/servicebroker/wiki/Weekly-Call)
and will have a PMC member assigned to them who is responsible for following up
with the author and bringing the issue/PR to a resolution.

## Minor Changes

Minor change proposals to the specification, changes such as editorial bugs
or enhancements that do not modify the semantics of the specification or
syntax of the API, can be suggested via a Github issue or pull request (PR).

If there is a need for some discussion around how best to address the concern,
then opening an issue prior to doing the work to develop a PR would be best.
These minor issues do not need to follow the [Major Changes](#major-changes)
process described below, rather the issue should be used to come to a consensus
around a PR that will eventually be submitted. If the proposed change is
uncontroversial (e.g. a typo) then a PR can be submitted directly without
opening an issue. Either way, once a PR is submitted it will be reviewed per the
[process](#prissue-review-process) described below.

### Major Changes

Major changes will be tracked through a number of stages before becoming part of
the specification. The working group will use a set of pre-defined Github labels
to highlight the current stage of each proposal. Note that these labels will not be
used for [minor changes](#minor-changes).

New design proposals to the API spec should be submitted by opening a
Github issue with a link to a Google Doc containing the proposal. Proposals
should focus primarily on motivation, problem statement, and use cases before
suggesting a solution or change. Collaboration on the design, fleshing out of
use cases, etc can occur as comment discussions in the Google Doc, as well
as on our weekly calls. Once the working group have agreed to focus on a
proposal, it will move into the first stage, as described below.

The stages that a proposal will go through are as follows:
- `1 - reviewing proposal`:
  The API working group is actively reviewing a proposal that has been submitted
  as a Github issue with the aim of validating both the problem statements and
  any proposed solutions. Critical information such as new API endpoints and
  response codes should be reviewed at this stage. For changes largely impacting
  the Open Service Broker API actors (Platforms, Service Authors, etc), it is
  recommended to solicit feedback from these actors and leave enough time (say
  2 weeks) for feedback to be provided, and for the potentially received
  objections/suggestions to be handled.
  Once the design has been finalized in the Google Doc, the proposed set of
  changes to the specification should be made available for review. This could
  be done by pointing to a branch in a Github repo with the proposed edits or by
  creating a PR with the `do not merge` label assigned to it. Reviewers, or
  potential implementers of the feature, can then easily see the exact changes
  being proposed so that they can comment on them. If the proposal adds or
  changes an object model or resource endpoint definition, it is expected that
  the PR will also include the necessary updates to the
  [Open API document](openapi.yaml) and [Swagger document](swagger.yaml).
  Before moving to the next stage, consensus must be agreed on the weekly call
  that the proposal is ready to be validated.
- `2 - validating through implementation`:
  One or more platforms are actively working on the proposal with the aim of
  providing feedback on the end-to-end implementation of the proposed solution.
  The related issue and/or PR should be kept updated with any activity or
  feedback that is collected whilst the change is being implemented. It is
  expected that during this implementation phase there will be changes made to
  the design to accurately represent the current status of the proposal.
  Before moving to the next stage, this feedback must have been presented on the
  weekly call and any issues found during this stage must have been discussed
  with the group and the issue and/or PR should have been updated accordingly.
- `3 - reviewing PR`:
  Feedback has been received on the implementation of the proposed solution and
  a pull request has been created containing the validated specification
  changes. By this point, the API interactions should be well understood and
  there should be no technical surprises; we expect the only discussion
  necessary on PRs to be for wordsmithing and formatting. The PR will then be
  reviewed as described in the [process](#prissue-review-process) below.

Note that not all issues will need to go through the
`validation through implementation` stage, and proposals can move back to a
previous label at any time.

## PR/Issue Review Process

All proposals (either pull requests or issues) will follow the process
described below:

- All proposals must be available for review for no less than one week before
  they are approved. This will provide each dedicated committer enough time
  to review the proposal without unnecessarily delaying forward progress.
  Any non-trivial edit to the proposal (e.g. edits larger than typos) will
  reset the clock.
- Any dedicated committer can veto (via a "NOT LGTM" comment in the proposal).
  The comment must include the reasoning behind the veto.
  It is then expected that the dedicated committers will discuss the concerns
  and determine the next step for proposal - either close/reject the proposal
  or address the concerns raised such that the "NOT LGTM" can be rescinded.
- A proposal requires at least 3 "LGTM" comments from at least 3 different
  organizations to be approved.
- Once a "design change" issue is approved, it will be tagged with an
  "proposal finalized" label. This indicates that it is ready to be
  implemented by a platform developer, see the [process](#contributing) above.
- Once a pull request is approved, it will be merged into the 'master' branch
  and labels should be removed any related issues and PRs as necessary.
- If the pull request is significant enough to warrant noting a difference in
  compatibility between platforms, the feature should be noted in the table for
  [Platform Compatibility for OSBAPI](compatibility.md).

## Release Process

Any member of the PMC can request a specific SHA on master (the
**Release RC SHA**) is ready to be released into a new version of the spec. They
will do this by creating a new PR with the title of the proposed release. For
example, **"Release Proposal: v$major.$minor"**.

### Prepare a PR

1. In a fork, create a new branch called "v$major.$minor-rc" from the
  **Release RC SHA**.
2. Create a new commit titled `prepare release` with the following changes:
  * Update [release-notes.md](release-notes.md) detailing the changes that are
  to be released in this version. Include a versioned link to the new branch's
  version of the spec.
  * Update [README.md](README.md) with an updated _Latest Release_ subheading
  and links to the latest version of the documents (`spec.md`, `profile.md`,
  `openapi.yaml`, etc).
  * Update [spec.md](spec.md) with an updated _Changes Since v..._ section (and
  link from table of contents) containing a copy of the relevant release notes,
  and with any references to the previous version of the specification (i.e. the
  `X-Broker-API-Version` headers) updated. Do not update the header
  `Open Service Broker API (master - might contain changes that are not yet released)`
  (this will be done if and when the release proposal is approved).
  * Update [diagram.md](diagram.md) to show the new version number in the
  header and link to the correct version of the Google Drawing from the
  [OSBAPI Google Drive Folder](https://drive.google.com/drive/u/0/folders/0B427Up4C9IE0VmM0ZlhHTG1Rc0E).
3. Open a new pull request titled **Release Proposal: v$major.$minor** from the
  branch of the fork to the master branch of the repository, with the following
  description:
  ```
  Announcing a new release candidate as described in the
  [Release Process](https://github.com/openservicebrokerapi/servicebroker/blob/master/CONTRIBUTING.md#release-process).

  **Release version**: <v$major.$minor>
  **Release RC SHA**: <Release RC SHA>
  **Target release date**: <YYYY-MM-DD> (one week after the next weekly call)

  The one-week
  [Review Process](https://github.com/openservicebrokerapi/servicebroker/blob/master/CONTRIBUTING.md#review-process)
  will be triggered on the next weekly call.
  ```
4. Announce the release proposal on the next weekly call and notify the mailing
  list of the proposal, triggering the start of the
  [Review Process](#review-process) as outlined below.

### Review Process

- All release proposals must be available for review for no less than one
  week before they are approved. This will provide each dedicated committer
  enough time to review the release proposal without unnecessarily delaying
  forward progress.
- Any dedicated committer can veto (via a "NOT LGTM" comment in the proposal).
  The comment must include the reasoning behind the veto. It is then expected
  that the dedicated committers will discuss the concerns and determine the next
  steps for release proposal. The submitter should either close/reject the
  proposal or address the concerns raised such that the "NOT LGTM" can be
  rescinded.
- A release proposal requires at least 3 "LGTM" comments from at least
  3 different organizations to be approved.

### Once Approved

Once the release is approved, the following actions should be taken by
any PMC member:

1. Merge the release proposal PR into the master branch of the repository. There
   should not be any conflicts as the text in the files that have changed should
   only be changed during this release process.
1. Checkout the **Release RC SHA** (either to a local branch or in 'detached HEAD'
   state). This is done in order to ensure that changes that were merged into
   master after the release candidate was created are not included in the
   release.
1. Cherry pick the `prepare release` commit.
1. Update [spec.md](spec.md), [profile](profile.md),
   [openapi.yaml](openapi.yaml) and [swagger.yaml](swagger.yaml) to include the
   version of the release `v$major.$minor`.
1. Create a new commit with these changes called `finalise release`.
1. Tag the commit with the name `v$major.$minor`.
1. Push the tag to the repository with `git push origin v$major.$minor`.
1. Notify the mailing list of the new release.
1. Update the [Roadmap & Release Planning](https://github.com/openservicebrokerapi/servicebroker/projects/1)
   project.
1. The PMC will create a blog post for the new release.


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

<resource xmlns:flora="urn:flora:options">
    <flora:dataSource type="mysql" database="db">
        <flora:option foo="bar">SELECT 'foo'</flora:option>
    </flora:dataSource>
</resource>


text:
require 'rails_helper'

describe Comment, :type => :model do

  describe "validations" do

    describe "requireds" do
      it { is_expected.to validate_presence_of(:body) }
    end
  end

  describe "associations" do
    it { is_expected.to belong_to(:user) }
    it { is_expected.to belong_to(:proposal) }
  end
end


text:
package org.neo4j.graphalgo.impl.util;

import common.Neo4jAlgoTestCase;
import org.junit.Test;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

import org.neo4j.graphalgo.CommonEvaluators;
import org.neo4j.graphalgo.CostEvaluator;
import org.neo4j.graphdb.Path;
import org.neo4j.kernel.impl.util.NoneStrictMath;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;

/**
 * @author Anton Persson
 */
public class TestTopFetchingWeightedPathIterator extends Neo4jAlgoTestCase
{
    @Test
    public void shouldHandleEmptySource()
    {
        topFetcher = new TopFetchingWeightedPathIterator(
                Collections.<Path>emptyIterator(), evaluator );

        assertFalse( "Expected iterator to be empty", topFetcher.hasNext() );
        assertNull( "Expected null after report has no next", topFetcher.fetchNextOrNull() );
    }

    @Test
    public void shouldHandleSinglePath()
    {
        Path a = graph.makePathWithRelProperty( length, "a1-1-a2" );
        List<Path> list = new ArrayList<>(  );
        list.add( a );

        topFetcher = new TopFetchingWeightedPathIterator( list.iterator(), evaluator, epsilon );

        assertTrue( "Expected at least one element", topFetcher.hasNext() );
        assertPathDef( a, topFetcher.next() );
        assertFalse( "Expected no more elements", topFetcher.hasNext() );
        assertNull( "Expected null after report has no next", topFetcher.fetchNextOrNull() );
    }

    @Test
    public void shouldHandleMultipleShortest()
    {
        Path a = graph.makePathWithRelProperty(  length, "a1-1-a2" );
        Path b = graph.makePathWithRelProperty( length, "b1-0-b2-1-b3-0-b4" );
        List<Path> list = new ArrayList<>(  );
        list.add( a );
        list.add( b );

        topFetcher = new TopFetchingWeightedPathIterator( list.iterator(), evaluator, epsilon );
        List<Path> result = new ArrayList<>();
        while ( topFetcher.hasNext() )
        {
            result.add( topFetcher.next() );
        }

        assertPathsWithPaths( result, a, b );
    }

    @Test
    public void shouldHandleUnsortedSource()
    {
        Path a = graph.makePathWithRelProperty( length, "a1-1-a2-2-a3" );             // 3
        Path b = graph.makePathWithRelProperty( length, "b1-3-b2-3-b3" );             // 6
        Path c = graph.makePathWithRelProperty( length, "c1-0-c2-1-c3" );             // 1
        Path d = graph.makePathWithRelProperty( length, "d1-3-d2-0-d3" );             // 3
        Path e = graph.makePathWithRelProperty( length, "e1-0-e2-0-e3-0-e4-1-e5" );   // 1

        List<Path> list = Arrays.asList(
                new Path[]{
                        a,b,c,d,e
                }
        );
        topFetcher = new TopFetchingWeightedPathIterator( list.iterator(), evaluator, epsilon );

        List<Path> result = new ArrayList<>(  );
        while ( topFetcher.hasNext() )
        {
            result.add( topFetcher.next() );
        }

        assertPathsWithPaths( result, c, e );
    }

    private final double epsilon = NoneStrictMath.EPSILON;
    private final String length = "length";
    private CostEvaluator evaluator = CommonEvaluators.doubleCostEvaluator( length );
    private TopFetchingWeightedPathIterator topFetcher;
}


text:
import React from 'react';

import SidePanel from '.';

const actions = [
	{
		componentId: 'first',
		href: '/storybook',
	},
	{
		componentId: 'second',
		href: '/foo',
	},
	{
		componentId: 'configuration',
		href: '/configuration',
	},
];

export default {
	title: 'SidePanel',
};

export const Default = () => <SidePanel actions={actions} />;
export const InjectedSettings = () => (
	<SidePanel
		actionIds={['menu:first', 'menu:second', 'menu:third']}
		components={{
			'before-actions': [
				{
					component: 'FilterBar',
					docked: false,
				},
			],
		}}
	/>
);


text:
//
//  UIImage+ImageEffects.h
//  Hao123_Simple
//
//  Created by zhikuiyu on 14-9-12.
//  Copyright (c) 2014年 baidu. All rights reserved.
//

#import <UIKit/UIKit.h>
#import <Accelerate/Accelerate.h>
#import <float.h>

@interface UIImage (ImageEffects)
- (UIImage *)applyLightEffect;
- (UIImage *)applyExtraLightEffect;
- (UIImage *)applyDarkEffect;
- (UIImage *)applyTintEffectWithColor:(UIColor *)tintColor;

- (UIImage *)applyBlurWithRadius:(CGFloat)blurRadius tintColor:(UIColor *)tintColor saturationDeltaFactor:(CGFloat)saturationDeltaFactor maskImage:(UIImage *)maskImage;
/**
 *  获取圆形的图片
 */
-(UIImage*) circleImage;
@end