text:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>io.apiman</groupId>
    <artifactId>apiman-distro</artifactId>
    <version>1.2.3-SNAPSHOT</version>
  </parent>
  <artifactId>apiman-distro-ddl</artifactId>
  <name>apiman-distro-ddl</name>

  <properties>
    <version.org.postgresql.jdbc.driver>9.4-1201-jdbc41</version.org.postgresql.jdbc.driver>
    <version.mysql.jdbc.driver>5.1.35</version.mysql.jdbc.driver>
    <version.com.oracle.driver>12.1.0.2</version.com.oracle.driver>
    <version.liquibase>3.4.1</version.liquibase>
  </properties>

  <dependencies>
    <!-- Project Dependencies -->
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>apiman-manager-api-beans</artifactId>
      <version>${project.version}</version>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>org.liquibase</groupId>
        <artifactId>liquibase-maven-plugin</artifactId>
        <version>${version.liquibase}</version>
        <dependencies>
          <!-- Database drivers -->
          <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <version>${version.com.h2database}</version>
          </dependency>
          <dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
            <version>${version.org.postgresql.jdbc.driver}</version>
          </dependency>
          <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>${version.mysql.jdbc.driver}</version>
          </dependency>
          <!-- The Oracle dependency - uncomment to generate the Oracle DDL
          <dependency>
            <groupId>com.oracle</groupId>
            <artifactId>ojdbc7</artifactId>
            <version>${version.com.oracle.driver}</version>
          </dependency>
           -->
          <!-- Liquibase -->
          <dependency>
            <groupId>org.liquibase</groupId>
            <artifactId>liquibase-core</artifactId>
            <version>${version.liquibase}</version>
          </dependency>
          <dependency>
            <groupId>org.liquibase.ext</groupId>
            <artifactId>liquibase-hibernate4</artifactId>
            <version>3.5</version>
          </dependency>
          <!-- Note: the dependency versions below are specific to the liquibase-hibernate4 version being used
            above. -->
          <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-beans</artifactId>
            <version>3.2.4.RELEASE</version>
          </dependency>
          <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>3.2.4.RELEASE</version>
          </dependency>
          <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-orm</artifactId>
            <version>3.2.4.RELEASE</version>
          </dependency>
          <dependency>
            <groupId>org.yaml</groupId>
            <artifactId>snakeyaml</artifactId>
            <version>1.13</version>
          </dependency>
        </dependencies>
        <configuration>
          <changeLogFile>${basedir}/src/main/liquibase/master.xml</changeLogFile>
          <diffChangeLogFile>${basedir}/target/entities-diff.xml</diffChangeLogFile>
          <outputFileEncoding>UTF-8</outputFileEncoding>
          <diffIncludeCatalog>false</diffIncludeCatalog>
        </configuration>
        <executions>
          <execution>
            <!-- This step is used to create the current database, based on the current changelogs -->
            <id>h2-update</id>
            <!--<phase>process-resources</phase> -->
            <goals>
              <goal>update</goal>
            </goals>
            <configuration>
              <changeLogFile>/src/main/liquibase/master.xml</changeLogFile>
              <driver>org.h2.Driver</driver>
              <url>jdbc:h2:${basedir}/target/apiman_manager_api;DATABASE_TO_UPPER=false;</url>
              <username>sa</username>
              <emptyPassword>true</emptyPassword>
              <promptOnNonLocalDatabase>false</promptOnNonLocalDatabase>
              <verbose>true</verbose>
            </configuration>
          </execution>
          <execution>
            <id>h2-entities-diff</id>
            <!--<phase>process-resources</phase> -->
            <goals>
              <goal>diff</goal>
            </goals>
            <configuration>
              <url>jdbc:h2:${basedir}/target/apiman_manager_api</url>
              <username>sa</username>
              <emptyPassword>true</emptyPassword>
              <!-- May be a comma separated list of packages to scan -->
              <referenceUrl>hibernate:spring:io.apiman.manager.api.beans?dialect=liquibase.ext.hibernate.database.HibernateGenericDialect</referenceUrl>
              <verbose>true</verbose>
            </configuration>
          </execution>
          <execution>
            <id>h2-ddl</id>
            <phase>compile</phase>
            <goals>
              <goal>updateSQL</goal>
            </goals>
            <configuration>
              <migrationSqlOutputFile>${basedir}/target/apiman_h2.ddl</migrationSqlOutputFile>
              <driver>org.h2.Driver</driver>
              <url>offline:h2?version=1.3&caseSensitive=true&changeLogFile=${basedir}/target/changelog/h2/databasechangelog.csv</url>
              <username>sa</username>
              <emptyPassword>true</emptyPassword>
              <promptOnNonLocalDatabase>false</promptOnNonLocalDatabase>
              <verbose>true</verbose>
            </configuration>
          </execution>
          <execution>
            <id>postgresql-ddl</id>
            <phase>compile</phase>
            <goals>
              <goal>updateSQL</goal>
            </goals>
            <configuration>
              <migrationSqlOutputFile>${basedir}/target/apiman_postgresql9.ddl</migrationSqlOutputFile>
              <driver>org.postgresql.Driver</driver>
              <url>offline:postgresql?version=9.3&caseSensitive=true&changeLogFile=${basedir}/target/changelog/postgresql/databasechangelog.csv</url>
              <username>apiman</username>
              <password>apiman</password>
              <!-- Note: when upgrading from liquibase 3.3.5 -> 3.4.1, adding the defaultSchemaName below became
                a requirement - otherwise this goal will fail. This setting only appears to be required for Postgres. -->
              <defaultSchemaName>public</defaultSchemaName>
              <promptOnNonLocalDatabase>false</promptOnNonLocalDatabase>
              <verbose>true</verbose>
            </configuration>
          </execution>
          <execution>
            <id>mysql-ddl</id>
            <phase>compile</phase>
            <goals>
              <goal>updateSQL</goal>
            </goals>
            <configuration>
              <migrationSqlOutputFile>${basedir}/target/apiman_mysql5.ddl</migrationSqlOutputFile>
              <driver>com.mysql.jdbc.Driver</driver>
              <url>offline:mysql?version=5.1&caseSensitive=true&changeLogFile=${basedir}/target/changelog/mysql/databasechangelog.csv</url>
              <username>apiman</username>
              <password>apiman</password>
              <promptOnNonLocalDatabase>false</promptOnNonLocalDatabase>
              <verbose>true</verbose>
            </configuration>
          </execution>
          <!-- Commented out because you need to manually install the Oracle JDBC driver JAR as a
               Maven dependency for this to work.  Here's how you do that:

               1) Download the oracle driver:  http://www.oracle.com/technetwork/database/features/jdbc/index-091264.html
               2) Install it:  mvn install:install-file -Dfile=ojdbc7.jar -DgroupId=com.oracle -DartifactId=ojdbc7 -Dversion=12.1.0.2 -Dpackaging=jar
          <execution>
            <id>oracle-ddl</id>
            <phase>compile</phase>
            <goals>
              <goal>updateSQL</goal>
            </goals>
            <configuration>
              <migrationSqlOutputFile>${basedir}/target/apiman_oracle12.ddl</migrationSqlOutputFile>
              <driver>oracle.jdbc.OracleDriver</driver>
              <url>offline:oracle?version=12&caseSensitive=true&changeLogFile=${basedir}/target/changelog/oracle/databasechangelog.csv</url>
              <username>apiman</username>
              <password>apiman</password>
              <promptOnNonLocalDatabase>false</promptOnNonLocalDatabase>
              <verbose>true</verbose>
            </configuration>
          </execution>
           -->
        </executions>
      </plugin>
    </plugins>
    <pluginManagement>
      <plugins>
        <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the
          Maven build itself. -->
        <plugin>
          <groupId>org.eclipse.m2e</groupId>
          <artifactId>lifecycle-mapping</artifactId>
          <version>1.0.0</version>
          <configuration>
            <lifecycleMappingMetadata>
              <pluginExecutions>
                <pluginExecution>
                  <pluginExecutionFilter>
                    <groupId>org.liquibase</groupId>
                    <artifactId>liquibase-maven-plugin</artifactId>
                    <versionRange>[3.4.1,)</versionRange>
                    <goals>
                      <goal>update</goal>
                      <goal>updateSQL</goal>
                    </goals>
                  </pluginExecutionFilter>
                  <action>
                    <ignore></ignore>
                  </action>
                </pluginExecution>
              </pluginExecutions>
            </lifecycleMappingMetadata>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>
</project>


