text:
/* -*- c-basic-offset: 4; indent-tabs-mode: nil -*- */
/* ====================================================================
 * Copyright (c) 1999-2004 Carnegie Mellon University.  All rights
 * reserved.
 *
 * 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 work was supported in part by funding from the Defense Advanced
 * Research Projects Agency and the National Science Foundation of the
 * United States of America, and the CMU Sphinx Speech Consortium.
 *
 * THIS SOFTWARE IS PROVIDED BY CARNEGIE MELLON UNIVERSITY ``AS IS'' AND
 * ANY EXPRESSED 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 CARNEGIE MELLON UNIVERSITY
 * NOR ITS EMPLOYEES 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.
 *
 * ====================================================================
 *
 */
/*
 * lextree.h --
 *
 * **********************************************
 * CMU ARPA Speech Project
 *
 * Copyright (c) 1999 Carnegie Mellon University.
 * ALL RIGHTS RESERVED.
 * **********************************************
 *
 * HISTORY
 * $Log$
 * Revision 1.1  2006/04/05  20:27:30  dhdfu
 * A Great Reorganzation of header files and executables
 *
 * Revision 1.11  2006/02/23 15:08:24  arthchan2003
 * Merged from the branch SPHINX3_5_2_RCI_IRII_BRANCH:
 *
 * 1, Fixed memory leaks.
 * 2, Add logic for full triphone expansion.  At this point, the
 * propagation of scores in word end is still incorrect. So composite
 * triphone should still be used by default.
 * 3, Removed lextree_copies_hmm_propagate.
 *
 * Revision 1.10.4.6  2005/11/17 06:28:50  arthchan2003
 * Changed the code to used compressed triphones. Not yet correct at this point
 *
 * Revision 1.10.4.5  2005/10/17 04:53:44  arthchan2003
 * Shrub the trees so that the run-time memory could be controlled.
 *
 * Revision 1.10.4.4  2005/10/07 19:34:31  arthchan2003
 * In full cross-word triphones expansion, the previous implementation has several flaws, e.g, 1, it didn't consider the phone beam on cross word triphones. 2, Also, when the cross word triphone phone is used, children of the last phones will be regarded as cross word triphone. So, the last phone should not be evaluated at all.  Last implementation has not safe-guaded that. 3, The rescoring for language model is not done correctly.  What we still need to do: a, test the algorithm in more databases. b,  implement some speed up schemes.
 *
 * Revision 1.10.4.2  2005/09/25 19:23:55  arthchan2003
 * 1, Added arguments for turning on/off LTS rules. 2, Added arguments for turning on/off composite triphones. 3, Moved dict2pid deallocation back to dict2pid. 4, Tidying up the clean up code.
 *
 * Revision 1.10.4.1  2005/06/27 05:37:05  arthchan2003
 * Incorporated several fixes to the search. 1, If a tree is empty, it will be removed and put back to the pool of tree, so number of trees will not be always increasing.  2, In the previous search, the answer is always "STOP P I T G S B U R G H </s>"and filler words never occurred in the search.  The reason is very simple, fillers was not properly propagated in the search at all <**exculamation**>  This version fixed this problem.  The current search will give <sil> P I T T S B U R G H </sil> </s> to me.  This I think it looks much better now.
 *
 * Revision 1.10  2005/06/21 23:32:58  arthchan2003
 * Log. Introduced lextree_init and filler_init to wrap up lextree_build
 * process. Split the hmm propagation to propagation for leaves and
 * non-leaves node.  This allows an easier time for turning off the
 * rescoring stage. However, the implementation is not clever enough. One
 * should split the array to leave array and non-leave array.
 *
 * Revision 1.7  2005/06/16 04:59:10  archan
 * Sphinx3 to s3.generic, a gentle-refactored version of Dave's change in senone scale.
 *
 * Revision 1.6  2005/06/13 04:02:59  archan
 * Fixed most doxygen-style documentation under libs3decoder.
 *
 * Revision 1.5  2005/04/25 23:53:35  archan
 * 1, Some minor modification of vithist_t, vithist_rescore can now support optional LM rescoring, vithist also has its own reporting routine. A new argument -lmrescore is also added in decode and livepretend.  This can switch on and off the rescoring procedure. 2, I am reaching the final difficulty of mode 5 implementation.  That is, to implement an algorithm which dynamically decide which tree copies should be entered.  However, stuffs like score propagation in the leave nodes and non-leaves nodes are already done. 3, As briefly mentioned in 2, implementation of rescoring , which used to happened at leave nodes are now separated. The current implementation is not the most clever one. Wish I have time to change it before check-in to the canonical.
 *
 * Revision 1.4  2005/04/25 19:22:47  archan
 * Refactor out the code of rescoring from lexical tree. Potentially we want to turn off the rescoring if we need.
 *
 * Revision 1.3  2005/03/30 01:22:47  archan
 * Fixed mistakes in last updates. Add
 *
 *
 * 29-Feb-2000	M K Ravishankar (rkm@cs.cmu.edu) at Carnegie Mellon University
 * 		Modified some functions to be able to deal with HMMs with any number
 * 		of states.
 *
 * 07-Jul-1999	M K Ravishankar (rkm@cs.cmu.edu) at Carnegie Mellon University
 * 		Added lextree_node_t.ci and lextree_ci_active().
 *
 * 30-Apr-1999	M K Ravishankar (rkm@cs.cmu.edu) at Carnegie Mellon University
 * 		Started.
 */

#ifndef _S3_LEXTREE_H_
#define _S3_LEXTREE_H_

#include <stdio.h>

#include <bitvec.h>
#include <s3types.h>
#include <glist.h>
#include "kbcore.h"
#include "hmm.h"
#include "lm.h"
#include "vithist.h"
#include "ascr.h"
#include "fast_algo_struct.h"
#include "dict.h"
#include "mdef.h"

#ifdef __cplusplus
extern "C" {
#endif
#if 0
} /* Fool Emacs into not indenting things. */
#endif

#define LEXTREE_OPERATION_SUCCESS 1
#define LEXTREE_OPERATION_FAILURE 0

#define LEXTREE_TYPE_FILLER -1
#define LEXTREE_TYPE_UNIGRAM 0
#define LEXTREE_TYPE_BIGRAM 1
#define LEXTREE_TYPE_TRIGRAM 2

#if 0 /*Number reserved but not used */
#define LEXTREE_TYPE_QUADGRAM 3
#define LEXTREE_TYPE_QUINGRAM 4
#endif

/** \file lextree.h
 * \brief Data structure of lexical tree.
 *
 * A lextree can be built for a specific history (e.g., for all bigram successors of a given
 * word or trigram successors of a word-pair in a given LM).  The history provides a set of left
 * context CIphones (if the final history word has multiple pronunciations; and there is always
 * \<sil\>).
 * A lextree is usually a set of trees, one for each distinct root model for the given set of
 * words.  Furthermore, the root node of each tree can itself actually be a SET of nodes,
 * required by the different left contexts.  If there is no history (i.e., the unigram lextree),
 * any CIphone is a potential left-context.  But this can explode the number of root nodes.
 * So, the root nodes of the unigram lextree use COMPOSITE models (see dict2pid.h), merging
 * different contexts into one.  Similarly, the right context (at the leaves of any lextree) is
 * always unknown.  So, all leaf nodes also use composite models.
 * Lextrees are formed by sharing as much of the HMM models as possible (based on senone-seq ID),
 * before having to diverge.  But the leaf nodes are always distinct for each word.
 * Finally, each node has a (language model) probability, given its history.  It is the max. of
 * the LM probability of all the words reachable from that node.  (Strictly speaking, it should
 * be their sum instead of max, but practically it makes little difference.)
 *
 *
 *
 * ARCHAN : Two weaknesses of the code, 1, when full triphone is
 * expanded, the code loop for all CI index. This is because dict2pid,
 * unlike ctxt_table, doesn't provide a list of triphones
 * 2, for all active node, the code has iterate two times. Rather than once, because of separation
 * of prop_non_leaves and prop_leaves.
 */

/*
 * \struct lextree_node_t
 * One node in a lextree.
 */
typedef struct {
    hmm_t hmm;		/**< HMM states */
    hmm_context_t *ctx; /**< HMM context pointer (not owned by this structure) */

    glist_t children;	/**< Its data.ptr are children (lextree_node_t *)

                        If non-leaf node, this is the list of
                        successor nodes.

                        If leaf node, if we are in normal mode and
                        this list will not be empty.

                        This is the list of all possible triphone.
                        If it is not allocated. The code will
                        allocate it.

                        */

    int32 wid;		/**< Dictionary word-ID if a leaf node; BAD_S3WID otherwise */
    int32 prob;		/**< LM probability of this node (of all words leading from this node) */
    int32 ssid;		/**< Senone-sequence ID (or composite state-seq ID if composite) */
    s3cipid_t rc;        /**< The (compressed) right context for this node. Preferably compressed.
                          */
    s3cipid_t ci;	/**< CIphone id for this node */
    int8 composite;	/**< Whether it is a composite model (merging many left/right contexts) */
} lextree_node_t;

/* Access macros; not meant for arbitrary use */
#define lextree_node_wid(n)		((n)->wid)
#define lextree_node_prob(n)		((n)->prob)
#define lextree_node_ssid(n)		((n)->ssid)
#define lextree_node_rc(n)		((n)->rc)
#define lextree_node_composite(n)	((n)->composite)
#define lextree_node_frame(n)		((n)->frame)

