text:
//============================================================================
// Name        : KinectTouch.cpp
// Author      : github.com/robbeofficial
// Version     : 0.something
// Description : recognizes touch points on arbitrary surfaces using kinect
// 				 and maps them to TUIO cursors
// 				 (turns any surface into a touchpad)
//============================================================================

/*
 * 1. point your kinect from a higher place down to your table
 * 2. start the program (keep your hands off the table for the beginning)
 * 3. use your table as a giant touchpad
 */

#include <iostream>
#include <vector>
#include <map>
using namespace std;

// openCV
#include <opencv/highgui.h>
#include <opencv/cv.h>
using namespace cv;

#define FREENECT

#ifdef FREENECT
#include "libfreenect.h"
#include <pthread.h>
#else
// openNI
#include <XnOpenNI.h>
#include <XnCppWrapper.h>
using namespace xn;
#define CHECK_RC(rc, what)											\
	if (rc != XN_STATUS_OK)											\
	{																\
		printf("%s failed: %s\n", what, xnGetStatusString(rc));		\
		return rc;													\
	}
#endif

// TUIO
#include "TuioServer.h"
using namespace TUIO;

// TODO smoothing using kalman filter

//---------------------------------------------------------------------------
// Globals
//---------------------------------------------------------------------------

#ifdef FREENECT
int die = 0;
pthread_t freenect_thread;
freenect_context *f_ctx;
freenect_device *f_dev;
ushort depth_mid[640*480], depth_front[640*480];
int got_depth = 0;
pthread_mutex_t gl_backbuf_mutex = PTHREAD_MUTEX_INITIALIZER;
pthread_cond_t gl_frame_cond = PTHREAD_COND_INITIALIZER;

#else
// openNI
xn::Context xnContext;
xn::DepthGenerator xnDepthGenerator;
xn::ImageGenerator xnImgeGenertor;
#endif

bool mousePressed = false;

//---------------------------------------------------------------------------
// Functions
//---------------------------------------------------------------------------

#ifdef FREENECT
void depth_cb(freenect_device *dev, void *v_depth, uint32_t timestamp)
{
	int i;
	pthread_mutex_lock(&gl_backbuf_mutex);
	pthread_cond_init(&gl_frame_cond, NULL);
	ushort *depth = (ushort*)v_depth;

	for (i = 0; i < 640*480; i++) {
		depth_mid[i] = depth[i];
	}
	got_depth++;

	pthread_cond_signal(&gl_frame_cond);
	pthread_mutex_unlock(&gl_backbuf_mutex);
	pthread_cond_init(&gl_frame_cond, NULL);
}

void *freenect_threadfunc(void *arg)
{

	freenect_set_led(f_dev, LED_RED);
	freenect_set_depth_callback(f_dev, depth_cb);
	freenect_set_depth_mode(f_dev, freenect_find_depth_mode(FREENECT_RESOLUTION_MEDIUM, FREENECT_DEPTH_11BIT));
//typedef enum {
//	FREENECT_RESOLUTION_LOW    = 0, /**< QVGA - 320x240 */
//	FREENECT_RESOLUTION_MEDIUM = 1, /**< VGA  - 640x480 */
//	FREENECT_RESOLUTION_HIGH   = 2, /**< SXGA - 1280x1024 */
//	FREENECT_RESOLUTION_DUMMY  = 2147483647, /**< Dummy value to force enum to be 32 bits wide */
//} freenect_resolution;
//typedef enum {
//	FREENECT_DEPTH_11BIT        = 0, /**< 11 bit depth information in one uint16_t/pixel */
//	FREENECT_DEPTH_10BIT        = 1, /**< 10 bit depth information in one uint16_t/pixel */
//	FREENECT_DEPTH_11BIT_PACKED = 2, /**< 11 bit packed depth information */
//	FREENECT_DEPTH_10BIT_PACKED = 3, /**< 10 bit packed depth information */
//	FREENECT_DEPTH_REGISTERED   = 4, /**< processed depth data in mm, aligned to 640x480 RGB */
//	FREENECT_DEPTH_MM           = 5, /**< depth to each pixel in mm, but left unaligned to RGB image */
//	FREENECT_DEPTH_DUMMY        = 2147483647, /**< Dummy value to force enum to be 32 bits wide */
//} freenect_depth_format;

	freenect_start_depth(f_dev);

	printf("\nstarting freenect_threadfunc\n");

	while (die == 0 && freenect_process_events(f_ctx) >= 0) {
		;;
	}

	printf("\nshutting down streams...\n");

	freenect_stop_depth(f_dev);

	freenect_close_device(f_dev);
	freenect_shutdown(f_ctx);

	printf("-- done!\n");
	return NULL;
}