text:
(function($, Backbone, _) {

    "use strict";

    // The Category Menu Item View
    // ---------------
    var CategoryMenuItemView = Backbone.StatefulView.extend({

        //... is a list tag.
        tagName:  "li"

    ,   template: '#category-menu-item-template'

        // Cache the template function for a single item.
    ,   initializeTemplate: function() {
            this.template = _.template($(this.template).html());
        }

        // The DOM events specific to an item.
    ,   events: {
            "click .ex-js-menu-item-container": "onClick"
        ,   "mouseenter .ex-js-menu-item-container": "onMouseEnter"
        ,   "mouseleave .ex-js-menu-item-container": "onMouseLeave"

        }

    //,   model: CategoryItem

    ,   isHover: false

    ,   initialize: function(options) {
            this.childrenView = options.childrenView || CategoryMenuItemView

            this.initializeTemplate()

            this.collection = this.model.collection

            var rootModel = this.model.collection.getRoot()

            this.children = []

            this.parent = options.parent ? options.parent : null

            _.each(this.model.getChildren(), function( model ){
                var view = new this.childrenView({model: model, parent: this, childrenView: this.childrenView})
                this.children.push(view)
            }, this)

            this.isActual = false
            this.isUpdateLock = false
            this.isRootModel = this.model == rootModel

            this.$details = $()

            this.collection.on('collection:startCascadeUpdate:selected', this.lockUpdate, this)
            this.collection.on('collection:finishCascadeUpdate:selected', this.unlockUpdate, this)

            this.model.on('change', this.change, this)
            this.model.on('remove outdate', this.clear, this)

            this.on('transition', function(leaveState, enterState) {
                if ( enterState != 'ex-state-outdate' ) {
                    this.model.set({currentState: enterState}, {silent: true})
                }
            }, this)

            _.bindAll(this, 'outsideClickHandler', 'doSelect', 'tryClose', 'tryOpen')

            this.toState(this.model.get('currentState'))

        }

    ,   states: {
            'ex-state-closed': {}
        ,   'ex-state-opened': {
                enter: ['doOpen']
            ,   leave: ['doClose']
            }
        }

    ,   transitions: {
            'init': {
                'initialized': {enterState: 'ex-state-closed'}
            }
        ,   '*': {
                'outdate': {enterState: 'ex-state-outdate'}
            }
        ,   'ex-state-closed': {
                'open': {enterState: 'ex-state-opened'}
            }
        ,   'ex-state-opened': {
                'close': {enterState: 'ex-state-closed'}
            }

        }

        // Re-render the rubric item.
    ,   render: function() {
            var isNotActual = !this.isActual || _.find(this.children, function( view ){ return !view.isActual })
            if ( isNotActual ) {
                _.each(this.children, function( view ){ view.$el.detach() }, this)
                var parent = this.model.getParent()
                ,   context = _.extend(_.clone(this.model.getJSON()), {
                            parent: (parent) ? parent.getJSON() : null
                        ,   children: _.map(this.model.getChildren(), function( model ) { return model.getJSON() })
                        })
                ,   level = this.model.getLevel()
                // redraw element
                var elAttr = {
                    'data-slug': this.model.get('slug')
                ,   'data-class-name': this.model.get('class_name')
                ,   'data-lvl': level
                ,   'data-status': this.model.get('status') || ''
                }
                if ( this.children.length ) {
                    elAttr['data-has-children'] = true
                }

                this.$el.empty().append($(this.template(context))).attr(elAttr)

                // delegate events
                this.delegateEvents()

                this.$details = (parent) ? this.$('.ex-js-details') : this.$el.closest('.ex-js-details')
                _.each(this.children, function( view ){ this.$details.append(view.render().$el) }, this)

                this.isActual = true
                // render
            } else {
                _.each(this.children, function( view ){ view.render() })
                // re-render
            }

            return this
        }

    ,   change: function() {
            this.isActual = false
            if ( !this.isUpdateLock ) {
                this.render()
            }
        }

    ,   lockUpdate: function() {
            this.isUpdateLock = true
        }

    ,   unlockUpdate: function() {
            this.isUpdateLock = false
            if ( this.isRootModel ) {
                this.render()
            }
        }

    ,   clear: function() {
            if ( this.isRootModel ) {
                this.stopListening()
            } else {
                this.remove()
            }
        }

    ,   stopListening: function() {
            this.collection.off('collection:startCascadeUpdate:selected', this.lockUpdate, this)
            this.collection.off('collection:finishCascadeUpdate:selected', this.unlockUpdate, this)

            this.model.off('change', this.change, this)
            this.model.off('remove outdate', this.clear, this)

            return Backbone.View.prototype.stopListening.call(this)
        }

    ,   remove: function() {
            this.trigger('outdate')
            return Backbone.View.prototype.remove.call(this)
        }

    ,   onClick: function() {
            if ( !this.isHover && this.model.getChildren().length ) {
                this.isHover = true
                this.tryOpen()
            } else {
                _.defer(this.doSelect)
                this.tryClose({force: true})
            }
            $(document.body).trigger('click')
            return false
        }

    ,   onMouseEnter: function() {
            if ( this.isMobile() ) {
                return
            }
            this.isHover = true
            this.tryOpen()
            return false

        }

    ,   onMouseLeave: function() {
            if ( this.isMobile() ) {
                return
            }
            this.isHover = false
            _.delay(this.tryClose, 600)
            return false
        }

    ,   outsideClickHandler: function(e) {
            this.tryClose({force: true})
        }

    ,   doSelect: function() {
            this.model.set('status', 'selected')
        }

    ,   doOpen: function() {
            if ( this.$details.length ) {
                var $window = $(window)
                ,   offset = this.$details.offset()
                ,   screenHeight = $window.height()
                ,   elTop = offset.top - $window.scrollTop()
                ,   elHeight = this.$details.outerHeight()
                ,   screenWidth = $window.width()
                ,   elLeft = offset.left - $window.scrollLeft()
                ,   elWidth = this.$details.outerWidth()
                ,   hDirection = ( elLeft + elWidth > screenWidth ) && ( elWidth * 2 <= elLeft ) ? 'rtl' : 'ltr'
                ,   vDirection = ( elTop + elHeight > screenHeight ) && ( elHeight <= elTop ) ? 'btt' : 'ttb'
                this.$details.attr({
                    'data-horizontal-direction': hDirection
                ,   'data-vertical-direction': vDirection
                })
            }
            if ( this.model.getLevel() == 1 ) {
                if ( this.isMobile() ) {
                    this.backdrop = $('<div class="ex-dropdown-backdrop"/>').insertBefore(this.parent.$el).on('click', this.outsideClickHandler)
                } else {
                    $(document).on('click', this.outsideClickHandler)
                }
            }
        }

    ,   doClose: function() {
            if ( this.$details.length ) {
                this.$details.removeAttr("data-horizontal-direction data-vertical-direction")
            }
            if ( this.model.getLevel() == 1 ) {
                if ( this.backdrop ) {
                    $(this.backdrop).off('click', this.outsideClickHandler).remove()
                    delete this.backdrop
                } else {
                    $(document).off('click', this.outsideClickHandler)
                }
            }
        }

    ,   tryClose: function(options){
            var settings = _.extend({
                    direction: "all"
                ,   force: false
                }, options)
            ,   doClose = false
            if ( !this.isHover || settings.force ) {
                if ( settings.direction == "parent" ) {
                    doClose = true
                } else {
                    var openedChildren = _.find(this.children, function( view ){
                        return view.currentState.indexOf('ex-state-opened') != -1
                    })
                    doClose = !openedChildren || openedChildren.tryClose({"direction": "children", force: settings.force})
                }
                if ( doClose ) {
                    this.isHover = false
                    this.trigger('close')
                    if ( (settings.direction != "children") && this.parent &&
                            (this.parent.currentState.indexOf('ex-state-closed') == -1) && this.parent.parent ) {
                        var openedSibling = _.find(this.parent.children, function( view ){
                            return view.currentState.indexOf('ex-state-opened') != -1
                        })
                        if ( !openedSibling ) {
                            this.parent.tryClose({"direction": "parent", force: settings.force})
                        }
                    }
                }
            }
            return doClose
        }

    ,   tryOpen: function(){
            if ( ( this.currentState.indexOf('ex-state-opened') == -1 ) && this.parent ) {
                var that = this
                ,   openedSibling = _.find(this.parent.children, function( view ){
                        return ( that != view ) && ( view.currentState.indexOf('ex-state-opened') != -1 )
                    })
                if ( openedSibling ) {
                    openedSibling.tryClose({"direction": "children", force: true})
                }
                this.parent.tryOpen()
                this.trigger('open')
            }
            return this.currentState.indexOf('ex-state-opened') != -1
        }

    ,   isMobile: function(){
            return BBNS.app.isTouch || ( $(window).width() < 980 )
        }

    })

    // The Module
    // --------------

    var Module = BBNS.Module.extend({

        name: "CategoryMenuItemView"

    ,   views: {
            CategoryMenuItemView: CategoryMenuItemView
        }

    })

    var App = new Module()

})(jQuery, Backbone, _);

redpajama_set_name: RedPajamaGithub


text:
/* =============================================================================
 *
 *                  COPYRIGHT 2010 BBN Technologies Corp.
 *                  1300 North 17th Street, Suite 600
 *                       Arlington, VA  22209
 *                          (703) 284-1200
 *
 *       This program is the subject of intellectual property rights
 *       licensed from BBN Technologies
 *
 *       This legend must continue to appear in the source code
 *       despite modifications or enhancements by any party.
 *
 *
 * ==============================================================================
 */

package com.bbn.c2s2.pint.exception;

import junit.framework.TestCase;

/**
 * @author tself
 *
 */
public class InvalidProcessExceptionTest extends TestCase {

	/**
	 * Test method for {@link com.bbn.c2s2.pint.exception.InvalidProcessException#InvalidProcessException(java.lang.String)}.
	 */
	public void testInvalidProcessExceptionString() {
		new InvalidProcessException("Test");
	}

	/**
	 * Test method for {@link com.bbn.c2s2.pint.exception.InvalidProcessException#InvalidProcessException(java.lang.Throwable)}.
	 */
	public void testInvalidProcessExceptionThrowable() {
		new InvalidProcessException(new InvalidProcessException("Test"));
	}

	/**
	 * Test method for {@link com.bbn.c2s2.pint.exception.InvalidProcessException#InvalidProcessException(java.lang.String, java.lang.Throwable)}.
	 */
	public void testInvalidProcessExceptionStringThrowable() {
		new InvalidProcessException("Test", new InvalidProcessException("Test"));
	}

}


text:
'use strict';
var exporter = require('../lib/exporter.js');
var assert = require('assert');
var _ = require('lodash');

describe('config', function () {
  var url = 'http://localhost:1337';

  beforeEach(function () {
    exporter.config = {};
  });

  it('should read a global config', function () {
    var config = exporter.config = require('./fixtures/config.json');
    var e = exporter();
    assert.deepEqual(e.settings, config, 'config match');
  });

  it('should allow for instance config values', function () {
    var e = exporter().config({
      $root: url,
    });
    assert.deepEqual(e.settings, { $root: url }, 'config match');
  });

  it('should shallow merge', function () {
    var config = exporter.config = require('./fixtures/config.json');
    var e = exporter().config({
      $root: url,
    });

    var copy = _.cloneDeep(config);
    copy.$root = url;

    assert.deepEqual(e.settings, copy);
  });

  it('should deep merge and maintain surrounding structure', function () {
    var config = exporter.config = require('./fixtures/config.json');
    var e = exporter().config({
      participants: {
        $methods: {
          custom: url,
        },
      },
    });

    var copy = _.cloneDeep(config);
    copy.participants.$methods.custom = url;

    assert.deepEqual(e.settings, copy);
  });

});