/*
 * \struct lextree_lcroot_t
 * Root nodes of the lextree valid for a given left context CIphone.
 */
typedef struct {
    s3cipid_t lc;	/* Left context CIphone */
    glist_t root;	/* Its data.ptr are the root nodes (lextree_node_t *) of interest; subset
			   of the entire lextree roots */
} lextree_lcroot_t;

/*
 * \struct lextree_t
 * Entire lextree.
 */
typedef struct {
    int32 type;		/**< For use by other modules; NOT maintained here.  For example:
                           N-gram type; 0: unigram lextree, 1: 2g, 2: 3g lextree... */
    glist_t root;	/**< The entire set of root nodes (lextree_node_t) for this lextree */
    lextree_lcroot_t *lcroot;	/**< Lists of subsets of root nodes; a list for each left context;
                                   NULL if n_lc == 0 (i.e., no specific left context) */
    int32 n_lc;		/**< No. of separate left contexts being maintained, if any */
    int32 n_node;	/**< Total No. of nodes in this lextree which is allocated in the initialization time */
    int32 n_alloc_node;   /**< Total No. of nodes in this lextree which is allocated dynamically */
    int32 n_alloc_blk_sz;   /**< Block size of each allocation */

    hmm_context_t *ctx;     /**< HMM context for non-composite triphones. */
    hmm_context_t *comctx; /**< HMM context for composite triphones. */

    lextree_node_t **active;		/**< Nodes active in any frame */
    lextree_node_t **next_active;	/**< Like active, but temporary space for constructing the
					   active list for the next frame using the current */
    int32 n_active;		/**< No. of nodes active in current frame */
    int32 n_next_active;	/**< No. of nodes active in current frame */

    int32 best;		/**< Best HMM state score in current frame (for pruning) */
    int32 wbest;	/**< Best wordexit HMM state score in current frame (for pruning) */

    char prev_word[100];      /**< This is used in WST. The previous word for a tree */
} lextree_t;

/* Access macros; not meant for arbitrary usage */
#define lextree_type(l)			((l)->type)
#define lextree_root(l)			((l)->root)
#define lextree_lcroot(l)		((l)->lcroot)
#define lextree_n_lc(l)			((l)->n_lc)
#define lextree_n_node(l)		((l)->n_node)
#define lextree_n_alloc_node(l)		((l)->n_alloc_node)
#define lextree_active(l)		((l)->active)
#define lextree_next_active(l)		((l)->next_active)
#define lextree_n_active(l)		((l)->n_active)
#define lextree_n_next_active(l)	((l)->n_next_active)

/** Initialize a lexical tree, also factor language model score through out the tree. Currently only
 * unigram look-ahead is supported.
 */
lextree_t* lextree_init(
    kbcore_t *kbcore, /**< In: Initialized kbcore */
    lm_t* lm,         /**< In: LM, to decide which set of word list is used */
    char *lmname,     /**< In: LM name */
    int32 istreeUgProb, /**< In: Decide whether LM factoring is used or not */
    int32 bReport,     /**< In: Whether to report the progress so far. */
    int32 type        /**< In: Type of the lexical tree, 0: unigram lextree, 1: 2g, 2: 3g lextree*/
    );

/** Initialize a filler tree.
 */
lextree_t* fillertree_init(
    kbcore_t *kbcore /**< In: Initialized kbcore */
    );

/** Report the lextree data structure.
 */
void lextree_report(
    lextree_t *ltree /**< In: Report a lexical tree*/
    );

/**
 * Build a lexical tree for the set of words specified in wordprob[] (with their
 * associated LM probabilities).  wordprob[] must contain EXACTLY the set of words for
 * which the lextree is to be built, i.e, including alternatives and excluding OOVs.
 * Return value: Pointer to lextree_t structure representing entire lextree.
 */
lextree_t *
lextree_build (kbcore_t *kbc,		/**< In: All the necessary knowledge bases */
	       wordprob_t *wordprob,	/**< In: Words in the tree and their (LM) probabilities */
	       int32 n_word,		/**< In: Size of the wordprob[] array */
	       s3cipid_t *lc,		/**< In: BAD_S3CIPID terminated array of left context
					   CIphones, or NULL if no specific left context */
               int32 type              /**< In: Type of lextree */
    );

/* Free a lextree that was created by lextree_build */
void lextree_free (lextree_t *lextree);

/**
 * Reset the entire lextree (to the inactive state).  I.e., mark each HMM node as inactive,
 * (with lextree_node_t.frame = -1), and the active list size to 0.
 */
void lextree_utt_end (lextree_t *l, kbcore_t *kbc);

/**
 * Enter root nodes of lextree for given left-context, with given incoming score/history.
 */
void lextree_enter (lextree_t *lextree,	/**< In/Out: Lextree being entered */
		    s3cipid_t lc,	/**< In: Left-context if any (can be BAD_S3CIPID) */
		    int32 frame,	/**< In: Frame from which being activated (for the next) */
		    int32 inscore,	/**< In: Incoming score */
		    int32 inhist,	/**< In: Incoming history */
		    int32 thresh,	/**< In: Pruning threshold; incoming scores below this
					   threshold will not enter successfully */
		    kbcore_t *kbc       /**< In: a kbcore, that provided stuffs such as dict and dict2pid */
    );

/**
 * Swap the active and next_active lists of the given lextree.  (Usually done at the end of
 * each frame: from the current active list, we've built the next_active list for the next
 * frame, and finally need to make the latter the current active list.)
 */
void lextree_active_swap (lextree_t *lextree /**< The lexical tree*/
    );

/**
 * Marks the active ssid and composite ssids in the given lextree.  Caller must allocate ssid[]
 * and comssid[].  Caller also responsible for clearing them before calling this function.
 */
void lextree_ssid_active (lextree_t *lextree,	/**< In: lextree->active is scanned */
			  uint8 *ssid,		/**< In/Out: ssid[s] is set to non-0 if senone
						   sequence ID s is active */
			  uint8 *comssid	/**< In/Out: comssid[s] is set to non-0 if
						   composite senone sequence ID s is active */
    );

/**
 * For each active lextree node, mark the corresponding CI phone as active.
 */
void lextree_ci_active (lextree_t *lextree,	/**< In: Lextree being traversed */
			bitvec_t *ci_active	/**< In/Out: Active/inactive flag for ciphones */
    );

/**
 * Evaluate the active HMMs in the given lextree, using the current frame senone scores.
 * Return value: The best HMM state score as a result.
 * Note that the current
 */
int32 lextree_hmm_eval (lextree_t *lextree,	/**< In/Out: Lextree with HMMs to be evaluated */
			kbcore_t *kbc,	/**< In: */
			ascr_t *ascr,	/**< In: Senone scores (primary and composite) */
			int32 f,	/**< In: Frame in which being invoked */
			FILE *fp	/**< In: If not-NULL, dump HMM state (for debugging) */
    );

/*
 * ARCHAN: Starting from Sphinx 3.6, lextree_hmm_propagate is separated to
 * lextree_hmm_propagate_non_leaves and lextree_hmm_propagate_leaves.  This allows
 * the rescoring routine to be more easily switched off
 */

/**
 *
 * Propagate the non-leaves nodes of HMMs in the given lextree
 * through to the start of the next frame.  Called after HMM state
 * scores have been updated.  Marks those with "good" scores as
 * active for the next frame.
 *
 * There is a difference between this part of the code in the
 * composite mode or not in the composite mode.  When in composite
 * mode, the code will propagate the leaf node as if it is just a
 * simple node.  In that case, composite senone-sequence index will
 * be used.
 *
 * (Warning! Grandpa is the true daddy! ) In the case when full
 * triphone is expanded, the code will propagate to all possible
 * contexts expansion which is stored in the "children" list of the
 * leaf nodes.  Notice, conceptually the list of all possible
 * contexts should be the children of the parent of the leave nodes
 * rather than the children of the leave node. However, physically,
 * the expansion was part of the children list.  So, there will be
 * subtle difference in propagation.
 *
 * @return SRCH_FAILURE if it failed, SRCH_SUCCESS if it succeeded.
 */
int32 lextree_hmm_propagate_non_leaves (lextree_t *lextree,	/**< In/Out: Propagate scores across HMMs in
								   this lextree */
					kbcore_t *kbc,	/**< In: Core knowledge bases */
					int32 cf,		/**< In: Current frame index. */
					int32 th,		/**< In: General (HMM survival) pruning thresh */
					int32 pth,		/**< In: Phone transition pruning threshold */
					int32 wth,		/**< In: Word exit pruning threshold */
					pl_t* pl            /**< In: Phoneme lookahead struct*/
    );

/**
 * Propagate the leaves nodes of HMMs in the given lextree through to
 * the start of the next frame.  Called after HMM state scores have
 * been updated.  Propagates HMM exit scores through to successor HMM
 * entry states. It should be called right after
 * lextree_hmm_propagate_leaves.
 *
 * @return SRCH_FAILURE if it failed, SRCH_SUCCESS if it succeeded.
 */

int32 lextree_hmm_propagate_leaves (lextree_t *lextree,	/**< In/Out: Propagate scores across HMMs in
							   this lextree */
				    kbcore_t *kbc,	/**< In: Core knowledge bases */
				    vithist_t *vh,	/**< In/Out: Viterbi history structure to be
							   updated with word exits */
				    int32 cf,            /**< In: Current frame index */
				    int32 wth		/**< In: Word exit pruning threshold */
    );