int initKinnect() {

	pthread_mutex_init(&gl_backbuf_mutex, NULL);
	pthread_cond_init(&gl_frame_cond, NULL);

	// setup
	if (freenect_init(&f_ctx, NULL) < 0) {
	  printf("freenect_init() failed\n");
	  return 1;
	}

	freenect_set_log_level(f_ctx, FREENECT_LOG_DEBUG);
	freenect_select_subdevices(f_ctx, (freenect_device_flags)(FREENECT_DEVICE_CAMERA));

	int nr_devices = freenect_num_devices(f_ctx);
	printf ("Number of devices found: %d\n", nr_devices);

	if (nr_devices <= 0) {
	  printf("devices not found\n");
		freenect_shutdown(f_ctx);
		return -1;
	}

	if (freenect_open_device(f_ctx, &f_dev, 0) < 0) {
	  printf("Could not open device\n");
		freenect_shutdown(f_ctx);
		return -1;
	}

	// depth読み取り用のスレッド起動
	int res = pthread_create(&freenect_thread, NULL, freenect_threadfunc, NULL);
	if (res) {
		printf("pthread_create failed\n");
		freenect_close_device(f_dev);
		freenect_shutdown(f_ctx);
		return -1;
	}

	return 0;
}
void updateKinnect() {
	//while (!got_depth) {
	//		pthread_cond_wait(&gl_frame_cond, &gl_backbuf_mutex);
	//}
}
uchar* getKinnectDepthMap() {
	int i;
	pthread_mutex_lock(&gl_backbuf_mutex);
	for (i = 0; i < 640*480; i++) {
		depth_front[i] = depth_mid[i];
	}
	got_depth = 0;
	pthread_mutex_unlock(&gl_backbuf_mutex);

	return (uchar *)depth_front;
}
#else
int initKinnect() {
	const XnChar* fname = "niConfig.xml";
	XnStatus nRetVal = XN_STATUS_OK;

	// initialize context
	nRetVal = xnContext.InitFromXmlFile(fname);
	CHECK_RC(nRetVal, "InitFromXmlFile");

	// initialize depth generator
	nRetVal = xnContext.FindExistingNode(XN_NODE_TYPE_DEPTH, xnDepthGenerator);
	CHECK_RC(nRetVal, "FindExistingNode(XN_NODE_TYPE_DEPTH)");

	// initialize image generator
	nRetVal = xnContext.FindExistingNode(XN_NODE_TYPE_IMAGE, xnImgeGenertor);
	CHECK_RC(nRetVal, "FindExistingNode(XN_NODE_TYPE_IMAGE)");

	return 0;
}
void updateKinnect() {
	xnContext.WaitAndUpdateAll();
}
ushort* getKinnectDepthMap() {
	return (uchar*) xnDepthGenerator.GetDepthMap();
}
#endif

void average(vector<Mat1s>& frames, Mat1s& mean) {
	Mat1d acc(mean.size());
	Mat1d frame(mean.size());

	for (unsigned int i=0; i<frames.size(); i++) {
		frames[i].convertTo(frame, CV_64FC1);
		acc = acc + frame;
	}

	acc = acc / frames.size();

	acc.convertTo(mean, CV_16SC1);
}