text:
START_ATF_NAMESPACE
    namespace Info
    {
        using _npclink_check_item_result_zoclsize2_ptr = int (WINAPIV*)(struct _npclink_check_item_result_zocl*);
        using _npclink_check_item_result_zoclsize2_clbk = int (WINAPIV*)(struct _npclink_check_item_result_zocl*, _npclink_check_item_result_zoclsize2_ptr);
    }; // end namespace Info
END_ATF_NAMESPACE


text:
@interface TMCoreDataStack : NSObject

@property (readonly, strong, nonatomic) NSManagedObjectContext          *backgroundSaveObjectContext;
@property (readonly, strong, nonatomic) NSManagedObjectContext          *mainThreadObjectContext;

@property (readonly, strong, nonatomic) NSManagedObjectModel            *managedObjectModel;
@property (readonly, strong, nonatomic) NSPersistentStoreCoordinator    *persistentStoreCoordinator;

@property (assign) BOOL canFailToMemoryContext;
@property (assign) BOOL canDeleteOnFail;

-(id)initWithManagedObjectModelName:(NSString*)momName databaseName:(NSString*)databaseName canDeleteOnFail:(BOOL)deletable;
-(id)initWithManagedObjectModel:(NSManagedObjectModel*)model databaseName:(NSString*)databaseName canDeleteOnFail:(BOOL)deletable;

-(BOOL)removeDatabaseWithName:(NSString*)databaseName error:(NSError **)error;

@end


text:
require 'logger'

module GetThemAll
  class SiteDownloaderLogger < Logger
    def format_message(level, time, progname, msg)
      "[#{level} -- #{time.strftime("%Y/%m/%d %H:%M:%S")}] #{msg}\n"
    end
  end

  class SiteDownloader
    cattr_accessor :logger

    self.logger= SiteDownloaderLogger.new(STDOUT)
    self.logger.level = Logger::ERROR
  end
end

# helpers
def debug(msg, short_msg = nil)
  GetThemAll::SiteDownloader::logger.debug(msg)
end

def info(msg)
  GetThemAll::SiteDownloader::logger.info(msg)
end

def warn(msg)
  GetThemAll::SiteDownloader::logger.warn(msg)
end

def error(msg, fatal = false)
  GetThemAll::SiteDownloader::logger.error(msg)
  exit(1) if fatal
end


text:
package com.pattern.command;

public class CodeGroup extends Group {

    @Override
    public void find() {
        System.out.println("Find code group");
    }

    @Override
    public void add() {
        System.out.println("Add new code");

    }

    @Override
    public void delete() {
        System.out.println("Delete code");

    }

    @Override
    public void change() {
        System.out.println("Change code");

    }

    @Override
    public void plan() {
        System.out.println("Code plan");

    }

}


text:
.class public Lorg/achartengine/chart/CubicLineChart;
.super Lorg/achartengine/chart/LineChart;

# static fields
.field public static final TYPE:Ljava/lang/String; = "Cubic"

# instance fields
.field private a:F

.field private b:F

.field private c:Lorg/achartengine/model/Point;

.field private d:Lorg/achartengine/model/Point;

.field private e:Lorg/achartengine/model/Point;

# direct methods
.method public constructor <init>()V
    .locals 2

    invoke-direct {p0}, Lorg/achartengine/chart/LineChart;-><init>()V

    new-instance v0, Lorg/achartengine/model/Point;

    invoke-direct {v0}, Lorg/achartengine/model/Point;-><init>()V

    iput-object v0, p0, Lorg/achartengine/chart/CubicLineChart;->c:Lorg/achartengine/model/Point;

    new-instance v0, Lorg/achartengine/model/Point;

    invoke-direct {v0}, Lorg/achartengine/model/Point;-><init>()V

    iput-object v0, p0, Lorg/achartengine/chart/CubicLineChart;->d:Lorg/achartengine/model/Point;

    new-instance v0, Lorg/achartengine/model/Point;

    invoke-direct {v0}, Lorg/achartengine/model/Point;-><init>()V

    iput-object v0, p0, Lorg/achartengine/chart/CubicLineChart;->e:Lorg/achartengine/model/Point;

    const v0, 0x3ea8f5c3    # 0.33f

    iput v0, p0, Lorg/achartengine/chart/CubicLineChart;->a:F

    const/high16 v0, 0x3f800000    # 1.0f

    iget v1, p0, Lorg/achartengine/chart/CubicLineChart;->a:F

    sub-float/2addr v0, v1

    iput v0, p0, Lorg/achartengine/chart/CubicLineChart;->b:F

    return-void
.end method

.method public constructor <init>(Lorg/achartengine/model/XYMultipleSeriesDataset;Lorg/achartengine/renderer/XYMultipleSeriesRenderer;F)V
    .locals 2

    invoke-direct {p0, p1, p2}, Lorg/achartengine/chart/LineChart;-><init>(Lorg/achartengine/model/XYMultipleSeriesDataset;Lorg/achartengine/renderer/XYMultipleSeriesRenderer;)V

    new-instance v0, Lorg/achartengine/model/Point;

    invoke-direct {v0}, Lorg/achartengine/model/Point;-><init>()V

    iput-object v0, p0, Lorg/achartengine/chart/CubicLineChart;->c:Lorg/achartengine/model/Point;

    new-instance v0, Lorg/achartengine/model/Point;

    invoke-direct {v0}, Lorg/achartengine/model/Point;-><init>()V

    iput-object v0, p0, Lorg/achartengine/chart/CubicLineChart;->d:Lorg/achartengine/model/Point;

    new-instance v0, Lorg/achartengine/model/Point;

    invoke-direct {v0}, Lorg/achartengine/model/Point;-><init>()V

    iput-object v0, p0, Lorg/achartengine/chart/CubicLineChart;->e:Lorg/achartengine/model/Point;

    iput p3, p0, Lorg/achartengine/chart/CubicLineChart;->a:F

    const/high16 v0, 0x3f800000    # 1.0f

    iget v1, p0, Lorg/achartengine/chart/CubicLineChart;->a:F

    sub-float/2addr v0, v1

    iput v0, p0, Lorg/achartengine/chart/CubicLineChart;->b:F

    return-void
.end method

.method private a(Ljava/util/List;Lorg/achartengine/model/Point;IIF)V
    .locals 4
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Ljava/util/List",
            "<",
            "Ljava/lang/Float;",
            ">;",
            "Lorg/achartengine/model/Point;",
            "IIF)V"
        }
    .end annotation

    invoke-interface {p1, p3}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Ljava/lang/Float;

    invoke-virtual {v0}, Ljava/lang/Float;->floatValue()F

    move-result v1

    add-int/lit8 v0, p3, 0x1

    invoke-interface {p1, v0}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Ljava/lang/Float;

    invoke-virtual {v0}, Ljava/lang/Float;->floatValue()F

    move-result v2

    invoke-interface {p1, p4}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Ljava/lang/Float;

    invoke-virtual {v0}, Ljava/lang/Float;->floatValue()F

    move-result v3

    add-int/lit8 v0, p4, 0x1

    invoke-interface {p1, v0}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Ljava/lang/Float;

    invoke-virtual {v0}, Ljava/lang/Float;->floatValue()F

    move-result v0

    sub-float/2addr v3, v1

    sub-float/2addr v0, v2

    mul-float/2addr v3, p5

    add-float/2addr v1, v3

    invoke-virtual {p2, v1}, Lorg/achartengine/model/Point;->setX(F)V

    mul-float/2addr v0, p5

    add-float/2addr v0, v2

    invoke-virtual {p2, v0}, Lorg/achartengine/model/Point;->setY(F)V

    return-void
.end method