/**
 * In order to use histogram pruning, get a histogram of the bestscore of each active HMM in
 * the given lextree.  For a given HMM, its bin is determined by:
 * 	(bestscr - hmm->bestscore) / bw.
 * Invoked right after all active HMMs are evaluated.
 */
void lextree_hmm_histbin (lextree_t *lextree,	/**< In: Its active HMM bestscores are used */
			  int32 bestscr,	/**< In: Overall bestscore in current frame */
			  int32 *bin,		/**< In/Out: The histogram bins; caller allocates
						   this array */
			  int32 nbin,		/**< In: Size of bin[] */
			  int32 bw		/**< In: Bin width; i.e., score range per bin */
    );

/** For debugging, dump the whole lexical tree*/
void lextree_dump (lextree_t *lextree,  /**< In: A lexical tree*/
		   dict_t *dict,       /**< In: a dictionary */
		   mdef_t *mdef,       /**< In: a model definition */
		   FILE *fp,           /**< A file pointer */
		   int32 fmt           /**< fmt=1, Ravi's format, fmt=2, Dot's format*/
    );

/** Utility function that count the number of links */
int32 num_lextree_links(lextree_t *ltree /**< In: A lexical tree */
    );
#if 0
{ /* Stop indent from complaining */
#endif
#ifdef __cplusplus
}
#endif

#endif


text:
import "reflect-metadata"
import {
    closeTestingConnections,
    createTestingConnections,
    reloadTestingDatabases,
} from "../../../utils/test-utils"
import {
    Any,
    Between,
    DataSource,
    Equal,
    ILike,
    In,
    IsNull,
    LessThan,
    LessThanOrEqual,
    Like,
    MoreThan,
    MoreThanOrEqual,
    Not,
} from "../../../../src"
import { Post } from "./entity/Post"
import { Raw } from "../../../../src/find-options/operator/Raw"
import { PersonAR } from "./entity/PersonAR"
import { expect } from "chai"

