text:
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

/**
 * @fileoverview
 * @suppress {checkTypes}  By default, JSCompile is not run on test files.
 *    However, you can modify |remoting_webapp_files.gypi| locally to include
 *    the test in the package to expedite local development.  This suppress
 *    is here so that JSCompile won't complain.
 *
 * Provides basic functionality for JavaScript based browser test.
 *
 * To define a browser test, create a class under the browserTest namespace.
 * You can pass arbitrary object literals to the browser test from the C++ test
 * harness as the test data.  Each browser test class should implement the run
 * method.
 * For example:
 *
 * browserTest.My_Test = function() {};
 * browserTest.My_Test.prototype.run(myObjectLiteral) = function() { ... };
 *
 * The browser test is async in nature.  It will keep running until
 * browserTest.fail("My error message.") or browserTest.pass() is called.
 *
 * For example:
 *
 * browserTest.My_Test.prototype.run(myObjectLiteral) = function() {
 *   window.setTimeout(function() {
 *     if (doSomething(myObjectLiteral)) {
 *       browserTest.pass();
 *     } else {
 *       browserTest.fail('My error message.');
 *     }
 *   }, 1000);
 * };
 *
 * You will then invoke the test in C++ by calling:
 *
 *   RunJavaScriptTest(web_content, "My_Test", "{"
 *    "pin: '123123'"
 *  "}");
 */

'use strict';

var browserTest = browserTest || {};

browserTest.init = function() {
  // The domAutomationController is used to communicate progress back to the
  // C++ calling code.  It will only exist if chrome is run with the flag
  // --dom-automation.  It is stubbed out here so that browser test can be run
  // under the regular app.
  browserTest.automationController_ = window.domAutomationController || {
    send: function(json) {
      var result = JSON.parse(json);
      if (result.succeeded) {
        console.log('Test Passed.');
      } else {
        console.error('Test Failed.\n' +
            result.error_message + '\n' + result.stack_trace);
      }
    }
  };
};

browserTest.expect = function(expr, message) {
  if (!expr) {
    message = (message) ? '<' + message + '>' : '';
    browserTest.fail('Expectation failed.' + message);
  }
};

browserTest.fail = function(error) {
  var error_message = error;
  var stack_trace = base.debug.callstack();

  if (error instanceof Error) {
    error_message = error.toString();
    stack_trace = error.stack;
  }

  // To run browserTest locally:
  // 1. Go to |remoting_webapp_files| and look for
  //    |remoting_webapp_js_browser_test_files| and uncomment it
  // 2. gclient runhooks
  // 3. rebuild the webapp
  // 4. Run it in the console browserTest.runTest(browserTest.MyTest, {});
  // 5. The line below will trap the test in the debugger in case of
  //    failure.
  debugger;

  browserTest.automationController_.send(JSON.stringify({
    succeeded: false,
    error_message: error_message,
    stack_trace: stack_trace
  }));
};

browserTest.pass = function() {
  browserTest.automationController_.send(JSON.stringify({
    succeeded: true,
    error_message: '',
    stack_trace: ''
  }));
};

browserTest.clickOnControl = function(id) {
  var element = document.getElementById(id);
  browserTest.expect(element, 'No such element: ' + id);
  element.click();
};

browserTest.onUIMode = function(expectedMode, opt_timeout) {
  if (expectedMode == remoting.currentMode) {
    // If the current mode is the same as the expected mode, return a fulfilled
    // promise.  For some reason, if we fulfill the promise in the same
    // callstack, V8 will assert at V8RecursionScope.h(66) with
    // ASSERT(!ScriptForbiddenScope::isScriptForbidden()).
    // To avoid the assert, execute the callback in a different callstack.
    return base.Promise.sleep(0);
  }

  return new Promise (function(fulfill, reject) {
    var uiModeChanged = remoting.testEvents.Names.uiModeChanged;
    var timerId = null;

    if (opt_timeout === undefined) {
      opt_timeout = browserTest.Timeout.DEFAULT;
    }

    function onTimeout() {
      remoting.testEvents.removeEventListener(uiModeChanged, onUIModeChanged);
      reject('Timeout waiting for ' + expectedMode);
    }

    function onUIModeChanged(mode) {
      if (mode == expectedMode) {
        remoting.testEvents.removeEventListener(uiModeChanged, onUIModeChanged);
        window.clearTimeout(timerId);
        timerId = null;
        fulfill();
      }
    }

    if (opt_timeout != browserTest.Timeout.NONE) {
      timerId = window.setTimeout(onTimeout, opt_timeout);
    }
    remoting.testEvents.addEventListener(uiModeChanged, onUIModeChanged);
  });
};

browserTest.connectMe2Me = function() {
  var AppMode = remoting.AppMode;
  browserTest.clickOnControl('this-host-connect');
  return browserTest.onUIMode(AppMode.CLIENT_HOST_NEEDS_UPGRADE).then(
    function() {
      // On fulfilled.
      browserTest.clickOnControl('host-needs-update-connect-button');
    }, function() {
      // On time out.
      return Promise.resolve();
    }).then(function() {
      return browserTest.onUIMode(AppMode.CLIENT_PIN_PROMPT, 10000);
    });
};

browserTest.disconnect = function() {
  var AppMode = remoting.AppMode;
  remoting.disconnect();
  return browserTest.onUIMode(AppMode.CLIENT_SESSION_FINISHED_ME2ME).then(
    function() {
      browserTest.clickOnControl('client-finished-me2me-button');
      return browserTest.onUIMode(AppMode.HOME);
    });
};

browserTest.enterPIN = function(pin, opt_expectError) {
  // Wait for 500ms before hitting the PIN button. From experiment, sometimes
  // the PIN prompt does not dismiss without the timeout.
  var CONNECT_PIN_WAIT = 500;

  document.getElementById('pin-entry').value = pin;

  return base.Promise.sleep(CONNECT_PIN_WAIT).then(function() {
    browserTest.clickOnControl('pin-connect-button');
  }).then(function() {
    if (opt_expectError) {
      return browserTest.expectMe2MeError(remoting.Error.INVALID_ACCESS_CODE);
    } else {
      return browserTest.expectMe2MeConnected();
    }
  });
};

browserTest.expectMe2MeError = function(errorTag) {
  var AppMode = remoting.AppMode;
  var Timeout = browserTest.Timeout;

  var onConnected = browserTest.onUIMode(AppMode.IN_SESSION, Timeout.None);
  var onFailure = browserTest.onUIMode(AppMode.CLIENT_CONNECT_FAILED_ME2ME);

  onConnected = onConnected.then(function() {
    return Promise.reject(
        'Expected the Me2Me connection to fail.');
  });

  onFailure = onFailure.then(function() {
    var errorDiv = document.getElementById('connect-error-message');
    var actual = errorDiv.innerText;
    var expected = l10n.getTranslationOrError(errorTag);

    browserTest.clickOnControl('client-finished-me2me-button');

    if (actual != expected) {
      return Promise.reject('Unexpected failure. actual:' + actual +
                     ' expected:' + expected);
    }
  });

  return Promise.race([onConnected, onFailure]);
};

browserTest.expectMe2MeConnected = function() {
  var AppMode = remoting.AppMode;
  // Timeout if the session is not connected within 30 seconds.
  var SESSION_CONNECTION_TIMEOUT = 30000;
  var onConnected = browserTest.onUIMode(AppMode.IN_SESSION,
                                         SESSION_CONNECTION_TIMEOUT);
  var onFailure = browserTest.onUIMode(AppMode.CLIENT_CONNECT_FAILED_ME2ME,
                                       browserTest.Timeout.NONE);
  onFailure = onFailure.then(function() {
    var errorDiv = document.getElementById('connect-error-message');
    var errorMsg = errorDiv.innerText;
    return Promise.reject('Unexpected error - ' + errorMsg);
  });
  return Promise.race([onConnected, onFailure]);
};

browserTest.expectEvent = function(eventSource, event, timeoutMs,
                                   opt_expectedData) {
  return new Promise(function(fullfil, reject) {
    var verifyEventParameters = function(actualData) {
      if (opt_expectedData === undefined || opt_expectedData === actualData) {
        fullfil();
      } else {
        reject('Bad event data; expected ' + opt_expectedData +
               '; got ' + actualData);
      }
    };
    eventSource.addEventListener(event, verifyEventParameters);
    base.Promise.sleep(timeoutMs).then(function() {
      reject(Error('Event ' + event + ' not received after ' +
                   timeoutMs + 'ms.'));
    });
  });
};

browserTest.runTest = function(testClass, data) {
  try {
    var test = new testClass();
    browserTest.expect(typeof test.run == 'function');
    test.run(data);
  } catch (e) {
    browserTest.fail(e);
  }
};

browserTest.setupPIN = function(newPin) {
  var AppMode = remoting.AppMode;
  var HOST_SETUP_WAIT = 10000;
  var Timeout = browserTest.Timeout;

  return browserTest.onUIMode(AppMode.HOST_SETUP_ASK_PIN).then(function() {
    document.getElementById('daemon-pin-entry').value = newPin;
    document.getElementById('daemon-pin-confirm').value = newPin;
    browserTest.clickOnControl('daemon-pin-ok');

    var success = browserTest.onUIMode(AppMode.HOST_SETUP_DONE, Timeout.NONE);
    var failure = browserTest.onUIMode(AppMode.HOST_SETUP_ERROR, Timeout.NONE);
    failure = failure.then(function(){
      return Promise.reject('Unexpected host setup failure');
    });
    return Promise.race([success, failure]);
  }).then(function() {
    console.log('browserTest: PIN Setup is done.');
    browserTest.clickOnControl('host-config-done-dismiss');

    // On Linux, we restart the host after changing the PIN, need to sleep
    // for ten seconds before the host is ready for connection.
    return base.Promise.sleep(HOST_SETUP_WAIT);
  });
};

browserTest.isLocalHostStarted = function() {
  return new Promise(function(resolve) {
    remoting.hostController.getLocalHostState(function(state) {
      resolve(remoting.HostController.State.STARTED == state);
    });
  });
};

browserTest.ensureHostStartedWithPIN = function(pin) {
  // Return if host is already
  return browserTest.isLocalHostStarted().then(function(started){
    if (!started) {
      console.log('browserTest: Enabling remote connection.');
      browserTest.clickOnControl('start-daemon');
    } else {
      console.log('browserTest: Changing the PIN of the host to: ' + pin + '.');
      browserTest.clickOnControl('change-daemon-pin');
    }
    return browserTest.setupPIN(pin);
  });
};

// Called by Browser Test in C++
browserTest.ensureRemoteConnectionEnabled = function(pin) {
  browserTest.ensureHostStartedWithPIN(pin).then(function(){
    browserTest.automationController_.send(true);
  }, function(errorMessage){
    console.error(errorMessage);
    browserTest.automationController_.send(false);
  });
};

browserTest.init();


text:
#import <VectorKit/VGLBuildingProgram.h>

// Not exported
@interface VGLDepthDependentBuildingProgram : VGLBuildingProgram
{
    float _minDepth;
    int _uMinDepth;
    float _maxDepth;
    int _uMaxDepth;
}

+ (id)fragName;
+ (id)vertName;
@property(nonatomic) float maxDepth; // @synthesize maxDepth=_maxDepth;
@property(nonatomic) float minDepth; // @synthesize minDepth=_minDepth;
- (void)setup;

@end

redpajama_set_name: RedPajamaGithub


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

<component type="desktop">
  <id>org.godotengine.Godot</id>
  <metadata_license>CC0-1.0</metadata_license>
  <project_license>MIT</project_license>
  <name>Godot Engine</name>
  Multi-platform 2D and 3D game engine with a feature-rich editor
  <launchable type="desktop-id">org.godotengine.Godot.desktop</launchable>
  <description>

      Godot is an advanced, feature-packed, multi-platform 2D and 3D game
      engine. It provides a huge set of common tools, so you can just focus on
      making your game without reinventing the wheel.

      Godot is completely free and open source under the very permissive MIT
      license. No strings attached, no royalties, nothing. Your game is yours,
      down to the last line of engine code.

  </description>
  <screenshots>
    <screenshot type="default" width="1330" height="720">

