text:
.class Lcom/android/server/VibratorService$3;
.super Ljava/lang/Object;
.source "VibratorService.java"

# interfaces
.implements Ljava/lang/Runnable;

# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Lcom/android/server/VibratorService;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x0
    name = null
.end annotation

# instance fields
.field final synthetic this$0:Lcom/android/server/VibratorService;

# direct methods
.method constructor <init>(Lcom/android/server/VibratorService;)V
    .locals 0

    .prologue
    .line 308
    iput-object p1, p0, Lcom/android/server/VibratorService$3;->this$0:Lcom/android/server/VibratorService;

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method

# virtual methods
.method public run()V
    .locals 2

    .prologue
    .line 310
    iget-object v0, p0, Lcom/android/server/VibratorService$3;->this$0:Lcom/android/server/VibratorService;

    # getter for: Lcom/android/server/VibratorService;->mVibrations:Ljava/util/LinkedList;
    invoke-static {v0}, Lcom/android/server/VibratorService;->access$000(Lcom/android/server/VibratorService;)Ljava/util/LinkedList;

    move-result-object v1

    monitor-enter v1

    .line 311
    :try_start_0
    iget-object v0, p0, Lcom/android/server/VibratorService$3;->this$0:Lcom/android/server/VibratorService;

    # invokes: Lcom/android/server/VibratorService;->doCancelVibrateLocked()V
    invoke-static {v0}, Lcom/android/server/VibratorService;->access$200(Lcom/android/server/VibratorService;)V

    .line 312
    iget-object v0, p0, Lcom/android/server/VibratorService$3;->this$0:Lcom/android/server/VibratorService;

    # invokes: Lcom/android/server/VibratorService;->startNextVibrationLocked()V
    invoke-static {v0}, Lcom/android/server/VibratorService;->access$300(Lcom/android/server/VibratorService;)V

    .line 313
    monitor-exit v1

    .line 314
    return-void

    .line 313
    :catchall_0
    move-exception v0

    monitor-exit v1
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    throw v0
.end method


text:
package org.spicefactory.parsley.core.view.impl;

import java.awt.Container;
import java.awt.event.ContainerEvent;
import java.awt.event.ContainerListener;
import java.util.ArrayList;
import java.util.IdentityHashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Nullable;
import javax.inject.Inject;
import javax.inject.Singleton;

import org.slf4j.Logger;
import org.spicefactory.parsley.core.context.Context;
import org.spicefactory.parsley.core.context.ContextListener;
import org.spicefactory.parsley.core.events.ContextEvent;
import org.spicefactory.parsley.core.view.ViewManager;
import org.spicefactory.parsley.core.view.ViewRootHandler;
import org.spicefactory.parsley.core.view.ViewSettings;

/**
 * Default implementation of the ViewManager interface.
 * @author Sylvain Lecoy <sylvain.lecoy@gmail.com>
 */
@Singleton
@ViewSettings
// TODO: ViewSettings must be on Applet, as well as global settings/configuration.
public class DefaultViewManager implements ViewManager, ContainerListener, ContextListener {

	@Inject
	private Logger logger;

	private final Context context;

	private final ViewSettings settings;

	private final List<ViewRootHandler> handlers;

	private final Map<Container, ViewRoot> viewRoots = new IdentityHashMap<Container, DefaultViewManager.ViewRoot>();

	private final static Map<Container, ViewManager> viewRootRegistry = new IdentityHashMap<Container, ViewManager>();

	@Inject
	DefaultViewManager(Context c, @Nullable ViewSettings s) {
		context = c;
		context.addContextListener(this);

		if (s == null) {
			settings = this.getClass().getAnnotation(ViewSettings.class);
		} else {
			settings = s;
		}

		handlers = new ArrayList<ViewRootHandler>(settings.viewRootHandlers().length);

		for (Class<? extends ViewRootHandler> type : settings.viewRootHandlers()) {
			handlers.add(c.getInstance(type));
		}
	}

	@Override
	public void addViewRoot(Container view) {
		if (viewRoots.containsKey(view)) {
			return;
		}
		logger.trace("Adding view root {}/{}.", view.getName(), view.getClass());

		if (viewRootRegistry.containsKey(view)) {
			// Does not allows two view managers on the same view, but allows switching them.
			logger.trace("Switching ViewManager for view root '{}'.", view.getClass());
			ViewManager viewManager = viewRootRegistry.get(view);
			viewManager.removeViewRoot(view);
		}
		viewRootRegistry.put(view, this);

		boolean autoRemove = settings.autoRemoveViewRoots();
		if (autoRemove) {
			view.addContainerListener(this);
		} else {
			// TODO: implement if needed.
		}

		viewRoots.put(view, new ViewRoot(view, autoRemove));

		for (ViewRootHandler handler : handlers) {
			handler.addViewRoot(view);
		}
	}

	@Override
	public void removeViewRoot(Container view) {
		ViewRoot viewRoot = viewRoots.remove(view);
		if (viewRoot != null) {
			logger.trace("Removing view root {}/{}.", view.getName(), view.getClass());
			removeViewRoot(viewRoot);
			if (viewRoots.size() == 0 && settings.autoDestroyContext()) {
				logger.trace("Last view root removed from ViewManager. Destroying Context.");
				context.destroy();
			}
		}
	}

	private void removeViewRoot(ViewRoot viewRoot) {
		for (ViewRootHandler handler : handlers) {
			handler.removeViewRoot(viewRoot.view);
		}

		if (viewRoot.autoRemove) {
			viewRoot.view.removeContainerListener(this);
		} else {
			// TODO: implement if needed.
		}

		viewRootRegistry.remove(viewRoot);
	}

	///////////////////////////////////////////////////////////////////////////
	// Implements ContainerListener.
	///////////////////////////////////////////////////////////////////////////

	@Override
	public void componentAdded(ContainerEvent e) {
		// Do nothing.
	}

	@Override
	public void componentRemoved(ContainerEvent e) {
		removeViewRoot(e.getContainer());
	}

	///////////////////////////////////////////////////////////////////////////
	// Implements ContextListener.
	///////////////////////////////////////////////////////////////////////////

	@Override
	public void contextDestroyed(ContextEvent e) {
		context.removeContextListener(this);
		for (ViewRoot viewRoot : viewRoots.values()) {
			removeViewRoot(viewRoot);
		}
		viewRoots.clear();
		for (ViewRootHandler handler : handlers) {
			handler.destroy();
		}
	}

	private class ViewRoot {
		public final Container view;
		public final boolean autoRemove;

		public ViewRoot(Container view, boolean autoRemove) {
			this.view = view;
			this.autoRemove = autoRemove;
		}
	}

}

redpajama_set_name: RedPajamaGithub


text:
module('Lesson model spec', {
    setup: function () {

    },
    teardown: function () {

    }
});

test('Lesson model attributes', function () {
    respondsTo('Lesson', 'lesson_number', 'number');
    respondsTo('Lesson', 'lesson_title', 'string');
    respondsTo('Lesson', 'lesson_body', 'string');
    respondsTo('Lesson', 'lesson_code', 'string');
});


text:
A client connecting to the OpenWeatherMap API for fetching current weather data, interval/daily forecasts, and searching cities.

#Installation
Add
```
pod 'KFOpenWeatherMapAPI'
```
to your podfile and run
```
pod install
```

Initialize the client with your API key obtained from http://openweathermap.org/login and an api version (currently 2.5):

```obj-c
self.apiClient = [[KFOpenWeatherMapAPIClient alloc] initWithAPIKey:@"1111111111" andAPIVersion:@"2.5"];
```
for a full documentation see http://docs.kf-interactive.com/KFOpenWeatherMapAPI

You can request weather data for a city by its name, its OpenWeatherMap city id, or by its geo location. For more acurate results you can
#Usage
##Current Weather
For requesting the current weather for Los Angeles use:
```obj-c
[self.apiClient weatherForCityName:@"Los Angeles" withResultBlock:^(BOOL success, id responseData, NSError *error)
{
    if (success)
    {
        KFOWMWeatherResponseModel *responseModel = (KFOWMWeatherResponseModel *)responseData;
        NSLog(@"received weather: %@, temperature: %@ K, %@%%rH, %@ mbar", responseModel.cityName, responseModel.mainWeather.temperature, responseModel.mainWeather.humidity, responseModel.mainWeather.pressure);
    }
    else
    {
        NSLog(@"could not get weather: %@", error);
    }
}];
```
This will return a `KFOWMWeatherResponseModel` including all data from the api parsed as native objects:
**KFOpenWeatherMapAPI[6102:c07] received weather: Los Angeles, temperature: 292.65 K, 71%rH, 1011 mbar**

##Forecast

To get the forecast for Los Angeles for the next hours call
```obj-c
[self.apiClient forecastForCityName:@"Los Angeles" withResultBlock:^(BOOL success, id responseData, NSError *error)
{
    if (success)
    {
        KFOWMForecastResponseModel *responseModel = (KFOWMForecastResponseModel *)responseData;

        NSString *humidity = [[responseModel.list valueForKeyPath:@"mainWeather.humidity"] componentsJoinedByString:@"%rH, "];
        NSLog(@"received forecast: %@, humidity: %@", responseModel.city.cityName, humidity);
    }
    else
    {
        NSLog(@"could not get forecast: %@", error);
    }
}];
```
and you get a `KFOWMForecastResponseModel`:
**KFOpenWeatherMapAPI[6448:c07] received forecast: Los Angeles, humidity: 80%rH, 70%rH, 67%rH, 66%rH, …**

##Daily Forecast

For getting a daily forecast for 4 days for Los Angeles use
```obj-c
[self.apiClient dailyForecastForCityName:@"Los Angeles" numberOfDays:4 withResultBlock:^(BOOL success, id responseData, NSError *error)
{
    if (success)
    {
        KFOWMDailyForecastResponseModel *responseModel = (KFOWMDailyForecastResponseModel *)responseData;
        NSLog(@"received daily forecast: %@, %@", responseModel.city.cityName, [[responseModel.list valueForKeyPath:@"temperature.day"] componentsJoinedByString:@" K, "]);
    }
    else
    {
        NSLog(@"could not get daily forecast: %@", error);
    }
}];
```
that returns a `KFOWMDailyForecastResponseModel`:
**KFOpenWeatherMapAPI[6605:c07] received daily forecast: Los Angeles, 299.71 K, 299.93 K, 300.69 K, 301.13 K**
##Search
To search for a phrase you can call
```obj-c
[self.apiClient searchForPhrase:@"London" numberOfResults:10 withResultBlock:^(BOOL success, id responseData, NSError *error)
{
    if (success)
    {
        KFOWMSearchResponseModel *responseModel = (KFOWMSearchResponseModel *)responseData;
        NSMutableArray *foundCities = [NSMutableArray new];
        for (KFOWMWeatherResponseModel *listModel in responseModel.list)
        {
            NSString *city = [NSString stringWithFormat:@"%@, %@", listModel.cityName, listModel.systemInfo.country];
            [foundCities addObject:city];
        }
        NSLog(@"search results: %@", [foundCities componentsJoinedByString:@", "]);
    }
    else
    {
        NSLog(@"could not get search results: %@", error);
    }
}];
```
that will result in a `KFOWMSearchResponseModel`:
**KFOpenWeatherMapAPI[6976:c07] search results: London, GB, London, CA, London, US, London, US**