describe("repository > find options > operators", () => {
    let connections: DataSource[]
    before(
        async () =>
            (connections = await createTestingConnections({
                entities: [__dirname + "/entity/*{.js,.ts}"],
            })),
    )
    beforeEach(() => reloadTestingDatabases(connections))
    after(() => closeTestingConnections(connections))

    it("not", () =>
        Promise.all(
            connections.map(async (connection) => {
                // insert some fake data
                const post1 = new Post()
                post1.title = "About #1"
                post1.likes = 12
                await connection.manager.save(post1)
                const post2 = new Post()
                post2.title = "About #2"
                post2.likes = 3
                await connection.manager.save(post2)

                // check operator
                const loadedPosts = await connection
                    .getRepository(Post)
                    .findBy({
                        title: Not("About #1"),
                    })
                loadedPosts.should.be.eql([
                    { id: 2, likes: 3, title: "About #2" },
                ])
            }),
        ))

    it("lessThan", () =>
        Promise.all(
            connections.map(async (connection) => {
                // insert some fake data
                const post1 = new Post()
                post1.title = "About #1"
                post1.likes = 12
                await connection.manager.save(post1)
                const post2 = new Post()
                post2.title = "About #2"
                post2.likes = 3
                await connection.manager.save(post2)

                // check operator
                const loadedPosts = await connection
                    .getRepository(Post)
                    .findBy({
                        likes: LessThan(10),
                    })
                loadedPosts.should.be.eql([
                    { id: 2, likes: 3, title: "About #2" },
                ])
            }),
        ))

    it("lessThanOrEqual", () =>
        Promise.all(
            connections.map(async (connection) => {
                // insert some fake data
                const post1 = new Post()
                post1.title = "About #1"
                post1.likes = 12
                await connection.manager.save(post1)
                const post2 = new Post()
                post2.title = "About #2"
                post2.likes = 3
                await connection.manager.save(post2)
                const post3 = new Post()
                post3.title = "About #3"
                post3.likes = 13
                await connection.manager.save(post3)

                // check operator
                const loadedPosts = await connection
                    .getRepository(Post)
                    .findBy({
                        likes: LessThanOrEqual(12),
                    })
                loadedPosts.should.be.eql([
                    { id: 1, likes: 12, title: "About #1" },
                    { id: 2, likes: 3, title: "About #2" },
                ])
            }),
        ))

    it("not(lessThan)", () =>
        Promise.all(
            connections.map(async (connection) => {
                // insert some fake data
                const post1 = new Post()
                post1.title = "About #1"
                post1.likes = 12
                await connection.manager.save(post1)
                const post2 = new Post()
                post2.title = "About #2"
                post2.likes = 3
                await connection.manager.save(post2)

                // check operator
                const loadedPosts = await connection
                    .getRepository(Post)
                    .findBy({
                        likes: Not(LessThan(10)),
                    })
                loadedPosts.should.be.eql([
                    { id: 1, likes: 12, title: "About #1" },
                ])
            }),
        ))

    it("not(lessThanOrEqual)", () =>
        Promise.all(
            connections.map(async (connection) => {
                // insert some fake data
                const post1 = new Post()
                post1.title = "About #1"
                post1.likes = 12
                await connection.manager.save(post1)
                const post2 = new Post()
                post2.title = "About #2"
                post2.likes = 3
                await connection.manager.save(post2)
                const post3 = new Post()
                post3.title = "About #3"
                post3.likes = 13
                await connection.manager.save(post3)

                // check operator
                const loadedPosts = await connection
                    .getRepository(Post)
                    .findBy({
                        likes: Not(LessThanOrEqual(12)),
                    })
                loadedPosts.should.be.eql([
                    { id: 3, likes: 13, title: "About #3" },
                ])
            }),
        ))

    it("moreThan", () =>
        Promise.all(
            connections.map(async (connection) => {
                // insert some fake data
                const post1 = new Post()
                post1.title = "About #1"
                post1.likes = 12
                await connection.manager.save(post1)
                const post2 = new Post()
                post2.title = "About #2"
                post2.likes = 3
                await connection.manager.save(post2)

                // check operator
                const loadedPosts = await connection
                    .getRepository(Post)
                    .findBy({
                        likes: MoreThan(10),
                    })
                loadedPosts.should.be.eql([
                    { id: 1, likes: 12, title: "About #1" },
                ])
            }),
        ))

    it("moreThanOrEqual", () =>
        Promise.all(
            connections.map(async (connection) => {
                // insert some fake data
                const post1 = new Post()
                post1.title = "About #1"
                post1.likes = 12
                await connection.manager.save(post1)
                const post2 = new Post()
                post2.title = "About #2"
                post2.likes = 3
                await connection.manager.save(post2)
                const post3 = new Post()
                post3.title = "About #3"
                post3.likes = 13
                await connection.manager.save(post3)

                // check operator
                const loadedPosts = await connection
                    .getRepository(Post)
                    .findBy({
                        likes: MoreThanOrEqual(12),
                    })

                loadedPosts.sort((a, b) => a.id - b.id)
                loadedPosts.should.be.eql([
                    { id: 1, likes: 12, title: "About #1" },
                    { id: 3, likes: 13, title: "About #3" },
                ])
            }),
        ))

    it("not(moreThan)", () =>
        Promise.all(
            connections.map(async (connection) => {
                // insert some fake data
                const post1 = new Post()
                post1.title = "About #1"
                post1.likes = 12
                await connection.manager.save(post1)
                const post2 = new Post()
                post2.title = "About #2"
                post2.likes = 3
                await connection.manager.save(post2)

                // check operator
                const loadedPosts = await connection
                    .getRepository(Post)
                    .findBy({
                        likes: Not(MoreThan(10)),
                    })
                loadedPosts.should.be.eql([
                    { id: 2, likes: 3, title: "About #2" },
                ])
            }),
        ))

    it("not(moreThanOrEqual)", () =>
        Promise.all(
            connections.map(async (connection) => {
                // insert some fake data
                const post1 = new Post()
                post1.title = "About #1"
                post1.likes = 12
                await connection.manager.save(post1)
                const post2 = new Post()
                post2.title = "About #2"
                post2.likes = 3
                await connection.manager.save(post2)
                const post3 = new Post()
                post3.title = "About #3"
                post3.likes = 13
                await connection.manager.save(post3)

                // check operator
                const loadedPosts = await connection
                    .getRepository(Post)
                    .findBy({
                        likes: Not(MoreThanOrEqual(12)),
                    })
                loadedPosts.should.be.eql([
                    { id: 2, likes: 3, title: "About #2" },
                ])
            }),
        ))

    it("equal", () =>
        Promise.all(
            connections.map(async (connection) => {
                // insert some fake data
                const post1 = new Post()
                post1.title = "About #1"
                post1.likes = 12
                await connection.manager.save(post1)
                const post2 = new Post()
                post2.title = "About #2"
                post2.likes = 3
                await connection.manager.save(post2)

                // check operator
                const loadedPosts = await connection
                    .getRepository(Post)
                    .findBy({
                        title: Equal("About #2"),
                    })
                loadedPosts.should.be.eql([
                    { id: 2, likes: 3, title: "About #2" },
                ])
            }),
        ))

    it("not(equal)", () =>
        Promise.all(
            connections.map(async (connection) => {
                // insert some fake data
                const post1 = new Post()
                post1.title = "About #1"
                post1.likes = 12
                await connection.manager.save(post1)
                const post2 = new Post()
                post2.title = "About #2"
                post2.likes = 3
                await connection.manager.save(post2)

                // check operator
                const loadedPosts = await connection
                    .getRepository(Post)
                    .findBy({
                        title: Not(Equal("About #2")),
                    })
                loadedPosts.should.be.eql([
                    { id: 1, likes: 12, title: "About #1" },
                ])
            }),
        ))

    it("ilike", () =>
        Promise.all(
            connections.map(async (connection) => {
                // insert some fake data
                const post1 = new Post()
                post1.title = "about #1"
                post1.likes = 12
                await connection.manager.save(post1)
                const post2 = new Post()
                post2.title = "ABOUT #2"
                post2.likes = 3
                await connection.manager.save(post2)

                // check operator
                const loadedPosts = await connection
                    .getRepository(Post)
                    .findBy({
                        title: ILike("%out #%"),
                    })
                loadedPosts.should.be.eql([
                    { id: 1, likes: 12, title: "about #1" },
                    { id: 2, likes: 3, title: "ABOUT #2" },
                ])
            }),
        ))

    it("not(ilike)", () =>
        Promise.all(
            connections.map(async (connection) => {
                // insert some fake data
                const post1 = new Post()
                post1.title = "about #1"
                post1.likes = 12
                await connection.manager.save(post1)
                const post2 = new Post()
                post2.title = "ABOUT #2"
                post2.likes = 3
                await connection.manager.save(post2)

                // check operator
                const loadedPosts = await connection
                    .getRepository(Post)
                    .findBy({
                        title: Not(ILike("%out #1")),
                    })
                loadedPosts.should.be.eql([
                    { id: 2, likes: 3, title: "ABOUT #2" },
                ])
            }),
        ))

    it("like", () =>
        Promise.all(
            connections.map(async (connection) => {
                // insert some fake data
                const post1 = new Post()
                post1.title = "About #1"
                post1.likes = 12
                await connection.manager.save(post1)
                const post2 = new Post()
                post2.title = "About #2"
                post2.likes = 3
                await connection.manager.save(post2)

                // check operator
                const loadedPosts = await connection
                    .getRepository(Post)
                    .findBy({
                        title: Like("%out #%"),
                    })
                loadedPosts.should.be.eql([
                    { id: 1, likes: 12, title: "About #1" },
                    { id: 2, likes: 3, title: "About #2" },
                ])
            }),
        ))

    it("not(like)", () =>
        Promise.all(
            connections.map(async (connection) => {
                // insert some fake data
                const post1 = new Post()
                post1.title = "About #1"
                post1.likes = 12
                await connection.manager.save(post1)
                const post2 = new Post()
                post2.title = "About #2"
                post2.likes = 3
                await connection.manager.save(post2)

                // check operator
                const loadedPosts = await connection
                    .getRepository(Post)
                    .findBy({
                        title: Not(Like("%out #1")),
                    })
                loadedPosts.should.be.eql([
                    { id: 2, likes: 3, title: "About #2" },
                ])
            }),
        ))

    it("between", () =>
        Promise.all(
            connections.map(async (connection) => {
                // insert some fake data
                const post1 = new Post()
                post1.title = "About #1"
                post1.likes = 12
                await connection.manager.save(post1)
                const post2 = new Post()
                post2.title = "About #2"
                post2.likes = 3
                await connection.manager.save(post2)

                // check operator
                const loadedPosts1 = await connection
                    .getRepository(Post)
                    .findBy({
                        likes: Between(1, 10),
                    })
                loadedPosts1.should.be.eql([
                    { id: 2, likes: 3, title: "About #2" },
                ])

                const loadedPosts2 = await connection
                    .getRepository(Post)
                    .findBy({
                        likes: Between(10, 13),
                    })
                loadedPosts2.should.be.eql([
                    { id: 1, likes: 12, title: "About #1" },
                ])

                const loadedPosts3 = await connection
                    .getRepository(Post)
                    .findBy({
                        likes: Between(1, 20),
                    })
                loadedPosts3.should.be.eql([
                    { id: 1, likes: 12, title: "About #1" },
                    { id: 2, likes: 3, title: "About #2" },
                ])
            }),
        ))

    it("not(between)", () =>
        Promise.all(
            connections.map(async (connection) => {
                // insert some fake data
                const post1 = new Post()
                post1.title = "About #1"
                post1.likes = 12
                await connection.manager.save(post1)
                const post2 = new Post()
                post2.title = "About #2"
                post2.likes = 3
                await connection.manager.save(post2)

                // check operator
                const loadedPosts1 = await connection
                    .getRepository(Post)
                    .findBy({
                        likes: Not(Between(1, 10)),
                    })
                loadedPosts1.should.be.eql([
                    { id: 1, likes: 12, title: "About #1" },
                ])

                const loadedPosts2 = await connection
                    .getRepository(Post)
                    .findBy({
                        likes: Not(Between(10, 13)),
                    })
                loadedPosts2.should.be.eql([
                    { id: 2, likes: 3, title: "About #2" },
                ])

                const loadedPosts3 = await connection
                    .getRepository(Post)
                    .findBy({
                        likes: Not(Between(1, 20)),
                    })
                loadedPosts3.should.be.eql([])
            }),
        ))

    it("in", () =>
        Promise.all(
            connections.map(async (connection) => {
                // insert some fake data
                const post1 = new Post()
                post1.title = "About #1"
                post1.likes = 12
                await connection.manager.save(post1)
                const post2 = new Post()
                post2.title = "About #2"
                post2.likes = 3
                await connection.manager.save(post2)

                // check operator
                const loadedPosts = await connection
                    .getRepository(Post)
                    .findBy({
                        title: In(["About #2", "About #3"]),
                    })
                loadedPosts.should.be.eql([
                    { id: 2, likes: 3, title: "About #2" },
                ])

                const noPosts = await connection.getRepository(Post).findBy({
                    title: In([]),
                })
                noPosts.length.should.be.eql(0)
            }),
        ))

    it("not(in)", () =>
        Promise.all(
            connections.map(async (connection) => {
                // insert some fake data
                const post1 = new Post()
                post1.title = "About #1"
                post1.likes = 12
                await connection.manager.save(post1)
                const post2 = new Post()
                post2.title = "About #2"
                post2.likes = 3
                await connection.manager.save(post2)

                // check operator
                const loadedPosts = await connection
                    .getRepository(Post)
                    .findBy({
                        title: Not(In(["About #1", "About #3"])),
                    })
                loadedPosts.should.be.eql([
                    { id: 2, likes: 3, title: "About #2" },
                ])

                const noPosts = await connection.getRepository(Post).findBy({
                    title: Not(In([])),
                })
                noPosts.length.should.be.eql(2)
            }),
        ))

    it("any", () =>
        Promise.all(
            connections.map(async (connection) => {
                if (!(connection.driver.options.type === "postgres")) return

                // insert some fake data
                const post1 = new Post()
                post1.title = "About #1"
                post1.likes = 12
                await connection.manager.save(post1)
                const post2 = new Post()
                post2.title = "About #2"
                post2.likes = 3
                await connection.manager.save(post2)

                // check operator
                const loadedPosts = await connection
                    .getRepository(Post)
                    .findBy({
                        title: Any(["About #2", "About #3"]),
                    })
                loadedPosts.should.be.eql([
                    { id: 2, likes: 3, title: "About #2" },
                ])
            }),
        ))

    it("not(any)", () =>
        Promise.all(
            connections.map(async (connection) => {
                if (!(connection.driver.options.type === "postgres")) return

                // insert some fake data
                const post1 = new Post()
                post1.title = "About #1"
                post1.likes = 12
                await connection.manager.save(post1)
                const post2 = new Post()
                post2.title = "About #2"
                post2.likes = 3
                await connection.manager.save(post2)

                // check operator
                const loadedPosts = await connection
                    .getRepository(Post)
                    .findBy({
                        title: Not(Any(["About #2", "About #3"])),
                    })
                loadedPosts.should.be.eql([
                    { id: 1, likes: 12, title: "About #1" },
                ])
            }),
        ))

    it("isNull", () =>
        Promise.all(
            connections.map(async (connection) => {
                // insert some fake data
                const post1 = new Post()
                post1.title = "About #1"
                post1.likes = 12
                await connection.manager.save(post1)
                const post2 = new Post()
                post2.title = null as any
                post2.likes = 3
                await connection.manager.save(post2)

                // check operator
                const loadedPosts = await connection
                    .getRepository(Post)
                    .findBy({
                        title: IsNull(),
                    })
                loadedPosts.should.be.eql([{ id: 2, likes: 3, title: null }])
            }),
        ))

    it("not(isNull)", () =>
        Promise.all(
            connections.map(async (connection) => {
                // insert some fake data
                const post1 = new Post()
                post1.title = "About #1"
                post1.likes = 12
                await connection.manager.save(post1)
                const post2 = new Post()
                post2.title = null as any
                post2.likes = 3
                await connection.manager.save(post2)

                // check operator
                const loadedPosts = await connection
                    .getRepository(Post)
                    .findBy({
                        title: Not(IsNull()),
                    })
                loadedPosts.should.be.eql([
                    { id: 1, likes: 12, title: "About #1" },
                ])
            }),
        ))

    it("raw", () =>
        Promise.all(
            connections.map(async (connection) => {
                // insert some fake data
                const post1 = new Post()
                post1.title = "About #1"
                post1.likes = 12
                await connection.manager.save(post1)
                const post2 = new Post()
                post2.title = "About #2"
                post2.likes = 3
                await connection.manager.save(post2)

                // check operator
                const loadedPosts = await connection
                    .getRepository(Post)
                    .findBy({
                        likes: Raw("12"),
                    })
                loadedPosts.should.be.eql([
                    { id: 1, likes: 12, title: "About #1" },
                ])
            }),
        ))

    it("raw (function)", () =>
        Promise.all(
            connections.map(async (connection) => {
                // insert some fake data
                const post1 = new Post()
                post1.title = "About #1"
                post1.likes = 12
                await connection.manager.save(post1)
                const post2 = new Post()
                post2.title = "About #2"
                post2.likes = 3
                await connection.manager.save(post2)

                // check operator
                const loadedPosts = await connection
                    .getRepository(Post)
                    .findBy({
                        likes: Raw(
                            (columnAlias) => "1 + " + columnAlias + " = 4",
                        ),
                    })
                loadedPosts.should.be.eql([
                    { id: 2, likes: 3, title: "About #2" },
                ])
            }),
        ))

    it("raw (function with object literal parameters)", () =>
        Promise.all(
            connections.map(async (connection) => {
                const createPost = (index: number): Post => {
                    const post = new Post()
                    post.title = `About #${index}`
                    post.likes = index

                    return post
                }

                // insert some fake data
                await connection.manager.save([
                    createPost(1),
                    createPost(2),
                    createPost(3),
                    createPost(4),
                    createPost(5),
                    createPost(6),
                ])

                // check operator
                const result1 = await connection.getRepository(Post).findBy({
                    likes: Raw(
                        (columnAlias) => {
                            return `(${columnAlias} = :value1) OR (${columnAlias} = :value2)`
                        },
                        { value1: 2, value2: 3 },
                    ),
                })
                result1.sort((a, b) => a.id - b.id)
                result1.should.be.eql([
                    { id: 2, likes: 2, title: "About #2" },
                    { id: 3, likes: 3, title: "About #3" },
                ])

                // check operator
                const result2 = await connection.getRepository(Post).findBy({
                    likes: Raw(
                        (columnAlias) => {
                            return `(${columnAlias} IN (1, 4, 5, 6)) AND (${columnAlias} < :maxValue)`
                        },
                        { maxValue: 6 },
                    ),
                })
                result2.sort((a, b) => a.id - b.id)
                result2.should.be.eql([
                    { id: 1, likes: 1, title: "About #1" },
                    { id: 4, likes: 4, title: "About #4" },
                    { id: 5, likes: 5, title: "About #5" },
                ])

                // check operator
                const result3 = await connection.getRepository(Post).findBy({
                    title: Raw(
                        (columnAlias) => {
                            return `${columnAlias} IN (:a, :b, :c)`
                        },
                        { a: "About #1", b: "About #3", c: "About #5" },
                    ),
                    likes: Raw((columnAlias) => `${columnAlias} IN (:d, :e)`, {
                        d: 5,
                        e: 1,
                    }),
                })
                result3.sort((a, b) => a.id - b.id)
                result3.should.be.eql([
                    { id: 1, likes: 1, title: "About #1" },
                    { id: 5, likes: 5, title: "About #5" },
                ])

                // check operator
                const result4 = await connection.getRepository(Post).findBy({
                    likes: Raw((columnAlias) => `${columnAlias} IN (2, 6)`, {}),
                })
                result4.sort((a, b) => a.id - b.id)
                result4.should.be.eql([
                    { id: 2, likes: 2, title: "About #2" },
                    { id: 6, likes: 6, title: "About #6" },
                ])

                // check operator
                const result5 = await connection.getRepository(Post).findBy({
                    likes: Raw(
                        (columnAlias) => `${columnAlias} IN (2, :value, 6)`,
                        { value: 3 },
                    ),
                })
                result5.sort((a, b) => a.id - b.id)
                result5.should.be.eql([
                    { id: 2, likes: 2, title: "About #2" },
                    { id: 3, likes: 3, title: "About #3" },
                    { id: 6, likes: 6, title: "About #6" },
                ])

                // check operator
                const result6 = await connection.getRepository(Post).findBy({
                    likes: Raw(
                        (columnAlias) => `${columnAlias} IN (:...values)`,
                        { values: [2, 3, 6] },
                    ),
                })
                result6.sort((a, b) => a.id - b.id)
                result6.should.be.eql([
                    { id: 2, likes: 2, title: "About #2" },
                    { id: 3, likes: 3, title: "About #3" },
                    { id: 6, likes: 6, title: "About #6" },
                ])
            }),
        ))

    it("should work with ActiveRecord model", async () => {
        // These must run sequentially as we have the global context of the `PersonAR` ActiveRecord class
        for (const connection of connections) {
            PersonAR.useDataSource(connection)

            const person = new PersonAR()
            person.name = "Timber"
            await connection.manager.save(person)

            const loadedPeople = await PersonAR.findBy({
                name: In(["Timber"]),
            })
            expect(loadedPeople[0].name).to.be.equal("Timber")
        }
    })

    it("or (array syntax)", () =>
        Promise.all(
            connections.map(async (connection) => {
                // insert some fake data
                const post1 = new Post()
                post1.title = "About #1"
                post1.likes = 12
                await connection.manager.save(post1)
                const post2 = new Post()
                post2.title = "About #2"
                post2.likes = 3
                await connection.manager.save(post2)
                const post3 = new Post()
                post3.title = "About #3"
                post3.likes = 4
                await connection.manager.save(post3)

                // check operator
                const loadedPosts = await connection
                    .getRepository(Post)
                    .findBy([
                        {
                            likes: 3,
                        },
                        {
                            likes: 4,
                        },
                    ])
                loadedPosts.sort((a, b) => a.id - b.id)
                loadedPosts.should.be.eql([
                    { id: 2, likes: 3, title: "About #2" },
                    { id: 3, likes: 4, title: "About #3" },
                ])
            }),
        ))
})

