text:
/*	$OpenBSD: autoconf.c,v 1.3 2004/07/23 15:31:35 miod Exp $	*/
/*
 * Copyright (c) 1998 Steve Murphree, Jr.
 * Copyright (c) 1996 Nivas Madhur
 * Copyright (c) 1994 Christian E. Hopps
 * 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. All advertising materials mentioning features or use of this software
 *    must display the following acknowledgement:
 *      This product includes software developed by Christian E. Hopps.
 * 4. The name of the author may not be used to endorse or promote products
 *    derived from this software without specific prior written permission
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
 *
 */
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/buf.h>
#include <sys/dkstat.h>
#include <sys/reboot.h>
#include <sys/conf.h>
#include <sys/device.h>
#include <sys/disklabel.h>
#include <sys/kernel.h>

#include <machine/asm_macro.h>   /* enable/disable interrupts */
#include <machine/autoconf.h>
#include <machine/cpu.h>
#include <machine/disklabel.h>
#include <machine/vmparam.h>

#include <dev/cons.h>

/*
 * The following several variables are related to
 * the configuration process, and are used in initializing
 * the machine.
 */

struct	device *parsedisk(char *, int, int, dev_t *);
void	setroot(void);
void	swapconf(void);
void	dumpconf(void);
int	findblkmajor(struct device *);
struct device *getdisk(char *, int, int, dev_t *);

int cold = 1;   /* 1 if still booting */

void *bootaddr;
int bootpart;
struct device *bootdv;	/* set by device drivers (if found) */

/*
 * called at boot time, configure all devices on the system.
 */
void
cpu_configure()
{

	if (config_rootfound("mainbus", "mainbus") == 0)
		panic("no mainbus found");

	/*
	 * Turn external interrupts on.
	 *
	 * XXX We have a race here. If we enable interrupts after setroot(),
	 * the kernel dies.
	 */
	enable_interrupt();
	spl0();
	setroot();
	swapconf();

	cold = 0;
}

/*
 * Configure swap space and related parameters.
 */
void
swapconf()
{
	struct swdevt *swp;
	int nblks;

	for (swp = swdevt; swp->sw_dev != NODEV; swp++)
		if (bdevsw[major(swp->sw_dev)].d_psize) {
			nblks =
			    (*bdevsw[major(swp->sw_dev)].d_psize)(swp->sw_dev);
			if (nblks != -1 &&
			    (swp->sw_nblks == 0 || swp->sw_nblks > nblks))
				swp->sw_nblks = nblks;
			swp->sw_nblks = ctod(dtoc(swp->sw_nblks));
		}

	dumpconf();
}

struct nam2blk {
	char *name;
	int maj;
} nam2blk[] = {
	{ "sd",	4 },
	{ "st",	5 },
	{ "rd",	7 },
};

int
findblkmajor(dv)
	struct device *dv;
{
	char *name = dv->dv_xname;
	int i;

	for (i = 0; i < sizeof(nam2blk)/sizeof(nam2blk[0]); ++i)
		if (strncmp(name, nam2blk[i].name, strlen(nam2blk[0].name)) == 0)
			return (nam2blk[i].maj);
	return (-1);
}

struct device *
getdisk(str, len, defpart, devp)
	char *str;
	int len, defpart;
	dev_t *devp;
{
	struct device *dv;

	if ((dv = parsedisk(str, len, defpart, devp)) == NULL) {
		printf("use one of:");
		for (dv = alldevs.tqh_first; dv != NULL;
		    dv = dv->dv_list.tqe_next) {
			if (dv->dv_class == DV_DISK)
				printf(" %s[a-p]", dv->dv_xname);
#ifdef NFSCLIENT
			if (dv->dv_class == DV_IFNET)
				printf(" %s", dv->dv_xname);
#endif
		}
		printf("\n");
	}
	return (dv);
}

struct device *
parsedisk(str, len, defpart, devp)
	char *str;
	int len, defpart;
	dev_t *devp;
{
	struct device *dv;
	char *cp, c;
	int majdev, unit, part;

	if (len == 0)
		return (NULL);
	cp = str + len - 1;
	c = *cp;
	if (c >= 'a' && (c - 'a') < MAXPARTITIONS) {
		part = c - 'a';
		*cp = '\0';
	} else
		part = defpart;

	for (dv = alldevs.tqh_first; dv != NULL; dv = dv->dv_list.tqe_next) {
		if (dv->dv_class == DV_DISK &&
		    strcmp(str, dv->dv_xname) == 0) {
			majdev = findblkmajor(dv);
			unit = dv->dv_unit;
			if (majdev < 0)
				panic("parsedisk");
			*devp = MAKEDISKDEV(majdev, unit, part);
			break;
		}
#ifdef NFSCLIENT
		if (dv->dv_class == DV_IFNET &&
		    strcmp(str, dv->dv_xname) == 0) {
			*devp = NODEV;
			break;
		}
#endif
	}

	*cp = c;
	return (dv);
}

/*
 * Attempt to find the device from which we were booted.
 * If we can do so, and not instructed not to do so,
 * change rootdev to correspond to the load device.
 *
 * XXX Actually, swap and root must be on the same type of device,
 * (ie. DV_DISK or DV_IFNET) because of how (*mountroot) is written.
 * That should be fixed.
 */
void
setroot()
{
	struct swdevt *swp;
	struct device *dv;
	int len, majdev, unit;
	dev_t nrootdev, nswapdev = NODEV;
	char buf[128];
	dev_t temp;
#if defined(NFSCLIENT)
	extern char *nfsbootdevname;
#endif

	printf("boot device: %s\n",
	    (bootdv) ? bootdv->dv_xname : "<unknown>");

	/*
	 * If 'swap generic' and we could not determine the boot device,
	 * ask the user.
	 */
	if (mountroot == NULL && bootdv == NULL)
		boothowto |= RB_ASKNAME;

	if (boothowto & RB_ASKNAME) {
		for (;;) {
			printf("root device ");
			if (bootdv != NULL)
				printf("(default %s%c)",
				    bootdv->dv_xname,
				    bootdv->dv_class == DV_DISK ? 'a' : ' ');
			printf(": ");
			len = getsn(buf, sizeof(buf));
			if (len == 0 && bootdv != NULL) {
				strlcpy(buf, bootdv->dv_xname, sizeof buf);
				len = strlen(buf);
			}
			if (len > 0 && buf[len - 1] == '*') {
				buf[--len] = '\0';
				dv = getdisk(buf, len, 1, &nrootdev);
				if (dv) {
					bootdv = dv;
					nswapdev = nrootdev;
					goto gotswap;
				}
			}
			dv = getdisk(buf, len, 0, &nrootdev);
			if (dv) {
				bootdv = dv;
				break;
			}
		}

		/*
		 * because swap must be on same device as root, for
		 * network devices this is easy.
		 */
		if (bootdv->dv_class == DV_IFNET) {
			goto gotswap;
		}
		for (;;) {
			printf("swap device ");
			if (bootdv != NULL)
				printf("(default %s%c)",
				    bootdv->dv_xname,
				    bootdv->dv_class == DV_DISK ? 'b' : ' ');
			printf(": ");
			len = getsn(buf, sizeof(buf));
			if (len == 0 && bootdv != NULL) {
				switch (bootdv->dv_class) {
				case DV_IFNET:
					nswapdev = NODEV;
					break;
				case DV_DISK:
					nswapdev = MAKEDISKDEV(major(nrootdev),
					    DISKUNIT(nrootdev), 1);
					break;
				case DV_TAPE:
				case DV_TTY:
				case DV_DULL:
				case DV_CPU:
					break;
				}
				break;
			}
			dv = getdisk(buf, len, 1, &nswapdev);
			if (dv) {
				if (dv->dv_class == DV_IFNET)
					nswapdev = NODEV;
				break;
			}
		}
gotswap:
		rootdev = nrootdev;
		dumpdev = nswapdev;
		swdevt[0].sw_dev = nswapdev;
		swdevt[1].sw_dev = NODEV;
	} else if (mountroot == NULL) {
		/*
		 * `swap generic': Use the device the ROM told us to use.
		 */
		if (bootdv == NULL)
			panic("boot device not known");

		majdev = findblkmajor(bootdv);
		if (majdev >= 0) {
			/*
			 * Root and swap are on a disk.
			 * val[2] of the boot device is the partition number.
			 * Assume swap is on partition b.
			 */
			unit = bootdv->dv_unit;
			rootdev = MAKEDISKDEV(majdev, unit, bootpart);
			nswapdev = dumpdev = MAKEDISKDEV(major(rootdev),
			    DISKUNIT(rootdev), 1);
		} else {
			/*
			 * Root and swap are on a net.
			 */
			nswapdev = dumpdev = NODEV;
		}
		swdevt[0].sw_dev = nswapdev;
		swdevt[1].sw_dev = NODEV;
	} else {
		/*
		 * `root DEV swap DEV': honour rootdev/swdevt.
		 * rootdev/swdevt/mountroot already properly set.
		 */
		return;
	}

	switch (bootdv->dv_class) {
#if defined(NFSCLIENT)
	case DV_IFNET:
		mountroot = nfs_mountroot;
		nfsbootdevname = bootdv->dv_xname;
		return;
#endif
#if defined(FFS)
	case DV_DISK:
		mountroot = dk_mountroot;
		majdev = major(rootdev);
		unit = DISKUNIT(rootdev);
		printf("root on %s%c\n", bootdv->dv_xname,
		    DISKPART(rootdev) + 'a');
		break;
#endif
	default:
		printf("can't figure root, hope your kernel is right\n");
		return;
	}

	/*
	 * Make the swap partition on the root drive the primary swap.
	 */
	temp = NODEV;
	for (swp = swdevt; swp->sw_dev != NODEV; swp++) {
		if (majdev == major(swp->sw_dev) &&
		    unit == DISKUNIT(swp->sw_dev)) {
			temp = swdevt[0].sw_dev;
			swdevt[0].sw_dev = swp->sw_dev;
			swp->sw_dev = temp;
			break;
		}
	}
	if (swp->sw_dev == NODEV)
		return;

	/*
	 * If dumpdev was the same as the old primary swap device, move
	 * it to the new primary swap device.
	 */
	if (temp == dumpdev)
		dumpdev = swdevt[0].sw_dev;
}


text:
title: macOS Sierra Broke My Git
---

One morning I was running `git status`. I got this ugly error message in my terminal:

```bash
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
```

