text:
const builtInMatchers = require('./matchers');

const { debug, setDebugNamespace, getDebug } = require('../lib/debug');

const isUrlMatcher = (matcher) =>
	matcher instanceof RegExp ||
	typeof matcher === 'string' ||
	(typeof matcher === 'object' && 'href' in matcher);

const isFunctionMatcher = (matcher) => typeof matcher === 'function';

class Route {
	constructor(args, fetchMock) {
		this.fetchMock = fetchMock;
		const debug = getDebug('compileRoute()');
		debug('Compiling route');
		this.init(args);
		this.sanitize();
		this.validate();
		this.generateMatcher();
		this.limit();
		this.delayResponse();
	}

	validate() {
		if (!('response' in this)) {
			throw new Error('fetch-mock: Each route must define a response');
		}

		if (!Route.registeredMatchers.some(({ name }) => name in this)) {
			throw new Error(
				"fetch-mock: Each route must specify some criteria for matching calls to fetch. To match all calls use '*'"
			);
		}
	}

	init(args) {
		const [matcher, response, options = {}] = args;

		const routeConfig = {};

		if (isUrlMatcher(matcher) || isFunctionMatcher(matcher)) {
			routeConfig.matcher = matcher;
		} else {
			Object.assign(routeConfig, matcher);
		}

		if (typeof response !== 'undefined') {
			routeConfig.response = response;
		}

		Object.assign(routeConfig, options);
		Object.assign(this, routeConfig);
	}

	sanitize() {
		const debug = getDebug('sanitize()');
		debug('Sanitizing route properties');

		if (this.method) {
			debug(`Converting method ${this.method} to lower case`);
			this.method = this.method.toLowerCase();
		}
		if (isUrlMatcher(this.matcher)) {
			debug('Mock uses a url matcher', this.matcher);
			this.url = this.matcher;
			delete this.matcher;
		}

		this.functionMatcher = this.matcher || this.functionMatcher;

		debug('Setting route.identifier...');
		debug(`  route.name is ${this.name}`);
		debug(`  route.url is ${this.url}`);
		debug(`  route.functionMatcher is ${this.functionMatcher}`);
		this.identifier = this.name || this.url || this.functionMatcher;
		debug(`  -> route.identifier set to ${this.identifier}`);
	}

	generateMatcher() {
		setDebugNamespace('generateMatcher()');
		debug('Compiling matcher for route');

		const activeMatchers = Route.registeredMatchers
			.map(
				({ name, matcher, usesBody }) =>
					this[name] && { matcher: matcher(this, this.fetchMock), usesBody }
			)
			.filter((matcher) => Boolean(matcher));

		this.usesBody = activeMatchers.some(({ usesBody }) => usesBody);

		debug('Compiled matcher for route');
		setDebugNamespace();
		this.matcher = (url, options = {}, request) =>
			activeMatchers.every(({ matcher }) => matcher(url, options, request));
	}

	limit() {
		const debug = getDebug('limit()');
		debug('Limiting number of requests to handle by route');
		if (!this.repeat) {
			debug(
				'  No `repeat` value set on route. Will match any number of requests'
			);
			return;
		}

		debug(`  Route set to repeat ${this.repeat} times`);
		const matcher = this.matcher;
		let timesLeft = this.repeat;
		this.matcher = (url, options) => {
			const match = timesLeft && matcher(url, options);
			if (match) {
				timesLeft--;
				return true;
			}
		};
		this.reset = () => (timesLeft = this.repeat);
	}

	delayResponse() {
		const debug = getDebug('delayResponse()');
		debug(`Applying response delay settings`);
		if (this.delay) {
			debug(`  Wrapping response in delay of ${this.delay} miliseconds`);
			const response = this.response;
			this.response = () => {
				debug(`Delaying response by ${this.delay} miliseconds`);
				return new Promise((res) =>
					setTimeout(() => res(response), this.delay)
				);
			};
		} else {
			debug(
				`  No delay set on route. Will respond 'immediately' (but asynchronously)`
			);
		}
	}

	static addMatcher(matcher) {
		Route.registeredMatchers.push(matcher);
	}
}

Route.registeredMatchers = [];

builtInMatchers.forEach(Route.addMatcher);

module.exports = Route;


text:
package awesomeBH.tests;

import static org.junit.Assert.*;

import org.junit.Test;

import awesomeBH.BinomialHeap;

public class BinomialHeapTest {
	@Test public void emptyTest1() {
		BinomialHeap heap = new BinomialHeap();
		assertEquals(true, heap.empty());
	}

	@Test public void insertTest1() {
		BinomialHeap heap = new BinomialHeap();

		for (int i=1; i<10; i++) {
			heap.insert(i);
		}

		assertEquals(false, heap.empty());
		assertEquals(9, heap.size());
	}

	@Test public void deleteMinTest1() {
		BinomialHeap heap = new BinomialHeap();

		heap.insert(3);
		heap.deleteMin();

		assertEquals(true, heap.empty());
	}

	@Test public void deleteMinTest2() {
		BinomialHeap heap = new BinomialHeap();

		heap.insert(3);
		heap.insert(1);
		heap.deleteMin();

		assertEquals(1, heap.size());
		assertEquals(3, heap.findMin());
	}

	@Test public void deleteMinTest3() {
		BinomialHeap heap = new BinomialHeap();

		heap.insert(1);
		heap.insert(3);
		heap.deleteMin();

		assertEquals(1, heap.size());
		assertEquals(3, heap.findMin());
		assertEquals(true, heap.isValid());

		heap.insert(7);
		heap.insert(9);
		heap.insert(1);
		heap.insert(12);
		heap.deleteMin();
		assertEquals(true, heap.isValid());
	}

	@Test public void deleteMinTest4() {
		BinomialHeap heap = new BinomialHeap();
		int[] array = { 7,2,5,14,1,30,12,19,24,7,2,5,14,1,30 };
		heap.arrayToHeap(array);
		assertEquals(true, heap.isValid());
		assertEquals(1, heap.findMin());

		heap.deleteMin();
		assertEquals(true, heap.isValid());
		assertEquals(1, heap.findMin());

		heap.deleteMin();
		assertEquals(true, heap.isValid());
		assertEquals(2, heap.findMin());
	}

	@Test public void deleteMinTest5() {
		BinomialHeap heap = new BinomialHeap();
		for (int i=0; i<50000; i+=50) {
			heap.insert(i+1);
		}

		for (int i=0; i<500; i++) {
			heap.deleteMin();
		}

		assertEquals(500, heap.size());
	}

	@Test public void deleteMinTest6() {
		int[] ar = {171, 48, 9, 112, 150, 199, 254, 263, 110, 172};
		BinomialHeap heap = new BinomialHeap();
		heap.arrayToHeap(ar);

		heap.deleteMin();
		heap.deleteMin();
		heap.deleteMin();
	}

	@Test public void findMinTest1() {
		BinomialHeap heap = new BinomialHeap();

		heap.insert(6);
		heap.insert(5);
		heap.insert(7);
		heap.insert(9);
		heap.insert(3);
		heap.insert(8);
		heap.insert(4);
		heap.insert(10);

		assertEquals(3, heap.findMin());
	}

	@Test public void findMinTest2() {
		BinomialHeap heap = new BinomialHeap();

		for (int i=4; i<200; i++) {
			heap.insert(i);
		}
		heap.insert(3);
		for (int i=201; i<450; i++) {
			heap.insert(i);
		}

		assertEquals(3, heap.findMin());
	}

	@Test public void meldTest1() {
		BinomialHeap h1 = new BinomialHeap();
		int[] array = {16, 21, 30, 19, 14, 25, 13, 28};
		h1.arrayToHeap(array);

		BinomialHeap h2 = new BinomialHeap();
		h2.arrayToHeap(array);

		h1.meld(h2);

		assertEquals(true, h1.isValid());
		assertEquals(16, h1.size());
	}

	@Test public void meldTest2() {
		BinomialHeap h1 = new BinomialHeap();
		int[] array = {16, 21, 30, 19, 14, 25, 13, 28};
		h1.arrayToHeap(array);

		BinomialHeap h2 = new BinomialHeap();
		h2.insert(39);
		h2.insert(30);
		h2.insert(7);
		h2.insert(49877221);
		h2.insert(3);

		h1.meld(h2);

		assertEquals(true, h1.isValid());
		assertEquals(13, h1.size());
	}

	@Test public void treesSizeTest1() {
		BinomialHeap h1 = new BinomialHeap();
		int[] array = {16, 21, 30, 19, 14, 25, 13, 28};
		h1.arrayToHeap(array);
		int[] sizes = {8};
		assertArrayEquals(sizes, h1.treesSize());

		h1.insert(1);
		int[] sizes2 = {1, 8};
		assertArrayEquals(sizes2, h1.treesSize());

		h1.insert(3);
		int[] sizes3 = {2, 8};
		assertArrayEquals(sizes3, h1.treesSize());

		h1.insert(4);
		int[] sizes4 = {1, 2, 8};
		assertArrayEquals(sizes4, h1.treesSize());

		for (int i=99; i<107; i++) {
			h1.insert(i);
		}
		int[] sizes5 = {1, 2, 16};
		assertArrayEquals(sizes5, h1.treesSize());
	}

	@Test public void sizeTest1() {
		BinomialHeap heap = new BinomialHeap();
		assertEquals(0, heap.size());
	}

	@Test public void sizeTest2() {
		BinomialHeap heap = new BinomialHeap();
		heap.insert(6);
		assertEquals(1, heap.size());
	}

	@Test public void sizeTest3() {
		BinomialHeap heap = new BinomialHeap();
		for (int size=1; size<=25; size++) {
			heap.insert(size);
			assertEquals(size, heap.size());
		}
	}

	@Test public void arrayToHeapTest1() {
		int[] array = {16, 21, 30, 19, 14, 25, 13, 28};
		BinomialHeap heap = new BinomialHeap();
		heap.arrayToHeap(array);
		assertEquals(array.length, heap.size());
	}

	@Test public void arrayToHeapTest2() {
		BinomialHeap heap = new BinomialHeap();
		heap.insert(16);
		heap.arrayToHeap(new int[0]);
		assertEquals(0, heap.size());
		assertEquals(true, heap.empty());
	}

	@Test public void arrayToHeapTest3() {
		BinomialHeap heap = new BinomialHeap();
		heap.insert(1);
		int[] array = { 7,2,5 };
		heap.arrayToHeap(array);
		assertEquals(3, heap.size());
		assertEquals(2, heap.findMin());
	}

	@Test public void isValidTest1() {
		BinomialHeap heap = new BinomialHeap();
		int[] array = { 7,2,5,14,1,30 };
		heap.arrayToHeap(array);
		assertEquals(true, heap.isValid());
	}