redpajama_set_name: RedPajamaGithub


text:
package cc.makeblock.modules;

import org.json.JSONObject;

import android.widget.TextView;
import cc.makeblock.makeblock.R;

public class MePotential extends MeModule {
	static String devName = "potentiometer";
	public MePotential(int port, int slot) {
		super(devName, MeModule.DEV_POTENTIALMETER, port, slot);
		// TODO Auto-generated constructor stub
		viewLayout = R.layout.dev_value_view;
		imageId = R.drawable.potentiometer;
	}

	public MePotential(JSONObject jobj) {
		super(jobj);
		viewLayout = R.layout.dev_value_view;
		imageId = R.drawable.potentiometer;
	}

	public String getScriptRun(String var){
		varReg = var;
		String code = var+" = potentiometer("+getPortString(port)+")\n";
		return code;
	}

	public byte[] getQuery(int index){
		byte[] query = buildQuery(type, port, slot, index);
		return query;
	}

	public void setEchoValue(String value){
		TextView txt =  (TextView)view.findViewById(R.id.textValue);
		txt.setText(value);
		return;
	}
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">

  <bean id="dataSourceServiceLocator" name="dataSourceServiceLocator" class="com.mchange.v2.c3p0.ComboPooledDataSource">
    <property name="jdbcUrl"><value>jdbc:mysql://db.livescribe.com/servicelocator</value></property>
    <property name="user"><value>_serlocatoruser</value></property>
    <property name="password"><value>__slg834__</value></property>
  </bean>

</beans>


text:
// 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.

package com.google.api.ads.adwords.appengine;

import java.util.logging.Logger;

import com.google.api.ads.adwords.appengine.oauth.AuthorizationCodeFlowFactory;
import com.google.api.ads.adwords.appengine.oauth.CredentialFactory;
import com.google.api.ads.adwords.appengine.servlet.DeniedServlet;
import com.google.api.ads.adwords.appengine.servlet.IndexServlet;
import com.google.api.ads.adwords.appengine.servlet.OAuth2CallbackServlet;
import com.google.api.ads.adwords.appengine.util.AdWordsRequest;
import com.google.api.ads.adwords.appengine.util.AdWordsSessions;
import com.google.api.ads.adwords.jaxws.factory.AdWordsServices;
import com.google.api.client.auth.oauth2.CredentialStore;
import com.google.api.client.extensions.appengine.auth.oauth2.AppEngineCredentialStore;
import com.google.api.client.googleapis.auth.oauth2.GoogleCredential;
import com.google.api.client.http.HttpTransport;
import com.google.api.client.http.javanet.NetHttpTransport;
import com.google.api.client.json.JsonFactory;
import com.google.api.client.json.jackson2.JacksonFactory;
import com.google.appengine.api.users.UserService;
import com.google.appengine.api.users.UserServiceFactory;
import com.google.inject.Provider;
import com.google.inject.name.Names;
import com.google.inject.servlet.ServletModule;

/**
 * Configures the servlet bindings.
 *
 */
public class PlaygroundServletModule extends ServletModule {

  static final Logger log = Logger.getLogger(PlaygroundServletModule.class.getName());

  /**
   * If you do not have a client ID or secret, please create one in the API console:
   * https://code.google.com/apis/console#access
   */
  private static final String CLIENT_ID = System.getProperty("adwords.appengine.clientId");
  private static final String CLIENT_SECRET = System.getProperty("adwords.appengine.clientSecret");
  private static final String SCOPE = "https://adwords.google.com/api/adwords/";
  private static final String CLIENT_CUSTOMER_ID = System.getProperty("adwords.clientCustomerId");
  private static final String DEVELOPER_TOKEN = System.getProperty("adwords.developerToken");

  /**
   * The redirect URL must be registered in the API console: https://code.google.com/apis/console/
   * This is so that once the user has authorized your app, they are redirected back to your app.
   */
  private static final String REDIRECT_URL = "/oauth2callback";

