text:
package org.bosphorus.core.expression.scalar.executor.event;

import org.bosphorus.core.expression.scalar.executor.IScalarExecutor1;
import org.bosphorus.core.expression.scalar.executor.IScalarExecutor3;

public class ExpressionExecutor3<TInput, TOutput, TType1, TType2, TType3> implements IScalarExecutor1<TInput, TOutput> {
	private IScalarExecutor3<? super TType1, ? super TType2, ? super TType3, ? extends TOutput> expressionExecutor;
	private IScalarExecutor1<? super TInput, ? extends TType1> parameterExecutor1;
	private IScalarExecutor1<? super TInput, ? extends TType2> parameterExecutor2;
	private IScalarExecutor1<? super TInput, ? extends TType3> parameterExecutor3;

	public ExpressionExecutor3(
			IScalarExecutor3<? super TType1, ? super TType2, ? super TType3, ? extends TOutput> expressionExecutor,
			IScalarExecutor1<? super TInput, ? extends TType1> parameterExecutor1,
			IScalarExecutor1<? super TInput, ? extends TType2> parameterExecutor2,
			IScalarExecutor1<? super TInput, ? extends TType3> parameterExecutor3
	) {
		this.expressionExecutor = expressionExecutor;
		this.parameterExecutor1 = parameterExecutor1;
		this.parameterExecutor2 = parameterExecutor2;
		this.parameterExecutor3 = parameterExecutor3;
	}

	@Override
	public TOutput execute(TInput input) throws Exception {
		return expressionExecutor.execute(parameterExecutor1.execute(input), parameterExecutor2.execute(input), parameterExecutor3.execute(input));
	}

	@Override
	public void reset() {
		expressionExecutor.reset();
		parameterExecutor1.reset();
		parameterExecutor2.reset();
		parameterExecutor3.reset();
	}

	@Override
	public Object getState() {
		return new Object[] {
				expressionExecutor.getState(),
				parameterExecutor1.getState(),
				parameterExecutor2.getState(),
				parameterExecutor3.getState()
		};
	}

	@Override
	public void setState(Object state) throws Exception {
		Object[] arr = (Object[])state;
		expressionExecutor.setState(arr[0]);
		parameterExecutor1.setState(arr[1]);
		parameterExecutor2.setState(arr[2]);
		parameterExecutor3.setState(arr[3]);
	}

}


text:
(function(){
    angular
        .module("WebAppMaker")
        .factory('WebsiteService', websiteService);

    function websiteService($http) {

        var api = {
            "createWebsite": createWebsite,
            "findWebsitesByUser": findWebsitesByUser,
            "findWebsiteById": findWebsiteById,
            "updateWebsite":updateWebsite,
            "deleteWebsite":deleteWebsite
        };
        return api;

        function createWebsite(userId, website) {
            return $http.post("/api/user/"+userId+"/website",website);
        }

        function findWebsiteById(wid) {
            return $http.get("/api/website/"+wid);
        }

        function findWebsitesByUser(userId) {
            return $http.get("/api/user/"+userId+"/website");
        }

        function updateWebsite(wid, website) {
            return $http.put("/api/website/"+wid, website);
        }

        function deleteWebsite(wid) {
            return $http.delete("/api/website/"+wid);
        }
    }
})();

redpajama_set_name: RedPajamaGithub


text:
package io.github.retz.scheduler;

import io.github.retz.db.Database;
import io.github.retz.protocol.data.*;
import org.apache.mesos.Protos;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;
import java.util.List;
import java.util.Map;
import java.util.Optional;

public final class Applications {
    private static final Logger LOG = LoggerFactory.getLogger(Applications.class);

    private Applications() {
    }

    public static Optional<Application> get(String appName) throws IOException {
        return Database.getInstance().getApplication(appName);
    }

    public static boolean load(Application application) throws IOException {
        return Database.getInstance().addApplication(application);
    }

    @Deprecated
    public static void unload(String appName) throws IOException {
        // Volumes are destroyed lazily
        LOG.info("deleting {}", appName);
        Database.getInstance().safeDeleteApplication(appName);
    }

    public static List<Application> getAll() throws IOException {
        return Database.getInstance().getAllApplications();
    }

    public static List<Application> getAll(String id) throws IOException {
        return Database.getInstance().getAllApplications(id);
    }

    public static Protos.ContainerInfo appToContainerInfo(Application application) {
        Container container = application.container();
        DockerContainer c = (DockerContainer) container;

        Protos.ContainerInfo.Builder builder = Protos.ContainerInfo.newBuilder().setMesos(
                Protos.ContainerInfo.MesosInfo.newBuilder()
                        .setImage(Protos.Image.newBuilder()
                                .setType(Protos.Image.Type.DOCKER)
                                .setDocker(Protos.Image.Docker.newBuilder()
                                        .setName(c.image()))))
                .setType(Protos.ContainerInfo.Type.MESOS);

        for (DockerVolume volume : c.volumes()) {
            Protos.Volume.Source.DockerVolume.Builder dvb = Protos.Volume.Source.DockerVolume.newBuilder()
                    .setDriver(volume.driver()) // like "nfs"
                    .setName(volume.name()); // like "192.168.204.222/"
            Protos.Parameters.Builder p = Protos.Parameters.newBuilder();
            for (Object key : volume.options().keySet()) {
                p.addParameter(Protos.Parameter.newBuilder()
                        .setKey((String) key)
                        .setValue(volume.options().getProperty((String) key))
                        .build());
            }
            if (!p.getParameterList().isEmpty()) {
                dvb.setDriverOptions(p.build());
            }

            Protos.Volume.Builder vb = Protos.Volume.newBuilder()
                    .setContainerPath(volume.containerPath()) // target path to mount inside container
                    .setSource(Protos.Volume.Source.newBuilder()
                            .setType(Protos.Volume.Source.Type.DOCKER_VOLUME)
                            .setDockerVolume(dvb.build()));

            switch (volume.mode()) {
                case RW:
                    vb.setMode(Protos.Volume.Mode.RW);
                    break;
                case RO:
                default:
                    vb.setMode(Protos.Volume.Mode.RO);
            }
            builder.addVolumes(vb);
        }

        return builder.build();
    }