	@Test public void isValidTest2() {
		BinomialHeap heap = new BinomialHeap();
		int[] array = { 7,2,5,14,1,30,12,19 };
		heap.arrayToHeap(array);

		heap.getLast().setLeftmostChild(heap.getLast().getLeftmostChild().getNext());
		assertEquals(false, heap.isValid());
	}

	@Test public void isValidTest3() {
		BinomialHeap heap = new BinomialHeap();
		int[] array = { 7,2,5,14,1,30,12,19,24,7,2,5,14,1,30 };
		heap.arrayToHeap(array);
		assertEquals(true, heap.isValid());

		heap.getFirst().getNext().getNext().getLeftmostChild().setNext(null);
		assertEquals(false, heap.isValid());
	}

	@Test public void isValidTest4() {
		BinomialHeap heap = new BinomialHeap();
		int[] array = { 7,2,5,14,1,30,12,19,24,7,2,5,14,1,30 };
		heap.arrayToHeap(array);
		assertEquals(true, heap.isValid());

		// kilkul for klal ha arema
		heap.getLast().setLeftmostChild(heap.getLast().getLeftmostChild().getNext());
		assertEquals(false, heap.isValid());
	}

	@Test public void isValidTest5() {
		BinomialHeap heap = new BinomialHeap();
		int[] array = { 7,2,5,14,1,30,12,19,24,7,2,5,14,1,30 };
		heap.arrayToHeap(array);
		assertEquals(true, heap.isValid());

		heap.getLast().getRightmostChild().getRightmostChild().setLeftmostChild(null);
		assertEquals(false, heap.isValid());
	}

	@Test public void emptyEmptyTest() {
		BinomialHeap heap = new BinomialHeap();
		assertEquals(true, heap.empty());
	}
	@Test public void emptyInsertTest() {
		BinomialHeap heap = new BinomialHeap();
		heap.insert(1);
		assertEquals(1, heap.size());
	}
	@Test public void emptyDeleteMinTest() {
		BinomialHeap heap = new BinomialHeap();
		heap.deleteMin();
		assertEquals(true, heap.empty());
	}
	@Test public void emptyFindMinTest() {
		BinomialHeap heap = new BinomialHeap();
		assertEquals(-1, heap.findMin());
	}
	@Test public void emptyMeldTest() {
		BinomialHeap h1 = new BinomialHeap();
		BinomialHeap h2 = new BinomialHeap();

		h1.meld(h2);
		assertEquals(true, h1.empty());
		h1.meld(null);
		assertEquals(true, h1.empty());

		h1.insert(1);
		h1.meld(h2);
		h1.meld(null);
		assertEquals(1, h1.size());

		h2.meld(h1);
		h2.meld(null);
		assertEquals(1, h1.size());
	}
	@Test public void emptySizeTest() {
		BinomialHeap heap = new BinomialHeap();
		assertEquals(0, heap.size());
	}
	@Test public void emptyArrayToHeapTest() {
		BinomialHeap heap = new BinomialHeap();
		int[] a = new int[0];
		heap.arrayToHeap(a);
		assertEquals(0, heap.size());
	}
	@Test public void emptyTreesSizeTest() {
		BinomialHeap heap = new BinomialHeap();
		assertEquals(0, heap.treesSize().length);
	}
	@Test public void emptyIsValidTest() {
		BinomialHeap heap = new BinomialHeap();
		assertEquals(true, heap.isValid());
	}
}

redpajama_set_name: RedPajamaGithub


text:
import process from 'node:process';
import meow from 'meow';
import {findUpSync} from 'find-up';

const cli = meow(`
	Usage
	  $ find-up <filename>

	Options
	  --cwd=<directory>  Working directory

	Example
	  $ echo $PWD
	  /Users/sindresorhus/foo/bar
	  $ find-up unicorn.png
	  /Users/sindresorhus/unicorn.png
`, {
	importMeta: import.meta,
	flags: {
		cwd: {
			type: 'string',
		},
	},
});

if (cli.input.length === 0) {
	console.error('Specify a filename');
	process.exit(1);
}

const filePath = findUpSync(cli.input[0], cli.flags);

if (filePath) {
	console.log(filePath);
	process.exit(0);
} else {
	process.exit(1);
}


text:
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="index.css">

        Click on any of the images to toggle expand/collapse. Note that the initial state is positioned differently for each.

          Aligned along the left edge of the image. This expands the crop right, while scaling up the height. The initial state uses object-position: top left.

        Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt.

          Aligned along the left edge of the image, offset by 8px. The initial state uses object-position: top left -8px;.

        Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur?

          Aligned on the center of the image. This is the default behavior for object-position.

        Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?

          Aligned on the right edge of the image. This expands the crop left, while moving the image to the right to align with the end state.

        At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Temporibus autem quibusdam et aut officiis debitis aut rerum necessitatibus saepe eveniet ut et voluptates repudiandae sint et molestiae non recusandae. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.


text:
/*	$NetBSD: lsi64854var.h,v 1.12 2008/04/28 20:23:50 martin Exp $ */

/*-
 * Copyright (c) 1998 The NetBSD Foundation, Inc.
 * All rights reserved.
 *
 * This code is derived from software contributed to The NetBSD Foundation
 * by Paul Kranenburg.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */

/*	$FreeBSD: releng/9.3/sys/sparc64/sbus/lsi64854var.h 227302 2011-11-07 13:16:51Z marius $ */

struct lsi64854_softc {
	device_t		sc_dev;

	struct resource		*sc_res;
	u_int			sc_rev;		/* revision */
	int			sc_burst;	/* max suported burst size */

	int			sc_channel;
#define L64854_CHANNEL_SCSI	1
#define L64854_CHANNEL_ENET	2
#define L64854_CHANNEL_PP	3
	void			*sc_client;

	int			sc_active;	/* DMA active? */
	bus_dmamap_t		sc_dmamap;	/* DMA map for bus_dma_* */

	bus_dma_tag_t		sc_parent_dmat;
	bus_dma_tag_t		sc_buffer_dmat;
	bus_size_t		sc_maxdmasize;
	int			sc_datain;
	size_t			sc_dmasize;
	void			**sc_dmaaddr;
	size_t			*sc_dmalen;

	void	(*reset)(struct lsi64854_softc *);/* reset routine */
	int	(*setup)(struct lsi64854_softc *, void **, size_t *,
		    int, size_t *);		/* DMA setup */
	int	(*intr)(void *);		/* interrupt handler */

	u_int 			sc_dmactl;
	int			sc_dodrain;
};

#define L64854_GCSR(sc)		bus_read_4((sc)->sc_res, L64854_REG_CSR)
#define L64854_SCSR(sc, csr)	bus_write_4((sc)->sc_res, L64854_REG_CSR, csr)

/*
 * DMA engine interface functions.
 */
#define DMA_RESET(sc)			(((sc)->reset)(sc))
#define DMA_INTR(sc)			(((sc)->intr)(sc))
#define DMA_SETUP(sc, a, l, d, s)	(((sc)->setup)(sc, a, l, d, s))
#define DMA_ISACTIVE(sc)		((sc)->sc_active)

#define DMA_ENINTR(sc) do {			\
	uint32_t csr = L64854_GCSR(sc);		\
	csr |= L64854_INT_EN;			\
	L64854_SCSR(sc, csr);			\
} while (/* CONSTCOND */0)

#define DMA_ISINTR(sc)	(L64854_GCSR(sc) & (D_INT_PEND|D_ERR_PEND))

#define DMA_GO(sc) do {				\
	uint32_t csr = L64854_GCSR(sc);		\
	csr |= D_EN_DMA;			\
	L64854_SCSR(sc, csr);			\
	sc->sc_active = 1;			\
} while (/* CONSTCOND */0)

int	lsi64854_attach(struct lsi64854_softc *);
int	lsi64854_detach(struct lsi64854_softc *);


text:
pip install --user virtualenv
python -m virtualenv venv
. ./venv/bin/activate

pip install azure-batch==3.0.0

# schedule test tasks
scripts_dir=$(cd $(dirname $0); pwd)
python $scripts_dir/schedule.py $scripts_dir/all_tests.txt


text:
//
// SQLite3Provider_cbsqlite.cs
//
// Author:
// 	Jim Borden  <jim.borden@couchbase.com>
//
// Copyright (c) 2016 Couchbase, Inc All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
using System;

// Copyright © Microsoft Open Technologies, Inc.
// All Rights Reserved
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT.
//
// See the Apache 2 License for the specific language governing permissions and limitations under the License.

namespace SQLitePCL
{
    using System;
    using System.Collections.Generic;
    using System.Runtime.InteropServices;
#if PLATFORM_IOS
    using MonoTouch;
#elif PLATFORM_UNIFIED
    using ObjCRuntime;
#endif

    /// <summary>
    /// Implements the <see cref="ISQLite3Provider"/> interface
    /// </summary>
#if __ANDROID__
    [Android.Runtime.Preserve(AllMembers=true)]
#elif PLATFORM_IOS
    [MonoTouch.Foundation.Preserve(AllMembers = true)]
#elif PLATFORM_UNIFIED
    [Foundation.Preserve(AllMembers = true)]
#endif
    public sealed class SQLite3Provider_cbsqlite : ISQLite3Provider
    {
        // this file is intended to be compiled only after
        // an automatic search-and-replace has been done.
        //
        // TODO it would be nice to make this file error
        // at compile time when the replace has not been performed.

        public SQLite3Provider_cbsqlite ()
        {
#if NETFX_CORE
            // FYI, the wp8 code does this same thing except using PRAGMAs

        NativeMethods.sqlite3_win32_set_directory(/*data directory type*/1, Windows.Storage.ApplicationData.Current.LocalFolder.Path);
        NativeMethods.sqlite3_win32_set_directory(/*temp directory type*/2, Windows.Storage.ApplicationData.Current.TemporaryFolder.Path);
#endif
        }

        int ISQLite3Provider.sqlite3_open (string filename, out IntPtr db)
        {
            return NativeMethods.sqlite3_open (util.to_utf8 (filename), out db);
        }

        int ISQLite3Provider.sqlite3_open_v2 (string filename, out IntPtr db, int flags, string vfs)
        {
            return NativeMethods.sqlite3_open_v2 (util.to_utf8 (filename), out db, flags, util.to_utf8 (vfs));
        }

#pragma warning disable 649
        private struct sqlite3_vfs
        {
            public int iVersion;
            public int szOsFile;
            public int mxPathname;
            public IntPtr pNext;
            public IntPtr zName;
            public IntPtr pAppData;
            public IntPtr xOpen;
            public SQLiteDeleteDelegate xDelete;
            public IntPtr xAccess;
            public IntPtr xFullPathname;
            public IntPtr xDlOpen;
            public IntPtr xDlError;
            public IntPtr xDlSym;
            public IntPtr xDlClose;
            public IntPtr xRandomness;
            public IntPtr xSleep;
            public IntPtr xCurrentTime;
            public IntPtr xGetLastError;