#License
This code is distributed under the terms and conditions of the MIT license.

#Author
Rico Becker
@ricobeck
<https://twitter.com/ricobeck>


text:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<groupId>lovePuppy2</groupId>
	<artifactId>lovePuppy2</artifactId>
	<version>0.0.1-SNAPSHOT</version>
	<packaging>war</packaging>
	<build>
		<sourceDirectory>src</sourceDirectory>
		<plugins>
			<plugin>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>3.1</version>
				<configuration>
					<source>1.7</source>
					<target>1.7</target>
				</configuration>
			</plugin>
			<plugin>
				<artifactId>maven-war-plugin</artifactId>
				<version>2.3</version>
				<configuration>
					<warSourceDirectory>WebContent</warSourceDirectory>
					<failOnMissingWebXml>false</failOnMissingWebXml>
				</configuration>
			</plugin>
		</plugins>
	</build>
	<dependencies>
		<dependency>
			<groupId>org.mybatis</groupId>
			<artifactId>mybatis</artifactId>
			<version>3.2.2</version>
		</dependency>
		<dependency>
			<groupId>log4j</groupId>
			<artifactId>log4j</artifactId>
			<version>1.2.14</version>
		</dependency>
	</dependencies>
</project>


text:
package com.flash3388.flashlib.vision.cv;

import com.flash3388.flashlib.vision.Camera;
import com.flash3388.flashlib.vision.VisionException;
import org.opencv.core.Mat;
import org.opencv.videoio.VideoCapture;
import org.opencv.videoio.Videoio;

public class CvCamera implements Camera<CvImage> {

    private final VideoCapture mVideoCapture;

    public CvCamera(VideoCapture videoCapture) {
        mVideoCapture = videoCapture;
    }

    public CvCamera(int dev) {
        this(new VideoCapture(0));
    }

    @Override
    public int getFps() {
        return (int) mVideoCapture.get(Videoio.CAP_PROP_FPS);
    }

    @Override
    public int getHeight() {
        return (int) mVideoCapture.get(Videoio.CAP_PROP_FRAME_HEIGHT);
    }

    @Override
    public int getWidth() {
        return (int) mVideoCapture.get(Videoio.CAP_PROP_FRAME_WIDTH);
    }

    @Override
    public CvImage capture() throws VisionException {
        Mat mat = new Mat();
        if (!mVideoCapture.read(mat)) {
            mat.release();
            throw new VisionException("failed to read");
        }

        if (mat.empty()) {
            mat.release();
            throw new VisionException("image is empty");
        }

        return new CvImage(mat);
    }

    @Override
    protected void finalize() throws Throwable {
        close();
    }

    @Override
    public void close() throws Exception {
        mVideoCapture.release();
    }
}


text:
from __future__ import unicode_literals
import sure  # noqa

from moto.core.utils import convert_regex_to_flask_path

def test_flask_path_converting_simple():
    convert_regex_to_flask_path("/").should.equal("/")
    convert_regex_to_flask_path("/$").should.equal("/")

    convert_regex_to_flask_path("/foo").should.equal("/foo")

    convert_regex_to_flask_path("/foo/bar/").should.equal("/foo/bar/")

def test_flask_path_converting_regex():
    convert_regex_to_flask_path(r"/(?P<key_name>[a-zA-Z0-9\-_]+)").should.equal(
        r'/<regex("[a-zA-Z0-9\-_]+"):key_name>'
    )

    convert_regex_to_flask_path(
        r"(?P<account_id>\d+)/(?P<queue_name>.*)$"
    ).should.equal(r'<regex("\d+"):account_id>/<regex(".*"):queue_name>')


text:
/**
 * @fileoverview Externs definitions for the Sinon library, 1.17 branch.
 *
 * Note that this file is incomplete.
 *
 * This file defines some virtual types, please don't use these directly, but
 * follow the official API guidelines.
 *
 * @externs
 * @see http://sinonjs.org/docs/
 */

/** @const */
var sinon = {};

/**
 * @constructor
 * @implements {EventListener}
 * @extends {Function}
 */
var SinonSpyCallApi = function() {};

/**
 * NOTE: This function doesn't exist on the sinon spy, it exists to be able to
 * satisfy the EventListener interface so that the spy can be used with
 * addEventListener calls.
 *
 * @param {!Event} event
 * @override
 * @deprecated This function doesn't exist on the sinon spy.
 */
SinonSpyCallApi.prototype.handleEvent = function(event) {};

/** @type {*} */
SinonSpyCallApi.prototype.thisValue;

/** @type {!Array<*>} */
SinonSpyCallApi.prototype.args;

/** @type {*} */
SinonSpyCallApi.prototype.exception;

/** @type {*} */
SinonSpyCallApi.prototype.returnValue;

/**
 * @param {*} obj
 * @return {boolean}
 */
SinonSpyCallApi.prototype.calledOn = function(obj) {};

/**
 * @param {...*} args
 * @return {boolean}
 */
SinonSpyCallApi.prototype.calledWith = function(args) {};

/**
 * @param {...*} args
 * @return {boolean}
 */
SinonSpyCallApi.prototype.calledWithExactly = function(args) {};

/**
 * @param {...*} args
 * @return {boolean}
 */
SinonSpyCallApi.prototype.calledWithMatch = function(args) {};

/**
 * @param {...*} args
 * @return {boolean}
 */
SinonSpyCallApi.prototype.notCalledWith = function(args) {};

/**
 * @param {...*} args
 * @return {boolean}
 */
SinonSpyCallApi.prototype.notCalledWithMatch = function(args) {};

/**
 * @param {*} value
 * @return {boolean}
 */
SinonSpyCallApi.prototype.returned = function(value) {};

/**
 * @param {*=} obj
 * @return {boolean}
 */
SinonSpyCallApi.prototype.threw = function(obj) {};

/**
 * @param {number} pos
 */
SinonSpyCallApi.prototype.callArg = function(pos) {};

/**
 * @param {number} pos
 * @param {*} obj
 * @param {...*} args
 */
SinonSpyCallApi.prototype.callArgOn = function(pos, obj, args) {};

/**
 * @param {number} pos
 * @param {...*} args
 */
SinonSpyCallApi.prototype.callArgWith = function(pos, args) {};

/**
 * @param {number} pos
 * @param {*} obj
 * @param {...*} args
 */
SinonSpyCallApi.prototype.callArgOnWith = function(pos, obj, args) {};

/**
 * @param {...*} args
 */
SinonSpyCallApi.prototype.yield = function(args) {};

/**
 * @param {*} obj
 * @param {...*} args
 */
SinonSpyCallApi.prototype.yieldOn = function(obj, args) {};

/**
 * @param {string} property
 * @param {...*} args
 */
SinonSpyCallApi.prototype.yieldTo = function(property, args) {};

/**
 * @param {string} property
 * @param {*} obj
 * @param {...*} args
 */
SinonSpyCallApi.prototype.yieldToOn = function(property, obj, args) {};

/**
 * @constructor
 * @extends {SinonSpyCallApi}
 */
var SinonSpyCall = function() {};

/**
 * @param {!SinonSpyCall} call
 * @return {boolean}
 */
SinonSpyCall.prototype.calledBefore = function(call) {};

/**
 * @param {!SinonSpyCall} call
 * @return {boolean}
 */
SinonSpyCall.prototype.calledAfter = function(call) {};

/**
 * @param {!SinonSpyCall} call
 * @return {boolean}
 */
SinonSpyCall.prototype.calledWithNew = function(call) {};

/**
 * @constructor
 * @extends {SinonSpyCallApi}
 */
var SinonSpy = function() {};

/** @type {number} */
SinonSpy.prototype.callCount;

/** @type {boolean} */
SinonSpy.prototype.called;

/** @type {boolean} */
SinonSpy.prototype.notCalled;

/** @type {boolean} */
SinonSpy.prototype.calledOnce;

/** @type {boolean} */
SinonSpy.prototype.calledTwice;

/** @type {boolean} */
SinonSpy.prototype.calledThrice;

/** @type {!SinonSpyCall} */
SinonSpy.prototype.firstCall;

/** @type {!SinonSpyCall} */
SinonSpy.prototype.secondCall;

/** @type {!SinonSpyCall} */
SinonSpy.prototype.thirdCall;

/** @type {!SinonSpyCall} */
SinonSpy.prototype.lastCall;

/** @type {!Array<*>} */
SinonSpy.prototype.thisValues;

/** @type {!Array<!Array<*>>} */
SinonSpy.prototype.args;

/** @type {!Array<*>} */
SinonSpy.prototype.exceptions;

/** @type {!Array<*>} */
SinonSpy.prototype.returnValues;

/**
 * @param {!SinonSpy} anotherSpy
 * @return {boolean}
 */
SinonSpy.prototype.calledBefore = function(anotherSpy) {};

/**
 * @param {!SinonSpy} anotherSpy
 * @return {boolean}
 */
SinonSpy.prototype.calledAfter = function(anotherSpy) {};

/**
 * @return {boolean}
 */
SinonSpy.prototype.calledWithNew = function() {};

/**
 * @param {...*} args
 * @return {!SinonSpy}
 */
SinonSpy.prototype.withArgs = function(args) {};

/**
 * @param {*} obj
 * @return {boolean}
 */
SinonSpy.prototype.alwaysCalledOn = function(obj) {};

/**
 * @param {...*} args
 * @return {boolean}
 */
SinonSpy.prototype.alwaysCalledWith = function(args) {};

/**
 * @param {...*} args
 * @return {boolean}
 */
SinonSpy.prototype.alwaysCalledWithExactly = function(args) {};

/**
 * @param {...*} args
 * @return {boolean}
 */
SinonSpy.prototype.alwaysCalledWithMatch = function(args) {};

/**
 * @param {...*} args
 * @return {boolean}
 */
SinonSpy.prototype.neverCalledWith = function(args) {};

/**
 * @param {...*} args
 * @return {boolean}
 */
SinonSpy.prototype.neverCalledWithMatch = function(args) {};

/**
 * @param {*=} obj
 * @return {boolean}
 */
SinonSpy.prototype.alwaysThrew = function(obj) {};

/**
 * @param {*} obj
 * @return {boolean}
 */
SinonSpy.prototype.alwaysReturned = function(obj) {};

/**
 * @param {...*} args
 */
SinonSpy.prototype.invokeCallback = function(args) {};

/**
 * @param {number} n
 * @return {!SinonSpyCall}
 */
SinonSpy.prototype.getCall = function(n) {};

SinonSpy.prototype.reset = function() {};

/**
 * @param {string} format
 * @param {...*} args
 * @return {string}
 */
SinonSpy.prototype.printf = function(format, args) {};

SinonSpy.prototype.restore = function() {};

/**
 * @param {*=} objectOrFunction
 * @param {string=} method
 * @return {!SinonSpy}
 */
sinon.spy = function(objectOrFunction, method) {};

/**
 * @constructor
 * @extends {SinonSpy}
 */
var SinonStub = function() {};

SinonStub.prototype.resetBehavior = function() {};

/**
 * @param {*} obj
 * @return {!SinonStub}
 */
SinonStub.prototype.returns = function(obj) {};

/**
 * @param {number} index
 * @return {!SinonStub}
 */