  /**
   * The number of seconds to keep a user's networks in memcache.
   */
  private static final int EXPIRATION_DELTA = 60 * 60;

  @Override
  protected void configureServlets() {
    super.configureServlets();

    serve("/").with(IndexServlet.class);
    serve("/denied").with(DeniedServlet.class);
    serve("/dfp").with(IndexServlet.class);
    serveRegex("/[0-9]+").with(IndexServlet.class);
    serve(REDIRECT_URL).with(OAuth2CallbackServlet.class);

    bindConstant().annotatedWith(Names.named("clientId")).to(CLIENT_ID);
    bindConstant().annotatedWith(Names.named("clientSecret")).to(CLIENT_SECRET);
    bindConstant().annotatedWith(Names.named("scope")).to(SCOPE);
    bindConstant().annotatedWith(Names.named("redirectUrl")).to(REDIRECT_URL);
    bindConstant().annotatedWith(Names.named("expirationDelta")).to(EXPIRATION_DELTA);

    bindConstant().annotatedWith(Names.named("clientCustomerId")).to(CLIENT_CUSTOMER_ID);
    bindConstant().annotatedWith(Names.named("developerToken")).to(DEVELOPER_TOKEN);

    bind(AuthorizationCodeFlowFactory.class);
    bind(CredentialFactory.class);
    bind(CredentialStore.class).to(AppEngineCredentialStore.class);
    bind(GoogleCredential.class);
    bind(HttpTransport.class).to(NetHttpTransport.class);
    bind(JsonFactory.class).to(JacksonFactory.class);

    bind(UserService.class).toProvider(UserServiceProvider.class);

    bind(AdWordsRequest.class);
    bind(AdWordsServices.class);
    bind(AdWordsSessions.class);
  }

  private static class UserServiceProvider implements Provider<UserService> {

