text:
$(function() {

  var isMobile = {
    Android: function() {
        return navigator.userAgent.match(/Android/i);
    },
    BlackBerry: function() {
        return navigator.userAgent.match(/BlackBerry/i);
    },
    iOS: function() {
        return navigator.userAgent.match(/iPhone|iPad|iPod/i);
    },
    Opera: function() {
        return navigator.userAgent.match(/Opera Mini/i);
    },
    Windows: function() {
        return navigator.userAgent.match(/IEMobile/i);
    },
    any: function() {
        return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows());
    }
  };

  if (isMobile.any()) {
    FastClick.attach(document.body);

    $('input[autofocus]').removeAttr('autofocus');
  }

  function isAndroid() {
    var nua = navigator.userAgent,
        isAndroid = (nua.indexOf('Mozilla/5.0') > -1 && nua.indexOf('Android ') > -1 && nua.indexOf('AppleWebKit') > -1 && nua.indexOf('Chrome') === -1);
    if (isAndroid) {
      $('html').addClass('android-browser');
    }
  }

  isAndroid();

  $('.nav-menu__trigger').on('click', function() {
    $(this).next('.nav-menu__items').toggleClass('toggle-content');
    $(this).toggleClass('triggered');
    return false;
  });

  $('.mob-collpanel-trigger').on('click', function() {
    $(this).next('.mob-collpanel').toggleClass('panel-open');
    $(this).toggleClass('triggered');
    return false;
  });

  $('.collpanel-trigger').on('click', function() {
    $(this).next('.collpanel').toggleClass('panel-open');
    $(this).toggleClass('triggered');
    return false;
  });

  $('.button-toggler').on('click', function() {
    var $this = $(this),
        $target = $this.attr('data-target');

    $('#' + $target).toggleClass('toggle-content');

    return false;
  });

  // Create linked input fields (For using email address as username)
  $('.linked-input-master').on('keyup blur', function() {
    var masterVal = $(this).val();
    $('.linked-input-slave').val(masterVal);
    $('.linked-input-slave').removeClass('hidden').text(masterVal);
    if($(this).val() == '') {
      $('.linked-input-slave').addClass('hidden');
    }
  });

  $(".block-label").each(function(){
    var $target = $(this).attr('data-target');

    // Add focus
    $(".block-label input").focus(function() {
      $("label[for='" + this.id + "']").addClass("add-focus");
      }).blur(function() {
      $("label").removeClass("add-focus");
    });
    // Add selected class
    $('input:checked').parent().addClass('selected');

    if($(this).hasClass('selected')) {
      $('#' + $target).show();
    }
  });

  // Add/remove selected class
  $('.block-label').on('click', 'input[type=radio], input[type=checkbox]', function() {
    var $this   = $(this),
        $target = $this.parent().attr('data-target'),
        $siblingTarget = $this.parent().siblings().attr('data-target'),
        $disTarget = $this.parent().attr('data-distarget'),
        $theTargetControl = $('#' + $disTarget);

    $('input:not(:checked)').parent().removeClass('selected');
    $('input:checked').parent().addClass('selected');

    if($target == undefined) {
      $this.closest('.form-group').next('.toggle-content').hide().attr('aria-hidden', true);
      $this.closest('.form-group').find('[aria-expanded]').attr('aria-expanded', false);
    } else {
      $('#' + $target).show();
      $('#' + $siblingTarget).hide().attr('aria-hidden', true);

      if($this.closest('.form-group').hasClass('blocklabel-single')) {

        $this.closest('.blocklabel-single-container').find('.blocklabel-content').not('#' + $target).hide();
      }
    }

    if($disTarget && !$theTargetControl.attr('disabled')) {
      $theTargetControl.attr('disabled', true);
      if($theTargetControl.attr('type') == 'text') {
        $theTargetControl.val('');
      } else if($theTargetControl.is('select')) {
        $theTargetControl.find('> option:first-of-type').attr('selected', true);
      }
    } else if($disTarget && $theTargetControl.attr('disabled')) {
      $theTargetControl.attr('disabled', false);
    }

  });

  $('.selectWithOptionTrigger').on('change', function() {
    var optionTrigger = $(this).find('.optionTrigger'),
        optionTarget = $('#' + optionTrigger.attr('data-optiontrigger'));

    if(optionTrigger.is(':selected')) {
      optionTarget.show();
    } else {
      optionTarget.hide();
    }
  });

  $('.amend-answers').on('click', function() {
    $(this).closest('.form-group').toggleClass('expanded');
    return false;
  });

  $('.update-answers').on('click', function() {
    $(this).closest('.form-group').toggleClass('expanded');
  });

  $('.summary-trigger').on('click', function() {
    $('.summary-box').toggle();
  });

  $('.summary-close').on('click', function() {
    $('.summary-box').toggle();
  });

  $('.inpage-focus').on('click', function() {
    var $this      = $(this),
        $target    = $this.attr('href'),
        $targetFor = $($target).attr('for');

    $('#' + $targetFor).focus();
  });

  //--------Max character length on textareas

  $('textarea').on('keyup', function() {
    characterCount(this);
  });

  $('textarea:not(:empty)').each(function() {
    characterCount(this);
  });

  setTimeout(function() {
    $('textarea[data-value]').each(function() {
      characterCount(this);
    });
  }, 1000);

  function characterCount(that) {
    var $this         = $(that),
        $maxLength    = $this.attr('data-val-length-max'),
        $enteredText  = $this.val(),
        $lineBreaks   = ($enteredText.match(/\n/g) || []).length,
        $lengthOfText = $enteredText.length + $lineBreaks,
        $characterCount = Math.abs($maxLength - $lengthOfText),
        $charCountEl  = $this.closest('.form-group').find('.maxchar-count'),
        $charTextEl   = $this.closest('.form-group').find('.maxchar-text'),
        $thisAria     = $this.closest('.form-group').find('.aria-limit');

    if($maxLength) {
        $charCountEl.text($characterCount);
    }

    if($lengthOfText > $maxLength) {
        $charCountEl.parent().addClass('has-error');
        $charTextEl.text(' characters over the limit');
        $thisAria.text("Character limit has been reached, you must type fewer than " + $maxLength + " characters");
        if ($characterCount == 1) {
            $charTextEl.text(' character over the limit');
        } else {
            $charTextEl.text(' characters over the limit');
        }
    } else {
        $charCountEl.parent().removeClass('has-error');
        $charTextEl.text(' characters remaining');
        $thisAria.text("");
        if ($characterCount == 1) {
            $charTextEl.text(' character remaining');
        } else {
            $charTextEl.text(' characters remaining');
        }
    }
  }

  //--------Expanding tables

  $('.tbody-3rows').each(function() {
    var $this       = $(this),
        $rowLength  = $this.find('tr').length,
        $expandRows = $this.next('.tbody-expandrows'),
        $after3Rows = $this.find('tr:nth-of-type(3)').nextAll(),
        $after6Rows = $this.find('tr:nth-of-type(6)').nextAll();

    if($rowLength > 3 && !$this.hasClass('tbody-withReasons')) {
      $expandRows.show();
      $after3Rows.hide().attr('aria-hidden', true);
    } else if($rowLength > 6 && $this.hasClass('tbody-withReasons')) {
      $expandRows.show();
      $after6Rows.hide().attr('aria-hidden', true);
    }

  });

  $('.btnExpandRows').on('click', function() {
    var $this        = $(this),
        $tbodyExpand = $this.closest('.tbody-expandrows');
        $tbody3Rows   = $tbodyExpand.prev('.tbody-3rows').find('tr:nth-of-type(3)').nextAll(),
        $tbodyWithReasons  = $tbodyExpand.prev('.tbody-withReasons').find('tr:nth-of-type(6)').nextAll();

    if(!$tbodyExpand.prev('.tbody-withReasons').length > 0) {
      $tbody3Rows.toggle();
    } else if($tbodyExpand.prev('.tbody-withReasons').length > 0) {
      $tbodyWithReasons.toggle();
    }

    $this.closest('table').toggleClass('opened');

    if($this.text().indexOf('More') > -1) {
      $this.html('Less');
      $this.attr('aria-expanded', false);
      if(!$tbodyExpand.prev('.tbody-withReasons').length > 0){
        $tbody3Rows.attr('aria-hidden', false);
      } else if ($tbodyExpand.prev('.tbody-withReasons').length > 0) {
        $tbodyWithReasons.attr('aria-hidden', false);
      }
    } else {
      $this.html('More');
      $this.attr('aria-expanded', true);
      if(!$tbodyExpand.prev('.tbody-withReasons').length > 0){
        $tbody3Rows.attr('aria-hidden', true);
      } else if ($tbodyExpand.prev('.tbody-withReasons').length > 0) {
        $tbodyWithReasons.attr('aria-hidden', true);
      }
    }

    return false;

  });

  //----------Details > Summary ARIA

  $('[aria-expanded]').on('click', function() {
    var $this = $(this),
        $controls = $(this).attr('aria-controls');

    if(!$this.parent().hasClass('selected')) {
      if($this.is('[aria-expanded="false"]')) {
        $('#' + $controls).attr('aria-hidden', false);
        $this.attr('aria-expanded', true);
      } else {
        $('#' + $controls).attr('aria-hidden', true);
        $this.attr('aria-expanded', false);
      }
    }

  });

  $('[aria-hidden]').each(function() {
    var $controlID = $(this).attr('id');

    if($(this).is(':visible')) {
      $(this).attr('aria-hidden', false);
      $('[aria-controls="' + $controlID + '"]').attr('aria-expanded', true);
    }
  });

  //----------Radio expanding lists IE8

  if($('html').hasClass('lt-ie9')) {
     $('.list-checkradio input[type=radio]:checked').siblings('details').addClass('ie8-details');

     $('.list-checkradio > li').on('click', function () {
       var $this = $(this),
           $thisDetails = $this.find('details');

       $('.list-checkradio input[type=radio]').not(':checked').siblings('details').removeClass('ie8-details');

       $thisDetails.addClass('ie8-details');

     });
   }

  //----------Tabbed content

  $('.tabbed-tab').attr('href', "#");

  $('.tabbed-tab').on('click', function() {
      var $this = $(this),
          $tabId = $this.attr('tab');

      $this.addClass('active');

      $('.tabbed-tab').not($('[tab="' + $tabId + '"]')).removeClass('active');

      if ($($tabId).length) {
          $($tabId).show();

          $('.tabbed-content').not($tabId).hide();
      } else {
          var $tabClass = '.' + $tabId.substr(1);

          $('.tabbed-element' + $tabClass).show();
          $('.tabbed-element').not($tabClass).hide();
      }

      return false;
  });

  //------- Select to inject content to text input

  $('.select-inject').on('change', function () {
      var $this = $(this),
          $selectedOption = $this.find('option:selected'),
          $thisOptionText = $selectedOption.text(),
          $theInput = $this.closest('.form-group').find('.select-injected'),
          $selectedVal = $selectedOption.val();

      $theInput.val($thisOptionText);

      $('.selfServe').each(function() {
        if($(this).prop('id') == $selectedVal) {
          $(this).show();
          $('.selfServe').not($(this)).hide();
        }
      });

      if($('#' + $selectedVal).length == 0) {
        $('.selfServe').hide();
      }

      if ($selectedVal == "noSelect") {
          $theInput.val("");
      }

      $theInput.focusout();
  });

  //------- Password meter

  if($('.new-password').length) {
    var minChars = 9,
        upperCase = new RegExp('[A-Z]'),
        lowerCase = new RegExp('[a-z]'),
        numbers = new RegExp('[0-9]'),
        passInput = $(".new-password");

    passInput.after('
Password validation:
');

    passInput.keyup(function () {
      var passVal = $(this).val(),
          passMeter = $("#pass_meter");

      passMeter.removeClass();

      if(passVal.length < minChars) {
        passMeter.addClass('strength-weak').text('Must be at least ' + minChars + ' characters');
      } else {
        if(!passVal.match(upperCase) && !passVal.match(lowerCase) && !passVal.match(numbers)) {
          passMeter.addClass('strength-weak').text('Requires upper and lowercase letters and at least one number');
        }
        if(passVal.match(upperCase) && !passVal.match(lowerCase) && !passVal.match(numbers)) {
          passMeter.addClass('strength-weak').text('Requires lowercase letters and at least one number');
        }
        if(!passVal.match(upperCase) && passVal.match(lowerCase) && !passVal.match(numbers)) {
          passMeter.addClass('strength-weak').text('Requires uppercase letters and at least one number');
        }
        if(!passVal.match(upperCase) && !passVal.match(lowerCase) && passVal.match(numbers)) {
          passMeter.addClass('strength-weak').text('Requires upper and lowercase letters');
        }
        if(!passVal.match(upperCase) && passVal.match(lowerCase) && passVal.match(numbers)) {
          passMeter.addClass('strength-weak').text('Requires uppercase letters');
        }
        if(passVal.match(upperCase) && passVal.match(lowerCase) && !passVal.match(numbers)) {
          passMeter.addClass('strength-weak').text('Requires at least one number');
        }
        if(passVal.match(upperCase) && passVal.match(lowerCase) && passVal.match(numbers)) {
          passMeter.addClass('strength-strong').text('Your password is valid');
        }
      }

    });
  }

  //------- Inline details toggle

  $('.summary-style').on('click', function() {
    $this = $(this);

    $this.toggleClass('open');

    $this.next('.detail-content').toggle();
  });

  // if($('html').hasClass('no-touch')) {
  //   $('.chosen-select').chosen({width: '100%'});
  // } else {
  //   $('.chosen-select').each(function() {
  //     $(this).find('.placeholder-option').text('Select an option')
  //   });
  // }

});