SinonStub.prototype.returnsArg = function(index) {};

/**
 * @return {!SinonStub}
 */
SinonStub.prototype.returnsThis = function() {};

/**
 * @param {*=} obj
 * @return {!SinonStub}
 */
SinonStub.prototype.throws = function(obj) {};

/**
 * @param {number} index
 * @return {!SinonStub}
 */
SinonStub.prototype.callsArg = function(index) {};

/**
 * @param {number} index
 * @param {*} context
 * @return {!SinonStub}
 */
SinonStub.prototype.callsArgOn = function(index, context) {};

/**
 * @param {number} index
 * @param {...*} args
 * @return {!SinonStub}
 */
SinonStub.prototype.callsArgWith = function(index, args) {};

/**
 * @param {number} index
 * @param {*} context
 * @param {...*} args
 * @return {!SinonStub}
 */
SinonStub.prototype.callsArgOnWith = function(index, context, args) {};

/**
 * @param {number} index
 * @return {!SinonStub}
 */
SinonStub.prototype.callsArgAsync = function(index) {};

/**
 * @param {number} index
 * @param {*} context
 * @return {!SinonStub}
 */
SinonStub.prototype.callsArgOnAsync = function(index, context) {};

/**
 * @param {number} index
 * @param {...*} args
 * @return {!SinonStub}
 */
SinonStub.prototype.callsArgWithAsync = function(index, args) {};

/**
 * @param {number} index
 * @param {*} context
 * @param {...*} args
 * @return {!SinonStub}
 */
SinonStub.prototype.callsArgOnWithAsync = function(index, context, args) {};

/**
 * @param {number} n
 * @return {!SinonStub}
 */
SinonStub.prototype.onCall = function(n) {};

/**
 * @return {!SinonStub}
 */
SinonStub.prototype.onFirstCall = function() {};

/**
 * @return {!SinonStub}
 */
SinonStub.prototype.onSecondCall = function() {};

/**
 * @return {!SinonStub}
 */
SinonStub.prototype.onThirdCall = function() {};

/**
 * @param {...*} args
 * @return {!SinonStub}
 */
SinonStub.prototype.yields = function(args) {};

/**
 * @param {*} context
 * @param {...*} args
 * @return {!SinonStub}
 */
SinonStub.prototype.yieldsOn = function(context, args) {};

/**
 * @param {string} property
 * @param {...*} args
 * @return {!SinonStub}
 */
SinonStub.prototype.yieldsTo = function(property, args) {};

/**
 * @param {string} property
 * @param {*} context
 * @param {...*} args
 * @return {!SinonStub}
 */
SinonStub.prototype.yieldsToOn = function(property, context, args) {};

/**
 * @param {...*} args
 * @return {!SinonStub}
 */
SinonStub.prototype.yieldsAsync = function(args) {};

/**
 * @param {*} context
 * @param {...*} args
 * @return {!SinonStub}
 */
SinonStub.prototype.yieldsOnAsync = function(context, args) {};

/**
 * @param {string} property
 * @param {...*} args
 * @return {!SinonStub}
 */
SinonStub.prototype.yieldsToAsync = function(property, args) {};

/**
 * @param {string} property
 * @param {*} context
 * @param {...*} args
 * @return {!SinonStub}
 */
SinonStub.prototype.yieldsToOnAsync = function(property, context, args) {};

/**
 * @param {...*} args
 * @return {!SinonStub}
 * @override
 */
SinonStub.prototype.withArgs = function(args) {};

/**
 * @param {*=} obj
 * @param {string=} method
 * @param {*=} func
 * @return {!SinonStub}
 */
sinon.stub = function(obj, method, func) {};

/**
 * @constructor
 * @extends {SinonStub}
 */
var SinonExpectation = function() {};

/**
 * @param {number} n
 * @return {!SinonExpectation}
 */
SinonExpectation.prototype.atLeast = function(n) {};

/**
 * @param {number} n
 * @return {!SinonExpectation}
 */
SinonExpectation.prototype.atMost = function(n) {};

/**
 * @return {!SinonExpectation}
 */
SinonExpectation.prototype.never = function() {};

/**
 * @return {!SinonExpectation}
 */
SinonExpectation.prototype.once = function() {};

/**
 * @return {!SinonExpectation}
 */
SinonExpectation.prototype.twice = function() {};

/**
 * @return {!SinonExpectation}
 */
SinonExpectation.prototype.thrice = function() {};

/**
 * @param {number} n
 * @return {!SinonExpectation}
 */
SinonExpectation.prototype.exactly = function(n) {};

/**
 * @param {...*} args
 * @return {!SinonExpectation}
 * @override
 */
SinonExpectation.prototype.withArgs = function(args) {};

/**
 * @param {...*} args
 * @return {!SinonExpectation}
 */
SinonExpectation.prototype.withExactArgs = function(args) {};

/**
 * @param {*} obj
 * @return {!SinonExpectation}
 */
SinonExpectation.prototype.on = function(obj) {};

/**
 * @return {!SinonExpectation}
 */
SinonExpectation.prototype.verify = function() {};

sinon.expectation = {};

/**
 * @param {string} methodName
 * @return {!SinonExpectation}
 */
sinon.expectation.create = function(methodName) {};

/**
 * @constructor
 */
var SinonMock = function() {};

/**
 * @param {string} method
 * @return {!SinonExpectation}
 */
SinonMock.prototype.expects = function(method) {};

SinonMock.prototype.restore = function() {};

SinonMock.prototype.verify = function() {};

/**
 * @param {*} obj
 * @return {!SinonMock}
 */
sinon.mock = function(obj) {};

/** @interface */
var SinonMatcher = function() {};

/**
 * @param {!SinonMatcher} expr
 * @return {!SinonMatcher}
 */
SinonMatcher.prototype.and = function(expr) {};

/**
 * @param {!SinonMatcher} expr
 * @return {!SinonMatcher}
 */
SinonMatcher.prototype.or = function(expr) {};

/**
 * @param {number|string|RegExp|*|function(*): boolean} value
 * @return {!SinonMatcher}
 */
sinon.match = function(value) {};

/** @type {!SinonMatcher} */

sinon.match.any;

/** @type {!SinonMatcher} */
sinon.match.defined;

/** @type {!SinonMatcher} */
sinon.match.truthy;

/** @type {!SinonMatcher} */
sinon.match.falsy;

/** @type {!SinonMatcher} */
sinon.match.bool;

/** @type {!SinonMatcher} */
sinon.match.number;

/** @type {!SinonMatcher} */
sinon.match.string;

/** @type {!SinonMatcher} */
sinon.match.object;

/** @type {!SinonMatcher} */
sinon.match.func;

/** @type {!SinonMatcher} */
sinon.match.array;

/** @type {!SinonMatcher} */
sinon.match.regexp;

/** @type {!SinonMatcher} */
sinon.match.date;

/**
 * @param {*} obj
 * @return {!SinonMatcher}
 */
sinon.match.same = function(obj) {};

/**
 * @param {string} type
 * @return {!SinonMatcher}
 */
sinon.match.typeOf = function(type) {};

/**
 * @param {*} type
 * @return {!SinonMatcher}
 */
sinon.match.instanceOf = function(type) {};

/**
 * @param {string} property
 * @param {*=} expect
 * @return {!SinonMatcher}
 */
sinon.match.has = function(property, expect) {};

/**
 * @param {string} property
 * @param {*=} expect
 * @return {!SinonMatcher}
 */
sinon.match.hasOwn = function(property, expect) {};

/**
 * @interface
 */
var SinonClock = function() {};

/**
 * @param {!number} ticks
 */
SinonClock.prototype.tick = function(ticks) {};

SinonClock.prototype.restore = function() {};

sinon.sandbox = {};

/**
 * @param {!Object=} opt_config
 * @return {!SinonSandbox}
 */
sinon.sandbox.create = function(opt_config) {};

/**
 * @constructor
 */
var SinonSandbox = function() {};

SinonSandbox.prototype.restore = function() {};

SinonSandbox.prototype.useFakeServer = function() {};

/**
 * @param {*=} objectOrFunction
 * @param {string=} method
 * @return {!SinonSpy}
 */
SinonSandbox.prototype.spy = function(objectOrFunction, method) {};

/**
 * @type {!SinonFakeServer|undefined}
 */
SinonSandbox.prototype.server;

/**
 * @param {*=} obj
 * @param {string=} method
 * @param {*=} func
 * @return {!SinonStub}
 */
SinonSandbox.prototype.stub = function(obj, method, func) {};

/**
 * @param {...?} params
 * @return {SinonClock}
 */
SinonSandbox.prototype.useFakeTimers = function(params) {};

sinon.fakeServer = {};

/**
 * @param {!Object=} opt_config
 * @return {!SinonFakeServer}
 */
sinon.fakeServer.create = function(opt_config) {};

/**
 * @constructor
 */
var SinonFakeServer = function() {};

/**
 * @type {!Array<!SinonFakeXmlHttpRequest>}
 */
SinonFakeServer.prototype.requests;

/**
 * @type {boolean|undefined}
 */
SinonFakeServer.prototype.respondImmediately;

SinonFakeServer.prototype.respond = function() {};

SinonFakeServer.prototype.restore = function() {};

/**
 * Note: incomplete definition because it is tricky.
 * @param {...*} var_args
 */
SinonFakeServer.prototype.respondWith = function(var_args) {};

/**
 * @constructor
 * @extends {XMLHttpRequest}
 */
var SinonFakeXmlHttpRequest = function() {};

/**
 * @type {?string}
 */
SinonFakeXmlHttpRequest.prototype.requestBody;

/**
 * @type {?Object<string, string>}
 */
SinonFakeXmlHttpRequest.prototype.requestHeaders;

/**
 * @type {?string}
 */
SinonFakeXmlHttpRequest.prototype.method;

/**
 * @type {?string}
 */
SinonFakeXmlHttpRequest.prototype.url;

/**
 * @param {?number} status
 * @param {?Object<string, string>} headers
 * @param {?string} body
 */
SinonFakeXmlHttpRequest.prototype.respond = function(status, headers, body) {};

/**
 * @param {...?} params
 * @return {SinonClock}
 */
sinon.useFakeTimers = function(params) {};


text:
package org.pac4j.core.matching;

import org.pac4j.core.context.HttpConstants;
import org.pac4j.core.context.Pac4jConstants;
import org.pac4j.core.context.WebContext;
import org.pac4j.core.util.CommonHelper;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Check that all matchers are satisfied.
 *
 * @author Jerome Leleu
 * @since 1.8.1
 */
public class RequireAllMatchersChecker implements MatchingChecker {

    private static final String GET_MATCHER_NAME = "get";
    private static final Matcher GET_MATCHER = new HttpMethodMatcher(HttpConstants.HTTP_METHOD.GET);
    private static final String POST_MATCHER_NAME = "post";
    private static final Matcher POST_MATCHER = new HttpMethodMatcher(HttpConstants.HTTP_METHOD.POST);
    private static final String PUT_MATCHER_NAME = "put";
    private static final Matcher PUT_MATCHER = new HttpMethodMatcher(HttpConstants.HTTP_METHOD.PUT);
    private static final String DELETE_MATCHER_NAME = "delete";
    private static final Matcher DELETE_MATCHER = new HttpMethodMatcher(HttpConstants.HTTP_METHOD.DELETE);