            [UnmanagedFunctionPointer (CallingConvention.Cdecl)]
            public delegate int SQLiteDeleteDelegate (IntPtr pVfs, byte [] zName, int syncDir);
        }
#pragma warning restore 649

        int ISQLite3Provider.sqlite3__vfs__delete (string vfs, string filename, int syncDir)
        {
            IntPtr ptrVfs = NativeMethods.sqlite3_vfs_find (util.to_utf8 (vfs));
            // this code and the struct it uses was taken from aspnet/DataCommon.SQLite, Apache License 2.0
            sqlite3_vfs vstruct = (sqlite3_vfs)Marshal.PtrToStructure (ptrVfs, typeof (sqlite3_vfs));
            return vstruct.xDelete (ptrVfs, util.to_utf8 (filename), 1);
        }

        int ISQLite3Provider.sqlite3_close_v2 (IntPtr db)
        {
            var rc = NativeMethods.sqlite3_close_v2 (db);
            hooks.removeFor (db);
            return rc;
        }

        int ISQLite3Provider.sqlite3_close (IntPtr db)
        {
            var rc = NativeMethods.sqlite3_close (db);
            hooks.removeFor (db);
            return rc;
        }

        int ISQLite3Provider.sqlite3_enable_shared_cache (int enable)
        {
            return NativeMethods.sqlite3_enable_shared_cache (enable);
        }

        void ISQLite3Provider.sqlite3_interrupt (IntPtr db)
        {
            NativeMethods.sqlite3_interrupt (db);
        }

#if PLATFORM_IOS || PLATFORM_UNIFIED
        [MonoPInvokeCallback (typeof(NativeMethods.callback_exec))] // TODO not xplat
#endif
        static int exec_hook_bridge (IntPtr p, int n, IntPtr values_ptr, IntPtr names_ptr)
        {
            exec_hook_info hi = exec_hook_info.from_ptr (p);
            return hi.call (n, values_ptr, names_ptr);
        }

        int ISQLite3Provider.sqlite3_exec (IntPtr db, string sql, delegate_exec func, object user_data, out string errMsg)
        {
            IntPtr errmsg_ptr;
            int rc;

            if (func != null) {
                exec_hook_info hi = new exec_hook_info (func, user_data);
                rc = NativeMethods.sqlite3_exec (db, util.to_utf8 (sql), exec_hook_bridge, hi.ptr, out errmsg_ptr);
                hi.free ();
            } else {
                rc = NativeMethods.sqlite3_exec (db, util.to_utf8 (sql), null, IntPtr.Zero, out errmsg_ptr);
            }

            if (errmsg_ptr == IntPtr.Zero) {
                errMsg = null;
            } else {
                errMsg = util.from_utf8 (errmsg_ptr);
                NativeMethods.sqlite3_free (errmsg_ptr);
            }

            return rc;
        }

        int ISQLite3Provider.sqlite3_complete (string sql)
        {
            return NativeMethods.sqlite3_complete (util.to_utf8 (sql));
        }

        string ISQLite3Provider.sqlite3_compileoption_get (int n)
        {
            return util.from_utf8 (NativeMethods.sqlite3_compileoption_get (n));
        }

        int ISQLite3Provider.sqlite3_compileoption_used (string s)
        {
            return NativeMethods.sqlite3_compileoption_used (util.to_utf8 (s));
        }

        int ISQLite3Provider.sqlite3_table_column_metadata (IntPtr db, string dbName, string tblName, string colName, out string dataType, out string collSeq, out int notNull, out int primaryKey, out int autoInc)
        {
            IntPtr datatype_ptr;
            IntPtr collseq_ptr;

            int rc = NativeMethods.sqlite3_table_column_metadata (
                        db, util.to_utf8 (dbName), util.to_utf8 (tblName), util.to_utf8 (colName),
                        out datatype_ptr, out collseq_ptr, out notNull, out primaryKey, out autoInc);

            if (datatype_ptr == IntPtr.Zero) {
                dataType = null;
            } else {
                dataType = util.from_utf8 (datatype_ptr);
                if (dataType.Length == 0) {
                    dataType = null;
                }
            }

            if (collseq_ptr == IntPtr.Zero) {
                collSeq = null;
            } else {
                collSeq = util.from_utf8 (collseq_ptr);
                if (collSeq.Length == 0) {
                    collSeq = null;
                }
            }

            return rc;
        }

        int ISQLite3Provider.sqlite3_prepare_v2 (IntPtr db, string sql, out IntPtr stm, out string remain)
        {
            IntPtr tail;
            int rc = NativeMethods.sqlite3_prepare_v2 (db, util.to_utf8 (sql), -1, out stm, out tail);
            if (tail == IntPtr.Zero) {
                remain = null;
            } else {
                remain = util.from_utf8 (tail);
                if (remain.Length == 0) {
                    remain = null;
                }
            }
            return rc;
        }

        int ISQLite3Provider.sqlite3_db_status (IntPtr db, int op, out int current, out int highest, int resetFlg)
        {
            return NativeMethods.sqlite3_db_status (db, op, out current, out highest, resetFlg);
        }

        string ISQLite3Provider.sqlite3_sql (IntPtr stmt)
        {
            return util.from_utf8 (NativeMethods.sqlite3_sql (stmt));
        }

        IntPtr ISQLite3Provider.sqlite3_db_handle (IntPtr stmt)
        {
            return NativeMethods.sqlite3_db_handle (stmt);
        }

        int ISQLite3Provider.sqlite3_blob_open (IntPtr db, string sdb, string table, string col, long rowid, int flags, out IntPtr blob)
        {
            return NativeMethods.sqlite3_blob_open (db, util.to_utf8 (sdb), util.to_utf8 (table), util.to_utf8 (col), rowid, flags, out blob);
        }

        int ISQLite3Provider.sqlite3_blob_bytes (IntPtr blob)
        {
            return NativeMethods.sqlite3_blob_bytes (blob);
        }

        int ISQLite3Provider.sqlite3_blob_close (IntPtr blob)
        {
            return NativeMethods.sqlite3_blob_close (blob);
        }

        int ISQLite3Provider.sqlite3_blob_read (IntPtr blob, byte [] b, int n, int offset)
        {
            return NativeMethods.sqlite3_blob_read (blob, b, n, offset);
        }

        int ISQLite3Provider.sqlite3_blob_write (IntPtr blob, byte [] b, int n, int offset)
        {
            return NativeMethods.sqlite3_blob_write (blob, b, n, offset);
        }

        int ISQLite3Provider.sqlite3_blob_read (IntPtr blob, byte [] b, int bOffset, int n, int offset)
        {
            GCHandle pinned = GCHandle.Alloc (b, GCHandleType.Pinned);
            IntPtr ptr = pinned.AddrOfPinnedObject ();
            int rc = NativeMethods.other_sqlite3_blob_read (blob, new IntPtr (ptr.ToInt64 () + bOffset), n, offset);
            pinned.Free ();
            return rc;
        }

        int ISQLite3Provider.sqlite3_blob_write (IntPtr blob, byte [] b, int bOffset, int n, int offset)
        {
            GCHandle pinned = GCHandle.Alloc (b, GCHandleType.Pinned);
            IntPtr ptr = pinned.AddrOfPinnedObject ();
            int rc = NativeMethods.other_sqlite3_blob_write (blob, new IntPtr (ptr.ToInt64 () + bOffset), n, offset);
            pinned.Free ();
            return rc;
        }

        IntPtr ISQLite3Provider.sqlite3_backup_init (IntPtr destDb, string destName, IntPtr sourceDb, string sourceName)
        {
            return NativeMethods.sqlite3_backup_init (destDb, util.to_utf8 (destName), sourceDb, util.to_utf8 (sourceName));
        }

        int ISQLite3Provider.sqlite3_backup_step (IntPtr backup, int nPage)
        {
            return NativeMethods.sqlite3_backup_step (backup, nPage);
        }

        int ISQLite3Provider.sqlite3_backup_finish (IntPtr backup)
        {
            return NativeMethods.sqlite3_backup_finish (backup);
        }

        int ISQLite3Provider.sqlite3_backup_remaining (IntPtr backup)
        {
            return NativeMethods.sqlite3_backup_remaining (backup);
        }

        int ISQLite3Provider.sqlite3_backup_pagecount (IntPtr backup)
        {
            return NativeMethods.sqlite3_backup_pagecount (backup);
        }

        IntPtr ISQLite3Provider.sqlite3_next_stmt (IntPtr db, IntPtr stmt)
        {
            return NativeMethods.sqlite3_next_stmt (db, stmt);
        }

        long ISQLite3Provider.sqlite3_last_insert_rowid (IntPtr db)
        {
            return NativeMethods.sqlite3_last_insert_rowid (db);
        }

        int ISQLite3Provider.sqlite3_changes (IntPtr db)
        {
            return NativeMethods.sqlite3_changes (db);
        }

        int ISQLite3Provider.sqlite3_total_changes (IntPtr db)
        {
            return NativeMethods.sqlite3_total_changes (db);
        }

        int ISQLite3Provider.sqlite3_extended_result_codes (IntPtr db, int onoff)
        {
            return NativeMethods.sqlite3_extended_result_codes (db, onoff);
        }

        string ISQLite3Provider.sqlite3_errstr (int rc)
        {
            return util.from_utf8 (NativeMethods.sqlite3_errstr (rc));
        }

        int ISQLite3Provider.sqlite3_errcode (IntPtr db)
        {
            return NativeMethods.sqlite3_errcode (db);
        }

        int ISQLite3Provider.sqlite3_extended_errcode (IntPtr db)
        {
            return NativeMethods.sqlite3_extended_errcode (db);
        }

        int ISQLite3Provider.sqlite3_busy_timeout (IntPtr db, int ms)
        {
            return NativeMethods.sqlite3_busy_timeout (db, ms);
        }

        int ISQLite3Provider.sqlite3_get_autocommit (IntPtr db)
        {
            return NativeMethods.sqlite3_get_autocommit (db);
        }

        int ISQLite3Provider.sqlite3_db_readonly (IntPtr db, string dbName)
        {
            return NativeMethods.sqlite3_db_readonly (db, util.to_utf8 (dbName));
        }