text:
#ifdef SHOULD_COMPILE_LOOKIN_SERVER

//
//  LKS_EventHandlerMaker.h
//  LookinServer
//
//  Created by Li Kai on 2019/8/7.
//  https://lookin.work
//

#import "LookinDefines.h"

@class LookinEventHandler;

@interface LKS_EventHandlerMaker : NSObject

+ (NSArray<LookinEventHandler *> *)makeForView:(UIView *)view;

@end

#endif /* SHOULD_COMPILE_LOOKIN_SERVER */

redpajama_set_name: RedPajamaGithub


text:
C $Header$
C $Name$

C CPP options file for atm_common package
C Use this file for selecting CPP options within the atm_common package

#ifndef ATM_COMMON_OPTIONS_H
#define ATM_COMMON_OPTIONS_H
#include "PACKAGES_CONFIG.h"
#include "CPP_OPTIONS.h"

#ifdef ALLOW_ATM_COMMON
C     Package-specific Options & Macros go here

#endif /* ALLOW_ATM_COMMON */
#endif /* ATM_COMMON_OPTIONS_H */


text:
using namespace cpp_monad;

template <typename T_Coll>
auto printAll(const T_Coll& src, const std::string& title) {
	std::cout << "Printing " << title << std::endl;
	for (const auto& x : src) {
		std::cout << "  elem: " << x << std::endl;
	}
};

int main() {

	const std::vector<int> src = { 1, 2, 3 };

	// Free function use
	auto squares = map(src, [](int x) {return x*x;});
	auto largerThan1 = filter(src, [](int x) {return x > 1;});
	auto strings = map(src, [](int x) {return std::to_string(x);});
	std::vector<std::vector<int>> intLists{src};
	std::vector<std::vector<int>> mapped = map(src, [](int x) { return std::vector<int>{1,2,3};} );
	std::vector<int> flatMapped = flatMap(src, [](int x) { return std::vector<int>{1,2,3};} );
	std::vector<int> flattened = flatten(mapped);

	// Monadic use
	Monadic<std::vector<int>> m(src);
	auto mMapped = m.map([](int x) {return x*x; });
	auto mFiltered = m.filter([](int x) {return x > 1; });
	auto funList =
		monadic(src)
			.map([](int x) { return std::vector<int>{1,2,3};} )
			.flatten()
			.filter([](int x) { return x > 1; })
			.map([](int x) { return std::to_string(x).append("_string"); })
			.col;

	printAll(src, "src");
	printAll(largerThan1, "largerThan1");
	printAll(strings, "strings");
	printAll(squares, "squares");
	printAll(mMapped.col, "mMapped");
	printAll(funList, "funList");

	return 0;
}


text:
// MESSAGE LOCAL_POSITION_NED PACKING

#define MAVLINK_MSG_ID_LOCAL_POSITION_NED 32

typedef struct __mavlink_local_position_ned_t
{
 uint32_t time_boot_ms; /*< Timestamp (milliseconds since system boot)*/
 float x; /*< X Position*/
 float y; /*< Y Position*/
 float z; /*< Z Position*/
 float vx; /*< X Speed*/
 float vy; /*< Y Speed*/
 float vz; /*< Z Speed*/
} mavlink_local_position_ned_t;

#define MAVLINK_MSG_ID_LOCAL_POSITION_NED_LEN 28
#define MAVLINK_MSG_ID_32_LEN 28

#define MAVLINK_MSG_ID_LOCAL_POSITION_NED_CRC 185
#define MAVLINK_MSG_ID_32_CRC 185

#define MAVLINK_MESSAGE_INFO_LOCAL_POSITION_NED { \
	"LOCAL_POSITION_NED", \
	7, \
	{  { "time_boot_ms", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_local_position_ned_t, time_boot_ms) }, \
         { "x", NULL, MAVLINK_TYPE_FLOAT, 0, 4, offsetof(mavlink_local_position_ned_t, x) }, \
         { "y", NULL, MAVLINK_TYPE_FLOAT, 0, 8, offsetof(mavlink_local_position_ned_t, y) }, \
         { "z", NULL, MAVLINK_TYPE_FLOAT, 0, 12, offsetof(mavlink_local_position_ned_t, z) }, \
         { "vx", NULL, MAVLINK_TYPE_FLOAT, 0, 16, offsetof(mavlink_local_position_ned_t, vx) }, \
         { "vy", NULL, MAVLINK_TYPE_FLOAT, 0, 20, offsetof(mavlink_local_position_ned_t, vy) }, \
         { "vz", NULL, MAVLINK_TYPE_FLOAT, 0, 24, offsetof(mavlink_local_position_ned_t, vz) }, \
         } \
}

/**
 * @brief Pack a local_position_ned message
 * @param system_id ID of this system
 * @param component_id ID of this component (e.g. 200 for IMU)
 * @param msg The MAVLink message to compress the data into
 *
 * @param time_boot_ms Timestamp (milliseconds since system boot)
 * @param x X Position
 * @param y Y Position
 * @param z Z Position
 * @param vx X Speed
 * @param vy Y Speed
 * @param vz Z Speed
 * @return length of the message in bytes (excluding serial stream start sign)
 */
static inline uint16_t mavlink_msg_local_position_ned_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
						       uint32_t time_boot_ms, float x, float y, float z, float vx, float vy, float vz)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
	char buf[MAVLINK_MSG_ID_LOCAL_POSITION_NED_LEN];
	_mav_put_uint32_t(buf, 0, time_boot_ms);
	_mav_put_float(buf, 4, x);
	_mav_put_float(buf, 8, y);
	_mav_put_float(buf, 12, z);
	_mav_put_float(buf, 16, vx);
	_mav_put_float(buf, 20, vy);
	_mav_put_float(buf, 24, vz);

        memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_LOCAL_POSITION_NED_LEN);
#else
	mavlink_local_position_ned_t packet;
	packet.time_boot_ms = time_boot_ms;
	packet.x = x;
	packet.y = y;
	packet.z = z;
	packet.vx = vx;
	packet.vy = vy;
	packet.vz = vz;

        memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_LOCAL_POSITION_NED_LEN);
#endif

	msg->msgid = MAVLINK_MSG_ID_LOCAL_POSITION_NED;
#if MAVLINK_CRC_EXTRA
    return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_LOCAL_POSITION_NED_LEN, MAVLINK_MSG_ID_LOCAL_POSITION_NED_CRC);
#else
    return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_LOCAL_POSITION_NED_LEN);
#endif
}

/**
 * @brief Pack a local_position_ned message on a channel
 * @param system_id ID of this system
 * @param component_id ID of this component (e.g. 200 for IMU)
 * @param chan The MAVLink channel this message will be sent over
 * @param msg The MAVLink message to compress the data into
 * @param time_boot_ms Timestamp (milliseconds since system boot)
 * @param x X Position
 * @param y Y Position
 * @param z Z Position
 * @param vx X Speed
 * @param vy Y Speed
 * @param vz Z Speed
 * @return length of the message in bytes (excluding serial stream start sign)
 */
static inline uint16_t mavlink_msg_local_position_ned_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
							   mavlink_message_t* msg,
						           uint32_t time_boot_ms,float x,float y,float z,float vx,float vy,float vz)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
	char buf[MAVLINK_MSG_ID_LOCAL_POSITION_NED_LEN];
	_mav_put_uint32_t(buf, 0, time_boot_ms);
	_mav_put_float(buf, 4, x);
	_mav_put_float(buf, 8, y);
	_mav_put_float(buf, 12, z);
	_mav_put_float(buf, 16, vx);
	_mav_put_float(buf, 20, vy);
	_mav_put_float(buf, 24, vz);

        memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_LOCAL_POSITION_NED_LEN);
#else
	mavlink_local_position_ned_t packet;
	packet.time_boot_ms = time_boot_ms;
	packet.x = x;
	packet.y = y;
	packet.z = z;
	packet.vx = vx;
	packet.vy = vy;
	packet.vz = vz;

        memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_LOCAL_POSITION_NED_LEN);
#endif

	msg->msgid = MAVLINK_MSG_ID_LOCAL_POSITION_NED;
#if MAVLINK_CRC_EXTRA
    return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_LOCAL_POSITION_NED_LEN, MAVLINK_MSG_ID_LOCAL_POSITION_NED_CRC);
#else
    return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_LOCAL_POSITION_NED_LEN);
#endif
}

/**
 * @brief Encode a local_position_ned struct
 *
 * @param system_id ID of this system
 * @param component_id ID of this component (e.g. 200 for IMU)
 * @param msg The MAVLink message to compress the data into
 * @param local_position_ned C-struct to read the message contents from
 */
static inline uint16_t mavlink_msg_local_position_ned_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_local_position_ned_t* local_position_ned)
{
	return mavlink_msg_local_position_ned_pack(system_id, component_id, msg, local_position_ned->time_boot_ms, local_position_ned->x, local_position_ned->y, local_position_ned->z, local_position_ned->vx, local_position_ned->vy, local_position_ned->vz);
}

/**
 * @brief Encode a local_position_ned struct on a channel
 *
 * @param system_id ID of this system
 * @param component_id ID of this component (e.g. 200 for IMU)
 * @param chan The MAVLink channel this message will be sent over
 * @param msg The MAVLink message to compress the data into
 * @param local_position_ned C-struct to read the message contents from
 */
static inline uint16_t mavlink_msg_local_position_ned_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_local_position_ned_t* local_position_ned)
{
	return mavlink_msg_local_position_ned_pack_chan(system_id, component_id, chan, msg, local_position_ned->time_boot_ms, local_position_ned->x, local_position_ned->y, local_position_ned->z, local_position_ned->vx, local_position_ned->vy, local_position_ned->vz);
}

/**
 * @brief Send a local_position_ned message
 * @param chan MAVLink channel to send the message
 *
 * @param time_boot_ms Timestamp (milliseconds since system boot)
 * @param x X Position
 * @param y Y Position
 * @param z Z Position
 * @param vx X Speed
 * @param vy Y Speed
 * @param vz Z Speed
 */
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS

static inline void mavlink_msg_local_position_ned_send(mavlink_channel_t chan, uint32_t time_boot_ms, float x, float y, float z, float vx, float vy, float vz)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
	char buf[MAVLINK_MSG_ID_LOCAL_POSITION_NED_LEN];
	_mav_put_uint32_t(buf, 0, time_boot_ms);
	_mav_put_float(buf, 4, x);
	_mav_put_float(buf, 8, y);
	_mav_put_float(buf, 12, z);
	_mav_put_float(buf, 16, vx);
	_mav_put_float(buf, 20, vy);
	_mav_put_float(buf, 24, vz);

#if MAVLINK_CRC_EXTRA
    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LOCAL_POSITION_NED, buf, MAVLINK_MSG_ID_LOCAL_POSITION_NED_LEN, MAVLINK_MSG_ID_LOCAL_POSITION_NED_CRC);