3D project loaded in the Godot Engine editor

      <image>https://download.tuxfamily.org/godotengine/media/screenshots/editor_3d_fracteed-720p.jpg</image>
    </screenshot>
  </screenshots>
  <url type="homepage">https://godotengine.org</url>
  <url type="bugtracker">https://github.com/godotengine/godot/issues</url>
  <url type="faq">http://docs.godotengine.org/en/latest/about/faq.html</url>
  <url type="help">http://docs.godotengine.org</url>
  <url type="donation">https://godotengine.org/donate</url>
  <url type="translate">https://hosted.weblate.org/projects/godot-engine/godot</url>
  <developer_name>The Godot Engine Community</developer_name>
  <update_contact>akien_at_godotengine_dot_org</update_contact>
</component>


text:
ACCEPTED

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Repert. Spec. Nov. Regni Veg. Beih. 42(1): 469 (1927)

#### Original name
Sphaeria oleae DC., 1815

### Remarks
null


text:
[中文文档](https://github.com/JackyAndroid/Android-Architecture-Fairy/blob/master/README-CN.md)

# The android architecture of fairies
![BlueFairy](https://github.com/JackyAndroid/Android-Architecture-Fairy/blob/master/Art/BlueFairy.png)

Fairy of the project name from the [Artificial Intelligence] (http://baike.baidu.com/subview/2949/5816870.htm), the blue fairy character in the movie, the blue fairy robots could be turned into human beings, let the machine with human's life and emotion, this is what David spend their lives struggling to pursue.

The aim of this project, like the blue fairy, want to give others bring enlightenment and reflection on the architecture.

This project focuses on Android mainstream technology of architecture and design analysis extension.

![](https://ws2.sinaimg.cn/large/006tNc79gy1g2qshh5vc0j30b40b4407.jpg)


text:
msfbase = __FILE__
while File.symlink?(msfbase)
  msfbase = File.expand_path(File.readlink(msfbase), File.dirname(msfbase))
end
inc = File.dirname(msfbase) + '/../../..'
$:.unshift(inc)

require 'rex/zip'

out = "test.zip"
dir = "/var/www"

def add_file(zip, path)
  zip.add_file(path)
end

#
# If it's a directory, Walk the directory and add each item
#
def add_files(zip, path, recursive = nil)

  if (not add_file(zip, path))
    return nil
  end

  if (recursive and File.stat(path).directory?)
    begin
      dir = Dir.open(path)
    rescue
      # skip this file
      return nil
    end

    dir.each { |f|
      next if (f == '.')
      next if (f == '..')

      full_path = path + '/' + f
      st = File.stat(full_path)
      if (st.directory?)
        puts "adding dir  #{full_path}"
        add_files(zip, full_path, recursive)
      elsif (st.file?)
        puts "adding file #{full_path}"
        add_file(zip, full_path)
      end
    }
  end
end

zip = Rex::Zip::Archive.new
add_files(zip, dir, TRUE)
zip.save_to(out)


text:
#include "bytestreamhandler.h"
#include "socks5bytestreammanager.h"
#include "socks5bytestreamserver.h"
#include "socks5bytestream.h"
#include "clientbase.h"
#include "disco.h"
#include "error.h"
#include "connectionbase.h"
#include "sha.h"
#include "util.h"

#include <cstdlib>

namespace gloox
{

  // ---- SOCKS5BytestreamManager::Query ----
  static const char* s5bModeValues[] =
  {
    "tcp", "udp"
  };

  static inline const char* modeString( SOCKS5BytestreamManager::S5BMode mode )
  {
    return s5bModeValues[mode];
  }

  SOCKS5BytestreamManager::Query::Query()
    : StanzaExtension( ExtS5BQuery ), m_type( TypeInvalid )
  {
  }

  SOCKS5BytestreamManager::Query::Query( const std::string& sid, S5BMode mode,
         const StreamHostList& hosts )
    : StanzaExtension( ExtS5BQuery ), m_sid( sid ), m_mode( mode ), m_hosts( hosts ), m_type( TypeSH )
  {
  }

  SOCKS5BytestreamManager::Query::Query( const JID& jid, const std::string& sid, bool activate )
    : StanzaExtension( ExtS5BQuery ), m_sid( sid ), m_jid( jid ), m_type( activate ? TypeA : TypeSHU )
  {
  }

  SOCKS5BytestreamManager::Query::Query( const Tag* tag )
    : StanzaExtension( ExtS5BQuery ), m_type( TypeInvalid )
  {
    if( !tag || tag->name() != "query" || tag->xmlns() != XMLNS_BYTESTREAMS
        /*|| !tag->hasAttribute( "sid" )*/ )
      return;

    m_sid = tag->findAttribute( "sid" );
    m_mode = static_cast<S5BMode>( util::deflookup( tag->findAttribute( "mode" ), s5bModeValues, S5BTCP ) );

    const TagList& l = tag->children();
    TagList::const_iterator it = l.begin();
    for( ; it != l.end(); ++it )
    {
      if( (*it)->name() == "streamhost" && (*it)->hasAttribute( "jid" )
            && (*it)->hasAttribute( "host" ) && (*it)->hasAttribute( "port" ) )
      {
        m_type = TypeSH;
        StreamHost sh;
        sh.jid = (*it)->findAttribute( "jid" );
        sh.host = (*it)->findAttribute( "host" );
        sh.port = atoi( (*it)->findAttribute( "port" ).c_str() );
        m_hosts.push_back( sh );
      }
      else if( (*it)->name() == "streamhost-used" )
      {
        m_type = TypeSHU;
        m_jid = (*it)->findAttribute( "jid" );
      }
      else if( (*it)->name() == "activate" )
      {
        m_type = TypeA;
        m_jid = (*it)->cdata();
      }
    }
  }

  SOCKS5BytestreamManager::Query::~Query()
  {
  }

  const std::string& SOCKS5BytestreamManager::Query::filterString() const
  {
    static const std::string filter = "/iq/query[@xmlns='" + XMLNS_BYTESTREAMS + "']";
    return filter;
  }

  Tag* SOCKS5BytestreamManager::Query::tag() const
  {
    if( m_type == TypeInvalid /*|| m_sid.empty()*/ )
      return 0;

    Tag* t = new Tag( "query" );
    t->setXmlns( XMLNS_BYTESTREAMS );
    t->addAttribute( "sid", m_sid );
    switch( m_type )
    {
      case TypeSH:
      {
        t->addAttribute( "mode", util::deflookup( m_mode, s5bModeValues, "tcp" ) );
        StreamHostList::const_iterator it = m_hosts.begin();
        for( ; it != m_hosts.end(); ++it )
        {
          Tag* s = new Tag( t, "streamhost" );
          s->addAttribute( "jid", (*it).jid.full() );
          s->addAttribute( "host", (*it).host );
          s->addAttribute( "port", (*it).port );
        }
        break;
      }
      case TypeSHU:
      {
        Tag* s = new Tag( t, "streamhost-used" );
        s->addAttribute( "jid", m_jid.full() );
        break;
      }
      case TypeA:
      {
        Tag* c = new Tag( t, "activate" );
        c->setCData( m_jid.full() );
        break;
      }
      default:
        break;
    }

    return t;
  }
  // ---- ~SOCKS5BytestreamManager::Query ----

  // ---- SOCKS5BytestreamManager ----
  SOCKS5BytestreamManager::SOCKS5BytestreamManager( ClientBase* parent, BytestreamHandler* s5bh )
    : m_parent( parent ), m_socks5BytestreamHandler( s5bh ), m_server( 0 )
  {
    if( m_parent )
    {
      m_parent->registerStanzaExtension( new Query() );
      m_parent->registerIqHandler( this, ExtS5BQuery );
    }
  }

  SOCKS5BytestreamManager::~SOCKS5BytestreamManager()
  {
    if( m_parent )
    {
      m_parent->removeIqHandler( this, ExtS5BQuery );
      m_parent->removeIDHandler( this );
    }

    util::clearMap( m_s5bMap );
  }

  void SOCKS5BytestreamManager::addStreamHost( const JID& jid, const std::string& host, int port )
  {
    StreamHost sh;
    sh.jid = jid;
    sh.host = host;
    sh.port = port;
    m_hosts.push_back( sh );
  }

  bool SOCKS5BytestreamManager::requestSOCKS5Bytestream( const JID& to, S5BMode mode,
                                                         const std::string& sid,
                                                         const JID& from )
  {
    if( !m_parent )
    {
      m_parent->logInstance().warn( LogAreaClassS5BManager,
                                    "No parent (ClientBase) set, cannot request bytestream." );
      return false;
    }

    if( m_hosts.empty() )
    {
      m_parent->logInstance().warn( LogAreaClassS5BManager,
                                    "No stream hosts set, cannot request bytestream." );
      return false;
    }

    const std::string& msid = sid.empty() ? m_parent->getID() : sid;
    const std::string& id = m_parent->getID();
    IQ iq( IQ::Set, to, id );
    iq.addExtension( new Query( msid, mode, m_hosts ) );
    if( from )
      iq.setFrom( from );

    if( m_server )
    {
      SHA sha;
      sha.feed( msid );
      if( from )
        sha.feed( from.full() );
      else
        sha.feed( m_parent->jid().full() );
      sha.feed( to.full() );
      m_server->registerHash( sha.hex() );
    }

    AsyncS5BItem asi;
    asi.sHosts = m_hosts;
    asi.id = id;
    asi.from = to;
    asi.to = from ? from : m_parent->jid();
    asi.incoming = false;
    m_asyncTrackMap[msid] = asi;

    m_trackMap[id] = msid;
    m_parent->send( iq, this, S5BOpenStream );

    return true;
  }

  void SOCKS5BytestreamManager::acknowledgeStreamHost( bool success, const JID& jid,
                                                       const std::string& sid )
  {
    AsyncTrackMap::const_iterator it = m_asyncTrackMap.find( sid );
    if( it == m_asyncTrackMap.end() || !m_parent )
      return;

    const AsyncS5BItem& item = (*it).second;

    IQ* iq = 0;

    if( item.incoming )
    {
      iq = new IQ( IQ::Result, item.from.full(), item.id );
      if( item.to )
        iq->setFrom( item.to );

      if( success )
        iq->addExtension( new Query( jid, sid, false ) );
      else
        iq->addExtension( new Error( StanzaErrorTypeCancel, StanzaErrorItemNotFound ) );

      m_parent->send( *iq );
    }
    else
    {
      if( success )
      {
        const std::string& id = m_parent->getID();
        iq = new IQ( IQ::Set, jid.full(), id );
        iq->addExtension( new Query( item.from, sid, true ) );

        m_trackMap[id] = sid;
        m_parent->send( *iq, this, S5BActivateStream );
      }
    }

    delete iq;
  }

  bool SOCKS5BytestreamManager::handleIq( const IQ& iq )
  {
    const Query* q = iq.findExtension<Query>( ExtS5BQuery );
    if( !q || !m_socks5BytestreamHandler
        || m_trackMap.find( iq.id() ) != m_trackMap.end() )
      return false;

    switch( iq.subtype() )
    {
      case IQ::Set:
      {
        const std::string& sid = q->sid();
// FIXME What is haveStream() good for?
        if( /*haveStream( iq.from() ) ||*/ sid.empty() || q->mode() == S5BUDP )
        {
          rejectSOCKS5Bytestream( iq.from(), iq.id(), StanzaErrorNotAcceptable );
          return true;
        }
        AsyncS5BItem asi;
        asi.sHosts = q->hosts();
        asi.id = iq.id();
        asi.from = iq.from();
        asi.to = iq.to();
        asi.incoming = true;
        m_asyncTrackMap[sid] = asi;
        m_socks5BytestreamHandler->handleIncomingBytestreamRequest( sid, iq.from() );
        break;
      }
      case IQ::Error:
        m_socks5BytestreamHandler->handleBytestreamError( iq, EmptyString );
        break;
      default:
        break;
    }

    return true;
  }

  const StreamHost* SOCKS5BytestreamManager::findProxy( const JID& from, const std::string& hostjid,
                                                        const std::string& sid )
  {
    AsyncTrackMap::const_iterator it = m_asyncTrackMap.find( sid );
    if( it == m_asyncTrackMap.end() )
      return 0;

    if( (*it).second.from == from )
    {
      StreamHostList::const_iterator it2 = (*it).second.sHosts.begin();
      for( ; it2 != (*it).second.sHosts.end(); ++it2 )
      {
        if( (*it2).jid == hostjid )
        {
          return &(*it2);
        }
      }
    }

    return 0;
  }

  bool SOCKS5BytestreamManager::haveStream( const JID& from )
  {
    S5BMap::const_iterator it = m_s5bMap.begin();
    for( ; it != m_s5bMap.end(); ++it )
    {
      if( (*it).second && (*it).second->target() == from )
        return true;
    }
    return false;
  }

  void SOCKS5BytestreamManager::acceptSOCKS5Bytestream( const std::string& sid )
  {
    AsyncTrackMap::iterator it = m_asyncTrackMap.find( sid );
    if( it == m_asyncTrackMap.end() || !m_socks5BytestreamHandler )
      return;

    SOCKS5Bytestream* s5b = new SOCKS5Bytestream( this, m_parent->connectionImpl()->newInstance(),
                                                  m_parent->logInstance(),
                                                  (*it).second.from, (*it).second.to, sid );
    s5b->setStreamHosts( (*it).second.sHosts );
    m_s5bMap[sid] = s5b;
    m_socks5BytestreamHandler->handleIncomingBytestream( s5b );
  }

  void SOCKS5BytestreamManager::rejectSOCKS5Bytestream( const std::string& sid, StanzaError reason )
  {
    AsyncTrackMap::iterator it = m_asyncTrackMap.find( sid );
    if( it != m_asyncTrackMap.end() )
    {
      rejectSOCKS5Bytestream( (*it).second.from, (*it).second.id, reason );
      m_asyncTrackMap.erase( it );
    }
  }

  void SOCKS5BytestreamManager::rejectSOCKS5Bytestream( const JID& from,
                                                        const std::string& id,
                                                        StanzaError reason )
  {
    IQ iq( IQ::Error, from, id );

    switch( reason )
    {
      case StanzaErrorForbidden:
      case StanzaErrorNotAcceptable:
      {
        iq.addExtension( new Error( StanzaErrorTypeAuth, reason ) );
        break;
      }
      case StanzaErrorFeatureNotImplemented:
      case StanzaErrorNotAllowed:
      default:
      {
        iq.addExtension( new Error( StanzaErrorTypeCancel, reason ) );
        break;
      }
    }

    m_parent->send( iq );
  }

  void SOCKS5BytestreamManager::handleIqID( const IQ& iq, int context )
  {
    StringMap::iterator it = m_trackMap.find( iq.id() );
    if( it == m_trackMap.end() )
      return;

    switch( context )
    {
      case S5BOpenStream:
      {
        switch( iq.subtype() )
        {
          case IQ::Result:
          {
            const Query* q = iq.findExtension<Query>( ExtS5BQuery );
            if( q && m_socks5BytestreamHandler )
            {
              const std::string& proxy = q->jid().full();
              const StreamHost* sh = findProxy( iq.from(), proxy, (*it).second );
              if( sh )
              {
                SOCKS5Bytestream* s5b = 0;
                bool selfProxy = ( proxy == m_parent->jid().full() && m_server );
                if( selfProxy )
                {
                  SHA sha;
                  sha.feed( (*it).second );
                  sha.feed( iq.to().full() );
                  sha.feed( iq.from().full() );
                  s5b = new SOCKS5Bytestream( this, m_server->getConnection( sha.hex() ),
                                              m_parent->logInstance(),
                                                  iq.to(), iq.from(),
                                                      (*it).second );
                }
                else
                {
                  s5b = new SOCKS5Bytestream( this, m_parent->connectionImpl()->newInstance(),
                                              m_parent->logInstance(),
                                                  iq.to(), iq.from(),
                                                      (*it).second );
                  s5b->setStreamHosts( StreamHostList( 1, *sh ) );
                }
                m_s5bMap[(*it).second] = s5b;
                m_socks5BytestreamHandler->handleOutgoingBytestream( s5b );
                if( selfProxy )
                  s5b->activate();
              }
            }
            break;
          }
          case IQ::Error:
            m_socks5BytestreamHandler->handleBytestreamError( iq, (*it).second );
            break;
          default:
            break;
        }
        break;
      }
      case S5BActivateStream:
      {
        switch( iq.subtype() )
        {
          case IQ::Result:
          {
            S5BMap::const_iterator it5 = m_s5bMap.find( (*it).second );
            if( it5 != m_s5bMap.end() )
              (*it5).second->activate();
            break;
          }
          case IQ::Error:
            m_socks5BytestreamHandler->handleBytestreamError( iq, (*it).second );
            break;
          default:
            break;
        }
        break;
      }
      default:
        break;
    }
    m_trackMap.erase( it );
  }

  bool SOCKS5BytestreamManager::dispose( SOCKS5Bytestream* s5b )
  {
    S5BMap::iterator it = m_s5bMap.find( s5b->sid() );
    if( it != m_s5bMap.end() )
    {
      delete s5b;
      m_s5bMap.erase( it );
      return true;
    }

    return false;
  }

}


text:
// @flow

import Icon from '@conveyal/woonerf/components/icon'
import React, {Component} from 'react'
import {connect} from 'react-redux'
import { Panel, Modal, Row, Col, Button, FormControl, Label as BsLabel, ListGroup, ListGroupItem, Image } from 'react-bootstrap'
import validator from 'validator'

import * as organizationActions from '../actions/organizations'
import UserPermissions from '../../common/user/UserPermissions'
import {getComponentMessages} from '../../common/util/config'
import type {Organization, UserProfile, Project} from '../../types'
import type {AppState, OrganizationsState, AdminUsersState} from '../../types/reducers'

import OrganizationSettings from './OrganizationSettings'

type Props = {
  createOrganization: typeof organizationActions.createOrganization,
  deleteOrganization: typeof organizationActions.deleteOrganization,
  fetchOrganizations: typeof organizationActions.fetchOrganizations,
  organizations: OrganizationsState,
  projects: Array<Project>,
  updateOrganization: typeof organizationActions.updateOrganization,
  users: AdminUsersState
}

type State = {
  showModal?: boolean
}

class OrganizationList extends Component<Props, State> {
  messages = getComponentMessages('OrganizationList')
  state = {}

  componentWillMount () {
    this.props.fetchOrganizations()
  }

  showModal = () => this.setState({showModal: true})

  close = () => this.setState({showModal: false})

  save = () => {
    const settings = this.refs.orgSettings.getSettings()
    if (settings) {
      this.props.createOrganization(settings)
      this.close()
    } else {
      window.alert('Must provide organization name.')
    }
  }

  render () {
    const { organizations, users } = this.props
    return (

        <Panel>
          <Panel.Heading>
            <Row>
              <Col xs={10} className='form-inline'>
                {/* TODO: connect this up to filter */}
                <FormControl type='text'
                  ref='searchInput'
                  placeholder={this.messages('search')} />
              </Col>
              <Col xs={2}>
                <Button
                  onClick={this.showModal}
                  bsStyle='primary'>
                  <Icon type='plus' />{' '}
                  {this.messages('new')}
                </Button>
              </Col>
            </Row>
          </Panel.Heading>
          <ListGroup>
            {organizations.isFetching
              ? <ListGroupItem style={{ fontSize: '18px', textAlign: 'center' }}>
                <Icon className='fa-2x fa-spin' type='refresh' />
              </ListGroupItem>
              : organizations.data && organizations.data.map((organization, i) => {
                const orgUsers = users.data ? users.data.filter(u => {
                  const permissions = new UserPermissions(u.app_metadata && u.app_metadata.datatools)
                  return permissions.getOrganizationId() === organization.id
                }) : []
                return (
                  <OrganizationRow
                    {...this.props}
                    organization={organization}
                    key={i}
                    orgUsers={orgUsers} />
                )
              })
            }
          </ListGroup>
        </Panel>
        <Modal
          show={this.state.showModal}
          onHide={this.close}>
          <Modal.Header closeButton>
            <Modal.Title>Create Organization</Modal.Title>
          </Modal.Header>
          <Modal.Body>
            <OrganizationSettings
              {...this.props}
              ref='orgSettings' />
          </Modal.Body>
          <Modal.Footer>
            <Button
              onClick={this.save}>
              {this.messages('new')}
            </Button>
          </Modal.Footer>
        </Modal>

    )
  }
}

class OrganizationRow extends Component<Props & {
  orgUsers: Array<UserProfile>,
  organization: Organization
},
{isEditing: boolean}> {
  state = {
    isEditing: false
  }

  toggleExpansion = () => {
    this.setState({
      isEditing: !this.state.isEditing
    })
  }

  cancel () {
    this.toggleExpansion()
  }

  save = () => {
    const settings = this.refs.orgSettings.getSettings()
    this.props.updateOrganization(this.props.organization, settings)
    this.toggleExpansion()
  }

  delete = () => {
    this.props.deleteOrganization(this.props.organization)
    this.toggleExpansion()
  }
  render () {
    const {
      organization,
      orgUsers
    } = this.props
    return (
      <ListGroupItem
        header={
          <Row>
            <Col xs={4} sm={2} md={1}>
              <Image
                responsive rounded
                src={organization.logoUrl && validator.isURL(organization.logoUrl, {protocol: 'https'}) ? organization.logoUrl : `http://placehold.it/60x60?text=${organization.name.substr(0, 3)}`}
                alt={organization.name} />
            </Col>
            <Col xs={8} sm={5} md={6}>

                {organization.name}{' '}
                {orgUsers.length ? <BsLabel>{orgUsers.length} users</BsLabel> : null}

            </Col>
            <Col xs={12} sm={5} md={5}>
              <Button
                className='pull-right'
                onClick={this.toggleExpansion}>
                {this.state.isEditing
                  ? <Icon type='remove' /> Cancel
                  : <Icon type='edit' /> Edit
                }
              </Button>
              {this.state.isEditing
                ? <Button
                  className='pull-right'
                  bsStyle='primary'
                  style={{marginRight: '5px'}}
                  onClick={this.save}>
                  <Icon type='save' /> Save
                </Button>
                : null
              }
              {this.state.isEditing
                ? <Button
                  className='pull-right'
                  bsStyle='danger'
                  style={{marginRight: '5px'}}
                  onClick={this.delete}>
                  <Icon type='trash' /> Delete
                </Button>
                : null
              }
            </Col>
          </Row>
        }
      >
        { this.state.isEditing
          ? <OrganizationSettings
            {...this.props}
            ref='orgSettings' />
          : ''
        }
      </ListGroupItem>
    )
  }
}

const mapStateToProps = (state: AppState, ownProps: {}) => {
  return {
    projects: state.projects.all,
    users: state.admin.users,
    organizations: state.admin.organizations
  }
}

const {
  createOrganization,
  deleteOrganization,
  fetchOrganizations,
  updateOrganization
} = organizationActions

const mapDispatchToProps = {
  createOrganization,
  deleteOrganization,
  fetchOrganizations,
  updateOrganization
}

export default connect(mapStateToProps, mapDispatchToProps)(OrganizationList)


text:
'use strict';

const definitions = require('./definitions');

const types = Object.keys(definitions).reduce((acc, key) => {
  const { builder, type } = definitions[key];
  return {
    ...acc,
    [type]: builder,
  };
}, {});

module.exports = {
  definitions,
  types,
};


text:
/*
    Created on : Aug 16, 2015, 5:28:48 PM
    Author     : Junior
*/

$(document).ready(function() {
    $('#singu').attr("checked",true);
    $(".btContinue").attr('disabled',true);
    $(".AddSeguroContinuar").attr("disabled",true);
    $('.closeModalFrame').click(function (){
       var tipoCliente =  $("input:radio[name='addClienteformulario:tipoCli']").is(":disabled");
       if(tipoCliente === true)
       {
            $(".mp-addClient").fadeOut();
       }
       else
       {
            $(".mp-addClient").hide($(".mp-addClient").fadeOut(400));
            limparInfo();
       }

    });

    $( ".addClient" ).click(function() {
         $('.buttons').css("display","");
         $('.clienteLimpar').attr("disabled", false);
         $('.formAddClient [type=text], select').attr('disabled', false);
        $("label").each(function ()
        {
            if ($(this).attr('for')==="addClienteformulario:tipoCli:0")
                $(this).show();
        });
        $("label").each(function ()
        {
            if ($(this).attr('for')==="addClienteformulario:tipoCli:1")
                $(this).show();
        });
       $('.formAddClient input').removeClass('onlyInfoSelected');
       $('.formAddClient input:text').val("");
       $('.formAddClient input:text').css("border","");
       $('.formAddClient select').removeClass('onlyInfoSelected');
       $('.formAddClient select').css("border","");
       $('.formAddClient select').val("");
       $('.formAddClient select').attr('disabled', false);
       $("input:radio[name='addClienteformulario:tipoCli']").attr('disabled',false);
       $("input:radio[name='addClienteformulario:numeroCliente']").val("");
       $("input:text[name='addClienteformulario:clienteDataNasc_input']").attr('disabled', false);
       $("input:text[name='addClienteformulario:clienteDataNasc_input']").val("");
       $(".mp-addClient").show($(".mp-addClient").fadeIn(400));
    });

    $('.cancel').click(function (){
     $(".mp-addClient").hide('fade');
         $('#formulario').each (function(e){
         this.reset();
            });
    });
     $(".nomeClienteSelecionado").click(function (e)
     {
        e.preventDefault();
       $(".tipoClienteS").html("");
        $('.formAddClient input').addClass('onlyInfoSelected');
        $('.formAddClient select').addClass('onlyInfoSelected');
          $("label").each(function ()
        {
            if ($(this).attr('for')==="addClienteformulario:tipoCli:0")
                $(this).show();
        });
        $("label").each(function ()
        {
            if ($(this).attr('for')==="addClienteformulario:tipoCli:1")
                $(this).show();
        });
        if($(".tipoCliente").html() !=="")
        {
            $("input:radio[name='addClienteformulario:tipoCli']").attr('disabled',true);
            if($(".tipoCliente").html() ==="Empresa")
            {
               $("input:radio[name='addClienteformulario:tipoCli']").each(function ()
              {
                 if($(this).val()==="Coletivo")
                 {
                      $(this).attr('checked', true);

                 }
                 $("label").each(function ()
                 {

                     if ($(this).attr('for')==="addClienteformulario:tipoCli:0")
                         $(this).hide();
                 });
              });
                $(".singular").hide($(".singular").fadeOut(00));
                $(".coletivo").show("slide");
            }
            else
            {
                 $("input:radio[name='addClienteformulario:tipoCli']").each(function ()
             {
                 if($(this).val()==="Singular")
                 {
                      $(this).attr('checked', true);
                 }
                 $("label").each(function ()
                 {
                     if ($(this).attr('for')==="addClienteformulario:tipoCli:1")
                         $(this).hide();
                 });
             });
                $(".coletivo").hide($(".coletivo").fadeOut(00));
                $(".singular").show("slide");
            }

            $('.formAddClient input:text').attr('disabled', true);
            $('.formAddClient select').attr('disabled', true);
            $('.buttons').css("display","none");
            $("input:text[name='addClienteformulario:clienteDataNasc_input']").attr('disabled', true);
            $(".mp-addClient").show($(".mp-addClient").fadeIn(400));
        }

    });
});

function ClienteSelecionado(xhr, status, args)
{
    var d = args.selecionado;
    var nomeCli = args.nome;
    var tipoC = args.tipoC;
    var contratos = args.contrato;
    var email = args.emailCliente;
    var nif = args.nif;
    var telefone = args.telefone;
    var telemovel = args.telemovel;

    if(d==='sim')
    {

         $(".AddSeguroContinuar").attr("disabled",false);
         $(".nomeClienteSelecionado").html(nomeCli);

        $(".tipoCliente").html(tipoC);
        $(".contratoCliente").html(contratos);
        $(".btContinue").attr('disabled',false);
    }
    else
    {
         $(".AddSeguroContinuar").attr("disabled",true);
         $(".nomeClienteSelecionado").html("");
         $(".tipoCliente").html("");
          $(".contratoCliente").html("");
         $(".btContinue").attr('disabled',true);
    }

     if(tipoC !=="")
     {
        if(tipoC==="Pessoa")
        {
            $(".NifSingular").val(nif);
            if(telefone ==="NENHUM")
                 $(".telefoneS").val("");
            else
              $(".telefoneS").val(telefone);
            if(telemovel ==="NENHUM")
               $(".telemovelS").val("");
            else
                $(".telemovelS").val(telemovel);
        }
        else
        {
            $(".nifColetivo").val(nif);
            if(telefone ==="NENHUM")
                 $(".telefoneColetivo").val("");
            else
              $(".telefoneColetivo").val(telefone);
            if(telemovel ==="NENHUM")
               $(".telemovelColetivo").val("");
            else
                $(".telemovelColetivo").val(telemovel);
        }
    }

}

function Cliente(xhr, status, args)
{
    var d = args.selecionado;
    if(d==="sim")
    {
         $(".AddSeguroContinuar").attr("disabled",false);
    }
    else
    {
         $(".AddSeguroContinuar").attr("disabled",true);
    }

}

 //-------------INFORMAÇÕES DA PAGINA GESTÃO DE CLIENTES----------

 function Info(xhr, status, args)
 {
     var info = args.selecionado;
     var tipoCliente = args.tipoClienteSelecionado;
     var contrato = args.contratoCliente;
     var nome = args.nomeCliente;

     //se um cliente for selecionado na tabela
     if(info ==='true')
     {
         $(".nomeClienteSelecionado").html(nome);
         $(".tipoCliente").html(tipoCliente);
         $(".contratoCliente").html(contrato);
     }

 }
  function limparInfo()
 {
    $('.formAddClient input:text').val("");
    $('.formAddClient input:text').css("border","");
    $('.formAddClient select').css("border","");
    $('.formAddClient select').val("");
 }

function checkApolice(apoliceCarregado)
{
    if(apoliceCarregado === "N")
        $(".apolice").attr("disabled", false);
    else
        $(".apolice").attr("disabled", true);
}

function apoliceContrato(apolice)
{
    if(apolice === '')
    {
        $(".apolice").attr("disabled", false);
        $(".apolice").val("");
    }
    else
    {
        $(".apolice").attr("disabled", true);
        $(".apolice").val(apolice);
    }
}


text:
#include "pch.h"
#include "MediaTypeFormatter.h"
#include "MediaSample.h"
#include "MediaStreamSink.h"

using namespace MediaCaptureReader;
using namespace Microsoft::WRL;
using namespace Platform;
using namespace Windows::Foundation;

MediaStreamSink::MediaStreamSink(
    __in const ComPtr<IMFMediaSink>& sink,
    __in DWORD id,
    __in const ComPtr<IMFMediaType>& mt,
    __in MediaSampleHandler^ sampleHandler,
    __in_opt MediaGraphicsDevice^ graphicsDevice /*= nullptr*/
    )
    : _shutdown(false)
    , _id(-1)
    , _width(0)
    , _height(0)
    , _graphicsDevice(graphicsDevice)
{
    CHK(MFCreateEventQueue(&_eventQueue));
    CHK(MFCreateMediaType(&_curMT));

    _UpdateMediaType(mt);

    _sink = sink;
    _id = id;
    _sampleHandler = sampleHandler;
}

HRESULT MediaStreamSink::GetMediaSink(__deref_out IMFMediaSink **sink)
{
    return ExceptionBoundary([this, sink]()
    {
        auto lock = _lock.LockExclusive();

        CHKNULL(sink);
        *sink = nullptr;

        _VerifyNotShutdown();

        CHK(_sink.CopyTo(sink));
    });
}

HRESULT MediaStreamSink::GetIdentifier(__out DWORD *identifier)
{
    return ExceptionBoundary([this, identifier]()
    {
        auto lock = _lock.LockExclusive();

        CHKNULL(identifier);

        _VerifyNotShutdown();

        *identifier = _id;
    });
}

HRESULT MediaStreamSink::GetMediaTypeHandler(__deref_out IMFMediaTypeHandler **handler)
{
    return ExceptionBoundary([this, handler]()
    {
        auto lock = _lock.LockExclusive();

        CHKNULL(handler);
        *handler = nullptr;

        _VerifyNotShutdown();

        *handler = this;
        this->AddRef();

    });
}

void MediaStreamSink::RequestSample()
{
    auto lock = _lock.LockExclusive();

    _VerifyNotShutdown();

    CHK(_eventQueue->QueueEventParamVar(MEStreamSinkRequestSample, GUID_NULL, S_OK, nullptr));
}

HRESULT MediaStreamSink::ProcessSample(__in_opt IMFSample *sample)
{
    return ExceptionBoundary([this, sample]()
    {
        MediaSampleHandler^ sampleHandler;
        IMediaSample^ mediaSample;

        {
            auto lock = _lock.LockExclusive();

            _VerifyNotShutdown();

            if (sample == nullptr)
            {
                return;
            }

            long long time = 0;
            (void)sample->GetSampleTime(&time);

            long long duration = 0;
            (void)sample->GetSampleDuration(&duration);

#ifdef NTRACELOG
			Trace("@%p IMFSample @%p, time %I64dhns, duration %I64dhns", (void*)this, sample, (int64)time, (int64)duration);
#endif

            ComPtr<IMF2DBuffer2> buffer2D;
            ComPtr<IMFMediaBuffer> buffer1D;
            CHK(sample->GetBufferByIndex(0, &buffer1D));
            if (SUCCEEDED(buffer1D.As(&buffer2D)))
            {
                auto mediaSample2D = ref new MediaSample2D(
                    sample,
                    MediaSample2D::GetFormatFromSubType(_subType),
                    (int)_width,
                    (int)_height,
                    _graphicsDevice
                    );
                mediaSample = mediaSample2D;
            }
            else
            {
                mediaSample = ref new MediaSample1D(sample);
            }

            mediaSample->Timestamp = TimeSpan{ time };
            mediaSample->Duration = TimeSpan{ duration };

            sampleHandler = _sampleHandler;
        }

        // Call back without the lock taken to avoid deadlocks
        sampleHandler(mediaSample);
    });
}

HRESULT MediaStreamSink::PlaceMarker(__in MFSTREAMSINK_MARKER_TYPE /*markerType*/, __in const PROPVARIANT * /*markerValue*/, __in const PROPVARIANT * contextValue)
{
    return ExceptionBoundary([this, contextValue]()
    {
        auto lock = _lock.LockExclusive();
        CHKNULL(contextValue);

        _VerifyNotShutdown();

        CHK(_eventQueue->QueueEventParamVar(MEStreamSinkMarker, GUID_NULL, S_OK, contextValue));
    });
}

HRESULT MediaStreamSink::Flush()
{
    return ExceptionBoundary([this]()
    {
        auto lock = _lock.LockExclusive();

        _VerifyNotShutdown();
    });
}

HRESULT MediaStreamSink::GetEvent(__in DWORD flags, __deref_out IMFMediaEvent **event)
{
    return ExceptionBoundary([this, flags, event]()
    {
        CHKNULL(event);
        *event = nullptr;

        ComPtr<IMFMediaEventQueue> eventQueue;

        {
            auto lock = _lock.LockExclusive();

            _VerifyNotShutdown();

            eventQueue = _eventQueue;
        }

        // May block for a while
        CHK(eventQueue->GetEvent(flags, event));
    });
}

HRESULT MediaStreamSink::BeginGetEvent(__in IMFAsyncCallback *callback, __in_opt IUnknown *state)
{
    return ExceptionBoundary([this, callback, state]()
    {
        auto lock = _lock.LockExclusive();

        _VerifyNotShutdown();

        CHK(_eventQueue->BeginGetEvent(callback, state));
    });
}

HRESULT MediaStreamSink::EndGetEvent(__in IMFAsyncResult *result, __deref_out IMFMediaEvent **event)
{
    return ExceptionBoundary([this, result, event]()
    {
        auto lock = _lock.LockExclusive();

        CHKNULL(event);
        *event = nullptr;

        _VerifyNotShutdown();

        CHK(_eventQueue->EndGetEvent(result, event));
    });
}

HRESULT MediaStreamSink::QueueEvent(
    __in MediaEventType met,
    __in REFGUID extendedType,
    __in HRESULT status,
    __in_opt const PROPVARIANT *value
    )
{
    return ExceptionBoundary([this, met, extendedType, status, value]()
    {
        auto lock = _lock.LockExclusive();

        _VerifyNotShutdown();

        CHK(_eventQueue->QueueEventParamVar(met, extendedType, status, value));
    });
}

HRESULT MediaStreamSink::IsMediaTypeSupported(__in IMFMediaType *mediaType, __deref_out_opt  IMFMediaType **closestMediaType)
{
    bool supported = false;

    HRESULT hr = ExceptionBoundary([this, mediaType, closestMediaType, &supported]()
    {
        auto lock = _lock.LockExclusive();
        HRESULT hr = S_OK;

        if (closestMediaType != nullptr)
        {
            *closestMediaType = nullptr;
        }

        CHKNULL(mediaType);

        _VerifyNotShutdown();

        supported = _IsMediaTypeSupported(mediaType);
    });

    // Avoid throwing an exception to return MF_E_INVALIDMEDIATYPE as this is not a exceptional case
    return FAILED(hr) ? hr : supported ? S_OK : MF_E_INVALIDMEDIATYPE;
}

HRESULT MediaStreamSink::GetMediaTypeCount(__out DWORD *typeCount)
{
    return ExceptionBoundary([this, typeCount]()
    {
        auto lock = _lock.LockExclusive();

        CHKNULL(typeCount);

        _VerifyNotShutdown();

        // No media type provided by default (app needs to specify it)
        *typeCount = 0;
    });
}

HRESULT MediaStreamSink::GetMediaTypeByIndex(__in DWORD /*index*/, __deref_out  IMFMediaType **mediaType)
{
    HRESULT hr = ExceptionBoundary([this, mediaType]()
    {
        auto lock = _lock.LockExclusive();

        CHKNULL(mediaType);
        *mediaType = nullptr;

        _VerifyNotShutdown();
    });

    // Avoid throwing an exception to return MF_E_NO_MORE_TYPES as this is not a exceptional case
    return FAILED(hr) ? hr : MF_E_NO_MORE_TYPES;
}

HRESULT MediaStreamSink::SetCurrentMediaType(__in IMFMediaType *mediaType)
{
    HRESULT hr = ExceptionBoundary([this, mediaType]()
    {
        auto lock = _lock.LockExclusive();
        HRESULT hr = S_OK;

        CHKNULL(mediaType);

        _VerifyNotShutdown();

        if (!_IsMediaTypeSupported(mediaType))
        {
            CHK(MF_E_INVALIDMEDIATYPE);
        }

        _UpdateMediaType(mediaType);
    });
#ifdef NTRACELOG
	Trace("SetCurrentMediaType hr=%08X, %s", hr, MediaTypeFormatter::Format(mediaType).c_str());
#endif

    return hr;
}

HRESULT MediaStreamSink::GetCurrentMediaType(__deref_out_opt IMFMediaType **mediaType)
{
    return ExceptionBoundary([this, mediaType]()
    {
        auto lock = _lock.LockExclusive();

        CHKNULL(mediaType);
        *mediaType = nullptr;

        _VerifyNotShutdown();

        ComPtr<IMFMediaType> mt;
        CHK(MFCreateMediaType(&mt));
        CHK(_curMT->CopyAllItems(mt.Get()));
        *mediaType = mt.Detach();
    });
}

HRESULT MediaStreamSink::GetMajorType(__out GUID *majorType)
{
    return ExceptionBoundary([this, majorType]()
    {
        auto lock = _lock.LockExclusive();

        CHKNULL(majorType);

        _VerifyNotShutdown();

        *majorType = _majorType;
    });
}

void MediaStreamSink::InternalSetCurrentMediaType(__in const ComPtr<IMFMediaType>& mediaType)
{
    auto lock = _lock.LockExclusive();

    CHKNULL(mediaType);

    _VerifyNotShutdown();

    _UpdateMediaType(mediaType);
}

void MediaStreamSink::Shutdown()
{
    auto lock = _lock.LockExclusive();

    if (_shutdown)
    {
        return;
    }
    _shutdown = true;

    (void)_eventQueue->Shutdown();
    _eventQueue = nullptr;

    _curMT = nullptr;
    _sink = nullptr;
    _sampleHandler = nullptr;
    _graphicsDevice = nullptr;
}

bool MediaStreamSink::_IsMediaTypeSupported(__in const ComPtr<IMFMediaType>& mt) const
{
    GUID majorType;
    GUID subType;
    if (SUCCEEDED(mt->GetGUID(MF_MT_MAJOR_TYPE, &majorType)) &&
        SUCCEEDED(mt->GetGUID(MF_MT_SUBTYPE, &subType)) &&
        (majorType == _majorType) &&
        (subType == _subType))
    {
        return true;
    }

    return false;
}

void MediaStreamSink::_UpdateMediaType(__in const ComPtr<IMFMediaType>& mt)
{
    CHK(mt->GetGUID(MF_MT_MAJOR_TYPE, &_majorType));
    CHK(mt->GetGUID(MF_MT_SUBTYPE, &_subType));

    if (_majorType == MFMediaType_Video)
    {
        CHK(MFGetAttributeSize(mt.Get(), MF_MT_FRAME_SIZE, &_width, &_height));
    }

    CHK(mt->CopyAllItems(_curMT.Get()));
}


text:
PKG_ROOT=/tmp
VERSION=$TAG
AVALANCHE_ROOT=$PKG_ROOT/avalanchego-$VERSION

mkdir -p $AVALANCHE_ROOT

OK=`cp ./build/avalanchego $AVALANCHE_ROOT`
if [[ $OK -ne 0 ]]; then
  exit $OK;
fi
OK=`cp -r ./build/plugins $AVALANCHE_ROOT`
if [[ $OK -ne 0 ]]; then
  exit $OK;
fi

echo "Build tgz package..."
cd $PKG_ROOT
echo "Version: $VERSION"
tar -czvf "avalanchego-linux-$ARCH-$VERSION.tar.gz" avalanchego-$VERSION
aws s3 cp avalanchego-linux-$ARCH-$VERSION.tar.gz s3://$BUCKET/linux/binaries/ubuntu/$RELEASE/$ARCH/
rm -rf $PKG_ROOT/avalanchego*


text:
<metadata xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.fgdc.gov/metadata/fgdc-std-001-1998.xsd">
   <idinfo>
      <citation>
         <citeinfo>
            <origin>Dave Hanson</origin>
            <pubdate>20141003</pubdate>
            <title>PSI PBR culture density and temperature effects - Photobioreactor-041 end 15C</title>
            <geoform>spreadsheet</geoform>
            <onlink>http://nmepscor.org/data_portal/browse-data</onlink>
            <onlink>http://gstore.unm.edu/apps/energize/datasets/7f0ae582-586f-4ff9-a027-b5aa6053d435/20140826_15_PBR1.original.xlsx</onlink>
            <onlink>http://gstore.unm.edu/apps/energize/datasets/7f0ae582-586f-4ff9-a027-b5aa6053d435/metadata/FGDC-STD-001-1998.xml</onlink>
            <onlink>http://gstore.unm.edu/apps/energize/datasets/7f0ae582-586f-4ff9-a027-b5aa6053d435/metadata/FGDC-STD-001-1998.html</onlink>
            <onlink>http://gstore.unm.edu/apps/energize/datasets/7f0ae582-586f-4ff9-a027-b5aa6053d435/metadata/ISO-19115:2003.xml</onlink>
            <onlink>http://gstore.unm.edu/apps/energize/datasets/7f0ae582-586f-4ff9-a027-b5aa6053d435/metadata/ISO-19115:2003.html</onlink>
         </citeinfo>
      </citation>
      <descript>
         <abstract>These are baseline data on the metabolic effects of culture density in semicontinuous cultures grown in PSI photobioreactors.
         </abstract>
         <purpose>This is a test of three things: 1) functionality of photobioreactors from PSI, 2) effect of cell density on metabolism, 3) the interaction between temperature, cell density and metabolism. This is a baseline for comparison to encapsulated cultures.
         </purpose>
         <supplinf>Conducted in the lab of Martin Jonikas at Stanford's Carnegie Institute.  These data are made available through New Mexico's Experimental Program to
            Stimulate Competitive Research (NM EPSCoR) data portal. The portal provides access
            to data generated by and of use to the EPSCoR community including researchers,
            educators, and policy leaders, as well as the general public.</supplinf>
      </descript>
      <timeperd>
         <timeinfo>
            <rngdates>
               <begdate>20140826</begdate>
               <enddate>20140829</enddate>
            </rngdates>
         </timeinfo>
         <current>Publication date</current>
      </timeperd>
      <status>
         <progress>Complete</progress>
         <update>Unknown</update>
      </status>
      <spdom>
         <bounding>
            <westbc>-122.17</westbc>
            <eastbc>-122.17</eastbc>
            <northbc>37.43</northbc>
            <southbc>37.43</southbc>
         </bounding>
      </spdom>
      <keywords>
         <theme>
            <themekt>Dave Hanson</themekt>
            <themekey>bioalgal energy</themekey>
            <themekey>PBR</themekey>
            <themekey>density</themekey>
            <themekey>temperature</themekey>
            <themekey>liquid</themekey>
            <themekey>Chlamydomonas</themekey>
         </theme>
         <theme>
            <themekt>ISO 19115 Topic Category</themekt>
            <themekey>utilitiesCommunications</themekey>
         </theme>
         <theme>
            <themekt>Project</themekt>
            <themekey>EPSCoR T1R4</themekey>
            <themekey>Bioalgal Energy</themekey>
            <themekey>Encapsulated Algae</themekey>
         </theme>
         <place>
            <placekt>GNIS</placekt>
            <placekey>New Mexico</placekey>
         </place>
      </keywords>
      <accconst>None</accconst>
      <useconst>None</useconst>
      <ptcontac>
         <cntinfo>
            <cntorgp>
               <cntorg>University of New Mexico</cntorg>
               <cntper>Dave Hanson</cntper>
            </cntorgp>
            <cntaddr>
               <addrtype>mailing address</addrtype>
               <address>Biology Department</address>
               <address>University of New Mexico</address>
               <city>Albuquerque</city>
               <state>NM</state>
               <postal>87131</postal>
               <country>USA</country>
            </cntaddr>
            <cntvoice>505-277-6681</cntvoice>
            <cntemail>dthanson@unm.edu</cntemail>
         </cntinfo>
      </ptcontac>
      <datacred>Dave Hanson</datacred>
      <native>Unknown</native>
   </idinfo>
   <dataqual>
      <logic>Not provided</logic>
      <complete>Not provided</complete>
      <lineage>
         <procstep>
            <procdesc>John Roesgen collected 15C data and switched to 25C</procdesc>
            <procdate>20140826</procdate>
         </procstep>
         <procstep>
            <procdesc>John Roesgen collected 25C data and shut down</procdesc>
            <procdate>20140829</procdate>
         </procstep>
      </lineage>
   </dataqual>
   <spdoinfo>
      <indspref>United States</indspref>
   </spdoinfo>
   <eainfo>
      <detailed>
         <enttyp>
            <enttypl>PSI PBR culture density and temperature effects</enttypl>
            <enttypd>Photobioreactor-041 end 15C</enttypd>
            <enttypds>Dave Hanson</enttypds>
         </enttyp>
         <attr>
            <attrlabl>Bioreact_typ</attrlabl>
            <attrdef>Bioreactor_type - Photobioreactor-###</attrdef>
            <attrdefs>Dave Hanson</attrdefs>
            <attrdomv>
               <udom>Bioreactor type</udom>
            </attrdomv>
         </attr>
         <attr>
            <attrlabl>Bioreactor</attrlabl>
            <attrdef>Bioreactor name -PBR#</attrdef>
            <attrdefs>Dave Hanson</attrdefs>
            <attrdomv>
               <udom>Bioreactor name</udom>
            </attrdomv>
         </attr>
         <attr>
            <attrlabl>Bioreact_id</attrlabl>
            <attrdef>Bioreactor id</attrdef>
            <attrdefs>Dave Hanson</attrdefs>
            <attrdomv>
               <udom>Bioreactor id</udom>
            </attrdomv>
         </attr>
         <attr>
            <attrlabl>Start</attrlabl>
            <attrdef>Program start time</attrdef>
            <attrdefs>Dave Hanson</attrdefs>
            <attrdomv>
               <udom>Start time</udom>
            </attrdomv>
         </attr>
         <attr>
            <attrlabl>End</attrlabl>
            <attrdef>Program end time</attrdef>
            <attrdefs>Dave Hanson</attrdefs>
            <attrdomv>
               <udom>End time</udom>
            </attrdomv>
         </attr>
         <attr>
            <attrlabl>Exper_name</attrlabl>
            <attrdef>Experiment name</attrdef>
            <attrdefs>Dave Hanson</attrdefs>
            <attrdomv>
               <udom>Experiment name</udom>
            </attrdomv>
         </attr>
         <attr>
            <attrlabl>Exper_gass</attrlabl>
            <attrdef>Experiment gassing - Gas supplied</attrdef>
            <attrdefs>Dave Hanson</attrdefs>
            <attrdomv>
               <udom>Experiment gassing</udom>
            </attrdomv>
         </attr>
         <attr>
            <attrlabl>Inoculum</attrlabl>
            <attrdef>Inoculum</attrdef>
            <attrdefs>Dave Hanson</attrdefs>
            <attrdomv>
               <udom>Inoculum</udom>
            </attrdomv>
         </attr>
         <attr>
            <attrlabl>Stirring</attrlabl>
            <attrdef>Stirring</attrdef>
            <attrdefs>Dave Hanson</attrdefs>
            <attrdomv>
               <udom>Stirring</udom>
            </attrdomv>
         </attr>
         <attr>
            <attrlabl>Medium</attrlabl>
            <attrdef>Medium</attrdef>
            <attrdefs>Dave Hanson</attrdefs>
            <attrdomv>
               <udom>Medium</udom>
            </attrdomv>
         </attr>
         <attr>
            <attrlabl>Organism</attrlabl>
            <attrdef>Organism</attrdef>
            <attrdefs>Dave Hanson</attrdefs>
            <attrdomv>
               <udom>Organism</udom>
            </attrdomv>
         </attr>
         <attr>
            <attrlabl>Notes</attrlabl>
            <attrdef>Notes</attrdef>
            <attrdefs>Dave Hanson</attrdefs>
            <attrdomv>
               <udom>Notes</udom>
            </attrdomv>
         </attr>
         <attr>
            <attrlabl>Time</attrlabl>
            <attrdef>Measurement time</attrdef>
            <attrdefs>Dave Hanson</attrdefs>
            <attrdomv>
               <rdom>
                  <rdommin>0</rdommin>
                  <rdommax>54.767</rdommax>
                  <attrunit>hours</attrunit>
               </rdom>
            </attrdomv>
         </attr>
         <attr>
            <attrlabl>Temperature</attrlabl>
            <attrdef>Temperature of culture</attrdef>
            <attrdefs>Dave Hanson</attrdefs>
            <attrdomv>
               <rdom>
                  <rdommin>14.483</rdommin>
                  <rdommax>18.152</rdommax>
                  <attrunit>degrees Celsius</attrunit>
               </rdom>
            </attrdomv>
         </attr>
         <attr>
            <attrlabl>ph</attrlabl>
            <attrdef>pH</attrdef>
            <attrdefs>Dave Hanson</attrdefs>
            <attrdomv>
               <rdom>
                  <rdommin>7.742</rdommin>
                  <rdommax>7.837</rdommax>
                  <attrunit>pH Scale</attrunit>
               </rdom>
            </attrdomv>
         </attr>
         <attr>
            <attrlabl>OD_680</attrlabl>
            <attrdef>optical density 680nm</attrdef>
            <attrdefs>Dave Hanson</attrdefs>
            <attrdomv>
               <rdom>
                  <rdommin>0.206</rdommin>
                  <rdommax>0.327</rdommax>
               </rdom>
            </attrdomv>
         </attr>
         <attr>
            <attrlabl>OD_735</attrlabl>
            <attrdef>optical density 735nm</attrdef>
            <attrdefs>Dave Hanson</attrdefs>
            <attrdomv>
               <rdom>
                  <rdommin>0.087</rdommin>
                  <rdommax>0.168</rdommax>
               </rdom>
            </attrdomv>
         </attr>
         <attr>
            <attrlabl>O2</attrlabl>
            <attrdef>O2</attrdef>
            <attrdefs>Dave Hanson</attrdefs>
            <attrdomv>
               <rdom>
                  <rdommin>1.412</rdommin>
                  <rdommax>2.162</rdommax>
                  <attrunit>unitless</attrunit>
               </rdom>
            </attrdomv>
         </attr>
         <attr>
            <attrlabl>H2</attrlabl>
            <attrdef>N/A</attrdef>
            <attrdefs>Dave Hanson</attrdefs>
            <attrdomv>
               <rdom>
                  <rdommin>0</rdommin>
                  <rdommax>0</rdommax>
               </rdom>
            </attrdomv>
         </attr>
         <attr>
            <attrlabl>CO2_medium</attrlabl>
            <attrdef>NOT USED</attrdef>
            <attrdefs>Dave Hanson</attrdefs>
            <attrdomv>
               <udom>CO2 Medium</udom>
            </attrdomv>
         </attr>
         <attr>
            <attrlabl>CO2_air</attrlabl>
            <attrdef>NOT USED</attrdef>
            <attrdefs>Dave Hanson</attrdefs>
            <attrdomv>
               <udom>CO2 air</udom>
            </attrdomv>
         </attr>
         <attr>
            <attrlabl>red_QY</attrlabl>
            <attrdef>red:QY quantum yield hourly</attrdef>
            <attrdefs>Dave Hanson</attrdefs>
            <attrdomv>
               <rdom>
                  <rdommin>0.028</rdommin>
                  <rdommax>0.418</rdommax>
                  <attrunit>unitless</attrunit>
               </rdom>
            </attrdomv>
         </attr>
         <attr>
            <attrlabl>red_Fm</attrlabl>
            <attrdef>red:Fm - max fluorescence red pulse</attrdef>
            <attrdefs>Dave Hanson</attrdefs>
            <attrdomv>
               <rdom>
                  <rdommin>419</rdommin>
                  <rdommax>625</rdommax>
                  <attrunit>unitless</attrunit>
               </rdom>
            </attrdomv>
         </attr>
         <attr>
            <attrlabl>red_Ft</attrlabl>
            <attrdef>red:Ft - fluorescence at time T red light</attrdef>
            <attrdefs>Dave Hanson</attrdefs>
            <attrdomv>
               <rdom>
                  <rdommin>246</rdommin>
                  <rdommax>595</rdommax>
                  <attrunit>unitless</attrunit>
               </rdom>
            </attrdomv>
         </attr>
         <attr>
            <attrlabl>blue_QY</attrlabl>
            <attrdef>blue-QY - quantum yield</attrdef>
            <attrdefs>Dave Hanson</attrdefs>
            <attrdomv>
               <rdom>
                  <rdommin>0.145</rdommin>
                  <rdommax>0.326</rdommax>
                  <attrunit>unitless</attrunit>
               </rdom>
            </attrdomv>
         </attr>
         <attr>
            <attrlabl>blue_Fm</attrlabl>
            <attrdef>blue:Fm - max fluorescence blue pulse</attrdef>
            <attrdefs>Dave Hanson</attrdefs>
            <attrdomv>
               <rdom>
                  <rdommin>1985</rdommin>
                  <rdommax>2748</rdommax>
                  <attrunit>unitless</attrunit>
               </rdom>
            </attrdomv>
         </attr>
         <attr>
            <attrlabl>blue_Ft</attrlabl>
            <attrdef>blue:Ft - fluorescence at time T blue light</attrdef>
            <attrdefs>Dave Hanson</attrdefs>
            <attrdomv>
               <rdom>
                  <rdommin>1264</rdommin>
                  <rdommax>2713</rdommax>
                  <attrunit>unitless</attrunit>
               </rdom>
            </attrdomv>
         </attr>
         <attr>
            <attrlabl>target_temp</attrlabl>
            <attrdef>target temperature</attrdef>
            <attrdefs>Dave Hanson</attrdefs>
            <attrdomv>
               <rdom>
                  <rdommin>Unknown</rdommin>
                  <rdommax>Unknown</rdommax>
                  <attrunit>Degree Celsius</attrunit>
               </rdom>
            </attrdomv>
         </attr>
         <attr>
            <attrlabl>red_actinic</attrlabl>
            <attrdef>red actinic light intensity</attrdef>
            <attrdefs>Dave Hanson</attrdefs>
            <attrdomv>
               <rdom>
                  <rdommin>167.5</rdommin>
                  <rdommax>167.5</rdommax>
                  <attrunit>umol m-2 s-1</attrunit>
               </rdom>
            </attrdomv>
         </attr>
         <attr>
            <attrlabl>blue_actinic</attrlabl>
            <attrdef>blue actinic light intensity</attrdef>
            <attrdefs>Dave Hanson</attrdefs>
            <attrdomv>
               <rdom>
                  <rdommin>180.9</rdommin>
                  <rdommax>180.9</rdommax>
                  <attrunit>umol m-2 s-1</attrunit>
               </rdom>
            </attrdomv>
         </attr>
      </detailed>
   </eainfo>
   <distinfo>
      <distrib>
         <cntinfo>
            <cntorgp>
               <cntorg>Earth Data Analysis Center</cntorg>
            </cntorgp>
            <cntpos>Clearinghouse Manager</cntpos>
            <cntaddr>
               <addrtype>mailing and physical address</addrtype>
               <address>MSC01 1110</address>
               <address>1 University of New Mexico</address>
               <city>Albuquerque</city>
               <state>NM</state>
               <postal>87131-0001</postal>
               <country>USA</country>
            </cntaddr>
            <cntvoice>505-277-3622 ext. 230</cntvoice>
            <cntfax>505-277-3614</cntfax>
            <cntemail>clearinghouse@edac.unm.edu</cntemail>
            <hours>0800 - 1700 MT, M-F -7 hours GMT</hours>
         </cntinfo>
      </distrib>
      <resdesc>Downloadable Data</resdesc>
      <distliab>The material on this site is made available as a public service. Maps and data are to be used for reference purposes only and the Earth Data Analysis Center (EDAC), New Mexico EPSCoR (NM EPSCoR), Energize New Mexico and The University of New Mexico are not responsible for any inaccuracies herein contained. No responsibility is assumed for damages or other liabilities due to the accuracy, availability, use or misuse of the information herein provided. Unless otherwise indicated in the documentation (metadata) for individual data sets, information on this site is public domain and may be copied without permission; citation of the source is appreciated.</distliab>
      <stdorder>
         <digform>
            <digtinfo>
               <formname>MS Office Open XML Spreadsheet (xslx)</formname>
               <transize>1</transize>
            </digtinfo>
            <digtopt>
               <onlinopt>
                  <computer>
                     <networka>
                        <networkr>http://gstore.unm.edu/apps/energize/datasets/7f0ae582-586f-4ff9-a027-b5aa6053d435/20140826_15_PBR1.original.xlsx</networkr>
                     </networka>
                  </computer>
                  <accinstr>Download from New Mexico EPSCoR (NM EPSCoR), Energize New Mexico at http://nmepscor.org.</accinstr>
               </onlinopt>
            </digtopt>
         </digform>
         <fees>None. The files are available to download from New Mexico EPSCoR (NM EPSCoR), Energize New Mexico (http://nmepscor.org).</fees>
         <ordering>Contact Earth Data Analysis Center at clearinghouse@edac.unm.edu</ordering>
      </stdorder>
      <custom>Contact Earth Data Analysis Center at clearinghouse@edac.unm.edu</custom>
      <techpreq>Adequate computer capability is the only technical prerequisite for viewing data in digital form.</techpreq>
   </distinfo>
   <metainfo>
      <metd>20150519</metd>
      <metc>
         <cntinfo>
            <cntorgp>
               <cntorg>Earth Data Analysis Center</cntorg>
            </cntorgp>
            <cntpos>Clearinghouse Manager</cntpos>
            <cntaddr>
               <addrtype>mailing and physical address</addrtype>
               <address>MSC01 1110</address>
               <address>1 University of New Mexico</address>
               <city>Albuquerque</city>
               <state>NM</state>
               <postal>87131-0001</postal>
               <country>USA</country>
            </cntaddr>
            <cntvoice>505-277-3622 ext. 230</cntvoice>
            <cntfax>505-277-3614</cntfax>
            <cntemail>clearinghouse@edac.unm.edu</cntemail>
            <hours>0800 - 1700 MT, M-F -7 hours GMT</hours>
         </cntinfo>
      </metc>
      <metstdn>FGDC Content Standards for Digital Geospatial Metadata</metstdn>
      <metstdv>FGDC-STD-001-1998</metstdv>
      <mettc>local time</mettc>
   </metainfo>
</metadata>


text:
import BootstrapTable from './BootstrapTable';
import TableHeaderColumn from './TableHeaderColumn';
import InsertModalHeader from './toolbar/InsertModalHeader';
import InsertModalBody from './toolbar/InsertModalBody';
import InsertModalFooter from './toolbar/InsertModalFooter';
import InsertButton from './toolbar/InsertButton';
import DeleteButton from './toolbar/DeleteButton';
import ExportCSVButton from './toolbar/ExportCSVButton';
import ShowSelectedOnlyButton from './toolbar/ShowSelectedOnlyButton';
import ClearSearchButton from './toolbar/ClearSearchButton';
import SearchField from './toolbar/SearchField';
import ButtonGroup from './toolbar/ButtonGroup';
import SizePerPageDropDown from './pagination/SizePerPageDropDown';

if (typeof window !== 'undefined') {
  window.BootstrapTable = BootstrapTable;
  window.TableHeaderColumn = TableHeaderColumn;
  window.InsertModalHeader = InsertModalHeader;
  window.InsertModalBody = InsertModalBody;
  window.InsertModalFooter = InsertModalFooter;
  window.InsertButton = InsertButton;
  window.DeleteButton = DeleteButton;
  window.ShowSelectedOnlyButton = ShowSelectedOnlyButton;
  window.ExportCSVButton = ExportCSVButton;
  window.ClearSearchButton = ClearSearchButton;
  window.SearchField = SearchField;
  window.ButtonGroup = ButtonGroup;
  window.SizePerPageDropDown = SizePerPageDropDown;
}
export {
  BootstrapTable,
  TableHeaderColumn,
  InsertModalHeader,
  InsertModalBody,
  InsertModalFooter,
  InsertButton,
  DeleteButton,
  ShowSelectedOnlyButton,
  ExportCSVButton,
  ClearSearchButton,
  SearchField,
  ButtonGroup,
  SizePerPageDropDown
};


text:
#include "test.h"

#define NUMTHREADS (30)

static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
static pthread_t threads[NUMTHREADS];
static unsigned numThreads = 0;

void *
myfunc(void *arg)
{
  pthread_mutex_lock(&lock);
  numThreads++;
  pthread_mutex_unlock(&lock);

  Sleep(1000);
  return 0;
}
int
main()
{
  int i;
  int maxThreads = sizeof(threads) / sizeof(pthread_t);

  /*
   * Spawn NUMTHREADS threads. Each thread should increment the
   * numThreads variable, sleep for one second.
   */
  for (i = 0; i < maxThreads; i++)
    {
      assert(pthread_create(&threads[i], NULL, myfunc, 0) == 0);
    }

  /*
   * Wait for all the threads to exit.
   */
  for (i = 0; i < maxThreads; i++)
    {
      assert(pthread_join(threads[i], NULL) == 0);
    }

  /*
   * Check the number of threads created.
   */
  assert((int) numThreads == maxThreads);

  /*
   * Success.
   */
  return 0;
}


text:
module AuditRails
  module AuditsHelper
    def add_to_audit(action_name=nil, controller_name=nil, user_name=nil, description=nil)
      if (action_name == "login" &&
              AuditRails::Audit.no_audit_entry_for_today?(action_name, user_name)) ||
        action_name != "login"
          AuditRails::Audit.create(action: get_action(action_name),
            controller: controller_name || request.params[:controller],
            user_name: user_name,
            description: description,
            ip_address: request.remote_ip.to_s)
      end
    end

    def get_action(action_name)
      action_name || request.params[:action]
    end

    def active?(action_name)
      controller.action_name == action_name
    end

    def active_class(action_name)
      active?(action_name) ? 'active' : ''
    end

    def page_visits_by_user(user)
      JSON.parse(@analysis[:per_user_by_page_views])[user].to_json
    end

    def percentage_share(user, count, total)
      "#{(100.0 * count/total).round(1)}%"
    end
  end
end


text:
package us.kbase.genomeimporter;

import java.util.HashMap;
import java.util.Map;
import javax.annotation.Generated;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;

/**
 *
Original spec-file type: ImportGenomeResults

 *

 * Output structure for the import_external_genome function
 *

 *
 */
@JsonInclude(JsonInclude.Include.NON_NULL)
@Generated("com.googlecode.jsonschema2pojo")
@JsonPropertyOrder({
    "report_name",
    "report_ref"
})
public class ImportGenomeResults {

    @JsonProperty("report_name")
    private String reportName;
    @JsonProperty("report_ref")
    private String reportRef;
    private Map<String, Object> additionalProperties = new HashMap<String, Object>();

    @JsonProperty("report_name")
    public String getReportName() {
        return reportName;
    }

    @JsonProperty("report_name")
    public void setReportName(String reportName) {
        this.reportName = reportName;
    }

    public ImportGenomeResults withReportName(String reportName) {
        this.reportName = reportName;
        return this;
    }

    @JsonProperty("report_ref")
    public String getReportRef() {
        return reportRef;
    }

    @JsonProperty("report_ref")
    public void setReportRef(String reportRef) {
        this.reportRef = reportRef;
    }

    public ImportGenomeResults withReportRef(String reportRef) {
        this.reportRef = reportRef;
        return this;
    }

    @JsonAnyGetter
    public Map<String, Object> getAdditionalProperties() {
        return this.additionalProperties;
    }

    @JsonAnySetter
    public void setAdditionalProperties(String name, Object value) {
        this.additionalProperties.put(name, value);
    }

    @Override
    public String toString() {
        return ((((((("ImportGenomeResults"+" [reportName=")+ reportName)+", reportRef=")+ reportRef)+", additionalProperties=")+ additionalProperties)+"]");
    }

}


text:
package at.kc.tugraz.ss.service.coll.service;

import at.tugraz.sss.servs.coll.impl.SSCollImpl;
import at.tugraz.sss.serv.conf.api.SSCoreConfA;
import at.tugraz.sss.serv.reg.*;
import at.tugraz.sss.serv.impl.api.SSServImplA;
import at.kc.tugraz.ss.service.coll.api.SSCollClientI;
import at.kc.tugraz.ss.service.coll.api.SSCollServerI;
import at.kc.tugraz.ss.service.tag.api.SSTagServerI;
import at.tugraz.sss.serv.conf.api.SSConfA;
import at.tugraz.sss.serv.datatype.SSErr;
import at.tugraz.sss.serv.container.api.*;
import at.tugraz.sss.serv.datatype.enums.*;
import java.util.List;

public class SSCollServ extends SSServContainerI{

  public static final SSCollServ inst = new SSCollServ(SSCollClientI.class, SSCollServerI.class);

  protected SSCollServ(
    final Class servImplClientInteraceClass,
    final Class servImplServerInteraceClass){

    super(servImplClientInteraceClass, servImplServerInteraceClass);
  }

  @Override
  public SSServImplA getServImpl() throws SSErr{

    if(!conf.use){
      throw SSErr.get(SSErrE.servNotRunning);
    }

    if(servImpl != null){
      return servImpl;
    }

    synchronized(this){

      servImpl = new SSCollImpl(conf);
    }

    return servImpl;
  }

  @Override
  public SSServContainerI regServ(final SSConfA conf) throws SSErr{

    this.conf = conf;

    SSServReg.inst.regServ(this);

    SSServReg.inst.regServForHandlingDescribeEntity(this);
    SSServReg.inst.regServForHandlingGetParentEntities(this);
    SSServReg.inst.regServForHandlingGetSubEntities(this);
    SSServReg.inst.regServForHandlingPushEntitiesToUsers(this);
    SSServReg.inst.regServForHandlingAddAffiliatedEntitiesToCircle(this);
    SSServReg.inst.regServForGatheringUserRelations (this);
    SSServReg.inst.regServForGatheringUsersResources (this);

    return this;
  }

  @Override
  public void initServ() throws SSErr{
  }

  @Override
  public SSCoreConfA getConfForCloudDeployment(
    final SSCoreConfA coreConfA,
    final List<Class> configuredServs) throws SSErr{

    throw new UnsupportedOperationException();
    //check whether to deploy service calls itself here once in getConfForCloudDeployment
//    final SSCoreConf coreConf = (SSCoreConf) getConfForCloudDeployment(SSTagServerI.class /* TODO wrong class here */, coreConfA, configuredServs);
//    final SSCollConf collConf = coreConf.getColl();
//
//    collConf.use                = true;
//    collConf.executeOpAtStartUp = false;
////    collConf.op                 = null;
//
//    return coreConf;
  }

  @Override
  public void schedule() throws SSErr{
    throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
  }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
	<persistence-unit name="persistenceUnit" transaction-type="RESOURCE_LOCAL">
		<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>

		<!-- List all entity classes here -->
		<class>com.amb_it_ion.refocus.persistence.UserEntity</class>
		<class>com.amb_it_ion.refocus.persistence.NavigationSectionEntity</class>

		<exclude-unlisted-classes>true</exclude-unlisted-classes>
		<shared-cache-mode>NONE</shared-cache-mode>
		<properties>
			<property name="eclipselink.target-database" value="org.eclipse.persistence.platform.database.HSQLPlatform"/>
			<property name="eclipselink.ddl-generation" value="create-tables"/>
			<property name="eclipselink.ddl-generation.output-mode" value="database"/>

			<property name="javax.persistence.jdbc.driver" value="org.hsqldb.jdbc.JDBCDriver"/>
			<property name="javax.persistence.jdbc.url" value="jdbc:hsqldb:mem:testdb"/>
			<property name="javax.persistence.jdbc.user" value="SA"/>
			<property name="javax.persistence.jdbc.password" value=""/>

			<property name="eclipselink.jdbc.batch-writing" value="JDBC"/>
			<property name="eclipselink.jdbc.native-sql" value="true"/>
			<property name="eclipselink.logging.level" value="OFF"/>
			<property name="eclipselink.logging.logger" value="DefaultLogger"/>
		</properties>
	</persistence-unit>
</persistence>


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/maven-v4_0_0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<groupId>MySpringSecurity1.0</groupId>
	<artifactId>MySpringSecurity1.0</artifactId>
	<version>0.0.1-SNAPSHOT</version>
	<packaging>war</packaging>
	<name />
	<description />
	<dependencies>

		<!-- Spring-Security 3.1.4-->
		<dependency>
			<groupId>org.springframework.security</groupId>
			<artifactId>spring-security-web</artifactId>
			<version>3.1.4.RELEASE</version>
		</dependency>
		<dependency>
			<groupId>org.springframework.security</groupId>
			<artifactId>spring-security-config</artifactId>
			<version>3.1.4.RELEASE</version>
		</dependency>

		<dependency>
			<groupId>jstl</groupId>
			<artifactId>jstl</artifactId>
			<version>1.2</version>
		</dependency>

		<dependency>
			<groupId>taglibs</groupId>
			<artifactId>standard</artifactId>
			<version>1.1.2</version>
		</dependency>

		<dependency>
			<groupId>xstream</groupId>
			<artifactId>xstream</artifactId>
			<version>0.5</version>
		</dependency>
		<dependency>
			<groupId>commons-logging</groupId>
			<artifactId>commons-logging</artifactId>
			<version>1.1.1</version>
		</dependency>

	</dependencies>

</project>


text:
@(pname: String, ptext: String)

            @ptext

            <select name="@pname" class="form-control" id="sel1">
                <option value="120">120</option>
                <option value="240">240</option>
                <option value="3">3</option>
                <option value="4">4</option>
            </select>


text:
using FluentNHibernate.Mapping;
using LNF.Impl.Repository.Data;

namespace LNF.Impl.Mappings.Data
{
    internal class SpecialTopicMap : ClassMap<SpecialTopic>
    {
        internal SpecialTopicMap()
        {
            Schema("sselData.dbo");
            Id(x => x.SpecialTopicID);
            Map(x => x.SpecialTopicName, "SpecialTopic");
        }
    }
}


text:
define(function(require, exports, module) {
"use strict";
var oop = require("../lib/oop");
var JSMode = require("./javascript").Mode;
var Tokenizer = require("../tokenizer").Tokenizer;
var SJSHighlightRules = require("./sjs_highlight_rules").SJSHighlightRules;
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour;
var CStyleFoldMode = require("./folding/cstyle").FoldMode;

var Mode = function() {
    var highlighter = new SJSHighlightRules();

    this.$tokenizer = new Tokenizer(highlighter.getRules());
    this.$outdent = new MatchingBraceOutdent();
    this.$behaviour = new CstyleBehaviour();
    this.$keywordList = highlighter.$keywordList;
    this.foldingRules = new CStyleFoldMode();
};
oop.inherits(Mode, JSMode);
(function() {
    // disable jshint
    this.createWorker = function(session) {
        return null;
    }
}).call(Mode.prototype);

exports.Mode = Mode;
});


text:
(function() {
  function onReadyStateComplete(document, callback) {

    function checkReadyState() {
      if (document.readyState === 'complete') {
        // TODO: the prototype code checked to see if the event exists before removing it.
        $(document).unbind('readystatechange', checkReadyState);
        callback();
        return true;
      } else {
        return false;
      }
    }

    $(document).bind('readystatechange', checkReadyState);
    checkReadyState();
  }

  function observeFrameContentLoaded(element) {
    element = $(element);
    var bare = element.get(0);

    var loaded, contentLoadedHandler;

    loaded = false;
    function fireFrameLoaded() {
      if (loaded) { return };

      loaded = true;
      if (contentLoadedHandler) { contentLoadedHandler.stop(); }
      element.trigger('frame:loaded');
    }

    if (window.addEventListener) {
      contentLoadedHandler = $(document).bind("DOMFrameContentLoaded", function(event) {
        if (element == $(this))
          fireFrameLoaded();
      });
    }

    element.load(function() {
      var frameDocument;
      if (typeof element.contentDocument !== 'undefined') {
        frameDocument = element.contentDocument;
      } else if (typeof element.contentWindow !== 'undefined' && typeof element.contentWindow.document !== 'undefined') {
        frameDocument = element.contentWindow.document;
      }

      onReadyStateComplete(frameDocument, fireFrameLoaded);
    });

    return element;
  }

  function onFrameLoaded($element, callback) {
    $element.bind('frame:loaded', callback);
    $element.observeFrameContentLoaded();
  }

  jQuery.fn.observeFrameContentLoaded = observeFrameContentLoaded;
  jQuery.fn.onFrameLoaded = onFrameLoaded;
})();


text:
package nz.co.testamation.core.mock;

import nz.co.testamation.core.mock.requestmatcher.RequestMatcher;
import nz.co.testamation.core.mock.response.MockResponse;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

public interface HttpExpectationHandler {

    MockResponse getMatchingResponse( HttpServletRequest request ) throws Exception;

    void addExpectation( RequestMatcher<HttpServletRequestWrapper> requestMatcher, MockResponse response );

    OnGoingExpectationStart<HttpServletRequestWrapper> createExpectation();

    void complete( OnGoingExpectation onGoingExpectation );

    void reset();

    void verify();

    void verifyOnGoingExpectation();

    List<HttpServletRequestWrapper> getReceivedRequests();
}


text:
package com.dreamchain.skeleton.dao.impl;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Random;

import javax.transaction.Transactional;

import org.hibernate.Query;
import org.hibernate.SQLQuery;
import org.hibernate.SessionFactory;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import com.dreamchain.skeleton.dao.ImageTagDao;
import com.dreamchain.skeleton.model.ImageInfo;
import com.dreamchain.skeleton.model.ImageTag;

@Repository
@Transactional
public class ImageTagDaoImpl implements ImageTagDao {

    @Autowired
    private SessionFactory sessionFactory;

    @Override
    public void add(ImageTag image_tag){
      sessionFactory.getCurrentSession().save(image_tag);

    }

    /**
     * 获取一组图片
     */
	@Transactional
	@Override
    public List<ImageInfo> data(){
		List<Object> sequence = new ArrayList<Object>();
		for(int i=1;i<=20;i++){
			for(int j=1;j<=5;j++){
				//暂且认定,j:image_type  i:多少组数据
				List<Object> n = RandomSelect(j);
				sequence.addAll(n);
			}
		}

		String range = sequence.toString().substring(1, sequence.toString().length()-1);
		//System.out.println(range);
		//System.out.println("range:"+range);
		String hq2 = "FROM ImageInfo i WHERE i.id in ("+range+")";
//		SQLQuery query2 = sessionFactory.getCurrentSession().createSQLQuery(hq2);
//		List<Object> n2 = query2.list();
		List<ImageInfo> images = sessionFactory.getCurrentSession()
				                 .createQuery(hq2)
				                 .list();

//		String result = "http://localhost:8080/skeleton/aurora/data/!";
//		String imgType = ".jpg";
//		Iterator<ImageInfo> it = images.iterator();
//		while(it.hasNext()){
//			ImageInfo image = it.next();
//			result += image.toString()+"\n";
//			result += objs[0].toString()+","+objs[1].toString()+imgType+","+objs[2].toString()+imgType+","+
//					objs[3].toString()+imgType+","+objs[4].toString()+","+objs[5].toString()+"!";

//		}

		return images;

    }

	/**
	 * 获取一组随机数据
	 * @param ground_truth
	 * @param score
	 * @return
	 */
//	public List<Object> RandomSelect(int image_type,int hard ){
	public List<Object> RandomSelect(int image_type ){

		String hql = "select t.id from image_info t where t.image_type = "+image_type;
//		String hql = "SELECT i.id FROM ImageInfo i  WHERE i.image_type=?";
//		System.out.println("session:"+sessionFactory);
		SQLQuery query1 = sessionFactory.getCurrentSession().createSQLQuery(hql);
		List<Object> n1 = query1.list();
//		List<Object> n1 = sessionFactory.getCurrentSession()
//				             .createQuery(hql)
//				             .setInteger(0, image_type)
////				             .setInteger(1, hard)
//				             .list();
		//System.out.println("n1:"+n1.size());
		Random rand = new Random() ;
		ArrayList<Object> sequence = new ArrayList<Object>();
		for(int i = 1;i<=4 &&n1.size()!=0;i++){

			int randNum = rand.nextInt(n1.size());
			//if(sequence)
			//System.out.println( (int)n1.get(randNum));
			int a = (int) n1.get(randNum);
			if(sequence.contains(a)){
				i--;
			}else{
				sequence.add(a);
			}
		}
		return sequence;

	}

//	/**
//	 * 用户注册
//	 */
//	public String register(String name, String password, String phone, String email, String age){
//
//		String hq1 = "select * from  user_info where name = '"+name+"'";
//		SQLQuery query1 = sessionFactory.getCurrentSession().createSQLQuery(hq1);
//		List n1 = query1.list();
//		if(n1.size() != 0){
//			return "error";
//		}
//
//		String hq2 = "insert user_info(phase,age,email,name,password,phone) values ('train',"+age+",'"+email+"','"+name+"','"+password+"','"+phone+"')";
//		SQLQuery query2 = sessionFactory.getCurrentSession().createSQLQuery(hq2);
//		int n2 = query2.executeUpdate();
//		return String.valueOf(n2);
//
//	}

	/**
	 * 选择特定图片
	 */
	@Override
	public List<ImageInfo> select(int id) {

//		String hq2 = "select * from image_info t where t.id ="+id;
		String hql = "FROM ImageInfo i WHERE i.id="+id;
//		SQLQuery query2 = sessionFactory.getCurrentSession().createSQLQuery(hq2);
//      List<ImageInfo> n2 = query2.list();
		List<ImageInfo> n2 = sessionFactory.getCurrentSession()
				          .createQuery(hql)
				          .list();

//		String result = "http://localhost:8080/skeleton/aurora/data/!";
//		String imgType = ".jpg";
//		Iterator<ImageInfo> it = n2.iterator();
//		while(it.hasNext()){
//			ImageInfo image =  it.next();
//			result += objs[0].toString()+","+objs[1].toString()+imgType+","+objs[2].toString()+imgType+","+
//					objs[3].toString()+imgType+","+objs[4].toString()+","+objs[5].toString()+"!";
//		    result += image.toString()+"\n";
//		}

		return n2;
	}

	@Override
	public List<ImageTag> find(int start, int pagesize) {
		Query query = sessionFactory.getCurrentSession().createQuery("from ImageTag as a");
		query.setFirstResult(start);
		query.setMaxResults(pagesize);
		List<ImageTag> list = query.list();
		for(ImageTag imageTag : list){
			System.out.println(imageTag.getId());
		}
		return list;
	}

	@Override
	public int count() {
		String hql = "select count(*)  from ImageTag";
		 Query query =  sessionFactory.getCurrentSession().createQuery(hql);
		 int n = ((Long) query.iterate().next()).intValue();
		 return n;
	}
}


text:
FROM alpine:latest
MAINTAINER Philipp Garbe <philipp.garbe@web.de>

# alias rake='docker run -it --rm -v $(pwd):/root/rake \
#                        -e AWS_REGION=$AWS_REGION \
#                        -e AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID \
#                        -e AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY \
#                        -e AWS_SESSION_TOKEN=$AWS_SESSION_TOKEN \
#                        --log-driver none \
#                        --entrypoint rake OR bundle OR ruby
#                        pgarbe/rake "$@"'

ENV BUILD_PACKAGES bash curl-dev ruby-dev build-base
ENV RUBY_PACKAGES ruby ruby-io-console ruby-bundler ruby-rake

# Update and install all of the required packages.
# At the end, remove the apk cache
RUN apk update && \
    apk upgrade && \
    apk add $BUILD_PACKAGES && \
    apk add $RUBY_PACKAGES && \
    rm -rf /var/cache/apk/*

ENV HOME /root
WORKDIR $HOME/rake

ENTRYPOINT [ "ruby" ]


text:
package io.jboot.test.mq.rabbit;

import io.jboot.Jboot;
import io.jboot.app.JbootApplication;

/**
 * 开始之前 先通过通过 docker 把 rabbitmq 运行起来
 * docker run -d  -p 15672:15672 -p 5672:5672 rabbitmq:management
 */
public class RabbitMqSender {

    public static void main(String[] args) throws InterruptedException {

        //Undertow端口号配置
        JbootApplication.setBootArg("undertow.port", "8000");

        //设置 mq 的相关信息
        JbootApplication.setBootArg("jboot.mq.type", "rabbitmq");
        JbootApplication.setBootArg("jboot.mq.rabbitmq.broadcastExchangeDeclareExchangeType", "direct");

        //以下可以不用配置,是默认信息
//        JbootApplication.setBootArg("jboot.mq.rabbitmq.username", "guest");
//        JbootApplication.setBootArg("jboot.mq.rabbitmq.password", "guest");
//        JbootApplication.setBootArg("jboot.mq.rabbitmq.host", "127.0.0.1");
//        JbootApplication.setBootArg("jboot.mq.rabbitmq.port", "5672");
//        JbootApplication.setBootArg("jboot.mq.rabbitmq.virtualHost", "");

        //启动应用程序
        JbootApplication.run(args);

        long index = 0;

        while (true && index < 3) {

            Jboot.getMq().publish("broadcast-channel1-index:" + index, "channel1");
            Jboot.getMq().publish("broadcast-channel2-index:" + index, "channel2");
            Jboot.getMq().publish("broadcast-myChannel-index:" + index, "myChannel");

            Jboot.getMq().enqueue("enqueue-channel1-index:" + index, "channel1");

            System.out.println("jboot mq publish success... index: " + index);
            index++;

            Thread.sleep(2000);
        }

    }

}


text:
package org.projectfloodlight.openflow.protocol;

import org.projectfloodlight.openflow.protocol.*;
import org.projectfloodlight.openflow.protocol.action.*;
import org.projectfloodlight.openflow.protocol.actionid.*;
import org.projectfloodlight.openflow.protocol.bsntlv.*;
import org.projectfloodlight.openflow.protocol.errormsg.*;
import org.projectfloodlight.openflow.protocol.meterband.*;
import org.projectfloodlight.openflow.protocol.instruction.*;
import org.projectfloodlight.openflow.protocol.instructionid.*;
import org.projectfloodlight.openflow.protocol.match.*;
import org.projectfloodlight.openflow.protocol.stat.*;
import org.projectfloodlight.openflow.protocol.oxm.*;
import org.projectfloodlight.openflow.protocol.oxs.*;
import org.projectfloodlight.openflow.protocol.queueprop.*;
import org.projectfloodlight.openflow.types.*;
import org.projectfloodlight.openflow.util.*;
import org.projectfloodlight.openflow.exceptions.*;
import java.util.List;
import io.netty.buffer.ByteBuf;

public interface OFGroupInsertBucket extends OFObject, OFGroupMod {
    OFVersion getVersion();
    OFType getType();
    long getXid();
    OFGroupModCommand getCommand();
    OFGroupType getGroupType();
    OFGroup getGroup();
    OFGroupBucket getCommandBucketId();
    List<OFBucket> getBuckets();
    List<OFGroupProp> getProperties();

    void writeTo(ByteBuf channelBuffer);

    Builder createBuilder();
    public interface Builder extends OFGroupMod.Builder {
        OFGroupInsertBucket build();
        OFVersion getVersion();
        OFType getType();
        long getXid();
        Builder setXid(long xid);
        OFGroupModCommand getCommand();
        OFGroupType getGroupType();
        Builder setGroupType(OFGroupType groupType);
        OFGroup getGroup();
        Builder setGroup(OFGroup group);
        OFGroupBucket getCommandBucketId();
        Builder setCommandBucketId(OFGroupBucket commandBucketId);
        List<OFBucket> getBuckets();
        Builder setBuckets(List<OFBucket> buckets);
        List<OFGroupProp> getProperties();
        Builder setProperties(List<OFGroupProp> properties);
    }
}