    public static Protos.CommandInfo appToCommandInfo(Application application, Job job, List<Range> ports, String defaultUnixUser) {

        Protos.CommandInfo.Builder builder = Protos.CommandInfo.newBuilder();
        builder.setUser(application.getUser().orElse(defaultUnixUser));

        for (String file : application.getFiles()) {
            builder.addUris(Protos.CommandInfo.URI.newBuilder().setValue(file).setCache(false));
        }
        for (String file : application.getLargeFiles()) {
            builder.addUris(Protos.CommandInfo.URI.newBuilder().setValue(file).setCache(true));
        }
        Protos.Environment.Builder envBuilder = Protos.Environment.newBuilder();
        for (Map.Entry<Object, Object> e : job.props().entrySet()) {
            String key = (String) e.getKey();
            String value = (String) e.getValue();
            envBuilder.addVariables(Protos.Environment.Variable.newBuilder()
                    .setName(key).setValue(value).build());
        }
        int portCount = 0;
        for (Range range : ports) {
            for (long p = range.getMin(); p <= range.getMax(); ++p) {
                String name = "PORT" + portCount;
                envBuilder.addVariables(Protos.Environment.Variable.newBuilder()
                        .setName(name).setValue(Long.toString(p)).build()); // Though int is enough for port number...
                portCount += 1;
            }
        }
        return builder.setEnvironment(envBuilder.build())
                .setValue(job.cmd())
                .setShell(true)
                .build();
    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0"
	xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
	<persistence-unit name="Saap-jpa">
		<jta-data-source>java:/Saap</jta-data-source>
		<non-jta-data-source>java:/Saap</non-jta-data-source>
		<properties>
			<property name="hibernate.show_sql" value="false" />
		</properties>
	</persistence-unit>
</persistence>


text:
/*
 *  MRFSVolume.m
 *  MRFS
 *
 *  Created by han9kin on 2011-04-26.
 *
 */

#import "AFPServer.h"
#import "AFPListener.h"
#import "AFPVolume.h"
#import "MRFSOperations.h"
#import "MRFSServer.h"
#import "MRFSVolume.h"
#import "MRFSPrivates.h"

static void MRFSVolumeMountProc(FSVolumeOperation aVolumeOp, void *aClientData, OSStatus aErr, FSVolumeRefNum aMountedVolumeRefNum);
static void MRFSVolumeUnmountProc(FSVolumeOperation aVolumeOp, void *aClientData, OSStatus aErr, FSVolumeRefNum aVolumeRefNum, pid_t aDissenter);

@implementation MRFSVolume

#pragma mark -
#pragma mark Initializing a File System Object

- (id)initWithServer:(MRFSServer *)aServer
{
    self = [super init];

    if (self)
    {
        mVolume = [[aServer server] addVolumeWithVolume:self];

        if (!mVolume)
        {
            [self release];
            return nil;
        }

        mServer = [aServer retain];

        [mServer addVolume:self];
    }

    return self;
}

- (void)dealloc
{
    [mVolume closeVolume];
    [mServer removeVolume:self];
    [[mServer server] removeVolume:mVolume];
    [mServer release];
    [super dealloc];
}

#pragma mark -
#pragma mark Setting the Delegate

- (id<MRFSOperations>)delegate
{
    return mDelegate;
}

- (void)setDelegate:(id<MRFSOperations>)aDelegate
{
    mDelegate = aDelegate;
}

#pragma mark -
#pragma mark Configuring Properties

- (NSString *)volumeName
{
    return [mVolume volumeName];
}

- (BOOL)setVolumeName:(NSString *)aVolumeName
{
    if ([aVolumeName length])
    {
        if ([self isMounted])
        {
            return NO;
        }
        else
        {
            return [[mServer server] renameVolume:mVolume toName:[NSString stringWithUTF8String:[aVolumeName fileSystemRepresentation]]];
        }
    }
    else
    {
        return NO;
    }
}

#pragma mark -
#pragma mark Getting the File System Status

- (BOOL)isMounted
{
    return mMountPoint ? YES : NO;
}

- (NSString *)mountPoint
{
    return mMountPoint;
}

- (FSVolumeRefNum)volumeRefNum
{
    return mMountedVolumeRefNum;
}

#pragma mark -
#pragma mark Mounting and Unmounting the File System

- (void)mountAtPath:(NSString *)aMountPoint
{
    NSError *sError = nil;

    if (mMountPoint)
    {
        sError = [NSError errorWithDomain:NSPOSIXErrorDomain code:EALREADY userInfo:nil];
    }
    else if (mVolumeOperation)
    {
        sError = [NSError errorWithDomain:NSPOSIXErrorDomain code:EINPROGRESS userInfo:nil];
    }
    else
    {
        OSStatus sStatus;

        sStatus = FSCreateVolumeOperation(&mVolumeOperation);

        if (sStatus)
        {
            NSLog(@"FSCreateVolumeOperation error = %ld", (long)sStatus);

            sError = [NSError errorWithDomain:NSOSStatusErrorDomain code:sStatus userInfo:nil];
        }
        else
        {
            sStatus = FSMountServerVolumeAsync(
                (CFURLRef)[NSURL URLWithString:[NSString stringWithFormat:@"afp://%@:%hu/%@", [[mServer listener] host], [[mServer listener] port], [[self volumeName] stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]],
                (aMountPoint ? (CFURLRef)[NSURL fileURLWithPath:aMountPoint] : NULL),
                (CFStringRef)[mServer userName],
                (CFStringRef)[[mServer listener] password],
                mVolumeOperation,
                self,
                0,
                MRFSVolumeMountProc,
                CFRunLoopGetCurrent(),
                kCFRunLoopCommonModes);

            if (sStatus)
            {
                NSLog(@"FSMountServerVolumeAsync failed with status %ld", (long)sStatus);

                sError = [NSError errorWithDomain:NSOSStatusErrorDomain code:sStatus userInfo:nil];

                FSDisposeVolumeOperation(mVolumeOperation);
                mVolumeOperation = NULL;
            }
        }
    }

    if (sError && [mDelegate respondsToSelector:@selector(volume:mountDidFailWithError:)])
    {
        [mDelegate volume:self mountDidFailWithError:sError];
    }
}

- (void)unmount
{
    NSError *sError = nil;

    if (!mMountPoint)
    {
        return;
    }
    else if (mVolumeOperation)
    {
        sError = [NSError errorWithDomain:NSPOSIXErrorDomain code:EINPROGRESS userInfo:nil];
    }
    else
    {
        OSStatus sStatus;

        sStatus = FSCreateVolumeOperation(&mVolumeOperation);

        if (sStatus)
        {
            NSLog(@"FSCreateVolumeOperation error = %ld", (long)sStatus);

            sError = [NSError errorWithDomain:NSOSStatusErrorDomain code:sStatus userInfo:nil];
        }
        else
        {
            sStatus = FSUnmountVolumeAsync(
                mMountedVolumeRefNum,
                0,
                mVolumeOperation,
                self,
                MRFSVolumeUnmountProc,
                CFRunLoopGetCurrent(),
                kCFRunLoopCommonModes);

            if (sStatus)
            {
                NSLog(@"FSUnmountVolumeAsync failed with status %ld", (long)sStatus);

                sError = [NSError errorWithDomain:NSOSStatusErrorDomain code:sStatus userInfo:nil];

                FSDisposeVolumeOperation(mVolumeOperation);
                mVolumeOperation = NULL;
            }
        }
    }

    if (sError && [mDelegate respondsToSelector:@selector(volume:unmountDidFailWithError:)])
    {
        [mDelegate volume:self unmountDidFailWithError:sError];
    }
}

- (void)cancel
{
    if (mVolumeOperation)
    {
        FSCancelVolumeOperation(mVolumeOperation);
        FSDisposeVolumeOperation(mVolumeOperation);
        mVolumeOperation = NULL;
    }
}

@end

@interface MRFSVolume (MountOperationCallback)
@end

@implementation MRFSVolume (MountOperationCallback)

- (void)mountOperationDidFinishWithStatus:(OSStatus)aStatus
{
    @synchronized(self)
    {
        FSDisposeVolumeOperation(mVolumeOperation);
        mVolumeOperation = NULL;
    }

    if (aStatus && [mDelegate respondsToSelector:@selector(volume:mountDidFailWithError:)])
    {
        [mDelegate volume:self mountDidFailWithError:[NSError errorWithDomain:NSOSStatusErrorDomain code:aStatus userInfo:nil]];
    }
}

- (void)unmountOperationDidFinishWithStatus:(OSStatus)aStatus dissenter:(pid_t)aDissenter
{
    @synchronized(self)
    {
        FSDisposeVolumeOperation(mVolumeOperation);
        mVolumeOperation = NULL;
    }

    if (aStatus && [mDelegate respondsToSelector:@selector(volume:unmountDidFailWithError:)])
    {
        [mDelegate volume:self unmountDidFailWithError:[NSError errorWithDomain:NSOSStatusErrorDomain code:aStatus userInfo:[NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithInteger:aDissenter], @"dissenter", nil]]];
    }
}

@end

@implementation MRFSVolume (MountEventHandling)

- (void)didMountAtPath:(NSString *)aMountPoint volumeRefNum:(FSVolumeRefNum)aMountedVolumeRefNum
{
    @synchronized(self)
    {
        [mMountPoint autorelease];
        mMountPoint = [aMountPoint copy];

        mMountedVolumeRefNum = aMountedVolumeRefNum;

        [mServer registerDisappearCallbackForVolume:self];
    }

    if ([mDelegate respondsToSelector:@selector(volume:mountDidFinishAtPath:)])
    {
        [mDelegate volume:self mountDidFinishAtPath:aMountPoint];
    }
}

- (void)didUnmountAtPath:(NSString *)aMountPoint
{
    @synchronized(self)
    {
        [mServer unregisterDisappearCallbackForVolume:self];

        [mMountPoint release];
        mMountPoint = nil;

        mMountedVolumeRefNum = 0;
    }

    if ([mDelegate respondsToSelector:@selector(volume:unmountDidFinishAtPath:)])
    {
        [mDelegate volume:self unmountDidFinishAtPath:aMountPoint];
    }
}

@end

static void MRFSVolumeMountProc(FSVolumeOperation aVolumeOp, void *aClientData, OSStatus aStatus, FSVolumeRefNum aMountedVolumeRefNum)
{
    MRFSVolume *sVolume = aClientData;

    [sVolume mountOperationDidFinishWithStatus:aStatus];
}

static void MRFSVolumeUnmountProc(FSVolumeOperation aVolumeOp, void *aClientData, OSStatus aStatus, FSVolumeRefNum aVolumeRefNum, pid_t aDissenter)
{
    MRFSVolume *sVolume = aClientData;

    [sVolume unmountOperationDidFinishWithStatus:aStatus dissenter:aDissenter];
}


text:
package alien4cloud.it;

import org.junit.runner.RunWith;

import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;

@RunWith(Cucumber.class)
@CucumberOptions(features = {
        //
        // "classpath:alien/rest/topology"
        "classpath:alien/rest/topology/get_topology.feature",
        // "classpath:alien/rest/topology/out_properties.feature"
        // "classpath:alien/rest/topology/inputs_properties.feature"
        "classpath:alien/rest/topology/mixing_component_versions.feature",
        // "classpath:alien/rest/topology/nodetemplate_constraint.feature"
        // "classpath:alien/rest/topology/nodetemplate.feature"
        // "classpath:alien/rest/topology/nodetemplate_target_filter.feature"
        // "classpath:alien/rest/topology/relationships.feature"
        // "classpath:alien/rest/topology/replace_node_template.feature"
        "classpath:alien/rest/topology/roles_on_topologies.feature",
        // "classpath:alien/rest/topology/scaling.feature"
//         "classpath:alien/rest/topology/validate_topology.feature",
        "classpath:alien/rest/topology/validate_topology_with_meta_properties.feature",
        "classpath:alien/rest/topology/validate_deployment_topology.feature",
//        "classpath:alien/rest/topology/topology_composition.feature"
        // "classpath:alien/rest/topology/workflow_edition.feature"
        //
}, format = { "pretty", "html:target/cucumber/topology", "json:target/cucumber/cucumber-topology.json" })
// @Ignore
public class RunTopologyIT {
}


text:
package com.thesett.common.util;

import java.util.LinkedList;

/**
 * The Stack class in java.util (most unhelpfully) does not implement the Queue interface. This is an implementation of
 * a stack that does implement the Queue interface.
 *
 *

CRC Card

 *
 Responsibilities  Collaborations
 *
 Provide a queue that works as a LIFO stack.
 *

 *
 * @author Rupert Smith
 */
public class StackQueue<E> extends LinkedList<E> implements Queue<E>
{
    /**
     * Inserts the specified element into this queue, if possible.
     *
     * @param  o The data element to push onto the stack.
     *
     * @return True if it was added to the stack, false otherwise (this implementation always returns true).
     */
    public boolean offer(E o)
    {
        super.add(0, o);

        return true;
    }

    /**
     * Appends the specified element to the end of this list.
     *
     *
This method is equivalent to {@link #addLast}.
     *
     * @param  e element to be appended to this list
     *
     * @return <tt>true</tt> (as specified by {@link java.util.Collection#add})
     */
    public boolean add(E e)
    {
        super.add(0, e);

        return true;
    }
}


text:
'use strict';

//Reflections service used for communicating with the reflections REST endpoints
angular.module('reflections').factory('Reflections', ['$resource',
	function($resource) {
		return $resource('reflections/:reflectionId', {
			reflectionId: '@_id'
		}, {
			update: {
				method: 'PUT'
			}
		});
	}
]).factory('ReflectionUtilities', function() {
	var Utils = {};

	Utils.setReflection = function(ref) {
		Utils.reflection = ref;
	};

	Utils.getReflection = function() {
		return Utils.reflection;
	}

	return Utils;
});


text:
<?php defined('BASEPATH') OR exit('No direct script access allowed'); ?>

<!DOCTYPE html>

	<meta charset="utf-8">
	<title>Salsabiela Cahyahaq</title>
    <link rel="stylesheet" href="<?php echo base_url('bower_components/bootstrap/dist/css/bootstrap.min.css') ?>">

		KTM

				<a href="<?php echo base_url('index.php/Ktm/home')?>">Home

				Contact


text:
set -e
DST='../src/'

java -cp ${DST}cloud-test.jar:${DST}cloud-utils.jar com.cloud.test.utils.SignRequest $*


text:
WITH billing as (
  SELECT artifact.artifactid as artifactid, artifact.luid as artifactluid, process.daterun as daterun
  FROM processiotracker
  INNER JOIN process ON processiotracker.processid=process.processid
  INNER JOIN processtype ON process.typeid=processtype.typeid
  INNER JOIN artifact ON processiotracker.inputartifactid=artifact.artifactid
  WHERE processtype.displayname='Billing'
  AND process.daterun >= :dateRangeStart AND process.daterun < :dateRangeEnd
)
-- SELECT -------------------------------------------------------------------------
SELECT distinct

-- col: SLX-ID
case when audf3.udfvalue like 'SLX-%' then audf3.udfvalue else 'SLX-?????' end as slxid,

-- col: platform
case
  -- HiSeq
  when itype.name like 'HiSeq%' then
    case
      when pudf3.udfvalue like '______NXX' then 'HiSeq'
      when pudf3.udfvalue like '_____BB__' then 'HiSeq4000'
      when pudf3.udfvalue like '______CXX' then 'HiSeq2000'
      when pudf3.udfvalue like '______DXX' then 'HiSeqRapid'
      when pudf3.udfvalue like '______CXY' then 'HiSeqRapid'
      else 'HiSeqUnknown'
    end
  when itype.name = 'MiSeq' then
    case
      when pudf4.udfvalue = 'Nano' then 'MiSeq_Nano'
      when audf4.udfvalue like 'MiSeq Express%' then 'MiSeq_Express'
      else 'MiSeq'
    end
  when itype.name = 'NextSeq' then 'NextSeq'
  else itype.name
end as platform,

-- col: run type
case
  -- HiSeq
	when itype.name like 'HiSeq%' then
		case
			when pudf3.udfvalue like '______NXX' then 'HiSeq' || '_' || case when pudf2.udfvalue is null then 'SE' else 'PE' end ||
				case
					when cast(pudf1.udfvalue as int) = 26 and cast(pudf2.udfvalue as int) = 98 then '75'
					when cast(pudf1.udfvalue as int) = 98 and cast(pudf2.udfvalue as int) = 10 then '75'
					when cast(pudf1.udfvalue as int) = 114 and cast(pudf2.udfvalue as int) = 98 then '125'
					else pudf1.udfvalue
				end
	    when pudf3.udfvalue like '______CXX' then 'HiSeq2000' || '_' || case when pudf2.udfvalue is null then 'SE' else 'PE' end || pudf1.udfvalue
	    when pudf3.udfvalue like '______DXX' then 'HiSeqRapid' || '_' || case when pudf2.udfvalue is null then 'SE' else 'PE' end || pudf1.udfvalue
			when pudf3.udfvalue like '______CXY' then 'HiSeqRapid' || '_' ||
				case when pudf2.udfvalue is null then 'SE' else 'PE' end ||
				case
					when cast(pudf1.udfvalue as int) <= 75 then '75'
					when cast(pudf1.udfvalue as int) > 75 and cast(pudf1.udfvalue as int) <= 125 then '125'
					else pudf1.udfvalue
				end
			when pudf3.udfvalue like '_____BB__' then 'HiSeq4000' || '_' ||
		  	case when pudf2.udfvalue is null then 'SE' || pudf1.udfvalue else 'PE' ||
					case
						when cast(pudf1.udfvalue as int) <= 75 then '75'
				 		when cast(pudf1.udfvalue as int) > 75 and cast(pudf1.udfvalue as int) <= 150 then '150'
				 		else pudf1.udfvalue
					end
		    end
		  else 'HiSeqUnknown' || '_' || case when pudf2.udfvalue is null then 'SE' else 'PE' end || pudf1.udfvalue
		end
	when itype.name = 'MiSeq' then 'MiSeq' || '_' ||
	  case
		  when pudf4.udfvalue = 'Nano' then 'Nano_' ||
				case
					when cast(pudf1.udfvalue as int)+cast(coalesce(pudf2.udfvalue,'0') as int) <= 300 then 'UpTo300'
					else 'UpTo500'
				end
			else
				case
					when cast(pudf1.udfvalue as int)+cast(coalesce(pudf2.udfvalue,'0') as int) <= 150 then 'UpTo150'
					else 'UpTo600'
				end
		end
	when itype.name = 'NextSeq' then 'NextSeq' || '_' ||
		case
			when pudf4.udfvalue = 'NextSeq Mid' then 'Mid' || '_' ||
				case
					when cast(pudf1.udfvalue as int)+cast(coalesce(pudf2.udfvalue,'0') as int) <= 150 then 'UpTo150'
				 	else 'UpTo300'
				end
			else 'High' || '_' ||
				case
					when cast(pudf1.udfvalue as int)+cast(coalesce(pudf2.udfvalue,'0') as int) <= 75 then 'UpTo75'
		 			when cast(pudf1.udfvalue as int)+cast(coalesce(pudf2.udfvalue,'0') as int) > 75 and cast(pudf1.udfvalue as int)+cast(coalesce(pudf2.udfvalue,'0') as int) <= 150 then 'UpTo150'
		 			else 'UpTo300'
				end
		end
	else itype.name || '_' || case when pudf2.udfvalue is null then 'SE' else 'PE' end || pudf1.udfvalue
end as runtype,

-- col: flow-cell ID
case when pudf3.udfvalue is null then container.name else pudf3.udfvalue end as flowcell,

-- col: lane
'Lane' || containerplacement.wellyposition + 1 as lane,

-- col: yield
audf2.udfvalue as yield,

-- col: billing month
to_char(billing.daterun, 'YYYY-MM') as billingmonth

-- FROM ---------------------------------------------------------------------------
FROM process
LEFT OUTER JOIN process_udf_view as pudf1 on (pudf1.processid=process.processid AND pudf1.udfname like 'Read 1 Cycle%')
LEFT OUTER JOIN process_udf_view as pudf2 on (pudf2.processid=process.processid AND pudf2.udfname like 'Read 2 Cycle%')
LEFT OUTER JOIN process_udf_view as pudf3 on (pudf3.processid=process.processid AND pudf3.udfname = 'Flow Cell ID')
LEFT OUTER JOIN process_udf_view as pudf4 on (pudf4.processid=process.processid AND pudf4.udfname = 'Kit Type')
INNER JOIN processtype ON process.typeid = processtype.typeid
INNER JOIN installation ON process.installationid=installation.id
INNER JOIN instrument ON installation.instrumentid=instrument.instrumentid
INNER JOIN itype ON instrument.typeid=itype.typeid
INNER JOIN processiotracker ON process.processid=processiotracker.processid
INNER JOIN artifact ON processiotracker.inputartifactid=artifact.artifactid
LEFT OUTER JOIN artifact_udf_view as audf1 on (audf1.artifactid=artifact.artifactid AND audf1.udfname = 'Billable')
LEFT OUTER JOIN artifact_udf_view as audf2 on (audf2.artifactid=artifact.artifactid AND audf2.udfname = 'Yield (Mreads)')
LEFT OUTER JOIN artifact_udf_view as audf3 on (audf3.artifactid=artifact.artifactid AND audf3.udfname = 'SLX Identifier')
LEFT OUTER JOIN artifact_udf_view as audf4 on (audf4.artifactid=artifact.artifactid AND audf4.udfname = 'Workflow')
INNER JOIN billing on artifact.artifactid=billing.artifactid
INNER JOIN containerplacement ON containerplacement.processartifactid=artifact.artifactid
INNER JOIN container ON containerplacement.containerid=container.containerid
INNER JOIN artifact_sample_map ON artifact_sample_map.artifactid=artifact.artifactid
INNER JOIN sample ON artifact_sample_map.processid=sample.processid
INNER JOIN project ON sample.projectid=project.projectid

-- WHERE --------------------------------------------------------------------------
WHERE processtype.displayname like '%Run%'
AND sample.name NOT LIKE 'Genomics Control%'
AND project.name != 'Controls'
AND sample.controltypeid is null
AND audf1.udfvalue = 'Bill'

-- ORDER BY -----------------------------------------------------------------------
ORDER BY billingmonth


text:
using System;
using System.Linq;
using System.Reflection;

namespace DesertOctopus.Utilities
{
    /// <summary>
    /// Helper class for array MethodInfo
    /// </summary>
    internal static class ArrayMih
    {
        /// <summary>
        /// Calls Array.CreateInstance
        /// </summary>
        /// <returns>The method info for Array.CreateInstance</returns>
        public static MethodInfo CreateInstance()
        {
            return typeof(Array).GetMethod(nameof(Array.CreateInstance), BindingFlags.Static | BindingFlags.Public, null, new[] { typeof(Type), typeof(int[]) }, null);
        }

        /// <summary>
        /// Calls Array.SetValue
        /// </summary>
        /// <returns>The method info for Array.SetValue</returns>
        public static MethodInfo SetValueRank()
        {
            return typeof(Array).GetMethod(nameof(Array.SetValue), new[] { typeof(object), typeof(int[]) });
        }

        /// <summary>
        /// Calls Array.GetValue
        /// </summary>
        /// <returns>The method info for Array.GetValue</returns>
        public static MethodInfo GetValueRank()
        {
            return typeof(Array).GetMethod(nameof(Array.GetValue), new[] { typeof(int[]) });
        }

        /// <summary>
        /// Calls Array.GetLength
        /// </summary>
        /// <returns>The method info for Array.GetLength</returns>
        public static MethodInfo GetLength()
        {
            return typeof(Array).GetMethod(nameof(Array.GetLength));
        }

        /// <summary>
        /// Calls Array.SetValue
        /// </summary>
        /// <returns>The method info for Array.SetValue</returns>
        public static MethodInfo SetValue()
        {
            return typeof(Array).GetMethod(nameof(Array.SetValue), new[] { typeof(object), typeof(int) });
        }

        /// <summary>
        /// Calls Array.GetValue
        /// </summary>
        /// <returns>The method info for Array.GetValue</returns>
        public static MethodInfo GetValue()
        {
            return typeof(Array).GetMethod(nameof(Array.GetValue), new[] { typeof(int) });
        }

        /// <summary>
        /// Calls Array.Clone
        /// </summary>
        /// <returns>The method info for Array.Clone</returns>
        public static MethodInfo Clone()
        {
            return typeof(Array).GetMethod(nameof(Array.Clone));
        }
    }
}


text:
> Edit text in a scriptable manner.

- Replace the first occurrence of a regular expression in each line of a file, and print the result:

`sed 's/{{regex}}/{{replace}}/' {{filename}}`

- Replace all occurrences of an extended regular expression in a file, and print the result:

`sed -r 's/{{regex}}/{{replace}}/g' {{filename}}`

- Replace all occurrences of a string in a file, overwriting the file (i.e. in-place):

`sed -i 's/{{find}}/{{replace}}/g' {{filename}}`

- Replace only on lines matching the line pattern:

`sed '/{{line_pattern}}/s/{{find}}/{{replace}}/' {{filename}}`

- Delete lines matching the line pattern:

`sed '/{{line_pattern}}/d' {{filename}}`

- Print only text between n-th line till the next empty line:

`sed -n '{{line_number}},/^$/p' {{filename}}`

- Apply multiple find-replace expressions to a file:

`sed -e 's/{{find}}/{{replace}}/' -e 's/{{find}}/{{replace}}/' {{filename}}`

- Replace separator / by any other character not used in the find or replace patterns, e.g., #:

`sed 's#{{find}}#{{replace}}#' {{filename}}`


text:
var debug_log = require('debug')('mysql-connection-manager:log')
var debug_error = require('debug')('mysql-connection-manager:error')
var EventEmitter = require('events').EventEmitter
var mysql = require('mysql')

var defaultOptions = {
	autoReconnect: true,// Whether or not to re-establish a database connection after a disconnect.
	reconnectDelay: [
		500,// Time between each attempt in the first group of reconnection attempts; milliseconds.
		1000,// Time between each attempt in the second group of reconnection attempts; milliseconds.
		5000,// Time between each attempt in the third group of reconnection attempts; milliseconds.
		30000,// Time between each attempt in the fourth group of reconnection attempts; milliseconds.
		300000// Time between each attempt in the fifth group of reconnection attempts; milliseconds.
	],
	useConnectionPooling: false,// Whether or not to use connection pooling.
	reconnectDelayGroupSize: 5,// Number of reconnection attempts per reconnect delay value.
	maxReconnectAttempts: 25,// Maximum number of reconnection attempts. Set to 0 for unlimited.
	keepAlive: true,// Whether or not to send keep-alive pings on the database connection(s).
	keepAliveInterval: 30000,// How frequently keep-alive pings will be sent; milliseconds.
}

var MySQLConnectionManager = function(options, connection) {

	this.options = options || {}
	this.connection = connection || null

	this.initialize()

}

// Extend the MySQLConnectionManager prototype with the EventEmitter's prototype.
for (var key in EventEmitter.prototype)
	MySQLConnectionManager.prototype[key] = EventEmitter.prototype[key]

MySQLConnectionManager.prototype.initialize = function() {

	this.setDefaultOptions()

	if (!this.connection)
	{
		var self = this

		this.connect(function(error, connection) {

			if (error)
			{
				debug_error('Failed to establish database connection..')
				debug_error(error)
				return
			}

			debug_log('Connection established..')

			self.emit('connect', connection)

		})
	}

	if (
		!this.options.useConnectionPooling &&
		this.options.autoReconnect
	)
		this.listenForDisconnect()
	else
		// Must catch connection errors somewhere.
		this.connection.on('error', function() {})

	if (this.options.keepAlive)
		this.setKeepAliveInterval()

}

MySQLConnectionManager.prototype.connect = function(cb) {

	if (this.options.useConnectionPooling)
		this.createPool(cb)
	else
		this.createConnection(cb)

}

MySQLConnectionManager.prototype.createConnection = function(cb) {

	debug_log('Creating new database connection..')

	var connection = mysql.createConnection(this.options)

	connection.connect(function(error) {

		if (error)
			return cb(error)

		cb(null, connection)

	})

	if (this.connection)
		this._overwriteConnectionObject(connection)
	else
		this.connection = connection

}

MySQLConnectionManager.prototype.createPool = function(cb) {

	debug_log('Creating new database connection pool..')

	var connection = mysql.createPool(this.options)

	connection.on('error', cb)

	connection.on('connection', function() {

		cb(null, connection)

	})

	if (this.connection)
		this._overwriteConnectionObject(connection)
	else
		this.connection = connection

}

MySQLConnectionManager.prototype._overwriteConnectionObject = function(newConnection) {

	for (var key in newConnection)
		this.connection[key] = newConnection[key]

	for (var key in this.connection)
		if (typeof newConnection[key] == 'undefined')
			this.connection[key] = undefined

}

MySQLConnectionManager.prototype.reconnect = function() {

	if (this.hasExceededMaxNumberOfReconnectAttempts())
	{
		// No more attempts..
		debug_log('Maximum number of reconnect attempts has been reached..')
		return
	}

	var delay = this.getReconnectDelay()

	var self = this

	setTimeout(function() {

		self._reconnect()

	}, delay)

}

MySQLConnectionManager.prototype._reconnect = function() {

	debug_log('Attempting to re-establish connection..')

	this._numFailedReconnectAttempts++

	var self = this

	this.connect(function(error, connection) {

		if (error)
		{
			debug_error('Failed to re-establish connection..')
			debug_error(error.code)
			self.reconnect()
			return
		}

		debug_log('Connection has been re-established..')

		if (
			!self.options.useConnectionPooling &&
			self.options.autoReconnect
		)
			self.listenForDisconnect()

		if (self.options.keepAlive)
			self.setKeepAliveInterval()

		self.emit('reconnect', connection)

	})

}

MySQLConnectionManager.prototype.hasExceededMaxNumberOfReconnectAttempts = function() {

	return 	this.options.maxReconnectAttempts &&
			this._numFailedReconnectAttempts >= this.options.maxReconnectAttempts - 1

}

MySQLConnectionManager.prototype.getReconnectDelay = function() {

	if (!(this.options.reconnectDelay instanceof Array))
		return this.options.reconnectDelay

	var numGroups = this.options.reconnectDelay.length
	var groupSize = this.options.reconnectDelayGroupSize
	var attemptNumber = this._numFailedReconnectAttempts + 1
	var groupIndex = Math.floor(attemptNumber / groupSize)

	return this.options.reconnectDelay[groupIndex] || this.options.reconnectDelay[numGroups - 1]

}

MySQLConnectionManager.prototype.listenForDisconnect = function() {

	var self = this

	this.connection.on('error', function(error) {

		if (error.code == 'PROTOCOL_CONNECTION_LOST')
		{
			debug_log('Connection to database has been lost..')

			self.emit('disconnect')

			self._numFailedReconnectAttempts = 0

			// Stop sending keep-alive signals.
			self.clearKeepAliveInterval()

			self.reconnect()
		}

	})

}

MySQLConnectionManager.prototype.setDefaultOptions = function() {

	for (var name in defaultOptions)
		if (typeof this.options[name] == 'undefined')
			this.options[name] = defaultOptions[name]

}

MySQLConnectionManager.prototype.keepAlive = function() {

	debug_log('Sending keep-alive signal..')

	if (!this.options.useConnectionPooling)
		return this.connection.ping()

	this.connection.getConnection(function(error, connection) {

		if (error)
		{
			debug_error('Failed to send keep-alive signal because an unexpected error has occurred.')
			debug_error(error.code)
			return
		}

		connection.ping()
		connection.release()

	})

}

MySQLConnectionManager.prototype.setKeepAliveInterval = function(interval) {

	this.clearKeepAliveInterval()

	var self = this

	this._keepAliveInterval = setInterval(function() {

		self.keepAlive()

	}, interval || this.options.keepAliveInterval)

}

MySQLConnectionManager.prototype.clearKeepAliveInterval = function() {

	clearInterval(this._keepAliveInterval)

}

module.exports = MySQLConnectionManager


text:
local Object = require 'objectlua.Object'
local Class  = require 'objectlua.Class'

TestObject = {}

function TestObject:tearDown()
    Class:reset()
    package.loaded['SomeClass'] = nil
end

----
--  Inheritance & Initialization
function TestObject:testInheritanceAndInitialization()
    local Toto = Object:subclass()

    function Toto:initialize(name)
        self.name = name
    end

    local toto = Toto:new('John')
    local otherToto = Toto:new('Bob')

    assertEquals(Toto, toto.class)
    assertEquals(Object, Toto.superclass)
    assertEquals(Object.class, Toto.class.superclass)
    assertEquals(nil, toto.new)
    assertEquals(toto.name, 'John')
    assertEquals(otherToto.name, 'Bob')
end

----
--  Testing subclassing
function TestObject:testSubclassing()
   local Toto = Object:subclass()

   function Toto:initialize(name)
      self.name = name
   end

   local john = Toto:new('John')
   local bob = Toto:new('Bob')

   assertEquals(john.name, 'John')
   assertEquals(bob.name, 'Bob')
end

----
--  Calling super
function TestObject:testSuper()
    local Toto = Object:subclass()
    function Toto:initialize(name)
        self.name = name
    end

    local Tata = Toto:subclass()
    function Tata:initialize(name)
       super(self, name)
    end

    local tata = Tata:new('Bob')
    assertEquals(tata.name, 'Bob')
end

----
--  Calling super through two levels of inheritance.
--  This one can cause a stackoverflow with a too simple super() implementation.
function TestObject:testSuperThroughTwoLevels()
    local Toto = Object:subclass()
    function Toto:initialize(name)
        self.name = name
    end

    local Tata = Toto:subclass()
    function Tata:initialize(name)
        super(self, name)
    end

    local Titi = Tata:subclass()
    function Titi:initialize(name)
        super(self, name)
    end

    local titi = Titi:new('Paul')
    assertEquals(titi.name, 'Paul')
end

----
--  Virtual calls
function TestObject:testVirtualCall()
    local Base = Object:subclass()

    function Base:initialize()
        self.type = self:getType()
    end

    function Base:getType()
        return 'base'
    end

    --
    local Derived = Base:subclass()

    function Derived:getType()
        return 'derived'
    end

    local derived = Derived:new()
    assertEquals(derived.type, 'derived')
end

----
--  Super jump
function TestObject:testSuperJump()
    local Level0 = Object:subclass()
    function Level0:getNumber()
        return 10
    end

    local Level1 = Level0:subclass()

    local Level2 = Level1:subclass()
    -- Calling super(self) in getNumber() on a Level2 object skips Level1
    -- (since it's not overriden here) and calls Level0:getNumber()
    function Level2:getNumber()
        return super(self) + 1
    end

    local level2 = Level2:new()
    assertEquals(level2:getNumber(), 11)
end

----
--  Super virtual calls through two levels...
function TestObject:testVirtualSuperThroughTwoLevels()
    local Level0 = Object:subclass()
    function Level0:initialize()
        self.type = self:getType()
    end
    function Level0:getType()
        return 'level0'
    end
    assertEquals(Level0:new().type, 'level0')

    local Level1 = Level0:subclass()
    function Level1:initialize()
        super(self)
    end
    function Level1:getType()
        return 'level1'
    end
    assertEquals(Level1:new().type, 'level1')

    local Level2 = Level1:subclass()
    function Level2:initialize()
        super(self)
    end
    function Level2:getType()
        return 'level2'
    end
    assertEquals(Level2:new().type, 'level2')
end

----
--  Calling initialize with two arguments through super
--  Passes since version 0.0.3
function TestObject:testInitializeWithTwoArguments()
    local Toto = Object:subclass()

    function Toto:initialize(name, color)
        self.name = name
        self.color = color
    end

    local toto = Toto:new('Bob', 'red')
    assertEquals(toto.name, 'Bob')
    assertEquals(toto.color, 'red')

    local Tata = Toto:subclass()
    function Tata:initialize(name, color)
        super(self, name, color)
    end
    local tata = Tata:new('John', 'blue')
    assertEquals(tata.name, 'John')
    assertEquals(tata.color, 'blue')
end

----
--  Testing class methods
function TestObject:testClassMethods()
   local Foo = Object:subclass()
   function Foo.class:sayHello()
      return 'Hello'
   end
   assertEquals(Foo:sayHello(), 'Hello')
end

----
--  Testing super on class methods
function TestObject:testSuperInClassMethods()
    local Level1 = Object:subclass()
    function Level1.class:getName()
        return 'Level1'
    end
    assert('Level1' == Level1:getName())

    local Level2 = Level1:subclass()
    function Level2.class:getName()
        return super(self)..'-Level2'
    end

    assertEquals(Level2:getName(), 'Level1-Level2')
end

----
--  Testing isKindOf
function TestObject:testIsKindOf()
    local Level1 = Object:subclass()
    local Level2 = Level1:subclass()
    local object = Object:new()
    local level2 = Level2:new()

    assert(not object:isKindOf())
    assert(object:isKindOf(Object))
    assert(not object:isKindOf(Level1))
    assert(level2:isKindOf(Object))
    assert(level2:isKindOf(Level1))
    assert(level2:isKindOf(Level2))
    assert(not object:isKindOf(Class))

    assert(not Level2:isKindOf(Level2))
end

----
--  Testing inheritsFrom
function TestObject:testInheritsFrom()
    local Level1 = Object:subclass()
    local Level2 = Level1:subclass()

    assert(Level1:inheritsFrom(Object))
    assert(Level2:inheritsFrom(Object))
    assert(Level2:inheritsFrom(Level1))
    assert(not Level2:inheritsFrom(Level2))
end

----
--  Validating object model
function TestObject:testObjectModel()
    assertEquals(Object.class.class, Class)
    assertEquals(Class.class.class, Class)
    assertEquals(Object:subclass().class.class, Class)
    assert(Object:isKindOf(Object))
    assert(Object:isKindOf(Class))
    assert(Class:isKindOf(Object))
    assert(Class:isKindOf(Class))

    assert(not Object:inheritsFrom(Class))
    assert(Class:inheritsFrom(Object))
    assert(not Object:inheritsFrom(Object))
end

----
--  Testing clone
function TestObject:testClone()
    local Level1 = Object:subclass()
    local level1 = Level1:new()
    level1.value = 5
    level1.values = {6, 7}
    local clone = level1:clone()

    assert(clone:isKindOf(level1.class))
    assert(clone.value == level1.value)
    assert(clone.values == level1.values)
end

----
--  Private metatables (get)
function TestObject:testPrivateMetatable()
    local Level1 = Object:subclass()
    local level1 = Level1:new()

    assertEquals(getmetatable(Level1), 'private')
    assertEquals(getmetatable(level1), 'private')
end

----
--  Private metatables (set)
function TestObject:testSetMetatableFails()
    local Titi = Object:subclass()
    local titi = Titi:new()
    assertError(setmetatable, titi, {})
end

----
--  Adding methods to an instance
function TestObject:testAddingMethodToInstance()
    local john = Object:new()
    function john:itWorks()
        return true
    end
    assert(john:itWorks())
end

----
--  Testing redefining new()
function TestObject:testRedefiningNew()
    local OtherNew = Object:subclass()

    function OtherNew.class:new(...)
       local instance = super(self, ...)
       instance.fromOtherNew = true
       return instance
    end

    local Foo = OtherNew:subclass()
    assert(Foo:isKindOf(Class))
    local foo = Foo:new()
    assert(foo.fromOtherNew)
end

----
--  Testing exception in super(self)
--  Passes since 0.3.2
function TestObject:testExceptionInSuper()
    local Base = Object:subclass()
    function Base:getString(name)
        assert('string' == type(name))
        return 'Base:'..name
    end

    local Derived = Base:subclass()
    function Derived:getString()
        pcall(super, self) -- throws & recovers immediately
        return super(self, 'John')
    end

    local derived = Derived:new()
    assertEquals(derived:getString(), 'Base:John')
end

----
--  Testing super(self) in tail call
function TestObject:testSuperTailCall()
    local Base = Object:subclass()
    function Base:getAnyString()
        return 'Coco'
    end

    local Derived = Base:subclass()
    function Derived:getAnyString()
        return super(self)
    end

    local derived = Derived:new()
    assertEquals(derived:getAnyString(), 'Coco')
end

----
--  Testing isMeta()
function TestObject:testIsMeta()
   assert(not Object:isMeta())
   assert(not Class:isMeta())
   assert(Object.class:isMeta())
   assert(Class.class:isMeta())
   local Toto = Object:subclass()
   assert(not Toto:isMeta())
   assert(Toto.class:isMeta())
end

----
--  Multiple return values
function TestObject:testMultipleReturnValues()
    local Toto = Object:subclass()
    function Toto:returnTwoValues()
        return 1, 2
    end

    local toto = Toto:new()
    a, b = toto:returnTwoValues()
    assertEquals(a, 1)
    assertEquals(b, 2)
end

----
--
function TestObject:testCallingNonExistingMethodFails()
    local Titi = Object:subclass()
    local titi = Titi:new()
    assertError(titi.aNonExistingMethod, titi)
end

----
--  Reading outside data
function TestObject:testReadOutsideData()
    local toto = 1
    local Foo = Object:subclass()
    function Foo:readToto()
        assertEquals(toto, 1)
    end

    local foo = Foo:new()
    foo:readToto()
end

----
--  Creating global data
function TestObject:testCreateGlobalData()
    local Foo = Object:subclass()
    function Foo:createToto()
        toto = 2
    end

    local foo = Foo:new()
    foo:createToto()
    assertEquals(toto, 2)
end

----
--  Testing named subclass in tail call
function TestObject:testNamedSubclassInTailCall()
    return Object:subclass 'NamedClass'
end

----
--  Testing named classes
function TestObject:testClassName()
    local NamedClass = Object:subclass 'NamedClass'
    assertEquals(NamedClass:name(), 'NamedClass')
end

----
--  Testing scope
function TestObject:testNamedAndAnonymClassScope()
    local assert = assert
    local assertEquals = assertEquals
    setfenv(1, {})
    do
        local NamedClass = Object:subclass 'NamedClass'
        local AnonymClass = Object:subclass()
    end

    assertEquals(NamedClass, nil)
    assertEquals(AnonymClass, nil)

    assert(nil ~= Class:find 'NamedClass')
    assertEquals(Class:find 'AnonymClass', nil)
end

----
--  Testing all Classes and class scope
function TestObject:testAllClasses()
    (function()
         Object:subclass 'NamedClass'
     end)()

    local classes = Class:all()

    assertEquals(classes['objectlua.Object']:name(), 'objectlua.Object')
    assertEquals(classes['objectlua.Object Metaclass']:name(), 'objectlua.Object Metaclass')

    assertEquals(classes['objectlua.Class']:name(), 'objectlua.Class')
    assertEquals(classes['objectlua.Class Metaclass']:name(), 'objectlua.Class Metaclass')

    assertEquals(classes['NamedClass']:name(), 'NamedClass')
    assertEquals(classes['NamedClass Metaclass']:name(), 'NamedClass Metaclass')
end

----
--  Testing requiring a class file
function TestObject:testLoadAClassFromFile()
    local SomeClass = require 'SomeClass'

    local someObject = SomeClass:new()
    assertEquals(someObject:className(), 'SomeClass')
    assert(someObject:itWorks())
end

function TestObject:testClassShadowedFails1()
    Object:subclass('SomeClass')
    assertError(require, 'SomeClass')
end

function TestObject:testClassShadowedFails2()
    require 'SomeClass'
    assertError(function()
                    Object:subclass('SomeClass')
                end)
end

function TestObject:testGlobalName()
    local Toto = Object:subclass('tata.Toto')
    assert(_G.tata)
    assert(_G.tata.Toto)
end


text:
suite( 'muigui/useful-Schema.Property', function() {
	var test_data = {
			items   : [
				{ name : 'Baxter', email : 'at.pretium@ultricies.com', location : { city : 'North Platte', country : 'Guatemala' }, date : '13/01/2009', age : 10 },
				{ name : 'Alyssa', email : 'arcu@purusgravida.org', location : { city : 'Pawtucket', country : 'Somalia' }, date : '22/10/2007', age : 15 },
				{ name : 'Fleur',  email : 'vehicula@temporarcu.org', location : { city : 'Hidden Hills', country : 'Myanmar' }, date : '06/10/2008', age : 20 },
				{ name : 'Norman', email : 'Vivamus@semmollis.org', location : { city : 'Ashland', country : 'Timor-leste' }, date : '21/07/2009', age : 25 },
				{ name : 'Bryar', email : 'Nulla.tempor@adipiscing.ca', location : { city : 'Helena', country : 'Aruba' }, date : '26/03/2009', age : 35 },
				{ name : 'Teegan', email : 'diam.vel.arcu@magnis.edu', location : { city : 'Tampa', country : 'Svalbard and Jan Mayen' }, date : '17/07/2008', age : 45 },
				{ name : 'Dorothy', email : 'luctus.felis@eteuismodet.ca', location : { city : 'Keene', country : 'Namibia' }, date : '08/05/2008', age : 50 },
				{ name : 'Aphrodite', email : 'Integer@vellectusCum.edu', location : { city : 'Rancho Palos Verdes', country : 'Solomon Islands' }, date : '22/11/2007', age : 55 },
				{ name : 'Quinn', email : 'varius.ultrices.mauris@diamProindolor.edu', location : { city : 'Shamokin', country : 'Norway' }, date : '07/03/2009', age : 60 },
				{ name : 'Bree', email : 'Vestibulum@nequeNullam.org', location : { city : 'Laramie', country : 'Norway' }, date : '05/08/2007', age : 65 },
				{ name : 'Zahir', email : 'ultrices.sit.amet@nullamagnamalesuada.ca', location : { city : 'Lawton', country : 'Tuvalu' }, date : '15/01/2009', age : 70 },
				{ name : 'Basil', email : 'ligula.Donec@atortorNunc.org', location : { city : 'Monrovia', country : 'Kenya' }, date : '21/07/2008', age : 75 },
				{ name : 'Inez', email : 'Curae;.Phasellus@non.edu', location : { city : 'St. George', country : 'Reunion' }, date : '08/12/2007', age : 80 },
				{ name : 'Fletcher', email : 'diam.lorem@malesuadautsem.ca', location : { city : 'Hayward', country : 'Central African Republic' }, date : '02/05/2008', age : 20 },
				{ name : 'Sage', email : 'libero.mauris.aliquam@elementumloremut.org', location : { city : 'Nenana', country : 'Ukraine' }, date : '11/09/2007', age : 25 },
				{ name : 'Brandon', email : 'Vivamus.rhoncus@etrisusQuisque.com', location : { city : 'Eden Prairie', country : 'Georgia' }, date : '16/12/2008', age : 25 },
				{ name : 'Miriam', email : 'Cum.sociis@sed.com', location : { city : 'Alpharetta', country : 'Tanzania, United Republic of' }, date : '13/02/2009', age : 20 },
				{ name : 'Whoopi', email : 'et.magna@faucibus.ca', location : { city : 'Frederiksted', country : 'Australia' }, date : '11/03/2009', age : 20 },
				{ name : 'Shay', email : 'metus.vitae@Vestibulumaccumsanneque.com', location : { city : 'New Haven', country : 'Anguilla' }, date : '09/04/2008', age : 20 },
				{ name : 'Orson', email : 'a@cursusin.edu', location : { city : 'Webster Groves', country : 'El Salvador' }, date : '13/12/2007', age : 25 }
			],
			success : true,
			total   : 20
		};

	suite( 'type: object', function() {
		var property_cite, property_direct;

		test( 'new Schema.Property', function( done ) {
				property_direct = new Schema.Property( {
					id   : 'name',
					type : 'object'
				} );
				property_cite   = new Schema.Property( {
					cite : 'location.country',
					id   : 'country'
				} );

			expect( property_direct.type ).to.be.an( 'function' );
			expect( property_cite.type ).to.be.an( 'function' );

			done();
		} );

		test( 'Property#coerce', function( done ) {
			var returned = {};

			expect( property_direct.coerce( test_data.items[0].name, test_data.items[0], returned ) ).to.equal( 'Baxter' );
			expect( property_cite.coerce( test_data.items[0].location.country, test_data.items[0], returned ) ).to.equal( 'Guatemala' );

			done();
		} );

		test( 'Property#process', function( done ) {
			var expected = { name : 'Baxter', country : 'Guatemala' },
				returned = {};

			property_direct.process( test_data.items[0], returned );
			property_cite.process( test_data.items[0], returned );

			expect( returned ).to.eql( expected );

			done();
		} );

		test( 'Property#value', function( done ) {
			var returned = {};

			expect( property_direct.value( test_data.items[0], returned ) ).to.equal( 'Baxter' );
			expect( property_cite.value( test_data.items[0], returned ) ).to.equal( 'Guatemala' );

			done();
		} );

		test( 'creating a property with a custom format Function', function( done ) {
			var property = new Schema.Property( {
					format : function( value, raw, data ) {
						expect( value ).to.equal( 'at.pretium@ultricies.com' );
						expect( raw ).to.equal( test_data.items[0] );
						expect( data ).to.equal( returned );

						return 'EMAIL: ' + value;
					},
					id     : 'email'
				} ),
				returned = {};

			property.process( test_data.items[0], returned );

			expect( returned.email ).to.equal( 'EMAIL: at.pretium@ultricies.com' );

			done();
		} );

		test( 'TODO: coerce using Schema', function( done ) {
			done();
		} );
	} );

	suite( 'type: array', function() {
		var property_cite, property_direct;

		test( 'new Schema.Property', function( done ) {
				property_direct = new Schema.Property( {
					id   : 'items',
					type : 'array'
				} );
				property_cite   = new Schema.Property( {
					cite : 'items',
					id   : 'users',
					type : 'array'
				} );

			expect( property_direct.type ).to.equal( Schema.Property.DATA_TYPE.array );
			expect( property_cite.type ).to.equal( Schema.Property.DATA_TYPE.array );

			done();
		} );

		test( 'Property#coerce', function( done ) {
			var returned = {};

			expect( property_direct.coerce( test_data.items, test_data, returned ) ).to.be.a( 'array' );
			expect( property_direct.coerce( test_data.items, test_data, returned ) ).to.eql( test_data.items );
			expect( property_direct.coerce( test_data.items, test_data, returned ) ).to.not.equal( test_data.items );
			expect( property_direct.coerce( 'foo', { items : 'foo' }, returned ) ).to.be.eql( ['foo'] );
			expect( property_direct.coerce( null, { items : null }, returned ) ).to.be.eql( [] );

			done();
		} );

		test( 'Property#process', function( done ) {
			var returned = {};
			property_direct.process( test_data, returned );

			expect( returned.items ).to.be.a( 'array' );
			expect( returned.items ).to.eql( test_data.items );
			expect( returned.items ).to.not.equal( test_data.items );

			returned = {};
			property_direct.process( { items : 'foo' }, returned );

			expect( returned.items ).to.be.eql( ['foo'] );

			returned = {};
			property_direct.process( { items : null }, returned );

			expect( returned.items ).to.be.eql( [] );

			returned = {};
			property_cite.process( test_data, returned );

			expect( returned.users ).to.be.a( 'array' );
			expect( returned.users ).to.eql( test_data.items );
			expect( returned.users ).to.not.equal( test_data.items );

			returned = {};
			property_cite.process( { items : 'foo' }, returned );

			expect( returned.users ).to.be.eql( ['foo'] );

			returned = {};
			property_cite.process( { items : null }, returned );

			expect( returned.users ).to.be.eql( [] );

			done();
		} );

		test( 'Property#value', function( done ) {
			var returned = {};

			expect( property_direct.value( test_data, returned ) ).to.equal( test_data.items );
			expect( property_cite.value( test_data, returned ) ).to.equal( test_data.items );

			done();
		} );

		test( 'creating a property with a custom format Function', function( done ) {
			var property = new Schema.Property( {
					format : function( value, raw, data ) {
						expect( value ).to.eql( test_data.items );
						expect( raw ).to.equal( test_data );
						expect( data ).to.equal( returned );

						return [1, 2, 3];
					},
					id     : 'items',
					type   : 'array'
				} ),
				returned = {};

				property.process( test_data, returned );

				expect( returned.items ).to.eql( [1, 2, 3] );

				done();
		} );

		test( 'max length', function( done ) {
			var property = new Schema.Property( {
					id   : 'items',
					max  :  10,
					type : 'array'
				} ),
				returned = {};

			property.process( test_data, returned );

			expect( returned.items.length ).to.equal( 10 );
			expect( returned.items ).to.eql( test_data.items.slice( 0, 10 ) );

			done();
		} );

		test( 'TODO: coerce using Schema', function( done ) {
			done();
		} );
	} );

	suite( 'type: boolean', function() {
		var property;

		test( 'new Schema.Property', function( done ) {
			property = new Schema.Property( {
				default : true,
				id      : 'flagged',
				type    : 'boolean'
			} );

			expect( property.type ).to.equal( Schema.Property.DATA_TYPE.boolean );
			expect( property.default ).to.equal( true );

			done();
		} );

		test( 'Property#coerce', function( done ) {
			var items    = [
					{ flagged : true }, { flagged : false }, { flagged : 1 }, { flagged : 0 },
					{ flagged : '0' }, { flagged : 'false' }, { flagged : null }, { flagged : undefined },
					{ flagged : 'null' }, { flagged : 'undefined' }
				],
				returned = {};

			items.forEach( function( item, i ) {

				expect( property.coerce( item.flagged, items, returned ) ).to.equal( this[i] );

			}, [true, false, true, false, false, false, true, true, true, true] );

			done();
		} );

		test( 'Property#process', function( done ) {
			var items    = [
					{ flagged : true }, { flagged : false }, { flagged : 1 }, { flagged : 0 },
					{ flagged : '0' }, { flagged : 'false' }, { flagged : null }, { flagged : undefined },
					{ flagged : 'null' }, { flagged : 'undefined' }
				];

			items.forEach( function( item, i ) {
				var returned = {};

				property.process( item, returned );

				expect( returned.flagged ).to.equal( this[i] );

			}, [true, false, true, false, false, false, true, true, true, true] );

			done();
		} );

		test( 'Property#value', function( done ) {
			var items    = [
					{ flagged : true }, { flagged : false }, { flagged : 1 }, { flagged : 0 },
					{ flagged : '0' }, { flagged : 'false' }, { flagged : null }, { flagged : undefined },
					{ flagged : 'null' }, { flagged : 'undefined' }
				];

			items.forEach( function( item, i ) {
				var returned = {};

				expect( property.value( item, returned ) ).to.equal( items[i].flagged );

			} );

			done();
		} );

		test( 'creating a property with a custom format Function', function( done ) {
			var property = new Schema.Property( {
					default : true,
					format  : function( value, raw, data ) {
						return typeof value == 'string' && /^false|0|null|undefined$/.test( value )
							 ? false
							 : !!value;
					},
					id      : 'flagged',
					type    : 'boolean'
				} ),
				items    = [
					{ flagged : true }, { flagged : false }, { flagged : 1 }, { flagged : 0 },
					{ flagged : '0' }, { flagged : 'false' }, { flagged : null }, { flagged : undefined },
					{ flagged : 'null' }, { flagged : 'undefined' }
				];

			items.forEach( function( item, i ) {
				var returned = {};

				expect( property.coerce( item.flagged, item, returned ) ).to.equal( this[i] );

			}, [true, false, true, false, false, false, false, false, false, false] );

			done();
		} );
	} );

	suite( 'type: number', function() {
		var property;

		test( 'new Schema.Property', function( done ) {
			property = new Schema.Property( {
				min  : 20,
				max  : 55,
				id   : 'age',
				type : 'number'
			} );

			expect( property.type ).to.equal( Schema.Property.DATA_TYPE.number );
			expect( property.max ).to.equal( 55 );
			expect( property.min ).to.equal( 20 );

			done();
		} );

		test( 'Property#coerce', function( done ) {
			var returned = {};

			expect( property.coerce( test_data.items[0].age, test_data.items[0], returned ) ).to.equal( 20 );
			expect( property.coerce( test_data.items[4].age, test_data.items[4], returned ) ).to.equal( 35 );

			done();
		} );

		test( 'Property#process', function( done ) {
			var returned = {};

			property.process( test_data.items[0], returned );

			expect( returned.age ).to.equal( 20 );

			returned = {};
			property.process( test_data.items[4], returned );

			expect( returned.age ).to.equal( 35 );

			done();
		} );

		test( 'Property#value', function( done ) {
			var returned = {};

			expect( property.value( test_data.items[0], returned ) ).to.equal( 10 );
			expect( property.value( test_data.items[4], returned ) ).to.equal( 35 );

			done();
		} );

		test( 'creating a property with a custom format Function', function( done ) {
			var property = new Schema.Property( {
					format : function( value, raw, data ) {
						return value + 15;
					},
					id     : 'age',
					min    : 20,
					max    : 55,
					type   : 'number'
				} ),
				returned = {};

			property.process( test_data.items[0], returned );

			expect( returned.age ).to.equal( 25 );

			returned = {};
			property.process( test_data.items[4], returned );

			expect( returned.age ).to.equal( 50 );

			done();
		} );
	} );

	suite( 'type: string', function() {
		var property;

		test( 'new Schema.Property', function( done ) {
			property = new Schema.Property( {
				min  : 20,
				max  : 55,
				id   : 'age',
				type : 'number'
			} );

			expect( property.type ).to.equal( Schema.Property.DATA_TYPE.number );
			expect( property.max ).to.equal( 55 );
			expect( property.min ).to.equal( 20 );

			done();
		} );

		test( 'Property#coerce', function( done ) {
			var returned = {};

			expect( property.coerce( test_data.items[0].age, test_data.items[0], returned ) ).to.equal( 20 );
			expect( property.coerce( test_data.items[4].age, test_data.items[4], returned ) ).to.equal( 35 );

			done();
		} );

		test( 'Property#process', function( done ) {
			var returned = {};

			property.process( test_data.items[0], returned );

			expect( returned.age ).to.equal( 20 );

			returned = {};
			property.process( test_data.items[4], returned );

			expect( returned.age ).to.equal( 35 );

			done();
		} );

		test( 'Property#value', function( done ) {
			var returned = {};

			expect( property.value( test_data.items[0], returned ) ).to.equal( 10 );
			expect( property.value( test_data.items[4], returned ) ).to.equal( 35 );

			done();
		} );

		test( 'creating a property with a custom format', function( done ) {
			var property = new Schema.Property( {
					format : function( value, raw, data ) {
						return value + 15;
					},
					id     : 'age',
					min    : 20,
					max    : 55,
					type   : 'number'
				} ),
				returned = {};

			property.process( test_data.items[0], returned );

			expect( returned.age ).to.equal( 25 );

			returned = {};
			property.process( test_data.items[4], returned );

			expect( returned.age ).to.equal( 50 );

			done();
		} );
	} );

	suite( 'type: date', function() {
		var property;

		test( 'new Schema.Property', function( done ) {
			property = new Schema.Property( {
				format : 'd/m/Y',
				id     : 'date',
				max    : new Date( 2009, 4, 1 ),
				min    : new Date( 2008, 0, 1 ),
				type   : 'date'
			} );

			expect( property.type ).to.equal( Schema.Property.DATA_TYPE.date );
			expect( +property.max ).to.equal( +( new Date( 2009, 4, 1 ) ) );
			expect( +property.min ).to.equal( +( new Date( 2008, 0, 1 ) ) );

			done();
		} );

		test( 'Property#coerce', function( done ) {
			var returned = {};

			expect( property.coerce( test_data.items[0].date, test_data.items[0], returned ) ).to.eql( new Date( 2009, 0, 13 ) );
			expect( property.coerce( test_data.items[3].date, test_data.items[3], returned ) ).to.eql( new Date( 2009, 4, 1 ) );

			done();
		} );

		test( 'Property#process', function( done ) {
			var returned = {};

			property.process( test_data.items[0], returned );

			expect( returned.date ).to.eql( new Date( 2009, 0, 13 ) );

			returned = {};
			property.process( test_data.items[3], returned );

			expect( returned.date ).to.eql( new Date( 2009, 4, 1 ) );

			done();
		} );

		test( 'Property#value', function( done ) {
			var returned = {};

			expect( property.value( test_data.items[0], returned ) ).to.equal( '13/01/2009' );
			expect( property.value( test_data.items[3], returned ) ).to.equal( '21/07/2009' );

			done();
		} );
	} );
} );


text:
var args = require('yargs').argv;
var config = require('./gulp.config')();
var del = require('del');
var glob = require('glob');
var gulp = require('gulp');
var path = require('path');
var _ = require('lodash');
var $ = require('gulp-load-plugins')({lazy: true});

/**
 * List the available gulp tasks
 */
gulp.task('help', $.taskListing);
gulp.task('default', ['help']);

/**
 * Compile sass to css
 * @return {Stream}
 */
gulp.task('styles', ['clean-styles'], function() {
	log('Compiling Sass --> CSS');

	return gulp
		.src(config.sass)
		.pipe($.plumber()) // exit gracefully if something fails after this
		.pipe($.sass())
//        .on('error', errorLogger) // more verbose and dupe output. requires emit.
		.pipe($.autoprefixer({browsers: ['last 2 version', '> 5%']}))
		.pipe(gulp.dest(config.temp));
});

/**
 *
 */
gulp.task('sass-watcher', function() {
	gulp.watch([config.sass], ['styles']);
});

/**
 * Copy fonts
 * @return {Stream}
 */
gulp.task('fonts', ['clean-fonts'], function() {
	log('Copying fonts');

	return gulp
		.src(config.fonts)
		.pipe(gulp.dest(config.build + 'fonts'));
});

/**
 * Compress images
 * @return {Stream}
 */
gulp.task('images', ['clean-images'], function() {
	log('Compressing and copying images');

	return gulp
		.src(config.images)
		.pipe($.imagemin({optimizationLevel: 4}))
		.pipe(gulp.dest(config.build + 'images'));
});

/**
 * Remove all files from the build, temp, and reports folders
 * @param  {Function} done - callback when complete
 */
gulp.task('clean', function(done) {
	var delconfig = [].concat(config.build, config.temp, config.report);
	log('Cleaning: ' + $.util.colors.blue(delconfig));
	del(delconfig, done);
});

/**
 * Remove all fonts from the build folder
 * @param  {Function} done - callback when complete
 */
gulp.task('clean-fonts', function(done) {
	clean(config.build + 'fonts/**/*.*', done);
});

/**
 * Remove all images from the build folder
 * @param  {Function} done - callback when complete
 */
gulp.task('clean-images', function(done) {
	clean(config.build + 'images/**/*.*', done);
});

/**
 * Remove all scripts from the build folder
 * @param  {Function} done - callback when complete
 */
gulp.task('clean-scripts', function(done) {
	clean(config.build + 'scripts/**/*.*', done);
});

/**
 * Remove all styles from the build and temp folders
 * @param  {Function} done - callback when complete
 */
gulp.task('clean-styles', function(done) {
	var files = [].concat(
		config.temp + '**/*.css',
		config.build + 'styles/**/*.css'
	);
	clean(files, done);
});

/**
 * Wire-up the bower dependencies
 * @return {Stream}
 */
gulp.task('wiredep', function() {
	log('Wiring the bower dependencies into the html');

	var wiredep = require('wiredep').stream;
	var options = config.getWiredepDefaultOptions();

	return gulp
		.src(config.index)
		.pipe(wiredep(options))
		.pipe(inject(config.js, ''))
		.pipe(gulp.dest(config.source));
});

gulp.task('inject', ['styles'], function() {
	log('Wire up css into the html, after files are ready');

	return gulp
		.src(config.index)
		.pipe(inject(config.css))
		.pipe(gulp.dest(config.source));
});

/**
 * Optimize all files, move to a build folder,
 * and inject them into the new index.html
 * @return {Stream}
 */
gulp.task('optimize', ['inject', 'clean-scripts'], function() {
	log('Optimizing the js, css, and html');

	var assets = $.useref.assets({searchPath: './'});
	// Filters are named for the gulp-useref path
	var cssFilter = $.filter('**/*.css');
	var jsAppFilter = $.filter('**/' + config.optimized.app);
	var jslibFilter = $.filter('**/' + config.optimized.lib);

	return gulp
		.src(config.index)
		.pipe($.plumber())
		.pipe(assets) // Gather all assets from the html with useref
		// Get the css
		.pipe(cssFilter)
		.pipe($.csso())
		.pipe(cssFilter.restore())
		// Get the custom javascript
		.pipe(jsAppFilter)
		.pipe($.uglify())
		//.pipe(getHeader())
		.pipe(jsAppFilter.restore())
		// Get the vendor javascript
		.pipe(jslibFilter)
		.pipe($.uglify()) // another option is to override wiredep to use min files
		.pipe(jslibFilter.restore())
		// Take inventory of the file names for future rev numbers
		.pipe($.rev())
		// Apply the concat and file replacement with useref
		.pipe(assets.restore())
		.pipe($.useref())
		// Replace the file names in the html with rev numbers
		.pipe($.revReplace())
		.pipe(gulp.dest(config.root));
});

// HELPER
////////////////////////////////////////////////////////

/**
 * Delete all files in a given path
 * @param  {Array}   path - array of paths to delete
 * @param  {Function} done - callback when complete
 */
function clean(path, done) {
	log('Cleaning: ' + $.util.colors.blue(path));
	del(path, done);
}

/**
 * Log a message or series of messages using chalk's blue color.
 * Can pass in a string, object or array.
 */
function log(msg) {
	if (typeof(msg) === 'object') {
		for (var item in msg) {
			if (msg.hasOwnProperty(item)) {
				$.util.log($.util.colors.blue(msg[item]));
			}
		}
	} else {
		$.util.log($.util.colors.blue(msg));
	}
}

/**
 * Inject files in a sorted sequence at a specified inject label
 * @param   {Array} src   glob pattern for source files
 * @param   {String} label   The label name
 * @param   {Array} order   glob pattern for sort order of the files
 * @returns {Stream}   The stream
 */
function inject(src, label, order) {
	var options = {read: false};
	if (label) {
		options.name = 'inject:' + label;
	}

	return $.inject(orderSrc(src, order), options);
}

/**
 * Order a stream
 * @param   {Stream} src   The gulp.src stream
 * @param   {Array} order Glob array pattern
 * @returns {Stream} The ordered stream
 */
function orderSrc (src, order) {
	//order = order || ['**/*'];
	return gulp
		.src(src)
		.pipe($.if(order, $.order(order)));
}

module.exports = gulp;


text:
import quantities as pq

from pylatex.quantities import _dimensionality_to_siunitx, Quantity

def test_quantity():
    v = 1 * pq.m/pq.s

    q1 = Quantity(v)
    assert q1.dumps() == r'\SI{1.0}{\meter\per\second}'

    q2 = Quantity(v, format_cb=lambda x: str(int(x)))
    assert q2.dumps() == r'\SI{1}{\meter\per\second}'

def test_dimensionality_to_siunitx():
    assert _dimensionality_to_siunitx((pq.volt/pq.kelvin).dimensionality) == \
        r'\volt\per\Kelvin'

if __name__ == '__main__':
    test_quantity()
    test_dimensionality_to_siunitx()


text:
package com.ctrip.zeus.service.tools.local.impl;

import com.ctrip.zeus.client.AgentApiClient;
import com.ctrip.zeus.dao.entity.SlbSlbServerR;
import com.ctrip.zeus.dao.entity.SlbSlbServerRExample;
import com.ctrip.zeus.dao.mapper.SlbSlbServerRMapper;
import com.ctrip.zeus.server.LocalInfoPack;
import com.ctrip.zeus.service.model.IdVersion;
import com.ctrip.zeus.service.tools.local.LocalInfoService;
import com.ctrip.zeus.util.EnvHelper;
import com.netflix.config.DynamicBooleanProperty;
import com.netflix.config.DynamicIntProperty;
import com.netflix.config.DynamicPropertyFactory;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.HashSet;
import java.util.Set;

/**
 * Created by fanqq on 2017/4/7.
 */
@Service("localInfoService")
public class LocalInfoServiceImpl implements LocalInfoService {

    @Resource
    private SlbSlbServerRMapper slbSlbServerRMapper;

    private Long slbId = null;
    private String slbName = null;
    private long lastChangeTime = 0L;
    private static DynamicIntProperty updateInterval = DynamicPropertyFactory.getInstance().getIntProperty("local.info.service.interval", 60000);
    private String env = null;
    private static Long staticSlbId = null;
    private static long staticLastFetchTime = 0L;

    private final DynamicBooleanProperty alwaysFromDb = DynamicPropertyFactory.getInstance().getBooleanProperty("local.info.service.get.slb.id.from.db", false);

    @Override
    public String getLocalIp() {
        return LocalInfoPack.INSTANCE.getIp();
    }

    @Override
    public Long getLocalSlbId() throws Exception {
        long now = System.currentTimeMillis();
        // Query for slb id only when cache expired, no matter whether cached slbId is null or not.
        if (now - lastChangeTime >= updateInterval.get()) {
            if (EnvHelper.portal() || alwaysFromDb.get()) {
                // get slb id from db
                Set<IdVersion> idVersions = getLocalSlbId(LocalInfoPack.INSTANCE.getIp());
                if (idVersions != null && idVersions.size() > 0) {
                    slbId = idVersions.toArray(new IdVersion[0])[0].getId();
                }else{
                    slbId=null;
                }
            } else {
                // get slb info from api cluster
                slbId = getSlbId();
            }
            lastChangeTime = now;
        }
        return slbId;
    }

    @Override
    public Long getLocalSlbIdWithRetry() throws Exception {
        long now = System.currentTimeMillis();
        // fetch when slbId cache is null or cache is expired
        if (slbId == null || now - lastChangeTime >= updateInterval.get()) {
            if (EnvHelper.portal() || alwaysFromDb.get()) {
                // get slb id from db
                Set<IdVersion> idVersions = getLocalSlbId(LocalInfoPack.INSTANCE.getIp());
                if (idVersions != null && idVersions.size() > 0) {
                    slbId = idVersions.toArray(new IdVersion[0])[0].getId();
                } else {
                    slbId = null;
                }
            } else {
                // get slb info from api cluster
                slbId = getSlbId();
            }
            lastChangeTime = now;
        }
        return slbId;
    }

    public static Long getLocalSlbIdStatic() throws Exception {
        long now = System.currentTimeMillis();
        if (staticSlbId == null || now - staticLastFetchTime >= updateInterval.get()) {
            staticSlbId = getSlbId();
            staticLastFetchTime = now;
        }
        return staticSlbId;
    }

    @Override
    public String getEnv() {
        if (env == null) {
            env = System.getProperty("archaius.deployment.environment");
        }
        return env;
    }

    public static Long getSlbId() throws Exception {
        Long slbId = AgentApiClient.getClient().getSlbId();
        if (slbId == null) {
            return null;
        } else {
            return slbId;
        }
    }

    private Set<IdVersion> getLocalSlbId(String ip) {
        Set<IdVersion> result = new HashSet<>();
        for (SlbSlbServerR server : slbSlbServerRMapper.selectByExample(new SlbSlbServerRExample().
                createCriteria().
                andIpEqualTo(ip).
                example())) {
            result.add(new IdVersion(server.getSlbId(), server.getSlbVersion()));
        }

        return result;
    }
}


text:
package com.ariscdc.coding.ds.graph;

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

/**
 * @author ariscdc
 * Aris Dela Cruz
 * https://github.com/ariscdc
 *
 * 20160216 2245-2300 (15 mins.)
 */
public class AdjacencyMatrixGraph implements Graph {

    private int verticesCount = 0;
    private Graph.Type type = Type.DIRECTED;
    private int[][] adjacencyMatrix;

    public AdjacencyMatrixGraph(int verticesCount, Graph.Type type) {

        this.verticesCount = verticesCount;
        this.type = type;
        adjacencyMatrix = new int[verticesCount][verticesCount];

        for (int i = 0; i < verticesCount; i++) {
            for (int j = 0; j < verticesCount; j++) {
                adjacencyMatrix[i][j] = 0;
            }
        }
    }

    @Override
    public void addEdge(int sourceVertexId, int destinationVertexId) {

        validate(sourceVertexId);
        validate(destinationVertexId);

        adjacencyMatrix[sourceVertexId][destinationVertexId] = 1;
        if (type.equals(Type.UNDIRECTED)) {
            adjacencyMatrix[destinationVertexId][sourceVertexId] = 1;
        }
    }

    @Override
    public List<Integer> getAdjacentVertices(int vertexId) {

        validate(vertexId);

        List<Integer> adjacentVertices = new ArrayList<>();
        for (int i = 0; i < verticesCount; i++) {
            if (adjacencyMatrix[vertexId][i] == 1) {
                adjacentVertices.add(i);
            }
        }
        Collections.sort(adjacentVertices);
        return adjacentVertices;
    }

    @Override
    public int getVerticesCount() {
        return verticesCount;
    }

    private void validate(int vertexId) {
        if (vertexId < 0 || vertexId >= verticesCount)
            throw new IllegalArgumentException("Vertex id=" + vertexId + " is invalid.");
    }
}


text:
x$(window).load(function(e){
	x$('#header__icon').on('click', function (e) {
			e.preventDefault();
            x$('.site-pusher').toggleClass('menuaa');
            x$('.site-cache').css({'display':'block'});
      });
	x$('#site-cache').click(function(e){
		console.log('entre');
		x$('.site-cache').css({'display':'none'});
		x$('.site-pusher').removeClass('menuaa');
	});

});


text:
<?php
/**
 * Returns the HTML for User Profile page.
 * @see https://api.drupal.org/api/drupal/modules%21user%21user-profile.tpl.php/7
 *
 * Available variables:
 *  - $title: (string).
 *  - $subtitle: (string).
 *  - $email: Account email address (string).
 *  - $first_name: User's first name (string).
 *  - $last_name: User's last name (string).
 *  - $mobile: User's mobile cell number (string).
 *  - $doing: Array containing campaign blocks for campaigns User is doing.
 */
?>
<article class="user profile"<?php print $attributes; ?> id="user-<?php print $user->uid; ?>">

<?php print $title; ?>

      <?php if (!empty($subtitle)): ?>

<?php print $subtitle; ?>

      <?php endif; ?>

<?php print t("You're Doing"); ?>

      <?php if (empty($doing)): ?>

<?php print $no_signups_header; ?>

<?php print $no_signups_copy; ?>

          <?php print t('Explore Campaigns'); ?>

      <?php else: ?>
        <?php print $doing_gallery; ?>
      <?php endif; ?>

  <?php if (!empty($reportbacks)): ?>

<?php print t('You Did'); ?>

        <?php // Missing Photo Link // ?>

          Is your photo not showing up?

        <?php print $reportback_gallery; ?>

  <?php endif; ?>

<?php print t('Your Info'); ?>

<?php print t('Name'); ?>:

          <?php print check_plain($first_name); ?>
          <?php if (!empty($last_name)): ?>
            <?php print check_plain($last_name); ?>
          <?php endif; ?>

<?php print t('Password'); ?>:

*******

<?php print t('Email'); ?>:

<?php print check_plain($email); ?>

        <?php if (!empty($mobile)): ?>

<?php print t('Cell'); ?>:

<?php print check_plain($mobile); ?>

        <?php endif; ?>

        <a class="secondary" href="/<?php print $edit_link; ?>">
          <?php print t('Update my profile'); ?>

<?php // Missing Photo Modal // ?>

Is your photo not showing up?

The other day, we had some issues with our site, and a bug deleted a bunch of images (which may have included yours).

Some good news:

We've fixed the issue so new photos will not be deleted.

Even though your photo isn't showing up, your impact is still being counted.

And if the campaign had a scholarship opportunity, don't worry! Your entry into the scholarship was still counted.

Here are a few things you can do:

If you have any new photos to add to or any campaigns you're signed up for go ahead and upload those now to start sharing your impact.

If you still have your old photo on your phone or computer, please re-upload it now to guarantee it's showing up on the campaign you participated in and your profile. If the campaign is now closed, feel free to reach out to us at our help center and we'll totally upload your photo for you.

      (P.S. If you have any other questions or problems uploading or viewing photos on the site, definitely let us know. Thanks so much!)


text:
@implementation MDUserDefaultHelper

+(id)readForKey:(NSString*)key{
    return [[NSUserDefaults standardUserDefaults] objectForKey:key];
}

+(void)saveForKey:(NSString*)key value:(id)value{
    [[NSUserDefaults standardUserDefaults] setObject:value forKey:key];
    [[NSUserDefaults standardUserDefaults] synchronize];
}

+(void)removeForKey:(NSString*)key{
    [[NSUserDefaults standardUserDefaults] removeObjectForKey:key];
    [[NSUserDefaults standardUserDefaults] synchronize];
}

@end


text:
namespace {

    void xGetter(GETTER_ARGUMENT) { GETTER_CONTENT(Rectangle, x); }

    void xSetter(SETTER_ARGUMENT) { SETTER_CONTENT(Rectangle, x); }

    void yGetter(GETTER_ARGUMENT) { GETTER_CONTENT(Rectangle, y); }

    void ySetter(SETTER_ARGUMENT) { SETTER_CONTENT(Rectangle, y); }

    void widthGetter(GETTER_ARGUMENT) { GETTER_CONTENT(Rectangle, width); }

    void widthSetter(SETTER_ARGUMENT) { SETTER_CONTENT(Rectangle, width); }

    void heightGetter(GETTER_ARGUMENT) { GETTER_CONTENT(Rectangle, height); }

    void heightSetter(SETTER_ARGUMENT) { SETTER_CONTENT(Rectangle, height); }

    void setToMethod(const v8::FunctionCallbackInfo<v8::Value>& args) {
        auto isolate = args.GetIsolate();
        auto context = isolate->GetCurrentContext();
        float x = float(args[0]->IsUndefined() ? 0 : args[0]->NumberValue(context).FromJust());
        float y = float(args[1]->IsUndefined() ? 0 : args[1]->NumberValue(context).FromJust());
        float width = float(args[2]->IsUndefined() ? 0 : args[2]->NumberValue(context).FromJust());
        float height = float(args[3]->IsUndefined() ? 0 : args[3]->NumberValue(context).FromJust());
        auto self = args.Holder();
        auto ptr = self->GetAlignedPointerFromInternalField(0);
        static_cast<Rectangle*>(ptr)->setTo(x, y, width, height);
    }

    void toStringMethod(const v8::FunctionCallbackInfo<v8::Value>& args) {
        auto self = args.Holder();
        auto isolate = args.GetIsolate();
        auto rect = static_cast<Rectangle*>(self->GetAlignedPointerFromInternalField(0));
        auto value = rect->toString();
        auto utf = JSString(value.c_str());
        args.GetReturnValue().Set(utf);
    }

    void constructor(const v8::FunctionCallbackInfo<v8::Value>& args) {
        auto isolate = args.GetIsolate();
        auto context = isolate->GetCurrentContext();
        float x = float(args[0]->IsUndefined() ? 0 : args[0]->NumberValue(context).FromJust());
        float y = float(args[1]->IsUndefined() ? 0 : args[1]->NumberValue(context).FromJust());
        float width = float(args[2]->IsUndefined() ? 0 : args[2]->NumberValue(context).FromJust());
        float height = float(args[3]->IsUndefined() ? 0 : args[3]->NumberValue(context).FromJust());
        Rectangle* rect = new Rectangle(x, y, width, height);
        auto self = args.Holder();
        self->SetAlignedPointerInInternalField(0, rect);
        SET_ACCESSOR("x", xGetter, xSetter);
        SET_ACCESSOR("y", yGetter, ySetter);
        SET_ACCESSOR("width", widthGetter, widthSetter);
        SET_ACCESSOR("height", heightGetter, heightSetter);
        args.GetReturnValue().Set(self);
    }

}

void V8Rectangle::install(v8::Isolate* isolate, v8::Local<v8::ObjectTemplate> parent) {
    auto classTemplate = v8::FunctionTemplate::New(isolate, constructor);
    classTemplate->SetClassName(JSString("Rectangle"));
    auto prototypeTemplate = classTemplate->PrototypeTemplate();
    SET_METHOD("setTo", setToMethod);
    SET_METHOD("toString", toStringMethod);
    classTemplate->InstanceTemplate()->SetInternalFieldCount(1);

    parent->Set(JSString("Rectangle"), classTemplate);
}


text:
using System;
using Elders.Skynet.Core.Transport;

namespace Elders.Skynet.Core.Util
{
    public class CompletedObserver : IObserver<BasicMessage>
    {
        private Action onCompleted;

        public CompletedObserver(Action onCompleted)
        {
            this.onCompleted = onCompleted;
        }

        void IObserver<BasicMessage>.OnCompleted()
        {
            onCompleted();
        }

        void IObserver<BasicMessage>.OnError(Exception error) { }

        void IObserver<BasicMessage>.OnNext(BasicMessage value) { }
    }
}


text:
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace LuisEntityHelpers.Tests
{
    [TestClass]
    public class DimensionHelperTests
    {
        [TestMethod]
        public void LuisSample1_ProcessedOk()
        {
            var json = @" { ""entity"": ""650 square kilometers"", ""type"": ""builtin.dimension"", ""startIndex"": 0, ""endIndex"": 20, ""score"": 0.834644437 }";

            var sut = new DimensionHelper();

            var resp = (DimensionParseResponse)sut.Parse(json);

            Assert.IsNotNull(resp);
            Assert.AreEqual(650, resp.NumericValue);
            Assert.AreEqual("square kilometers", resp.Scale);
        }

        [TestMethod]
        public void LuisSample2_ProcessedOk()
        {
            var json = @" { ""entity"": ""2 miles"", ""type"": ""builtin.dimension"", ""startIndex"": 0, ""endIndex"": 6, ""score"": 0.9962368 }";

            var sut = new DimensionHelper();

            var resp = (DimensionParseResponse)sut.Parse(json);

            Assert.IsNotNull(resp);
            Assert.AreEqual(2, resp.NumericValue);
            Assert.AreEqual("miles", resp.Scale);
        }

        [TestMethod]
        public void LuisSample3_ProcessedOk()
        {
            var json = @" { ""entity"": ""9 , 350 feet"", ""type"": ""builtin.dimension"", ""startIndex"": 0, ""endIndex"": 9, ""score"": 0.9317738 }";

            var sut = new DimensionHelper();

            var resp = (DimensionParseResponse)sut.Parse(json);

            Assert.IsNotNull(resp);
            Assert.AreEqual(9350, resp.NumericValue);
            Assert.AreEqual("feet", resp.Scale);
        }

        [TestMethod]
        public void DecimalValue_ProcessedOk()
        {
            var json = @" { ""entity"": ""1 . 5 miles"", ""type"": ""builtin.dimension"", ""startIndex"": 0, ""endIndex"": 9, ""score"": 0.9317738 }";

            var sut = new DimensionHelper();

            var resp = (DimensionParseResponse)sut.Parse(json);

            Assert.IsNotNull(resp);
            Assert.AreEqual(1.5, resp.NumericValue);
            Assert.AreEqual("miles", resp.Scale);
        }

        [TestMethod]
        public void AMile_ProcessedOk()
        {
            var json = @" { ""entity"": ""a mile"", ""type"": ""builtin.dimension"", ""startIndex"": 0, ""endIndex"": 9, ""score"": 0.9317738 }";

            var sut = new DimensionHelper();

            var resp = (DimensionParseResponse)sut.Parse(json);

            Assert.IsNotNull(resp);
            Assert.AreEqual(1, resp.NumericValue);
            Assert.AreEqual("mile", resp.Scale);
        }
    }
}


text:
var redefine = require('./_redefine');
module.exports = function(target, src, safe){
  for(var key in src)redefine(target, key, src[key], safe);
  return target;
};


text:
package com.twitter.finagle.memcached.integration

import com.twitter.conversions.time._
import com.twitter.finagle.Address
import com.twitter.finagle.Memcached
import com.twitter.finagle.Memcached.UsePushMemcachedToggleName
import com.twitter.finagle.Name
import com.twitter.finagle.Service
import com.twitter.finagle.memcached.Interpreter
import com.twitter.finagle.memcached.integration.external.InProcessMemcached
import com.twitter.finagle.memcached.protocol._
import com.twitter.finagle.toggle.flag
import com.twitter.io.Buf
import com.twitter.util.TimeConversions._
import com.twitter.util.{Await, Awaitable, Time}
import java.net.{InetAddress, InetSocketAddress}
import org.scalatest.{BeforeAndAfter, FunSuite}

abstract class InterpreterServiceTest extends FunSuite with BeforeAndAfter {

  val TimeOut = 15.seconds

  private def awaitResult[T](awaitable: Awaitable[T]): T = Await.result(awaitable, TimeOut)

  var server: InProcessMemcached = null
  var client: Service[Command, Response] = null

  protected def baseClient: Memcached.Client

  before {
    server = new InProcessMemcached(new InetSocketAddress(InetAddress.getLoopbackAddress, 0))
    val address = Address(server.start().boundAddress.asInstanceOf[InetSocketAddress])
    client = baseClient
      .connectionsPerEndpoint(1)
      .newService(Name.bound(address), "memcache")
  }

  after {
    server.stop()
  }

  test("set & get") {
    val key = Buf.Utf8("key")
    val value = Buf.Utf8("value")
    val zero = "0"
    val result = for {
      _ <- client(Delete(key))
      _ <- client(Set(key, 0, Time.epoch, value))
      r <- client(Get(Seq(key)))
    } yield r
    assert(awaitResult(result) == Values(Seq(Value(key, value, None, Some(Buf.Utf8(zero))))))
  }

  test("huge set value to force framing") {
    val key = Buf.Utf8("key")
    val value = Buf.Utf8("value" * 5000)
    val zero = "0"
    val result = for {
      _ <- client(Delete(key))
      _ <- client(Set(key, 0, Time.epoch, value))
      r <- client(Get(Seq(key)))
    } yield r
    assert(awaitResult(result) == Values(Seq(Value(key, value, None, Some(Buf.Utf8(zero))))))
  }

  test("quit") {
    val result = client(Quit())
    assert(awaitResult(result) == NoOp)
  }

  test("cas") {
    val key = Buf.Utf8("key")
    val value = Buf.Utf8("value")
    val zero = "0"
    val result = for {
      _ <- client(Delete(key))
      _ <- client(Set(key, 0, Time.epoch, value))
      r <- client(Get(Seq(key)))
    } yield r

    assert(awaitResult(result) == Values(Seq(Value(key, value, None, Some(Buf.Utf8(zero))))))

    val newValue = Buf.Utf8("new-value")
    // client tries to cas using a wrong checksum and fails to update the value
    val wrongChecksum = Interpreter.generateCasUnique(Buf.Utf8("wrong-value"))
    awaitResult(client(Cas(key, 0, Time.epoch + 5.seconds, newValue, wrongChecksum)))
    val retrievedValue = awaitResult(client(Get(Seq(key))))
    assert(retrievedValue == Values(Seq(Value(key, value, None, Some(Buf.Utf8(zero))))))

    // client does cas using the right checksum and successfully updates the value
    val rightChecksum = Interpreter.generateCasUnique(value)
    awaitResult(client(Cas(key, 0, Time.epoch + 5.seconds, newValue, rightChecksum)))
    val newRetrievedValue = awaitResult(client(Get(Seq(key))))
    assert(newRetrievedValue == Values(Seq(Value(key, newValue, None, Some(Buf.Utf8(zero))))))
  }

}

class InterpreterServicePushClientTest extends InterpreterServiceTest {
  protected def baseClient: Memcached.Client =
    flag.overrides.let(UsePushMemcachedToggleName, 1.0) {
      Memcached.client
    }
}

class InterpreterServiceTestNonPushClientTest extends InterpreterServiceTest {
  protected def baseClient: Memcached.Client =
    flag.overrides.let(UsePushMemcachedToggleName, 0.0) {
      Memcached.client
    }
}


text:
set -e

RED="$(echo -e '\033[1;31m')"
NORM="$(echo -e '\033[0m')"

function handle_err() {
  echo -e "\n${RED}ERROR: build script failed.${NORM}\n"
}

trap handle_err ERR

sudo echo -e "\nTesting sudo works...\n"

# We MUST be in the same directory as this script for the build to work properly
cd $(dirname $0)

# Build ourselves
echo
echo "Building meeting-oosecurity..."

sudo time docker build $@ -t meeting-oosecurity .
sudo docker tag meeting-oosecurity oosecurity/meeting:latest


text:
from ..web import _base
import arcrest
_url = None
_securityHandler = None

class search(_base.BaseWebOperations):
    def __init__(self, url=None, securityHandler=None, proxy_url=None, proxy_port=None):
        """Constructor"""

        if url is None and not securityHandler is None:
            url = securityHandler.org_url
        if proxy_url is None and not securityHandler is None:
            self._proxy_url = securityHandler.proxy_url
        if proxy_port is None and not securityHandler is None:
            self._proxy_url = securityHandler.proxy_port

        if url is None or url == '':
            raise AttributeError("URL or Security Hanlder needs to be specified")

        if url.lower().find("/home") > -1:
            pass
        else:
            url = url + "/home"

        if url.lower().find("/search") > -1:
            self._url = url
        else:
            self._url = url + "/search"

        self._securityHandler = securityHandler
        if not securityHandler is None:
            self._referer_url = securityHandler.referer_url
        self._proxy_port = proxy_port
        self._proxy_url = proxy_url
    #----------------------------------------------------------------------
    def findItem(self, title, itemType,username=None):
        #
        # Find the itemID of whats being updated
        #
        url = self._url + "/search"
        #http://arcgissolutions.maps.arcgis.com/home/search.html?q=qwrwq&t=content&focus=maps

        if username is None:
            username = self._securityHandler.username

        params = {'f': 'json',
                'token': self._securityHandler.token,
                'q': "title:\""+ title + "\"AND owner:\"" + username + "\" AND type:\"" + itemType + "\""}

        jsonResponse = self._do_get(url=url,
                                   param_dict=params,
                                   proxy_url=self._proxy_url,
                                   proxy_port=self._proxy_port)

        if jsonResponse['total'] == 0:
           # print "\nCould not find a service to update. Check the service name in the settings.ini"
            return None
        else:
            return jsonResponse['results'][0]["id"]


text:
<?php
/*
Plugin Name:        Roots Rewrites
Plugin URI:         http://roots.io/plugins/roots-rewrites/
Description:        Clean URL rewrites for theme assets in the Roots WordPress Starter Theme
Version:            1.0.0
Author:             Roots
Author URI:         http://roots.io/
License:            MIT License
License URI:        http://opensource.org/licenses/MIT
*/

defined('ABSPATH') or die('A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools. - Douglas Adams');

include_once('src/plugin.php');


text:
CREATE TABLE IF NOT EXISTS `SUBSTATUS_ANNOTATIONS_OWNER` (
  `SUBMISSION_ID` BIGINT NOT NULL,
  `EVALUATION_ID` BIGINT NOT NULL,
  PRIMARY KEY (`SUBMISSION_ID`),
  KEY (`EVALUATION_ID`)
)


text:
DROP SEQUENCE IF EXISTS "notification"."notification_id_seq";
CREATE SEQUENCE "notification"."notification_id_seq" INCREMENT 1 START 1 MAXVALUE 9223372036854775807 MINVALUE 1 CACHE 1;
-- ALTER TABLE "notification"."notification_id_seq" OWNER TO "social";
GRANT USAGE ON SEQUENCE "notification"."notification_id_seq" TO "social";

-- ----------------------------
--  Sequence structure for notification_content_id_seq
-- ----------------------------
DROP SEQUENCE IF EXISTS "notification"."notification_content_id_seq";
CREATE SEQUENCE "notification"."notification_content_id_seq" INCREMENT 1 START 1 MAXVALUE 9223372036854775807 MINVALUE 1 CACHE 1;
-- ALTER TABLE "notification"."notification_content_id_seq" OWNER TO "social";
GRANT USAGE ON SEQUENCE "notification"."notification_content_id_seq" TO "social";

-- ----------------------------
--  Sequence structure for activity_id_seq
-- ----------------------------
DROP SEQUENCE IF EXISTS "notification"."notification_activity_id_seq";
CREATE SEQUENCE "notification"."notification_activity_id_seq" INCREMENT 1 START 1 MAXVALUE 9223372036854775807 MINVALUE 1 CACHE 1;
-- ALTER TABLE "notification"."notification_activity_id_seq" OWNER TO "social";
GRANT USAGE ON SEQUENCE "notification"."notification_activity_id_seq" TO "social";

-- ----------------------------
--  Sequence structure for notification_setting_id_seq
-- ----------------------------
DROP SEQUENCE IF EXISTS "notification"."notification_setting_id_seq";
CREATE SEQUENCE "notification"."notification_setting_id_seq" INCREMENT 1 START 1 MAXVALUE 9223372036854775807 MINVALUE 1 CACHE 1;
-- ALTER TABLE "notification"."notification_setting_id_seq" OWNER TO "social";
GRANT USAGE ON SEQUENCE "notification"."notification_setting_id_seq" TO "social";