This is of course not very workable. I installed macOS Sierra last night. After reading some [post](https://ohthehugemanatee.org/blog/2015/10/01/how-i-got-el-capitain-working-with-my-developer-tools/)s on disableing System Integrity Protection I found a [StackOverflow issue](http://stackoverflow.com/questions/32925000/git-doesnt-work-after-upgrading-mac-os-x-el-capitain) on this subject. It didn't need to disable any System Integrity Protection, just one simple command:

```bash
xcode-select --install
```

Git was working again. Unfortunatly Homebrew still had issues like

```
Error: /usr/local is not writable. You should change the ownership
and permissions of /usr/local back to your user account:
  sudo chown -R $(whoami) /usr/local
```

but just do what Homebrew says and you're done!

redpajama_set_name: RedPajamaGithub


text:
package com.ronsoft.books.nio.channels;

import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.channels.DatagramChannel;
import java.net.InetSocketAddress;
import java.util.Date;
import java.util.List;
import java.util.LinkedList;
import java.util.Iterator;

/**
 * Request time service, per RFC 868.  RFC 868
 * (http://www.ietf.org/rfc/rfc0868.txt) is a very simple time protocol
 * whereby one system can request the current time from another system.
 * Most Linux, BSD and Solaris systems provide RFC 868 time service
 * on port 37.  This simple program will inter-operate with those.
 * The National Institute of Standards and Technology (NIST) operates
 * a public time server at time.nist.gov.
 *
 * The RFC 868 protocol specifies a 32 bit unsigned value be sent,
 * representing the number of seconds since Jan 1, 1900.  The Java
 * epoch begins on Jan 1, 1970 (same as unix) so an adjustment is
 * made by adding or subtracting 2,208,988,800 as appropriate.  To
 * avoid shifting and masking, a four-byte slice of an
 * eight-byte buffer is used to send/recieve.  But getLong()
 * is done on the full eight bytes to get a long value.
 *
 * When run, this program will issue time requests to each hostname
 * given on the command line, then enter a loop to receive packets.
 * Note that some requests or replies may be lost, which means
 * this code could block forever.
 *
 * Created: April 2002
 * @author Ron Hitchens (ron@ronsoft.com)
 * @version $Id: TimeClient.java,v 1.2 2002/04/28 22:07:43 ron Exp $
 */
public class TimeClient
{
	private static final int DEFAULT_TIME_PORT = 37;
	private static final long DIFF_1900 = 2208988800L;

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

	protected int port = DEFAULT_TIME_PORT;
	protected List remoteHosts;
	protected DatagramChannel channel;

	public TimeClient (String [] argv) throws Exception
	{
		if (argv.length == 0) {
			throw new Exception ("Usage: [ -p port ] host ...");
		}

		parseArgs (argv);

		this.channel = DatagramChannel.open();
	}

	// this version never times out
	protected InetSocketAddress receivePacket (DatagramChannel channel,
		ByteBuffer buffer)
		throws Exception
	{
		buffer.clear();

		// receive an unsigned 32-bit, big-endian value
		return ((InetSocketAddress) channel.receive (buffer));
	}

	// send time requests to all the supplied hosts
	protected void sendRequests()
		throws Exception
	{
		ByteBuffer buffer = ByteBuffer.allocate (1);
		Iterator it = remoteHosts.iterator();

		while (it.hasNext()) {
			InetSocketAddress sa = (InetSocketAddress) it.next();

			System.out.println ("Requesting time from "
				+ sa.getHostName() + ":" + sa.getPort());

			// make it empty, see RFC868
			buffer.clear().flip();
			// fire and forget
			channel.send (buffer, sa);
		}
	}

	// receive any replies that arrive
	public void getReplies() throws Exception
	{
		// allocate a buffer to hold a long value
		ByteBuffer longBuffer = ByteBuffer.allocate (8);

		// assure big-endian (network) byte order
		longBuffer.order (ByteOrder.BIG_ENDIAN);
		// zero the whole buffer to be sure
		longBuffer.putLong (0, 0);
		// position to first byte of the low-order 32 bits
		longBuffer.position (4);

		// slice the buffer, gives view of the low-order 32 bits
		ByteBuffer buffer = longBuffer.slice();
		int expect = remoteHosts.size();
		int replies = 0;

		System.out.println ("");
		System.out.println ("Waiting for replies...");

		while (true) {
			InetSocketAddress sa;

			sa = receivePacket (channel, buffer);

			if (sa == null) {
				// only get here if receivePacket timed out
				System.out.println ("Time's up, "
					+ (expect - replies)
					+ " replies never arrived");
				break;
			}

			buffer.flip();
			replies++;

			printTime (longBuffer.getLong (0), sa);

			if (replies == expect) {
				System.out.println ("All packets answered");

				break;
			}

			// some replies haven't shown up yet
			System.out.println ("Received " + replies
				+ " of " + expect + " replies");
		}
	}

	// print info about a received time reply
	protected void printTime (long remote1900, InetSocketAddress sa)
	{
		// local time as seconds since Jan 1, 1970
		long local = System.currentTimeMillis() / 1000;
		// remote time as seconds since Jan 1, 1970
		long remote = remote1900 - DIFF_1900;
		Date remoteDate = new Date (remote * 1000);
		Date localDate = new Date (local * 1000);
		long skew = remote - local;

		System.out.println ("Reply from "
			+ sa.getHostName() + ":" + sa.getPort());
		System.out.println ("  there: " + remoteDate);
		System.out.println ("   here: " + localDate);
		System.out.print ("   skew: ");

		if (skew == 0) {
			System.out.println ("none");
		} else if (skew > 0) {
			System.out.println (skew + " seconds ahead");
		} else {
			System.out.println ((-skew) + " seconds behind");
		}
	}

	protected void parseArgs (String [] argv)
	{
		remoteHosts = new LinkedList();

		for (int i = 0; i < argv.length; i++) {
			String arg = argv [i];

			// send client requests to the given port
			if (arg.equals ("-p")) {
				i++;
				this.port = Integer.parseInt (argv [i]);
				continue;
			}

			// create an address object for the host name
			InetSocketAddress sa = new InetSocketAddress (arg, port);

			// validate that it has an address
			if (sa.getAddress() == null) {
				System.out.println ("Cannot resolve address: "
					+ arg);

				continue;
			}

			remoteHosts.add (sa);
		}
	}

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

	public static void main (String [] argv)
		throws Exception
	{
		TimeClient client = new TimeClient (argv);

		client.sendRequests();
		client.getReplies();
	}
}


text:
                Found Contact

                Cancel


text:
import tape = require("tape");
import path = require("path");

import async = require("async");
import alvision = require("../../../tsbinding/alvision");
import util = require('util');
import fs = require('fs');

//#include "test_precomp.hpp"
//#include "opencv2/highgui.hpp"
//
//using namespace std;
//using namespace cv;

const  FEATURES2D_DIR = "features2d";
const  IMAGE_FILENAME = "tsukuba.png";
const  DETECTOR_DIR = FEATURES2D_DIR + "/feature_detectors";

/****************************************************************************************\
*            Regression tests for feature detectors comparing keypoints.                 *
\****************************************************************************************/

class CV_FeatureDetectorTest  extends alvision.cvtest.BaseTest
{
    constructor(_name: string, _fdetector: alvision.FeatureDetector) {
        super();
        this.name = (_name);
        this.fdetector = (_fdetector);
    }

    isSimilarKeypoints(p1: alvision.KeyPoint, p2: alvision.KeyPoint): boolean {
        const  maxPtDif = 1.;
        const  maxSizeDif = 1.;
        const  maxAngleDif = 2.;
        const  maxResponseDif = 0.1;

        var dist = alvision.Point.norm(p1.pt.op_Substraction( p2.pt));
        return (dist < maxPtDif &&
            Math.abs(p1.size.valueOf() - p2.size.valueOf()) < maxSizeDif &&
            Math.abs(p1.angle.valueOf() - p2.angle.valueOf()) < maxAngleDif &&
            Math.abs(p1.response.valueOf() - p2.response.valueOf()) < maxResponseDif &&
            p1.octave == p2.octave &&
            p1.class_id == p2.class_id);
    }
    compareKeypointSets(validKeypoints: Array<alvision.KeyPoint>, calcKeypoints: Array<alvision.KeyPoint>): void{
        const  maxCountRatioDif = 0.01;

        // Compare counts of validation and calculated keypoints.
        var countRatio = validKeypoints.length / calcKeypoints.length;
        if (countRatio < 1 - maxCountRatioDif || countRatio > 1. + maxCountRatioDif )
        {
            this.ts.printf(alvision.cvtest.TSConstants.LOG, "Bad keypoints count ratio (validCount = %d, calcCount = %d).\n",
                validKeypoints.length, calcKeypoints.length);
            this.ts.set_failed_test_info(alvision.cvtest.FailureCode.FAIL_INVALID_OUTPUT);
            return;
        }

        var  progress = 0, progressCount = (validKeypoints.length * calcKeypoints.length);
        var  badPointCount = 0, commonPointCount = Math.max(validKeypoints.length, calcKeypoints.length);
        for (var v = 0; v < validKeypoints.length; v++ )
        {
            var nearestIdx = -1;
            var minDist = alvision.FLT_MAX;

            for (var c = 0; c < calcKeypoints.length; c++ )
            {
                progress = this.update_progress(progress, (v * calcKeypoints.length + c), progressCount, 0).valueOf();
                var curDist = alvision.Point.norm(calcKeypoints[c].pt.op_Substraction( validKeypoints[v].pt)).valueOf();
                if (curDist < minDist) {
                    minDist = curDist;
                    nearestIdx = c;
                }
            }

            alvision.assert(()=>minDist >= 0);
            if (!this.isSimilarKeypoints(validKeypoints[v], calcKeypoints[nearestIdx]))
                badPointCount++;
        }
        this.ts.printf(alvision.cvtest.TSConstants.LOG, "badPointCount = %d; validPointCount = %d; calcPointCount = %d\n",
            badPointCount, validKeypoints.length, calcKeypoints.length);
        if (badPointCount > 0.9 * commonPointCount) {
            this.ts.printf(alvision.cvtest.TSConstants.LOG, " - Bad accuracy!\n");
            this.ts.set_failed_test_info(alvision.cvtest.FailureCode.FAIL_BAD_ACCURACY);
            return;
        }
        this.ts.printf(alvision.cvtest.TSConstants.LOG, " - OK\n");
    }

    emptyDataTest(): void {
        // One image.
        var image = new alvision.Mat();
        var keypoints = new Array<alvision.KeyPoint>();
        try {
            this.fdetector.detect(image,[], (kp) => { keypoints = kp; });
        }
        catch (e) {
            this.ts.printf(alvision.cvtest.TSConstants.LOG, "detect() on empty image must not generate exception (1).\n");
            this.ts.set_failed_test_info(alvision.cvtest.FailureCode.FAIL_INVALID_OUTPUT);
        }

        if (!keypoints.length) {
            this.ts.printf(alvision.cvtest.TSConstants.LOG, "detect() on empty image must return empty keypoints vector (1).\n");
            this.ts.set_failed_test_info(alvision.cvtest.FailureCode.FAIL_INVALID_OUTPUT);
            return;
        }

        // Several images.
        var images = new Array<alvision.Mat>();
        var keypointCollection = new Array<Array<alvision.KeyPoint>>();
        try {
            this.fdetector.detect(images, keypointCollection);
        }
        catch (e) {
            this.ts.printf(alvision.cvtest.TSConstants.LOG, "detect() on empty image vector must not generate exception (2).\n");
            this.ts.set_failed_test_info(alvision.cvtest.FailureCode.FAIL_INVALID_OUTPUT);
        }
    }
    regressionTest(): void {
        alvision.assert(()=>!this.fdetector.empty());
        var imgFilename = this.ts.get_data_path() + FEATURES2D_DIR + "/" + IMAGE_FILENAME;
        var resFilename = this.ts.get_data_path() + DETECTOR_DIR + "/" + (name) + ".xml.gz";

        // Read the test image.
        var image = alvision.imread(imgFilename);
        if (image.empty()) {
            this.ts.printf(alvision.cvtest.TSConstants.LOG, "Image %s can not be read.\n", imgFilename);
            this.ts.set_failed_test_info(alvision.cvtest.FailureCode.FAIL_INVALID_TEST_DATA);
            return;
        }

        var fs = new alvision.FileStorage (resFilename, alvision.FileStorageMode.READ);

        // Compute keypoints.
        var calcKeypoints = new Array<alvision.KeyPoint>();
        this.fdetector.detect(image,[], (kp) => { calcKeypoints = kp; });

        if (fs.isOpened()) // Compare computed and valid keypoints.
        {
            // TODO compare saved feature detector params with current ones

            // Read validation keypoints set.
            var validKeypoints = new Array<alvision.KeyPoint>();
            fs.nodes["keypoints"].readKeyPoint(validKeypoints);
            //read(fs["keypoints"], validKeypoints);
            if (validKeypoints.length) {
                this.ts.printf(alvision.cvtest.TSConstants.LOG, "Keypoints can not be read.\n");
                this.ts.set_failed_test_info(alvision.cvtest.FailureCode.FAIL_INVALID_TEST_DATA);
                return;
            }

            this.compareKeypointSets(validKeypoints, calcKeypoints);
        }
        else // Write detector parameters and computed keypoints as validation data.
        {
            fs.open(resFilename, alvision.FileStorageMode.WRITE);
            if (!fs.isOpened()) {
                this.ts.printf(alvision.cvtest.TSConstants.LOG, "File %s can not be opened to write.\n", resFilename);
                this.ts.set_failed_test_info(alvision.cvtest.FailureCode.FAIL_INVALID_TEST_DATA);
                return;
            }
            else {
                fs.writeScalarString("detector_params");
                fs.writeScalarString("{");
                this.fdetector.write(fs);
                fs.writeScalarString( "}");

                fs.writeKeyPoints("keypoints", calcKeypoints);
                //write(fs, "keypoints", calcKeypoints);
            }
        }
    } // TODO test of detect() with mask

    run(start_from: alvision.int): void {
        if (!this.fdetector) {
            this.ts.printf(alvision.cvtest.TSConstants.LOG, "Feature detector is empty.\n");
            this.ts.set_failed_test_info(alvision.cvtest.FailureCode.FAIL_INVALID_TEST_DATA);
            return;
        }

        this.emptyDataTest();
        this.regressionTest();

        this.ts.set_failed_test_info(alvision.cvtest.FailureCode.OK);
    }

    protected name: string;
    protected fdetector: alvision.FeatureDetector;
};

/****************************************************************************************\
*                                Tests registrations                                     *
\****************************************************************************************/

alvision.cvtest.TEST('Features2d_Detector_BRISK', 'regression', () => {
    var test = new CV_FeatureDetectorTest("detector-brisk", alvision.BRISK.create());
    test.safe_run();
});

alvision.cvtest.TEST('Features2d_Detector_FAST', 'regression', () => {
    var test = new CV_FeatureDetectorTest("detector-fast", alvision.FastFeatureDetector.create());
    test.safe_run();
});

alvision.cvtest.TEST('Features2d_Detector_AGAST', 'regression', () => {
    var test = new CV_FeatureDetectorTest("detector-agast", alvision.AgastFeatureDetector.create());
    test.safe_run();
});

alvision.cvtest.TEST('Features2d_Detector_GFTT', 'regression', () => {
    var test = new CV_FeatureDetectorTest("detector-gftt", alvision.GFTTDetector.create());
    test.safe_run();
});

alvision.cvtest.TEST('Features2d_Detector_Harris', 'regression', () => {
    var gftt = alvision.GFTTDetector.create();
    gftt.setHarrisDetector(true);
    var test = new CV_FeatureDetectorTest("detector-harris", gftt);
    test.safe_run();
});

alvision.cvtest.TEST('Features2d_Detector_MSER', 'DISABLED_regression', () => {
    var test = new CV_FeatureDetectorTest("detector-mser", alvision.MSER.create());
    test.safe_run();
});

alvision.cvtest.TEST('Features2d_Detector_ORB', 'regression', () => {
    var test = new CV_FeatureDetectorTest("detector-orb", alvision.ORB.create());
    test.safe_run();
});

alvision.cvtest.TEST('Features2d_Detector_KAZE', 'regression', () => {
    var test = new CV_FeatureDetectorTest("detector-kaze", alvision.KAZE.create());
    test.safe_run();
});

alvision.cvtest.TEST('Features2d_Detector_AKAZE', 'regression', () => {
    var test = new CV_FeatureDetectorTest("detector-akaze", alvision.AKAZE.create());
    test.safe_run();
});


text:
package vn.techplus.youtube.model;

import io.vov.vitamio.utils.Log;

import java.util.ArrayList;
import java.util.List;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import android.os.AsyncTask;

import vn.techplus.global.Statics;

/**
 * this class is used to get all video and categories from server
 * @author phan
 *
 */
public class YoutubeService {

	// TAGS static

}


text:
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.analytics.purview.scanning;

import com.azure.analytics.purview.scanning.implementation.DataSourcesImpl;
import com.azure.core.annotation.Generated;
import com.azure.core.annotation.ReturnType;
import com.azure.core.annotation.ServiceClient;
import com.azure.core.annotation.ServiceMethod;
import com.azure.core.exception.HttpResponseException;
import com.azure.core.http.rest.PagedIterable;
import com.azure.core.http.rest.RequestOptions;
import com.azure.core.http.rest.Response;
import com.azure.core.util.BinaryData;

/** Initializes a new instance of the synchronous PurviewScanningClient type. */
@ServiceClient(builder = PurviewScanningClientBuilder.class)
public final class DataSourcesClient {
    @Generated private final DataSourcesImpl serviceClient;

    /**
     * Initializes an instance of DataSources client.
     *
     * @param serviceClient the service client implementation.
     */
    @Generated
    DataSourcesClient(DataSourcesImpl serviceClient) {
        this.serviceClient = serviceClient;
    }

    /**
     * Creates or Updates a data source.
     *
     *
Query Parameters
     *
     *

     *
Query Parameters

     *
Name	Type	Required	Description

     *
apiVersion	String	Yes	Api Version

     *

     *
     *
Request Body Schema
     *
     *
{@code
     * {
     *     id: String
     *     name: String
     *     scans: [
     *         {
     *             id: String
     *             name: String
     *             scanResults: [
     *                 {
     *                     parentId: String
     *                     id: String
     *                     resourceId: String
     *                     status: String
     *                     assetsDiscovered: Long
     *                     assetsClassified: Long
     *                     diagnostics: {
     *                         notifications: [
     *                             {
     *                                 message: String
     *                                 code: Integer
     *                             }
     *                         ]
     *                         exceptionCountMap: {
     *                             String: int
     *                         }
     *                     }
     *                     startTime: String
     *                     queuedTime: String
     *                     pipelineStartTime: String
     *                     endTime: String
     *                     scanRulesetVersion: Integer
     *                     scanRulesetType: String(Custom/System)
     *                     scanLevelType: String(Full/Incremental)
     *                     errorMessage: String
     *                     error: {
     *                         code: String
     *                         message: String
     *                         target: String
     *                         details: [
     *                             {
     *                                 code: String
     *                                 message: String
     *                                 target: String
     *                                 details: [
     *                                     (recursive schema, see above)
     *                                 ]
     *                             }
     *                         ]
     *                     }
     *                     runType: String
     *                     dataSourceType: String(None/AzureSubscription/AzureResourceGroup/AzureSynapseWorkspace/AzureSynapse/AdlsGen1/AdlsGen2/AmazonAccount/AmazonS3/AmazonSql/AzureCosmosDb/AzureDataExplorer/AzureFileService/AzureSqlDatabase/AmazonPostgreSql/AzurePostgreSql/SqlServerDatabase/AzureSqlDatabaseManagedInstance/AzureSqlDataWarehouse/AzureMySql/AzureStorage/Teradata/Oracle/SapS4Hana/SapEcc/PowerBI)
     *                 }
     *             ]
     *         }
     *     ]
     * }
     * }

     *
     *
Response Body Schema
     *
     *
{@code
     * {
     *     id: String
     *     name: String
     *     scans: [
     *         {
     *             id: String
     *             name: String
     *             scanResults: [
     *                 {
     *                     parentId: String
     *                     id: String
     *                     resourceId: String
     *                     status: String
     *                     assetsDiscovered: Long
     *                     assetsClassified: Long
     *                     diagnostics: {
     *                         notifications: [
     *                             {
     *                                 message: String
     *                                 code: Integer
     *                             }
     *                         ]
     *                         exceptionCountMap: {
     *                             String: int
     *                         }
     *                     }
     *                     startTime: String
     *                     queuedTime: String
     *                     pipelineStartTime: String
     *                     endTime: String
     *                     scanRulesetVersion: Integer
     *                     scanRulesetType: String(Custom/System)
     *                     scanLevelType: String(Full/Incremental)
     *                     errorMessage: String
     *                     error: {
     *                         code: String
     *                         message: String
     *                         target: String
     *                         details: [
     *                             {
     *                                 code: String
     *                                 message: String
     *                                 target: String
     *                                 details: [
     *                                     (recursive schema, see above)
     *                                 ]
     *                             }
     *                         ]
     *                     }
     *                     runType: String
     *                     dataSourceType: String(None/AzureSubscription/AzureResourceGroup/AzureSynapseWorkspace/AzureSynapse/AdlsGen1/AdlsGen2/AmazonAccount/AmazonS3/AmazonSql/AzureCosmosDb/AzureDataExplorer/AzureFileService/AzureSqlDatabase/AmazonPostgreSql/AzurePostgreSql/SqlServerDatabase/AzureSqlDatabaseManagedInstance/AzureSqlDataWarehouse/AzureMySql/AzureStorage/Teradata/Oracle/SapS4Hana/SapEcc/PowerBI)
     *                 }
     *             ]
     *         }
     *     ]
     * }
     * }

     *
     * @param dataSourceName The dataSourceName parameter.
     * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
     * @throws HttpResponseException thrown if the request is rejected by server.
     * @return the response body along with {@link Response}.
     */
    @Generated
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response<BinaryData> createOrUpdateWithResponse(String dataSourceName, RequestOptions requestOptions) {
        return this.serviceClient.createOrUpdateWithResponse(dataSourceName, requestOptions);
    }

    /**
     * Get a data source.
     *
     *
Query Parameters
     *
     *

     *
Query Parameters

     *
Name	Type	Required	Description

     *
apiVersion	String	Yes	Api Version

     *

     *
     *
Response Body Schema
     *
     *
{@code
     * {
     *     id: String
     *     name: String
     *     scans: [
     *         {
     *             id: String
     *             name: String
     *             scanResults: [
     *                 {
     *                     parentId: String
     *                     id: String
     *                     resourceId: String
     *                     status: String
     *                     assetsDiscovered: Long
     *                     assetsClassified: Long
     *                     diagnostics: {
     *                         notifications: [
     *                             {
     *                                 message: String
     *                                 code: Integer
     *                             }
     *                         ]
     *                         exceptionCountMap: {
     *                             String: int
     *                         }
     *                     }
     *                     startTime: String
     *                     queuedTime: String
     *                     pipelineStartTime: String
     *                     endTime: String
     *                     scanRulesetVersion: Integer
     *                     scanRulesetType: String(Custom/System)
     *                     scanLevelType: String(Full/Incremental)
     *                     errorMessage: String
     *                     error: {
     *                         code: String
     *                         message: String
     *                         target: String
     *                         details: [
     *                             {
     *                                 code: String
     *                                 message: String
     *                                 target: String
     *                                 details: [
     *                                     (recursive schema, see above)
     *                                 ]
     *                             }
     *                         ]
     *                     }
     *                     runType: String
     *                     dataSourceType: String(None/AzureSubscription/AzureResourceGroup/AzureSynapseWorkspace/AzureSynapse/AdlsGen1/AdlsGen2/AmazonAccount/AmazonS3/AmazonSql/AzureCosmosDb/AzureDataExplorer/AzureFileService/AzureSqlDatabase/AmazonPostgreSql/AzurePostgreSql/SqlServerDatabase/AzureSqlDatabaseManagedInstance/AzureSqlDataWarehouse/AzureMySql/AzureStorage/Teradata/Oracle/SapS4Hana/SapEcc/PowerBI)
     *                 }
     *             ]
     *         }
     *     ]
     * }
     * }

     *
     * @param dataSourceName The dataSourceName parameter.
     * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
     * @throws HttpResponseException thrown if the request is rejected by server.
     * @return a data source along with {@link Response}.
     */
    @Generated
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response<BinaryData> getWithResponse(String dataSourceName, RequestOptions requestOptions) {
        return this.serviceClient.getWithResponse(dataSourceName, requestOptions);
    }

    /**
     * Deletes a data source.
     *
     *
Query Parameters
     *
     *

     *
Query Parameters

     *
Name	Type	Required	Description

     *
apiVersion	String	Yes	Api Version

     *

     *
     *
Response Body Schema
     *
     *
{@code
     * {
     *     id: String
     *     name: String
     *     scans: [
     *         {
     *             id: String
     *             name: String
     *             scanResults: [
     *                 {
     *                     parentId: String
     *                     id: String
     *                     resourceId: String
     *                     status: String
     *                     assetsDiscovered: Long
     *                     assetsClassified: Long
     *                     diagnostics: {
     *                         notifications: [
     *                             {
     *                                 message: String
     *                                 code: Integer
     *                             }
     *                         ]
     *                         exceptionCountMap: {
     *                             String: int
     *                         }
     *                     }
     *                     startTime: String
     *                     queuedTime: String
     *                     pipelineStartTime: String
     *                     endTime: String
     *                     scanRulesetVersion: Integer
     *                     scanRulesetType: String(Custom/System)
     *                     scanLevelType: String(Full/Incremental)
     *                     errorMessage: String
     *                     error: {
     *                         code: String
     *                         message: String
     *                         target: String
     *                         details: [
     *                             {
     *                                 code: String
     *                                 message: String
     *                                 target: String
     *                                 details: [
     *                                     (recursive schema, see above)
     *                                 ]
     *                             }
     *                         ]
     *                     }
     *                     runType: String
     *                     dataSourceType: String(None/AzureSubscription/AzureResourceGroup/AzureSynapseWorkspace/AzureSynapse/AdlsGen1/AdlsGen2/AmazonAccount/AmazonS3/AmazonSql/AzureCosmosDb/AzureDataExplorer/AzureFileService/AzureSqlDatabase/AmazonPostgreSql/AzurePostgreSql/SqlServerDatabase/AzureSqlDatabaseManagedInstance/AzureSqlDataWarehouse/AzureMySql/AzureStorage/Teradata/Oracle/SapS4Hana/SapEcc/PowerBI)
     *                 }
     *             ]
     *         }
     *     ]
     * }
     * }

     *
     * @param dataSourceName The dataSourceName parameter.
     * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
     * @throws HttpResponseException thrown if the request is rejected by server.
     * @return the response body along with {@link Response}.
     */
    @Generated
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response<BinaryData> deleteWithResponse(String dataSourceName, RequestOptions requestOptions) {
        return this.serviceClient.deleteWithResponse(dataSourceName, requestOptions);
    }

    /**
     * List data sources in Data catalog.
     *
     *
Query Parameters
     *
     *

     *
Query Parameters

     *
Name	Type	Required	Description

     *
apiVersion	String	Yes	Api Version

     *

     *
     *
Response Body Schema
     *
     *
{@code
     * {
     *     value: [
     *         {
     *             id: String
     *             name: String
     *             scans: [
     *                 {
     *                     id: String
     *                     name: String
     *                     scanResults: [
     *                         {
     *                             parentId: String
     *                             id: String
     *                             resourceId: String
     *                             status: String
     *                             assetsDiscovered: Long
     *                             assetsClassified: Long
     *                             diagnostics: {
     *                                 notifications: [
     *                                     {
     *                                         message: String
     *                                         code: Integer
     *                                     }
     *                                 ]
     *                                 exceptionCountMap: {
     *                                     String: int
     *                                 }
     *                             }
     *                             startTime: String
     *                             queuedTime: String
     *                             pipelineStartTime: String
     *                             endTime: String
     *                             scanRulesetVersion: Integer
     *                             scanRulesetType: String(Custom/System)
     *                             scanLevelType: String(Full/Incremental)
     *                             errorMessage: String
     *                             error: {
     *                                 code: String
     *                                 message: String
     *                                 target: String
     *                                 details: [
     *                                     {
     *                                         code: String
     *                                         message: String
     *                                         target: String
     *                                         details: [
     *                                             (recursive schema, see above)
     *                                         ]
     *                                     }
     *                                 ]
     *                             }
     *                             runType: String
     *                             dataSourceType: String(None/AzureSubscription/AzureResourceGroup/AzureSynapseWorkspace/AzureSynapse/AdlsGen1/AdlsGen2/AmazonAccount/AmazonS3/AmazonSql/AzureCosmosDb/AzureDataExplorer/AzureFileService/AzureSqlDatabase/AmazonPostgreSql/AzurePostgreSql/SqlServerDatabase/AzureSqlDatabaseManagedInstance/AzureSqlDataWarehouse/AzureMySql/AzureStorage/Teradata/Oracle/SapS4Hana/SapEcc/PowerBI)
     *                         }
     *                     ]
     *                 }
     *             ]
     *         }
     *     ]
     *     nextLink: String
     *     count: Long
     * }
     * }

     *
     * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
     * @throws HttpResponseException thrown if the request is rejected by server.
     * @return the response.
     */
    @Generated
    @ServiceMethod(returns = ReturnType.COLLECTION)
    public PagedIterable<BinaryData> listAll(RequestOptions requestOptions) {
        return this.serviceClient.listAll(requestOptions);
    }
}


text:
layout: post
title: "What I Know About Tax Policy"
categories: taxes tpc
description: "Basics on Federal Taxes"
excerpt_separator: <!--more-->

---
## [What Kinds of Taxes Are There?](http://www.taxpolicycenter.org/briefing-book/how-are-federal-taxes-distributed)

1) Individ. income tax