    public UserService get() {
      return UserServiceFactory.getUserService();
    }
  }
}


text:
This guide covers the basic build and configuration of OpenThread Commissioner
(OT Commissioner). Upon completion of this procedure, you'll have an OT
Commissioner CLI executable and a static Commissioner library.

## Step 1: Set up OT Commissioner

1.  Clone the OT Commissioner repository:
    ```
    $ git clone https://github.com/openthread/ot-commissioner
    ```

1.  Install dependencies:
    ```
    $ cd ot-commissioner
    $ ./script/bootstrap.sh
    ```

## Step 2: Build OT Commissioner

OT Commissioner installs to the `/usr/local` directory. If you'd like to change
your installation directory, set `-DCMAKE_INSTALL_PREFIX`.

> Note: If you change the default installation directory, you'll need to update
`$PATH` to run `commissioner-cli`. This guide uses an Environment variable to
work for both default and custom installations.

1.  Build OT Commissioner:
    ```
    $ mkdir build
    $ cd build
    $ cmake -DCMAKE_INSTALL_PREFIX={/usr/local} -GNinja ..
    $ ninja -j1
    ```

1.  Create an Environment variable to run `commissioner-cli` in the next step:
    ```
    $ export COMMISSIONER_CLI={/usr/local}/bin/commissioner-cli
    ```

1.  _Optional_. Run unit tests:
    ```
    $ ./tests/commissioner-test
    ```

## Step 3: Install OT Commissioner

OT Commissioner installs the following to your installation directory:

*   OT Commissioner library and header files
*   OT Commissioner CLI executable binary
*   Default configuration files and credentials
*   Scripts to run OT Commissioner CLI as daemon

```
$ sudo ninja install
```

Verify the installation by checking the help menu.

```
$ $COMMISSIONER_CLI -h
```

If you installed to the `/usr/local` directory, `commissioner-cli` is available
from the command line.

```
$ commissioner-cli -h
```

## Step 3: Configuration

The OT Commissioner CLI supports both Thread 1.2 Commercial Commissioning Mode
(CCM) and Thread 1.1 commissioning (Non-CCM). To connect to different Thread
networks, a JSON configuration file is needed to start OT Commissioner CLI:

*   `ccm-config.json` — The default configuration file for CCM Thread Network.
*   `non-ccm-config.json` — The default configuration file for Non-CCM Thread
    Network.

By default, these configuration files are installed in `/usr/local/etc/commissioner`. You can
also view sample files on the [ot-commissioner GitHub repository](https://github.com/openthread/ot-commissioner/tree/main/src/app/etc/commissioner).

### CCM configuration

To connect to a CCM Thread network, update these fields in `ccm-config.json`:

Field | Description
----|----
`DomainName` | Unique identifier within the Enterprise Domain.
`PrivateKeyFile` | The private key file in PEM format.
`CertificateFile` | The certificate file in PEM format.
`TrustAnchorFile` | The trust anchor file in PEM format.

These key and certificate files are used to establish secure sessions between
the Commissioner and Border Agent.

> Note: If you changed the default installation directory, you'll need to
update `"ThreadSMRoot" : "/usr/local/etc/commissioner"`.

### Non-CCM configuration

The Pre-Shared Key `PSKc` is used to establish a secure session between the
Commissioner and Border Agent. To connect to a Non-CCM Thread network, you
can set your `PSKc` from the OT Commissioner CLI. For more information,
refer to [External Commissioning](../border-router/external-commissioning/index.md).

### Logging

When you run `pi@raspberrypi: commissioner-cli` from the command line,
OT Commissioner creates a `commissioner.log` file in the current working
directory, for example `/home/pi/commissioner.log`. In the JSON configuration
file, you can configure your `LogFile` path, logging level, and other log
settings.

### Load configuration

To start OT Commissioner with your configuration settings:

```
$ commissioner-cli {/usr/local}/etc/commissioner/{ccm-config}.json
>
```

> Note: If you're using the default configuration settings in the
`non-ccm-config.json` file, you don't need to pass it to
`commissioner-cli`.

## Commission a joiner

To use OT Commissioner to commission a joiner, refer to [External
Commissioning](../border-router/external-commissioning/index.md).

## License

Copyright (c) 2021, The OpenThread Authors.
All rights reserved.

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.
3. Neither the name of the copyright holder nor the
   names of its contributors may be used to endorse or promote products
   derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT HOLDER 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.


text:
Meteor.startup(function () {

  // My auth will return the userId
  var myAuth = function() {
        // Read the token from '/hello?token=5'
        var userToken = this.query.token;
        // Check the userToken before adding it to the db query
        // Set the this.userId
        if (userToken) {
          var user = Meteor.users.findOne({ 'services.resume.loginTokens.token': userToken });

          // Set the userId in the scope
          return user && user._id;
        }
      };

    function readCookie(cookieHeader, cookieName) {
     var re = new RegExp('[; ]'+cookieName+'=([^\\s;]*)');
     var sMatch = (' '+cookieHeader).match(re);
     if (cookieName && sMatch) return unescape(sMatch[1]);
     return  null;
    }

    function auth() {
        var meteor_login_token = this.req.cookies.meteor_login_token;
        if (meteor_login_token) {
             var user = Meteor.users.findOne({"services.resume.loginTokens.hashedToken": Accounts._hashLoginToken(meteor_login_token)});
             if (user)
                 return user._id;
        }
        return null;
    }

//copied from Meteor-cfs-access-point

/**
 * @method defaultSelectorFunction
 * @private
 * @returns { collection, file }
 *
 * This is the default selector function
 */
var defaultSelectorFunction = function() {
  var self = this;
  // Selector function
  //
  // This function will have to return the collection and the
  // file. If file not found undefined is returned - if null is returned the
  // search was not possible
  var opts = FS.Utility.extend({}, self.query || {}, self.params || {});

  // Get the collection name from the url
  var collectionName = "blobs";

  // Get the id from the url
  var id = opts.id;

  // Get the collection
  var collection = FS._collections[collectionName];

  // Get the file if possible else return null
  var q = ({post: this.params.postId, 'original.name': this.params.name});
  var file =  Collections.Blobs.findOne(q);

  if (file == null) {
      q = ({owner: this.params.postId, 'original.name': this.params.name});
      file =  Collections.Blobs.findOne(q);
  }

  // Return the collection and the file
  return {
    collection: collection,
    file: file,
    storeName: opts.store,
    download: opts.download,
    filename: opts.filename
  };
};

/*
  requestRange will parse the range set in request header - if not possible it
  will throw fitting errors and autofill range for both partial and full ranges
  throws error or returns the object:
  {
    start
    end
    length
    unit
    partial
  }
*/
var requestRange = function(req, fileSize) {
  if (req) {
    if (req.headers) {
      var rangeString = req.headers.range;

      // Make sure range is a string
      if (rangeString === ''+rangeString) {

        // range will be in the format "bytes=0-32767"
        var parts = rangeString.split('=');
        var unit = parts[0];

        // Make sure parts consists of two strings and range is of type "byte"
        if (parts.length == 2 && unit == 'bytes') {
          // Parse the range
          var range = parts[1].split('-');
          var start = Number(range[0]);
          var end = Number(range[1]);

          // Fix invalid ranges?
          if (range[0] != start) start = 0;
          if (range[1] != end) end = fileSize - 1;

          // Make sure range consists of a start and end point of numbers and start is less than end
          if (start < end) {

            var partSize = start + end + 1;

            // Return the parsed range
            return {
              start: start,
              end: end,
              length: partSize,
              size: fileSize,
              unit: unit,
              partial: (partSize < fileSize)
            };

          } else {
            throw new Meteor.Error(416, "Requested Range Not Satisfiable");
          }

        } else {
          // The first part should be bytes
          throw new Meteor.Error(416, "Requested Range Unit Not Satisfiable");
        }

      } else {
        // No range found
      }

    } else {
      // throw new Error('No request headers set for _parseRange function');
    }
  } else {
    throw new Error('No request object passed to _parseRange function');
  }

  return {
    start: 0,
    end: fileSize - 1,
    length: fileSize,
    size: fileSize,
    unit: 'bytes',
    partial: false
  };
};

getHeaders = [];
getHeadersByCollection = {};

/**
 * @method httpDelHandler
 * @private
 * @returns {any} response
 *
 * HTTP DEL request handler
 */
httpDelHandler = function httpDelHandler(ref) {
  var self = this;
  var opts = FS.Utility.extend({}, self.query || {}, self.params || {});

  // If DELETE request, validate with 'remove' allow/deny, delete the file, and return
  FS.Utility.validateAction(ref.collection.files._validators['remove'], ref.file, self.userId);

  /*
   * From the DELETE spec:
   * A successful response SHOULD be 200 (OK) if the response includes an
   * entity describing the status, 202 (Accepted) if the action has not
   * yet been enacted, or 204 (No Content) if the action has been enacted
   * but the response does not include an entity.
   */
  self.setStatusCode(200);

  return {
    deleted: !!ref.file.remove()
  };
};

/*
  requestRange will parse the range set in request header - if not possible it
  will throw fitting errors and autofill range for both partial and full ranges
  throws error or returns the object:
  {
    start
    end
    length
    unit
    partial
  }
*/
var requestRange = function(req, fileSize) {
  if (req) {
    if (req.headers) {
      var rangeString = req.headers.range;

      // Make sure range is a string
      if (rangeString === ''+rangeString) {

        // range will be in the format "bytes=0-32767"
        var parts = rangeString.split('=');
        var unit = parts[0];

        // Make sure parts consists of two strings and range is of type "byte"
        if (parts.length == 2 && unit == 'bytes') {
          // Parse the range
          var range = parts[1].split('-');
          var start = Number(range[0]);
          var end = Number(range[1]);

          // Fix invalid ranges?
          if (range[0] != start) start = 0;
          if (range[1] != end) end = fileSize - 1;

          // Make sure range consists of a start and end point of numbers and start is less than end
          if (start < end) {

            var partSize = start + end + 1;

            // Return the parsed range
            return {
              start: start,
              end: end,
              length: partSize,
              size: fileSize,
              unit: unit,
              partial: (partSize < fileSize)
            };

          } else {
            throw new Meteor.Error(416, "Requested Range Not Satisfiable");
          }

        } else {
          // The first part should be bytes
          throw new Meteor.Error(416, "Requested Range Unit Not Satisfiable");
        }

      } else {
        // No range found
      }

    } else {
      // throw new Error('No request headers set for _parseRange function');
    }
  } else {
    throw new Error('No request object passed to _parseRange function');
  }

  return {
    start: 0,
    end: fileSize - 1,
    length: fileSize,
    size: fileSize,
    unit: 'bytes',
    partial: false
  };
};

/**
 * @method httpGetHandler
 * @private
 * @returns {any} response
 *
 * HTTP GET request handler
 */
httpGetHandler = function httpGetHandler(ref) {

 console.log("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");

  var self = this;
  // Once we have the file, we can test allow/deny validators
  // XXX: pass on the "share" query eg. ?share=342hkjh23ggj for shared url access?
  FS.Utility.validateAction(ref.collection._validators['download'], ref.file, self.userId /*, self.query.shareId*/);

  var storeName = ref.storeName;

  // If no storeName was specified, use the first defined storeName
  if (typeof storeName !== "string") {
    // No store handed, we default to primary store
    storeName = ref.collection.primaryStore.name;
  }

  // Get the storage reference
  var storage = ref.collection.storesLookup[storeName];

  if (!storage) {
    throw new Meteor.Error(404, "Not Found", 'There is no store "' + storeName + '"');
  }

  // Get the file
  var copyInfo = ref.file.copies[storeName];

  if (!copyInfo) {
    throw new Meteor.Error(404, "Not Found", 'This file was not stored in the ' + storeName + ' store');
  }

  // Set the content type for file
  if (typeof copyInfo.type === "string") {
    self.setContentType(copyInfo.type);
  } else {
    self.setContentType('application/octet-stream');
  }

  // Add 'Content-Disposition' header if requested a download/attachment URL
  if (typeof ref.download !== "undefined") {
    var filename = ref.filename || copyInfo.name;
    self.addHeader('Content-Disposition', 'attachment; filename="' + filename + '"');
  } else {
    self.addHeader('Content-Disposition', 'inline');
  }

  // Get the contents range from request
  var range = requestRange(self.request, copyInfo.size);

  // Some browsers cope better if the content-range header is
  // still included even for the full file being returned.
  self.addHeader('Content-Range', range.unit + ' ' + range.start + '-' + range.end + '/' + range.size);

  // If a chunk/range was requested instead of the whole file, serve that'
  if (range.partial) {
    self.setStatusCode(206, 'Partial Content');
  } else {
    self.setStatusCode(200, 'OK');
  }

  // Add any other global custom headers and collection-specific custom headers
  FS.Utility.each(getHeaders.concat(getHeadersByCollection[ref.collection.name] || []), function(header) {
    self.addHeader(header[0], header[1]);
  });

  // Inform clients about length (or chunk length in case of ranges)
  self.addHeader('Content-Length', range.length);

  // Last modified header (updatedAt from file info)
  self.addHeader('Last-Modified', copyInfo.updatedAt.toUTCString());

  // Inform clients that we accept ranges for resumable chunked downloads
  //self.addHeader('Accept-Ranges', range.unit);
  self.addHeader('Accept-Ranges', 'none');

  if (FS.debug) console.log('Read file "' + (ref.filename || copyInfo.name) + '" ' + range.unit + ' ' + range.start + '-' + range.end + '/' + range.size);

  var readStream = storage.adapter.createReadStream(ref.file, {start: range.start, end: range.end});

  readStream.on('error', function(err) {
    // Send proper error message on get error
    if (err.message && err.statusCode) {
      self.Error(new Meteor.Error(err.statusCode, err.message));
    } else {
      self.Error(new Meteor.Error(503, 'Service unavailable'));
    }
  });

  readStream.pipe(self.createWriteStream());
};

httpPutInsertHandler = function httpPutInsertHandler(ref) {
  var self = this;
  var opts = FS.Utility.extend({}, self.query || {}, self.params || {});

  FS.debug && console.log("HTTP PUT (insert) handler");

  // Create the nice FS.File
  var fileObj = new FS.File();

  // Set its name
  fileObj.name(opts.filename || null);

  // Attach the readstream as the file's data
  fileObj.attachData(self.createReadStream(), {type: self.requestHeaders['content-type'] || 'application/octet-stream'});

  // Validate with insert allow/deny
  FS.Utility.validateAction(ref.collection.files._validators['insert'], file, self.userId);

  // Insert file into collection, triggering readStream storage
  ref.collection.insert(fileObj);

  // Send response
  self.setStatusCode(200);

  // Return the new file id
  return {_id: fileObj._id};
};

    function get_postFileGetRequest(numArgs) {
        return function postFileGetRequest() {
            console.log("postFileGetRequest");

            if (numArgs == 0) {
              var result ="";
              var postId = this.params.postId;
              Collections.Blobs.find({post: postId}, { sort: {name:1}}).forEach(function(f) {
                  result += "" +  f.name()+"
";
              });
              return result;
            } else {
              var name = this.params[''+0]
              for (var i = 1; i < numArgs; i++) {
                 name += "/" + this.params[''+i]
              }
              this.params.name = name;
              var fileRef = defaultSelectorFunction.apply(this);
              console.log("this.request");
              httpGetHandler.call(this, fileRef);
              console.log("get done");
              // return numArgs + ' posts filename username='+ this.userId;
            }
        }
    }

    var methodParam = {};
    var name =  'posts/:postId/file';

    FS.debug = true;

    for (var numArgs = 0; numArgs <= 100; numArgs ++) {
        methodParam[name] = {  auth: auth, get: get_postFileGetRequest(numArgs)} ;
        name += "/";
        methodParam[name] = {  auth: auth, get: get_postFileGetRequest(numArgs)} ;
        name += ":" + numArgs;
    }

    HTTP.methods(methodParam);

});


text:
/)calendars;
+ (NSArray* /* NSString * */)clocks;
+ (NSArray* /* NSString * */)currencies;
+ (NSString*)homeGeographicRegion;
+ (NSArray* /* NSString * */)languages;
+ (WGDayOfWeek)weekStartsOn;
@end

#endif // __WSUGlobalizationPreferences_DEFINED__

// Windows.System.UserProfile.FirstSignInSettings
#ifndef __WSUFirstSignInSettings_DEFINED__
#define __WSUFirstSignInSettings_DEFINED__

WINRT_EXPORT
@interface WSUFirstSignInSettings : RTObject
+ (WSUFirstSignInSettings*)getDefault;
@property (readonly) unsigned int size;
- (id)objectForKey:(id)key;
- (NSArray*)allKeys;
- (NSArray*)allKeysForObject:(id)obj;
- (NSArray*)allValues;
- (id)keyEnumerator;
- (unsigned int)count;

@end

#endif // __WSUFirstSignInSettings_DEFINED__


text: The prompt displayed to the user, which will be followed by confirm and cancel links.


text:
using DevJobs.Models.Contracts;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DevJobs.Services.Tests.Fakes
{
    public class DataModel_Fake : IDataModel, IDeletable, IAuditable
    {
        public Guid Id { get; set; }
        public DateTime? CreatedOn { get; set; }
        public DateTime? DeletedOn { get; set; }
        public bool IsDeleted { get; set; }
        public DateTime? ModifiedOn { get; set; }
    }
}


text:
r"""Convert raw PASCAL dataset to TFRecord for object_detection.

Example usage:
    ./create_pascal_tf_record --data_dir=/home/user/VOCdevkit \
        --year=VOC2012 \
        --output_path=/home/user/pascal.record
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

import hashlib
import io
import logging

import PIL.Image
import os
import tensorflow as tf
from lxml import etree

from object_detection.utils import dataset_util
from object_detection.utils import label_map_util

# flags = tf.app.flags
# flags.DEFINE_string('data_dir', '', 'Root directory to raw PASCAL VOC dataset.')
# flags.DEFINE_string('set', 'train', 'Convert training set, validation set or '
#                     'merged set.')
# flags.DEFINE_string('annotations_dir', 'Annotations',
#                     '(Relative) path to annotations directory.')
# flags.DEFINE_string('year', 'VOC2007', 'Desired challenge year.')
# flags.DEFINE_string('output_path', '', 'Path to output TFRecord')
# flags.DEFINE_string('label_map_path', 'data/pascal_label_map.pbtxt',
#                     'Path to label map proto')
# flags.DEFINE_boolean('ignore_difficult_instances', False, 'Whether to ignore '
#                      'difficult instances')
# FLAGS = flags.FLAGS

SETS = ['train', 'val', 'trainval', 'test']
YEARS = ['VOC2007', 'VOC2012', 'merged']

def dict_to_tf_example(data,
                       dataset_directory,
                       label_map_dict,
                       ignore_difficult_instances=False,
                       image_subdirectory='JPEGImages'):
  """Convert XML derived dict to tf.Example proto.