# virtual methods
.method protected drawPath(Landroid/graphics/Canvas;Ljava/util/List;Landroid/graphics/Paint;Z)V
    .locals 14
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Landroid/graphics/Canvas;",
            "Ljava/util/List",
            "<",
            "Ljava/lang/Float;",
            ">;",
            "Landroid/graphics/Paint;",
            "Z)V"
        }
    .end annotation

    new-instance v13, Landroid/graphics/Path;

    invoke-direct {v13}, Landroid/graphics/Path;-><init>()V

    const/4 v1, 0x0

    move-object/from16 v0, p2

    invoke-interface {v0, v1}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Ljava/lang/Float;

    invoke-virtual {v1}, Ljava/lang/Float;->floatValue()F

    move-result v2

    const/4 v1, 0x1

    move-object/from16 v0, p2

    invoke-interface {v0, v1}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Ljava/lang/Float;

    invoke-virtual {v1}, Ljava/lang/Float;->floatValue()F

    move-result v1

    invoke-virtual {v13, v2, v1}, Landroid/graphics/Path;->moveTo(FF)V

    invoke-interface/range {p2 .. p2}, Ljava/util/List;->size()I

    move-result v1

    if-eqz p4, :cond_5

    add-int/lit8 v1, v1, -0x4

    move v12, v1

    :goto_0
    const/4 v4, 0x0

    :goto_1
    if-ge v4, v12, :cond_2

    add-int/lit8 v1, v4, 0x2

    if-ge v1, v12, :cond_0

    add-int/lit8 v5, v4, 0x2

    :goto_2
    add-int/lit8 v1, v4, 0x4

    if-ge v1, v12, :cond_1

    add-int/lit8 v10, v4, 0x4

    :goto_3
    iget-object v3, p0, Lorg/achartengine/chart/CubicLineChart;->c:Lorg/achartengine/model/Point;

    iget v6, p0, Lorg/achartengine/chart/CubicLineChart;->b:F

    move-object v1, p0

    move-object/from16 v2, p2

    invoke-direct/range {v1 .. v6}, Lorg/achartengine/chart/CubicLineChart;->a(Ljava/util/List;Lorg/achartengine/model/Point;IIF)V

    iget-object v2, p0, Lorg/achartengine/chart/CubicLineChart;->d:Lorg/achartengine/model/Point;

    move-object/from16 v0, p2

    invoke-interface {v0, v5}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Ljava/lang/Float;

    invoke-virtual {v1}, Ljava/lang/Float;->floatValue()F

    move-result v1

    invoke-virtual {v2, v1}, Lorg/achartengine/model/Point;->setX(F)V

    iget-object v2, p0, Lorg/achartengine/chart/CubicLineChart;->d:Lorg/achartengine/model/Point;

    add-int/lit8 v1, v5, 0x1

    move-object/from16 v0, p2

    invoke-interface {v0, v1}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Ljava/lang/Float;

    invoke-virtual {v1}, Ljava/lang/Float;->floatValue()F

    move-result v1

    invoke-virtual {v2, v1}, Lorg/achartengine/model/Point;->setY(F)V

    iget-object v8, p0, Lorg/achartengine/chart/CubicLineChart;->e:Lorg/achartengine/model/Point;

    iget v11, p0, Lorg/achartengine/chart/CubicLineChart;->a:F

    move-object v6, p0

    move-object/from16 v7, p2

    move v9, v5

    invoke-direct/range {v6 .. v11}, Lorg/achartengine/chart/CubicLineChart;->a(Ljava/util/List;Lorg/achartengine/model/Point;IIF)V

    iget-object v1, p0, Lorg/achartengine/chart/CubicLineChart;->c:Lorg/achartengine/model/Point;

    invoke-virtual {v1}, Lorg/achartengine/model/Point;->getX()F

    move-result v6

    iget-object v1, p0, Lorg/achartengine/chart/CubicLineChart;->c:Lorg/achartengine/model/Point;

    invoke-virtual {v1}, Lorg/achartengine/model/Point;->getY()F

    move-result v7

    iget-object v1, p0, Lorg/achartengine/chart/CubicLineChart;->d:Lorg/achartengine/model/Point;

    invoke-virtual {v1}, Lorg/achartengine/model/Point;->getX()F

    move-result v8

    iget-object v1, p0, Lorg/achartengine/chart/CubicLineChart;->d:Lorg/achartengine/model/Point;

    invoke-virtual {v1}, Lorg/achartengine/model/Point;->getY()F

    move-result v9

    iget-object v1, p0, Lorg/achartengine/chart/CubicLineChart;->e:Lorg/achartengine/model/Point;

    invoke-virtual {v1}, Lorg/achartengine/model/Point;->getX()F

    move-result v10

    iget-object v1, p0, Lorg/achartengine/chart/CubicLineChart;->e:Lorg/achartengine/model/Point;

    invoke-virtual {v1}, Lorg/achartengine/model/Point;->getY()F

    move-result v11

    move-object v5, v13

    invoke-virtual/range {v5 .. v11}, Landroid/graphics/Path;->cubicTo(FFFFFF)V

    add-int/lit8 v4, v4, 0x2

    goto :goto_1

    :cond_0
    move v5, v4

    goto :goto_2

    :cond_1
    move v10, v5

    goto :goto_3

    :cond_2
    if-eqz p4, :cond_4

    move v2, v12

    :goto_4
    add-int/lit8 v1, v12, 0x4

    if-ge v2, v1, :cond_3

    move-object/from16 v0, p2

    invoke-interface {v0, v2}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Ljava/lang/Float;

    invoke-virtual {v1}, Ljava/lang/Float;->floatValue()F

    move-result v3

    add-int/lit8 v1, v2, 0x1

    move-object/from16 v0, p2

    invoke-interface {v0, v1}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Ljava/lang/Float;

    invoke-virtual {v1}, Ljava/lang/Float;->floatValue()F

    move-result v1

    invoke-virtual {v13, v3, v1}, Landroid/graphics/Path;->lineTo(FF)V

    add-int/lit8 v1, v2, 0x2

    move v2, v1

    goto :goto_4

    :cond_3
    const/4 v1, 0x0

    move-object/from16 v0, p2

    invoke-interface {v0, v1}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Ljava/lang/Float;

    invoke-virtual {v1}, Ljava/lang/Float;->floatValue()F

    move-result v2

    const/4 v1, 0x1

    move-object/from16 v0, p2

    invoke-interface {v0, v1}, Ljava/util/List;->get(I)Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Ljava/lang/Float;

    invoke-virtual {v1}, Ljava/lang/Float;->floatValue()F

    move-result v1

    invoke-virtual {v13, v2, v1}, Landroid/graphics/Path;->lineTo(FF)V

    :cond_4
    move-object/from16 v0, p3

    invoke-virtual {p1, v13, v0}, Landroid/graphics/Canvas;->drawPath(Landroid/graphics/Path;Landroid/graphics/Paint;)V

    return-void

    :cond_5
    move v12, v1

    goto/16 :goto_0
.end method

.method public getChartType()Ljava/lang/String;
    .locals 1

    const-string v0, "Cubic"

    return-object v0
.end method


text:
package org.jeasy.batch.json;

import org.jeasy.batch.core.reader.AbstractFileRecordReader;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.nio.charset.Charset;
import java.nio.file.Path;

/**
 * Record reader that reads Json records from an Json file with the following format:
 *

 * [
 * {
 * // JSON object
 * },
 * {
 * // JSON object
 * }
 * ]
 *

 *
This reader produces {@link JsonRecord} instances.

 *
 * @author Mahmoud Ben Hassine (mahmoud.benhassine@icloud.com)
 */
public class JsonFileRecordReader extends AbstractFileRecordReader<String> {

    private JsonRecordReader jsonRecordReader;

    /**
     * Create a new {@link JsonFileRecordReader}.
     *
     * @param jsonFile to read
     */
    public JsonFileRecordReader(final Path jsonFile) {
        this(jsonFile, Charset.defaultCharset());
    }

    /**
     * Create a new {@link JsonFileRecordReader}.
     *
     * @param jsonFile to read
     * @param charset of the file
     */
    public JsonFileRecordReader(final Path jsonFile, final Charset charset) {
        super(jsonFile, charset);
    }

    @Override
    public void open() throws Exception {
        jsonRecordReader = new Reader(path, charset);
        jsonRecordReader.open();
    }

    @Override
    public JsonRecord readRecord() {
        return jsonRecordReader.readRecord();
    }

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

    // JsonFileRecordReader should return the file name as data source instead of the inherited "Json stream"
    private static class Reader extends JsonRecordReader {

        private Path path;

        Reader(Path path, Charset charset) throws FileNotFoundException {
            super(new FileInputStream(path.toFile()), charset);
            this.path = path;
        }

        @Override
        protected String getDataSourceName() {
            return path.toAbsolutePath().toString();
        }
    }
}


text:
<?php

/**
 * @file
 * Contains \Drupal\Core\Theme\ThemeManagerInterface.
 */

namespace Drupal\Core\Theme;

/**
 * Provides a high level access to the active theme and methods to use it.
 *
 * Beside the active theme it provides a wrapper around _theme as well as the
 * alter functionality for themes.
 */
interface ThemeManagerInterface {

  /**
   * Generates themed output.
   *
   * See the @link themeable Default theme implementations topic @endlink for
   * details.
   *
   * @param string $hook
   *   The name of the theme hook to call.
   * @param array $variables
   *   An associative array of theme variables.
   *
   * @return string
   *   The rendered output.
   */
  public function render($hook, array $variables);

  /**
   * Returns the active theme object.
   *
   * @return \Drupal\Core\Theme\ActiveTheme
   */
  public function getActiveTheme();

  /**
   * Determines whether there is an active theme.
   *
   * @return bool
   */
  public function hasActiveTheme();

  /**
   * Resets the current active theme.
   *
   * Note: This method should not be used in common cases, just in special cases
   * like tests.
   *
   * @return $this
   */
  public function resetActiveTheme();

  /**
   * Sets the current active theme manually.
   *
   * Note: This method should not be used in common cases, just in special cases
   * like tests.
   *
   * @param \Drupal\Core\Theme\ActiveTheme $active_theme
   *   The new active theme.
   * @return $this
   */
  public function setActiveTheme(ActiveTheme $active_theme);

  /**
   * Passes alterable variables to specific $theme_TYPE_alter() implementations.
   *
   * It also invokes alter hooks for all base themes.
   *
   * $theme specifies the theme name of the active theme and all its base
   * themes.
   *
   * This dispatch function hands off the passed-in variables to type-specific
   * $theme_TYPE_alter() implementations in the active theme. It ensures a
   * consistent interface for all altering operations.
   *
   * A maximum of 2 alterable arguments is supported. In case more arguments
   * need to be passed and alterable, modules provide additional variables
   * assigned by reference in the last $context argument:
   * @code
   *   $context = array(
   *     'alterable' => &$alterable,
   *     'unalterable' => $unalterable,
   *     'foo' => 'bar',
   *   );
   *   $this->alter('mymodule_data', $alterable1, $alterable2, $context);
   * @endcode
   *
   * Note that objects are always passed by reference in PHP5. If it is
   * absolutely required that no implementation alters a passed object in
   * $context, then an object needs to be cloned:
   * @code
   *   $context = array(
   *     'unalterable_object' => clone $object,
   *   );
   *   $this->alter('mymodule_data', $data, $context);
   * @endcode
   *
   * @param string|array $type
   *   A string describing the type of the alterable $data. 'form', 'links',
   *   'node_content', and so on are several examples. Alternatively can be an
   *   array, in which case $theme_TYPE_alter() is invoked for each value in the
   *   array. When Form API is using $this->alter() to
   *   execute both $theme_form_alter() and $theme_form_FORM_ID_alter()
   *   implementations, it passes array('form', 'form_' . $form_id) for $type.
   * @param mixed $data
   *   The variable that will be passed to $theme_TYPE_alter() implementations
   *   to be altered. The type of this variable depends on the value of the
   *   $type argument. For example, when altering a 'form', $data will be a
   *   structured array. When altering a 'profile', $data will be an object.
   * @param mixed $context1
   *   (optional) An additional variable that is passed by reference.
   * @param mixed $context2
   *   (optional) An additional variable that is passed by reference. If more
   *   context needs to be provided to implementations, then this should be an
   *   associative array as described above.
   * Execute the alter hook on the current theme.
   *
   * @see \Drupal\Core\Extension\ModuleHandlerInterface
   */
  public function alter($type, &$data, &$context1 = NULL, &$context2 = NULL);