        string ISQLite3Provider.sqlite3_db_filename (IntPtr db, string att)
        {
            return util.from_utf8 (NativeMethods.sqlite3_db_filename (db, util.to_utf8 (att)));
        }

        string ISQLite3Provider.sqlite3_errmsg (IntPtr db)
        {
            return util.from_utf8 (NativeMethods.sqlite3_errmsg (db));
        }

        string ISQLite3Provider.sqlite3_libversion ()
        {
            return util.from_utf8 (NativeMethods.sqlite3_libversion ());
        }

        int ISQLite3Provider.sqlite3_libversion_number ()
        {
            return NativeMethods.sqlite3_libversion_number ();
        }

        // ----------------------------------------------------------------

        // Passing a callback into SQLite is tricky.  The implementation details
        // can vary depending on the .NET implementation, so we hide these
        // in platform-specific code underneath the ISQLite3Provider boundary.
        //
        // The caller gives us a delegate and an object they want passed to that
        // delegate.  We do not actually pass that stuff down to SQLite as
        // the callback.  Instead, we store the information and pass down a bridge
        // function, with an IntPtr that can be used to retrieve the info later.
        //
        // When SQLite calls the bridge function, we lookup the info we previously
        // stored and call the delegate provided by the upper layer.
        //
        // The class we use to remember the original info (delegate and user object)
        // is shared but not portable.  It is in the util.cs file which is compiled
        // into each platform assembly.

#if PLATFORM_IOS || PLATFORM_UNIFIED
        [MonoPInvokeCallback (typeof(NativeMethods.callback_commit))] // TODO not xplat
#endif
        static int commit_hook_bridge_impl (IntPtr p)
        {
            commit_hook_info hi = commit_hook_info.from_ptr (p);
            return hi.call ();
        }

        NativeMethods.callback_commit commit_hook_bridge = new NativeMethods.callback_commit (commit_hook_bridge_impl);
        void ISQLite3Provider.sqlite3_commit_hook (IntPtr db, delegate_commit func, object v)
        {
            var info = hooks.getOrCreateFor (db);
            if (info.commit != null) {
                // TODO maybe turn off the hook here, for now
                info.commit.free ();
                info.commit = null;
            }

            if (func != null) {
                info.commit = new commit_hook_info (func, v);
                NativeMethods.sqlite3_commit_hook (db, commit_hook_bridge, info.commit.ptr);
            } else {
                NativeMethods.sqlite3_commit_hook (db, null, IntPtr.Zero);
            }
        }

        // ----------------------------------------------------------------

        // Passing a callback into SQLite is tricky.  See comments near commit_hook
        // implementation in pinvoke/SQLite3Provider.cs

#if PLATFORM_IOS || PLATFORM_UNIFIED
        [MonoPInvokeCallback (typeof(NativeMethods.callback_scalar_function))] // TODO not xplat
#endif
        static void scalar_function_hook_bridge_impl (IntPtr context, int num_args, IntPtr argsptr)
        {
            IntPtr p = NativeMethods.sqlite3_user_data (context);
            scalar_function_hook_info hi = scalar_function_hook_info.from_ptr (p);
            hi.call (context, num_args, argsptr);
        }

        NativeMethods.callback_scalar_function scalar_function_hook_bridge = new NativeMethods.callback_scalar_function (scalar_function_hook_bridge_impl);
        int ISQLite3Provider.sqlite3_create_function (IntPtr db, string name, int nargs, object v, delegate_function_scalar func)
        {
            // the keys for this dictionary are nargs.name, not just the name
            string key = string.Format ("{0}.{1}", nargs, name);
            var info = hooks.getOrCreateFor (db);
            if (info.scalar.ContainsKey (key)) {
                scalar_function_hook_info hi = info.scalar [key];

                // TODO maybe turn off the hook here, for now
                hi.free ();

                info.scalar.Remove (key);
            }

            // 1 is SQLITE_UTF8
            if (func != null) {
                scalar_function_hook_info hi = new scalar_function_hook_info (func, v);
                int rc = NativeMethods.sqlite3_create_function_v2 (db, util.to_utf8 (name), nargs, 1, hi.ptr, scalar_function_hook_bridge, null, null, null);
                if (rc == 0) {
                    info.scalar [key] = hi;
                }
                return rc;
            } else {
                return NativeMethods.sqlite3_create_function_v2 (db, util.to_utf8 (name), nargs, 1, IntPtr.Zero, null, null, null, null);
            }
        }

        // ----------------------------------------------------------------

        // Passing a callback into SQLite is tricky.  See comments near commit_hook
        // implementation in pinvoke/SQLite3Provider.cs

#if PLATFORM_IOS || PLATFORM_UNIFIED
        [MonoPInvokeCallback (typeof(NativeMethods.callback_agg_function_step))] // TODO not xplat
#endif
        static void agg_function_hook_bridge_step_impl (IntPtr context, int num_args, IntPtr argsptr)
        {
            IntPtr agg = NativeMethods.sqlite3_aggregate_context (context, 8);
            // TODO error check agg nomem

            IntPtr p = NativeMethods.sqlite3_user_data (context);
            agg_function_hook_info hi = agg_function_hook_info.from_ptr (p);
            hi.call_step (context, agg, num_args, argsptr);
        }

#if PLATFORM_IOS || PLATFORM_UNIFIED
        [MonoPInvokeCallback (typeof(NativeMethods.callback_agg_function_final))] // TODO not xplat
#endif
        static void agg_function_hook_bridge_final_impl (IntPtr context)
        {
            IntPtr agg = NativeMethods.sqlite3_aggregate_context (context, 8);
            // TODO error check agg nomem

            IntPtr p = NativeMethods.sqlite3_user_data (context);
            agg_function_hook_info hi = agg_function_hook_info.from_ptr (p);
            hi.call_final (context, agg);
        }

        NativeMethods.callback_agg_function_step agg_function_hook_bridge_step = new NativeMethods.callback_agg_function_step (agg_function_hook_bridge_step_impl);
        NativeMethods.callback_agg_function_final agg_function_hook_bridge_final = new NativeMethods.callback_agg_function_final (agg_function_hook_bridge_final_impl);
        int ISQLite3Provider.sqlite3_create_function (IntPtr db, string name, int nargs, object v, delegate_function_aggregate_step func_step, delegate_function_aggregate_final func_final)
        {
            // the keys for this dictionary are nargs.name, not just the name
            string key = string.Format ("{0}.{1}", nargs, name);
            var info = hooks.getOrCreateFor (db);
            if (info.agg.ContainsKey (key)) {
                agg_function_hook_info hi = info.agg [key];

                // TODO maybe turn off the hook here, for now
                hi.free ();

                info.agg.Remove (key);
            }

            // 1 is SQLITE_UTF8
            if (func_step != null) {
                // TODO both func_step and func_final must be non-null
                agg_function_hook_info hi = new agg_function_hook_info (func_step, func_final, v);
                int rc = NativeMethods.sqlite3_create_function_v2 (db, util.to_utf8 (name), nargs, 1, hi.ptr, null, agg_function_hook_bridge_step, agg_function_hook_bridge_final, null);
                if (rc == 0) {
                    info.agg [key] = hi;
                }
                return rc;
            } else {
                return NativeMethods.sqlite3_create_function_v2 (db, util.to_utf8 (name), nargs, 1, IntPtr.Zero, null, null, null, null);
            }
        }

        // ----------------------------------------------------------------

        // Passing a callback into SQLite is tricky.  See comments near commit_hook
        // implementation in pinvoke/SQLite3Provider.cs

#if PLATFORM_IOS || PLATFORM_UNIFIED
        [MonoPInvokeCallback (typeof(NativeMethods.callback_collation))] // TODO not xplat
#endif
        static int collation_hook_bridge_impl (IntPtr p, int len1, IntPtr pv1, int len2, IntPtr pv2)
        {
            collation_hook_info hi = collation_hook_info.from_ptr (p);
            return hi.call (util.from_utf8 (pv1, len1), util.from_utf8 (pv2, len2));
        }

        NativeMethods.callback_collation collation_hook_bridge = new NativeMethods.callback_collation (collation_hook_bridge_impl);
        int ISQLite3Provider.sqlite3_create_collation (IntPtr db, string name, object v, delegate_collation func)
        {
            var info = hooks.getOrCreateFor (db);
            if (info.collation.ContainsKey (name)) {
                collation_hook_info hi = info.collation [name];

                // TODO maybe turn off the hook here, for now
                hi.free ();

                info.collation.Remove (name);
            }

            // 1 is SQLITE_UTF8
            if (func != null) {
                collation_hook_info hi = new collation_hook_info (func, v);
                int rc = NativeMethods.sqlite3_create_collation (db, util.to_utf8 (name), 1, hi.ptr, collation_hook_bridge);
                if (rc == 0) {
                    info.collation [name] = hi;
                }
                return rc;
            } else {
                return NativeMethods.sqlite3_create_collation (db, util.to_utf8 (name), 1, IntPtr.Zero, null);
            }
        }

        // ----------------------------------------------------------------

        // Passing a callback into SQLite is tricky.  See comments near commit_hook
        // implementation in pinvoke/SQLite3Provider.cs

#if PLATFORM_IOS || PLATFORM_UNIFIED
        [MonoPInvokeCallback (typeof(NativeMethods.callback_update))] // TODO not xplat
#endif
        static void update_hook_bridge_impl (IntPtr p, int typ, IntPtr db, IntPtr tbl, Int64 rowid)
        {
            update_hook_info hi = update_hook_info.from_ptr (p);
            hi.call (typ, util.from_utf8 (db), util.from_utf8 (tbl), rowid);
        }

        NativeMethods.callback_update update_hook_bridge = new NativeMethods.callback_update (update_hook_bridge_impl);
        void ISQLite3Provider.sqlite3_update_hook (IntPtr db, delegate_update func, object v)
        {
            var info = hooks.getOrCreateFor (db);
            if (info.update != null) {
                // TODO maybe turn off the hook here, for now
                info.update.free ();
                info.update = null;
            }

            if (func != null) {
                info.update = new update_hook_info (func, v);
                NativeMethods.sqlite3_update_hook (db, update_hook_bridge, info.update.ptr);
            } else {
                NativeMethods.sqlite3_update_hook (db, null, IntPtr.Zero);
            }
        }

        // ----------------------------------------------------------------

        // Passing a callback into SQLite is tricky.  See comments near commit_hook
        // implementation in pinvoke/SQLite3Provider.cs

#if PLATFORM_IOS || PLATFORM_UNIFIED
        [MonoPInvokeCallback (typeof(NativeMethods.callback_rollback))] // TODO not xplat
#endif
        static void rollback_hook_bridge_impl (IntPtr p)
        {
            rollback_hook_info hi = rollback_hook_info.from_ptr (p);
            hi.call ();
        }