    @Override
    public boolean matches(final WebContext context, final String matcherNames, final Map<String, Matcher> matchersMap) {
        // if we have a matcher name (which may be a list of matchers names)
        if (CommonHelper.isNotBlank(matcherNames)) {
            final List<Matcher> matchers = new ArrayList<>();
            // we must have matchers
            CommonHelper.assertNotNull("matchersMap", matchersMap);
            final Map<String, Matcher> allMatchers = buildAllMatchers(matchersMap);
            final String[] names = matcherNames.split(Pac4jConstants.ELEMENT_SEPARATOR);
            final int nb = names.length;
            for (int i = 0; i < nb; i++) {
                final String name = names[i];
                Matcher result = null;
                for (final Map.Entry<String, Matcher> entry : allMatchers.entrySet()) {
                    if (CommonHelper.areEqualsIgnoreCaseAndTrim(entry.getKey(), name)) {
                        result = entry.getValue();
                        break;
                    }
                }
                // we must have an matcher defined for this name
                CommonHelper.assertNotNull("allMatchers['" + name + "']", result);
                matchers.add(result);
            }
            if (!matchers.isEmpty()) {
                // check matching using matchers: all must be satisfied
                for (Matcher matcher : matchers) {
                    if (!matcher.matches(context)) {
                        return false;
                    }
                }
            }
        }
        return true;
    }

    private Map<String, Matcher> buildAllMatchers(final Map<String, Matcher> matchersMap) {
        final Map<String, Matcher> allMatchers = new HashMap<>();
        allMatchers.putAll(matchersMap);
        addDefaultMatcherIfNotDefined(allMatchers, GET_MATCHER_NAME, GET_MATCHER);
        addDefaultMatcherIfNotDefined(allMatchers, POST_MATCHER_NAME, POST_MATCHER);
        addDefaultMatcherIfNotDefined(allMatchers, PUT_MATCHER_NAME, PUT_MATCHER);
        addDefaultMatcherIfNotDefined(allMatchers, DELETE_MATCHER_NAME, DELETE_MATCHER);
        return allMatchers;
    }

    private void addDefaultMatcherIfNotDefined(final Map<String, Matcher> allMatchers, final String name, final Matcher matcher) {
        if (!allMatchers.containsKey(name)) {
            allMatchers.put(name, matcher);
        }
    }
}


text:
package com.twelvemonkeys.imageio.plugins.pnm;

import com.twelvemonkeys.imageio.spi.ProviderInfo;

import javax.imageio.ImageReader;
import javax.imageio.spi.ImageReaderSpi;
import javax.imageio.stream.ImageInputStream;
import java.io.IOException;
import java.util.Locale;

public final class PNMImageReaderSpi extends ImageReaderSpi {

    /**
     * Creates a {@code PNMImageReaderSpi}.
     */
    public PNMImageReaderSpi() {
        this(new PNMProviderInfo());
    }

    private PNMImageReaderSpi(final ProviderInfo providerInfo) {
        super(
                providerInfo.getVendorName(),
                providerInfo.getVersion(),
                new String[] {
                        "pnm", "pbm", "pgm", "ppm", "pam", "pfm",
                        "PNM", "PBM", "PGM", "PPM", "PAM", "PFM"
                },
                new String[] {"pbm", "pgm", "ppm", "pam", "pfm"},
                new String[] {
                        // No official IANA record exists, these are conventional
                        "image/x-portable-pixmap",
                        "image/x-portable-anymap",
                        "image/x-portable-arbitrarymap" // PAM
                },
                "com.twelvemonkeys.imageio.plugins.pnm.PNMImageReader",
                new Class[] {ImageInputStream.class},
                new String[] {
                        "com.twelvemonkeys.imageio.plugins.pnm.PNMImageWriterSpi",
                        "com.twelvemonkeys.imageio.plugins.pnm.PAMImageWriterSpi"
                },
                true, // supports standard stream metadata
                null, null, // native stream format name and class
                null, null, // extra stream formats
                true, // supports standard image metadata
                null, null,
                null, null // extra image metadata formats
        );
    }

    @Override
    public boolean canDecodeInput(final Object source) throws IOException {
        if (!(source instanceof ImageInputStream)) {
            return false;
        }

        ImageInputStream stream = (ImageInputStream) source;

        stream.mark();

        try {
            short magic = stream.readShort();

            switch (magic) {
                case PNM.PBM_PLAIN:
                case PNM.PBM:
                case PNM.PGM_PLAIN:
                case PNM.PGM:
                case PNM.PPM_PLAIN:
                case PNM.PPM:
                case PNM.PFM_GRAY:
                case PNM.PFM_RGB:
                    return true;
                case PNM.PAM:
                    return stream.readInt() != PNM.XV_THUMBNAIL_MAGIC;
                default:
                    return false;
            }
        }
        finally {
            stream.reset();
        }
    }

    @Override
    public ImageReader createReaderInstance(final Object extension) throws IOException {
        return new PNMImageReader(this);
    }

    @Override
    public String getDescription(final Locale locale) {
        return "NetPBM Portable Any Map (PNM and PAM) image reader";
    }
}


text:
/*******************************************************************************
 * \file pid_control.h
 *
 * \author MAV'RIC Team
 * \author Felix Schill
 *
 * \brief PID controller
 *
 ******************************************************************************/

#ifndef PID_CONTROL_H_
#define PID_CONTROL_H_

#ifdef __cplusplus
extern "C" {
#endif

#include <stdint.h>
#include <math.h>

/**
 * \brief Integrator part of PID
 */
typedef struct
{
	float pregain; 		///< Pregain
	float postgain;		///< Postgain
	float accumulator;	///< Accumulator
	float clip;			///< Clipping value
} integrator_t;

/**
 * \brief Derivative part of PID
 */
typedef struct
{
	float gain;			///< Gain
	float previous;		///< Previous input to the differentiator
	float LPF;			///< Low pass filter
	float clip;			///< Clipping value
} differentiator_t;

/**
 * \brief Configuration for PID controller
 */
typedef struct
{
	float p_gain;
	float clip_min; 					///< Min clipping values
	float clip_max;						///< Max clipping values
	integrator_t integrator;			///< Integrator parameters
	differentiator_t differentiator;	///< Differentiator parameters
	float soft_zone_width;				///< Approximate width of a "soft zone" on the error input, i.e. a region of low gain around the target point. Value 0 -> switched off
} pid_controller_conf_t;

/**
 * \brief PID controller
 */
typedef struct
{
	float p_gain;						///< Proportional gain
	float clip_min; 					///< Min clipping values
	float clip_max;						///< Max clipping values
	integrator_t integrator;			///< Integrator parameters
	differentiator_t differentiator;	///< Differentiator parameters
	float output;						///< Output
	float error;						///< Error
	uint32_t last_update;				///< Last update time in timer tick
	float dt;							///< Time step
	float soft_zone_width;				///< Approximate width of a "soft zone" on the error input, i.e. a region of low gain around the target point. Value 0 -> switched off
} pid_controller_t;

/**
 * \brief	Init PID controller
 *
 * \param	controller 		A PID controller structure
 * \param	config 			Configuration
 */
void pid_controller_init(pid_controller_t* controller, const pid_controller_conf_t* config);

/**
 * \brief	Init as passing through controller
 *
 * \param	controller 		A PID controller structure
 */
void pid_controller_init_pass_through(pid_controller_t* controller);

/**
 * \brief	Reset integrator
 *
 * \param	controller 		A PID controller structure
 */
void pid_controller_reset_integrator(pid_controller_t* controller);

/**
 * \brief				Update the PID controller
 *
 * \param	controller	Pointer to the PID controller structure
 * \param	error		Error in the controlled variable
 *
 * \return				The controller output
 */
float pid_controller_update(pid_controller_t* controller, float error);

/**
 * \brief				Update the PID controller for a given time step
 *
 * \param	controller	Pointer to the PID controller structure
 * \param	error		Error in the controlled variable
 * \param	dt			Timestep
 *
 * \return				The controller output
 */
float pid_controller_update_dt(pid_controller_t* controller, float error, float dt);

#ifdef __cplusplus
}
#endif

#endif /* PID_CONTROL_H_ */


text:
#ifndef PATHNODE_H
#define PATHNODE_H

#include "nodes/relation.h"

/*
 * prototypes for pathnode.c
 */
extern int compare_path_costs(Path *path1, Path *path2,
				   CostSelector criterion);
extern int compare_fractional_path_costs(Path *path1, Path *path2,
							  double fraction);
extern void set_cheapest(RelOptInfo *parent_rel);
extern void add_path(RelOptInfo *parent_rel, Path *new_path);
extern bool add_path_precheck(RelOptInfo *parent_rel,
				  Cost startup_cost, Cost total_cost,
				  List *pathkeys, Relids required_outer);

extern Path *create_seqscan_path(PlannerInfo *root, RelOptInfo *rel,
					Relids required_outer);
extern IndexPath *create_index_path(PlannerInfo *root,
				  IndexOptInfo *index,
				  List *indexclauses,
				  List *indexclausecols,
				  List *indexorderbys,
				  List *indexorderbycols,
				  List *pathkeys,
				  ScanDirection indexscandir,
				  bool indexonly,
				  Relids required_outer,
				  double loop_count);
extern BitmapHeapPath *create_bitmap_heap_path(PlannerInfo *root,
						RelOptInfo *rel,
						Path *bitmapqual,
						Relids required_outer,
						double loop_count);
extern BitmapAndPath *create_bitmap_and_path(PlannerInfo *root,
					   RelOptInfo *rel,
					   List *bitmapquals);
extern BitmapOrPath *create_bitmap_or_path(PlannerInfo *root,
					  RelOptInfo *rel,
					  List *bitmapquals);
extern TidPath *create_tidscan_path(PlannerInfo *root, RelOptInfo *rel,
					List *tidquals);
extern AppendPath *create_append_path(RelOptInfo *rel, List *subpaths,
				   Relids required_outer);
extern MergeAppendPath *create_merge_append_path(PlannerInfo *root,
						 RelOptInfo *rel,
						 List *subpaths,
						 List *pathkeys,
						 Relids required_outer);
extern ResultPath *create_result_path(List *quals);
extern MaterialPath *create_material_path(RelOptInfo *rel, Path *subpath);
extern UniquePath *create_unique_path(PlannerInfo *root, RelOptInfo *rel,
				   Path *subpath, SpecialJoinInfo *sjinfo);
extern Path *create_subqueryscan_path(PlannerInfo *root, RelOptInfo *rel,
						 List *pathkeys, Relids required_outer);
extern Path *create_functionscan_path(PlannerInfo *root, RelOptInfo *rel);
extern Path *create_valuesscan_path(PlannerInfo *root, RelOptInfo *rel);
extern Path *create_ctescan_path(PlannerInfo *root, RelOptInfo *rel);
extern Path *create_worktablescan_path(PlannerInfo *root, RelOptInfo *rel);
extern ForeignPath *create_foreignscan_path(PlannerInfo *root, RelOptInfo *rel,
						double rows, Cost startup_cost, Cost total_cost,
						List *pathkeys,
						Relids required_outer,
						List *fdw_private);