#else
    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LOCAL_POSITION_NED, buf, MAVLINK_MSG_ID_LOCAL_POSITION_NED_LEN);
#endif
#else
	mavlink_local_position_ned_t packet;
	packet.time_boot_ms = time_boot_ms;
	packet.x = x;
	packet.y = y;
	packet.z = z;
	packet.vx = vx;
	packet.vy = vy;
	packet.vz = vz;

#if MAVLINK_CRC_EXTRA
    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LOCAL_POSITION_NED, (const char *)&packet, MAVLINK_MSG_ID_LOCAL_POSITION_NED_LEN, MAVLINK_MSG_ID_LOCAL_POSITION_NED_CRC);
#else
    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LOCAL_POSITION_NED, (const char *)&packet, MAVLINK_MSG_ID_LOCAL_POSITION_NED_LEN);
#endif
#endif
}

#if MAVLINK_MSG_ID_LOCAL_POSITION_NED_LEN <= MAVLINK_MAX_PAYLOAD_LEN
/*
  This varient of _send() can be used to save stack space by re-using
  memory from the receive buffer.  The caller provides a
  mavlink_message_t which is the size of a full mavlink message. This
  is usually the receive buffer for the channel, and allows a reply to an
  incoming message with minimum stack space usage.
 */
static inline void mavlink_msg_local_position_ned_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan,  uint32_t time_boot_ms, float x, float y, float z, float vx, float vy, float vz)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
	char *buf = (char *)msgbuf;
	_mav_put_uint32_t(buf, 0, time_boot_ms);
	_mav_put_float(buf, 4, x);
	_mav_put_float(buf, 8, y);
	_mav_put_float(buf, 12, z);
	_mav_put_float(buf, 16, vx);
	_mav_put_float(buf, 20, vy);
	_mav_put_float(buf, 24, vz);

#if MAVLINK_CRC_EXTRA
    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LOCAL_POSITION_NED, buf, MAVLINK_MSG_ID_LOCAL_POSITION_NED_LEN, MAVLINK_MSG_ID_LOCAL_POSITION_NED_CRC);
#else
    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LOCAL_POSITION_NED, buf, MAVLINK_MSG_ID_LOCAL_POSITION_NED_LEN);
#endif
#else
	mavlink_local_position_ned_t *packet = (mavlink_local_position_ned_t *)msgbuf;
	packet->time_boot_ms = time_boot_ms;
	packet->x = x;
	packet->y = y;
	packet->z = z;
	packet->vx = vx;
	packet->vy = vy;
	packet->vz = vz;

#if MAVLINK_CRC_EXTRA
    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LOCAL_POSITION_NED, (const char *)packet, MAVLINK_MSG_ID_LOCAL_POSITION_NED_LEN, MAVLINK_MSG_ID_LOCAL_POSITION_NED_CRC);
#else
    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_LOCAL_POSITION_NED, (const char *)packet, MAVLINK_MSG_ID_LOCAL_POSITION_NED_LEN);
#endif
#endif
}
#endif

#endif

// MESSAGE LOCAL_POSITION_NED UNPACKING

/**
 * @brief Get field time_boot_ms from local_position_ned message
 *
 * @return Timestamp (milliseconds since system boot)
 */
static inline uint32_t mavlink_msg_local_position_ned_get_time_boot_ms(const mavlink_message_t* msg)
{
	return _MAV_RETURN_uint32_t(msg,  0);
}

/**
 * @brief Get field x from local_position_ned message
 *
 * @return X Position
 */
static inline float mavlink_msg_local_position_ned_get_x(const mavlink_message_t* msg)
{
	return _MAV_RETURN_float(msg,  4);
}

/**
 * @brief Get field y from local_position_ned message
 *
 * @return Y Position
 */
static inline float mavlink_msg_local_position_ned_get_y(const mavlink_message_t* msg)
{
	return _MAV_RETURN_float(msg,  8);
}

/**
 * @brief Get field z from local_position_ned message
 *
 * @return Z Position
 */
static inline float mavlink_msg_local_position_ned_get_z(const mavlink_message_t* msg)
{
	return _MAV_RETURN_float(msg,  12);
}

/**
 * @brief Get field vx from local_position_ned message
 *
 * @return X Speed
 */
static inline float mavlink_msg_local_position_ned_get_vx(const mavlink_message_t* msg)
{
	return _MAV_RETURN_float(msg,  16);
}

/**
 * @brief Get field vy from local_position_ned message
 *
 * @return Y Speed
 */
static inline float mavlink_msg_local_position_ned_get_vy(const mavlink_message_t* msg)
{
	return _MAV_RETURN_float(msg,  20);
}

/**
 * @brief Get field vz from local_position_ned message
 *
 * @return Z Speed
 */
static inline float mavlink_msg_local_position_ned_get_vz(const mavlink_message_t* msg)
{
	return _MAV_RETURN_float(msg,  24);
}

/**
 * @brief Decode a local_position_ned message into a struct
 *
 * @param msg The message to decode
 * @param local_position_ned C-struct to decode the message contents into
 */
static inline void mavlink_msg_local_position_ned_decode(const mavlink_message_t* msg, mavlink_local_position_ned_t* local_position_ned)
{
#if MAVLINK_NEED_BYTE_SWAP
	local_position_ned->time_boot_ms = mavlink_msg_local_position_ned_get_time_boot_ms(msg);
	local_position_ned->x = mavlink_msg_local_position_ned_get_x(msg);
	local_position_ned->y = mavlink_msg_local_position_ned_get_y(msg);
	local_position_ned->z = mavlink_msg_local_position_ned_get_z(msg);
	local_position_ned->vx = mavlink_msg_local_position_ned_get_vx(msg);
	local_position_ned->vy = mavlink_msg_local_position_ned_get_vy(msg);
	local_position_ned->vz = mavlink_msg_local_position_ned_get_vz(msg);
#else
	memcpy(local_position_ned, _MAV_PAYLOAD(msg), MAVLINK_MSG_ID_LOCAL_POSITION_NED_LEN);
#endif
}


text:
import json
import logging
import uuid

# logger used for internal pyflow logging
logger = logging.getLogger('pyflow')

def encode_task_input(input_obj):
    return json.dumps(input_obj)

def decode_task_result(result_str):
    if result_str is None:
        return None
    else:
        return json.loads(result_str)

def iter_collection(paginator, items_key):
    for page in paginator:
        for item in page[items_key]:
            yield item

def list_domains(swf):
    paginator = swf.get_paginator('list_domains')
    return iter_collection(
        paginator.paginate(registrationStatus='REGISTERED'), 'domainInfos')

def list_workflow_types(swf, domain):
    paginator = swf.get_paginator('list_workflow_types')
    return iter_collection(
        paginator.paginate(domain=domain, registrationStatus='REGISTERED'),
        'typeInfos')

def list_activity_types(swf, domain):
    paginator = swf.get_paginator('list_activity_types')
    return iter_collection(
        paginator.paginate(domain=domain, registrationStatus='REGISTERED'),
        'typeInfos')

def list_workflow_history(swf, domain, workflow_id, run_id, reverse=False):
    paginator = swf.get_paginator('get_workflow_execution_history')
    return iter_collection(
        paginator.paginate(domain=domain, execution={'workflowId': workflow_id, 'runId': run_id}, reverseOrder=reverse),
        'events')

def poll_for_decision_tasks(swf, domain, task_list, identity):
    paginator = swf.get_paginator('poll_for_decision_task')
    result = None
    for page in paginator.paginate(domain=domain, taskList={'name': task_list},
                                   identity=identity):
        if result is None:
            result = page
        else:
            result['events'].extend(page['events'])
    return result

def poll_for_activity_tasks(swf, domain, task_list, identity):
    return swf.poll_for_activity_task(domain=domain,
                                      taskList={'name': task_list},
                                      identity=identity)

def schedule_activity_task(swf, task, task_list, activity_type, **options):
    attribs = {'activityType': activity_type,
               'activityId': 'activityId-' + str(uuid.uuid4()),
               'taskList': {'name': task_list}}
    attribs.update(options)

    swf.respond_decision_task_completed(
        taskToken=task['taskToken'],
        decisions=[
            {
                'decisionType': 'ScheduleActivityTask',
                'scheduleActivityTaskDecisionAttributes': attribs
            }
        ])

def init_domain(swf):
    """
    :param swf: boto3 SWF client
    :return: domain name for this project
    """
    domain_name = 'SWFSampleDomain'

    # see if domain already exists.  If not, register it.
    for d in list_domains(swf):
        if d['name'] == domain_name:
            break
    else:
        swf.register_domain(name=domain_name,
                            description='{} domain'.format(domain_name),
                            workflowExecutionRetentionPeriodInDays='1')
    return domain_name


text:
using stdext::hash_map;
#else // !WIN32
//hash_map is deprecated with new GCC, see webpage:
// http://fgda.pl/post/7/gcc-hash-map-vs-unordered-map
#define GCC_VERSION (__GNUC__ * 10000 \
    + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)

#if GCC_VERSION >= 40300
#include <tr1/unordered_map>
#define hash_map std::tr1::unordered_map
#else
#include <ext/hash_map>
#define hash_map __gnu_cxx::hash_map

using namespace __gnu_cxx;

namespace __gnu_cxx
{
  template<> struct hash<long long> {
    size_t operator()(long long __x) const { return __x; }
  };
  template<> struct hash<const long long> {
    size_t operator()(const long long __x) const { return __x; }
  };

  template<> struct hash<unsigned long long> {
    size_t operator()(unsigned long long __x) const { return __x; }
  };
  template<> struct hash<const unsigned long long> {
    size_t operator()(const unsigned long long __x) const { return __x; }
  };
}

#endif //GCC_VERSION

#endif // WIN32
#endif // HASH_INCLUDED


text:
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.ether;

import com.intellij.openapi.projectRoots.JavaSdkVersion;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.SystemInfo;
import org.jetbrains.jps.ModuleChunk;
import org.jetbrains.jps.ProjectPaths;
import org.jetbrains.jps.builders.BuildResult;
import org.jetbrains.jps.builders.CompileScopeTestBuilder;
import org.jetbrains.jps.builders.java.JavaModuleBuildTargetType;
import org.jetbrains.jps.incremental.ModuleBuildTarget;
import org.jetbrains.jps.incremental.java.ModulePathSplitter;
import org.jetbrains.jps.javac.ModulePath;
import org.jetbrains.jps.model.JpsModuleRootModificationUtil;
import org.jetbrains.jps.model.java.JpsJavaDependencyScope;
import org.jetbrains.jps.model.java.JpsJavaExtensionService;
import org.jetbrains.jps.model.library.JpsLibrary;
import org.jetbrains.jps.model.module.JpsModule;

import java.io.File;
import java.util.Collection;
import java.util.Collections;
import java.util.Map;

/**
 * @author Eugene Zhuravlev
 */
public class Java9Test extends IncrementalTestCase {

  public Java9Test() {
    super("java9-features");
  }

  @Override
  protected boolean shouldRunTest() {
    // java9 is not supported anymore and javac9 contains some problems that are already fixed in java10+
    // It is expected that for JPMS-related features javac10 or better will be used
    final JavaSdkVersion sdkVersion = JavaSdkVersion.fromVersionString(SystemInfo.JAVA_VERSION);
    if (sdkVersion == null || !sdkVersion.isAtLeast(JavaSdkVersion.JDK_10)) {
      System.out.println("Test '" + getTestName(false) + "' skipped because it requires at least java 10 runtime");
      return false;
    }
    return super.shouldRunTest();
  }

  @Override
  protected BuildResult doTestBuild(int makesCount) {
    setupModules();
    return super.doTestBuild(makesCount);
  }

  public void testModuleInfoAdded() {
    // expected result: the whole target is recompiled after the module-info.java file was newly added
    // because necessary 'require' directives may be missing from the newly added module-info file
    final BuildResult buildResult = doTest();
    buildResult.assertSuccessful();
  }

  public void testRemoveModuleRequires() {
    final BuildResult buildResult = doTest();
    buildResult.assertFailed();
  }

  public void testRemoveTransitiveModuleRequires() {
    final BuildResult buildResult = doTest();
    buildResult.assertFailed();
  }

  public void testChangeTransitiveModuleRequires() {
    final BuildResult buildResult = doTest();
    buildResult.assertFailed();
  }