        NativeMethods.callback_rollback rollback_hook_bridge = new NativeMethods.callback_rollback (rollback_hook_bridge_impl);
        void ISQLite3Provider.sqlite3_rollback_hook (IntPtr db, delegate_rollback func, object v)
        {
            var info = hooks.getOrCreateFor (db);
            if (info.rollback != null) {
                // TODO maybe turn off the hook here, for now
                info.rollback.free ();
                info.rollback = null;
            }

            if (func != null) {
                info.rollback = new rollback_hook_info (func, v);
                NativeMethods.sqlite3_rollback_hook (db, rollback_hook_bridge, info.rollback.ptr);
            } else {
                NativeMethods.sqlite3_rollback_hook (db, null, IntPtr.Zero);
            }
        }

        // ----------------------------------------------------------------

        // Passing a callback into SQLite is tricky.  See comments near commit_hook
        // implementation in pinvoke/SQLite3Provider.cs

#if PLATFORM_IOS || PLATFORM_UNIFIED
        [MonoPInvokeCallback (typeof(NativeMethods.callback_trace))] // TODO not xplat
#endif
        static void trace_hook_bridge_impl (IntPtr p, IntPtr s)
        {
            trace_hook_info hi = trace_hook_info.from_ptr (p);
            hi.call (util.from_utf8 (s));
        }

        NativeMethods.callback_trace trace_hook_bridge = new NativeMethods.callback_trace (trace_hook_bridge_impl);
        void ISQLite3Provider.sqlite3_trace (IntPtr db, delegate_trace func, object v)
        {
            var info = hooks.getOrCreateFor (db);
            if (info.trace != null) {
                // TODO maybe turn off the hook here, for now
                info.trace.free ();
                info.trace = null;
            }

            if (func != null) {
                info.trace = new trace_hook_info (func, v);
                NativeMethods.sqlite3_trace (db, trace_hook_bridge, info.trace.ptr);
            } else {
                NativeMethods.sqlite3_trace (db, null, IntPtr.Zero);
            }
        }

        // ----------------------------------------------------------------

        // Passing a callback into SQLite is tricky.  See comments near commit_hook
        // implementation in pinvoke/SQLite3Provider.cs

#if PLATFORM_IOS || PLATFORM_UNIFIED
        [MonoPInvokeCallback (typeof(NativeMethods.callback_profile))] // TODO not xplat
#endif
        static void profile_hook_bridge_impl (IntPtr p, IntPtr s, long elapsed)
        {
            profile_hook_info hi = profile_hook_info.from_ptr (p);
            hi.call (util.from_utf8 (s), elapsed);
        }

        NativeMethods.callback_profile profile_hook_bridge = new NativeMethods.callback_profile (profile_hook_bridge_impl);
        void ISQLite3Provider.sqlite3_profile (IntPtr db, delegate_profile func, object v)
        {
            var info = hooks.getOrCreateFor (db);
            if (info.profile != null) {
                // TODO maybe turn off the hook here, for now
                info.profile.free ();
                info.profile = null;
            }

            if (func != null) {
                info.profile = new profile_hook_info (func, v);
                NativeMethods.sqlite3_profile (db, profile_hook_bridge, info.profile.ptr);
            } else {
                NativeMethods.sqlite3_profile (db, null, IntPtr.Zero);
            }
        }

        // ----------------------------------------------------------------

        // Passing a callback into SQLite is tricky.  See comments near commit_hook
        // implementation in pinvoke/SQLite3Provider.cs

#if PLATFORM_IOS || PLATFORM_UNIFIED
        [MonoPInvokeCallback (typeof(NativeMethods.callback_progress_handler))] // TODO not xplat
#endif
        static int progress_handler_hook_bridge_impl (IntPtr p)
        {
            progress_handler_hook_info hi = progress_handler_hook_info.from_ptr (p);
            return hi.call ();
        }

        NativeMethods.callback_progress_handler progress_handler_hook_bridge = new NativeMethods.callback_progress_handler (progress_handler_hook_bridge_impl);
        void ISQLite3Provider.sqlite3_progress_handler (IntPtr db, int instructions, delegate_progress_handler func, object v)
        {
            var info = hooks.getOrCreateFor (db);
            if (info.progress != null) {
                // TODO maybe turn off the hook here, for now
                info.progress.free ();
                info.progress = null;
            }

            if (func != null) {
                info.progress = new progress_handler_hook_info (func, v);
                NativeMethods.sqlite3_progress_handler (db, instructions, progress_handler_hook_bridge, info.progress.ptr);
            } else {
                NativeMethods.sqlite3_progress_handler (db, instructions, null, IntPtr.Zero);
            }
        }

        // ----------------------------------------------------------------

        // ----------------------------------------------------------------

        // Passing a callback into SQLite is tricky.  See comments near commit_hook
        // implementation in pinvoke/SQLite3Provider.cs

#if PLATFORM_IOS || PLATFORM_UNIFIED
        [MonoPInvokeCallback (typeof(NativeMethods.callback_authorizer))] // TODO not xplat
#endif
        static int authorizer_hook_bridge_impl (IntPtr p, int action_code, IntPtr param0, IntPtr param1, IntPtr dbName, IntPtr inner_most_trigger_or_view)
        {
            authorizer_hook_info hi = authorizer_hook_info.from_ptr (p);
            return hi.call (action_code, util.from_utf8 (param0), util.from_utf8 (param1), util.from_utf8 (dbName), util.from_utf8 (inner_most_trigger_or_view));
        }

        NativeMethods.callback_authorizer authorizer_hook_bridge = new NativeMethods.callback_authorizer (authorizer_hook_bridge_impl);
        int ISQLite3Provider.sqlite3_set_authorizer (IntPtr db, delegate_authorizer func, object v)
        {
            var info = hooks.getOrCreateFor (db);
            if (info.authorizer != null) {
                // TODO maybe turn off the hook here, for now
                info.authorizer.free ();
                info.authorizer = null;
            }

            if (func != null) {
                info.authorizer = new authorizer_hook_info (func, v);
                return NativeMethods.sqlite3_set_authorizer (db, authorizer_hook_bridge, info.authorizer.ptr);
            } else {
                return NativeMethods.sqlite3_set_authorizer (db, null, IntPtr.Zero);
            }
        }

        // ----------------------------------------------------------------

        long ISQLite3Provider.sqlite3_memory_used ()
        {
            return NativeMethods.sqlite3_memory_used ();
        }

        long ISQLite3Provider.sqlite3_memory_highwater (int resetFlag)
        {
            return NativeMethods.sqlite3_memory_highwater (resetFlag);
        }

        int ISQLite3Provider.sqlite3_status (int op, out int current, out int highwater, int resetFlag)
        {
            return NativeMethods.sqlite3_status (op, out current, out highwater, resetFlag);
        }

        string ISQLite3Provider.sqlite3_sourceid ()
        {
            return util.from_utf8 (NativeMethods.sqlite3_sourceid ());
        }

        void ISQLite3Provider.sqlite3_result_int64 (IntPtr ctx, long val)
        {
            NativeMethods.sqlite3_result_int64 (ctx, val);
        }

        void ISQLite3Provider.sqlite3_result_int (IntPtr ctx, int val)
        {
            NativeMethods.sqlite3_result_int (ctx, val);
        }

        void ISQLite3Provider.sqlite3_result_double (IntPtr ctx, double val)
        {
            NativeMethods.sqlite3_result_double (ctx, val);
        }

        void ISQLite3Provider.sqlite3_result_null (IntPtr stm)
        {
            NativeMethods.sqlite3_result_null (stm);
        }

        void ISQLite3Provider.sqlite3_result_error (IntPtr ctx, string val)
        {
            NativeMethods.sqlite3_result_error (ctx, util.to_utf8 (val), -1);
        }

        void ISQLite3Provider.sqlite3_result_text (IntPtr ctx, string val)
        {
            NativeMethods.sqlite3_result_text (ctx, util.to_utf8 (val), -1, new IntPtr (-1));
        }

        void ISQLite3Provider.sqlite3_result_blob (IntPtr ctx, byte [] blob)
        {
            NativeMethods.sqlite3_result_blob (ctx, blob, blob.Length, new IntPtr (-1));
        }

        void ISQLite3Provider.sqlite3_result_zeroblob (IntPtr ctx, int n)
        {
            NativeMethods.sqlite3_result_zeroblob (ctx, n);
        }

        // TODO sqlite3_result_value

        void ISQLite3Provider.sqlite3_result_error_toobig (IntPtr ctx)
        {
            NativeMethods.sqlite3_result_error_toobig (ctx);
        }

        void ISQLite3Provider.sqlite3_result_error_nomem (IntPtr ctx)
        {
            NativeMethods.sqlite3_result_error_nomem (ctx);
        }

        void ISQLite3Provider.sqlite3_result_error_code (IntPtr ctx, int code)
        {
            NativeMethods.sqlite3_result_error_code (ctx, code);
        }

        byte [] ISQLite3Provider.sqlite3_value_blob (IntPtr p)
        {
            IntPtr blobPointer = NativeMethods.sqlite3_value_blob (p);
            if (blobPointer == IntPtr.Zero) {
                return null;
            }

            var length = NativeMethods.sqlite3_value_bytes (p);
            byte [] result = new byte [length];
            Marshal.Copy (blobPointer, (byte [])result, 0, length);
            return result;
        }

        int ISQLite3Provider.sqlite3_value_bytes (IntPtr p)
        {
            return NativeMethods.sqlite3_value_bytes (p);
        }

        double ISQLite3Provider.sqlite3_value_double (IntPtr p)
        {
            return NativeMethods.sqlite3_value_double (p);
        }

        int ISQLite3Provider.sqlite3_value_int (IntPtr p)
        {
            return NativeMethods.sqlite3_value_int (p);
        }

        long ISQLite3Provider.sqlite3_value_int64 (IntPtr p)
        {
            return NativeMethods.sqlite3_value_int64 (p);
        }

        int ISQLite3Provider.sqlite3_value_type (IntPtr p)
        {
            return NativeMethods.sqlite3_value_type (p);
        }

        string ISQLite3Provider.sqlite3_value_text (IntPtr p)
        {
            return util.from_utf8 (NativeMethods.sqlite3_value_text (p));
        }

        int ISQLite3Provider.sqlite3_bind_int (IntPtr stm, int paramIndex, int val)
        {
            return NativeMethods.sqlite3_bind_int (stm, paramIndex, val);
        }

        int ISQLite3Provider.sqlite3_bind_int64 (IntPtr stm, int paramIndex, long val)
        {
            return NativeMethods.sqlite3_bind_int64 (stm, paramIndex, val);
        }