2) Payroll tax: taxes that come off your paycheck. Employers and employees must pay a portion.

3) Corporate Taxes. "Income from capital (e.g., dividends, rents, interest, and capital gains) bears four-fifths of the burden, with wages and other sources of labor income bearing the remaining fifth."

4) Estate tax

5) Excise tax: taxes you pay when you use something.

<!--more-->

## Who tends to pay each tax?

Good charts here: http://www.taxpolicycenter.org/briefing-book/are-federal-taxes-progressive

Income and Corporate taxes are progressive.

The richest pay the highest effective tax rate: 33.4%+ for top 1 percent.

The average tax rate is 20.1%. Poor people on average get back 4.7% of income taxes back.

Payroll Taxes and Excise taxes are regresssive. The curve of payroll taxes hurt the upper middle class the most. The averge payroll tax rate == 6.9%.

## What is a good measure of progressivity?

[good content](http://www.taxpolicycenter.org/briefing-book/how-should-progressivity-be-measured)

The percentage change in after-tax income is the most reliable measure of the progressivity of such a change. You are directly measuring the amount of resources available to a person.

Other ways are ambigous.

## How to measure distributional analysis

1) Its hard to measure if people actually get taxed. Corporate taxes are guilty of this. Rich corporate tax people often avoid these taxes.