  public void testChangeQualifiedTransitiveModuleRequires() {
    final BuildResult buildResult = doTest();
    buildResult.assertSuccessful();
  }

  public void testRemoveModuleExports() {
    final BuildResult buildResult = doTest();
    buildResult.assertSuccessful();
  }

  public void testRemoveTransitiveModuleExports() {
    final BuildResult buildResult = doTest();
    buildResult.assertFailed();
  }

  public void testRemoveQualifiedModuleExports() {
    final BuildResult buildResult = doTest();
    buildResult.assertSuccessful();
  }

  public void testRemoveQualifiedTransitiveModuleExports() {
    final BuildResult buildResult = doTest();
    buildResult.assertFailed();
  }

  public void testChangeQualifiedTransitiveModuleExportsNoRebuild() {
    final BuildResult buildResult = doTest();
    buildResult.assertSuccessful();
  }

  public void testChangeQualifiedTransitiveModuleExportsRebuildIndirectDeps() {
    final BuildResult buildResult = doTest();
    buildResult.assertFailed();
  }

  public void testChangeQualifiedTransitiveModuleExportsRebuildDirectDeps() {
    final BuildResult buildResult = doTest();
    buildResult.assertSuccessful();
  }

  public void testIntegrateAfterErrors() {
    setupInitialProject();
    setupModules();

    doBuild(CompileScopeTestBuilder.rebuild().allModules()).assertFailed();
    modify(0);
    doBuild(CompileScopeTestBuilder.make().allModules()).assertSuccessful();
    modify(1);
    doBuild(CompileScopeTestBuilder.make().allModules()).assertFailed();
  }

  public void testSplitModulePath() {
    setupInitialProject();
    final Map<String, JpsModule> modules = setupModules();

    assertEquals(1, modules.size());

    final JpsModule module = modules.values().iterator().next();
    final ModuleBuildTarget target = new ModuleBuildTarget(module, JavaModuleBuildTargetType.PRODUCTION);

    final File outputDir = target.getOutputDir();
    final File libDir = new File(getAbsolutePath("lib"));
    for (File jarFile : libDir.listFiles((dir, name) -> name.endsWith(".jar"))) {
      JpsLibrary lib = addLibrary(jarFile.getName(), jarFile);
      JpsModuleRootModificationUtil.addDependency(module, lib, JpsJavaDependencyScope.COMPILE, false);
    }

    final File moduleInfoPath = new File(getAbsolutePath("moduleA/src/module-info.java"));

    final ModulePathSplitter splitter = new ModulePathSplitter();
    final Collection<File> dependencies = ProjectPaths.getCompilationModulePath(new ModuleChunk(Collections.singleton(target)), false);
    final Pair<ModulePath, Collection<File>> split = splitter.splitPath(moduleInfoPath, Collections.singleton(outputDir), dependencies);
    final ModulePath modulePath = split.first;
    final Collection<File> classpath = split.second;

    final Collection<? extends File> modPath = modulePath.getPath();
    assertEquals(4, modPath.size());
    assertTrue(modPath.contains(outputDir));
    assertTrue(modPath.contains(new File(libDir, "module_lib_1.jar")));
    assertTrue(modPath.contains(new File(libDir, "module_lib_2.jar")));
    assertTrue(modPath.contains(new File(libDir, "module_lib_util.jar")));

    assertEquals(1, classpath.size());
    assertTrue(classpath.contains(new File(libDir, "module_lib_3.jar")));
  }

  public void testExplodedAutoModule() {
    setupInitialProject();
    final Map<String, JpsModule> modules = setupModules();
    assertEquals(2, modules.size());
    assertTrue(modules.containsKey("A"));
    assertTrue(modules.containsKey("B"));

    doBuild(CompileScopeTestBuilder.rebuild().allModules()).assertSuccessful();
  }

  public void testExplodedAutoModuleWithManifest() {
    setupInitialProject();
    final Map<String, JpsModule> modules = setupModules();
    JpsJavaExtensionService.getInstance().getCompilerConfiguration(myProject).addResourcePattern("*.MF");

    assertEquals(2, modules.size());
    assertTrue(modules.containsKey("A"));
    assertTrue(modules.containsKey("B"));

    doBuild(CompileScopeTestBuilder.rebuild().allModules()).assertSuccessful();
  }
}


text:
ACCEPTED

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

#### Published in
Trans. Br. mycol. Soc. 69(1): 21 (1977)

#### Original name
Gaeumannomyces cylindrosporus D. Hornby, Slope, Gutter. & Sivan., 1977

### Remarks
null


text:
package org.pentaho.di.job.entries.sql;

import static java.util.Arrays.asList;

import java.util.List;
import java.util.Map;

import org.pentaho.di.job.entry.loadSave.JobEntryLoadSaveTestSupport;

public class JobEntrySQLTest extends JobEntryLoadSaveTestSupport<JobEntrySQL> {

  @Override
  protected Class<JobEntrySQL> getJobEntryClass() {
    return JobEntrySQL.class;
  }

  @Override
  protected List<String> listCommonAttributes() {
    return asList(
        "sql",
        "useVariableSubstitution",
        "sqlfromfile",
        "sqlfilename",
        "sendOneStatement" );
  }

  @Override
  protected Map<String, String> createGettersMap() {
    return toMap(
        "sql", "getSQL",
        "useVariableSubstitution", "getUseVariableSubstitution",
        "sqlfromfile", "getSQLFromFile",
        "sqlfilename", "getSQLFilename",
        "sendOneStatement", "isSendOneStatement" );
  }

  @Override
  protected Map<String, String> createSettersMap() {
    return toMap(
        "sql", "setSQL",
        "useVariableSubstitution", "setUseVariableSubstitution",
        "sqlfromfile", "setSQLFromFile",
        "sqlfilename", "setSQLFilename",
        "sendOneStatement", "setSendOneStatement" );
  }

}


text:
from BridgePython import serializer, reference

class Client(object):
    def __init__(self, bridge, id):
        self.bridge, self.clientId = bridge, id;
    def get_service(self, svc):
        return reference.Reference(self.bridge, ['client', self.clientId, svc])


text:
<!DOCTYPE html>

        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <title>Animation component - UIkit documentation</title>
        <link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon">
        <link rel="apple-touch-icon-precomposed" href="images/apple-touch-icon.png">
        <link id="data-uikit-theme" rel="stylesheet" href="css/uikit.docs.min.css">
        <link rel="stylesheet" href="css/docs.css">
        <link rel="stylesheet" href="../vendor/highlight/highlight.css">

Get Started

Core

Components

Customizer

Showcase

Tutorials

UIkit 3

Defaults

Base

Print

Layout

Grid

Panel

Block

Article

Comment

Utility

Flex

Cover

Navigations

Nav

Navbar

Subnav

Breadcrumb

Pagination

Tab

Thumbnav

Elements

List

Description list

Table

Form

Common

Button

Icon

Close

Badge

Alert

Thumbnail

Overlay

Text

Column

Animation

Contrast

JavaScript

Dropdown

Modal

Off-canvas

Switcher

Toggle

Scrollspy

Smooth scroll

Animation

A basic collection of smooth animations to use within your page.

Usage

To apply this component, add any .uk-animation-* class to an element and it will fade in with a nice animation. These classes are commonly set by using JavaScript to apply the animation to specific behaviors.

                                            Class
                                            Description

                                            .uk-animation-fade
                                            The element fades in.

                                            .uk-animation-scale-up
                                            The element scales up.

                                            .uk-animation-scale-down
                                            The element scales down.

                                            .uk-animation-slide-top
                                            The element slides in from the top.

                                            .uk-animation-slide-bottom
                                            The element slides in from the bottom.

                                            .uk-animation-slide-left
                                            The element slides in from the left.

                                            .uk-animation-slide-right
                                            The element slides in from the right.

                                            .uk-animation-shake
                                            The element shakes.

                                            .uk-animation-scale
                                            The element scales down without fading in.

Example

Hover over any of the boxes to see the animation.

 div > .uk-panel'}" data-uk-grid-margin>

Fade

Scale up

Scale down

Shake

 div > .uk-panel'}" data-uk-grid-margin>

Slide top

Slide bottom

Slide left

Slide right

 div > .uk-panel'}" data-uk-grid-margin>

Scale

Markup

<div class="uk-animation-fade">...</div>

Reverse modifier

By default, all aimations are incoming. To reverse any animation, add the .uk-animation-reverse class.

Example

Hover over any of the boxes to see the animation.

 div > .uk-panel'}" data-uk-grid-margin>

Fade

Scale up

Scale down

Shake

 div > .uk-panel'}" data-uk-grid-margin>

Slide top

Slide bottom

Slide left

Slide right

 div > .uk-panel'}" data-uk-grid-margin>

Scale

Markup

<div class="uk-animation-fade uk-animation-reverse">...</div>

Duration modifier

To stretch the animation duration to 15 seconds, add the .uk-animation-15 class.

Example

Slide right

Markup

<div class="uk-animation-slide-right uk-animation-15">...</div>

Origin modifier

By default, scaling animations originate from the center. To modify this behavior, add one of these classes.

                                            Class
                                            Description

                                            .uk-animation-top-left
                                            The animation spreads from the top left.

                                            .uk-animation-top-center
                                            The animation spreads from the top center.

                                            .uk-animation-top-right
                                            The animation spreads from the top right.

                                            .uk-animation-middle-left
                                            The animation spreads from the middle left.

                                            .uk-animation-middle-right
                                            The animation spreads from the middle right.

                                            .uk-animation-bottom-left
                                            The animation spreads from the bottom left.

                                            .uk-animation-bottom-center
                                            The animation spreads from the bottom center.

                                            .uk-animation-bottom-right
                                            The animation spreads from the bottom right.

Example

Hover over any of the boxes to see the animation.

 div > .uk-panel'}" data-uk-grid-margin>

Top Left

Top Center

Top Right

Middle Left

 div > .uk-panel'}" data-uk-grid-margin>

Middle Right

Bottom Left

Bottom Center

Bottom Right

Animation hover

To trigger an animation on hover, just add the .uk-animation-hover class to the animated element itself or to a container.

Example

Fade

Slide right

Markup

<div class="uk-animation-hover uk-animation-fade">...</div>

<div class="uk-animation-hover">
    <div class="uk-animation-slide-right">...</div>
</div>

GitHub

Issues

Changelog

Twitter

Made by YOOtheme with love and caffeine.
Licensed under MIT license.

Documentation

Get started

How to customize

Layout examples

Core

Components

Project structure

Less & Sass files

Create a theme

Create a style

Customizer.json

JavaScript

Custom prefix

Core

 Defaults

Base

Print

 Layout

Grid

Panel

Block

Article

Comment

Utility

Flex

Cover

 Navigations

Nav

Navbar

Subnav

Breadcrumb

Pagination

Tab

Thumbnav

 Elements

List

Description list

Table

Form

 Common

Button

Icon

Close

Badge

Alert

Thumbnail

Overlay

Text

Column

Animation

Contrast

 JavaScript

Dropdown

Modal

Off-canvas

Switcher

Toggle

Scrollspy

Smooth scroll

Components

 Layout

Dynamic Grid

Parallax Grid

 Navigations

Dotnav

Slidenav

Dynamic Pagination

 Common

Form advanced

Form file

Form password

Form select

Placeholder

Progress

 JavaScript

Lightbox

Autocomplete

Datepicker

HTML editor

Slider

Slideset

Slideshow

Parallax

Accordion

Notify

Search

Nestable

Sortable

Sticky

Timepicker

Tooltip

Upload

Showcase

Tutorials

UIkit 3


text:
<!DOCTYPE html>
<?=$head?>

                <?php echo $left; ?>

STUDENTS

                                              ID
                                              Name
                                              Roll Number
                                              Batch

                                          <?php foreach ($students as $key => $value) {?>

                                            <?php echo $value['id']; ?>
                                              <?php echo $value['name']; ?>
                                            <?php echo $value['roll_number']; ?>
                                            <?php
                                            foreach ($batches as $key => $batch) {
                                              if ($batch['id'] == $value['batch']){
                                                echo $batch['start_year']."-".$batch['end_year'];
                                              }
                                            }
                                          ?>

                                          <?php } ?>

<?=$foot?>


text:
import click
from tscli.restapi import ConsumeAPIs
from tscli.textoutput import TextOutputAPIs