        int ISQLite3Provider.sqlite3_bind_text (IntPtr stm, int paramIndex, string t)
        {
            return NativeMethods.sqlite3_bind_text (stm, paramIndex, util.to_utf8 (t), -1, new IntPtr (-1));
        }

        int ISQLite3Provider.sqlite3_bind_double (IntPtr stm, int paramIndex, double val)
        {
            return NativeMethods.sqlite3_bind_double (stm, paramIndex, val);
        }

        int ISQLite3Provider.sqlite3_bind_blob (IntPtr stm, int paramIndex, byte [] blob)
        {
            return NativeMethods.sqlite3_bind_blob (stm, paramIndex, blob, blob.Length, new IntPtr (-1));
        }

        int ISQLite3Provider.sqlite3_bind_zeroblob (IntPtr stm, int paramIndex, int size)
        {
            return NativeMethods.sqlite3_bind_zeroblob (stm, paramIndex, size);
        }

        int ISQLite3Provider.sqlite3_bind_null (IntPtr stm, int paramIndex)
        {
            return NativeMethods.sqlite3_bind_null (stm, paramIndex);
        }

        int ISQLite3Provider.sqlite3_bind_parameter_count (IntPtr stm)
        {
            return NativeMethods.sqlite3_bind_parameter_count (stm);
        }

        string ISQLite3Provider.sqlite3_bind_parameter_name (IntPtr stm, int paramIndex)
        {
            return util.from_utf8 (NativeMethods.sqlite3_bind_parameter_name (stm, paramIndex));
        }

        int ISQLite3Provider.sqlite3_bind_parameter_index (IntPtr stm, string paramName)
        {
            return NativeMethods.sqlite3_bind_parameter_index (stm, util.to_utf8 (paramName));
        }

        int ISQLite3Provider.sqlite3_step (IntPtr stm)
        {
            return NativeMethods.sqlite3_step (stm);
        }

        int ISQLite3Provider.sqlite3_stmt_busy (IntPtr stm)
        {
            return NativeMethods.sqlite3_stmt_busy (stm);
        }

        int ISQLite3Provider.sqlite3_stmt_readonly (IntPtr stm)
        {
            return NativeMethods.sqlite3_stmt_readonly (stm);
        }

        int ISQLite3Provider.sqlite3_column_int (IntPtr stm, int columnIndex)
        {
            return NativeMethods.sqlite3_column_int (stm, columnIndex);
        }

        long ISQLite3Provider.sqlite3_column_int64 (IntPtr stm, int columnIndex)
        {
            return NativeMethods.sqlite3_column_int64 (stm, columnIndex);
        }

        string ISQLite3Provider.sqlite3_column_text (IntPtr stm, int columnIndex)
        {
            return util.from_utf8 (NativeMethods.sqlite3_column_text (stm, columnIndex));
        }

        string ISQLite3Provider.sqlite3_column_decltype (IntPtr stm, int columnIndex)
        {
            return util.from_utf8 (NativeMethods.sqlite3_column_decltype (stm, columnIndex));
        }

        double ISQLite3Provider.sqlite3_column_double (IntPtr stm, int columnIndex)
        {
            return NativeMethods.sqlite3_column_double (stm, columnIndex);
        }

        byte [] ISQLite3Provider.sqlite3_column_blob (IntPtr stm, int columnIndex)
        {
            IntPtr blobPointer = NativeMethods.sqlite3_column_blob (stm, columnIndex);
            if (blobPointer == IntPtr.Zero) {
                return null;
            }

            var length = NativeMethods.sqlite3_column_bytes (stm, columnIndex);
            byte [] result = new byte [length];
            Marshal.Copy (blobPointer, (byte [])result, 0, length);
            return result;
        }

        int ISQLite3Provider.sqlite3_column_type (IntPtr stm, int columnIndex)
        {
            return NativeMethods.sqlite3_column_type (stm, columnIndex);
        }

        int ISQLite3Provider.sqlite3_column_bytes (IntPtr stm, int columnIndex)
        {
            return NativeMethods.sqlite3_column_bytes (stm, columnIndex);
        }

        int ISQLite3Provider.sqlite3_column_count (IntPtr stm)
        {
            return NativeMethods.sqlite3_column_count (stm);
        }

        int ISQLite3Provider.sqlite3_data_count (IntPtr stm)
        {
            return NativeMethods.sqlite3_data_count (stm);
        }

        string ISQLite3Provider.sqlite3_column_name (IntPtr stm, int columnIndex)
        {
            return util.from_utf8 (NativeMethods.sqlite3_column_name (stm, columnIndex));
        }

        string ISQLite3Provider.sqlite3_column_origin_name (IntPtr stm, int columnIndex)
        {
            return util.from_utf8 (NativeMethods.sqlite3_column_origin_name (stm, columnIndex));
        }

        string ISQLite3Provider.sqlite3_column_table_name (IntPtr stm, int columnIndex)
        {
            return util.from_utf8 (NativeMethods.sqlite3_column_table_name (stm, columnIndex));
        }

        string ISQLite3Provider.sqlite3_column_database_name (IntPtr stm, int columnIndex)
        {
            return util.from_utf8 (NativeMethods.sqlite3_column_database_name (stm, columnIndex));
        }

        int ISQLite3Provider.sqlite3_reset (IntPtr stm)
        {
            return NativeMethods.sqlite3_reset (stm);
        }

        int ISQLite3Provider.sqlite3_clear_bindings (IntPtr stm)
        {
            return NativeMethods.sqlite3_clear_bindings (stm);
        }

        int ISQLite3Provider.sqlite3_stmt_status (IntPtr stm, int op, int resetFlg)
        {
            return NativeMethods.sqlite3_stmt_status (stm, op, resetFlg);
        }

        int ISQLite3Provider.sqlite3_finalize (IntPtr stm)
        {
            return NativeMethods.sqlite3_finalize (stm);
        }

        int ISQLite3Provider.sqlite3_wal_autocheckpoint (IntPtr db, int n)
        {
            return NativeMethods.sqlite3_wal_autocheckpoint (db, n);
        }

        int ISQLite3Provider.sqlite3_wal_checkpoint (IntPtr db, string dbName)
        {
            return NativeMethods.sqlite3_wal_checkpoint (db, util.to_utf8 (dbName));
        }

        int ISQLite3Provider.sqlite3_wal_checkpoint_v2 (IntPtr db, string dbName, int eMode, out int logSize, out int framesCheckPointed)
        {
            return NativeMethods.sqlite3_wal_checkpoint_v2 (db, util.to_utf8 (dbName), eMode, out logSize, out framesCheckPointed);
        }

        private static class NativeMethods
        {
            private const string SQLITE_DLL = "cbsqlite3";

#if PRELOAD_FROM_ARCH_DIRECTORY
    // TODO on which Windows platforms is LoadLibraryEx available?

        [DllImport("kernel32")]
        private static extern IntPtr LoadLibraryEx(string lpFileName, IntPtr hFile, uint dwFlags);

        // Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
        // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
        // https://github.com/aspnet/DataCommon.SQLite/blob/dev/src/Microsoft.Data.SQLite/Utilities/NativeLibraryLoader.cs

        private static bool TryLoadFromArchDirectory()
        {
        var dllName = string.Format("{0}.dll", SQLITE_DLL);

        string baseDirectory = new Uri(AppDomain.CurrentDomain.BaseDirectory).LocalPath;
        if (baseDirectory == null)
        {
#if OLD_REFLECTION
            var currentAssembly = typeof(NativeMethods).Assembly;
#else
            var currentAssembly = typeof(NativeMethods).GetTypeInfo().Assembly;
#endif
            var codeBase = currentAssembly.CodeBase;
            var uri = new UriBuilder(codeBase);
            baseDirectory = System.IO.Path.GetDirectoryName(Uri.UnescapeDataString(uri.Path));

        }
        if (baseDirectory == null)
        {
            return false;
        }
            System.Diagnostics.Debug.Assert(System.IO.Path.IsPathRooted(baseDirectory), "baseDirectory is not rooted.");

            var architecture = IntPtr.Size == 4
                ? "x86"
                : "x64";

            var dllPath = System.IO.Path.Combine(System.IO.Path.Combine(baseDirectory, architecture), dllName);
            if (!System.IO.File.Exists(dllPath))
        {
                return false;
        }

        const uint LOAD_WITH_ALTERED_SEARCH_PATH = 8;

            var ptr = LoadLibraryEx(dllPath, IntPtr.Zero, LOAD_WITH_ALTERED_SEARCH_PATH);
            return ptr != IntPtr.Zero;
        }
#endif