extern Relids calc_nestloop_required_outer(Path *outer_path, Path *inner_path);
extern Relids calc_non_nestloop_required_outer(Path *outer_path, Path *inner_path);

extern NestPath *create_nestloop_path(PlannerInfo *root,
					 RelOptInfo *joinrel,
					 JoinType jointype,
					 JoinCostWorkspace *workspace,
					 SpecialJoinInfo *sjinfo,
					 SemiAntiJoinFactors *semifactors,
					 Path *outer_path,
					 Path *inner_path,
					 List *restrict_clauses,
					 List *pathkeys,
					 Relids required_outer);

extern MergePath *create_mergejoin_path(PlannerInfo *root,
					  RelOptInfo *joinrel,
					  JoinType jointype,
					  JoinCostWorkspace *workspace,
					  SpecialJoinInfo *sjinfo,
					  Path *outer_path,
					  Path *inner_path,
					  List *restrict_clauses,
					  List *pathkeys,
					  Relids required_outer,
					  List *mergeclauses,
					  List *outersortkeys,
					  List *innersortkeys);

extern HashPath *create_hashjoin_path(PlannerInfo *root,
					 RelOptInfo *joinrel,
					 JoinType jointype,
					 JoinCostWorkspace *workspace,
					 SpecialJoinInfo *sjinfo,
					 SemiAntiJoinFactors *semifactors,
					 Path *outer_path,
					 Path *inner_path,
					 List *restrict_clauses,
					 Relids required_outer,
					 List *hashclauses);

extern Path *reparameterize_path(PlannerInfo *root, Path *path,
					Relids required_outer,
					double loop_count);

/*
 * prototypes for relnode.c
 */
extern void setup_simple_rel_arrays(PlannerInfo *root);
extern RelOptInfo *build_simple_rel(PlannerInfo *root, int relid,
				 RelOptKind reloptkind);
extern RelOptInfo *find_base_rel(PlannerInfo *root, int relid);
extern RelOptInfo *find_join_rel(PlannerInfo *root, Relids relids);
extern RelOptInfo *build_join_rel(PlannerInfo *root,
			   Relids joinrelids,
			   RelOptInfo *outer_rel,
			   RelOptInfo *inner_rel,
			   SpecialJoinInfo *sjinfo,
			   List **restrictlist_ptr);
extern AppendRelInfo *find_childrel_appendrelinfo(PlannerInfo *root,
							RelOptInfo *rel);
extern ParamPathInfo *get_baserel_parampathinfo(PlannerInfo *root,
						  RelOptInfo *baserel,
						  Relids required_outer);
extern ParamPathInfo *get_joinrel_parampathinfo(PlannerInfo *root,
						  RelOptInfo *joinrel,
						  Path *outer_path,
						  Path *inner_path,
						  SpecialJoinInfo *sjinfo,
						  Relids required_outer,
						  List **restrict_clauses);
extern ParamPathInfo *get_appendrel_parampathinfo(RelOptInfo *appendrel,
							Relids required_outer);

#endif   /* PATHNODE_H */


text:
package org.keycloak.keys;

import java.util.List;

import org.jboss.logging.Logger;
import org.keycloak.component.ComponentModel;
import org.keycloak.crypto.KeyUse;
import org.keycloak.jose.jwe.JWEConstants;
import org.keycloak.models.KeycloakSession;
import org.keycloak.provider.ProviderConfigProperty;

/**
 * @author Takashi Norimatsu
 */
public class GeneratedRsaEncKeyProviderFactory extends AbstractGeneratedRsaKeyProviderFactory {

    private static final Logger logger = Logger.getLogger(GeneratedRsaEncKeyProviderFactory.class);

    public static final String ID = "rsa-enc-generated";

    private static final String HELP_TEXT = "Generates RSA keys for key encryption and creates a self-signed certificate";

    private static final List<ProviderConfigProperty> CONFIG_PROPERTIES = AbstractGeneratedRsaKeyProviderFactory.rsaKeyConfigurationBuilder()
            .property(Attributes.KEY_SIZE_PROPERTY)
            .property(Attributes.RS_ENC_ALGORITHM_PROPERTY)
            .build();

    @Override
    public KeyProvider create(KeycloakSession session, ComponentModel model) {
        model.put(Attributes.KEY_USE, KeyUse.ENC.name());
        return new ImportedRsaKeyProvider(session.getContext().getRealm(), model);
    }

    @Override
    public String getHelpText() {
        return HELP_TEXT;
    }

    @Override
    public List<ProviderConfigProperty> getConfigProperties() {
        return CONFIG_PROPERTIES;
    }

    @Override
    public String getId() {
        return ID;
    }

    @Override
    protected boolean isValidKeyUse(KeyUse keyUse) {
        return keyUse.equals(KeyUse.ENC);
    }

    @Override
    protected boolean isSupportedRsaAlgorithm(String algorithm) {
        return algorithm.equals(JWEConstants.RSA1_5)
                || algorithm.equals(JWEConstants.RSA_OAEP)
                || algorithm.equals(JWEConstants.RSA_OAEP_256);
    }

    @Override
    protected Logger getLogger() {
        return logger;
    }

}


text:
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
    <title></title>

    <link href="./app/home/home.css" rel="stylesheet">
    <link href="./app/courses/courses.css" rel="stylesheet">
    <link href="./app/courses/details/details.css" rel="stylesheet">

    <!-- compiled css output -->
    <link href="css/ionic.app.css" rel="stylesheet">

    <!-- ionic/angularjs js -->
    <script src="lib/ionic/js/ionic.bundle.js"></script>
    <script src="lib/ui-utils.min.js"></script>

    <!-- cordova script (this will be a 404 during development) -->
    <script src="lib/ng-cordova.min.js"></script>
    <script src="cordova.js"></script>

    <!-- Google Maps Library -->
    <script type="text/javascript"
      src="https://maps.googleapis.com/maps/api/js?key=AIzaSyAkKQfI4s2awqv0EBdAXPFFIu6d0r67bMQ">
    </script>

    <!-- your app's js -->
    <script src="app/app.js"></script>
    <script src="app/home/home.js"></script>
    <script src="app/courses/courses.js"></script>
    <script src="app/courses/details/details.js"></script>
    <script src="app/invite/invite.js"></script>
    <script src="services/courses.js"></script>
  </head>
  <body ng-app="app">

    <ion-nav-bar class="bar-positive">
      <ion-nav-back-button class="button-icon button-clear ion-ios7-arrow-back">
      </ion-nav-back-button>
    </ion-nav-bar>

    <ion-nav-view></ion-nav-view>
  </body>
</html>


text:
angular.module('sorting.controllers').controller('loginController',['$location', '$scope',  'toaster','$window', '$cookies', function($location, $scope,toaster, $window, $cookies) {

   $scope.login = function() {
			   $window.location.href = "#/sort";
   }

}]);


text:
first_name= 'Danger'
last_name= 'Russ'
age= 25

describe 'first_name' do
  it "is defined as a local variable" do
    expect(defined?(first_name)).to eq 'local-variable'
  end

  it "is a String" do
    expect(first_name).to be_a String
  end
end

describe 'last_name' do
  it "is defined as a local variable" do
    expect(defined?(last_name)).to eq 'local-variable'
  end

  it "be a String" do
    expect(last_name).to be_a String
  end
end

describe 'age' do
  it "is defined as a local variable" do
    expect(defined?(age)).to eq 'local-variable'
  end

  it "is an integer" do
    expect(age).to be_a Fixnum
  end
end


text:
import popup from '../popup';

export default function reddit(url, title = '') {
    url = encodeURIComponent(url);
    title = encodeURIComponent(title);
    return popup(`https://www.reddit.com/submit?url=${url}&title=${title}`);
}


text:
#define EDTAA_UNSIGNED_CHAR_INPUT 1

namespace EDTAA {

#if EDTAA_UNSIGNED_CHAR_INPUT
typedef unsigned char EdtaaImageType;
#else
typedef double EdtaaImageType;
#endif

void computegradient(EdtaaImageType *img, int w, int h, double *gx, double *gy);
void edtaa3(EdtaaImageType *img, double *gx, double *gy, int w, int h,
                   short *distx, short *disty, double *dist);

}


text:
package org.jasig.cas.authentication.support;

import org.jasig.cas.authentication.principal.Service;
import org.jasig.cas.services.RegisteredService;
import org.jasig.cas.services.RegisteredServiceCipherExecutor;
import org.jasig.cas.services.ServicesManager;
import org.jasig.cas.CasViewConstants;
import org.jasig.cas.util.services.DefaultRegisteredServiceCipherExecutor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;

import javax.validation.constraints.NotNull;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;

/**
 * Abstract class to define common attribute encoding operations.
 *
 * @author Misagh Moayyed
 * @since 4.1
 */
@Component("abstractCasAttributeEncoder")
public abstract class AbstractCasAttributeEncoder implements CasAttributeEncoder {
    /** The Services manager. */
    @NotNull
    @Autowired
    @Qualifier("servicesManager")
    protected ServicesManager servicesManager;

    /** The Logger. */
    protected final Logger logger = LoggerFactory.getLogger(this.getClass());

    @Autowired
    @Qualifier("registeredServiceCipherExecutor")
    private RegisteredServiceCipherExecutor cipherExecutor;

    /**
     * Instantiates a new abstract cas attribute encoder.
     */
    protected AbstractCasAttributeEncoder() {}

    /**
     * Instantiates a new attribute encoder with the default
     * cipher as {@link DefaultRegisteredServiceCipherExecutor}.
     * @param servicesManager the services manager
     */
    public AbstractCasAttributeEncoder(final ServicesManager servicesManager) {
        this(servicesManager, new DefaultRegisteredServiceCipherExecutor());
    }

    /**
     * Instantiates a new Abstract cas attribute encoder.
     *
     * @param servicesManager the services manager
     * @param cipherExecutor the cipher executor
     */
    public AbstractCasAttributeEncoder(final ServicesManager servicesManager,
                                       final RegisteredServiceCipherExecutor cipherExecutor) {
        this.servicesManager = servicesManager;
        this.cipherExecutor = cipherExecutor;
    }

    @Override
    public final Map<String, Object> encodeAttributes(final Map<String, Object> attributes,
                                                      final Service service) {
        logger.debug("Starting to encode attributes for release to service [{}]", service);
        final Map<String, Object> newEncodedAttributes = new HashMap<>(attributes);
        final Map<String, String> cachedAttributesToEncode = initialize(newEncodedAttributes);

        final RegisteredService registeredService = this.servicesManager.findServiceBy(service);
        if (registeredService != null && registeredService.getAccessStrategy().isServiceAccessAllowed()) {
            encodeAttributesInternal(newEncodedAttributes, cachedAttributesToEncode,
                    this.cipherExecutor, registeredService);
            logger.debug("[{}] Encoded attributes are available for release to [{}]",
                    newEncodedAttributes.size(), service);
        } else {
            logger.debug("Service [{}] is not found and/or enabled in the service registry. "
                    + "No encoding has taken place.", service);
        }

        return newEncodedAttributes;
    }