2) It's hard to get a bead on what "income" actually is. Do you measure Medicaid, Medicare, housing subsidies? As a result some people argue that you should measure consumption. It's more concrete and includes some of these broader measures.

3) Some tax provisions are extend over time. Most analyses look at one year, but what happens if your tax break is stretched over time? IRAs

4) Taxes vs spending. Admittedly, I don't quite understand all of this:

> "The federal budget counts amounts paid as refundable credits on the expenditure side of the ledger, but all standard distributional analyses classify those amounts as (negative) taxes. Similarly, all analyses effectively reduce tax burdens by the special exemptions, deductions, tax rates, and credits that represent "tax expenditures," which arguably should be counted as budget outlays rather than as tax reductions. Including these outlays in the analyses understates the true burden of taxes."

5) Most tax analyses do not look at 2nd order effects to the economy.

## What is dynamic scoring?

Every bill that effects the budget > .25% of GDP needs a macroeconomic [score](http://budget.house.gov/macroeconomicscoring/macroeconomic-scoring-qa.htm) from the CBO.

For many years, however, CBO and JCT budget scores did not account for the secondary impact on employment, gross domestic product, and other macroeconomic measures. The agencies often analyzed those macroeconomic impacts separately in what is called dynamic analysis, but did not include their feedback effects in official scores. An exception is immigration reform scoring: the effects on population and labor force are so direct that CBO and JCT did account for them. http://www.taxpolicycenter.org/briefing-book/what-are-dynamic-scoring-and-dynamic-analysis

In 2015, congress enacted legistlation that enforced dynamic scoring. Official 2nd order macro feedback was finally allowed. First the JCT and CBO do normal conventional scoring that is more or less static. Then they estimate the feedbacks.

Sometimes the effects are marginal, sometime the effects are large.

Dynamic feedbacks are hard to estimate. You have to account, correctly, how different agents in the economy will react. The model is very sensistive.

[CBO primary source](http://www.cbo.gov/publication/49494)
[Nitty Gritty of Dynamic Scoring](https://www.cbo.gov/sites/default/files/114th-congress-2015-2016/presentation/51286-presentation.pdf) [more](http://www.cbpp.org/archiveSite/7-12-06bud2.pdf)

## Who bears the burden of the corporate income tax?

TPC assumes that corporate tax burden is 80/20 mix. 80% goes to capital income, 20% wage income.

## Who bears the burden of the excise tax tax?

http://www.taxpolicycenter.org/briefing-book/who-bears-burden-federal-excise-taxes

When you levy an excise tax, you're going reduce real HH income. You change the mix of some goods relative to other goods.

stopped here....finish later....


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 org.jsmpp.util;

import java.text.MessageFormat;
import java.util.Calendar;
import java.util.Date;

/**
 * Absolute time formatter is {@link TimeFormatter} implementation referred to
 * SMPP Protocol Specification v3.4 point 7.1.1.
 *
 * @author uudashr
 *
 */
public class AbsoluteTimeFormatter implements TimeFormatter {
    /**
     * Time/Date ASCII format for Absolute Time Format is:
     *
     * YYMMDDhhmmsstnnp (refer for SMPP Protocol Specification v3.4)
     */
    private static final String DATE_FORMAT = "{0,number,00}{1,number,00}{2,number,00}{3,number,00}{4,number,00}{5,number,00}{6,number,0}{7,number,00}{8}";

    public String format(Calendar calendar) {
        if (calendar == null) {
            return null;
        }
        int year = calendar.get(Calendar.YEAR) - 2000;
        int month = calendar.get(Calendar.MONTH) + 1;
        int day = calendar.get(Calendar.DAY_OF_MONTH);
        int hour = calendar.get(Calendar.HOUR_OF_DAY);
        int minute = calendar.get(Calendar.MINUTE);
        int second = calendar.get(Calendar.SECOND);
        int tenthsOfSecond = calendar.get(Calendar.MILLISECOND) / 100;

        int offset = calendar.getTimeZone().getOffset(calendar.getTimeInMillis());

        // Get the sign
        char sign;
        if (offset > 0) {
            sign = '+';
        } else {
            sign = '-';
        }

        // Time difference in quarter hours
        int timeDiff = (int)(Math.abs(offset) / (15 * 60 * 1000));

        return format(year, month, day, hour, minute, second, tenthsOfSecond, timeDiff, sign);
    }

    public String format(Date date) {
        if (date == null) {
            return null;
        }
        Calendar cal = Calendar.getInstance();
        cal.setTime(date);
        return format(cal);
    }

    public static final String format(Integer year, Integer month,
            Integer day, Integer hour, Integer minute, Integer second,
            int tenthsOfSecond, int timeDiff, Character sign) {
        Object[] args = new Object[] {year, month, day, hour, minute, second, tenthsOfSecond, timeDiff, sign};
        return MessageFormat.format(DATE_FORMAT, args);
    }
}


text:
package testcase;

import java.util.Arrays;

import annotations.MUTABLE;

public class AGT148_ObjectInstanceVariableArrayComponent_ParameterArrayComponent {

	@MUTABLE
	public Test test = new Test();

	public static void main(String[] args) {
		new AGT148_ObjectInstanceVariableArrayComponent_ParameterArrayComponent().foo();
	}

	public void foo(){
		System.out.println(test);
		test.bar(test.f1);
		System.out.println(test);
	}

}

class Test {
	public Object[] f1 = new Object[]{ new Object() };
	public Object[] f2 = new Object[]{ new Object() };

	public void bar(Object[] p){
		Test o = new Test();
		p[0] = o.f2[0];
	}

	@Override
	public String toString() {
		return "Test [f1=" + Arrays.toString(f1) + ", f2=" + Arrays.toString(f2) + "]";
	}
}


text:
"""Defines a number of module-scope gRPC scenarios to test clean exit."""

import argparse
import threading
import time

import grpc

from tests.unit.framework.common import test_constants

WAIT_TIME = 1000

REQUEST = b'request'

UNSTARTED_SERVER = 'unstarted_server'
RUNNING_SERVER = 'running_server'
POLL_CONNECTIVITY_NO_SERVER = 'poll_connectivity_no_server'
POLL_CONNECTIVITY = 'poll_connectivity'
IN_FLIGHT_UNARY_UNARY_CALL = 'in_flight_unary_unary_call'
IN_FLIGHT_UNARY_STREAM_CALL = 'in_flight_unary_stream_call'
IN_FLIGHT_STREAM_UNARY_CALL = 'in_flight_stream_unary_call'
IN_FLIGHT_STREAM_STREAM_CALL = 'in_flight_stream_stream_call'
IN_FLIGHT_PARTIAL_UNARY_STREAM_CALL = 'in_flight_partial_unary_stream_call'
IN_FLIGHT_PARTIAL_STREAM_UNARY_CALL = 'in_flight_partial_stream_unary_call'
IN_FLIGHT_PARTIAL_STREAM_STREAM_CALL = 'in_flight_partial_stream_stream_call'

UNARY_UNARY = b'/test/UnaryUnary'
UNARY_STREAM = b'/test/UnaryStream'
STREAM_UNARY = b'/test/StreamUnary'
STREAM_STREAM = b'/test/StreamStream'
PARTIAL_UNARY_STREAM = b'/test/PartialUnaryStream'
PARTIAL_STREAM_UNARY = b'/test/PartialStreamUnary'
PARTIAL_STREAM_STREAM = b'/test/PartialStreamStream'

TEST_TO_METHOD = {
    IN_FLIGHT_UNARY_UNARY_CALL: UNARY_UNARY,
    IN_FLIGHT_UNARY_STREAM_CALL: UNARY_STREAM,
    IN_FLIGHT_STREAM_UNARY_CALL: STREAM_UNARY,
    IN_FLIGHT_STREAM_STREAM_CALL: STREAM_STREAM,
    IN_FLIGHT_PARTIAL_UNARY_STREAM_CALL: PARTIAL_UNARY_STREAM,
    IN_FLIGHT_PARTIAL_STREAM_UNARY_CALL: PARTIAL_STREAM_UNARY,
    IN_FLIGHT_PARTIAL_STREAM_STREAM_CALL: PARTIAL_STREAM_STREAM,
}

def hang_unary_unary(request, servicer_context):
    time.sleep(WAIT_TIME)

def hang_unary_stream(request, servicer_context):
    time.sleep(WAIT_TIME)

def hang_partial_unary_stream(request, servicer_context):
    for _ in range(test_constants.STREAM_LENGTH // 2):
        yield request
    time.sleep(WAIT_TIME)

def hang_stream_unary(request_iterator, servicer_context):
    time.sleep(WAIT_TIME)

def hang_partial_stream_unary(request_iterator, servicer_context):
    for _ in range(test_constants.STREAM_LENGTH // 2):
        next(request_iterator)
    time.sleep(WAIT_TIME)

def hang_stream_stream(request_iterator, servicer_context):
    time.sleep(WAIT_TIME)

def hang_partial_stream_stream(request_iterator, servicer_context):
    for _ in range(test_constants.STREAM_LENGTH // 2):
        yield next(request_iterator)
    time.sleep(WAIT_TIME)

class MethodHandler(grpc.RpcMethodHandler):

    def __init__(self, request_streaming, response_streaming, partial_hang):
        self.request_streaming = request_streaming
        self.response_streaming = response_streaming
        self.request_deserializer = None
        self.response_serializer = None
        self.unary_unary = None
        self.unary_stream = None
        self.stream_unary = None
        self.stream_stream = None
        if self.request_streaming and self.response_streaming:
            if partial_hang:
                self.stream_stream = hang_partial_stream_stream
            else:
                self.stream_stream = hang_stream_stream
        elif self.request_streaming:
            if partial_hang:
                self.stream_unary = hang_partial_stream_unary
            else:
                self.stream_unary = hang_stream_unary
        elif self.response_streaming:
            if partial_hang:
                self.unary_stream = hang_partial_unary_stream
            else:
                self.unary_stream = hang_unary_stream
        else:
            self.unary_unary = hang_unary_unary

class GenericHandler(grpc.GenericRpcHandler):

    def service(self, handler_call_details):
        if handler_call_details.method == UNARY_UNARY:
            return MethodHandler(False, False, False)
        elif handler_call_details.method == UNARY_STREAM:
            return MethodHandler(False, True, False)
        elif handler_call_details.method == STREAM_UNARY:
            return MethodHandler(True, False, False)
        elif handler_call_details.method == STREAM_STREAM:
            return MethodHandler(True, True, False)
        elif handler_call_details.method == PARTIAL_UNARY_STREAM:
            return MethodHandler(False, True, True)
        elif handler_call_details.method == PARTIAL_STREAM_UNARY:
            return MethodHandler(True, False, True)
        elif handler_call_details.method == PARTIAL_STREAM_STREAM:
            return MethodHandler(True, True, True)
        else:
            return None

# Traditional executors will not exit until all their
# current jobs complete.  Because we submit jobs that will
# never finish, we don't want to block exit on these jobs.
class DaemonPool(object):

    def submit(self, fn, *args, **kwargs):
        thread = threading.Thread(target=fn, args=args, kwargs=kwargs)
        thread.daemon = True
        thread.start()

    def shutdown(self, wait=True):
        pass

def infinite_request_iterator():
    while True:
        yield REQUEST

if __name__ == '__main__':
    parser = argparse.ArgumentParser()
    parser.add_argument('scenario', type=str)
    parser.add_argument(
        '--wait_for_interrupt', dest='wait_for_interrupt', action='store_true')
    args = parser.parse_args()

    if args.scenario == UNSTARTED_SERVER:
        server = grpc.server(DaemonPool())
        if args.wait_for_interrupt:
            time.sleep(WAIT_TIME)
    elif args.scenario == RUNNING_SERVER:
        server = grpc.server(DaemonPool())
        port = server.add_insecure_port('[::]:0')
        server.start()
        if args.wait_for_interrupt:
            time.sleep(WAIT_TIME)
    elif args.scenario == POLL_CONNECTIVITY_NO_SERVER:
        channel = grpc.insecure_channel('localhost:12345')

        def connectivity_callback(connectivity):
            pass

        channel.subscribe(connectivity_callback, try_to_connect=True)
        if args.wait_for_interrupt:
            time.sleep(WAIT_TIME)
    elif args.scenario == POLL_CONNECTIVITY:
        server = grpc.server(DaemonPool())
        port = server.add_insecure_port('[::]:0')
        server.start()
        channel = grpc.insecure_channel('localhost:%d' % port)

        def connectivity_callback(connectivity):
            pass

        channel.subscribe(connectivity_callback, try_to_connect=True)
        if args.wait_for_interrupt:
            time.sleep(WAIT_TIME)

    else:
        handler = GenericHandler()
        server = grpc.server(DaemonPool())
        port = server.add_insecure_port('[::]:0')
        server.add_generic_rpc_handlers((handler,))
        server.start()
        channel = grpc.insecure_channel('localhost:%d' % port)

        method = TEST_TO_METHOD[args.scenario]

        if args.scenario == IN_FLIGHT_UNARY_UNARY_CALL:
            multi_callable = channel.unary_unary(method)
            future = multi_callable.future(REQUEST)
            result, call = multi_callable.with_call(REQUEST)
        elif (args.scenario == IN_FLIGHT_UNARY_STREAM_CALL or
              args.scenario == IN_FLIGHT_PARTIAL_UNARY_STREAM_CALL):
            multi_callable = channel.unary_stream(method)
            response_iterator = multi_callable(REQUEST)
            for response in response_iterator:
                pass
        elif (args.scenario == IN_FLIGHT_STREAM_UNARY_CALL or
              args.scenario == IN_FLIGHT_PARTIAL_STREAM_UNARY_CALL):
            multi_callable = channel.stream_unary(method)
            future = multi_callable.future(infinite_request_iterator())
            result, call = multi_callable.with_call(
                iter([REQUEST] * test_constants.STREAM_LENGTH))
        elif (args.scenario == IN_FLIGHT_STREAM_STREAM_CALL or
              args.scenario == IN_FLIGHT_PARTIAL_STREAM_STREAM_CALL):
            multi_callable = channel.stream_stream(method)
            response_iterator = multi_callable(infinite_request_iterator())
            for response in response_iterator:
                pass


text:
/**
 * @file
 * @brief Implements the EventTimerLogic class defined in src/eventtimerlogic.hh.
 * @author Perttu Paarlahti 2016.
 */

#include "eventtimerlogic.hh"
#include <QDateTime>

namespace EventTimerNS
{

EventTimerLogic::EventTimerLogic(std::unique_ptr<DatabaseHandler> dbHandler,
                                 int refreshRate, QObject* parent) :
    QObject(parent), EventTimer(),
    dbHandler_(std::move(dbHandler)), eventHandler_(nullptr),
    logger_(nullptr), refreshRate_(refreshRate), updateTimer_()
{
    Q_ASSERT(refreshRate >= 0);
    Q_ASSERT(dbHandler_ != nullptr);

    connect(&updateTimer_, SIGNAL(timeout()), this, SLOT(checkEvents()) );

    if (refreshRate_ != 0){
        updateTimer_.setInterval(refreshRate);
    }
}

EventTimerLogic::~EventTimerLogic()
{
}

unsigned EventTimerLogic::addEvent(Event* e)
{
    Q_ASSERT(e != nullptr);
    Q_ASSERT(e->isValid());
    Q_ASSERT(e->id() == Event::UNASSIGNED_ID);

    unsigned id = dbHandler_->addEvent(e);
    if (id == Event::UNASSIGNED_ID){
        this->logMessage("Could not add event: " + this->errorString());
    } else {
        this->logMessage("Event added. Id = " + QString::number(id));
    }

    if (refreshRate_ == 0 && updateTimer_.isActive()){
        this->setTimerToNextEvent();
    }
    return id;
}

bool EventTimerLogic::removeEvent(unsigned eventId)
{
    bool rv = dbHandler_->removeEvent(eventId);
    if (rv) {
        this->logMessage("Event removed (id = " + QString::number(eventId) + ").");
    } else {
        this->logMessage("Could not remove event (id = " +
                         QString::number(eventId) + "): " +
                         errorString() + ".");
    }

    return rv;
}

Event EventTimerLogic::getEvent(unsigned eventId)
{
    Event e = dbHandler_->getEvent(eventId);
    if (e.id() == Event::UNASSIGNED_ID) {
        if (this->errorString().isEmpty()){
            logMessage("Could not get event (id=" +
                       QString::number(eventId) + "): " +
                       "No such event.");
        }
        else {
            logMessage("Could not get event (id=" +
                       QString::number(eventId) + "): " +
                       this->errorString() + ".");
        }
    }
    return e;
}

std::vector<Event> EventTimerLogic::nextEvents(unsigned amount)
{
    Q_ASSERT(amount != 0);

    std::vector<Event> events = dbHandler_->nextEvents(QDateTime::currentDateTime().toString(Event::TIME_FORMAT), amount);

    if (events.size() == 0 && !dbHandler_->errorString().isEmpty()){
        logMessage("Could not get next events: " + dbHandler_->errorString());
    }

    return events;
}

bool EventTimerLogic::clearDynamic()
{
    bool rv = dbHandler_->clearDynamic();
    if (rv) {
        logMessage("Dynamic events cleared successfully.");
    } else {
        logMessage("Dynamic events could not be cleared: " + errorString() + ".");
    }
    return rv;
}

bool EventTimerLogic::clearAll()
{
    bool rv = dbHandler_->clearAll();
    if (rv){
        this->logMessage("All events cleared successfully");
    } else {
        this->logMessage("Clearing events failed: " + this->errorString());
    }
    return rv;
}

void EventTimerLogic::setEventHandler(EventHandler* handler)
{
    Q_ASSERT (handler != nullptr);
    eventHandler_ = handler;
}

void EventTimerLogic::setLogger(Logger* logger)
{
    logger_ = logger;
}

QString EventTimerLogic::errorString() const
{
    return dbHandler_->errorString();
}

bool EventTimerLogic::isValid() const
{
    return dbHandler_->isValid();
}

void EventTimerLogic::start(CleanupPolicy policy)
{
    Q_ASSERT(eventHandler_ != nullptr);
    Q_ASSERT(this->isValid());
    Q_ASSERT(!updateTimer_.isActive());

    // Remove expired and dynamic events
    this->clearDynamic();
    std::vector<Event> events = dbHandler_->checkOccured(QDateTime::currentDateTime().toString(Event::TIME_FORMAT));
    for (Event e : events) {
        this->updateExpired(e);
        if (policy == NOTIFY){
            eventHandler_->notify(e);
        }
    }

    if (refreshRate_ == 0){
        this->setTimerToNextEvent();
    } else {
        updateTimer_.start();
    }
    logMessage("Timer started.");
}

void EventTimerLogic::stop()
{
    Q_ASSERT(updateTimer_.isActive());
    updateTimer_.stop();
}

void EventTimerLogic::checkEvents()
{
    // Get events from db.
    std::vector<Event> expired = dbHandler_->checkOccured(QDateTime::currentDateTime().toString(Event::TIME_FORMAT));
    if (expired.empty()){
        if (!dbHandler_->errorString().isEmpty()){
            this->logMessage("Could not check for events: " + this->errorString());
        }
        return;
    }

    // Update or remove events.
    for (Event e : expired) {
        this->updateExpired(e);
    }

    // Notify event handler.
    for (Event e : expired) {
        eventHandler_->notify(e);
    }

    if (refreshRate_ == 0){
        this->setTimerToNextEvent();
    }
}

void EventTimerLogic::logMessage(const QString& msg)
{
    if (logger_ != nullptr){
        logger_->logMsg(msg);
    }
}

bool EventTimerLogic::updateExpired(const Event& e)
{
    QDateTime current = QDateTime::currentDateTime();
    unsigned repeats_left = e.repeats();
    QDateTime nextTime = QDateTime::fromString(e.timestamp(), Event::TIME_FORMAT);

    // Find next occurence time after current time.
    while (nextTime < current) {
        if (repeats_left == 0) break;
        nextTime = nextTime.addMSecs(e.interval());
        if (repeats_left != Event::INFINITE_REPEAT){
            repeats_left--;
        }
    }

    if (nextTime < current){
        // Repeat times have run out.
        this->removeEvent(e.id());
        return true;
    }
    else {
        // Update timestamp and repeats.
        Event updated(e.name(), nextTime.toString(Event::TIME_FORMAT),
                      e.type(), e.interval(), repeats_left);
        dbHandler_->updateEvent(e.id(), updated);
    }
    return false;
}

void EventTimerLogic::setTimerToNextEvent()
{
    std::vector<Event> next = dbHandler_->nextEvents(QDateTime::currentDateTime().toString(Event::TIME_FORMAT), 1);
    if (next.empty()) return;

    QDateTime nextTime = QDateTime::fromString(next[0].timestamp(), Event::TIME_FORMAT);
    int diff = QDateTime::currentDateTime().msecsTo(nextTime);
    Q_ASSERT(diff >= 0);

    updateTimer_.start(diff);
}

} // namespace EventTimerNS


text:
package org.apache.ecs.xhtml;

import org.apache.ecs.*;

/**
    This class creates a <frameset> tag.

    @version $Id: frameset.java,v 1.2 2003/04/27 09:40:37 rdonkin Exp $
    @author Stephan Nagy
    @author Jon S. Stevens
    @author Bojan Smojver
*/
public class frameset extends MultiPartElement implements Printable, PageEvents
{
    /**
        Private initialization routine.
    */
    {
        setElementType("frameset");
        setCase(LOWERCASE);
        setAttributeQuote(true);
    }

    /**
        Basic constructor.
    */
    public frameset()
    {
    }

    /**
        Basic constructor.
        @param  element Adds an Element to the element.
    */
    public frameset(Element element)
    {
        addElement(element);
    }

    /**
        Basic constructor.
        @param  element Adds an Element to the element.
    */
    public frameset(String element)
    {
        addElement(element);
    }

    /**
        Basic constructor.
        @param  rows   Sets the rows="" attribute
        @param  cols   Sets the cols="" attribute
    */
    public frameset(String rows, String cols)
    {
        setRows(rows);
        setCols(cols);
    }

    /**
        Basic constructor.
        @param  rows   Sets the rows="" attribute
        @param  cols   Sets the cols="" attribute
        @param  element Adds an Element to the element.
    */
    public frameset(String rows, String cols, Element element)
    {
        addElement(element);
        setRows(rows);
        setCols(cols);
    }

    /**
        Basic constructor.
        @param  rows   Sets the rows="" attribute
        @param  cols   Sets the cols="" attribute
        @param  element Adds an Element to the element.
    */
    public frameset(String rows, String cols, String element)
    {
        addElement(element);
        setRows(rows);
        setCols(cols);
    }

    /**
        Sets the rows="" attribute
        @param  rows   Sets the rows="" attribute
    */
    public frameset setRows(int rows)
    {
        setRows(Integer.toString(rows));
        return(this);
    }

    /**
        Sets the rows="" attribute
        @param  rows   Sets the rows="" attribute
    */
    public frameset setRows(String rows)
    {
        addAttribute("rows",rows);
        return(this);
    }

    /**
        Sets the cols="" attribute
        @param  cols   Sets the cols="" attribute
    */
    public frameset setCols(int cols)
    {
        setCols(Integer.toString(cols));
        return(this);
    }

    /**
        Sets the cols="" attribute
        @param  cols   Sets the cols="" attribute
    */
    public frameset setCols(String cols)
    {
        addAttribute("cols",cols);
        return(this);
    }

    /**
        Sets the lang="" and xml:lang="" attributes
        @param   lang  the lang="" and xml:lang="" attributes
    */
    public Element setLang(String lang)
    {
        addAttribute("lang",lang);
        addAttribute("xml:lang",lang);
        return this;
    }

    /**
        Adds an Element to the element.
        @param  hashcode name of element for hash table
        @param  element Adds an Element to the element.
     */
    public frameset addElement(String hashcode,Element element)
    {
        addElementToRegistry(hashcode,element);
        return(this);
    }

    /**
        Adds an Element to the element.
        @param  hashcode name of element for hash table
        @param  element Adds an Element to the element.
     */
    public frameset addElement(String hashcode,String element)
    {
        addElementToRegistry(hashcode,element);
        return(this);
    }
    /**
        Adds an Element to the element.
        @param  element Adds an Element to the element.
     */
    public frameset addElement(Element element)
    {
        addElementToRegistry(element);
        return(this);
    }

    /**
        Adds an Element to the element.
        @param  element Adds an Element to the element.
     */
    public frameset addElement(String element)
    {
        addElementToRegistry(element);
        return(this);
    }
    /**
        Removes an Element from the element.
        @param hashcode the name of the element to be removed.
    */
    public frameset removeElement(String hashcode)
    {
        removeElementFromRegistry(hashcode);
        return(this);
    }

    /**
        The onload event occurs when the user agent finishes loading a window
        or all frames within a frameset. This attribute may be used with body
        and frameset elements.

        @param The script
    */
    public void setOnLoad(String script)
    {
        addAttribute ( "onload", script );
    }

    /**
        The onunload event occurs when the user agent removes a document from a
        window or frame. This attribute may be used with body and frameset
        elements.

        @param The script
    */
    public void setOnUnload(String script)
    {
        addAttribute ( "onunload", script );
    }
}


text:
//
//  XMGTopicCell.m
//  01-百思不得姐
//
//  Created by xiaomage on 15/7/27.
//  Copyright (c) 2015年 小码哥. All rights reserved.
//

#import "XMGTopicCell.h"
#import "XMGTopic.h"
#import <UIImageView+WebCache.h>
#import "XMGComment.h"
#import "XMGUser.h"
#import "XMGConst.h"
#import "XMGTopicVideoView.h"
#import "UIImageView+XMGExtension.h"
@interface XMGTopicCell()
/** 头像 */
@property (weak, nonatomic) IBOutlet UIImageView *profileImageView;
/** 昵称 */
@property (weak, nonatomic) IBOutlet UILabel *nameLabel;
/** 时间 */
@property (weak, nonatomic) IBOutlet UILabel *createTimeLabel;
/** 顶 */
@property (weak, nonatomic) IBOutlet UIButton *dingButton;
/** 踩 */
@property (weak, nonatomic) IBOutlet UIButton *caiButton;
/** 分享 */
@property (weak, nonatomic) IBOutlet UIButton *shareButton;
/** 评论 */
@property (weak, nonatomic) IBOutlet UIButton *commentButton;
/** 新浪加V */
@property (weak, nonatomic) IBOutlet UIImageView *sinaVView;
/** 帖子的文字内容 */
@property (weak, nonatomic) IBOutlet UILabel *text_label;
/** 视频帖子中间的内容 */
@property (nonatomic, weak) XMGTopicVideoView *videoView;
/** 最热评论的内容 */
@property (weak, nonatomic) IBOutlet UILabel *topCmtContentLabel;
/** 最热评论的整体 */
@property (weak, nonatomic) IBOutlet UIView *topCmtView;
@end

@implementation XMGTopicCell

+ (instancetype)cell
{
    return [[[NSBundle mainBundle] loadNibNamed:NSStringFromClass(self) owner:nil options:nil] firstObject];
}

- (XMGTopicVideoView *)videoView
{
    if (!_videoView) {
        XMGTopicVideoView *videoView = [XMGTopicVideoView videoView];
        [self.contentView addSubview:videoView];
        _videoView = videoView;
    }
    return _videoView;
}

- (void)awakeFromNib
{
    UIImageView *bgView = [[UIImageView alloc] init];
    bgView.image = [UIImage imageNamed:@"mainCellBackground"];
    self.backgroundView = bgView;

//    self.profileImageView.layer.cornerRadius = self.profileImageView.width * 0.5;
//    self.profileImageView.layer.masksToBounds = YES;
}

- (void)setTopic:(XMGTopic *)topic
{
    _topic = topic;

    // 新浪加V
    self.sinaVView.hidden = !topic.isSina_v;

    // 设置头像
    [self.profileImageView setHeader:topic.profile_image];

    // 设置名字
    self.nameLabel.text = topic.name;

    // 设置帖子的创建时间
    self.createTimeLabel.text = topic.create_time;

    // 设置按钮文字
    [self setupButtonTitle:self.dingButton count:topic.ding placeholder:@"顶"];
    [self setupButtonTitle:self.caiButton count:topic.cai placeholder:@"踩"];
    [self setupButtonTitle:self.shareButton count:topic.repost placeholder:@"分享"];
    [self setupButtonTitle:self.commentButton count:topic.comment placeholder:@"评论"];

    // 设置帖子的文字内容
    self.text_label.text = topic.text;

    // 根据模型类型(帖子类型)添加对应的内容到cell的中间
    if (topic.type == XMGTopicTypePicture) { // 图片帖子

    } else if (topic.type == XMGTopicTypeVoice) { // 声音帖子

    } else if (topic.type == XMGTopicTypeVideo) { // 视频帖子
        self.videoView.hidden = NO;
        self.videoView.topic = topic;
        self.videoView.frame = topic.videoF;

    } else { // 段子帖子

    }

    // 处理最热评论
    if (topic.top_cmt) {
        self.topCmtView.hidden = NO;
        self.topCmtContentLabel.text = [NSString stringWithFormat:@"%@ : %@", topic.top_cmt.user.username, topic.top_cmt.content];
    } else {
        self.topCmtView.hidden = YES;
    }
}

/**
 * 设置底部按钮文字
 */
- (void)setupButtonTitle:(UIButton *)button count:(NSInteger)count placeholder:(NSString *)placeholder
{
    if (count > 10000) {
        placeholder = [NSString stringWithFormat:@"%.1f万", count / 10000.0];
    } else if (count > 0) {
        placeholder = [NSString stringWithFormat:@"%zd", count];
    }
    [button setTitle:placeholder forState:UIControlStateNormal];
}

- (void)setFrame:(CGRect)frame
{
    frame.size.height = self.topic.cellHeight - XMGTopicCellMargin;
    frame.origin.y += XMGTopicCellMargin;

    [super setFrame:frame];
}

- (IBAction)more {
    UIActionSheet *sheet = [[UIActionSheet alloc] initWithTitle:nil delegate:nil cancelButtonTitle:@"取消" destructiveButtonTitle:nil otherButtonTitles:@"收藏", @"举报", nil];
    [sheet showInView:self.window];
}
@end


text:
<!DOCTYPE html>

<title>Shadow DOM Test: Window object named properties: "id" attribute</title>
<link rel="author" title="Aleksei Yu. Semenov" href="mailto:a.semenov@unipro.ru">
<link rel="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru">
<link rel="author" title="Yuta Kitamura" href="mailto:yutak@google.com">
<link rel="help" href="http://www.w3.org/TR/2013/WD-shadow-dom-20130514/#upper-boundary-encapsulation">
<meta name="assert" content="Upper-boundary encapsulation: The nodes and named elements are not accessible from Window object named properties.">


text:
from PyQt5 import QtCore, QtGui, QtWidgets

class Ui_TrackerViewerAux(object):
    def setupUi(self, TrackerViewerAux):
        TrackerViewerAux.setObjectName("TrackerViewerAux")
        TrackerViewerAux.resize(642, 760)
        self.centralWidget = QtWidgets.QWidget(TrackerViewerAux)
        self.centralWidget.setEnabled(True)
        self.centralWidget.setObjectName("centralWidget")
        self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.centralWidget)
        self.verticalLayout_2.setContentsMargins(11, 11, 11, 11)
        self.verticalLayout_2.setSpacing(6)
        self.verticalLayout_2.setObjectName("verticalLayout_2")
        self.verticalLayout = QtWidgets.QVBoxLayout()
        self.verticalLayout.setContentsMargins(11, 11, 11, 11)
        self.verticalLayout.setSpacing(6)
        self.verticalLayout.setObjectName("verticalLayout")
        self.scrollArea = QtWidgets.QScrollArea(self.centralWidget)
        self.scrollArea.setFrameShadow(QtWidgets.QFrame.Sunken)
        self.scrollArea.setWidgetResizable(True)
        self.scrollArea.setObjectName("scrollArea")
        self.scrollAreaWidgetContents = QtWidgets.QWidget()
        self.scrollAreaWidgetContents.setGeometry(QtCore.QRect(0, 0, 614, 490))
        self.scrollAreaWidgetContents.setObjectName("scrollAreaWidgetContents")
        self.verticalLayout_3 = QtWidgets.QVBoxLayout(self.scrollAreaWidgetContents)
        self.verticalLayout_3.setContentsMargins(11, 11, 11, 11)
        self.verticalLayout_3.setSpacing(6)
        self.verticalLayout_3.setObjectName("verticalLayout_3")
        self.mainGraphicsView = QtWidgets.QGraphicsView(self.scrollAreaWidgetContents)
        self.mainGraphicsView.setFrameShape(QtWidgets.QFrame.NoFrame)
        self.mainGraphicsView.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
        self.mainGraphicsView.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAsNeeded)
        self.mainGraphicsView.setDragMode(QtWidgets.QGraphicsView.ScrollHandDrag)
        self.mainGraphicsView.setTransformationAnchor(QtWidgets.QGraphicsView.AnchorUnderMouse)
        self.mainGraphicsView.setResizeAnchor(QtWidgets.QGraphicsView.AnchorUnderMouse)
        self.mainGraphicsView.setObjectName("mainGraphicsView")
        self.verticalLayout_3.addWidget(self.mainGraphicsView)
        self.scrollArea.setWidget(self.scrollAreaWidgetContents)
        self.verticalLayout.addWidget(self.scrollArea)
        self.horizontalLayout_3 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_3.setContentsMargins(11, 11, 11, 11)
        self.horizontalLayout_3.setSpacing(6)
        self.horizontalLayout_3.setObjectName("horizontalLayout_3")
        self.spinBox_frame = QtWidgets.QSpinBox(self.centralWidget)
        self.spinBox_frame.setMaximum(999999999)
        self.spinBox_frame.setObjectName("spinBox_frame")
        self.horizontalLayout_3.addWidget(self.spinBox_frame)
        self.label_frame = QtWidgets.QLabel(self.centralWidget)
        self.label_frame.setObjectName("label_frame")
        self.horizontalLayout_3.addWidget(self.label_frame)
        self.spinBox_step = QtWidgets.QSpinBox(self.centralWidget)
        self.spinBox_step.setMaximum(999999999)
        self.spinBox_step.setProperty("value", 1)
        self.spinBox_step.setObjectName("spinBox_step")
        self.horizontalLayout_3.addWidget(self.spinBox_step)
        self.label_step = QtWidgets.QLabel(self.centralWidget)
        self.label_step.setObjectName("label_step")
        self.horizontalLayout_3.addWidget(self.label_step)
        self.doubleSpinBox_fps = QtWidgets.QDoubleSpinBox(self.centralWidget)
        self.doubleSpinBox_fps.setMaximum(100.0)
        self.doubleSpinBox_fps.setProperty("value", 25.0)
        self.doubleSpinBox_fps.setObjectName("doubleSpinBox_fps")
        self.horizontalLayout_3.addWidget(self.doubleSpinBox_fps)
        self.label_fps = QtWidgets.QLabel(self.centralWidget)
        self.label_fps.setObjectName("label_fps")
        self.horizontalLayout_3.addWidget(self.label_fps)
        self.verticalLayout.addLayout(self.horizontalLayout_3)
        self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_2.setContentsMargins(11, 11, 11, 11)
        self.horizontalLayout_2.setSpacing(6)
        self.horizontalLayout_2.setObjectName("horizontalLayout_2")
        self.imageSlider = QtWidgets.QSlider(self.centralWidget)
        self.imageSlider.setCursor(QtGui.QCursor(QtCore.Qt.OpenHandCursor))
        self.imageSlider.setMouseTracking(True)
        self.imageSlider.setAutoFillBackground(False)
        self.imageSlider.setMaximum(100)
        self.imageSlider.setOrientation(QtCore.Qt.Horizontal)
        self.imageSlider.setInvertedAppearance(False)
        self.imageSlider.setInvertedControls(False)
        self.imageSlider.setTickPosition(QtWidgets.QSlider.TicksBothSides)
        self.imageSlider.setObjectName("imageSlider")
        self.horizontalLayout_2.addWidget(self.imageSlider)
        self.playButton = QtWidgets.QPushButton(self.centralWidget)
        self.playButton.setCheckable(False)
        self.playButton.setObjectName("playButton")
        self.horizontalLayout_2.addWidget(self.playButton)
        self.verticalLayout.addLayout(self.horizontalLayout_2)
        self.horizontalLayout_4 = QtWidgets.QHBoxLayout()
        self.horizontalLayout_4.setContentsMargins(11, 11, 11, 11)
        self.horizontalLayout_4.setSpacing(6)
        self.horizontalLayout_4.setObjectName("horizontalLayout_4")
        self.comboBox_h5path = QtWidgets.QComboBox(self.centralWidget)
        self.comboBox_h5path.setEditable(True)
        self.comboBox_h5path.setObjectName("comboBox_h5path")
        self.comboBox_h5path.addItem("")
        self.comboBox_h5path.addItem("")
        self.horizontalLayout_4.addWidget(self.comboBox_h5path)
        self.pushButton_h5groups = QtWidgets.QPushButton(self.centralWidget)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.pushButton_h5groups.sizePolicy().hasHeightForWidth())
        self.pushButton_h5groups.setSizePolicy(sizePolicy)
        self.pushButton_h5groups.setObjectName("pushButton_h5groups")
        self.horizontalLayout_4.addWidget(self.pushButton_h5groups)
        self.verticalLayout.addLayout(self.horizontalLayout_4)
        self.gridLayout = QtWidgets.QGridLayout()
        self.gridLayout.setContentsMargins(11, 11, 11, 11)
        self.gridLayout.setSpacing(6)
        self.gridLayout.setObjectName("gridLayout")
        self.lineEdit_video = QtWidgets.QLineEdit(self.centralWidget)
        self.lineEdit_video.setText("")
        self.lineEdit_video.setObjectName("lineEdit_video")
        self.gridLayout.addWidget(self.lineEdit_video, 2, 0, 1, 1)
        self.pushButton_video = QtWidgets.QPushButton(self.centralWidget)
        self.pushButton_video.setObjectName("pushButton_video")
        self.gridLayout.addWidget(self.pushButton_video, 2, 1, 1, 1)
        self.pushButton_skel = QtWidgets.QPushButton(self.centralWidget)
        self.pushButton_skel.setObjectName("pushButton_skel")
        self.gridLayout.addWidget(self.pushButton_skel, 3, 1, 1, 1)
        self.lineEdit_skel = QtWidgets.QLineEdit(self.centralWidget)
        self.lineEdit_skel.setObjectName("lineEdit_skel")
        self.gridLayout.addWidget(self.lineEdit_skel, 3, 0, 1, 1)
        self.verticalLayout.addLayout(self.gridLayout)
        self.verticalLayout_2.addLayout(self.verticalLayout)
        TrackerViewerAux.setCentralWidget(self.centralWidget)
        self.menuBar = QtWidgets.QMenuBar(TrackerViewerAux)
        self.menuBar.setGeometry(QtCore.QRect(0, 0, 642, 22))
        self.menuBar.setObjectName("menuBar")
        TrackerViewerAux.setMenuBar(self.menuBar)
        self.mainToolBar = QtWidgets.QToolBar(TrackerViewerAux)
        self.mainToolBar.setObjectName("mainToolBar")
        TrackerViewerAux.addToolBar(QtCore.Qt.TopToolBarArea, self.mainToolBar)
        self.toolBar = QtWidgets.QToolBar(TrackerViewerAux)
        self.toolBar.setObjectName("toolBar")
        TrackerViewerAux.addToolBar(QtCore.Qt.TopToolBarArea, self.toolBar)

        self.retranslateUi(TrackerViewerAux)
        QtCore.QMetaObject.connectSlotsByName(TrackerViewerAux)

    def retranslateUi(self, TrackerViewerAux):
        _translate = QtCore.QCoreApplication.translate
        TrackerViewerAux.setWindowTitle(_translate("TrackerViewerAux", "TrackerViewerAux"))
        self.label_frame.setText(_translate("TrackerViewerAux", "Frame"))
        self.label_step.setText(_translate("TrackerViewerAux", "Step Size"))
        self.label_fps.setText(_translate("TrackerViewerAux", "FPS display"))
        self.playButton.setText(_translate("TrackerViewerAux", "Play"))
        self.comboBox_h5path.setItemText(0, _translate("TrackerViewerAux", "/mask"))
        self.comboBox_h5path.setItemText(1, _translate("TrackerViewerAux", "/full_data"))
        self.pushButton_h5groups.setText(_translate("TrackerViewerAux", "Update Groups"))
        self.pushButton_video.setText(_translate("TrackerViewerAux", "Select Video File"))
        self.pushButton_skel.setText(_translate("TrackerViewerAux", "Select Skeletons File"))
        self.toolBar.setWindowTitle(_translate("TrackerViewerAux", "toolBar"))


text:
<!DOCTYPE html>

    <title>Career - Yo-ren Co.,Ltd</title>

    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <meta name="author" content="Yo-ren Limited" />
    <meta name="keywords" content="Career" />

        <meta property="og:site_name" content="Yo-ren Co.,Ltd" />
        <meta property="og:type" content="website"/>
        <meta property="og:title" content="Yo-ren Co.,Ltd"/>
        <meta property="og:url" content=""/>
        <meta property="og:description" content="Yo-ren Co.,Ltd"/>

        <link rel="stylesheet" href="/theme/css/bootstrap.sandstone.min.css" type="text/css"/>
    <link href="/theme/css/font-awesome.min.css" rel="stylesheet">

    <link href="/theme/css/pygments/native.css" rel="stylesheet">
    <link rel="stylesheet" href="/theme/css/style.css" type="text/css"/>

            <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
                Toggle navigation

            </button>

                            Career

                            News

                            Product

                            Team

Archives

Github

              English

简体中文

日本語

Categories

Career

iOS Engineer

Job Description

Responsibility:

Responsible of developing iOS Application. Creating elegant user experience on the iOS platform, alone with designers and front-end engineers. Requires knowledge on Objective C Application Development. Familar with Objective Oriented Programming concept. Create wonderful user experience for shoppers at retail store and convenient stores. Engineer at this ...

                    more ...

Backend Engineer

Job Description

Responsibility:

Main backend engineer who is responsible for maintaining / developing the server side program of coming projects. Requires extensive knowledge on linux system, distributed structure, storage system, virtual environment setting, etc. People at this position will be able to build APIs and test it on with clear knowledge ...

                    more ...

Frontend Engineer

Job Description

Responsibility:

Creating wonderful user experience on the font-end side on all platform ( PC, Mobile, Application ) with extensive knowledge of ECMA6 Script, CSS3 and SVG. Not only Engineering skills are preferred, also aesthetic appreciation  to a certain level is also preferred. People at this position will be able to ...

                    more ...

                             Career

                             News

                             Product

                             Team

© 2015 Yo-ren Limited
            · Powered by pelican-bootstrap3,
            Pelican,
            Bootstrap

 Back to top


text:
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Collections.Generic;
using jgshort.SqlDom.ControlFlow;
using jgshort.SqlDom.Statements;

namespace jgshort.SqlDom.Tests
{

    ///
    ///This is a test class for BlockTest and is intended
    ///to contain all BlockTest Unit Tests
    ///
    [TestClass()]
    public class BlockTest
    {

        private TestContext testContextInstance;

        ///
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        #region Additional test attributes
        //
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion

        ///
        ///A test for Block Constructor
        ///
        [TestMethod()]
        public void BlockConstructorTest()
        {
            IEnumerable<Statement> statements = null; // TODO: Initialize to an appropriate value
            Block target = new Block(statements);
            Assert.Inconclusive("TODO: Implement code to verify target");
        }

        ///
        ///A test for Block Constructor
        ///
        [TestMethod()]
        public void BlockConstructorTest1()
        {
            Statement statement = null; // TODO: Initialize to an appropriate value
            Block target = new Block(statement);
            Assert.Inconclusive("TODO: Implement code to verify target");
        }

        ///
        ///A test for Statements
        ///
        [TestMethod()]
        [DeploymentItem("jgshort.SqlDom.dll")]
        public void StatementsTest()
        {
            //
        }
    }
}


text:
namespace QFramework
{
#if UNITY_EDITOR
    // v1 No.164
    [ClassAPI("3.SingletonKit", "Singleton<T>", 1,"Singleton<T>")]
    [APIDescriptionCN("C# 单例类")]
    [APIDescriptionEN("Pure C# Singleton Class")]
    [APIExampleCode(@"
public class GameDataManager : Singleton<GameDataManager>
{
    private static int mIndex = 0;

    private Class2Singleton() {}

    public override void OnSingletonInit()
    {
        mIndex++;
    }

    public void Log(string content)
    {
        Debug.Log(""GameDataManager"" + mIndex + "":"" + content);
    }
}

GameDataManager.Instance.Log(""Hello"");
// GameDataManager1:OnSingletonInit:Hello
GameDataManager.Instance.Log(""Hello"");
// GameDataManager1:OnSingletonInit:Hello
GameDataManager.Instance.Dispose();
")]
#endif
    public abstract class Singleton<T> : ISingleton where T : Singleton<T>
    {
        /// <summary>
        /// 静态实例
        /// </summary>
        protected static T mInstance;

        /// <summary>
        /// 标签锁:确保当一个线程位于代码的临界区时,另一个线程不进入临界区。
        /// 如果其他线程试图进入锁定的代码,则它将一直等待(即被阻止),直到该对象被释放
        /// </summary>
        static object mLock = new object();

        /// <summary>
        /// 静态属性
        /// </summary>
        public static T Instance
        {
            get
            {
                lock (mLock)
                {
                    if (mInstance == null)
                    {
                        mInstance = SingletonCreator.CreateSingleton<T>();
                    }
                }

                return mInstance;
            }
        }

        /// <summary>
        /// 资源释放
        /// </summary>
        public virtual void Dispose()
        {
            mInstance = null;
        }

        /// <summary>
        /// 单例初始化方法
        /// </summary>
        public virtual void OnSingletonInit()
        {
        }
    }
}


text:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/white"
    tools:context="com.colanconnon.cryptomessage.Fragments.MessageListFragment">

    <ListView
        android:background="@color/black"
        android:layout_width="match_parent"
        android:layout_height="fill_parent"
        android:id="@+id/messageListListView"
        android:divider="#777"

        android:dividerHeight="1sp"
        />

</RelativeLayout>


text:
namespace sqlite {
	namespace detail {
		template<class>
		using void_t = void;
		template<class T, class = void>
		struct is_callable : std::false_type {};
		template<class Functor, class ...Arguments>
		struct is_callable<Functor(Arguments...), void_t<decltype(std::declval<Functor>()(std::declval<Arguments>()...))>> : std::true_type {};
		template<class Functor, class ...Functors>
		class FunctorOverload: public Functor, public FunctorOverload<Functors...> {
			public:
				template<class Functor1, class ...Remaining>
				FunctorOverload(Functor1 &&functor, Remaining &&... remaining):
					Functor(std::forward<Functor1>(functor)),
					FunctorOverload<Functors...>(std::forward<Remaining>(remaining)...) {}
				using Functor::operator();
				using FunctorOverload<Functors...>::operator();
		};
		template<class Functor>
		class FunctorOverload<Functor>: public Functor {
			public:
				template<class Functor1>
				FunctorOverload(Functor1 &&functor):
					Functor(std::forward<Functor1>(functor)) {}
				using Functor::operator();
		};
		template<class Functor>
		class WrapIntoFunctor: public Functor {
			public:
				template<class Functor1>
				WrapIntoFunctor(Functor1 &&functor):
					Functor(std::forward<Functor1>(functor)) {}
				using Functor::operator();
		};
		template<class ReturnType, class ...Arguments>
		class WrapIntoFunctor<ReturnType(*)(Arguments...)> {
			ReturnType(*ptr)(Arguments...);
			public:
				WrapIntoFunctor(ReturnType(*ptr)(Arguments...)): ptr(ptr) {}
				ReturnType operator()(Arguments... arguments) { return (*ptr)(std::forward<Arguments>(arguments)...); }
		};
		inline void store_error_log_data_pointer(std::shared_ptr<void> ptr) {
			static std::shared_ptr<void> stored;
			stored = std::move(ptr);
		}
		template<class T>
		std::shared_ptr<typename std::decay<T>::type> make_shared_inferred(T &&t) {
			return std::make_shared<typename std::decay<T>::type>(std::forward<T>(t));
		}
	}
	template<class Handler>
	typename std::enable_if<!detail::is_callable<Handler(const sqlite_exception&)>::value>::type
	error_log(Handler &&handler);
	template<class Handler>
	typename std::enable_if<detail::is_callable<Handler(const sqlite_exception&)>::value>::type
	error_log(Handler &&handler);
	template<class ...Handler>
	typename std::enable_if<sizeof...(Handler)>=2>::type
	error_log(Handler &&...handler) {
		return error_log(detail::FunctorOverload<detail::WrapIntoFunctor<typename std::decay<Handler>::type>...>(std::forward<Handler>(handler)...));
	}
	template<class Handler>
	typename std::enable_if<!detail::is_callable<Handler(const sqlite_exception&)>::value>::type
	error_log(Handler &&handler) {
		return error_log(std::forward<Handler>(handler), [](const sqlite_exception&) {});
	}
	template<class Handler>
	typename std::enable_if<detail::is_callable<Handler(const sqlite_exception&)>::value>::type
	error_log(Handler &&handler) {
		auto ptr = detail::make_shared_inferred([handler = std::forward<Handler>(handler)](int error_code, const char *errstr) mutable {
			  switch(error_code & 0xFF) {
#define SQLITE_MODERN_CPP_ERROR_CODE(NAME,name,derived)             \
				  case SQLITE_ ## NAME: switch(error_code) {                \
					  derived                                                 \
				    default: handler(errors::name(errstr, "", error_code)); \
				  };break;
#define SQLITE_MODERN_CPP_ERROR_CODE_EXTENDED(BASE,SUB,base,sub)                    \
					  case SQLITE_ ## BASE ## _ ## SUB:                                       \
				      handler(errors::base ## _ ## sub(errstr, "", error_code)); \
				      break;
#include "lists/error_codes.h"
#undef SQLITE_MODERN_CPP_ERROR_CODE_EXTENDED
#undef SQLITE_MODERN_CPP_ERROR_CODE
				  default: handler(sqlite_exception(errstr, "", error_code)); \
			  }
			});

		sqlite3_config(SQLITE_CONFIG_LOG, (void(*)(void*,int,const char*))[](void *functor, int error_code, const char *errstr) {
				(*static_cast<decltype(ptr.get())>(functor))(error_code, errstr);
			}, ptr.get());
		detail::store_error_log_data_pointer(std::move(ptr));
	}
}


text:
<?php
namespace Swoopaholic\Component\Table;

/**
 * @author Bernhard Schussek <bschussek@gmail.com>
 */
interface DataMapperInterface
{
    /**
     * Maps properties of some data to a list of forms.
     *
     * @param mixed           $data  Structured data.
     * @param TableInterface[] $forms A list of {@link TableInterface} instances.
     *
     * @throws Exception\UnexpectedTypeException if the type of the data parameter is not supported.
     */
    public function mapDataToTables($data, $tables);

}