int main() {

	const unsigned int nBackgroundTrain = 30;	// サンプリング回数
	int touchDepthMin = 10;	// タッチ判定の最小値(defautl:10)
	int touchDepthMax = 20;	// タッチ判定の最大値(default:20)
	int touchMinArea = 50;		// このエリアよりも輪郭が大きいなら、タッチ箇所とみなす

	const bool localClientMode = false; 		// connect to a local client

	const double debugFrameMaxDepth = 4000;		// maximal distance (in millimeters) for 8 bit debug depth frame quantization. 4000mm === 4m
	const char* windowName = "TouchReader";			// ウィンドウ名
	const Scalar debugColor0(0, 0, 128);		// タッチ近似領域の色:Scalr(Blue, Green, Red) === (0x800000) === red
	const Scalar debugColor1(255, 0, 0);		// ROIを囲む枠線の色
	const Scalar debugColor2(255, 255, 255);	// タッチの色

	const int xMin = 0;
	const int xMax = 640;
	const int yMin = 00;
	const int yMax = 480;

	Mat1s depth(480, 640);		// 16 bit depth (in millimeters) <Mat1s === short>
	Mat1b depth8(480, 640);		// 8 bit depth <Mat1b === uchar>
	//Mat3b rgb(480, 640);		// 8 bit depth <Mat3b === Vec3b<r,g,b>>

	Mat3b debug(480, 640);		// debug visualization

	Mat1s foreground(640, 480);
	Mat1b foreground8(640, 480);

	Mat1b touch(640, 480); // touch mask

	Mat1s background(480, 640);
	vector<Mat1s> buffer(nBackgroundTrain);

	if (initKinnect() != 0) {
		printf("initKinnect Error\n");
		return -1;
	}

	// TUIO server object
	TuioServer* tuio;
	if (localClientMode) {
		printf("connect \"LOCAL\" TuioServer\n");
		tuio = new TuioServer();
	} else {
		printf("connect TuioServer 150.43.77.24:3333\n");
		tuio = new TuioServer("150.43.74.5", 3333, false);			// 安東さん
		//tuio = new TuioServer("150.43.77.24", 3333, false);		// 龍さん
	}
	TuioTime time;

	// create some sliders
	namedWindow(windowName);
/*
	createTrackbar("xMin", windowName, &xMin, 640);
	createTrackbar("xMax", windowName, &xMax, 640);
	createTrackbar("yMin", windowName, &yMin, 480);
	createTrackbar("yMax", windowName, &yMax, 480);
//*/
	createTrackbar("touchDepthMin", windowName, &touchDepthMin, 100);
	createTrackbar("touchDepthMax", windowName, &touchDepthMax, 100);
	createTrackbar("touchMinArea", windowName, &touchMinArea, 100);

	// create background model (average depth)
	for (unsigned int i=0; i<nBackgroundTrain; i++) {
		updateKinnect();
		depth.data = getKinnectDepthMap();
		buffer[i] = depth;
	}
	average(buffer, background);

	while ( waitKey(1) != 27 ) {
		// データ読み取り
		updateKinnect();

		// update 16 bit depth matrix
		depth.data = getKinnectDepthMap();
		//xnImgeGenertor.GetGrayscale8ImageMap()

		// update rgb image
		//rgb.data = (uchar*) xnImgeGenertor.GetRGB24ImageMap(); // segmentation fault here
		//cvtColor(rgb, rgb, CV_RGB2BGR);

		// extract foreground by simple subtraction of very basic background model
		foreground = background - depth;

		// タッチマスク
		// find touch mask by thresholding (points that are close to background = touch points)
		touch = (foreground > touchDepthMin) & (foreground < touchDepthMax);

		// extract ROI
		Rect roi(xMin, yMin, xMax - xMin, yMax - yMin);
		Mat touchRoi = touch(roi);

		// タッチ位置を探す
		vector< vector<Point2i> > contours;
		vector<Point2f> touchPoints;//タッチ位置
		findContours(touchRoi, contours, CV_RETR_LIST, CV_CHAIN_APPROX_SIMPLE, Point2i(xMin, yMin));//輪郭を探しだす by OpenCV
		for (unsigned int i=0; i<contours.size(); i++) {
			Mat contourMat(contours[i]);
			// find touch points by area thresholding
			if ( contourArea(contourMat) > touchMinArea ) {	// 小さすぎる点はタッチと見なさない
				Scalar center = mean(contourMat);
				Point2i touchPoint(center[0], center[1]);
				touchPoints.push_back(touchPoint);
			}
		}

		// send TUIO cursors
		time = TuioTime::getSessionTime();
		tuio->initFrame(time);

		for (unsigned int i = 0; i < touchPoints.size(); i++) { // touch points
				//float cursorX2 = (touchPoints[i].x - xMin) / (xMax - xMin);
				float cursorX = 1- (touchPoints[i].x - xMin) / (xMax - xMin);
				//float cursorY2 = 1 - (touchPoints[i].y - yMin)/(yMax - yMin);
				float cursorY = (touchPoints[i].y - yMin)/(yMax - yMin);
				cursorY = 1 - (touchPoints[i].y - yMin)/(yMax - yMin);//安東さん用
				TuioCursor* cursor = tuio->getClosestTuioCursor(cursorX,cursorY);
				// TODO improve tracking (don't move cursors away, that might be closer to another touch point)
				if (cursor == NULL || cursor->getTuioTime() == time) {
					tuio->addTuioCursor(cursorX, cursorY);
					//printf("addTuioCursor TuioServer(%f, %f)\n", cursorX, cursorY);
					//printf("addTuioCursor TuioServer(%f, %f)2\n", cursorX, cursorY2);
				} else {
					tuio->updateTuioCursor(cursor, cursorX, cursorY);
					//printf("updateTuioCursor TuioServer(%f, %f)\n", cursorX, cursorY);
					//printf("updateTuioCursor TuioServer(%f, %f)2\n", cursorX, cursorY2);
				}
		}

		tuio->stopUntouchedMovingCursors();
		tuio->removeUntouchedStoppedCursors();
		tuio->commitFrame();

		//--------------------
		// draw debug frame
		//--------------------
		// render depth to debug frame
		depth.convertTo(depth8, CV_8U, 255 / debugFrameMaxDepth);
		cvtColor(/* in */depth8, /* out*/debug, /* 変換方法 */CV_GRAY2BGR);

		// ヒートマップの描画
		debug.setTo(debugColor0, touch);  // touch mask
		//rectangle(debug, roi, debugColor1, 2); // surface boundaries

		// タッチ位置の描画
		for (unsigned int i = 0; i < touchPoints.size(); i++) { // touch points
			circle(debug, touchPoints[i], 5, debugColor2, CV_FILLED);
		}

		// render debug frame (with sliders)
		imshow(windowName, debug);
		//imshow("image", rgb);
	}
	die++;
	sleep(1);

	printf("main thread finished.\n");
	printf("\ttouchDepthMin = %d\n", touchDepthMin);
	printf("\ttouchDepthMax = %d\n", touchDepthMax);
	printf("\ttouchMinArea = %d\n", touchMinArea);

	return 0;
}


text:
package com.amazonaws.services.elasticache.model;

import javax.annotation.Generated;

/**
 * <p>
 * The specified replication group does not exist.
 * </p>
 */
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class ReplicationGroupNotFoundException extends com.amazonaws.services.elasticache.model.AmazonElastiCacheException {
    private static final long serialVersionUID = 1L;

    /**
     * Constructs a new ReplicationGroupNotFoundException with the specified error message.
     *
     * @param message
     *        Describes the error encountered.
     */
    public ReplicationGroupNotFoundException(String message) {
        super(message);
    }

}

redpajama_set_name: RedPajamaGithub