    /**
     * Initialize the cipher with the public key
     * and then start to encrypt select attributes.
     *
     * @param attributes the attributes
     * @param cachedAttributesToEncode the cached attributes to encode
     * @param cipher the cipher object initialized per service public key
     * @param registeredService the registered service
     */
    protected abstract void encodeAttributesInternal(Map<String, Object> attributes,
                                                     Map<String, String> cachedAttributesToEncode,
                                                     RegisteredServiceCipherExecutor cipher,
                                                     RegisteredService registeredService);

    /**
     * Initialize the encoding process. Removes the
     * {@link CasViewConstants#MODEL_ATTRIBUTE_NAME_PRINCIPAL_CREDENTIAL}
     * and
     * {@link CasViewConstants#MODEL_ATTRIBUTE_NAME_PROXY_GRANTING_TICKET}
     * from the authentication attributes originally and into a cache object, so it
     * can later on be encrypted if needed.
     * @param attributes the new encoded attributes
     * @return a map of attributes that are to be encoded and encrypted
     */
    protected final Map<String, String> initialize(final Map<String, Object> attributes) {
        final Map<String, String> cachedAttributesToEncode = new HashMap<>(attributes.size());

        Collection<?> collection = (Collection<?>) attributes.remove(CasViewConstants.MODEL_ATTRIBUTE_NAME_PRINCIPAL_CREDENTIAL);
        if (collection != null && collection.size() == 1) {
            cachedAttributesToEncode.put(CasViewConstants.MODEL_ATTRIBUTE_NAME_PRINCIPAL_CREDENTIAL,
                    collection.iterator().next().toString());
            logger.debug("Removed [{}] as an authentication attribute and cached it locally.",
                    CasViewConstants.MODEL_ATTRIBUTE_NAME_PRINCIPAL_CREDENTIAL);
        }

        collection = (Collection<?>) attributes.remove(CasViewConstants.MODEL_ATTRIBUTE_NAME_PROXY_GRANTING_TICKET);
        if (collection != null && collection.size() == 1) {
            cachedAttributesToEncode.put(CasViewConstants.MODEL_ATTRIBUTE_NAME_PROXY_GRANTING_TICKET,
                    collection.iterator().next().toString());
            logger.debug("Removed [{}] as an authentication attribute and cached it locally.",
                    CasViewConstants.MODEL_ATTRIBUTE_NAME_PROXY_GRANTING_TICKET);
        }
        return cachedAttributesToEncode;
    }
}


text:
package main

import (
	"bufio"
	"fmt"
	"os"
	"strings"
)

func main() {
	reader := bufio.NewReader(os.Stdin)

	quote := getInput("What is the quote? ", reader)
	author := getInput("Who said it? ", reader)

	fmt.Printf("%s says, \"%s\"\n", author, quote)
}

func getInput(prompt string, reader *bufio.Reader) (input string) {
	fmt.Print(prompt)

	input, err := reader.ReadString('\n')
	if err != nil {
		fmt.Println("Error reading input")
		os.Exit(0)
	}

	input = strings.TrimSpace(input)
	if input == "" {
		fmt.Println("Missing input")
		os.Exit(0)
	}

	return
}


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <title>Slot Framework: Documentation</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <link rel="stylesheet" href="../bootstrap/oneTheme/bootstrap.min.css" media="screen">
    <link rel="stylesheet" href="../assets/css/bootswatch.min.css">
    <link rel="stylesheet" href="../bower_components/font-awesome/css/font-awesome.min.css">
    <link rel="stylesheet" href="./css/github.css">

                 Slot Framework
                <button class="navbar-toggle" type="button" data-toggle="collapse" data-target="#navbar-main">

                </button>

                        Demos

                         Themes

OneTheme

Bootswatch themes

Default Bootstrap

                         Blog

            (Developer preview)

Introducing Slot

After months of hard work we are here, and happy to announce the beta release of an idea that  has become a reality. A Cross Side Web Framework that helps us reuse objects on Server Side and Client Side, and minimize the code you need to do.

Built on Node.js, we take advantage of the language that is really crossing the line between platforms and technologies. The nature of JavaScript has become it a language that is used today in many areas like databases (MongoDB for example), web browsers, and finally Node.js that is exploding the use of JavaScript from command line to -web servers, ftp servers and socket servers-.

The problem

As a web developers and Rich Internet Applications lovers, every time we want to build a -dynamic, fancy and responsive client side- we encounter a lot of obstacles that makes things hard and a little confused, for example we can found situations like the next ones:

The MVC Model is ready for consume on server side, but we need to replicate it to JavaScript if we are going to use it on AJAX.

ResultSets are fully usables on server side, but we can't scroll or manage it on client side.

If we want to re-render parts of the web page, we need to invoke server side to re-build a then render again on client. And so many  things that we need defeat to accomplish our goals.

The main concern is that practically we need to take a lot of our server side stuff, then port and replicate it to JavaScript on the client side. That's a very huge way and a waste of time and resources that can be used to improve other aspects of a web project.

What Slot does?

Seamless the main goal in Slot is:

Generate a MVC layer for your project that reuse the same code on client and server side, taking your web design as a pattern.

But to make it happens, it's absolutely necessary stay clear with the basic concepts to use Slot Framework.

Designing / Prototyping

TODO: Change this introductory paragraph

                        Learn the most important principle in Slot, how to orchestrate your page in fragments, and how to reuse them on many pages.
                        Also you can use dynamic data to populate your page without necessity of database connections...

Simple and Natural Web Oriented

Taking the premise that the native environment of a browser is compounded for HTML+CSS+JavaScript, and today's trending in web designs requires HTML5+CCS3 to guarantee responsive and functionality in a wide range of screen sizes.

We have built Slot Framework keeping this premises on mind, and we offers a way to use this technologies without necessity of server side controls. And maintaining the clean and pure use of HTML, saving the extra layers that server side controls wraps over native HTML+CSS.

That's why today's disruptive client side frameworks are the perfect option to work with Slot, we can accomplish excellent results and a plethora of screen sizes using;
                            Bootstrap,
                            Zurb Foundation,
                            Yahoo UI,
                            JQuery,
                            JQuery UI
                            and many others powerful JavaScript frameworks.

In conclusion, Slot is not a server side controls oriented framework, instead is intended to use HTML5 tools.

Design and Prototyping First Oriented

One of the most emphasis point we have done, is going to the rescue for the good practices and better methodologies, and that's the case of Design Stage.

Many times building web sites, we have encountered situations in which the rush force us to dedicate a minimum time for the design stage, that is a very bad decision, and will impact the quality of final product. Furthermore, in many  cases when we need to create a very functional prototype, we start creating a lite web page with a few data, and probably we need to do some server side code to accomplish the prototype.

Design stage is a precious time to detect and define the data-models we are going to use in the development stage, but really we don't take advantage of this opportunity. It's a perfect moment that can be used to link our data-models with the database structures. No matter what the situation we affront on design stage or prototyping, in the majority of cases we lost the time invested on, because we don't get focused on reuse 100% of the output from this stage.

Slot put the focus on reuse every piece of work you have done on design/prototyping, that is why Slot provide a methodology to organize the page in fragments, and to define the data-models that fragments will be using. Finally based on those definitions, Slot generates a MVC layer ready to use on development stage, this layer can be used in server and client side too.

Inside a Slot Project

Learn the ways to create a project, and take a full view of the internal structure.

Creating a project (slot command line)

This feature will be ready when Slot Command Line has been released.
                            Meanwhile, those prompt lovers can easily build a slot project following the next manual step by step.

Creating a project (manually)

TODO: pending to complete

                                    Steps to create a project

                                            1

                                                Execute the command line:

$ mkdir /your-project-path/mySlotProject
$ cd /your-project-path/mySlotProject

$ npm init

It only covers the most common items, and tries to guess sane defaults.
...
...
Press ^C at any time to quit.

                                                Complete basic configurations, the command will be asking to you for many values, use "mySlotProject" as a name for demo purposes:

name: (nodeModule) mySlotProject
version: (0.0.0)
description: Description for your project
entry point: (index.js)
test command:
git repository:
keywords:
author: Carlos Echeverria
license: (ISC) MIT

                                                As a result the command will create a packaje.json file:

About to write to /your-project-path/mySlotProject/package.json:

{
    "name": "mySlotProject",
    "version": "0.0.0",
    "description": "Description for your project",
    "main": "index.js",
    "scripts": {
        "test": "echo \"Error: no test specified\" && exit 1"
    },
    "author": "Carlos Echeverria",
    "license": "MIT"
}

                                            2
                                            Up to this point the project has been created, but you need to
                                                add "SlotFramework" as a dependency in the project.
                                                To do that you need to add the next node in the package.json file:

{
    "name": "myFirstModule",
    "version": "0.0.0",
    "description": "Description for your project",
    "main": "index.js",
    "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
    },
    "author": "Carlos Echeverria",
    "license": "MIT",
    "dependencies":{
        "slot-framework": "1.0.0"
    }
}

                                            3
                                            To complete the setup, is necessary download and install all dependencies in the proyect.
                                                To do that you need to execute the next command line:

$ cd /your-project-path/mySlotProject
$ npm install

npm WARN package.json myFirstModule@0.0.0 No repository field.
npm WARN package.json myFirstModule@0.0.0 No README data
npm http GET https://registry.npmjs.org/mime/1.2.11
npm http 304 https://registry.npmjs.org/mime/1.2.11
mime@1.2.11 node_modules\mime

                                                Finally the command has installed all the necessaries packages and modules into the project,
                                                all of them were created on folder /your-project-path/mySlotProject/node_modules:

$ ls -ltr node_modules/
total 24
drwxr-xr-x+ 1 cecheveria     None 0 Jun  5 18:12 bower
drwxr-xr-x+ 1 cecheveria     None 0 Jun  5 18:12 grunt
drwxr-xr-x+ 1 cecheveria     None 0 Jun  5 18:12 grunt-contrib-clean
drwxr-xr-x+ 1 cecheveria     None 0 Jun  5 18:12 grunt-contrib-concat
drwxr-xr-x+ 1 cecheveria     None 0 Jun  5 18:12 grunt-contrib-less
drwxr-xr-x+ 1 cecheveria     None 0 Jun  5 18:12 grunt-contrib-watch

Project Structure

Once the project has been created, it will containt a lot folders and the project configuration set in the slot.json file.
                            It declares paths to folders and key attributes to use in the project.

                                    Slot.json file

{
    metaData:     "/bind",
    webRootDir:   "/www",
    mvcRootDir:   "/app/mvc",
    restRootDir:  "/app/rest",
    dbRootDir:    "/app/db",
    restFilter:   "/rest",
    mvcFilter:    "/mvc"
}

                                    Slot.json attributes

                                                Name
                                                description

                                                metaData
                                                By default is set to /bind, this attribute points to the folder that holds
                                                    the fragments definitions used on design time.

                                                webRootDir
                                                By default is set to /www, this attribute points to the folder that holds
                                                    the resources used in the project; html files, css files, images, javascript files,
                                                    and any other content needed to build the project.

                                                mvcRootDir
                                                By default is set to /app/mvc, remember that Slot is a built in MCV framework, and to maintain separated layers,
                                                    the mvcRootDir attribute was created to point to the folder that holds
                                                    the auto generated MVC resources.

                                                    See Generating MVC Layer

                                                restRootDir
                                                By default is set to /app/rest,
                                                    this attribute points to the folder that holds
                                                    the REST Api Methods created in the project.

                                                    See Rest Api in action

                                                dbRootDir
                                                By default is set to /app/db,
                                                    this attribute points to the folder that holds
                                                    the Data Access Objects used to interact with databases, data storages and many other data sources.

                                                restFilter
                                                By default is set to /rest, this attribute holds the URL path
                                                    used to filter all REST Service calls.

                                                    Example:

                                                    If the restFilter attribute points to /rest
                                                    and the REST Service to be consumed is /examples/contacts,
                                                    then, the end point url to consume this service will be /rest/examples/contacts.
                                                    Any other url will be unresolved.

                                                mvcFilter
                                                By default is set to /mvc, this attribute holds the URL path
                                                    used to filter all MVC Object requests.

                                                    Example:

                                                    If the mvcFilter attribute points to /mvc
                                                    and the MVC Object to be downloaded is the /examples/mContact.js model,
                                                    then, the end point url to consume this object will be /mvc/examples/mContact.js.
                                                    Any other url will be unresolved.