  /**
   * Provides an alter hook for a specific theme.
   *
   * Similar to ::alter, it also invokes the alter hooks for the base themes.
   *
   * @param \Drupal\Core\Theme\ActiveTheme $theme
   *   A manually specified theme.
   * @param string|array $type
   *   A string describing the type of the alterable $data.
   * @param mixed $data
   *   The variable that will be passed to $theme_TYPE_alter() implementations
   * @param mixed $context1
   *   (optional) An additional variable that is passed by reference.
   * @param mixed $context2
   *   (optional) An additional variable that is passed by reference.
   *
   * @see ::alter
   */
  public function alterForTheme(ActiveTheme $theme, $type, &$data, &$context1 = NULL, &$context2 = NULL);

}


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>HTableInterfaceFactory xref</title>
<link type="text/css" rel="stylesheet" href="../../../../../stylesheet.css" />

View Javadoc

1
19  package org.apache.hadoop.hbase.client;
20
21  import org.apache.hadoop.hbase.classification.InterfaceAudience;
22  import org.apache.hadoop.hbase.classification.InterfaceStability;
23  import org.apache.hadoop.conf.Configuration;
24
25  import java.io.IOException;
26
27
28  /**
29   * Defines methods to create new HTableInterface.
30   *
31   * @since 0.21.0
32   * @deprecated in favor of {@link ConnectionFactory} and {@link Connection}.
33   */
34  @Deprecated
35  @InterfaceAudience.Public
36  @InterfaceStability.Stable
37  public interface HTableInterfaceFactory {
38
39    /**
40     * Creates a new HTableInterface.
41     *
42     * @param config HBaseConfiguration instance.
43     * @param tableName name of the HBase table.
44     * @return HTableInterface instance.
45     */
46    HTableInterface createHTableInterface(Configuration config, byte[] tableName);
47
48
49    /**
50     * Release the HTable resource represented by the table.
51     * @param table
52     */
53    void releaseHTableInterface(final HTableInterface table) throws IOException;
54  }

This page was automatically generated by Maven


text:
using RiskApp.Calculations;

namespace RiskApp.Models
{
    public class RiskRelation
    {
        public RiskFactor Factor { get; set; }
        public RiskEvent Event { get; set; }
        public double Propability { get; set; }
    }
}


text:
'use strict';

import * as parseGlob from 'parse-glob';
import * as globToRegExp from 'glob-to-regexp';

import { Uri } from 'vscode';
import { IConfig } from '../spgo';
import { UrlHelper } from '../util/urlHelper';
import { FileHelper } from '../util/fileHelper';
import { ISPPullOptions } from 'sppull';

export class DownloadFileOptionsFactory {

    public glob: any;

    constructor(path : string){
        this.glob = parseGlob(path);
    }

    public createFileOptions(siteUrl: Uri, config : IConfig) : ISPPullOptions{

        let dlRootFolder : string = FileHelper.ensureCorrectPathSeparator(
            config.sourceRoot + siteUrl.toString().replace(config.sharePointSiteUrl, ''));
        let options : ISPPullOptions = {
            spBaseFolder : UrlHelper.ensureLeadingWebSlash(siteUrl.path),
            dlRootFolder: dlRootFolder
        }
        let globPattern : string = options.spBaseFolder === '/' ? this.glob.orig : options.spBaseFolder + this.glob.orig;

        if(this.glob.is.glob){
            options.spRootFolder = this.glob.base.replace('/**/','/');
            options.fileRegExp = globToRegExp(globPattern, { flags: 'i', globstar : this.glob.is.globstar, extended : this.glob.orig.indexOf('|') >= 0 });
        }
        else{
            options.spRootFolder = UrlHelper.formatWebFolder(this.glob.orig);
        }

        options.recursive = this.glob.is.globstar;
        options.createEmptyFolders = false;

        return options;
    }
}


text:
//
//  Stripe.h
//  Stripe
//
//  Created by Saikat Chakrabarti on 10/30/12.
//  Copyright (c) 2012 Stripe. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "StripeError.h"
#import "STPCard.h"
#import "STPToken.h"

FOUNDATION_EXPORT NSString *const kStripeiOSVersion; // Version of this library.

typedef void (^STPCompletionBlock)(STPToken *token, NSError *error);

// Stripe is a static class used to create and retrieve tokens.
@interface Stripe : NSObject

/*
 If you set a default publishable key, it will be used in any of the methods
 below that do not accept a publishable key parameter
 */
+ (NSString *)defaultPublishableKey;
+ (void)setDefaultPublishableKey:(NSString *)publishableKey;

+ (void)createTokenWithCard:(STPCard *)card publishableKey:(NSString *)publishableKey operationQueue:(NSOperationQueue *)queue completion:(STPCompletionBlock)handler;

+ (void)createTokenWithCard:(STPCard *)card publishableKey:(NSString *)publishableKey completion:(STPCompletionBlock)handler;

+ (void)createTokenWithCard:(STPCard *)card operationQueue:(NSOperationQueue *)queue completion:(STPCompletionBlock)handler;

+ (void)createTokenWithCard:(STPCard *)card completion:(STPCompletionBlock)handler;

+ (void)requestTokenWithID:(NSString *)tokenId publishableKey:(NSString *)publishableKey operationQueue:(NSOperationQueue *)queue completion:(STPCompletionBlock)handler;

+ (void)requestTokenWithID:(NSString *)tokenId publishableKey:(NSString *)publishableKey completion:(STPCompletionBlock)handler;

+ (void)requestTokenWithID:(NSString *)tokenId operationQueue:(NSOperationQueue *)queue completion:(STPCompletionBlock)handler;

+ (void)requestTokenWithID:(NSString *)tokenId completion:(STPCompletionBlock)handler;
@end


text:
class MRTCommonHeader;
class MRTBgp4MPMessage;
class MRTBgp4MPMessageAS4;
class MRTBgp4MPStateChange;
class MRTBgp4MPStateChangeAS4;
class AttributeType;
class AttributeTypeAS4Aggregator;
class AttributeTypeAS4Path;
class AttributeTypeAS4PathSegment;
class AttributeTypeASPath;
class AttributeTypeASPathSegment;
class AttributeTypeAggregator;
class AttributeTypeAtomicAggregate;
class AttributeTypeClusterList;
class AttributeTypeCommunities;
class AttributeTypeExtCommunities;
class AttributeTypeLocalPref;
class AttributeTypeMPReachNLRI;
class AttributeTypeMPUnreachNLRI;
class AttributeTypeMultiExitDisc;
class AttributeTypeNextHop;
class AttributeTypeOrigin;
class AttributeTypeOriginatorID;
class BGPAttribute;
class BGPCommonHeader;
class BGPKeepAlive;
class BGPNotification;
class BGPOpen;
class BGPRouteRefresh;
class BGPUpdate;
class MRTTblDump;
class MRTTblDumpV2PeerIndexTbl;
class MRTTblDumpV2RibGeneric;
class MRTTblDumpV2RibHeader;
class MRTTblDumpV2RibIPv4Multicast;
class MRTTblDumpV2RibIPv4Unicast;
class MRTTblDumpV2RibIPv6Multicast;
class MRTTblDumpV2RibIPv6Unicast;
class OptionalParameter;
class OptionalParameterCapabilities;
class TblDumpV2RibEntry;
class Route;
class NLRIReachable;
class NLRIUnReachable;

#endif


text:
<?php

namespace Functional;

/**
 * Performs an equal comparison
 *
 * @param mixed $b the value to compare to
 *
 * @return callable the function to perform the comparison
 * @no-named-arguments
 */
function equal($b)
{
    return function ($a) use ($b) {
        return $a == $b;
    };
}


text:
module.exports = function () {
  var mongoose = require('mongoose');

  var InviteSchema = mongoose.Schema({
    message: {type: String},
    dateCreated: {type: Date},
    resolved: Boolean,
    _sender: {type: mongoose.Schema.Types.ObjectId, ref: 'UserModel'},
    _recipient: {type: mongoose.Schema.Types.ObjectId, ref: 'UserModel'},
    _regimen: {type: mongoose.Schema.Types.ObjectId, ref: 'RegimenModel'}
  }, {collection: 'invite'});

  return InviteSchema;
};


text:
'''
Copyright 2010-2013 DIMA Research Group, TU Berlin

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Created on Mar 2, 2011

@author: Alexander Alexandrov <alexander.alexandrov@tu-berlin.de>
'''

import os, sys, tempfile, optparse, datetime, time
import BaseHTTPServer
import config
from urlparse import urlparse
from SocketServer import ThreadingMixIn
from threading import Thread, Lock, RLock
from myriad.util import sysutil, timeutil
import httplib