text:
import {ChangeDetectionStrategy, ChangeDetectorRef, Component, ContentChild, ContentChildren, Directive, HostBinding, HostListener, Injectable, Input, NgModule, OnDestroy, Optional, Pipe, PipeTransform, QueryList, SimpleChanges, TemplateRef, ViewChild, ViewChildren, ViewContainerRef} from '../../../src/core';
import * as $r3$ from '../../../src/core_render3_private_export';
import {ComponentDefInternal} from '../../../src/render3/interfaces/definition';
import {containerEl, renderComponent, toHtml} from '../render_util';

/// See: `normative.md`
describe('pipes', () => {
  type $any$ = any;
  type $RenderFlags$ = $r3$.ɵRenderFlags;

  let myPipeTransformCalls = 0;
  let myPurePipeTransformCalls = 0;

  @Pipe({
    name: 'myPipe',
    pure: false,
  })
  class MyPipe implements PipeTransform,
      OnDestroy {
    private numberOfBang = 1;

    transform(value: string, size: number): string {
      let result = value.substring(size);
      for (let i = 0; i < this.numberOfBang; i++) result += '!';
      this.numberOfBang++;
      myPipeTransformCalls++;
      return result;
    }

    ngOnDestroy() { this.numberOfBang = 1; }

    // NORMATIVE
    static ngPipeDef = $r3$.ɵdefinePipe({
      name: 'myPipe',
      type: MyPipe,
      factory: function MyPipe_Factory() { return new MyPipe(); },
      pure: false,
    });
    // /NORMATIVE
  }

  @Pipe({
    name: 'myPurePipe',
    pure: true,
  })
  class MyPurePipe implements PipeTransform {
    transform(value: string, size: number): string {
      myPurePipeTransformCalls++;
      return value.substring(size);
    }

    // NORMATIVE
    static ngPipeDef = $r3$.ɵdefinePipe({
      name: 'myPurePipe',
      type: MyPurePipe,
      factory: function MyPurePipe_Factory() { return new MyPurePipe(); },
      pure: true,
    });
    // /NORMATIVE
  }

  it('should render pipes', () => {
    type $MyApp$ = MyApp;
    myPipeTransformCalls = 0;
    myPurePipeTransformCalls = 0;

    @Component({template: `{{name | myPipe:size | myPurePipe:size }}`})
    class MyApp {
      name = '12World';
      size = 1;

      // NORMATIVE
      static ngComponentDef = $r3$.ɵdefineComponent({
        type: MyApp,
        selectors: [['my-app']],
        factory: function MyApp_Factory() { return new MyApp(); },
        template: function MyApp_Template(rf: $RenderFlags$, ctx: $MyApp$) {
          if (rf & 1) {
            $r3$.ɵT(0);
            $r3$.ɵPp(1, 'myPipe');
            $r3$.ɵPp(2, 'myPurePipe');
            $r3$.ɵrS(6);
          }
          if (rf & 2) {
            $r3$.ɵt(
                0,
                $r3$.ɵi1('', $r3$.ɵpb2(1, 6, $r3$.ɵpb2(2, 3, ctx.name, ctx.size), ctx.size), ''));
          }
        }
      });
      // /NORMATIVE
    }

    // NON-NORMATIVE
    (MyApp.ngComponentDef as ComponentDefInternal<any>).pipeDefs =
        () => [MyPurePipe.ngPipeDef, MyPipe.ngPipeDef];
    // /NON-NORMATIVE

    let myApp: MyApp = renderComponent(MyApp);
    expect(toHtml(containerEl)).toEqual('World!');
    expect(myPurePipeTransformCalls).toEqual(1);
    expect(myPipeTransformCalls).toEqual(1);

    $r3$.ɵdetectChanges(myApp);
    expect(toHtml(containerEl)).toEqual('World!!');
    expect(myPurePipeTransformCalls).toEqual(1);
    expect(myPipeTransformCalls).toEqual(2);

    myApp.name = '34WORLD';
    $r3$.ɵdetectChanges(myApp);
    expect(toHtml(containerEl)).toEqual('WORLD!!!');
    expect(myPurePipeTransformCalls).toEqual(2);
    expect(myPipeTransformCalls).toEqual(3);
  });

  it('should render many pipes and forward the first instance (pure or impure pipe)', () => {
    type $MyApp$ = MyApp;
    myPipeTransformCalls = 0;
    myPurePipeTransformCalls = 0;

    @Directive({
      selector: '[oneTimeIf]',
    })
    class OneTimeIf {
      @Input() oneTimeIf: any;
      constructor(private view: ViewContainerRef, private template: TemplateRef<any>) {}
      ngDoCheck(): void {
        if (this.oneTimeIf) {
          this.view.createEmbeddedView(this.template);
        }
      }
      // NORMATIVE
      static ngDirectiveDef = $r3$.ɵdefineDirective({
        type: OneTimeIf,
        selectors: [['', 'oneTimeIf', '']],
        factory: () => new OneTimeIf($r3$.ɵinjectViewContainerRef(), $r3$.ɵinjectTemplateRef()),
        inputs: {oneTimeIf: 'oneTimeIf'}
      });
      // /NORMATIVE
    }

    @Component({
      template: `{{name | myPurePipe:size}}{{name | myPurePipe:size}}

{{name | myPurePipe:size}}
`
    })
    class MyApp {
      name = '1World';
      size = 1;
      more = true;

      // NORMATIVE
      static ngComponentDef = $r3$.ɵdefineComponent({
        type: MyApp,
        selectors: [['my-app']],
        factory: function MyApp_Factory() { return new MyApp(); },
        template: function MyApp_Template(rf: $RenderFlags$, ctx: $MyApp$) {
          if (rf & 1) {
            $r3$.ɵT(0);
            $r3$.ɵPp(1, 'myPurePipe');
            $r3$.ɵT(2);
            $r3$.ɵPp(3, 'myPurePipe');
            $r3$.ɵC(4, C4, '', ['oneTimeIf', '']);
            $r3$.ɵrS(6);
          }
          if (rf & 2) {
            $r3$.ɵt(0, $r3$.ɵi1('', $r3$.ɵpb2(1, 3, ctx.name, ctx.size), ''));
            $r3$.ɵt(2, $r3$.ɵi1('', $r3$.ɵpb2(3, 6, ctx.name, ctx.size), ''));
            $r3$.ɵp(4, 'oneTimeIf', $r3$.ɵb(ctx.more));
            $r3$.ɵcR(4);
            $r3$.ɵcr();
          }

          function C4(rf: $RenderFlags$, ctx1: $any$) {
            if (rf & 1) {
              $r3$.ɵE(0, 'div');
              $r3$.ɵT(1);
              $r3$.ɵPp(2, 'myPurePipe');
              $r3$.ɵe();
              $r3$.ɵrS(3);
            }
            if (rf & 2) {
              $r3$.ɵt(1, $r3$.ɵi1('', $r3$.ɵpb2(2, 3, ctx.name, ctx.size), ''));
            }
          }
        }
      });
      // /NORMATIVE
    }

    // NON-NORMATIVE
    (MyApp.ngComponentDef as ComponentDefInternal<any>).directiveDefs = [OneTimeIf.ngDirectiveDef];
    (MyApp.ngComponentDef as ComponentDefInternal<any>).pipeDefs = [MyPurePipe.ngPipeDef];
    // /NON-NORMATIVE

    let myApp: MyApp = renderComponent(MyApp);
    expect(toHtml(containerEl)).toEqual('WorldWorld
World
');
    expect(myPurePipeTransformCalls).toEqual(3);
    expect(myPipeTransformCalls).toEqual(0);
  });
});


text:
layout: category
section-type: category
title: MGMT
---
## Category


text:
mapOf
=====

Usage: ```mapOf(kpred, vpred, opts)```

Returns a spec for a map whose keys satisfy kpred and vals satisfy vpred.

[Source](https://github.com/mrijk/speculaas/blob/master/lib/mapOf.js)

Example:

```js
const s = require('speculaas');
const {isInteger, isString} = s.utils;

s.def('::scores', s.mapOf(isString, isInteger));

s.isValid('::scores', {'Sally': 1000, 'Joe': 500});
// true

s.isValid('::scores', {'Sally': 1000, 'Joe': '500'});
// false
```


text:
BOT_NAME = 'faperj'

SPIDER_MODULES = ['faperj.spiders']
NEWSPIDER_MODULE = 'faperj.spiders'

ITEM_PIPELINES = {
    'faperj.pipelines.DuplicatesPipeline': 300
}
# Crawl responsibly by identifying yourself (and your website) on the user-agent
#USER_AGENT = 'faperj (+http://www.yourdomain.com)'


text:
/*
 * This file is generated by jOOQ.
*/
package com.nerv.server.database.gen.jooq.tables.records;

import com.nerv.server.database.gen.jooq.tables.AlarmUser;

import java.sql.Timestamp;

import javax.annotation.Generated;

import org.jooq.Field;
import org.jooq.Record2;
import org.jooq.Record4;
import org.jooq.Row4;
import org.jooq.impl.UpdatableRecordImpl;

/**
 * This class is generated by jOOQ.
 */
@Generated(
    value = {
        "http://www.jooq.org",
        "jOOQ version:3.10.3"
    },
    comments = "This class is generated by jOOQ"
)
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
public class AlarmUserRecord extends UpdatableRecordImpl<AlarmUserRecord> implements Record4<Integer, Integer, String, Timestamp> {

    private static final long serialVersionUID = -1973734920;

    /**
     * Setter for public.alarm_user.id.
     */
    public void setId(Integer value) {
        set(0, value);
    }

    /**
     * Getter for public.alarm_user.id.
     */
    public Integer getId() {
        return (Integer) get(0);
    }

    /**
     * Setter for public.alarm_user.id_panel.
     */
    public void setIdPanel(Integer value) {
        set(1, value);
    }

    /**
     * Getter for public.alarm_user.id_panel.
     */
    public Integer getIdPanel() {
        return (Integer) get(1);
    }

    /**
     * Setter for public.alarm_user.user_name.
     */
    public void setUserName(String value) {
        set(2, value);
    }

    /**
     * Getter for public.alarm_user.user_name.
     */
    public String getUserName() {
        return (String) get(2);
    }

    /**
     * Setter for public.alarm_user.last_seen.
     */
    public void setLastSeen(Timestamp value) {
        set(3, value);
    }

    /**
     * Getter for public.alarm_user.last_seen.
     */
    public Timestamp getLastSeen() {
        return (Timestamp) get(3);
    }

    // -------------------------------------------------------------------------
    // Primary key information
    // -------------------------------------------------------------------------

    /**
     * {@inheritDoc}
     */
    @Override
    public Record2<Integer, Integer> key() {
        return (Record2) super.key();
    }

    // -------------------------------------------------------------------------
    // Record4 type implementation
    // -------------------------------------------------------------------------

    /**
     * {@inheritDoc}
     */
    @Override
    public Row4<Integer, Integer, String, Timestamp> fieldsRow() {
        return (Row4) super.fieldsRow();
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public Row4<Integer, Integer, String, Timestamp> valuesRow() {
        return (Row4) super.valuesRow();
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public Field<Integer> field1() {
        return AlarmUser.ALARM_USER.ID;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public Field<Integer> field2() {
        return AlarmUser.ALARM_USER.ID_PANEL;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public Field<String> field3() {
        return AlarmUser.ALARM_USER.USER_NAME;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public Field<Timestamp> field4() {
        return AlarmUser.ALARM_USER.LAST_SEEN;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public Integer component1() {
        return getId();
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public Integer component2() {
        return getIdPanel();
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public String component3() {
        return getUserName();
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public Timestamp component4() {
        return getLastSeen();
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public Integer value1() {
        return getId();
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public Integer value2() {
        return getIdPanel();
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public String value3() {
        return getUserName();
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public Timestamp value4() {
        return getLastSeen();
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public AlarmUserRecord value1(Integer value) {
        setId(value);
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public AlarmUserRecord value2(Integer value) {
        setIdPanel(value);
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public AlarmUserRecord value3(String value) {
        setUserName(value);
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public AlarmUserRecord value4(Timestamp value) {
        setLastSeen(value);
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public AlarmUserRecord values(Integer value1, Integer value2, String value3, Timestamp value4) {
        value1(value1);
        value2(value2);
        value3(value3);
        value4(value4);
        return this;
    }

    // -------------------------------------------------------------------------
    // Constructors
    // -------------------------------------------------------------------------

    /**
     * Create a detached AlarmUserRecord
     */
    public AlarmUserRecord() {
        super(AlarmUser.ALARM_USER);
    }

    /**
     * Create a detached, initialised AlarmUserRecord
     */
    public AlarmUserRecord(Integer id, Integer idPanel, String userName, Timestamp lastSeen) {
        super(AlarmUser.ALARM_USER);

        set(0, id);
        set(1, idPanel);
        set(2, userName);
        set(3, lastSeen);
    }
}


text:
"""Tests for context_managers module."""

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

from tensorflow.contrib.py2tf.utils import context_managers
from tensorflow.python.framework import constant_op
from tensorflow.python.platform import test

class ContextManagersTest(test.TestCase):

  def test_control_dependency_on_returns(self):
    # Just dry run them.
    with context_managers.control_dependency_on_returns(None):
      pass
    with context_managers.control_dependency_on_returns(
        constant_op.constant(1)):
      pass
    with context_managers.control_dependency_on_returns(
        [constant_op.constant(1),
         constant_op.constant(2)]):
      pass

if __name__ == '__main__':
  test.main()


text:
			Posted on

			by


text:
package org.frikadelki.ash.telegram.api.chat;

import lombok.experimental.UtilityClass;

@UtilityClass
public final class TgmChatTestData {
	public static TgmChat any() {
		return TgmChat.builder()
				.id(1)
				.type(TgmChat.Type.PRIVATE)
				.build();
	}
}


text:
<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:orientation="vertical"
              android:background="#ffffff"
              android:layout_width="match_parent"
              android:layout_height="match_parent">

    <com.appcutt.demo.widget.AdvertiseViewPager
            android:id="@+id/adviewpager"
            android:layout_width="match_parent"
            android:layout_height="160dp"/>

    <TextView
            android:background="#eeeeee"
            android:layout_width="match_parent"
            android:layout_height="16dp"/>

</LinearLayout>


text:
Veera's Soul Portraits
=========================

My personal website modified from Jekyll theme based on [Grayscale bootstrap theme ](http://ironsummitmedia.github.io/startbootstrap-grayscale/)

For more details, read the [documentation](http://jekyllrb.com/)


text:
<?php

namespace Admin\PageBundle\Controller;

use Symfony\Component\HttpFoundation\Request;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;

use Admin\PageBundle\Entity\Page;
use Admin\PageBundle\Form\PageType;
use Admin\PageBundle\Helpers\Tree\Page\AdminPageTree;

/**
 * Page controller.
 *
 */
class PageController extends Controller
{

    /**
     * Lists all Page entities.
     *
     */
    public function indexAction()
    {

        $em = $this->getDoctrine()->getManager();

        $entities = $em->getRepository('PageBundle:Page')->findAll();
//        $dql   = "SELECT a FROM PageBundle:Page a";
//        $query = $em->createQuery($dql);

        $paginator  = $this->get('knp_paginator');
        $pagination = $paginator->paginate(
         $entities,
        $this->get('request')->query->get('page', 1)/*page number*/,
        5/*limit per page*/
        );
        return $this->render('PageBundle:Page:index.html.twig', array(
            'entities' => $pagination,
        ));
    }
    /**
     * Creates a new Page entity.
     *
     */
    public function createAction(Request $request)
    {
        $entity  = new Page();
        $form = $this->createForm( new PageType(), $entity );
        $pagetype = $request->request->get('admin_pagebundle_pagetype');
        $iscombo =  $pagetype['pageType'] == 'combo' ? true : false;
        $par = $request->request->get('page-widget');

        if ($iscombo && is_array($par)){
            $par = serialize($par);
            $pagetype['widget'] = $par;
        }

        $request->request->set('admin_pagebundle_pagetype',$pagetype);

        $form->submit($request);

        $em = $this->getDoctrine()->getManager();
        $pages = $em->getRepository('PageBundle:Page')->findAll();

        $tree = new AdminPageTree();
        $pageTree = $tree->createTree( $pages );

        if ($form->isValid()) {
            $entity->setUserId( $this->get('security.context')->getToken()->getUser()->getId() );
            $em->persist($entity);
            $em->flush();

            return $this->redirect($this->generateUrl('page', array('id' => $entity->getId())));
        }

        return $this->render('PageBundle:Page:new.html.twig', array(
            'entity' => $entity,
            'form'   => $form->createView(),
            'pageTree' => $pageTree
        ));
    }

    /**
     * Displays a form to create a new Page entity.
     *
     */
    public function newAction()
    {
        $em = $this->getDoctrine()->getManager();
        $entity = new Page();
        $entity->setUserId( $this->get('security.context')->getToken()->getUser()->getId() );
        $categories = $em->getRepository('CategoryBundle:Category')->findAll();
        $browse_path = $this->generateUrl('elfinder');

        $pages = $em->getRepository('PageBundle:Page')->findAll();

        $tree = new AdminPageTree();
        $pageTree = $tree->createTree( $pages );

        $pagesForm = array();

        foreach($pages as $p) {
            $pagesForm[$p->getId()] = $p->getTitle();
        }

        $form   = $this->createForm(new PageType($browse_path), $entity);

        return $this->render('PageBundle:Page:new.html.twig', array(
            'entity'    => $entity,
            'categories' => $categories,
            'form'      => $form->createView(),
            'pageTree' => $pageTree
        ));
    }

    /**
     * Finds and displays a Page  entity.
     *
     */
    public function showAction($id)
    {
        $em = $this->getDoctrine()->getManager();

        $entity = $em->getRepository('PageBundle:Page')->find($id);

        if (!$entity) {
            throw $this->createNotFoundException('Unable to find Page entity.');
        }

        $deleteForm = $this->createDeleteForm($id);

        return $this->render('PageBundle:Page:show.html.twig', array(
            'entity'      => $entity,
            'delete_form' => $deleteForm->createView(),        ));
    }

    /**
     * Displays a form to edit an existing Page entity.
     *
     */
    public function editAction($id, $locale)
    {
        $em = $this->getDoctrine()->getManager();

        $entity = $em->getRepository('PageBundle:Page')->find($id);
        $categories = $em->getRepository('CategoryBundle:Category')->findAll();
        $entity->setTranslatableLocale($locale);
        $em->refresh($entity);
        $page_widget = array('cat'=> 0,'posts'=> 5,'orderby'=>'asc');

            $setwidget = $entity->getWidget();

            if ($setwidget){
                $setwidget = @unserialize($setwidget);

             }

        is_array($setwidget)? $entity->setWidget($setwidget) : $entity->setWidget($page_widget);

        if (!$entity) {
            throw $this->createNotFoundException('Unable to find Page entity.');
        }

        $pages = $em->getRepository('PageBundle:Page')->findAll();
        $tree = new AdminPageTree();
        $pageTree = $tree->createTree( $pages );
        $browse_path = $this->generateUrl('elfinder');
        $editForm = $this->createForm(new PageType($browse_path), $entity);
        $deleteForm = $this->createDeleteForm($id);

        return $this->render('PageBundle:Page:edit.html.twig', array(
            'entity'      => $entity,
            'categories' => $categories,
            'edit_form'   => $editForm->createView(),
            'delete_form' => $deleteForm->createView(),
            'pageTree' => $pageTree
        ));
    }

    /**
     * Edits an existing Page entity.
     *
     */
    public function updateAction(Request $request, $id, $locale)
    {

        $em = $this->getDoctrine()->getManager();

        $entity = $em->getRepository('PageBundle:Page')->find($id);
        $entity->setTranslatableLocale($locale);

        if (!$entity) {
            throw $this->createNotFoundException('Unable to find Page entity.');
        }

        $pages = $em->getRepository('PageBundle:Page')->findAll();
        $tree = new AdminPageTree();
        $pageTree = $tree->createTree( $pages );

        $deleteForm = $this->createDeleteForm($id);
        $editForm = $this->createForm(new PageType(), $entity);
        $page_type = $request->request->get('admin_pagebundle_pagetype');
        if($page_type['pageType'] != 'combo'){
            $page_type['widget'] = null;
        }
        else{
            $par = $request->request->get('page-widget');
            if (is_array($par)){
                $par = serialize($par);

            }
            $page_type['widget'] = $par;
        }
        $request->request->set('admin_pagebundle_pagetype',$page_type);
        $editForm->submit($request);

        if ($editForm->isValid()) {
            $entity->setUserId( $this->get('security.context')->getToken()->getUser()->getId() );
            $em->persist($entity);
            $em->flush();

            return $this->redirect($this->generateUrl('page_edit', array('id' => $id, 'locale'=> $locale)));
        }

        return $this->render('PageBundle:Page:edit.html.twig', array(
            'entity'      => $entity,
            'edit_form'   => $editForm->createView(),
            'delete_form' => $deleteForm->createView(),
            'pageTree' => $pageTree
        ));
    }
    /**
     * Deletes a Page entity.
     *
     */
    public function deleteAction(Request $request, $id)
    {
        $form = $this->createDeleteForm($id);
        $form->submit($request);

        if ($form->isValid()) {
            $em = $this->getDoctrine()->getManager();
            $repositoryPage = $em->getRepository('PageBundle:Page');
            $entity = $repositoryPage->find($id);

            if (!$entity) {
                throw $this->createNotFoundException('Unable to find Page entity.');
            }

            $this->_checkChildresn( $entity, $repositoryPage )
                 ->_deleteNavMenu( $entity );

            $em->remove($entity);
            $em->flush();
        }

        return $this->redirect($this->generateUrl('page'));
    }

    private function _checkChildresn( $entity, $repositoryPage ) {

        $pages = $repositoryPage->findBy( array( 'parentId' => $entity->getId() ) );

        $message = "";

        if( $pages ) {
            $message = "Ne možete obrisati ovu stranu jer ona roditelje drugim stranama. Prvo obrišite strane ili im promenite roditelja:  ";
            foreach($pages as $p) {
                $message .= $p->getName() . ', ' ;
            }

            throw $this->createNotFoundException( $message );
        }

        return $this;
    }

    private function _deleteNavMenu( $page ) {

        $em = $this->getDoctrine()->getManager();

        $nav = $em->getRepository('NavMenuBundle:NavMenu')->findBy( array( 'pageId' => $page->getId() ) );

        if( $nav ) {

            foreach($nav as $n){

                if($n->getType() == 'page'){
                    $em->remove($n);
                    $em->flush();

                }
            }

        }

        return $this;
    }

    /**
     * Creates a form to delete a Page entity by id.
     *
     * @param mixed $id The entity id
     *
     * @return \Symfony\Component\Form\Form The form
     */
    private function createDeleteForm($id)
    {
        return $this->createFormBuilder(array('id' => $id))
            ->add('id', 'hidden')
            ->getForm()
        ;
    }

    /**
     * Get latest pages.
     *
     */
    public function getLatestPagesAction( $num)
    {
        $em = $this->getDoctrine()->getManager();

        $entities = $em->getRepository('PageBundle:Page')->getLatest( $num );

        return $this->render('PageBundle:Page:latestpages.html.twig', array(
            'entities'      => $entities,
        ));
    }

    /**
     * Get latest pages.
     *
     */
    public function getPagesTreeAction( $form, $input )
    {
        $em = $this->getDoctrine()->getManager();
        $pages = $em->getRepository('PageBundle:Page')->findAll();

        $tree = new AdminPageTree();
        $pageTree = $tree->createTree( $pages );

        return $this->render('PageBundle:Page:pagesTree.html.twig', array(
            'pageTree'      => $pageTree,
            'form'          => $form,
            'input'         => $input
        ));
    }

}


text:
using System.Linq;
using MoreTraps.Things.Building.Security;
using Verse;

namespace MoreTraps.PlaceWorkers
{
    public class PlaceWorker_ArrowTrap : PlaceWorker
    {
        /// <summary>
        ///     Draws the ghost.
        /// </summary>
        /// <param name="def">The definition.</param>
        /// <param name="center">The center.</param>
        /// <param name="rot">The rot.</param>
        public override void DrawGhost(ThingDef def, IntVec3 center, Rot4 rot)
        {
            GenDraw.DrawFieldEdges(Building_ArrowTrap.CalculateTriggerCells(center, rot).ToList());
        }
    }
}


text:
package org.jivesoftware.openfire.reporting.stats;

import org.jivesoftware.openfire.stats.Statistic;

/**
 * A class used by the StatsEngine to track all relevant meta information and data
 * relating to a graph. It also provides a mechanism for other classes in the stats
 * package to retrieve data relating to a stat.
 *
 * @author Alexander Wenckus
 */
abstract class StatDefinition {

    private String dbPath;
    private String datasourceName;
    private Statistic stat;
    public long lastSampleTime;
    public double lastSample;

    StatDefinition(String dbPath, String datasourceName, Statistic stat) {
        this.dbPath = dbPath;
        this.datasourceName = datasourceName;
        this.stat = stat;
    }

    public String getDbPath() {
        return dbPath;
    }

    public String getDatasourceName() {
        return datasourceName;
    }

    public Statistic getStatistic() {
        return stat;
    }

    public abstract double[][] getData(long startTime, long endTime);

    public abstract double[][] getData(long startTime, long lastTime, int dataPoints);

    public abstract long getLastSampleTime();

    public abstract double getLastSample();

    public abstract double[] getMax(long startTime, long endTime);

    public abstract double[] getMin(long startTime, long endTime);

    public abstract double[] getMin(long startTime, long endTime, int dataPoints);

    public abstract double[] getMax(long l, long l1, int dataPoints);
}