Page Components

An easy way to understand the internal page structure,
                            is taking in mind that a web page contains spaces where page portions can be inserted.
                            Learn how to orchestrate this portions, and how to reuse them on many pages.

                                    Components TODO: complete explanation

                                                Name
                                                description

                                                Slots
                                                The Slot is the page space where a portion of data will be inserted.
                                                    To declare a Slot you must use the next syntax in the html template: {@slotName@}.

                                                Fragments
                                                The Fragment is the page portion that will be inserted in a Slot.

A Fragment is central unit of design.

A Fragment is binded to a HTML template

A Fragment contains Attributes.

                                                Attributes

An Attribute is a minimal unit of design,
                                                        it contains a simple values like names, numbers, simple texts, etc.
                                                        Also, an attr can contain any complex data you want to display in the page.

An attribute can be defined as a Slot, furthermore, a fragment can contain many slots.

The next is an example of a how to declare simple Slots on Design Time,
                           we have taken the Contact example page from our tutorials.
                           In this case just two simple attributes were defined in the page, userName and userNumber:

                                    Simple Slots in /www/examples/contacts.html (on webRootDir folder)

<!DOCTYPE html>
<html>
    <head lang="en">
        <meta charset="UTF-8">
        <title></title>
    </head>
    <body>
        <p>Hi {@useName@}, this is a demo of declaring slots</p>
        <p>You are the user number: {@userNumber@}</p>
    </body>
</html>

                                    Fragment definition in /bind/examples/contacts.json (on metaData folder)

{
    binds: {
        userName:"Jhon Doe",
        userNumber:"#00001"
    }
}

MVC Layer

Parting from a well done Design Stage with a depurated UI, and a clean metadata Model, is time to pass to your Development Stage.
                    One of the main advantages of Slot's MVC, is that model objects can be used on client and server side, and controller object can be used to render fragments on both sides too.

Generating layer (refreshing page)

Base on the previous Slots and Fragments used on Design Time (see page components section ), the framework will Auto generate MVC Objects to be used on Development Time,
                            a complete MVC Layer will be created on mvcRootDir folder.
                            This generation will happen each time you refresh a page directly from your browser, you can see next the details of each object that will be generated.

                                    Generated MVC Objects

                                            Name
                                            description

                                            Server Side View
                                            vContacts.js

An Attribute is a minimal unit of design,

An attribute can be defined as a Slot, furthermore, a fragment can contain many slots.

                                                TODO: explain syntax

                                            Server Side Model
                                            mContactsSrv.js

An Attribute is a minimal unit of design,

An attribute can be defined as a Slot, furthermore, a fragment can contain many slots.

                                                TODO: explain syntax

                                            Client Side Model
                                            mContacts.js

An Attribute is a minimal unit of design,

An attribute can be defined as a Slot, furthermore, a fragment can contain many slots.

                                                TODO: explain syntax

                                    Sample of Client Side Model /app/mvc/examples/mContacts.js

/**
 * Created using Slot Framework
 * Object model that represents the main Slot
 */
function main() {
    this.userName = "";
    this.userNumber = "";
}
main.create = function() { return new main(); }
main.prototype.layout = function() { return page.layouts["main"]; }
main.prototype.bind = function(json) {
    return this;
}
main.prototype.onPreRender = function() {
    return this;
}

Generating layer (slot command line)

This feature will be ready when Slot Command Line has been released.
                            Meanwhile, those prompt lovers can easily generate the MVC Layer using the refreshing page.

Binding Databases

Include Node.js Drivers in your project to connect with
                        MySQL,
                        MariaDB,
                        SQLite,
                        PostgreSQL,
                        MS SqlServer,
                        MongoDB
                        and many others.
                        Get knowledge of tips and tricks to lean and faster binding with the MVC Layer...

Equals Slot.attributes and Database.field-names

                        TODO: Complete this section

The API implements a stadarized output response

REST Api in action

This api offers the opportunity to do lean web services implementations,
                        now developers can enjoy a faster way to create RESTful services backed on modules,
                        and relay on Default Convention to ease your work.
                        Learn how to return Single Objects and Array Objects,
                        what you need to scroll lot of data using Native Server Side Pagination,
                        and how to consume services.

How to implement REST Modules?

REST Modules are the core in the Api and the most easy to implement feature,
                            every time you want to serve a web service method you must implement a REST Module.
                            Also, there are a few steps you need to follow to create an effective module.

                                    Steps to implement a REST Module

                                                1
                                                Identify your REST folder, the default path for this folder is /app/rest
                                                    but you can change it at your desire in the slot.json config file.
                                                    This folder must contain all the REST Module you want to serve

                                                2
                                                Define a name space for your module, this name space will be the URL path used to invoke your service, by example you can define /examples/contacts as your name space

                                                3
                                                Define a module name, supposing you are going to name it as search,
                                                    then you need to create the search.js javascript file in the REST folder.
                                                    Note that module name and javascript file are syntactically equals.

                                                4
                                                Base on the name space and module name , the URL for consume the service will be /examples/contacts/search

                                                5
                                                Finally, you need to ensure that the REST module complies with the default convention and implements the Module functions and parameters

The next is an example of a plain REST Module, and the detailed table of functions and parameters to complie:

                                    REST Module

var Slot = require('slotFramework');

function run(request,
             callback) {

    var data = new Object();
    /*"set attributes to object data"*/

    callback(data /*<<== "data to be saved on session"*/);
}

module.exports.run = run;

                                    Module functions and parameters

                                                Name
                                                description

                                                run
                                                The run function is required, it is executed for the main controller when the REST service is consumed.
                                                    If this function is not declared, an error will be throwed.

                                                data
                                                Is a local variable declared in the module, and it represents the response that your REST service will return

                                                request
                                                Is a parameter that main controller passes to run function.
                                                    It encapsulates a HTTP style request, containing the request line, headers and content body

                                                callback
                                                The callback function is a parameter that main controller passes to run function,
                                                    you must invoke the callback at the end of your module execution, and must pass the data variable as a callback parameter

                                                exports.run
                                                In order to complie with a Node.js module definition, you must set the run function to exported objects in the module.
                                                    If this function is not exported, the main controller can not execute it, and an error will be throwed

Default convention

In order to standardize the output response, all REST services will return the same response body.
                            Taking the previous REST Module example, the corresponding output will be the next:

                                    Response body

{
    error: 0,
    msg: "",
    data: {}
}

                                    Response attributes

                                                Name
                                                description

                                                error
                                                By default it returns a cero int value.

Reserved values:

0 = execution was successful

1 = execution has fail and there are errors

Also you can return any int value to handle you error situations.

                                                msg
                                                Response message by default is an empty String, but you can return any statement to handle your alerts.

Example:

"Your transaction was successfully executed"

"Problems executing your transaction"

                                                data
                                                Structured data contains a single JSON object with many attributes inside,
                                                    also it can contain a paginated array when the REST service handle a JSON array on server side

Returning single objects

Implements a this kind of service when you want return a single JSON object, a contact information, a car detail or a just single pack on information.
                            If you want to return a list of objects, absolutely this is not the kind of service tou need to implement, to handle lists better refer to Returning array objects.

                                    Server side JavaScript

var Slot = require('slotFramework');

function run(request,
             callback) {

    var data = new Object();
    data.name = "Jhon";
    data.lastName = "Doe";
    data.birhtD = (new Date()).getTime();

    callback(data /*<<== "data to be saved on session"*/);
}

module.exports.run = run;

                                    Response body

{
    error: 0,
    msg: "",
    data: {
        name: "Jhon",
        lastName: "Doe",
        birhtD: 1402546374639
    }
}

Returning array objects

Implement this kind of service when you want return a JSON array, a contact list, a car list or a list of items from a search.
                            By convention JSON arrays are automatically paginated by the framework and must be consumed using the
                            Native Server Side Scrolling.

                                    Server side JavaScript

var Slot = require('slotFramework');

function run(request,
             callback) {

    var data = [];
    for(x=0; x<10; x++){
        var obj = new Object();
        obj.name = "Jhon " + x;
        obj.lastName = "Doe";
        obj.birhtD = (new Date()).getTime();

        data[x] = obj;
    }

    callback(data /*<<== "data to be saved on session"*/);
}

module.exports.run = run;

                                    Response body

{
    error: 0,
    msg: "",
    data: {
        page: [
            { /* record One */ },
            { /* record Two */ },
            { /* record Three */ },
            { /* record Four */ }
        ],
        totalRows: 10,
        totalPages: 3,
        pageNumber: 1,
        pageSize: 4
    }
}

                                    Data attributes

                                                Name
                                                description

                                                page
                                                A chunk from a paginated array, it holds a number of records
                                                    specified by the pageSize attribute

                                                totalRows
                                                Number of rows on server side buffer

                                                totalPages
                                                Number o pages to scroll

                                                pageNumber
                                                Current page number

                                                pageSize
                                                Number of records per page

How to consume services?

The API implements a stadarized output response

                                    Invoke a REST service

# Hit a service and set a callback wraper
http://127.0.0.1:81/rest/examples/contacts/search?callback=fnc

# Hit a service and set the page size, the number of records
# to be returned on each page
http://127.0.0.1:81/rest/examples/contacts/search?pageSize=4

Native Server Side Scrolling

The API implements a stadarized output response

                                    Scrolling data back and forward

# Set cursor on first record
http://127.0.0.1:81/rest/examples/contacts/search/first

# Set cursor on next record
http://127.0.0.1:81/rest/examples/contacts/search/next

# Step back cursor to previous record
http://127.0.0.1:81/rest/examples/contacts/search/back

# Set cursor on last record
http://127.0.0.1:81/rest/examples/contacts/search/last

# Get current record
http://127.0.0.1:81/rest/examples/contacts/search/current

Managing Themes

Explore themes

Install themes

                            Introducing Slot

The problem

What Slot does?

                            Designing / Prototyping

Simple and Natural Web Oriented

Design and Prototyping First Oriented

                            Inside a Slot Project

Creating a project (slot command line)

Creating a project (manually)

Project Structure

Page Components

                            MVC Layer

Generating layer (refreshing page)

Generating layer (slot command line)

                            Binding Databases

Simple and Natural Web Oriented

                            REST Api in action

How to implement REST Modules?

Default convention

Returning single objects

Returning array objects

How to consume services?

Native Server Side Scrolling

                            Managing Themes

Explore themes