  Notice that this function normalizes the bounding box coordinates provided
  by the raw data.

  Args:
    data: dict holding PASCAL XML fields for a single image (obtained by
      running dataset_util.recursive_parse_xml_to_dict)
    dataset_directory: Path to root directory holding PASCAL dataset
    label_map_dict: A map from string label names to integers ids.
    ignore_difficult_instances: Whether to skip difficult instances in the
      dataset  (default: False).
    image_subdirectory: String specifying subdirectory within the
      PASCAL dataset directory holding the actual image data.

  Returns:
    example: The converted tf.Example.

  Raises:
    ValueError: if the image pointed to by data['filename'] is not a valid JPEG
  """
  # TODO(SS): loop over sets
  img_path = os.path.join(data['folder'], image_subdirectory, data['filename'])
  full_path = os.path.join(dataset_directory, img_path)
  assert os.path.exists(full_path), full_path
  with tf.gfile.GFile(full_path, 'rb') as fid:
    encoded_jpg = fid.read()
  encoded_jpg_io = io.BytesIO(encoded_jpg)
  image = PIL.Image.open(encoded_jpg_io)
  if image.format != 'JPEG':
    raise ValueError('Image format not JPEG')
  key = hashlib.sha256(encoded_jpg).hexdigest()

  width = int(data['size']['width'])
  height = int(data['size']['height'])

  xmin = []
  ymin = []
  xmax = []
  ymax = []
  classes = []
  classes_text = []
  truncated = []
  poses = []
  difficult_obj = []

  for obj in data['object']:
    difficult = bool(int(obj['difficult']))
    if ignore_difficult_instances and difficult:
      continue

    difficult_obj.append(int(difficult))
    xmin.append(float(obj['bndbox']['xmin']) / width)
    ymin.append(float(obj['bndbox']['ymin']) / height)
    xmax.append(float(obj['bndbox']['xmax']) / width)
    ymax.append(float(obj['bndbox']['ymax']) / height)
    classes_text.append(obj['name'].lower().encode('utf8'))
    classes.append(label_map_dict[obj['name'].lower()])
    truncated.append(int(obj['truncated']))
    poses.append(obj['pose'].encode('utf8'))

  example = tf.train.Example(features=tf.train.Features(feature={
      'image/height': dataset_util.int64_feature(height),
      'image/width': dataset_util.int64_feature(width),
      'image/filename': dataset_util.bytes_feature(
          data['filename'].encode('utf8')),
      'image/source_id': dataset_util.bytes_feature(
          data['filename'].encode('utf8')),
      'image/key/sha256': dataset_util.bytes_feature(key.encode('utf8')),
      'image/encoded': dataset_util.bytes_feature(encoded_jpg),
      'image/format': dataset_util.bytes_feature('jpeg'.encode('utf8')),
      'image/object/bbox/xmin': dataset_util.float_list_feature(xmin),
      'image/object/bbox/xmax': dataset_util.float_list_feature(xmax),
      'image/object/bbox/ymin': dataset_util.float_list_feature(ymin),
      'image/object/bbox/ymax': dataset_util.float_list_feature(ymax),
      'image/object/class/text': dataset_util.bytes_list_feature(classes_text),
      'image/object/class/label': dataset_util.int64_list_feature(classes),
      'image/object/difficult': dataset_util.int64_list_feature(difficult_obj),
      'image/object/truncated': dataset_util.int64_list_feature(truncated),
      'image/object/view': dataset_util.bytes_list_feature(poses),
  }))
  return example

def main(_):
  if FLAGS.set not in SETS:
    raise ValueError('set must be in : {}'.format(SETS))
  if FLAGS.year not in YEARS:
    raise ValueError('year must be in : {}'.format(YEARS))

  data_dir = FLAGS.data_dir
  years = ['VOC2007', 'VOC2012']
  if FLAGS.year != 'merged':
    years = [FLAGS.year]

  writer = tf.python_io.TFRecordWriter(FLAGS.output_path)

  label_map_dict = label_map_util.get_label_map_dict(FLAGS.label_map_path)

  for year in years:
    logging.info('Reading from PASCAL %s dataset.', year)
    examples_path = os.path.join(data_dir, year, 'ImageSets', 'Main',
                                 'aeroplane_' + FLAGS.set + '.txt')
    annotations_dir = os.path.join(data_dir, year, FLAGS.annotations_dir)
    examples_list = dataset_util.read_examples_list(examples_path)
    for idx, example in enumerate(examples_list):
      if idx % 100 == 0:
        logging.info('On image %d of %d', idx, len(examples_list))
      path = os.path.join(annotations_dir, example + '.xml')
      with tf.gfile.GFile(path, 'r') as fid:
        xml_str = fid.read()
      xml = etree.fromstring(xml_str)
      data = dataset_util.recursive_parse_xml_to_dict(xml)['annotation']

      tf_example = dict_to_tf_example(data, FLAGS.data_dir, label_map_dict,
                                      FLAGS.ignore_difficult_instances)
      writer.write(tf_example.SerializeToString())

  writer.close()

if __name__ == '__main__':
  tf.app.run()


text:
import { assert } from 'chai';
import UpdateVisitor from 'osg/UpdateVisitor';
import Node from 'osg/Node';

export default function() {
    test('UpdateVisitor', function() {
        var uv = new UpdateVisitor();

        var root = new Node();
        root.setName('a');
        var b = new Node();
        b.setName('b');
        var c = new Node();
        c.setName('c');
        root.addChild(b);
        b.addChild(c);

        var callRoot = 0;
        var callb = 0;
        var callc = 0;
        var stateSetUpdateCallbackCalled = 0;

        var StateSetUpdateCallback = function() {
            this.update = function(/*stateset, nv */) {
                stateSetUpdateCallbackCalled += 1;
            };
        };
        var ss = b.getOrCreateStateSet();
        ss.addUpdateCallback(new StateSetUpdateCallback());

        var Froot = function() {};
        Froot.prototype = {
            update: function(node, nv) {
                callRoot = 1;
                node.traverse(nv);
            }
        };

        var Fb = function() {};
        Fb.prototype = {
            update: function(/*node, nv */) {
                callb = 1;
                return false;
            }
        };

        var Fc = function() {};
        Fc.prototype = {
            update: function(/*node, nv */) {
                callc = 1;
                return true;
            }
        };

        root.addUpdateCallback(new Froot());
        b.addUpdateCallback(new Fb());
        c.addUpdateCallback(new Fc());

        uv.apply(root);

        assert.isOk(stateSetUpdateCallbackCalled > 0, 'Called stateSet update callback');

        assert.isOk(callRoot === 1, 'Called root update callback');
        assert.isOk(callb === 1, 'Called b update callback');
        assert.isOk(callc === 0, 'Did not Call c update callback as expected');

        root.setNodeMask(~0);
        assert.isOk(callRoot === 1, 'Called root update callback');
        assert.isOk(callb === 1, 'Called b update callback');
        assert.isOk(callc === 0, 'Did not Call c update callback as expected');
    });
}


text:
package org.jahap.gui.base;

import java.util.EventObject;
import javax.swing.table.TableModel;

/**
 *
 * @author russ
 */
public class SearchResultEvent extends EventObject{

    private long DbRecordId;

    private String TableNameofSource;

     public long getDbRecordId() {
        return DbRecordId;
    }

    public Object getTableNameofSource() {
        return TableNameofSource;
    }

    public SearchResultEvent(Object source, long DataRecordId, String TableNameofSource ){
        super(source);
        this.DbRecordId=DataRecordId;
        this.TableNameofSource=TableNameofSource;
    }

}