            static NativeMethods ()
            {
#if PRELOAD_FROM_ARCH_DIRECTORY
        // TODO the check below is intended to prevent the LoadLibraryEx call
        // from happening when using the net45 build on Mono on non-Windows
        // platforms.  this approach is almost certainly wrong-ish for .NET Core.
        if (
        (System.Environment.OSVersion.Platform == System.PlatformID.Win32NT)
        && (TryLoadFromArchDirectory())
           )
        {
        return;
        }
#endif

            }

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern int sqlite3_close (IntPtr db);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern int sqlite3_close_v2 (IntPtr db); /* 3.7.14+ */

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern int sqlite3_enable_shared_cache (int enable);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern void sqlite3_interrupt (IntPtr db);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern int sqlite3_finalize (IntPtr stmt);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern int sqlite3_reset (IntPtr stmt);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern int sqlite3_clear_bindings (IntPtr stmt);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern int sqlite3_stmt_status (IntPtr stm, int op, int resetFlg);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern IntPtr sqlite3_bind_parameter_name (IntPtr stmt, int index);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern IntPtr sqlite3_column_database_name (IntPtr stmt, int index);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern IntPtr sqlite3_column_database_name16 (IntPtr stmt, int index);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern IntPtr sqlite3_column_decltype (IntPtr stmt, int index);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern IntPtr sqlite3_column_decltype16 (IntPtr stmt, int index);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern IntPtr sqlite3_column_name (IntPtr stmt, int index);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern IntPtr sqlite3_column_name16 (IntPtr stmt, int index);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern IntPtr sqlite3_column_origin_name (IntPtr stmt, int index);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern IntPtr sqlite3_column_origin_name16 (IntPtr stmt, int index);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern IntPtr sqlite3_column_table_name (IntPtr stmt, int index);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern IntPtr sqlite3_column_table_name16 (IntPtr stmt, int index);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern IntPtr sqlite3_column_text (IntPtr stmt, int index);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern IntPtr sqlite3_column_text16 (IntPtr stmt, int index);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern IntPtr sqlite3_errmsg (IntPtr db);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern int sqlite3_db_readonly (IntPtr db, byte [] dbName);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern IntPtr sqlite3_db_filename (IntPtr db, byte [] att);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern int sqlite3_prepare (IntPtr db, IntPtr pSql, int nBytes, out IntPtr stmt, out IntPtr ptrRemain);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern int sqlite3_prepare_v2 (IntPtr db, byte [] pSql, int nBytes, out IntPtr stmt, out IntPtr ptrRemain);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern int sqlite3_db_status (IntPtr db, int op, out int current, out int highest, int resetFlg);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern int sqlite3_complete (byte [] pSql);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern int sqlite3_compileoption_used (byte [] pSql);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern IntPtr sqlite3_compileoption_get (int n);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern int sqlite3_table_column_metadata (IntPtr db, byte [] dbName, byte [] tblName, byte [] colName, out IntPtr ptrDataType, out IntPtr ptrCollSeq, out int notNull, out int primaryKey, out int autoInc);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern IntPtr sqlite3_value_text (IntPtr p);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern IntPtr sqlite3_value_text16 (IntPtr p);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern int sqlite3_enable_load_extension (
            IntPtr db, int enable);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern int sqlite3_load_extension (
            IntPtr db, byte [] fileName, byte [] procName, ref IntPtr pError);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern IntPtr sqlite3_libversion ();

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern int sqlite3_libversion_number ();

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern IntPtr sqlite3_sourceid ();

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern IntPtr sqlite3_malloc (int n);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern IntPtr sqlite3_realloc (IntPtr p, int n);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern void sqlite3_free (IntPtr p);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern int sqlite3_open (byte [] filename, out IntPtr db);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern int sqlite3_open_v2 (byte [] filename, out IntPtr db, int flags, byte [] vfs);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern IntPtr sqlite3_vfs_find (byte [] vfs);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
            public static extern int sqlite3_open16 (string fileName, out IntPtr db);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern long sqlite3_last_insert_rowid (IntPtr db);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern int sqlite3_changes (IntPtr db);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern int sqlite3_total_changes (IntPtr db);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern long sqlite3_memory_used ();

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern long sqlite3_memory_highwater (int resetFlag);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern int sqlite3_status (int op, out int current, out int highwater, int resetFlag);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern int sqlite3_shutdown ();

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern int sqlite3_busy_timeout (IntPtr db, int ms);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern int sqlite3_bind_blob (IntPtr stmt, int index, byte [] val, int nSize, IntPtr nTransient);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern int sqlite3_bind_zeroblob (IntPtr stmt, int index, int size);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern int sqlite3_bind_double (IntPtr stmt, int index, double val);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern int sqlite3_bind_int (IntPtr stmt, int index, int val);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern int sqlite3_bind_int64 (IntPtr stmt, int index, long val);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern int sqlite3_bind_null (IntPtr stmt, int index);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern int sqlite3_bind_text (IntPtr stmt, int index, byte [] val, int nlen, IntPtr pvReserved);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern int sqlite3_bind_parameter_count (IntPtr stmt);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern int sqlite3_bind_parameter_index (IntPtr stmt, byte [] strName);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern int sqlite3_column_count (IntPtr stmt);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern int sqlite3_data_count (IntPtr stmt);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern int sqlite3_step (IntPtr stmt);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern IntPtr sqlite3_sql (IntPtr stmt);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern double sqlite3_column_double (IntPtr stmt, int index);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern int sqlite3_column_int (IntPtr stmt, int index);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern long sqlite3_column_int64 (IntPtr stmt, int index);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern IntPtr sqlite3_column_blob (IntPtr stmt, int index);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern int sqlite3_column_bytes (IntPtr stmt, int index);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern int sqlite3_column_type (IntPtr stmt, int index);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern int sqlite3_aggregate_count (IntPtr context);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern IntPtr sqlite3_value_blob (IntPtr p);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern int sqlite3_value_bytes (IntPtr p);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern double sqlite3_value_double (IntPtr p);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern int sqlite3_value_int (IntPtr p);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern long sqlite3_value_int64 (IntPtr p);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern int sqlite3_value_type (IntPtr p);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern IntPtr sqlite3_user_data (IntPtr context);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern void sqlite3_result_blob (IntPtr context, byte [] val, int nSize, IntPtr pvReserved);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern void sqlite3_result_double (IntPtr context, double val);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern void sqlite3_result_error (IntPtr context, byte [] strErr, int nLen);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern void sqlite3_result_int (IntPtr context, int val);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern void sqlite3_result_int64 (IntPtr context, long val);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern void sqlite3_result_null (IntPtr context);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern void sqlite3_result_text (IntPtr context, byte [] val, int nLen, IntPtr pvReserved);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern void sqlite3_result_zeroblob (IntPtr context, int n);

            // TODO sqlite3_result_value

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern void sqlite3_result_error_toobig (IntPtr context);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern void sqlite3_result_error_nomem (IntPtr context);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern void sqlite3_result_error_code (IntPtr context, int code);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern IntPtr sqlite3_aggregate_context (IntPtr context, int nBytes);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
            public static extern int sqlite3_bind_text16 (IntPtr stmt, int index, string val, int nlen, IntPtr pvReserved);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
            public static extern void sqlite3_result_error16 (IntPtr context, string strName, int nLen);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode)]
            public static extern void sqlite3_result_text16 (IntPtr context, string strName, int nLen, IntPtr pvReserved);

#if not // TODO removed, perhaps temporarily.  not sure if we want these or PRAGMA key.
            [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern int sqlite3_key(IntPtr db, byte[] key, int keylen);

            [DllImport(SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern int sqlite3_rekey(IntPtr db, byte[] key, int keylen);
#endif

            // Since sqlite3_config() takes a variable argument list, we have to overload declarations
            // for all possible calls that we want to use.
            [DllImport (SQLITE_DLL, EntryPoint = "sqlite3_config", CallingConvention = CallingConvention.Cdecl)]
            public static extern int sqlite3_config_none (int op);

            [DllImport (SQLITE_DLL, EntryPoint = "sqlite3_config", CallingConvention = CallingConvention.Cdecl)]
            public static extern int sqlite3_config_int (int op, int val);

            [UnmanagedFunctionPointer (CallingConvention.Cdecl)]
            public delegate void callback_log (IntPtr pUserData, int errorCode, IntPtr pMessage);

            [DllImport (SQLITE_DLL, EntryPoint = "sqlite3_config", CallingConvention = CallingConvention.Cdecl)]
            public static extern int sqlite3_config_log (int op, callback_log func, IntPtr pvUser);

            [UnmanagedFunctionPointer (CallingConvention.Cdecl)]
            public delegate void callback_agg_function_final (IntPtr context);

            [UnmanagedFunctionPointer (CallingConvention.Cdecl)]
            public delegate void callback_scalar_function (IntPtr context, int nArgs, IntPtr argsptr);

            [UnmanagedFunctionPointer (CallingConvention.Cdecl)]
            public delegate void callback_agg_function_step (IntPtr context, int nArgs, IntPtr argsptr);

            [UnmanagedFunctionPointer (CallingConvention.Cdecl)]
            public delegate void callback_destroy (IntPtr p);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern int sqlite3_create_function_v2 (IntPtr db, byte [] strName, int nArgs, int nType, IntPtr pvUser, callback_scalar_function func, callback_agg_function_step fstep, callback_agg_function_final ffinal, callback_destroy fdestroy);

            [UnmanagedFunctionPointer (CallingConvention.Cdecl)]
            public delegate int callback_collation (IntPtr puser, int len1, IntPtr pv1, int len2, IntPtr pv2);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern int sqlite3_create_collation (IntPtr db, byte [] strName, int nType, IntPtr pvUser, callback_collation func);

            [UnmanagedFunctionPointer (CallingConvention.Cdecl)]
            public delegate void callback_update (IntPtr p, int typ, IntPtr db, IntPtr tbl, long rowid);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern IntPtr sqlite3_update_hook (IntPtr db, callback_update func, IntPtr pvUser);

            [UnmanagedFunctionPointer (CallingConvention.Cdecl)]
            public delegate int callback_commit (IntPtr puser);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern IntPtr sqlite3_commit_hook (IntPtr db, callback_commit func, IntPtr pvUser);

            [UnmanagedFunctionPointer (CallingConvention.Cdecl)]
            public delegate void callback_profile (IntPtr puser, IntPtr statement, long elapsed);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern IntPtr sqlite3_profile (IntPtr db, callback_profile func, IntPtr pvUser);

            [UnmanagedFunctionPointer (CallingConvention.Cdecl)]
            public delegate int callback_progress_handler (IntPtr puser);

            [UnmanagedFunctionPointer (CallingConvention.Cdecl)]
            public delegate int callback_authorizer (IntPtr puser, int action_code, IntPtr param0, IntPtr param1, IntPtr dbName, IntPtr inner_most_trigger_or_view);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern IntPtr sqlite3_progress_handler (IntPtr db, int instructions, callback_progress_handler func, IntPtr pvUser);

            [UnmanagedFunctionPointer (CallingConvention.Cdecl)]
            public delegate void callback_trace (IntPtr puser, IntPtr statement);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern IntPtr sqlite3_trace (IntPtr db, callback_trace func, IntPtr pvUser);

            [UnmanagedFunctionPointer (CallingConvention.Cdecl)]
            public delegate void callback_rollback (IntPtr puser);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern IntPtr sqlite3_rollback_hook (IntPtr db, callback_rollback func, IntPtr pvUser);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern IntPtr sqlite3_db_handle (IntPtr stmt);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern IntPtr sqlite3_next_stmt (IntPtr db, IntPtr stmt);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern int sqlite3_stmt_busy (IntPtr stmt);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern int sqlite3_stmt_readonly (IntPtr stmt);

            [UnmanagedFunctionPointer (CallingConvention.Cdecl)]
            public delegate int callback_exec (IntPtr db, int n, IntPtr values, IntPtr names);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern int sqlite3_exec (IntPtr db, byte [] strSql, callback_exec cb, IntPtr pvParam, out IntPtr errMsg);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern int sqlite3_get_autocommit (IntPtr db);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern int sqlite3_extended_result_codes (IntPtr db, int onoff);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern int sqlite3_errcode (IntPtr db);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern int sqlite3_extended_errcode (IntPtr db);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern IntPtr sqlite3_errstr (int rc); /* 3.7.15+ */

            // Since sqlite3_log() takes a variable argument list, we have to overload declarations
            // for all possible calls.  For now, we are only exposing a single string, and
            // depend on the caller to format the string.
            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern void sqlite3_log (int iErrCode, byte [] zFormat);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern int sqlite3_file_control (IntPtr db, byte [] zDbName, int op, IntPtr pArg);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern IntPtr sqlite3_backup_init (IntPtr destDb, byte [] zDestName, IntPtr sourceDb, byte [] zSourceName);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern int sqlite3_backup_step (IntPtr backup, int nPage);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern int sqlite3_backup_finish (IntPtr backup);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern int sqlite3_backup_remaining (IntPtr backup);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern int sqlite3_backup_pagecount (IntPtr backup);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern int sqlite3_blob_open (IntPtr db, byte [] sdb, byte [] table, byte [] col, long rowid, int flags, out IntPtr blob);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern int sqlite3_blob_write (IntPtr blob, byte [] b, int n, int offset);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern int sqlite3_blob_read (IntPtr blob, byte [] b, int n, int offset);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "sqlite3_blob_write")]
            public static extern int other_sqlite3_blob_write (IntPtr blob, IntPtr b, int n, int offset);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl, EntryPoint = "sqlite3_blob_read")]
            public static extern int other_sqlite3_blob_read (IntPtr blob, IntPtr b, int n, int offset);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern int sqlite3_blob_bytes (IntPtr blob);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern int sqlite3_blob_close (IntPtr blob);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern int sqlite3_wal_autocheckpoint (IntPtr db, int n);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern int sqlite3_wal_checkpoint (IntPtr db, byte [] dbName);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern int sqlite3_wal_checkpoint_v2 (IntPtr db, byte [] dbName, int eMode, out int logSize, out int framesCheckPointed);

            [DllImport (SQLITE_DLL, CallingConvention = CallingConvention.Cdecl)]
            public static extern int sqlite3_set_authorizer (IntPtr db, callback_authorizer cb, IntPtr pvUser);