Install themes

OneTheme

Simplistic and live colors

This is the official theme used on Slot Framework,
                            a cross side oriented web framework.
                            OneTheme is open sourced, based on Bootstrap 3.1.1,
                            and you can download and use it on any other project.
                            Also you can fork it on Github.

                        Thanks so much to Thomas Park and Bootswatch/yeti theme, an initial inspiration for OneTheme..

Download this theme

                            <h4x>bootstrap.min.css</h4x>

                            <h4x>bootstrap.css</h4x>

                            <h4x>variables.less</h4x>

                            <h4x>bootswatch.less</h4x>

                    Install instructions

Navbars

                                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-success-collapse">

                                </button>
                                Brand

Thumbnails

Watermarked thumbnails

Thumbnail label

Put you text in this paragraph and see how pretty looks. Add more lorem ipsum dolor sit amet, consectetur adipiscing elit.

Button Button

                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>

Source Code

Back to top

Blog

RSS

Twitter

GitHub

                            Donate

Made by Carlos Echeverría. Contact him at slotframework@gmail.com.

Code released under the MIT License.


text:
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated by org.testng.reporters.JUnitXMLReporter -->
<testsuite hostname="INIZAMIYEVA" name="Default test" tests="6" failures="0" timestamp="25 Dec 2014 10:29:08 GMT" time="10.78" errors="0">
  <testcase name="testEmptyGroupCreation" time="1.203" classname="com.example.tests.AddNewCreationTests"/>
  <testcase name="testNonEmptyGroupCreation" time="0.986" classname="com.example.tests.AddNewCreationTests"/>
  <testcase name="testEmptyGroupCreation" time="0.912" classname="com.example.tests.GroupCreationTests"/>
  <testcase name="testNonEmptyGroupCreation" time="0.939" classname="com.example.tests.GroupCreationTests"/>
  <testcase name="addNewContactWithData" time="1.518" classname="com.example.tests.AddNewContactTests"/>
  <testcase name="addNewContactWithoutData" time="1.189" classname="com.example.tests.AddNewContactTests"/>
</testsuite> <!-- Default test -->


text:
/*
 The graph is implemented unsing a Adjecency List, which is a
 vector of a vector of Edge. The other fields: costs, paths,
 and known, are utilize to keep track of the shortest cost, the path,
 and  whether or not that node had been visited, respectively.
 */
#ifndef __Graph__
#define __Graph__

#include <stdio.h>
#include <vector>
#include "Edge.h"
#include <list>
#include <string>
#include <iostream>
#include <cmath> //for INFINITY
using namespace std;

class Graph{
public:
    /*
     *It takes the number of vertices as an argument
     *(nrVetices). It resizes the adjacency list to
     *nrVetices, and pushes nrVertices times
     *INFINITY, -1, and false, into costs, path, and
     *known, respectively
     * @param nrVertices
     */
    void startBuild(int nrVertices);

    //default constructor
    Graph();

    /*
     *addEdge adds an EdgeNode to the adjList. It
     *takes as a parameter, start, end and weight.
     *The node's fields dest and weight are given
     *end and weight and it is inserted in
     *adjList[start].
     *
     * @param start
     * @param end
     * @param weight
     */
    void addEdge(int start, int end, double weight);

    /*
     Accesor method that returns costs.
     */
    vector<double>& getCosts();

    /*
     Accesor method that returns path.
     */

    vector<int>& getPath();

    /*
     Accesor method that returns known.
     */
    vector<bool>& getKnown();

    /*
     Setter method for Known
     */
    vector<bool>& setKnown(int ver);
    /*
     Accesor method that returns adjList.
     */
    vector< vector<Edge> >& getList();

private:
    /*
     *adjList is an adjacency list made of a vector of a
     *vector of edgeNodes. Each entry in the vector
     *represents a vertices, and each of the edgeNodes
     *represent the edges that are connected to each vertex.
     *If the cost of vertex i is MAX_INT, path does not exist
    */
    vector< vector<Edge> > adjList;

    /*
     *costs is used to keep track of the lowest cost to get
     *to each of the vertices from the initial vertex.
     */
    vector<double> costs;

    /*
     *path is a vector of integers that keeps track of the
     *shortest path to get to each of the vertices.
     */
    vector<int> path;

    /*
     *known is used to indicate whether a vertex in the
     *graph has been visited or not. If known is true, it
     *means that the shortest cost and the appropriate path
     *of that vertex is known.
     */
    vector<bool> known;

};
#include "Graph.cpp"
#endif


text:
Publish PGP Keys
================
![CI](https://github.com/PartTimeLegend/Publish-PGP-Keys/workflows/CI/badge.svg)

What is PGP?
-----------

>"Pretty Good Privacy (PGP) is a data encryption and decryption computer program that provides cryptographic privacy and authentication for data communication.
>PGP is often used for signing, encrypting and decrypting texts, e-mails, files, directories and whole disk partitions to increase the
security of e-mail communications.
>It was created by Phil Zimmermann in 1991.
PGP and similar products follow the OpenPGP standard (RFC 4880 ) for encrypting and decrypting data." -- [Wikipedia](http://en.wikipedia.org/wiki/Pretty_Good_Privacy)

Why would I need them?
---------------------

If you wish to send communications and encrypt the data being transmitted you can use public key and private keypair cryptology. This means that only the intended recipiant can read the contents of your communication.

Requirements
------------

You need to have `curl` suppport.

On Debian based systems you can install via:

`apt-get install curl`

On Red Hat based systems you can install via:

`yum install curl`

On Windows I recommend [Cygwin](http://cygwin.org).

Why did you do this?
--------------------

Boredom mainly. I really like automation of tasks, and as I have a repo for [my public keys](https://github.com/PartTimeLegend/PGPKeys) I wanted a way to have these use Githug Actions to validate and publish the keys so I don't have to.

How can I use PGP?
------------------

You should download a Keyring application. Some examples of which are:

* [GnuPG](http://www.gnupg.org)
* [Gpg4win](http://www.gpg4win.org)

It is personal preference. Please ensure you are using a secure application that has been peer reviewed. I would recommend you look for a program with open source code so you can build yourself to ensure that you have a clean install.


text:
function zipUrl=getZipURL(url,branchName)
    % masiv.pluginManager.getZipURL
    %
    % Convert the WWW URL or the Git URL to the url of the zip file containing the archive of the latest master branch commit
    %
    % Private method
    if nargin<2
        branchName = masiv.pluginManager.defaultBranchName;
    end
    zipUrl = regexprep(url,'\.git$', '');
    zipUrl = [zipUrl,'/archive/',branchName,'.zip'];
end


text:
package pidstat

import (
	"math"
	"testing"
	"time"

	"github.com/square/inspect/metrics"
)

func TestPidstatCPU(t *testing.T) {
	root = "testdata/t0/"
	// Initialize a metric context
	m := metrics.NewMetricContext("system")
	pstat := NewProcessStat(m, time.Millisecond*50)
	time.Sleep(time.Millisecond * 1000)
	root = "testdata/t1/"
	time.Sleep(time.Millisecond * 1000)
	root = "testdata/t2/"
	time.Sleep(time.Millisecond * 1000)
	root = "testdata/t3/"
	var expected float64 = 0.5
	actual := pstat.ByCPUUsage()[0].CPUUsage()
	if math.Abs(actual-expected) > 0.01 {
		t.Errorf("CPU usage for top pid: %v expected: %v", actual, expected)
	}
}

func TestPidstatMem(t *testing.T) {
	root = "testdata/t0/"
	// Initialize a metric context
	m := metrics.NewMetricContext("system")
	pstat := NewProcessStat(m, time.Millisecond*50)
	time.Sleep(time.Millisecond * 1000)
	root = "testdata/t1/"
	time.Sleep(time.Millisecond * 1000)
	var expected float64 = 1.794048e+06
	actual := pstat.ByMemUsage()[0].MemUsage()
	if math.Abs(actual-expected) > 0.01 {
		t.Errorf("Mem usage for top pid: %v expected: %v", actual, expected)
	}
}


text:
/* Layout helpers
----------------------------------*/
.ui-helper-hidden { display: none; }
.ui-helper-hidden-accessible { position: absolute; left: -99999999px; }
.ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; }
.ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; }
.ui-helper-clearfix { display: inline-block; }
/* required comment for clearfix to work in Opera \*/
* html .ui-helper-clearfix { height:1%; }
.ui-helper-clearfix { display:block; }
/* end clearfix */
.ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); }

/* Interaction Cues
----------------------------------*/
.ui-state-disabled { cursor: default !important; }

/* Icons
----------------------------------*/

/* states and images */
.ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; }

/* Misc visuals
----------------------------------*/

/* Overlays */
.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }

/* Resizable
----------------------------------*/
.ui-resizable { position: relative;}
.ui-resizable-handle { position: absolute;font-size: 0.1px;z-index: 99999; display: block;}
.ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; }
.ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0px; }
.ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0px; }
.ui-resizable-e { cursor: e-resize; width: 7px; right: -5px; top: 0px; height: 100%; }
.ui-resizable-w { cursor: w-resize; width: 7px; left: -5px; top: 0px; height: 100%; }
.ui-resizable-se { cursor: se-resize; width: 12px; height: 12px; right: 1px; bottom: 1px; }
.ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; }
.ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; }
.ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px;}

/* Tooltip
----------------------------------*/
.ui-tooltip {
	padding: 8px;
	position: absolute;
	z-index: 9999;
	max-width: 300px;
	-webkit-box-shadow: rgba(0, 0, 0, .1) 0px 1px 3px;
	-moz-box-shadow: rgba(0, 0, 0, .1) 0px 1px 3px;
	box-shadow: rgba(0, 0, 0, .1) 0px 1px 3px;
	color: #000;
	font-family: sans-serif;
	font-size: 70%;
	font-weight: bold;
	text-transform: uppercase;
}

body .ui-tooltip {
	border-width: 1px;
}

.ui-tooltip,
.arrow:after {
	background: #eee;
	border: 1px solid #bbbbbb;
}

.arrow {
	width: 70px;
	height: 16px;
	overflow: hidden;
	position: absolute;
	left: 50%;
	margin-left: -35px;
	bottom: -16px;
}

.arrow.top {
	top: -16px;
	bottom: auto;
}

.arrow.left {
	left: 20%;
}

.arrow:after {
	content: "";
	position: absolute;
	left: 20px;
	top: -20px;
	width: 25px;
	height: 25px;
	box-shadow: 6px 5px 9px -9px rgba(0, 0, 0, .1);
	-webkit-transform: rotate(45deg);
	-ms-transform: rotate(45deg);
	transform: rotate(45deg);
}

.arrow.top:after {
	bottom: -20px; top: auto;
}


text:
from django.db import migrations, models

class Migration(migrations.Migration):

    dependencies = [
        ('huntserver', '0056_auto_20200418_1151'),
    ]

    operations = [
        migrations.RemoveField(
            model_name='team',
            name='last_received_message',
        ),
        migrations.RemoveField(
            model_name='team',
            name='last_seen_message',
        ),
        migrations.AddField(
            model_name='team',
            name='num_waiting_messages',
            field=models.IntegerField(default=0, help_text='The number of unseen messages a team has waiting'),
        ),
    ]


text:
package testdata

//go:generate bash -c ./generate.bash