class DGen(object):
    '''
    classdocs
    '''
    basePath = None
    dgenName = None
    nodeName = None

    config = None
    dgenConfig = None
    parser = None
    logBase = None

    cleanup = None
    sf = None
    configPath = None
    nodeConfig = None
    datasetID = None
    executeStages = None
    configName = None
    serverAddress = None

    dgenMaster = None
    dgenNodes = None

    started = None
    finished = None

    log = None

    VERSION = "0.3.0"

    def __init__(self, basePath, dgenName, argv):
        '''
        Constructor
        '''

        self.basePath = basePath
        self.dgenName = dgenName
        self.initialize(argv)
        self.dgenNodes = []

    def initialize(self, argv):

        parser = optparse.OptionParser(usage="%prog [options] <dgen-config>", version=self.VERSION)
        parser.add_option("-s", dest="sf", type="float", default=1.0,
                          help="scaling factor (sf=1 generates 1GB data)")
        parser.add_option("-m", dest="dataset_id", type="str", default="default-dataset",
                          help="ID of the generated Myriad dataset")
        parser.add_option("-x", dest="execute_stages", action="append", type="str", default=[],
                          help="Specify a specific stage to execute")
        parser.add_option("-n", dest="node_config", type="str", default="%s-node.xml" % (self.dgenName),
                          help="name of the node config file (should reside in the config dir)")
        parser.add_option("--config-dir", dest="config_path", type="str", default="%s/config" % (self.basePath),
                          help="path to the myriad config folder (TODO)")
        parser.add_option("--log-dir", dest="log_dir", type="str", default=None,
                          help="base directory for output logging")
        parser.add_option("--cleanup", dest="cleanup", action="store_true",
                          help="remove output from previously generated job")

        self.parser = parser

        args, remainder = parser.parse_args(argv)
        if (len(remainder) != 1):
            self.error(None, True)
            raise

        self.log = sysutil.createLogger("myriad.dgen")

        try:
            self.cleanup = args.cleanup
            self.sf = args.sf
            self.datasetID = args.dataset_id
            self.configPath = args.config_path
            self.nodeConfig = args.node_config
            self.logBase = args.log_dir
            self.executeStages = args.execute_stages
            self.configName = remainder.pop()

            # load myriad config
            self.config = config.readConfig(self.dgenName, self.nodeConfig, "%s/%s-frontend.xml" % (self.configPath, self.dgenName))
            # load sizing config
            self.dgenConfig = config.readDGenConfig("%s/%s-node.properties" % (self.configPath, self.dgenName))

            DGenNode.MAX_ATTEMPTS = int(self.dgenConfig.getProperty("coordinator.node.max.attempts", DGenNode.MAX_ATTEMPTS))
            DGenNode.DEAD_TIMEOUT = datetime.timedelta(0, 0, 0, int(self.dgenConfig.getProperty("coordinator.node.dead.timeout", DGenNode.DEAD_TIMEOUT.seconds*1000)))
            NodeMonitor.POLL_INTERVAL = int(self.dgenConfig.getProperty("coordinator.node.monitor.interval", NodeMonitor.POLL_INTERVAL*1000))/1000.0

            if (self.logBase == None):
                # create log dir
                self.logBase = tempfile.mkdtemp("", "%s-frontend-%s_" % (self.dgenName, self.datasetID))

            # make sure that logBase directories exist
            sysutil.checkDir(self.logBase)

            # register file handler to the logger
            sysutil.registerFileHandler(self.log, "%s/%s-frontend.log" % (self.logBase, self.dgenName))

        except:
            e = sys.exc_info()[1]
            self.error("unexpected error: %s" % (str(e)), True)
            raise

    def run(self):
        '''
        Srart the distributed generation process using the specified dgen configName.
        '''

        self.started = datetime.datetime.now()

        server = None
        monitor = None

        try:
            if (self.cleanup):
                slaves = self.config.slaves(self.configName)

                self.log.info("~" * 55)
                self.log.info("Myriad Parallel Data Generator (Version %s)", self.VERSION)
                self.log.info("~" * 55)
                self.log.info("cleaning configuration `%s`", self.configName)

                for h in slaves:
                    DGenHost(h).clean(self)

            else:
                master = self.config.master(self.configName)
                nodes = self.config.nodes(self.configName)

                self.log.info("~" * 55)
                self.log.info("Myriad Parallel Data Generator (Version %s)", self.VERSION)
                self.log.info("~" * 55)
                self.log.info("running configuration `%s` with scaling factor %.3f", self.configName, self.sf)

                self.dgenMaster = master
                self.dgenNodes = [ DGenNode(n) for n in nodes ]

                self.log.info("starting heartbeat server on address `%s:%d`", self.dgenMaster.name, self.dgenMaster.coorServerPort)
                server = HeartbeatServer(self.datasetID, self.dgenNodes, ('0.0.0.0', self.dgenMaster.coorServerPort))

                # start node monitor
                self.log.info("starting node monitor thread")
                monitor = NodeMonitor(self, server)
                monitor.start()

                # start server loop
                serverThread = Thread(target=server.serveLoop)
                serverThread.start()

                self.log.info("starting %d generator nodes", len(self.dgenNodes))
                self.startNodes()

                # wait for server thread to finish (timeout and loop needed for KeyboardInterrupt)
                while(serverThread.isAlive()):
                    serverThread.join(3.0)

                # wait for monitor thread
                monitor.join()

                if (monitor.exception):
                    self.log.error("interrupting generation process after failure in node %d ", monitor.exception.id)
                    raise monitor.exception

                # abort all running nodes
                self.abortAllNodes()

                self.finished = datetime.datetime.now()
                self.log.info("generator process finished in %s seconds", timeutil.formatTime(self.finished - self.started))

        except KeyboardInterrupt:
            self.log.warning("execution interrupted by user")
            if (monitor != None):
                monitor.shutdown()
            self.abortAllNodes()
            raise
        except NodeFailureException, e:
            self.abortAllNodes()
            if (monitor != None):
                monitor.shutdown()
            self.error(str(e), False)
            raise
        except config.UnknownConfigObjectException, e:
            self.abortAllNodes()
            self.error(str(e), False)
            raise
        except:
            e = sys.exc_info()[1]
            if (monitor != None):
                monitor.shutdown()
            self.error(str(e), False)
            raise
            self.abortAllNodes()

    def startNodes(self):
        for node in self.dgenNodes:
            node.start(self, len(self.dgenNodes))

    def abortAllNodes(self):
        for node in self.dgenNodes:
            node.abort(self, len(self.dgenNodes))

    def error(self, message=None, withUsage = False):
        if (withUsage):
            self.parser.print_usage(sys.stderr)
        if (message != None):
            self.log.error("%s: error: %s", self.parser.get_prog_name(), message)

class NodeMonitor(Thread):

    POLL_INTERVAL = 5.0

    dgen = None
    server = None
    exception = None
    isShutdown = False

    log = None

    def __init__(self, dgen, server):
        Thread.__init__(self)
        self.dgen = dgen
        self.server = server
        self.isShutdown = False

        self.log = sysutil.getExistingLogger("myriad.dgen")

    def run(self):

        while (not self.isShutdown):

            time.sleep(3.0)

            self.server.nonReadyLock.acquire()

            try:

                if (self.server.nonReady == 0):
                    self.isShutdown = True

                for node in self.server.nodes:
                    if (node.isDead()):
                        self.log.warning("restarting dead node #%d", node.id)
                        node.restart(self.dgen, len(self.server.nodes))

            except NodeFailureException, e:
                self.isShutdown = True
                self.exception = e

            self.server.nonReadyLock.release()

        self.server.stopServeLoop()

    def shutdown(self):
        self.isShutdown = True

class HeartbeatServer(ThreadingMixIn, BaseHTTPServer.HTTPServer):

    datasetID = None
    nodes = []
    nonReady = None
    nonReadyLock = None
    isShutdown = False

    def __init__(self, datasetID, nodes, address):
        BaseHTTPServer.HTTPServer.__init__(self, address, RequestHandler)
        self.datasetID = datasetID
        self.nodes = nodes
        self.nonReady = len(nodes)
        self.nonReadyLock = Lock()
        self.isShutdown = False

    def serveLoop(self):
        while (not self.isShutdown):
            self.handle_request()

    def stopServeLoop(self):
        self.isShutdown = True
        self.makeSentinelRequest()

    def makeSentinelRequest(self):
        try:
            conn = httplib.HTTPConnection(self.server_address[0], self.server_address[1])
            conn.request("GET", "/sentinel")
            conn.getresponse()
            conn.close()
        except:
            pass

class RequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):

    GET_REFRESH = 8000

    def do_HEAD(self):
        self.send_response(200)
        self.end_headers()

        result = urlparse(self.path, '', False)
        params = dict([part.split('=') for part in result[4].split('&')])

        status = int(params['status'])

        if (status >= DGenNode.INITIALIZING and status <= DGenNode.ABORTED): # valid values for heartbeats

            node = self.server.nodes[int(params['id'])]

            node.lock.acquire()

            if (status == DGenNode.READY):
                self.server.nonReadyLock.acquire()

            node.lastBeat = datetime.datetime.now()

            if (node.status != status and node.status < status):
                log = sysutil.getExistingLogger("myriad.dgen")
                log.info("node %05d: %s -> %s", node.id, DGenNode.STATUS_STRING[node.status], DGenNode.STATUS_STRING[status])
                node.status = status

            if (node.status == DGenNode.ACTIVE):
                node.progress = float(params['progress'])

            elif (node.status == DGenNode.READY):
                node.progress = 1.0
                node.finished = datetime.datetime.now()
                self.server.nonReady -= 1

            elif (node.status == DGenNode.ABORTED or node.status == DGenNode.FAILED):
                pass

            else:
                log = sysutil.getExistingLogger("myriad.dgen")
                log.error("unknown status %d for node %d", node.status, node.id)

            if (status == DGenNode.READY):
                self.server.nonReadyLock.release()

            node.lock.release()

    def do_GET(self):

        if (self.path == '/sentinel'):
            self.send_response(200)
            self.end_headers()
            return

        elif (self.path != '/'):
            self.send_response(404)
            self.end_headers()
            return

        self.send_response(200)
        self.send_header('Content-type', 'text/html')
        self.end_headers()

        print >> self.wfile, ""
        print >> self.wfile, ""
        print >> self.wfile, "  <title>Myriad Parallel Data Generator » % s</title>" % (self.server.datasetID)
        print >> self.wfile, "  "
        print >> self.wfile, ""
        print >> self.wfile, "" % (self.GET_REFRESH)
        print >> self.wfile, "