#if NETFX_CORE
            [DllImport(SQLITE_DLL, EntryPoint = "sqlite3_win32_set_directory", CallingConvention=CallingConvention.Cdecl, CharSet=CharSet.Unicode)]
            public static extern int sqlite3_win32_set_directory (uint directoryType, string directoryPath);
#endif

        }
    }
}


text:
package org.hisp.dhis.util;

import static org.hisp.dhis.system.util.ReflectionUtils.getProperty;

import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Set;

import org.apache.commons.lang3.StringUtils;
import org.hisp.dhis.schema.Property;
import org.hisp.dhis.schema.Schema;
import org.hisp.dhis.translation.Translation;

/**
 * @author Viet Nguyen <viet@dhis2.org>
 */
public class TranslationUtils
{
    public static Map<String, String> getObjectPropertyValues( Schema schema, Object object )
    {
        if ( object == null )
        {
            return null;
        }

        List<Property> properties = schema.getTranslatableProperties();

        Map<String, String> translations = new HashMap<>();

        for ( Property property : properties )
        {
            translations.put( property.getName(), getProperty( object, property.getName() ) );
        }

        return translations;
    }

    public static Map<String, String> convertTranslations( Set<Translation> translations, Locale locale )
    {

        if ( !ObjectUtils.allNonNull( translations, locale ) )
        {
            return null;
        }

        Map<String, String> translationMap = new HashMap<>();

        for ( Translation translation : translations )
        {
            if ( StringUtils.isNotEmpty( translation.getValue() )
                && translation.getLocale().equalsIgnoreCase( locale.toString() ) )
            {
                translationMap.put( translation.getProperty(), translation.getValue() );
            }
        }

        return translationMap;
    }
}


text:
<?php

    namespace App\Mail;

    use Illuminate\Bus\Queueable;
    use Illuminate\Mail\Mailable;
    use Illuminate\Queue\SerializesModels;

    /**
     * Class PasswordReset
     *
     * @package App\Mail
     */
    class PasswordReset extends Mailable {
        use Queueable, SerializesModels;
        protected $email;
        protected $token;

        /**
         * Create a new message instance.
         *
         * @param $email
         * @param $token
         */
        public function __construct($email, $token) {
            $this->email   = $email;
            $this->token   = $token;
            $this->subject = trans('email.password_reset.title');
            return $this;
        }

        /**
         * Build the message.
         *
         * @return $this
         */
        public function build() {
            return $this->view('emails.password_reset', ['reset_link' => route('auth/reset_password', ['email' => $this->email, 'token' => $this->token])]);
        }
    }


text:
namespace content {

WebContentsTracker::WebContentsTracker(bool track_fullscreen_rwh)
    : track_fullscreen_rwh_(track_fullscreen_rwh),
      last_target_(NULL) {}

WebContentsTracker::~WebContentsTracker() {
  DCHECK(!web_contents()) << "BUG: Still observering!";
}

void WebContentsTracker::Start(int render_process_id, int main_render_frame_id,
                               const ChangeCallback& callback) {
  DCHECK(!message_loop_.get() || message_loop_->BelongsToCurrentThread());

  message_loop_ = base::MessageLoopProxy::current();
  DCHECK(message_loop_.get());
  callback_ = callback;

  if (BrowserThread::CurrentlyOn(BrowserThread::UI)) {
    StartObservingWebContents(render_process_id, main_render_frame_id);
  } else {
    BrowserThread::PostTask(
        BrowserThread::UI, FROM_HERE,
        base::Bind(&WebContentsTracker::StartObservingWebContents, this,
                   render_process_id, main_render_frame_id));
  }
}

void WebContentsTracker::Stop() {
  DCHECK(message_loop_->BelongsToCurrentThread());

  callback_.Reset();

  if (BrowserThread::CurrentlyOn(BrowserThread::UI)) {
    WebContentsObserver::Observe(NULL);
  } else {
    BrowserThread::PostTask(
        BrowserThread::UI, FROM_HERE,
        base::Bind(&WebContentsTracker::Observe, this,
                   static_cast<WebContents*>(NULL)));
  }
}

RenderWidgetHost* WebContentsTracker::GetTargetRenderWidgetHost() const {
  DCHECK_CURRENTLY_ON(BrowserThread::UI);

  WebContents* const wc = web_contents();
  if (!wc)
    return NULL;

  RenderWidgetHost* rwh = NULL;
  if (track_fullscreen_rwh_) {
    RenderWidgetHostView* const view = wc->GetFullscreenRenderWidgetHostView();
    if (view)
      rwh = view->GetRenderWidgetHost();
  }
  if (!rwh) {
    RenderFrameHostImpl* const rfh =
        static_cast<RenderFrameHostImpl*>(wc->GetMainFrame());
    if (rfh)
      rwh = rfh->GetRenderWidgetHost();
  }

  return rwh;
}

void WebContentsTracker::OnPossibleTargetChange(bool force_callback_run) {
  DCHECK_CURRENTLY_ON(BrowserThread::UI);

  RenderWidgetHost* const rwh = GetTargetRenderWidgetHost();
  if (rwh == last_target_ && !force_callback_run)
    return;
  DVLOG(1) << "Will report target change from RenderWidgetHost@" << last_target_
           << " to RenderWidgetHost@" << rwh;
  last_target_ = rwh;

  if (message_loop_->BelongsToCurrentThread()) {
    MaybeDoCallback(rwh);
  } else {
    message_loop_->PostTask(
        FROM_HERE,
        base::Bind(&WebContentsTracker::MaybeDoCallback, this, rwh));
  }
}

void WebContentsTracker::MaybeDoCallback(RenderWidgetHost* rwh) {
  DCHECK(message_loop_->BelongsToCurrentThread());

  if (!callback_.is_null())
    callback_.Run(rwh);
}

void WebContentsTracker::StartObservingWebContents(int render_process_id,
                                                   int main_render_frame_id) {
  DCHECK_CURRENTLY_ON(BrowserThread::UI);

  Observe(WebContents::FromRenderFrameHost(RenderFrameHost::FromID(
      render_process_id, main_render_frame_id)));
  DVLOG_IF(1, !web_contents())
      << "Could not find WebContents associated with main RenderFrameHost "
      << "referenced by render_process_id=" << render_process_id
      << ", routing_id=" << main_render_frame_id;

  OnPossibleTargetChange(true);
}

void WebContentsTracker::RenderFrameDeleted(
    RenderFrameHost* render_frame_host) {
  OnPossibleTargetChange(false);
}

void WebContentsTracker::RenderFrameHostChanged(RenderFrameHost* old_host,
                                                RenderFrameHost* new_host) {
  OnPossibleTargetChange(false);
}

void WebContentsTracker::WebContentsDestroyed() {
  Observe(NULL);
  OnPossibleTargetChange(false);
}

void WebContentsTracker::DidShowFullscreenWidget(int routing_id) {
  OnPossibleTargetChange(false);
}

void WebContentsTracker::DidDestroyFullscreenWidget(int routing_id) {
  OnPossibleTargetChange(false);
}

}  // namespace content


text:
(function() {
    'use strict';

    angular.module('sslv2App')
        .controller('SubmissionCtrl', SubmissionCtrl);

    SubmissionCtrl.$inject = ['$state'];

    function SubmissionCtrl($state) {

        var vm = this;
        vm.message = "";
        vm.login_greetings = localStorage.getItem("first_name") || "";
        vm.help = {
            templateUrl: 'templates/help.html'
        };
    }

})();


text:
const { RyvrsCollection } = require('./RyvrsCollection');

const RELS_RYVRS_COLLECTION = 'https://mountain-pass.github.io/ryvr/rels/ryvrs-collection';

class RyvrApp {
  constructor() {
    this.reset();
  }

  reset() {
    this.theTitle = 'ryvr';
    this.ryvrsCollection = new RyvrsCollection();
  }

  get title() {
    return this.theTitle;
  }

  getApiDocs() {
    throw new Error('Not Impleented');
  }

  getRyvrs() {
    return this.ryvrsCollection;
  }
}

exports.RyvrApp = RyvrApp;
exports.RELS_RYVRS_COLLECTION = RELS_RYVRS_COLLECTION;


text:
Image Compression Filter
========================

Compress an image to optimize size without losing quality.

+-------------+--------------------------------------------------------------------+
| type        | image_compression                                                  |
+-------------+--------------------------------------------------------------------+
| class       | `Enhavo\\MediaBundle\\Filter\\Filter\\ImageCompressionFilter`      |
+-------------+--------------------------------------------------------------------+


text:
module.exports = function (gulp) {

	'use strict';

	gulp.task('test', ['jshint', 'karma']);
};