@click.group()
def package():
    """Package related operations"""

@package.command()
@click.option(
    '--server-url', envvar='TRANSTATS_SERVER', help="Transtats Server URL")
@click.option(
    '--token', envvar='TOKEN', help="Transtats API token")
@click.option("--upstream-url", is_flag=False,
              help="source repository url like github or gitlab")
@click.option("--transplatform-slug", is_flag=False,
              help="platform slug like WLTEFED for fedora weblate")
@click.option("--release-stream", is_flag=False,
              help="product like fedora")
@click.option(
    '--json', is_flag=True, envvar='JSON_OUTPUT', help="Print in JSON format")
@click.argument('package_name')
@click.pass_obj
def add(app_context, server_url, token, package_name, upstream_url,
        transplatform_slug, release_stream, json):
    """Add a package to Transtats server."""
    api_obj = ConsumeAPIs(server_url or app_context.server_url) if json \
        else TextOutputAPIs(server_url or app_context.server_url)

    response = api_obj.add_package(package_name, upstream_url,
                                   transplatform_slug, release_stream)
    if isinstance(response, dict):
        app_context.print_r(response)

@package.command()
@click.option(
    '--server-url', envvar='TRANSTATS_SERVER', help="Transtats Server URL")
@click.option("--exist", is_flag=True,
              help="Determine if the package exist in Transtats or not.")
@click.option("--health", is_flag=True,
              help="Get package health")
@click.option(
    '--json', is_flag=True, envvar='JSON_OUTPUT', help="Print in JSON format")
@click.argument('package-name')
@click.pass_obj
def status(app_context, server_url, package_name, exist, health, json):
    """Translation status of a package.
       e.g. transtats package anaconda """
    api_obj = ConsumeAPIs(server_url or app_context.server_url) if json \
        else TextOutputAPIs(server_url or app_context.server_url)

    if exist:
        response = api_obj.package_status(package_name, exist=True, health=None)
    elif health:
        response = api_obj.package_status(package_name, exist=None, health=True)
    else:
        response = api_obj.package_status(package_name, exist=None, health=None)
    if isinstance(response, dict):
        app_context.print_r(response)


text:
			CV MAKER

		<form class="cvmaker--form" ng-submit="submitData()">
			<fieldset>
				<legend>Personal information</legend>

					First name:
					<input type="text" name="first-name" id="cvmaker--fname" ng-model="fname">

					Second name:
					<input type="text" name="second-name" id="cvmaker--sname" ng-model="sname">

					Last name:
					<input type="text" name="last-name" id="cvmaker--lname" ng-model="lname">

					Date of birth:
					<input type="date" name="birthday" id="cvmaker--birthday" ng-model="birthday">

					Address:
					<input type="text" name="address" id="cvmaker--address" ng-model="address">

					E-mail:
					<input type="email" name="e-mail" id="cvmaker--mail" ng-model="mail">

					Telephone number:
					<input type="tel" name="second-name" id="cvmaker--phone" ng-model="phone">

					<input type="submit" name="submit" value="Submit" id="submit">

			</fieldset>
		</form>


text:
interface IContext {
    someMethod();
}
class c1 {
    private _forEachBindingContext(bindingContext: IContext, fn: (bindingContext: IContext) => void);
    private _forEachBindingContext(bindingContextArray: Array<IContext>, fn: (bindingContext: IContext) => void);
    private _forEachBindingContext(context, fn: (bindingContext: IContext) => void): void {
        // Function here
    }

    private overloadWithArityDifference(bindingContext: IContext);
    private overloadWithArityDifference(bindingContextArray: Array<IContext>, fn: (bindingContext: IContext) => void);
    private overloadWithArityDifference(context): void {
        // Function here
    }
}
declare class c2 {
    private overload1(context, fn);

    private overload2(context);
    private overload2(context, fn);
}

//// [declFilePrivateMethodOverloads.js]
var c1 = (function () {
    function c1() {
    }
    c1.prototype._forEachBindingContext = function (context, fn) {
        // Function here
    };
    c1.prototype.overloadWithArityDifference = function (context) {
        // Function here
    };
    return c1;
})();

//// [declFilePrivateMethodOverloads.d.ts]
interface IContext {
    someMethod(): any;
}
declare class c1 {
    private _forEachBindingContext(bindingContext, fn);
    private _forEachBindingContext(bindingContextArray, fn);
    private overloadWithArityDifference(bindingContext);
    private overloadWithArityDifference(bindingContextArray, fn);
}
declare class c2 {
    private overload1(context, fn);
    private overload2(context);
    private overload2(context, fn);
}


text:
var parse = require('../parse/index.js')

/**
 * @category Common Helpers
 * @summary Compare the two dates and return -1, 0 or 1.
 *
 * @description
 * Compare the two dates and return 1 if the first date is after the second,
 * -1 if the first date is before the second or 0 if dates are equal.
 *
 * @param {Date|String|Number} dateLeft - the first date to compare
 * @param {Date|String|Number} dateRight - the second date to compare
 * @returns {Number} the result of the comparison
 *
 * @example
 * // Compare 11 February 1987 and 10 July 1989:
 * var result = compareAsc(
 *   new Date(1987, 1, 11),
 *   new Date(1989, 6, 10)
 * )
 * //=> -1
 *
 * @example
 * // Sort the array of dates:
 * var result = [
 *   new Date(1995, 6, 2),
 *   new Date(1987, 1, 11),
 *   new Date(1989, 6, 10)
 * ].sort(compareAsc)
 * //=> [
 * //   Wed Feb 11 1987 00:00:00,
 * //   Mon Jul 10 1989 00:00:00,
 * //   Sun Jul 02 1995 00:00:00
 * // ]
 */
function compareAsc (dirtyDateLeft, dirtyDateRight) {
  var dateLeft = parse(dirtyDateLeft)
  var timeLeft = dateLeft.getTime()
  var dateRight = parse(dirtyDateRight)
  var timeRight = dateRight.getTime()

  if (timeLeft < timeRight) {
    return -1
  } else if (timeLeft > timeRight) {
    return 1
  } else {
    return 0
  }
}

module.exports = compareAsc


text:
/**
 * ÎļþÃû£ºEx27.java
 * ÏîÄ¿-°ü£ºJAVA±à³Ì˼Ïë - µÚ¶þʮһÕ²¢·¢
 * ×÷ÕߣºÕÅÎĵÏ
 * ´´½¨ÈÕÆÚ£º2014-11-7
 */
package µÚ¶þʮһÕ²¢·¢;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

/**
 * @author ÕÅÎĵÏ
 * ÀàÃû£ºEx27
 * Àà˵Ã÷£º ÓÃÏÔʾµÄ lockºÍ Condition  ½øÐÐÏß³ÌÖ®¼äµÄЭ×÷£¡£¡£¡
 */
class Meal0{
	private final int orderNum;
	public Meal0(int orderNum) {this.orderNum = orderNum;}
	public String toString() {return "Meal " +orderNum;}
}
class WaitPerson0 implements Runnable{
	private Lock lock = new ReentrantLock();
	private Condition condition = lock.newCondition();
	private Restaurant27 restaurant ;
	public WaitPerson0(Restaurant27 r) {restaurant = r;}
	public void run(){
		try
		{
			while(!Thread.interrupted()){
				synchronized(this){
					while(restaurant.meal==null)
						condition.await();
				}
				System.out.println("Waitperson got" + restaurant.meal);
				lock.lock();
				try{
					condition.notifyAll();
				}finally{
					lock.unlock();
				}
				lock.lock();
				try{
					restaurant.meal = null;
					condition.notifyAll();
				}finally{
					lock.unlock();
				}

			}
		}
		catch (InterruptedException e)
		{
			System.out.println("WaitPerson interrupted");
		}
	}
}
class BusBoy0 implements Runnable
{
	private Lock lock = new ReentrantLock();
	private Condition condition = lock.newCondition();
	private Restaurant27 restaurant ;
	public BusBoy0(Restaurant27 r) {restaurant = r;}
	public void run(){
		try
		{
			while(!Thread.interrupted()){
				lock.lock();
				try{
					condition.await();
					System.out.println("ÇåÀíÁË~~~~~");
				}finally{
					lock.unlock();
				}
			}
		}
		catch (InterruptedException e)
		{
			System.out.println("boy interrupted");
		}
	}
}
class Chef0 implements Runnable{
	private Lock lock = new ReentrantLock();
	private Condition condition = lock.newCondition();
	private Restaurant27 restaurant ;
	private int count = 0;
	public Chef0(Restaurant27 r) {restaurant = r;}
	public void run(){
		try
		{
			while(!Thread.interrupted()){
				lock.lock();
				try{
					while(restaurant.meal != null)
						condition.await();
				}finally{
					lock.unlock();
				}
				if(++count == 10){
					System.out.println("out of food ,Closing");
					restaurant.exec.shutdownNow();
				}
				System.out.print("Order up!!!!!");
				lock.lock();
				try{
					restaurant.meal = new Meal0(count);
					condition.notifyAll();
				}finally{
					lock.unlock();
				}
				TimeUnit.MILLISECONDS.sleep(100);
				//24Ì⣺µ±ÈÎÎñÊÔͼ½øÈëÒ»¸ö×èÈû²Ù×÷ʱ£¬Õâ¸öÖжÏÖ»ÄÜ  Å׳ö  interruptedException¡£
				//ÒƳýsleep()ºó£¬ÈÎÎñ½«»Øµ½run()Ñ»·µÄ¶¥²¿£¬²¢ÇÒÓÉÓÚThread.interruped()²âÊÔ¶øÍ˳ö£¬²»Å׳öÒì³£~~~
			}
		}
		catch (InterruptedException e)
		{
			System.out.println("Chef interrupted");
		}
	}
}

public class Restaurant27
{
	Meal0 meal;
	ExecutorService exec = Executors.newCachedThreadPool();
	WaitPerson0 waitPerson = new WaitPerson0(this);
	Chef0 chef = new Chef0(this);
	BusBoy0 boy = new BusBoy0(this);   // thisµÄÓ÷¨£¬ ºÜÉñÆæ~~~
	public Restaurant27(){
		exec.execute(chef);
		exec.execute(waitPerson);
		exec.execute(boy);
	}
	public static void main(String[] args){
		new Restaurant2425();
	}
}


text:
// Warning: This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if the
// code is regenerated.

package com.microsoft.azure.management.compute.models;

/**
* Contains a Source Key Vault relative URL.
*/
public class SourceVaultReference extends ApiEntityReference {
}


text:
package com.silverforge.busyindicator;

import android.os.AsyncTask;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;

import com.silverforge.controls.BusyIndicator;

import java.util.Random;

public class TransFragment extends Fragment {
    private BusyIndicator transBusyIndicator;

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_trans, container, false);
        transBusyIndicator = (BusyIndicator) view.findViewById(R.id.finiteTransBusyIndicator);

        transBusyIndicator.setMaxValue(83);
        transBusyIndicator.setOnTouchListener(new View.OnTouchListener() {
            @Override
            public boolean onTouch(View v, MotionEvent event) {
                if (event.getAction() == MotionEvent.ACTION_DOWN) {
                    new FiniteTransparentBusyIndicatorAsync().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
                }
                return true;
            }
        });
        return view;
    }

    class FiniteTransparentBusyIndicatorAsync extends AsyncTask {
        @Override
        protected Object doInBackground(Object[] objects) {

            final Random rand = new Random();
            int i = 0;

            FragmentActivity activity = getActivity();

            while (i < 84) {
                final int a = i;
                activity.runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                    transBusyIndicator.setValue(a);
                    }
                });

                i = i + rand.nextInt(20) + 1;

                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }

            activity.runOnUiThread(new Runnable() {
                @Override
                public void run() {
                    transBusyIndicator.setValue(83);
                }
            });

            return null;
        }
    }
}