"
        print >> self.wfile, "
Myriad Parallel Data Generator
"
        print >> self.wfile, "
Job coordinator for dataset »%s«
" % (self.server.datasetID)
        print >> self.wfile, "
"
        print >> self.wfile, "
"
        print >> self.wfile, "
"
        print >> self.wfile, "
"
        print >> self.wfile, "  Node #	"
        print >> self.wfile, "  Hostname	"
        print >> self.wfile, "  Progress	"
        print >> self.wfile, "  Status	"
        print >> self.wfile, "  Attempt #	"
        print >> self.wfile, "  Time	"
        print >> self.wfile, "
"
        print >> self.wfile, "
"
        print >> self.wfile, "
"
        for n in self.server.nodes:
            print >> self.wfile, "
"
            print >> self.wfile, "  %05d	" % (n.id)
            print >> self.wfile, "  %s	" % (n.host)
            print >> self.wfile, "  %02d%%»	" % (100 * n.progress, 80 * n.progress)
            print >> self.wfile, "  %s	" % (DGenNode.STATUS_STRING[n.status])
            print >> self.wfile, "  %d	" % (n.attempt)
            print >> self.wfile, "  %s	" % (timeutil.formatTime(n.lastBeat - n.started))
            print >> self.wfile, "
"
        print >> self.wfile, "
"
        print >> self.wfile, "
"
        print >> self.wfile, ""
        print >> self.wfile, ""

    def log_request(self, code='-', size='-'):
        '''
        Disable request logging for the communication server
        '''
        pass

class DGenHost(config.Host):
    '''
    classdocs
    '''
    name = None
    outputBase = None

    def __init__(self, envNode):
        '''
        Constructor
        '''
        self.name = envNode.name
        self.outputBase = envNode.outputBase

    def clean(self, dgen):
        log = sysutil.getExistingLogger("myriad.dgen")
        log.info("clearing host `%s`", self.name)
        os.system("ssh %s 'rm -Rf %s/%s'" % (self.name, self.outputBase, dgen.datasetID))

class DGenNode(config.Node):
    '''
    classdocs
    '''
    id = None
    host = None
    dgenPath = None
    dgenName = None
    outputBase = None

    lock = None

    attempt = None
    progress = None
    status = None
    started = None
    finished = None
    lastBeat = None

    NEW = -1
    INITIALIZING = 0
    ACTIVE = 1
    READY = 2
    ABORTED = 3
    FAILED = 4

    DEAD_TIMEOUT = datetime.timedelta(0, 30)
    MAX_ATTEMPTS = 3

    STATUS_STRING = {
       -1: "NEW",
        0: "INITIALIZING",
        1: "ACTIVE",
        2: "READY",
        3: "ABORTED",
        4: "FAILED",
    }

    def __init__(self, envNode):
        '''
        Constructor
        '''
        self.id = envNode.id
        self.host = envNode.host
        self.dgenPath = envNode.dgenPath
        self.dgenName = envNode.dgenName
        self.outputBase = envNode.outputBase
        self.nodeConfig = envNode.nodeConfig

        self.attempt = 0
        self.resetState()

        self.lock = RLock()

    def start(self, dgen, nodesTotal):
        self.lock.acquire();

        os.system("ssh -f %s '%s/bin/%s-node -s%.3f -m%s -i%d -N%d -H%s -P%d -o%s -n%s %s > /dev/null 2> /dev/null &'" % (self.host, self.dgenPath, self.dgenName, dgen.sf, dgen.datasetID, self.id, nodesTotal, dgen.dgenMaster.name, dgen.dgenMaster.coorServerPort, self.outputBase, self.nodeConfig, ' '.join(map(lambda s: '-x%s' % s, dgen.executeStages))))

        self.attempt += 1
        self.resetState()

        self.lock.release()

    def restart(self, dgen, nodesTotal):
        self.lock.acquire();

        if (self.attempt < DGenNode.MAX_ATTEMPTS):
            os.system("ssh -f %s '%s/bin/%s-kill %d %s > /dev/null 2> /dev/null'" % (self.host, self.dgenPath, self.dgenName, self.id, dgen.datasetID))
            os.system("ssh -f %s '%s/bin/%s-node -s%.3f -m%s -i%d -N%d -H%s -P%d -o%s -n%s %s > /dev/null 2> /dev/null &'" % (self.host, self.dgenPath, self.dgenName, dgen.sf, dgen.datasetID, self.id, nodesTotal, dgen.dgenMaster.name, dgen.dgenMaster.coorServerPort, self.outputBase, self.nodeConfig, ' '.join(map(lambda s: '-x%s' % s, dgen.executeStages))))

            self.attempt += 1
            self.resetState()

            self.lock.release()

        else:
            self.status = DGenNode.FAILED
            self.lock.release()
            raise NodeFailureException(self.id)

    def abort(self, dgen, nodesTotal):
        self.lock.acquire()

        if (self.status < DGenNode.READY):
            log = sysutil.getExistingLogger("myriad.dgen")
            log.info("aborting node #%03d" % (self.id))
            os.system("ssh -f %s '%s/bin/%s-kill %d %s > /dev/null 2> /dev/null'" % (self.host, self.dgenPath, self.dgenName, self.id, dgen.datasetID))
            self.status = DGenNode.FAILED

        self.lock.release()

    def isDead(self):
        self.lock.acquire()

        if (self.status == DGenNode.FAILED):
            self.lock.release()
            raise NodeFailureException(self.id)

        if (self.status == DGenNode.READY):
            self.lock.release()
            return False

        elif (self.status == DGenNode.ABORTED):
            self.lock.release()
            return True

        else:
            diff = datetime.datetime.now() - self.lastBeat
            self.lock.release()
            return diff > DGenNode.DEAD_TIMEOUT

    def resetState(self):
        self.progress = 0.0
        self.status = DGenNode.NEW
        self.started = datetime.datetime.now()
        self.lastBeat = datetime.datetime.now()

class NodeFailureException(RuntimeError):

    id = None

    def __init__(self, id):
        self.id = id

    def __str__(self):
        return "node %d failed" % (self.id)


text:
 !defined(__i386__) && !defined(_M_IX86) && !defined(_X86_) && \
 !defined(__amd64__) && !defined(__x86_64__) && !defined(_M_X64) && \
 !defined(_M_AMD64) && !defined(__EMSCRIPTEN__) && !defined(__riscv)
#  error "Unsupported platform"
#endif

#ifndef __cplusplus
#  include <stdalign.h>
#endif

#ifdef _MSC_VER
// MSVC has no support of C11 atomics.
#  include <atomic>
#  define PONY_ATOMIC(T) std::atomic<T>
#  define PONY_ATOMIC_RVALUE(T) std::atomic<T>
#  define PONY_ATOMIC_INIT(T, N, V) std::atomic<T> N{V}
#  ifdef PONY_WANT_ATOMIC_DEFS
using std::memory_order_relaxed;
using std::memory_order_consume;
using std::memory_order_acquire;
using std::memory_order_release;
using std::memory_order_acq_rel;
using std::memory_order_seq_cst;

using std::atomic_load_explicit;
using std::atomic_store_explicit;
using std::atomic_exchange_explicit;
using std::atomic_compare_exchange_weak_explicit;
using std::atomic_compare_exchange_strong_explicit;
using std::atomic_fetch_add_explicit;
using std::atomic_fetch_sub_explicit;
using std::atomic_thread_fence;
#  endif
#elif defined(__GNUC__) && !defined(__clang__)
#  if ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((4) << 16) + (9))
#    ifdef __cplusplus
//     g++ doesn't like C11 atomics. We never need atomic ops in C++ files so
//     we only define the atomic types.
#      include <atomic>
#      define PONY_ATOMIC(T) std::atomic<T>
#      define PONY_ATOMIC_RVALUE(T) std::atomic<T>
#      define PONY_ATOMIC_INIT(T, N, V) std::atomic<T> N{V}
#    else
#      ifdef PONY_WANT_ATOMIC_DEFS
#        include <stdatomic.h>
#      endif
#      define PONY_ATOMIC(T) T _Atomic
#      define PONY_ATOMIC_RVALUE(T) T _Atomic
#      define PONY_ATOMIC_INIT(T, N, V) T _Atomic N = V
#    endif
#  elif ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((4) << 16) + (7))
#    define PONY_ATOMIC(T) alignas(sizeof(T)) T
#    define PONY_ATOMIC_RVALUE(T) T
#    define PONY_ATOMIC_INIT(T, N, V) T N = V
#    define PONY_ATOMIC_BUILTINS
#  else
#    error "Please use GCC >= 4.7"
#  endif
#elif defined(__clang__)
#  if __clang_major__ >= 4 || (__clang_major__ == 3 && __clang_minor__ >= 6)
#    ifdef PONY_WANT_ATOMIC_DEFS
#      include <stdatomic.h>
#    endif
#    define PONY_ATOMIC(T) T _Atomic
#    define PONY_ATOMIC_RVALUE(T) T _Atomic
#    define PONY_ATOMIC_INIT(T, N, V) T _Atomic N = V
#  elif __clang_major__ >= 3 && __clang_minor__ >= 4
#    define PONY_ATOMIC(T) alignas(sizeof(T)) T
#    define PONY_ATOMIC_RVALUE(T) T
#    define PONY_ATOMIC_INIT(T, N, V) T N = V
#    define PONY_ATOMIC_BUILTINS
#  else
#    error "Please use Clang >= 3.4"
#  endif
#else
#  error "Unsupported compiler"
#endif

#ifdef _MSC_VER
namespace ponyint_atomics
{
  template <typename T>
  struct aba_protected_ptr_t
  {
    // Nested struct for uniform initialisation with GCC/Clang.
    struct
    {
      T* object;
      uintptr_t counter;
    };
  };
}
#  define PONY_ABA_PROTECTED_PTR_DECLARE(T)
#  define PONY_ABA_PROTECTED_PTR(T) ponyint_atomics::aba_protected_ptr_t<T>
#else
#  if defined(__LP64__) || defined(_WIN64)
#    define PONY_DOUBLEWORD __int128_t
#  else
#    define PONY_DOUBLEWORD int64_t
#  endif
#  define PONY_ABA_PROTECTED_PTR_DECLARE(T) \
    typedef union \
    { \
      struct \
      { \
        T* object; \
        uintptr_t counter; \
      }; \
      PONY_DOUBLEWORD raw; \
    } aba_protected_##T;
#  define PONY_ABA_PROTECTED_PTR(T) aba_protected_##T
#endif

// We provide our own implementation of big atomic objects (larger than machine
// word size) because we need special functionalities that aren't provided by
// standard atomics. In particular, we need to be able to do both atomic and
// non-atomic operations on big objects since big atomic operations (e.g.
// CMPXCHG16B on x86_64) are very expensive.
#define PONY_ATOMIC_ABA_PROTECTED_PTR(T) \
    alignas(sizeof(PONY_ABA_PROTECTED_PTR(T))) PONY_ABA_PROTECTED_PTR(T)

#ifdef PONY_WANT_ATOMIC_DEFS
#  ifdef _MSC_VER
#    pragma warning(push)
#    pragma warning(disable:4164)
#    pragma warning(disable:4800)
#    pragma intrinsic(_InterlockedCompareExchange128)

namespace ponyint_atomics
{
  template <typename T>
  inline PONY_ABA_PROTECTED_PTR(T) big_load(PONY_ABA_PROTECTED_PTR(T)* ptr)
  {
    PONY_ABA_PROTECTED_PTR(T) ret = {NULL, 0};
    _InterlockedCompareExchange128((LONGLONG*)ptr, 0, 0, (LONGLONG*)&ret);
    return ret;
  }

  template <typename T>
  inline void big_store(PONY_ABA_PROTECTED_PTR(T)* ptr,
    PONY_ABA_PROTECTED_PTR(T) val)
  {
    PONY_ABA_PROTECTED_PTR(T) tmp;
    tmp.object = ptr->object;
    tmp.counter = ptr->counter;
    while(!_InterlockedCompareExchange128((LONGLONG*)ptr,
      (LONGLONG)val.counter, (LONGLONG)val.object, (LONGLONG*)&tmp))
    {}
  }

  template <typename T>
  inline bool big_cas(PONY_ABA_PROTECTED_PTR(T)* ptr,
    PONY_ABA_PROTECTED_PTR(T)* exp, PONY_ABA_PROTECTED_PTR(T) des)
  {
    return _InterlockedCompareExchange128((LONGLONG*)ptr, (LONGLONG)des.counter,
      (LONGLONG)des.object, (LONGLONG*)exp);
  }
}

#    define bigatomic_load_explicit(PTR, MO) \
      ponyint_atomics::big_load(PTR)

#    define bigatomic_store_explicit(PTR, VAL, MO) \
      ponyint_atomics::big_store(PTR, VAL)

#    define bigatomic_compare_exchange_strong_explicit(PTR, EXP, DES, SUCC, FAIL) \
      ponyint_atomics::big_cas(PTR, EXP, DES)

#    pragma warning(pop)
#  else
#    define bigatomic_load_explicit(PTR, MO) \
      ({ \
        _Static_assert(sizeof(*(PTR)) == (2 * sizeof(void*)), ""); \
        (__typeof__(*(PTR)))__atomic_load_n(&(PTR)->raw, MO); \
      })

#    define bigatomic_store_explicit(PTR, VAL, MO) \
      ({ \
        _Static_assert(sizeof(*(PTR)) == (2 * sizeof(void*)), ""); \
        __atomic_store_n(&(PTR)->raw, (VAL).raw, MO); \
      })

#    define bigatomic_compare_exchange_strong_explicit(PTR, EXP, DES, SUCC, FAIL) \
      ({ \
        _Static_assert(sizeof(*(PTR)) == (2 * sizeof(void*)), ""); \
        __atomic_compare_exchange_n(&(PTR)->raw, &(EXP)->raw, (DES).raw, false, \
          SUCC, FAIL); \
      })
#  endif

#  ifdef PONY_ATOMIC_BUILTINS
#    define memory_order_relaxed __ATOMIC_RELAXED
#    define memory_order_consume __ATOMIC_CONSUME
#    define memory_order_acquire __ATOMIC_ACQUIRE
#    define memory_order_release __ATOMIC_RELEASE
#    define memory_order_acq_rel __ATOMIC_ACQ_REL
#    define memory_order_seq_cst __ATOMIC_SEQ_CST

#    define atomic_load_explicit(PTR, MO) \
      ({ \
        _Static_assert(sizeof(PTR) <= sizeof(void*), ""); \
        __atomic_load_n(PTR, MO); \
      })

#    define atomic_store_explicit(PTR, VAL, MO) \
      ({ \
        _Static_assert(sizeof(PTR) <= sizeof(void*), ""); \
        __atomic_store_n(PTR, VAL, MO); \
      })

#    define atomic_exchange_explicit(PTR, VAL, MO) \
      ({ \
        _Static_assert(sizeof(PTR) <= sizeof(void*), ""); \
        __atomic_exchange_n(PTR, VAL, MO); \
      })

#    define atomic_compare_exchange_weak_explicit(PTR, EXP, DES, SUCC, FAIL) \
      ({ \
        _Static_assert(sizeof(PTR) <= sizeof(void*), ""); \
        __atomic_compare_exchange_n(PTR, EXP, DES, true, SUCC, FAIL); \
      })

#    define atomic_compare_exchange_strong_explicit(PTR, EXP, DES, SUCC, FAIL) \
      ({ \
        _Static_assert(sizeof(PTR) <= sizeof(void*), ""); \
        __atomic_compare_exchange_n(PTR, EXP, DES, false, SUCC, FAIL); \
      })

#    define atomic_fetch_add_explicit(PTR, VAL, MO) \
      ({ \
        _Static_assert(sizeof(PTR) <= sizeof(void*), ""); \
        __atomic_fetch_add(PTR, VAL, MO); \
      })

#    define atomic_fetch_sub_explicit(PTR, VAL, MO) \
      ({ \
        _Static_assert(sizeof(PTR) <= sizeof(void*), ""); \
        __atomic_fetch_sub(PTR, VAL, MO); \
      })

#    define atomic_thread_fence(MO) \
      __atomic_thread_fence(MO)

#    undef PONY_ATOMIC_BUILTINS
#  endif
#endif

#endif


text:
FROM linuxkit/alpine:e2391e0b164c57db9f6c4ae110ee84f766edc430 AS mirror

RUN apk add --no-cache go musl-dev
ENV GOPATH=/go PATH=$PATH:/go/bin
# Hack to work around an issue with go on arm64 requiring gcc
RUN [ $(uname -m) = aarch64 ] && apk add --no-cache gcc || true

COPY main.go /go/src/sysctl/
RUN go-compile.sh /go/src/sysctl

FROM scratch
ENTRYPOINT []
CMD []
WORKDIR /
COPY --from=mirror /go/bin/sysctl /usr/bin/sysctl
COPY etc/ /etc/
CMD ["/usr/bin/sysctl"]


text:
import createConstantNode from '../../createConstantNode';
const template = require('./template.html');

export default class Scope {
  constructor(audioContext, viewContainer) {
    const CANVAS_WIDTH = 510;
    const CANVAS_HEIGHT = 256;
    const WINDOW_SIZE = 1024;
    const data = new Float32Array(WINDOW_SIZE);
    const analyserNode = audioContext.createAnalyser();
    analyserNode.fftSize = WINDOW_SIZE;

    const constantNode = createConstantNode(audioContext, 0);
    constantNode.connect(analyserNode);

    this.inputs = {
      'audio': {type: 'audio', node: analyserNode},
    };
    this.outputs = {
      'audio': {type: 'audio', node: analyserNode}, // pass through input
    };

    viewContainer.innerHTML = template;

    const canvasElem = viewContainer.querySelector('canvas');
    const canvasCtx = canvasElem.getContext('2d');

    const draw = () => {
      analyserNode.getFloatTimeDomainData(data);

      // Determine sync index, which will be leftmost displayed
      let syncIndex = 0; // default to zero if no good sync can be found
      for (let i = 0; i < (WINDOW_SIZE-CANVAS_WIDTH); i++) {
        if ((data[i] <= 0) && (data[i+1] > 0)) {
          syncIndex = i;
          break;
        }
      }

      canvasCtx.fillStyle = 'rgb(0, 0, 0)';
      canvasCtx.fillRect(0, 0, CANVAS_WIDTH, CANVAS_HEIGHT);

      canvasCtx.lineWidth = 1;
      canvasCtx.strokeStyle = 'rgb(0, 255, 0)';

      canvasCtx.beginPath();

      for (let x = 0; x < CANVAS_WIDTH; x++) {
        const y = 0.5*CANVAS_HEIGHT*(1-data[x+syncIndex]);

        if (x === 0) {
          canvasCtx.moveTo(x, y);
        } else {
          canvasCtx.lineTo(x, y);
        }
      }

      canvasCtx.stroke();

      this.rafId = requestAnimationFrame(draw);
    };
    draw();
  }

  deactivate() {
    cancelAnimationFrame(this.rafId);
  }
}

Scope.blockName = 'Scope';
Scope.helpText =
`Scope is an audio waveform visualizer, similar to an oscilloscope.

Scope visualizes the audio signal connected to its input. Its output is a copy of of its input, so it can be placed "in line" in a signal chain. However its output needn't be connected for it to work.

The vertical range of scope is [-1, 1], and the horizontal range is 510 samples, or about 12 milliseconds at a 44.1kHz sample rate.

If possible, Scope will align the displayed waveform so that it crosses zero at the left edge of the display. This can make wave shapes easier to discern. But if the input signal does not have a recent zero-crossing, alignment is not possible.`;