text:
- bug fix (#127) to fix loop when using provision(@firewall_rule)

## v1.0

- initial release, includes database server and firewall rule resource


text:
#ifndef HALIDE_VAR_H
#define HALIDE_VAR_H

/** \file
 * Defines the Var - the front-end variable
 */

#include "IR.h"

namespace Halide {

/** A Halide variable, to be used when defining functions. It is just
 * a name, and can be reused in places where no name conflict will
 * occur. It can be used in the left-hand-side of a function
 * definition, or as an Expr. As an Expr, it always has type
 * Int(32). */
class Var {
    std::string _name;
public:
    /** Construct a Var with the given name */
    EXPORT Var(const std::string &n);

    /** Construct a Var with an automatically-generated unique name. */
    EXPORT Var();

    /** Get the name of a Var */
    const std::string &name() const {return _name;}

    /** Test if two Vars are the same. This simply compares the names. */
    bool same_as(const Var &other) const {return _name == other._name;}

    /** Implicit var constructor. Implicit variables are injected
     * automatically into a function call if the number of arguments
     * to the function are fewer than its dimensionality and a
     * placeholder ("_") appears in its argument list. Defining a
     * function to equal an expression containing implicit variables
     * similarly appends those implicit variables, in the same order,
     * to the left-hand-side of the definition where the placeholder
     * ('_') appears.
     *
     * For example, consider the definition:
     *
     \code
     Func f, g;
     Var x, y;
     f(x, y) = 3;
     \endcode
     *
     * A call to f with the placeholder symbol \ref _
     * will have implicit arguments injected automatically, so f(2, \ref _)
     * is equivalent to f(2, \ref _0), where \ref _0 = Var::implicit(0), and f(\ref _)
     * (and indeed f when cast to an Expr) is equivalent to f(\ref _0, \ref _1).
     * The following definitions are all equivalent, differing only in the
     * variable names.
     *
     \code
     g(_) = f*3;
     g(_) = f(_)*3;
     g(x, _) = f(x, _)*3;
     g(x, y) = f(x, y)*3;
     \endcode
     *
     * These are expanded internally as follows:
     *
     \code
     g(_0, _1) = f(_0, _1)*3;
     g(_0, _1) = f(_0, _1)*3;
     g(x, _0) = f(x, _0)*3;
     g(x, y) = f(x, y)*3;
     \endcode
     *
     * The following, however, defines g as four dimensional:
     \code
     g(x, y, _) = f*3;
     \endcode
     *
     * It is equivalent to:
     *
     \code
     g(x, y, _0, _1) = f(_0, _1)*3;
     \endcode
     *
     * Expressions requiring differing numbers of implicit variables
     * can be combined. The left-hand-side of a definition injects
     * enough implicit variables to cover all of them:
     *
     \code
     Func h;
     h(x) = x*3;
     g(x) = h + (f + f(x)) * f(x, y);
     \endcode
     *
     * expands to:
     *
     \code
     Func h;
     h(x) = x*3;
     g(x, _0, _1) = h(_0) + (f(_0, _1) + f(x, _0)) * f(x, y);
     \endcode
     *
     * The first ten implicits, _0 through _9, are predeclared in this
     * header and can be used for scheduling. They should never be
     * used as arguments in a declaration or used in a call.
     *
     * While it is possible to use Var::implicit or the predeclared
     * implicits to create expressions that can be treated as small
     * anonymous functions (e.g. Func(_0 + _1)) this is considered
     * poor style. Instead use \ref lambda.
     */
    EXPORT static Var implicit(int n);

    /** Return whether a variable name is of the form for an implicit argument.
     * TODO: This is almost guaranteed to incorrectly fire on user
     * declared variables at some point. We should likely prevent
     * user Var declarations from making names of this form.
     */
    //{
    EXPORT static bool is_implicit(const std::string &name);
    bool is_implicit() const {
        return is_implicit(name());
    }
    //}

    /** Return the argument index for a placeholder argument given its
     *  name. Returns 0 for \ref _0, 1 for \ref _1, etc. Returns -1 if
     *  the variable is not of implicit form.
     */
    //{
    static int implicit_index(const std::string &name) {
        return is_implicit(name) ? atoi(name.c_str() + 1) : -1;
    }
    int implicit_index() const {
        return implicit_index(name());
    }
    //}

    /** Test if a var is the placeholder variable \ref _ */
    //{
    static bool is_placeholder(const std::string &name) {
        return name == "_";
    }
    bool is_placeholder() const {
        return is_placeholder(name());
    }
    //}

    /** A Var can be treated as an Expr of type Int(32) */
    operator Expr() const {
        return Internal::Variable::make(Int(32), name());
    }

    /** Vars to use for scheduling producer/consumer pairs on the gpu. Deprecated. */
    // @{
    HALIDE_ATTRIBUTE_DEPRECATED("Var::gpu_blocks() is deprecated.")
    static Var gpu_blocks() {
        return Var("__deprecated_block_id_x");
    }
    HALIDE_ATTRIBUTE_DEPRECATED("Var::gpu_threads() is deprecated.")
    static Var gpu_threads() {
        return Var("__deprecated_thread_id_x");
    }
    // @}

    /** A Var that represents the location outside the outermost loop. */
    static Var outermost() {
        return Var("__outermost");
    }

};

/** A placeholder variable for infered arguments. See \ref Var::implicit */
EXPORT extern Var _;

/** The first ten implicit Vars for use in scheduling. See \ref Var::implicit */
// @{
EXPORT extern Var _0, _1, _2, _3, _4, _5, _6, _7, _8, _9;
// @}

}

#endif


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="Sci blog jekyll theme">
    <meta name="author" content="AIR RAYA Group">
    <link href='/MyBlog/img/favicon.ico' type='image/icon' rel='shortcut icon'/>

    <title>泽民博客 | Jekyll theme</title>

    <link rel="stylesheet" href="/MyBlog/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
    <link rel="stylesheet" href="/MyBlog/css/font-awesome.min.css">
    <link href="/MyBlog/css/simple-sidebar.css" rel="stylesheet">
	<link href="/MyBlog/css/classic-10_7.css" rel="stylesheet" type="text/css">

    <link href="/MyBlog/css/style.css" rel="stylesheet">
    <link href="/MyBlog/css/pygments.css" rel="stylesheet">

 <link href="/MyBlog/css/front.css" rel="stylesheet" type="text/css">
 <link href="/MyBlog/css/Josefin_Slab.css" rel="stylesheet" type="text/css">
<link href="/MyBlog/css/Architects_Daughter.css" rel="stylesheet" type="text/css">
<link href="/MyBlog/css/Schoolbell.css" rel="stylesheet" type="text/css">
<link href="/MyBlog/css/Codystar.css" rel="stylesheet" type="text/css">

<link href="/MyBlog/css/calendar/common.css" type="text/css"  rel="stylesheet">

    <link rel="stylesheet" href="/MyBlog/katex/katex.css">

                        Home

                    About

                    Services

                    Portfolio

                    Events

                    Blog

                    FAQ

                    Contact

                        泽民博客
                        ☰ Menu

net-tools

 by 夏泽民 <time datetime="2022-03-26T00:00:00+08:00" itemprop="datePublished"> Mar 26, 2022</time>

ifconfig

$ apt-get install net-tools

ip

$ apt-get install iproute2

ping

$ apt-get install iputils-ping

https://zj-linux-guide.readthedocs.io/zh_CN/stable/tools/%5BUbuntu%2018.02%5D%5Bifconfig%5D%5Bip%5D%5Bping%5D%E7%BD%91%E7%BB%9C%E5%B7%A5%E5%85%B7%E5%AE%89%E8%A3%85.html

https://opensuse.pkgs.org/tumbleweed/opensuse-oss-x86_64/busybox-net-tools-1.35.0-22.1.noarch.rpm.html

https://embedkari.com/linux-busyboxdpkgapt-getapt/

https://raw.githubusercontent.com/dvershinin/apt-get-centos/master/apt-get.sh

Sometimes you'll want to have a shell into that VM, but that turns out to be more complicated than I initially expected. There is however an easily accessible debug shell available.

First, open a terminal and use socat to open the debug shell socket to the VM using the following command:

$ socat -d -d ~/Library/Containers/com.docker.docker/Data/debug-shell.sock pty,rawer

socat will print the line "PTY is /dev/ttys010", to which you can then connect to using screen on another terminal window:

$ screen /dev/ttys0xx

So that will look something like this:

$ socat -d -d ~/Library/Containers/com.docker.docker/Data/debug-shell.sock pty,rawer

2021/01/02 21:28:43 socat[23508] N opening connection to LEN=73 AF=1 "/Users/simon/Library/Containers/com.docker.docker/Data/debug-shell.sock"

2021/01/02 21:28:43 socat[23508] N successfully connected from local address LEN=16 AF=1 ""

2021/01/02 21:28:43 socat[23508] N successfully connected via

2021/01/02 21:28:43 socat[23508] N PTY is /dev/ttys010

2021/01/02 21:28:43 socat[23508] N starting data transfer loop with FDs [5,5] and [6,6]

$ screen /dev/ttys010

/ #

/ # uname -a

Linux docker-desktop 4.19.121-linuxkit #1 SMP Tue Dec 1 17:50:32 UTC 2020 x86_64 Linux

The VM is a very stripped down Alpine image with no package manager available, so you'll have to make do with what is available.

https://www.krenger.ch/blog/docker-desktop-for-mac-ssh-into-the-docker-vm/

                Category linux

<link rel="stylesheet" href="/MyBlog/css/default.css">


text:
<?xml version="1.0"?>
<project
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
	xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
	<modelVersion>4.0.0</modelVersion>
	<parent>
		<groupId>org.genericsystem</groupId>
		<artifactId>genericsystem2015</artifactId>
		<version>4.0-SNAPSHOT</version>
	</parent>
	<artifactId>gs-ir</artifactId>
	<name>Generic System Information Retriever</name>
	<url>http://maven.apache.org</url>
	<properties>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
	</properties>
	<dependencies>
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<version>3.8.1</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.genericsystem</groupId>
			<artifactId>gs-cv</artifactId>
			<version>4.0-SNAPSHOT</version>
		</dependency>
		<dependency>
			<groupId>org.genericsystem</groupId>
			<artifactId>gs-common</artifactId>
			<version>4.0-SNAPSHOT</version>
		</dependency>
		<dependency>
			<groupId>org.genericsystem</groupId>
			<artifactId>gs-reinforcer</artifactId>
			<version>4.0-SNAPSHOT</version>
		</dependency>
		<dependency>
			<groupId>io.vertx</groupId>
			<artifactId>vertx-core</artifactId>
			<version>${vertx.version}</version>
		</dependency>
		<dependency>
			<groupId>io.vertx</groupId>
			<artifactId>vertx-hazelcast</artifactId>
			<version>${vertx.version}</version>
		</dependency>
		<dependency>
			<groupId>org.apache.commons</groupId>
			<artifactId>commons-email</artifactId>
			<version>1.4</version>
		</dependency>
		<dependency>
			<groupId>org.testng</groupId>
			<artifactId>testng</artifactId>
			<scope>test</scope>
		</dependency>
	</dependencies>
</project>


text:
from gensim import corpora, models
import gensim
import gzip
import requests
import os.path
import shutil

if not os.path.isfile('news.gz'):
    print('Fetching news archive news.gz')
    url = 'http://acube.di.unipi.it/repo/news.gz'
    response = requests.get(url, stream=True)
    with open('news.gz', 'wb') as out_file:
        shutil.copyfileobj(response.raw, out_file)

news_corpus = {}
texts = []
categories = set()

with gzip.open('news.gz', 'rb') as news_raw:
    for line in news_raw:
        title = line.lower().strip()
        description = news_raw.readline().lower().strip()
        url = news_raw.readline().lower().strip()
        sequence = news_raw.readline().lower().strip()
        timestamp = news_raw.readline().lower().strip()
        publisher = news_raw.readline().lower().strip()
        category = news_raw.readline().lower().strip()
        news_corpus[sequence] = {'description': description,
                                 'url': url,
                                 'title': title,
                                 'timestamp': timestamp,
                                 'publisher': publisher,
                                 'category': category}
        # To skip the blank line between the records
        news_raw.readline().lower().strip()
        tokens = [token for token in gensim.utils.simple_preprocess(title + b'\n' + description) if token not in gensim.parsing.preprocessing.STOPWORDS]
        texts.append(tokens)
        categories.add(category)

print('Done parsing data')
dictionary = corpora.Dictionary(texts)
corpus = [dictionary.doc2bow(text) for text in texts]
# tfidf = models.tfidfmodel.TfidfModel(corpus)
ldamodel = models.ldamodel.LdaModel(corpus, num_topics=len(categories), id2word = dictionary, passes=30)
print('Done training LDA Model')

tokens = [[dictionary.token2id[word] for word in text] for text in texts]

# Saliency related functions adapted from https://github.com/StanfordHCI/termite/blob/master/pipeline/compute_saliency.py
from saliency import *
topic_info = computeTopicInfo(ldamodel, dictionary)
term_info = computeTermInfo(ldamodel, dictionary, corpus)

topic_info = sorted( topic_info, key = lambda topic_weight : -topic_weight['weight'] )
term_info = sorted( term_info, key = lambda term_freq : -term_freq['saliency'] )
for i, element in enumerate( term_info ):
    element['rank'] = i

from pipeline.io_utils import *

def CheckAndMakeDirs( path ):
    if not os.path.exists( path ):
        os.makedirs( path )

root = 'docs'
SUBFOLDER = 'saliency'
TOPIC_WEIGHTS = 'topic-info.json'
TOPIC_WEIGHTS_TXT = 'topic-info.txt'
TOPIC_WEIGHTS_FIELDS = [ 'term', 'saliency', 'frequency', 'distinctiveness', 'rank', 'visibility' ]
TERM_SALIENCY = 'term-info.json'
TERM_SALIENCY_TXT = 'term-info.txt'
TERM_SALIENCY_FIELDS = [ 'topic', 'weight' ]

path = '{}/{}/'.format( root, SUBFOLDER )
CheckAndMakeDirs( path )
# WriteAsJson( term_info, path + TERM_SALIENCY )
# WriteAsJson( topic_info, path + TOPIC_WEIGHTS )
# WriteAsTabDelimited( topic_info, path + TOPIC_WEIGHTS_TXT, TERM_SALIENCY_FIELDS )

# for index in range(ldamodel.num_topics):
#     topics = ldamodel.get_topic_terms(index, topn=40)
#     terms = [ldamodel.id2word[topic_id] for (topic_id, prob) in topics]
#     # Reorder terms based on saliency rank
#     reordered_terms = sorted( [term for term in term_info if term['term'] in terms], key = lambda term_freq : term_freq['rank'] )
#     print ('Terms for topic %d order:' %index)
#     print ('{}'.format(' '.join(terms[:20])))
#     print ('{}'.format(' '.join([term['term'] for term in reordered_terms[:20]])))
# print(term_info)

print('Done calculating saliecny values for terms')
from similarity import *
SUBFOLDER = 'similarity'
path = '{}/{}/'.format( root, SUBFOLDER )
COMBINED_G2 = 'combined-g2.txt'
combined_g2 = combineSimilarityMatrices(tokens)
CheckAndMakeDirs( path )
print('Done calculating bond energies between terms')
# WriteAsSparseMatrix( combined_g2, path + COMBINED_G2 )

import time
from seriation import *

candidateSize = 100
termFreqs = {}
termSaliency = {}
orderedTermList = []
termRank = {}
# termDistinct = {}
# termVisibility = {}
for element in term_info:
    term = dictionary.token2id[element['term']]
    orderedTermList.append( term )
    termSaliency[term] = element['saliency']
    termFreqs[term] = element['frequency']
    termRank[term] = element['rank']
    # termDistinct[term] = element['distinctiveness']
    # termVisibility[term] = element['visibility']

start_time = time.time()
candidateTerms = orderedTermList
term_ordering = []
term_iter_index = []
buffers = [0,0]

preBest = []
postBest = []
DEFAULT_NUM_SERIATED_TERMS = 100

for iteration in range(DEFAULT_NUM_SERIATED_TERMS):
    print("Iteration no. ", iteration)
    addedTerm = 0
    if len(term_iter_index) > 0:
        addedTerm = term_iter_index[-1]
    if iteration == 1:
        (preBest, postBest) = initBestEnergies(combined_g2, addedTerm, candidateTerms)
    (preBest, postBest, bestEnergies) = getBestEnergies(combined_g2, preBest, postBest, addedTerm)
    (candidateTerms, term_ordering, term_iter_index, buffers) = iterate_eff(combined_g2, termRank, termFreqs, termSaliency, candidateTerms, term_ordering, term_iter_index, buffers, bestEnergies, iteration)

seriation_time = time.time() - start_time

print("seriation time: " +  str(seriation_time))
print('Done with seriation step.')
term_ordering, term_iter_index

term_ordering = [dictionary.id2token[term] for term in term_ordering]
term_iter_index = [str(index) for index in term_iter_index]
# term_ordering, term_iter_index = compute()
TERM_ORDERING = 'term-ordering.txt'
TERM_ITER_INDEX = 'term-iter-index.txt'
SUBFOLDER = 'seriation'
path = '{}/{}/'.format( root, SUBFOLDER )
CheckAndMakeDirs( path )
WriteAsList( term_ordering, path + TERM_ORDERING)
WriteAsList( term_iter_index, path + TERM_ITER_INDEX)

term_topic_submatrix = []
term_subindex = []
for term in term_ordering:
    if term in dictionary.token2id:
        term_topic_matrix = []
        for index in range(ldamodel.num_topics):
            term_topic_matrix.append(ldamodel.expElogbeta[index][dictionary.token2id[term]])
        term_topic_submatrix.append(term_topic_matrix)
        term_subindex.append(term)
seriated_parameters = {
    'termIndex' : term_subindex,
    'topicIndex' : [i for i in range(ldamodel.num_topics)],
    'matrix' : term_topic_submatrix
}
SERIATED_PARAMETERS = 'seriated-parameters.json'

term_rank_map = { term: value for value, term in enumerate(term_iter_index)}
term_order_map = { term: value for value, term in enumerate(term_ordering)}
term_saliency_map = { d['term']: d['saliency'] for d in term_info }
term_distinctiveness_map = { d['term'] : d['distinctiveness'] for d in term_info }
filtered_parameters = {
    'termRankMap' : term_rank_map,
    'termOrderMap' : term_order_map,
    'termSaliencyMap' : term_saliency_map,
    'termDistinctivenessMap' : term_distinctiveness_map
}
FILTERED_PARAMETERS = 'filtered-parameters.json'

topic_index = [i for i in range(ldamodel.num_topics)]
term_topic_submatrix = []
term_subindex = []
for term in term_ordering:
    if term in dictionary.token2id:
        term_topic_matrix = []
        for index in range(ldamodel.num_topics):
            term_topic_matrix.append(ldamodel.expElogbeta[index][dictionary.token2id[term]])
        term_topic_submatrix.append(term_topic_matrix)
        term_subindex.append(term)

term_freqs = { d['term']: d['frequency'] for d in term_info }
global_term_freqs = {
    'termIndex' : term_subindex,
    'topicIndex' : topic_index,
    'matrix' : term_topic_submatrix,
    'termFreqMap' : term_freqs
    }
GLOBAL_TERM_FREQS = 'global-term-freqs.json'

SUBFOLDER = 'data'
path = '{}/{}/'.format( root, SUBFOLDER )
CheckAndMakeDirs( SUBFOLDER )
WriteAsJson( seriated_parameters, path + SERIATED_PARAMETERS )
WriteAsJson( filtered_parameters, path + FILTERED_PARAMETERS )
WriteAsJson( global_term_freqs, path + GLOBAL_TERM_FREQS )


text:
package org.apache.flink.table.descriptors;

import org.apache.flink.annotation.Internal;
import org.apache.flink.table.api.ValidationException;

/**
 * Validator for {@link Avro}.
 */
@Internal
public class AvroValidator extends FormatDescriptorValidator {

	public static final String FORMAT_TYPE_VALUE = "avro";
	public static final String FORMAT_RECORD_CLASS = "format.record-class";
	public static final String FORMAT_AVRO_SCHEMA = "format.avro-schema";

	@Override
	public void validate(DescriptorProperties properties) {
		super.validate(properties);
		final boolean hasRecordClass = properties.containsKey(FORMAT_RECORD_CLASS);
		final boolean hasAvroSchema = properties.containsKey(FORMAT_AVRO_SCHEMA);
		if (hasRecordClass && hasAvroSchema) {
			throw new ValidationException("A definition of both a schema and Avro schema is not allowed.");
		} else if (hasRecordClass) {
			properties.validateString(FORMAT_RECORD_CLASS, false, 1);
		} else if (hasAvroSchema) {
			properties.validateString(FORMAT_AVRO_SCHEMA, false, 1);
		} else {
			throw new ValidationException("A definition of an Avro specific record class or Avro schema is required.");
		}
	}
}


text:
A microservice generator for the [usrv](https://github.com/achilleasa/usrv) framework.

This tool provides an easy way to bootstrap new usrv services for your application. Features:
- AMQP as the transport layer.
- Protocol buffers for message exchange.
- Support for incoming request throttling (max concurrent connections) and execution deadlines.
- Support for request tracing via the [usrv-tracer](https://github.com/achilleasa/usrv-tracer) package with redis as the storage backend.
- Generation of both the server and the client (real and mock for running integration tests).
- Dynamic service configuration via etcd.

# Getting started

Please note that this package is still work in progress.

The following example will generate service `go-usrv-example` under the `github.com/foo` folder inside the current
go workspace (`GOPATH` needs to be present in your env vars or the generator will fail with an error). The generated
service will:
- use etcd for configuration and amqp as the transport layer
- expose an endpoint called `Foo` with the fully qualified name `com.foo.example.Foo`
- expose an endpoint called `Bar` with the fully qualified name `com.foo.example.Bar`
- generate protocol buffer stubs for request/response messages to the above endpoints and execute proto-c
- throttle incoming requests (1000 concurrent, no exec limit)
- log request/response traces to redis (also configured via etcd) with a 1-day TTL.

```
go run usrv-gen.go \
   --srv-path="github.com/foo/go-usrv-example" \
   --srv-descr="A description for the service" \
   --srv-base="com.foo.example" \
   --srv-endpoint="Foo" \
   --srv-endpoint="Bar" \
   --throttle-enabled --throttle-max-concurrent=1000 --throttle-max-exec-time=0 \
   --tracer-enabled --tracer-queue-size=1000 --tracer-entry-ttl=86400 \
   --init-git-repo \
   --etcd-enabled

Creating new usrv service at ~/go/src/github.com/foo/go-usrv-example
✓  Processing: templates/.gitignore_tpl -> .gitignore
✓  Processing: templates/README.md_tpl -> README.md
✓  Processing: templates/client.go_tpl -> client.go
✓  Processing: templates/endpoints.go_tpl -> endpoints.go
✓  Processing: templates/launch/launch.go_tpl -> launch/launch.go
✓  Processing: templates/messages.proto_tpl -> messages.proto
✓  Processing: templates/server.go_tpl -> server.go
✓  Processing: templates/service.go_tpl -> service.go
✓  Running go fmt
✓  Creating initial protobuf bindings
✓  Init empty git repo

Notes:
- The service protobuf messages are defined in ~/go/src/github.com/foo/go-usrv-example/messages.proto.
  After making any changes to the .proto file run 'go generate' to rebuild the go bindings.
- Add your service implementation inside ~/go/src/github.com/foo/go-usrv-example/service.go.
- The service is set up to use etcd for automatic configuration.
  See ~/go/src/github.com/foo/go-usrv-example/README.md for more details.
- An empty git repo has been created for you.
```

# Service implementation details

Add your service implementation details to the `service.go` file inside each generated `Handler` method.

The same file also defines the `InitService` function which will be invoked before the server starts.
You can use this hook  to perform one-time initialization of your service, setup connections or create
clients for the external services you need.

# Building and running your service

To build your server executable switch to the `launch` folder inside the generated service and type:
`go build`

To run the service just run the compiled executable. The service expects an etcd server to be available at
`http://127.0.0.1:4001`. To use a different etcd host (e.g running inside a docker container) or a list
 of multiple comma-delimited hosts you can either:
- specify the `--etcd-hosts` command line argument
- define the `ETCD_HOSTS` env var

To exit a running server send it a `SIGINT` or press `ctrl+c` if running in interactive mode.

# The request and response messages

## Using protobuf (default)
The generator defines a `Request` and `Response` protobuf message for the each exposed service endpoint. The protobuf
messages are defined in the `messages.proto` file. If you make any changes to the `messages.proto` file you need to
rebuild the go bindings via running `go generate` inside the service folder.

## Using json

If you want to use json instead of protocol buffers for your service pass the
`srv-message-type=json` command-line option to the generator. In this case, the `Request` and
`Response` objects will be defined inside the generated `messages.go` file.

# License

usrv-gen is distributed under the [MIT license](https://github.com/achilleasa/usrv-genr/blob/master/LICENSE).


text:
This release focussed mainly on bug fixes and minor enhancements, in order to provide a stable release of the compiler.

This release saw major contributions from [a number of new contributors](https://github.com/purescript/purescript/graphs/contributors). Thank you very much to everyone who submitted pull requests, issues and suggestions, and also to the users of the #purescript FreeNode channel for their valuable feedback. As always, new contributors are always welcome!

- The full language guide can be found [here](http://purescript.readthedocs.org).
- Try out the latest features [here](http://tryps.functorial.com).

## Breaking Changes

- Multiple argument functions are no longer available.
- When used in the browser, PureScript modules are now accessed through `window.PS.<ModuleName>`. The `PS` object name can be changed via the `--browser-namespace` compiler argument.
- The `--run-main` argument has been replaced with `--main` which can now accept a module name in which to find the `main` function.

### New Features

- Dead code elimination. The new compiler argument `--module=` can be used to specify one or more modules that should be kept in the generated code along with their dependencies. If no modules are specified, all code is exported.

### Enhancements

- The `->` and `[]` types are now usable in type class instances.
- The file path is included in syntax error messages.
- Most reserved Javascript names (`return`, `const`, etc) are now usable.
- Generated code for operators is more user friendly (for example, `Prelude[">>="]`). Where this transformation cannot be applied, human-readable variable names (e.g. `$greater$greater$eq`) are generated.
- The typechecker's function application judgement was greatly simplified, and as a result, more valid things now typecheck.
- Data constructors with multiple arguments can now be defined.
- It is no longer necessary to sort modules in order of dependencies manually.
- Case statements matching data constructors no longer generate unnecessary constructor checks at runtime if there is only a single data constructor.
- New optimizer rules were added to inline JavaScript's built-in operators.

### Bug Fixes

- Floats parse correctly.
- Using data constructors in pattern matches now works properly across modules.
- PureScript modules no longer overwrite global objects with the same name.
- Show problems with shadowing of names were fixed.
- Problems with recursive non-function values were fixed.
- Type synonyms can now expand to types containing more type synonyms.
- A bug in capture-avoiding type variable substitution which was affecting the `Functor (Either e)` instance was fixed.
- Type synonym instances are now disallowed.
- Precedence rules for some basic operators were corrected.
- A bug which allowed skolem variables to escape their scope was add (thanks to Brian McKenna).
- Modules containing mutually recursive type synonyms and data declarations now compile correctly.
- A number of bugs in the optimizer were addressed.

### Libraries

- The `Prelude` has been greatly expanded. Definitions for built-in JavaScript operators have been moved into the Prelude.
- Gary Burgess has released the [grunt-purescript library](https://github.com/purescript/grunt-purescript) to build PureScript code using Grunt.
- The [purescript-parsing](https://github.com/purescript/purescript-parsing) library provides Parsec-like parsing combinators.
- The [purescript-promises](https://github.com/purescript/purescript-promises) library provides `Monad` and `Applicative` instances for promises.
- The [purescript-quickcheck](https://github.com/purescript/purescript-quickcheck) library provides a very basic implementation of a QuickCheck-style testing harness.
- The [purescript-json](https://github.com/purescript/purescript-json) library aims to provide a safe way to consume  JSON data.

### Documentation

- Documentation for the `Prelude` modules is now automatically generated and can be found [here](http://purescript.readthedocs.org/en/latest/prelude.html).
- There is now Hackage documentation.
- Code comments have been improved.


text:
{% extends 'admin/master.html' %}
{% import 'admin/lib.html' as lib with context %}

{% macro extra() %}
  <input name="_continue_editing" type="submit" class="btn btn-large" value="{{ _gettext('Save and Continue') }}" />
{% endmacro %}

{% block head %}
    {{ super() }}
{% endblock %}

{% block body %}
    {% call lib.form_tag(form) %}
        <input type="hidden" name="_csrftoken" value="{{ csrf_token() }}"/>
        {{ lib.render_form_fields(form, form_opts=form_opts) }}
        {{ lib.render_form_buttons(return_url, extra()) }}
    {% endcall %}
{% endblock %}

{% block tail %}
  {{ super() }}
{% endblock %}


text:
<?php
/**
 * Created by PhpStorm.
 * User: juanan
 * Date: 15/04/15
 * Time: 23:28
 */

namespace AppBundle\EventListener;

use AppBundle\Entity\File;
use AppBundle\FileEvents;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use AppBundle\Event\FileEvent;
use Psr\Log\LoggerInterface;
use CL\Tissue\Adapter\ClamAv\ClamAvAdapter;
use Doctrine\ORM\EntityManager;
use Swift_Mailer;

/**
 * Class VirusConsignaListener
 * @package AppBundle\EventListener
 */
class VirusConsignaListener implements EventSubscriberInterface
{
    /**
     * @var
     */
    private $antivirus_path ;

    /**
     * @var LoggerInterface
     */
    private $loggerInterface;

    /**
     * @var EntityManager
     */
    private $entityManager;

    /**
     * @var Swift_Mailer
     */
    private $swiftMailer;

    /**
     * @param LoggerInterface $loggerInterface
     * @param EntityManager $entityManager
     * @param $antivirus_path
     * @param Swift_Mailer $mailer
     */
    function __construct(LoggerInterface $loggerInterface, EntityManager $entityManager, $antivirus_path, Swift_Mailer $mailer)
    {
        $this->loggerInterface = $loggerInterface;
        $this->entityManager= $entityManager;
        $this->antivirus_path = $antivirus_path;
        $this->swiftMailer = $mailer;
    }

    /**
     * @return array
     */
    public static function getSubscribedEvents()
    {
        return array(
            FileEvents::SUBMITTED => 'onFileSubmitted'
        );
    }

    /**
     * @param FileEvent $event
     */
    public function onFileSubmitted(FileEvent $event)
    {
        $file = $event->getFile();
        $path = $file-> getPath();

        try {
            $adapter = new ClamAVAdapter($this->antivirus_path);

            $result = $adapter->scan([$path]);

            if ($result->hasVirus()) {
                $this->loggerInterface->info('File ' . $file . ' has been removed');
                $this->entityManager->remove($file);
            } else {
                $this->loggerInterface->info('File ' . $file . ' has been scanned');
                $file->setScanStatus(File::SCAN_STATUS_OK);
                $this->entityManager->persist($file);
            }

        } catch (\Exception $e) {
            $this->loggerInterface->info($e);
            $file->setScanStatus(File::SCAN_STATUS_FAILED);
            $this->entityManager->persist($file);
            $mailer = $this->swiftMailer;
            $message = $mailer->createMessage()
                ->setSubject('Error scanning file')
                ->setFrom('consignauco@gmail.com')
                ->setTo('jamartinez@uco.es')
                ->setBody($e)
            ;
            $mailer->send($message);
        };
        $this->entityManager->flush();

    }
}


text:
/*
 * RestoreDialog.java - Jun 16, 2003
 *
 * @author wolf
 */
package org.exist.backup;

import java.awt.Dimension;
import java.awt.Frame;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.HeadlessException;
import java.awt.Insets;
import java.util.Observable;
import java.util.Observer;

import javax.swing.BorderFactory;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JProgressBar;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;

import org.exist.storage.ElementIndex;
import org.exist.storage.TextSearchEngine;
import org.exist.util.ProgressIndicator;

public class RestoreDialog extends JDialog {

	JTextField currentCollection;
	JTextField resource;
	JTextArea messages;
	JProgressBar progress;

    Observer progressObserver = new UploadProgressObserver();

	/**
	 * @param owner
	 * @param title
	 * @param modal
	 * @throws java.awt.HeadlessException
	 */
	public RestoreDialog(Frame owner, String title, boolean modal) throws HeadlessException {
		super(owner, title, modal);
		setupComponents();
		setSize(new Dimension(350, 200));
		pack();
	}

	private void setupComponents() {
		GridBagLayout grid = new GridBagLayout();
		getContentPane().setLayout(grid);
		GridBagConstraints c = new GridBagConstraints();
		c.insets = new Insets(5, 5, 5, 5);

		JLabel label = new JLabel("Collection:");
		c.gridx = 0;
		c.gridy = 0;
		c.anchor = GridBagConstraints.WEST;
		c.fill = GridBagConstraints.NONE;
		grid.setConstraints(label, c);
		getContentPane().add(label);

		currentCollection = new JTextField(40);
		currentCollection.setEditable(false);
		c.gridx = 1;
		c.gridy = 0;
		c.anchor = GridBagConstraints.WEST;
		c.fill = GridBagConstraints.HORIZONTAL;
		grid.setConstraints(currentCollection, c);
		getContentPane().add(currentCollection);

		label = new JLabel("Restoring:");
		c.gridx = 0;
		c.gridy = 1;
		c.anchor = GridBagConstraints.WEST;
		c.fill = GridBagConstraints.NONE;
		grid.setConstraints(label, c);
		getContentPane().add(label);

		resource = new JTextField(40);
		resource.setEditable(false);
		c.gridx = 1;
		c.gridy = 1;
		c.anchor = GridBagConstraints.WEST;
		c.fill = GridBagConstraints.HORIZONTAL;
		grid.setConstraints(resource, c);
		getContentPane().add(resource);

		label = new JLabel("Progress:");
		c.gridx = 0;
		c.gridy = 2;
		c.anchor = GridBagConstraints.WEST;
		c.fill = GridBagConstraints.NONE;
		grid.setConstraints(label, c);
		getContentPane().add(label);

		progress = new JProgressBar();
		progress.setStringPainted(true);
		progress.setString("");
		c.gridx = 1;
		c.gridy = 2;
		c.anchor = GridBagConstraints.EAST;
		c.fill = GridBagConstraints.HORIZONTAL;
		grid.setConstraints(progress, c);
		getContentPane().add(progress);

		messages = new JTextArea(5, 50);
		messages.setEditable(false);
		JScrollPane scroll =
			new JScrollPane(
				messages,
				JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
				JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
		scroll.setBorder(BorderFactory.createTitledBorder("Messages"));
		c.gridx = 0;
		c.gridy = 3;
		c.gridwidth = 2;
		c.anchor = GridBagConstraints.WEST;
		c.fill = GridBagConstraints.HORIZONTAL;
		grid.setConstraints(scroll, c);
		getContentPane().add(scroll);
	}

	public void setCollection(String collection) {
		currentCollection.setText(collection);
	}

	public void setResource(String current) {
		resource.setText(current);
	}

	public void displayMessage(String message) {
		messages.append(message + '\n');
		messages.setCaretPosition(messages.getDocument().getLength());
	}

	public Observer getObserver() {
		return progressObserver;
	}

	class UploadProgressObserver implements Observer {

		int mode = 0;

		public void update(Observable o, Object arg) {
			progress.setIndeterminate(false);
			ProgressIndicator ind = (ProgressIndicator) arg;
			progress.setValue(ind.getPercentage());
			if (o instanceof TextSearchEngine)
				progress.setString("Storing words");
			else if (o instanceof ElementIndex)
				progress.setString("Storing elements");
			else
				progress.setString("Storing nodes");
		}

	}
}


text:
chef_version_for_provides '< 16.5' if respond_to?(:chef_version_for_provides)

provides :chef_client_trusted_certificate
resource_name :chef_client_trusted_certificate

unified_mode true if respond_to?(:unified_mode)

property :cert_name, String, name_property: true

# this version check can go away once this is ported into chef itself
property :certificate, String, required: Chef::VERSION.to_i >= 16 ? [:add] : true

action :add do
  unless ::Dir.exist?(Chef::Config[:trusted_certs_dir])
    directory Chef::Config[:trusted_certs_dir] do
      mode '0640'
      recursive true
    end
  end

  file cert_path do
    content new_resource.certificate
    mode '0640'
  end
end

action :remove do
  file cert_path do
    action :delete
  end
end

action_class do
  #
  # The path to the string on disk
  #
  # @return [String]
  #
  def cert_path
    path = ::File.join(Chef::Config[:trusted_certs_dir], new_resource.cert_name)
    path << '.pem' unless path.end_with?('.pem')
    path
  end
end