text:
package com.alibaba.wasp;

import com.alibaba.wasp.master.EntityGroupState;
import com.alibaba.wasp.protobuf.ProtobufUtil;
import com.alibaba.wasp.protobuf.generated.ClusterStatusProtos;
import com.alibaba.wasp.protobuf.generated.WaspProtos;
import com.google.protobuf.ByteString;
import org.apache.hadoop.hbase.util.Bytes;

import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.Map;

/**
 * Status information on the Wasp cluster.
 *

 * <tt>ClusterStatus</tt> provides clients with information such as:
 *

 *
The count and names of fservers in the cluster.

 *
The count and names of dead fservers in the cluster.

 *
The name of the active master for the cluster.

 *
The name(s) of the backup master(s) for the cluster, if they exist.

 *
The average cluster load.

 *
The number of entity groups deployed on the cluster.

 *
The number of requests since last report.

 *
Detailed fserver loading and resource usage information, per server and
 * per entityGroup.

 *
entityGroups in transition at master

 *
The unique cluster ID

 *

 */
public class ClusterStatus {
  /**
   * Version for object serialization. Incremented for changes in serialized
   * representation.
   *

   *
0

   *
Initial version

   *
1

   *
Added cluster ID

   *
2

   *
Added Map of ServerName to ServerLoad

   *
3

   *
Added master and backupMasters

   *

   */

  private Map<ServerName, ServerLoad> liveServers;
  private Collection<ServerName> deadServers;
  private ServerName master;
  private Collection<ServerName> backupMasters;
  private Map<String, EntityGroupState> intransition;
  private String clusterId;
  private boolean balancerOn;

  public ClusterStatus(final String clusterid,
      final Map<ServerName, ServerLoad> servers,
      final Collection<ServerName> deadServers, final ServerName master,
      final Collection<ServerName> backupMasters,
      final Map<String, EntityGroupState> egit, final boolean balancerOn) {
    this.liveServers = servers;
    this.deadServers = deadServers;
    this.master = master;
    this.backupMasters = backupMasters;
    this.intransition = egit;
    this.clusterId = clusterid;
    this.balancerOn = balancerOn;
  }

  /**
   * @return the names of fservers on the dead list
   */
  public Collection<ServerName> getDeadServerNames() {
    return Collections.unmodifiableCollection(deadServers);
  }

  /**
   * @return the number of fservers in the cluster
   */
  public int getServersSize() {
    return liveServers.size();
  }

  /**
   * @return the number of dead fservers in the cluster
   */
  public int getDeadServers() {
    return deadServers.size();
  }

  /**
   * @return the average cluster load
   */
  public double getAverageLoad() {
    int load = getEntityGroupsCount();
    return (double) load / (double) getServersSize();
  }

  /**
   * @return the number of entityGroups deployed on the cluster
   */
  public int getEntityGroupsCount() {
    int count = 0;
    for (Map.Entry<ServerName, ServerLoad> e : this.liveServers.entrySet()) {
      count += e.getValue().getNumberOfEntityGroups();
    }
    return count;
  }

  /**
   * @return the number of requests since last report
   */
  public int getRequestsCount() {
    int count = 0;
    for (Map.Entry<ServerName, ServerLoad> e : this.liveServers.entrySet()) {
      count += e.getValue().getTotalNumberOfRequests();
    }
    return count;
  }

  /**
   * @see Object#equals(Object)
   */
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (!(o instanceof ClusterStatus)) {
      return false;
    }
    return this.liveServers.equals(((ClusterStatus) o).liveServers)
        && this.deadServers.containsAll(((ClusterStatus) o).deadServers)
        && this.master.equals(((ClusterStatus) o).master)
        && this.backupMasters.containsAll(((ClusterStatus) o).backupMasters);
  }

  /**
   * @see Object#hashCode()
   */
  public int hashCode() {
    return this.liveServers.hashCode() + this.deadServers.hashCode()
        + this.master.hashCode() + this.backupMasters.hashCode();
  }

  //
  // Getters
  //
  public Collection<ServerName> getServers() {
    return Collections.unmodifiableCollection(this.liveServers.keySet());
  }

  /**
   * Returns detailed information about the current master {@link ServerName}.
   *
   * @return current master information if it exists
   */
  public ServerName getMaster() {
    return this.master;
  }

  /**
   * @return the number of backup masters in the cluster
   */
  public int getBackupMastersSize() {
    return this.backupMasters.size();
  }

  /**
   * @return the names of backup masters
   */
  public Collection<ServerName> getBackupMasters() {
    return Collections.unmodifiableCollection(this.backupMasters);
  }

  /**
   * @param sn
   * @return Server's load or null if not found.
   */
  public ServerLoad getLoad(final ServerName sn) {
    return this.liveServers.get(sn);
  }

  public Map<String, EntityGroupState> getEntityGroupsInTransition() {
    return this.intransition;
  }

  public String getClusterId() {
    return clusterId;
  }

  public boolean isBalancerOn() {
    return balancerOn;
  }

  /**
   * Convert a ClutserStatus to a protobuf ClusterStatus
   *
   * @return the protobuf ClusterStatus
   */
  public ClusterStatusProtos.ClusterStatus convert() {
    ClusterStatusProtos.ClusterStatus.Builder builder = ClusterStatusProtos.ClusterStatus
        .newBuilder();

    for (Map.Entry<ServerName, ServerLoad> entry : liveServers.entrySet()) {
      ClusterStatusProtos.LiveServerInfo.Builder lsi = ClusterStatusProtos.LiveServerInfo.newBuilder().setServer(
          ProtobufUtil.toServerName(entry.getKey()));
      lsi.setServerLoad(entry.getValue().obtainServerLoadPB());
      builder.addLiveServers(lsi.build());
    }
    for (ServerName deadServer : getDeadServerNames()) {
      builder.addDeadServers(ProtobufUtil.toServerName(deadServer));
    }

    for (Map.Entry<String, EntityGroupState> egit : getEntityGroupsInTransition()
        .entrySet()) {
      ClusterStatusProtos.EntityGroupStateProtos egs = egit.getValue()
          .convert();
      WaspProtos.EntityGroupSpecifier.Builder spec = WaspProtos.EntityGroupSpecifier.newBuilder()
          .setType(WaspProtos.EntityGroupSpecifier.EntityGroupSpecifierType.ENTITYGROUP_NAME);
      spec.setValue(ByteString.copyFrom(Bytes.toBytes(egit.getKey())));

      ClusterStatusProtos.EntityGroupInTransitionProtos pbEGIT = ClusterStatusProtos.EntityGroupInTransitionProtos
          .newBuilder().setSpec(spec.build()).setEntityGroupState(egs).build();
      builder.addEntityGroupsInTransition(pbEGIT);
    }

    builder.setClusterId(new ClusterId(getClusterId()).convert());

    builder.setMaster(ProtobufUtil.toServerName(getMaster()));
    for (ServerName backup : getBackupMasters()) {
      builder.addBackupMasters(ProtobufUtil.toServerName(backup));
    }
    builder.setBalancerOn(balancerOn);
    return builder.build();
  }

  /**
   * Convert a protobuf ClusterStatus to a ClusterStatus
   *
   * @param proto
   *          the protobuf ClusterStatus
   * @return the converted ClusterStatus
   */
  public static ClusterStatus convert(ClusterStatusProtos.ClusterStatus proto) {
    Map<ServerName, ServerLoad> servers = new HashMap<ServerName, ServerLoad>();
    for (ClusterStatusProtos.LiveServerInfo lsi : proto.getLiveServersList()) {
      servers.put(ProtobufUtil.toServerName(lsi.getServer()), new ServerLoad(
          lsi.getServerLoad()));
    }
    Collection<ServerName> deadServers = new LinkedList<ServerName>();
    for (WaspProtos.ServerName sn : proto.getDeadServersList()) {
      deadServers.add(ProtobufUtil.toServerName(sn));
    }
    Collection<ServerName> backupMasters = new LinkedList<ServerName>();
    for (WaspProtos.ServerName sn : proto.getBackupMastersList()) {
      backupMasters.add(ProtobufUtil.toServerName(sn));
    }
    final Map<String, EntityGroupState> egit = new HashMap<String, EntityGroupState>();
    for (ClusterStatusProtos.EntityGroupInTransitionProtos entityGroup : proto
        .getEntityGroupsInTransitionList()) {
      String key = new String(entityGroup.getSpec().getValue().toByteArray());
      EntityGroupState value = EntityGroupState.convert(entityGroup
          .getEntityGroupState());
      egit.put(key, value);
    }

    return new ClusterStatus(
        ClusterId.convert(proto.getClusterId()).toString(), servers,
        deadServers, ProtobufUtil.toServerName(proto.getMaster()),
        backupMasters, egit, proto.getBalancerOn());
  }
}


text:
#include "storage.h"

#include <string.h>

/**
 * CacheStorageNew:
 * @path: Directory where #CacheEntry instances are read/written.
 *
 * Returns: New instance of #CacheStorage.
 */
CacheStorage *CacheStorageNew(const char *path) {
  CacheStorage *self = g_new0(CacheStorage, 1);
  self->refcount = 1;
  self->path = g_strdup(path);
  g_assert(self->path);
  return self;
}

void CacheStorageRef(CacheStorage *self) {
  g_assert(self->refcount > 0);
  self->refcount++;
}

void CacheStorageUnref(CacheStorage *self) {
  g_assert(self->refcount > 0);
  self->refcount--;
  if (self->refcount)
    return;

  g_free(self->path);
  memset(self, 0, sizeof(*self));
  g_free(self);
}

static gchar *CacheStorageGetUserPath(CacheStorage *self, const gchar *username,
                                      GError **error) {
  g_assert(username);
  if (username[0] == '\0') {
      g_set_error(
          error, CACHE_STORAGE_ERROR, CACHE_STORAGE_USERNAME_ERROR,
          "Empty username is not supported");
      return NULL;
  }

  for (guint i = 0; username[i]; i++) {
    if (g_ascii_isalnum(username[i]))
      continue;

    switch (username[i]) {
      case '_':
      case '-':
        break;
      default:
        g_set_error(
            error, CACHE_STORAGE_ERROR, CACHE_STORAGE_USERNAME_ERROR,
            "Username '%s' contains unsupported characters",
            g_shell_quote(username));
        return NULL;
    }
  }

  return g_build_filename(self->path, username, NULL);
}

/**
 * CacheStorageGetEntry:
 * @self: #CacheStorage instance.
 * @username: User whose entry we want.
 * @error: (out)(allow-none): Error return location or #NULL.
 *
 * Returns: Instance of #CacheEntry or #NULL on error.
 */
CacheEntry *CacheStorageGetEntry(CacheStorage *self, const gchar *username,
                                  GError **error) {
  GError *tmp_error = NULL;
  gchar *path = NULL;
  gchar *contents = NULL;
  CacheEntry *result = NULL;

  path = CacheStorageGetUserPath(self, username, error);
  if (!path)
    goto done;

  if (!g_file_get_contents(path, &contents, NULL, &tmp_error)) {
    g_assert(tmp_error);
    g_set_error(error, CACHE_STORAGE_ERROR, CACHE_STORAGE_FILE_ERROR,
                "Failed to get cache entry for %s: %s", username,
                tmp_error->message);
    g_error_free(tmp_error);
    goto done;
  }

  result = CacheEntryUnserialize(contents, error);

done:
  g_free(contents);
  g_free(path);
  return result;
}

/**
 * CacheStoragePutEntry:
 * @self: #CacheStorage instance.
 * @username: User who owns the @entry.
 * @entry: #CacheEntry to write to disk.
 * @error: (out)(allow-none): Error return location or #NULL.
 *
 * Returns: #TRUE on success or #FALSE on error.
 */
gboolean CacheStoragePutEntry(CacheStorage *self, const gchar *username,
                              CacheEntry *entry, GError **error) {
  gchar *path = NULL;
  gchar *contents = NULL;
  gboolean result = FALSE;
  GError *tmp_error = NULL;

  path = CacheStorageGetUserPath(self, username, error);
  if (!path)
    goto done;

  contents = CacheEntrySerialize(entry);

  result = g_file_set_contents(path, contents, -1, &tmp_error);
  if (!result) {
    g_assert(tmp_error);
    g_set_error(error, CACHE_STORAGE_ERROR, CACHE_STORAGE_FILE_ERROR,
                "Failed to save cache entry for %s: %s", username,
                tmp_error->message);
    g_error_free(tmp_error);
  }

done:
  g_free(contents);
  g_free(path);
  return result;
}

GQuark
_CacheStorageErrorQuark() {
  return g_quark_from_string("cache-storage-error-quark");
}

redpajama_set_name: RedPajamaGithub


text:
package com.jeeplus.common.util;

import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.UUID;

/**
 * 文件上传下载的帮助类
 * Created by yuzp17311 on 2016/9/12.
 */
public final class FileUtils {

    private FileUtils(){
        throw new Error("The class can't be intance");
    }

    /**
     * SpringMVC 中的文件上传方法 trasferTo 的方式上传,参数为MultipartFile
     * @param request
     * @param multipartFile
     * @param filePath
     * @return
     */
    public static String fileUpload(HttpServletRequest request, MultipartFile multipartFile,String filePath){
        //时间戳
        String dateString=new SimpleDateFormat("yyyyMMdd hh:mm:ss").format(new Date());
        //服务器路径(绝对路径)
        String savePath=request.getSession().getServletContext().getRealPath(filePath)+ File.separator+dateString;
        File saveDir=new File(savePath);
        if(!saveDir.exists()||!saveDir.isDirectory())
            saveDir.mkdir();
        if(multipartFile!=null){
            //后缀名
            String suffix=multipartFile.getOriginalFilename().substring(multipartFile.getOriginalFilename().lastIndexOf("."));
            String uuidName= UUID.randomUUID().toString()+suffix;
            //完整文件名
            String fileName=savePath+File.separator+uuidName;
            //相对路径
            String relativePath = filePath + File.separator + dateString + File.separator + uuidName;
            try {
                multipartFile.transferTo(new File(fileName));
                return relativePath;
            }catch (IOException e){
                e.printStackTrace();
                return null;
            }
        }else
            return null;
    }

    /**
     * 文件下载
     * @param request
     * @param response
     * @param filePath
     */
    public static void fileDownload(HttpServletRequest request, HttpServletResponse response,String filePath){
        String realPath=request.getSession().getServletContext().getRealPath(filePath);
        File file=new File(realPath);
        String fileName=file.getName();
        try {
            InputStream inputStream=new BufferedInputStream(new FileInputStream(file));
            byte [] buffer=new byte[inputStream.available()];
            inputStream.read(buffer);
            inputStream.close();
            response.reset();
            // 先去掉文件名称中的空格,然后转换编码格式为utf-8,保证不出现乱码,这个文件名称用于浏览器的下载框中自动显示的文件名
            response.addHeader("Content-Disposition", "attachment;filename=" + new String(fileName.replaceAll(" ", "").getBytes("utf-8"), "iso8859-1"));
            response.addHeader("Content-Length", "" + file.length());
            OutputStream os = new BufferedOutputStream(response.getOutputStream());
            response.setContentType("application/octet-stream");
            os.write(buffer);// 输出文件
            os.flush();
            os.close();
        }catch (IOException e){
            e.printStackTrace();
        }
    }

}


text:
var uploadify_img_types = '*.jpg;*.jpeg;*.png;*.gif;*.eps;*.psd;*.ai;*.tiff';
var uploadify_doc_types = '*.doc;*.docx;*.pdf;*.xls;*.vcf;*.vcard;*.ppt;*.pptx';

$(document).ready(function(){

	$('input.upldify').each(function(){
		var fileType = "";
		var allowedFileTypes = "";
		var folder = '/assets/files'+$(this).attr('folder');
		var params = {};
		var queue = $(this).parent().parent().parent().find('div.uploadProgress').attr('id');
		var myInpId = $(this).attr('id').replace('upldf_', '');
		var myContainer = $(this).parent().parent().parent();
		var callBack = "";
		var extrathumb = 0;

		if (typeof $(this).attr('callback') !== 'undefined' && $(this).attr('callback') !== false)
			callBack = $(this).attr('callback');

		if (typeof $(this).attr('extrathumb') !== 'undefined' && $(this).attr('extrathumb') !== false)
			extrathumb = $(this).attr('extrathumb');

		if($(this).hasClass('image')){
			fileType = "image";
			allowedFileTypes = uploadify_img_types;
			params = {
				fileType   : fileType,
				maxWidth   : 232,
				maxHeight  : 112,
				thumbWidth : 64,
				thumbHeight: 64,
				callBack   : callBack,
				extrathumb : extrathumb,
				folder     : folder
			};
		} else if($(this).hasClass('doc')){
			fileType = "doc";
			allowedFileTypes = uploadify_doc_types;
			params = {
				fileType   : fileType,
				folder     : folder,
				callBack   : callBack
			};
		}

		$(this).uploadify({
			'auto'      : true,
			'swf'  : '../assets/uploadify/uploadify.swf',
			'uploader'    : '/www/admin/api/api/uploadify/',
			'fileTypeExts' : allowedFileTypes,
			'buttonText'   : 'Select file',
			'checkExisting': false,
			'formData': params,
			'height'   : 30,
			'queueID'   : queue,
			'fileObjName': 'upload',
			'onUploadSuccess': function(file, data, response) {
				response = jQuery.parseJSON(data);
				if(!response.error){
					if(response.fileInfo.type == 'image')
						myContainer.find('div.thumb').html('');
					else
						myContainer.find('div.thumb').html('');
					myContainer.find('div.uploadifyData div.fileDetail').html(response.original);
					$('input#'+myInpId).val(response.original);
					if(response.callBack.length > 0){
						eval(callBack+"()");
					}
				} else{
					alert("An error occurred while saving the file, please try again");
				}
			}
		});

	});

	$('a.delattach').click(function(e){
		e.preventDefault();
		var delwhat = $(this).attr('id').split('_')[1];
		if(confirm("Are you sure you want to delete the attached file?")){
			$('div.upldr_'+delwhat+' input.filename').val('');
			$('div.upldr_'+delwhat+' div.thumb').html('');
			$('div.upldr_'+delwhat+' div.fileDetail').text('No file selected');
			$('div#showdel_'+delwhat).fadeOut();
		}
	});

});

function show_delpic_options(){
	$('div#showdel_imagename').fadeIn();
}

// Default functions for admin

$(document).ready(function(){

	$('div.pagination #anterior').on('click', function(e){
		e.preventDefault();
		if ( ! $(this).hasClass('disabled')) {
			$('form[name="filters_player"] input[name="page"]').val($(this).data('page'));
			$('form[name="filters_player"]').submit();
		}
	});

	$('div.pagination #siguiente').on('click', function(e){
		e.preventDefault();
		if ( ! $(this).hasClass('disabled')) {
			$('form[name="filters_player"] input[name="page"]').val($(this).data('page'));
			$('form[name="filters_player"]').submit();
		}
	});

	// logout
	$('.logout').click(function(){
		if( ! window.confirm($(this).attr('title')))
			return false;
	});

	// menu
	$("#menu a").each(function(i){
		var group = $(this).attr("class");
		var href = $("#submenu li."+group).eq(0).find("a").attr("href");
		$(this).attr("href", href);
	})
	.click(function(){
		var group = $(this).attr("class");
		var subitems = $("#submenu li."+group).length;
		if(subitems>1){
			$("#menu li").removeClass("selected");
			$("#menu a."+group).parent().addClass("selected");
			$("#submenu li").removeClass("visible");
			$("#submenu li."+group).addClass("visible");
			return false;
		}
	});

	// sort by column
	$("th.sortable").each(function(){
		$(this).attr("title", "Sort by "+$(this).text().toLowerCase());
		$(this).html("" + $(this).text() + "");
		if($(this).attr("abbr")==$("input[name='order_by']").val()){
			$(this).addClass($("input[name='sort']").val().toLowerCase());
		}
	});
	$("th.sortable span").click(function(){
		var sort = ($("input[name='sort']").val().toLowerCase()=="asc") ? "DESC" : "ASC";
		$("input[name='sort']").val(sort);
		$("input[name='order_by']").val($(this).parent().attr("abbr"));
		$("#filters").submit();
	});

	// search filters
	$("#filters button.submit").click(function(){
		$("input[name='page']").val(1);
	});

	// change page
	$("#pages ul a ").click(function(){
		var page = $(this).attr("href").replace("#page","");
		$("input[name='page']").val(page);
		$("#filters").submit();
		return false;
	});

	// select all items
	$("input[name='select_all']").click(function(){
		if($(this).is(":checked")){
			$("input[name='items[]']").attr("checked", "checked");
		} else {
			$("input[name='items[]']").attr("checked", false);
		}
	});

	// delete item from list
	$("td.delete a").click(function(){
		if(window.confirm("Are you sure you want to delete the selected item?")){
			$("#filters fieldset.hidden").append('<input type="hidden" name="csrf_token" value="'+$("#csrf_token").text()+'" />');
			$("#filters").get(0).setAttribute("action", $(this).attr("href"));
			$("#filters").attr("method", "post").submit();
		}
		return false;
	});

	// delete item from form
	$("#form a.delete").click(function(){
		if(window.confirm("Are you sure you want to delete this item?")){
			var action = $(this).attr("href") + '?id=' + $("#form input[name='id']").val();
			$("#form").get(0).setAttribute("action", action);
			$("#form").submit();
		}
		return false;
	});

	// delete item from modal form
	$("#modal-form").on("click", 'a.delete', function(){
		if(window.confirm("Are you sure you want to delete this item?")){
			var action = $("#modal-form").attr("action").replace("/details", "/delete");
			$("#modal-form").attr("action", action).submit();
		}
		return false;
	});

	// bulk actions
	$("#filters a.bulk").click(function(){
		var items_num = $("#filters input[name='items[]']:checked").length;
		if(items_num==0){
			alert("Please select at least one item");
		} else {
			if(window.confirm($(this).attr("title"))){
				$("#filters fieldset.hidden").append('<input type="hidden" name="csrf_token" value="'+$("#csrf_token").text()+'" />');
				$("#filters").get(0).setAttribute("action", $(this).attr("href"));
				$("#filters").attr("method", "post").submit();
			}
		}
		return false;
	});

	// cancel edit mode
	$("#form a.cancel").click(function(){
		history.back();
		return false;
	});

	// show/hide search filters
	$("a.filters").click(function(){
		if($("fieldset.filters").is(":hidden")){
			$(this).text("Hide search").addClass("visible");
			$("fieldset.filters").addClass("visible").show();
		} else {
			$(this).text("Show search").removeClass("visible");
			$("fieldset.filters").removeClass("visible").hide();
		}
		return false;
	});

	// form validation
	$("form.validate").submit(function(){
		var error = false;
		$("input.required, select.required, textarea.required").each(function(){
			if($.trim($(this).val())==""){
				alert("Please fill in this field");
				$(this).focus().addClass("error");
				error = true;
				return false;
			}
			if($(this).hasClass("email") && $.trim($(this).val())!="" && !$(this).val().isEmail()){
				alert("Please enter a valid email address");
				$(this).focus().addClass("error");
				error = true;
				return false;
			}
		});
		return !error;
	});
	$("input, select, textarea").bind("focus change keydown blur", function(){
		$(this).removeClass("error");
	});

	// flash messages
	$("div.warning, div.success, div.error").fadeOut().fadeIn().fadeOut().fadeIn();

	// date picker
//	$.datepicker.setDefaults( $.datepicker.regional[ "no" ] );
	$("input.date").datepicker({ dateFormat: "yy-mm-dd", firstDay: 1, changeMonth: true, changeYear: true, yearRange: '1940:2015' });

	// zebra tables
	$('table.zebra tr:even').addClass('even');

	// modal
	$("td.view a").click(function(){
		var url = $(this).attr("href");
		$("body").append('

');
		$("#overlay").show(function(){
			// load ajax
			$("#modal").addClass("loading").show(300, function(){
				$.get(url, function(data){
					$("#modal").removeClass("loading").append(data);
				});
			});
		});
		return false;
	});

	// close modal
	$(document).on("click", "img.close", function(){
		var new_token = $("#modal-form input[name='token']").val();
		$("#filters span.csrf_token").text(new_token);
		$("#modal").html("").hide(300, function(){
			$("#overlay").remove();
			$(this).remove();
		});
	});

	/*
	if ($("div.richtext textarea").length) {
		$("div.richtext textarea").tinymce({
			// Location of TinyMCE script
			script_url : '/assets/tiny_mce/tiny_mce.js',
			// General options
			theme : "advanced",
			language : "en",
			plugins : "imagemanager,safari,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template",
			// Theme options
			theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,bullist,numlist,|,outdent,indent,|,link,unlink,|,image,|,cleanup,code,|,justifyleft,justifycenter,justifyright,justifyfull",
			theme_advanced_buttons2 : "tablecontrols,|,formatselect,|,forecolor,backcolor",
			theme_advanced_buttons3 : "",
			theme_advanced_buttons4 : "",
//			theme_advanced_toolbar_location : "external",
			theme_advanced_toolbar_location : "top",
			theme_advanced_toolbar_align : "left",
			theme_advanced_statusbar_location : "bottom",
			theme_advanced_resizing : false,
			width: 800,
			content_css : '/assets/styles/ckeditor.css'
		});
	}
*/
	// init ckeditor
	/*
	if ($("div.richtext textarea").length) {
		$("div.richtext textarea").ckeditor({
			toolbar:
			[
				[ 'Bold','Italic','Underline','Strike','Subscript','Superscript' ],
				[ 'HorizontalRule','-','Link','Unlink','-','Image' ],
				[ 'NumberedList','BulletedList','-','Outdent','Indent','-','JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock' ],
				[ 'TextColor','BGColor' ],
				['Source']
			],
			language: 'es',
			width: 910,
			height: 400,
			filebrowserBrowseUrl : '/assets/filemanager/index.html',
		});
	}
	*/

	// modal
	$("td.inhome a").click(function(e){
		e.preventDefault();
		var url = $(this).attr("href");
		var mybtnimg = $(this).find('img');
		if(mybtnimg.attr('src').indexOf('_off')>=0){
			msg = "Are you sure you want to publish this entry to the Home page?";
			mynewimg = mybtnimg.attr('src').replace('_off.png', '.png');
		} else {
			msg = "Are you sure you want to unpublish this entry from the Home page?";
			mynewimg = mybtnimg.attr('src').replace('.png', '_off.png');
		}
		if(confirm(msg)){
			$.post(url, { upd: 1 }, function(data){
				console.log(data);
				mybtnimg.attr('src', mynewimg);
			}, 'json');
		}
	});

	$("[name=school_year_id]").change(function(){
		$("[name=asignature_id]").empty();
		$.getJSON("../materias", { school_year_id: $('[name=school_year_id]').val() },function(data){
            $("select[name=asignature_id]").append('<option value="">- Seleccione -</option>');
 			$(data).each(function(i){
                $("select[name=asignature_id]").append('<option value="'+this.id+'">'+this.asignature+'</option>');
 			});
        });
    });

});

String.prototype.isEmail = function(){
	return (this.valueOf().search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1);
}


text:
JAVA_HOME="/opt/java/jdk1.7.0_09"
export JAVA_HOME

# shutdown jetty
jetty/bin/jetty.sh stop

# clear logs
rm jetty/logs/*

# update source code
cd bootzooka
git pull

# wait 5 sec
sleep 5

# copy configuration file to proper location
cp /home/bootstrap/bootzooka/application.conf /home/bootstrap/bootzooka/bootzooka/bootzooka-rest/src/main/resources/

# package
sbt compile package

# deploy
cp bootzooka-ui/target/scala-2.10/bootzooka.war ../jetty/webapps/

# start jetty
cd ../
jetty/bin/jetty.sh start


text:
<TITLE>Review for Romeo + Juliet (1996)</TITLE>
<LINK REL="STYLESHEET" TYPE="text/css" HREF="/ramr.css">

Romeo + Juliet (1996)

reviewed by
James Berardinelli

                              ROMEO AND JULIET (1996)
                       A film review by James Berardinelli
                        Copyright 1996 James Berardinelli

RATING (0 TO 10): 7.5
Alternative Scale: *** out of ****

United States, 1996
U.S. Release Date: 11/1/96 (wide)
Running Length: 2:00
MPAA Classification: PG-13 (Mature themes, violence)
Theatrical Aspect Ratio: 2.35:1

Cast: Leonardo DiCaprio, Claire Danes, Brian Dennehy, John Leguizamo,
      Pete Postlethwaite, Paul Sorvino, Miriam Margolyes, Diane Venora,
      Harold Perrineau
Director: Baz Luhrmann
Producer: Gabriella Martinelli and Baz Luhrmann
Screenplay: Craig Pearce and Baz Luhrmann based on the play by
      William Shakespeare
Cinematography: Donald M. McAlpine
Music: Nellee Hooper
U.S. Distributor: Twentieth Century Fox

     In LOOKING FOR RICHARD, actor/director Al Pacino expressed his
greatest hope for the film -- that he could extend his enthusiasm for
the Bard's plays to a broader audience.  In a very different way, that's
what Baz Luhrmann (STRICTLY BALLROOM) is attempting to do with this
radical approach to "Romeo and Juliet".  Luhrmann hasn't fashioned this
motion picture with the stodgy, elitist Shakespeare "purist" in mind.
Instead, by incorporating lively, modern imagery with a throbbing rock
soundtrack and hip actors, he has taken aim at an audience that would
normally regard Shakespeare as a chore to be endured in school, not a
passionate drama to ignite the screen.

     Make no mistake, this ROMEO AND JULIET isn't the match of Franco
Zeffirelli's unforgettable 1968 classic.  While Leonardo DiCaprio and
Claire Danes make an effective couple, their romance doesn't burn with
the white-hot intensity of Leonard Whiting and Olivia Hussey's.
Nevertheless, this interpretation is so fundamentally different from
anything to have come before it that there's no danger of repetition.
By the same token, there have been two different "Richard III"s in the
past twelve months, and no one is complaining.

     For those who aren't aware, "Romeo and Juliet" tells the tale of
two "star-cross'd" teenage lovers who secretly fall for each other and
marry.  Their families, the Montagues and Capulets, have been fierce
enemies for decades, and, even as Romeo and Juliet say their wedding
vows, new violence breaks out between the clans.  In the end, their love
is doomed.  When Romeo mistakenly believes Juliet is dead, he poisons
himself.  And, when Juliet discovers that he is dead, she too commits
suicide.

     Luhrmann's ROMEO AND JULIET (properly titled WILLIAM SHAKESPEARE'S
ROMEO AND JULIET) takes the play and deposits it in a modern Verona
Beach that is part decaying Miami and part Mexico City.  By the
director's own admission, this is a created world, borrowing aspects of
its unique visual style from such diverse periods as the 1940s, 1970s,
and 1990s, and using a variety of classic films (most notably REBEL
WITHOUT A CAUSE) for inspiration.  Fast cars with roaring engines
replace horses.  Guns stand in for swords and daggers.  The resulting
hybrid background is startling.

     ROMEO AND JULIET's camera is restless, always moving.  There are
times when the rapid cuts and raging soundtrack might cause
understandable confusion between the movie and a rock video.  Indeed,
with all the camera tricks, special effects (such as a roiling storm),
and riotous splashes of color, it's easy to lose the story in the style.
Luhrmann's intent was never to drown Shakespeare's dialogue in
technique, but it happens, especially early in the film.  In the
process, the more subtle intangibles of the romance are irretrievably
lost.

     The movie settles down when Romeo (DiCaprio) and Juliet (Danes)
first come face-to-face, gazing at each other through the transparent
panes of an aquarium while a love ballad plays in the background.  It's
a delicately romantic moment whose magic is never quite matched by any
other scene in the film.  Danes makes a breathtaking Juliet, merging
strength and fragility into one.  DiCaprio isn't quite as successful as
Romeo; there are times when his delivery of Shakespeare's dialogue
sounds forced, and, on at least one occasion (when he learns about
Juliet's supposed death), he goes way over-the-top.

     The supporting cast has its share of successes and failures.  John
Leguizamo plays a particularly effective Tybalt, Juliet's Latino cousin.
Despite a terrible accent, Miriam Margolyes gives a delightful
interpretation of Juliet's nurse.  In a daring move that works, Harold
Perrineau's Mercutio is presented as a high-energy drag queen who gets a
chance to strut his stuff to a disco tune with Shakespearean lyrics.
Pete Postlethwaite (as Father Laurence) and Vondie Curtis-Hall (Captain
Prince) are both at ease in their roles.  Brian Dennehy's presence is,
as always, imposing, but, as Lord Montague, he doesn't have more than a
handful of lines.  Less successful are Paul Sorvino's cartoon-like
portrayal of Lord Capulet and Diane Verona's Blanche DuBois-flavored
version of his wife.  And a pair of characters, Paul Rudd's Paris and
Jesse Bradford's Balthasar, are so ineffectual that they're virtually
invisible.

     There are moments of comedy in Shakespeare's play, and Luhrmann
tries to transfer some of these over, in addition to adding a few of his
own.  One in particular, with Romeo ineptly scaling a trellis for the
famous balcony sequence, is ill-placed.  Also, there are times when the
director gets a little too cute.  A run-down theater in Verona is called
"The Globe" (the name of the locale where Shakespeare's plays were
originally performed), and the astute viewer will catch visual
references to "The Merchant of Verona Beach", "Rozencranzky's",
"Wherefore L'Amour", and "Out, Out Damn Spot Cleaners".

     Ultimately, no matter how many innovative and unconventional
flourishes it applies, the success of any adaptation of a Shakespeare
play is determined by two factors:  the competence of the director and
the ability of the main cast members.  Luhrmann, Danes, and DiCaprio
place this ROMEO AND JULIET in capable hands.  And, while such a loud,
brash interpretation may not go down in cinematic history as the
definitive version of the play, hopefully it will open a few eyes and
widen the audience willing to venture into any movie bearing the credit
"based on the play by William Shakespeare."

     Now, bring on Kenneth Branagh's HAMLET...

- James Berardinelli
e-mail: berardin@bc.cybernex.net
ReelViews web site: http://www.cybernex.net/~berardin

The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).

The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.

Please direct comments/criticisms of the review to relevant newsgroups.

Broken URLs inthe reviews are the responsibility of the author.

The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.

Related links: index of all rec.arts.movies.reviews reviews


text:
class ModelWithAssociations
  include Pupper::Model

  self.backend = :none

  attr_accessor :assoc_arrays, :assoc_vals, :assoc_id, :no_assoc_id, :assoc_hash

  has_one :assoc_hash, :assoc
  has_many :assoc_vals
end


text:
apiTest.controller('CategoriesController', function ($scope, $routeParams, appService) {
    $scope.categories = [];
    $scope.category = {};
    $scope.alert = {showAlert: false, alertClass: 'success', msg: ''};
    $scope.dataAvailable = true;

    appService.getData('categories', $routeParams.id).then(function (data) {
            console.log(data);
            $scope.category = data;
        },
        function (error) {
            $scope.alert = {showAlert: true, msg: error, alertClass: 'danger'};
        }
    );

    $scope.loadCategories = function () {
        appService.getData('categories').then(function (data) {
                angular.forEach(data, function (value) {
                    $scope.categories.push(value);
                });
            },
            function (error) {
                $scope.alert = {showAlert:true, msg: error, alertClass: 'danger'};
            }
        );
    };

    $scope.loadCategories();
});


text:
#import <GameController/GCGamepad.h>

#import "GCNamedProfile-Protocol.h"
#import "NSSecureCoding-Protocol.h"

@class GCController, NSString, _GCControllerButtonInput, _GCControllerDirectionPad;

// Not exported
@interface _GCGamepad : GCGamepad <GCNamedProfile, NSSecureCoding>
{
    GCController *_controller;
    id _valueChangedHandler;
    _GCControllerDirectionPad *_dpad;
    _GCControllerButtonInput *_button0;
    _GCControllerButtonInput *_button1;
    _GCControllerButtonInput *_button2;
    _GCControllerButtonInput *_button3;
    _GCControllerButtonInput *_leftShoulder;
    _GCControllerButtonInput *_rightShoulder;
}

+ (_Bool)supportsSecureCoding;
- (id)rightShoulder;
- (id)leftShoulder;
- (id)buttonY;
- (id)buttonX;
- (id)buttonB;
- (id)buttonA;
- (id)dpad;
- (void)setValueChangedHandler:(id)arg1;
- (id)valueChangedHandler;
- (id)controller;
- (void).cxx_destruct;
- (void)setController:(id)arg1;
- (void)setPlayerIndex:(long long)arg1;
@property(readonly) NSString *name;
- (id)initWithController:(id)arg1 dpadFlippedY:(_Bool)arg2;
- (id)initWithController:(id)arg1;
- (void)encodeWithCoder:(id)arg1;
- (id)initWithCoder:(id)arg1;
- (id)init;

@end


text:
@interface NVTitleBarView : UIView

-(id)initWithBridge: (RCTBridge *)bridge;

@end


text:
          Master Response Headers: {{request.masterRequestId}} ({{request.responseId}})

          {{request.outbound ? 'Inbound' : 'Outbound'}} Response Headers: {{request.responseId}}


text:
package com.kurotkin;

/**
 * Created by Vitaly Kurotkin on 17.08.2017.
 */
public interface Lists<T> {
    public void add (T value);
    public void remove(int index);
    public void clear();
    public int size();
}


text:
/*Fonts */

@font-face {
  font-family: "HelvBoldIBM";
  font-style: normal;
  font-weight: bold;
  src: url("//1.www.s81c.com/common/fonts/hni-bold.eot?#iefix") format("embedded-opentype"), url("//1.www.s81c.com/common/fonts/hni-bold.woff") format("woff"), url("//1.www.s81c.com/common/fonts/hni-bold.ttf") format("truetype"), url("//1.www.s81c.com/common/fonts/hni-bold.svg#HelvBoldIBM") format("svg");
}
@font-face {
  font-family: "HelvLightIBM";
  font-style: normal;
  src: url("//1.www.s81c.com/common/fonts/hni-light.eot?#iefix") format("embedded-opentype"), url("//1.www.s81c.com/common/fonts/hni-light.woff") format("woff"), url("//1.www.s81c.com/common/fonts/hni-light.ttf") format("truetype"), url("//1.www.s81c.com/common/fonts/hni-light.svg#HelvLightIBM") format("svg");
}
@font-face {
  font-family: 'HelvRegularIBM';
  src: url("//1.www.s81c.com/common/fonts/hni.eot");
  src: url("//1.www.s81c.com/common/fonts/hni.eot?#iefix") format("embedded-opentype"), url("//1.www.s81c.com/common/fonts/hni.woff") format("woff"), url("//1.www.s81c.com/common/fonts/hni.ttf") format("truetype"), url("//1.www.s81c.com/common/fonts/hni.svg#HelvRegularIBM") format("svg");
  font-weight: normal;
  font-style: normal
}

/*Main page */

* {
  box-sizing: border-box;
}
html {
  height: 100%;
}
body {
  height: 100%;
  margin: 0px;
  display: -ms-flexbox;
  display: flex;
  -ms-flex-direction: column;
  flex-direction: column;
  font-family: HelvRegularIBM;
  min-width: 960px;
}
svg {
  overflow: hidden;
}

/*Header*/

.header-container {
  background-color: #4A418C;
  color: white;
  height: 70px;
  position: fixed;
  width: 100%;
  z-index: 100;
}
.header-h1-title {
  padding-left: 64px;
  font-size: 1rem;
  margin: 0px;
  float: left;
  font-weight: normal;
  line-height: 70px;
  font-family: HelvBoldIBM;
}
.header-title-pronounce {
  font-weight: bold;
}

/*Search field*/

.entity-input-details {
  height: 35px;
  font-size: 18px;
  font-family: HelvRegularIBM;
}
.search-field {
  position: relative;
  float: right;
  margin-right: 118px;
  padding-top: 10px;
  border-bottom-style: solid;
  border-bottom-color: #FFFFFF;
  border-bottom-width: 1px;
  width: 288px;
}
.search-field input {
  margin-left: 40px;
  outline: none;
}
.search-field span {
  background: url("images/search_icon_small.svg") no-repeat;
  position: absolute;
  top: 18px;
  left: 10px;
  width: 18px;
  height: 18px;
  background-size: contain;
}

/*Main page*/

#entity-description {
  float: right;
  width: 288px;
  font-family: HelvRegularIBM;
  font-size: 16px;
}
.main-container {
  -ms-flex: 1;
  flex: 1;
  display: -ms-flexbox;
  display: flex;
  -ms-flex-direction: column;
  flex-direction: column;
  margin-top: 70px;
}

/*Loader*/

.ask-watson-loader {
  position: fixed;
  top: 70px;
  bottom: 0px;
  left: 0px;
  right: 0px;
  background-color: #F2F2F2;
}
.loader-holder {
  margin: -90px 0px 0px -60px;
  top: 50%;
  left: 50%;
  position: absolute;
}

.loader-fallback {
  display: none;
  width: 160px;
}

.ie .loader-fallback {
  display: inline;
}
.ie .loader-main {
  display: none;
}

/*Welcome page*/

.welcome-flex {
  display: -ms-flexbox;
  display: flex;
  -ms-flex: 1;
  flex: 1;
  -ms-flex-direction: column;
  flex-direction: column;
  background-color: #6854BF;
  color: #FFFFFF;
}
.welcome-box {
  margin: 130px auto;
  width: 800px;
  -ms-flex: 1;
  flex: 1;
}
.message-welcome-container {
  padding-bottom: 100px;
}
.message-welcome-strong {
  font-family: HelvBoldIBM;
}
.message-welcome {
  font-size: 24px;
  font-family: HelvLightIBM;
}
.entity-input {
  border-color: #FFFFFF;
  border-top: 0;
  border-right: 0;
  border-left: 0;
  border-bottom: 0;
  background-color: transparent;
  color: inherit;
}
.entity-input::-webkit-input-placeholder {
  color: #ddd;
}
.welcome-search-field {
  position: relative;
  border-color: #FFFFFF;
  border-bottom: 1px solid;
}
.welcome-search-field::-webkit-input-placeholder {
  color: #B9B7F9;
  font-family: HelvRegularIBM;
}
.welcome-search-field span {
  background: url("images/search_icon_small.svg") no-repeat;
  position: absolute;
  top: 38px;
  left: 10px;
  width: 40px;
  height: 40px;
  background-size: contain;
}
.entity-input-welcome {
  height: 100px;
  font-size: 60px;
  margin-left: 70px;
  outline: none;
  font-family: HelvRegularIBM;
}

/*Details page*/

.details-section-container > * {
  padding-left: 6%;
  padding-right: 6%;
}
.details-header-section {
  padding-top: 20px;
  background-color: #6854BF;
  color: white;
}
.details-header-title {
  margin: 0px;
  font-weight: normal;
  font-size: 60px;
  display: inline;
  font-family: HelvLightIBM;
}
.details-section-body {
  background-color: white;
  color: black;
}
.details-sticky-space {
  margin-top: 210px;
}
.details-card-title {
  border-bottom: medium solid black;
  padding-bottom: 10px;
  padding-top: 28px font-family: HelvBoldIBM;
  font-size: 18px;
}
.details-card-description {
  font-family: HelvLightIBM;
  font-size: 14px;
}

/*Date picker*/

.date-container {
  padding-top: 10px;
}
.fixed-date-container {
  background-color: #6854BF;
  position: fixed;
  top: 70px;
  left: 0px;
  right: 0px;
  padding-left: 6%;
  padding-right: 6%;
  z-index: 100;
}
.date-panel {
  padding-top: 25px;
}
.date-picker-label {
  font-size: 18px;
  font-family: HelvLightIBM;
}
.date-picker .axis path {
  fill: none;
  shape-rendering: crispEdges;
}
.date-picker .axis line {
  stroke: #FFFFFF;
}
.date-picker .brush .extent {
  shape-rendering: crispEdges;
  fill: #FFFFFF;
}
.date-picker .brush .background {
  visibility: visible !important;
  fill: #4A418C;
}
.date-picker .resize {
  display: inline !important;
  /* show when empty */
  fill: #666;
  fill-opacity: 1;
  stroke: #000;
  stroke-width: 1.5px;
}
.date-picker .axis text {
  font-family: HelvRegularIBM;
  font-size: 12px;
  font-weight: bold;
  fill: #FFFFFF;
}
.date-picker .days-postfix-text {
  font-family: HelvLightIBM;
  font-size: 10px;
}
.date-picker .arrow-handle {
  fill: #FCEE6B;
  stroke: transparent;
}

/*Summary row*/

.summary-row {
  display: -ms-flexbox;
  display: flex;
  -ms-flex-flow: row nowrap;
  flex-flow: row nowrap;
  overflow: hidden;
}
.summary-row > article {
  -ms-flex: 1;
  flex: 1;
}
.summary-row-first-item {
  margin-right: 50px;
}
.summary-row-second-item {
  margin-left: 50px;
}

/*Widgets in detail summary*/

.customer-sentiment-desc-container {
  padding-bottom: 30px;
}
.sentiment-balls .sentiment-circle {
  stroke: transparent;
}
.sentiment-balls .sentiment-percent {
  font-family: HelvBoldIBM;
}
.sources-desc-container {
  padding-bottom: 30px;
}

/*Top sources*/

.top-sources .source-rect {
  fill: transparent;
  stroke: black;
  stroke-width: 1px;
}
.top-sources .source-rect:hover {
  cursor: pointer;
}
.top-sources .hover-rect, .top-sources .clicked-rect {
  fill: #6854BF;
}
.top-sources .hover-text, .top-sources .clicked-text {
  fill: #FFFFFF;
}
.top-sources .source-count {
  font-family: HelvBoldIBM;
  font-size: 16px;
}
.top-sources .source-count:hover {
  cursor: pointer;
}
.top-sources .source-name {
  font-family: HelvLightIBM;
}

/*Articles and tones*/

.article-list-item {
  padding-top: 30px;
}
.article-table {
  margin-top: 20px;
}
.article-table .article-caption {
  border-bottom: 1px solid;
  font-family: HelvBoldIBM;
}
.article-table .article-cell {
  text-align: left;
  border-bottom: 1px solid;
  padding-top: 20px;
  padding-bottom: 20px;
  font-size: 14px;
  font-family: HelvLightIBM;
}

/*Topics chart*/

.topic-chart .ball-number {
  font-size: 11px;
  font-family: HelvBoldIBM;
}
.topic-chart .stick-text {
  font-size: 8px;
  font-family: HelvBoldIBM;
}
.topic-chart .circle-node:hover {
  cursor: pointer;
}
.topic-chart .circle-counter {
  fill: #FCEE6B;
}

/*Keywords or topics table*/

.topics-container {
  display: -ms-flexbox;
  display: flex;
  -ms-flex-flow: column nowrap;
  flex-flow: column nowrap;
  padding-top: 30px;
}
.topics-container > article {
  -ms-flex: 1;
  flex: 1;
}
.topics-desc-container {
  padding-bottom: 30px;
}
.keywords-table-container {
  width: 100%;
  border-collapse: collapse;
}
.keywords-table-container .keyword-row {
  text-align: left;
  font-family: HelvBoldIBM;
}
.keywords-table-container > thead {
  border-bottom: 1pt solid black;
}
.keywords-table-container > tbody {
  border-bottom: 1pt solid black;
}
.keywords-table-container .keyword-heading {
  font-weight: normal;
  font-size: 14px;
  padding-bottom: 10px;
  text-align: left;
  font-weight: HelvLightIBM;
}
.keywords-table-container .keyword-row > td {
  cursor: pointer;
}
.keywords-table-container .data-column-entry {
  padding: 15px;
  font-size: 16px;
}
.keywords-table-container .sentiment-chart-container {
  -ms-flex: 1 1 0%;
  flex: 1 1 0%;
  margin: 0 auto;
  margin-bottom: 20px;
}
.keywords-table-container .sentiment-column-positive:before {
  content: "\2b";
  font-size: 40px;
  color: #41D6BD;
}
.keywords-table-container .sentiment-column-negative:before {
  content: "\2212";
  font-size: 40px;
  color: #FF7461;
}
.keywords-table-container .carrot {
  background: url("images/chevron_arrow-01.svg") no-repeat;
  margin-left: 10px;
  width: 18px;
  height: 18px;
  background-size: contain;
}
.keywords-table-container .carrot-expanded {
  transform: rotate(180deg);
}

/*Sentiment time multi line chart  */

.sentimentTimeLineChart-tooltip {
  position: absolute;
  text-align: center;
  padding-top: 10px;
  width: 50px;
  height: 28px;
  color: white;
  font-size: 12px;
  font-family: HelvBoldIBM;
  pointer-events: none;
}
.sentimentTimeLineChart-tooltip:after {
  display: inline;
  width: 100%;
  line-height: 1;
  content: "\25BC";
  position: absolute;
  text-align: center;
  margin-top: -3px;
  top: 100%;
  left: 0;
}
.sentimentTimeLineChart-tooltip-positive {
  background-color: #41D6BD;
}
.sentimentTimeLineChart-tooltip-positive:after {
  color: #41D6BD;
}
.sentimentTimeLineChart-tooltip-negative {
  background-color: #FF7461;
}
.sentimentTimeLineChart-tooltip-negative:after {
  color: #FF7461;
}
.sentimentTimeLineChart .axis path, .sentimentTimeLineChart .axis line {
  fill: none;
  stroke: grey;
  stroke-width: 1;
  shape-rendering: auto;
}
.sentimentTimeLineChart .line {
  fill: none;
  stroke-width: 2px;
}
.sentimentTimeLineChart .line-points {
  fill: #FFFFFF;
  stroke-width: 2px;
}
.sentimentTimeLineChart .positive {
  stroke: #41D6BD;
}
.sentimentTimeLineChart .negative {
  stroke: #FF7461;
}
.sentimentTimeLineChart .legend-text {
  font-size: 10px;
}
.sentimentTimeLineChart .axis {
  font-family: HelvBoldIBM;
  font-size: 14px;
}
.sentimentTimeLineChart .y-axis-label {
  font-family: HelvLightIBM;
  font-size: 14px;
}
.footer-section {
  background-color: #6854BF;
  color: #FFFFFF;
  padding: 10px 0px 10px 0px;
}
.footer-section > a {
  color: inherit;
  text-decoration: none;
  font-size: 0.8em;
}
@media only screen and (max-width: 960px) {
  .header-container {
    position: relative;
  }
  .main-container {
    margin-top: 0px;
  }
  .fixed-date-container {
    background-color: inherit;
    position: inherit;
    top: 0px;
    left: 0px;
    right: 0px;
    padding: 0px;
  }
}


text:
var get = Ember.get, set = Ember.set;
var env, Person, Phone, App;

module("integration/adapter/fixture_adapter - DS.FixtureAdapter", {
  setup: function() {
    Person = DS.Model.extend({
      firstName: DS.attr('string'),
      lastName: DS.attr('string'),

      height: DS.attr('number'),

      phones: DS.hasMany('phone', { async: true })
    });

    Phone = DS.Model.extend({
      person: DS.belongsTo('person')
    });

    env = setupStore({ person: Person, phone: Phone, adapter: DS.FixtureAdapter });
    env.adapter.simulateRemoteResponse = true;

    // Enable setTimeout.
    Ember.testing = false;

    Person.FIXTURES = [];
    Phone.FIXTURES = [];
  },
  teardown: function() {
    Ember.testing = true;

    env.container.destroy();
  }
});

test("should load data for a type asynchronously when it is requested", function() {
  Person.FIXTURES = [{
    id: 'wycats',
    firstName: "Yehuda",
    lastName: "Katz",

    height: 65
  },

  {
    id: 'ebryn',
    firstName: "Erik",
    lastName: "Brynjolffsosysdfon",

    height: 70,
    phones: [1, 2]
  }];

  Phone.FIXTURES = [{
    id: 1,
    person: 'ebryn'
  }, {
    id: 2,
    person: 'ebryn'
  }];

  env.store.find('person', 'ebryn').then(async(function(ebryn) {
    equal(get(ebryn, 'isLoaded'), true, "data loads asynchronously");
    equal(get(ebryn, 'height'), 70, "data from fixtures is loaded correctly");

    return Ember.RSVP.hash({ ebryn: ebryn, wycats: env.store.find('person', 'wycats') });
  }, 1000)).then(async(function(records) {
    equal(get(records.wycats, 'isLoaded'), true, "subsequent requests for records are returned asynchronously");
    equal(get(records.wycats, 'height'), 65, "subsequent requested records contain correct information");

    return get(records.ebryn, 'phones');
  }, 1000)).then(async(function(phones) {
    equal(get(phones, 'length'), 2, "relationships from fixtures is loaded correctly");
  }, 1000));
});

test("should load data asynchronously at the end of the runloop when simulateRemoteResponse is false", function() {
  Person.FIXTURES = [{
    id: 'wycats',
    firstName: "Yehuda"
  }];

  env.adapter.simulateRemoteResponse = false;

  var wycats;

  Ember.run(function() {
    env.store.find('person', 'wycats').then(function(person) {
      wycats = person;
    });
  });

  ok(get(wycats, 'isLoaded'), 'isLoaded is true after runloop finishes');
  equal(get(wycats, 'firstName'), 'Yehuda', 'record properties are defined after runloop finishes');
});

test("should create record asynchronously when it is committed", function() {
  equal(Person.FIXTURES.length, 0, "Fixtures is empty");

  var paul = env.store.createRecord('person', {firstName: 'Paul', lastName: 'Chavard', height: 70});

  paul.on('didCreate', async(function() {
    equal(get(paul, 'isNew'), false, "data loads asynchronously");
    equal(get(paul, 'isDirty'), false, "data loads asynchronously");
    equal(get(paul, 'height'), 70, "data from fixtures is saved correctly");

    equal(Person.FIXTURES.length, 1, "Record added to FIXTURES");

    var fixture = Person.FIXTURES[0];

    ok(typeof fixture.id === 'string', "The fixture has an ID generated for it");
    equal(fixture.firstName, 'Paul');
    equal(fixture.lastName, 'Chavard');
    equal(fixture.height, 70);
  }));

  paul.save();
});

test("should update record asynchronously when it is committed", function() {
  equal(Person.FIXTURES.length, 0, "Fixtures is empty");

  var paul = env.store.push('person', { id: 1, firstName: 'Paul', lastName: 'Chavard', height: 70});

  paul.set('height', 80);

  paul.on('didUpdate', async(function() {
    equal(get(paul, 'isDirty'), false, "data loads asynchronously");
    equal(get(paul, 'height'), 80, "data from fixtures is saved correctly");

    equal(Person.FIXTURES.length, 1, "Record FIXTURES updated");

    var fixture = Person.FIXTURES[0];

    equal(fixture.firstName, 'Paul');
    equal(fixture.lastName, 'Chavard');
    equal(fixture.height, 80);
  }, 1000));

  paul.save();
});

test("should delete record asynchronously when it is committed", function() {
  stop();

  var timer = setTimeout(function() {
    start();
    ok(false, "timeout exceeded waiting for fixture data");
  }, 1000);

  equal(Person.FIXTURES.length, 0, "Fixtures empty");

  var paul = env.store.push('person', { id: 'paul', firstName: 'Paul', lastName: 'Chavard', height: 70 });

  paul.save().then(function(){
    paul.deleteRecord();
    paul.save();
  });

  paul.on('didDelete', function() {
    clearTimeout(timer);
    start();

    equal(get(paul, 'isDeleted'), true, "data deleted asynchronously");
    equal(get(paul, 'isDirty'), false, "data deleted asynchronously");

    equal(Person.FIXTURES.length, 0, "Record removed from FIXTURES");
  });

});

test("should follow isUpdating semantics", function() {
  var timer = setTimeout(function() {
    start();
    ok(false, "timeout exceeded waiting for fixture data");
  }, 1000);

  stop();

  Person.FIXTURES = [{
    id: "twinturbo",
    firstName: "Adam",
    lastName: "Hawkins",
    height: 65
  }];

  var result = env.store.findAll('person');

  result.then(function(all) {
    clearTimeout(timer);
    start();
    equal(get(all, 'isUpdating'), false, "isUpdating is set when it shouldn't be");
  });
});

test("should coerce integer ids into string", function() {
  Person.FIXTURES = [{
    id: 1,
    firstName: "Adam",
    lastName: "Hawkins",
    height: 65
  }];

  env.store.find('person', 1).then(async(function(result) {
    strictEqual(get(result, 'id'), "1", "should load integer model id as string");
  }));
});

test("should coerce belongsTo ids into string", function() {
  Person.FIXTURES = [{
    id: 1,
    firstName: "Adam",
    lastName: "Hawkins",

    phones: [1]
  }];

  Phone.FIXTURES = [{
    id: 1,
    person: 1
  }];

  env.store.find('phone', 1).then(async(function(result) {
    var person = get(result, 'person');
    person.one('didLoad', async(function() {
      strictEqual(get(result, 'person.id'), "1", "should load integer belongsTo id as string");
      strictEqual(get(result, 'person.firstName'), "Adam", "resolved relationship with an integer belongsTo id");
    }));
  }));
});

test("only coerce belongsTo ids to string if id is defined and not null", function() {
  Person.FIXTURES = [];

  Phone.FIXTURES = [{
    id: 1
  }];

  env.store.find('phone', 1).then(async(function(phone) {
    equal(phone.get('person'), null);
  }));
});

test("should throw if ids are not defined in the FIXTURES", function() {
  Person.FIXTURES = [{
    firstName: "Adam",
    lastName: "Hawkins",
    height: 65
  }];

  raises(function(){
    env.store.find('person', 1);
  }, /the id property must be defined as a number or string for fixture/);

  Person.FIXTURES = [{
    id: 0
  }];

  env.store.find('person', 0).then(async(function() {
    ok(true, "0 is an acceptable ID, so no exception was thrown");
  }), function() {
    ok(false, "should not get here");
  });
});


text:
This is a simple executable wrapper to allow Vagrant to run ansible commands on windows through to a configured cygwin environment. There are a few [threads](http://stackoverflow.com/questions/29743491/how-to-install-ansible-playbook-on-windows-as-host-with-vagrant) out there that document the use of batch files to bootstrap ansible but I found the windows command shell does not actually work properly when using `--extra-vars` for instance.

We assume you have installed a working cygwin shell on your workstation.

## Wrapper Configuration

The wrapper must be able to find the installed cygwin environment. By default it assumes the cygwin home is `c:\cygwin`. If your cygwin is installed in a different location there are 2 options available to tell the wrapper where to find the cygwin environment.

1. Using the `CYGWIN_HOME` Environment Variable

```sh
export CYGWIN_HOME=c:\\cygwin64
```

2. Using the `cygwin.ini` File

The wrapper will look into the directory of the wrapper executable for a `cygwin.ini` file that contains the below ini information.

```ini
[cygwin]
home=c:\cygwin64
```
## Installing Ansible on Cygwin

This section describes the installation steps required to install Cygwin and Ansible on Windows.

### Install Cygwin

Use the cygwin package installer from https://cygwin.com/ and install the following packages:

```sh
setup-x86_64.exe -q -P binutils,^
                       gcc-core,^
                       make,^
                       python,^
                       python-setuptools,^
                       python-devel,^
                       libtool,^
                       libuuid-devel,^
                       libffi-devel,^
                       python-cffi,^
                       libcrypt-devel,^
                       python-crypto,^
                       openssl,^
                       openssl-devel,^
                       python-openssl,^
                       openssh,^
                       gmp,^
                       libgmp-devel,^
                       curl,^
                       wget,^
                       nano
```

or using `apt-cyg`

```sh
$ apt-cyg install binutils \
          gcc-core \
          make \
          python \
          python-setuptools \
          python-devel \
          libtool \
          libuuid-devel \
          libffi-devel \
          python-cffi \
          libcrypt-devel \
          python-crypto \
          openssl \
          openssl-devel \
          python-openssl \
          openssh \
          gmp \
          libgmp-devel \
          curl \
          wget \
          nano
```

Now you should have a basic cygwin python environment that can be used to install ansible in.

### Configure Python Environment

First lets open up a cygwin terminal and install `pip`

```sh
$ easy_install-2.7 pip
```

Thereafter we will update `pip`, `setuptools` and also install `wheel` and `virtualenv`.

```sh
$ pip install -U pip setuptools wheel virtualenv
```

### Install Ansible

Before installing Ansible, you will need to install its dependency `PyNaCL` with additional compiler flags.

```sh
ARCHFLAGS="-arch x86_64" \
LDFLAGS="-L/usr/lib" \
CFLAGS="-I/usr/include/openssl -g -O2 -D_BSD_SOURCE" pip install -v -v -v -U pynacl
```

Now lets install ansible and its dependencies.

```sh
$ pip install -U ansible
```

Quick test to ensure it works.

```sh
$ ansible --version
ansible 2.4.3.0
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.14 (default, Oct 31 2017, 21:12:13) [GCC 6.4.0]
```

### Configure Vagrant Environment to work with Ansible

To bridge Vagrant on windows to Ansible on Cygwin we can now use the Ansible Wrapper for Windows binary. The Vagrant Ansible provisionser will use the Vagrant windows environment to load the `ansible-playbook` executable. So we need to ensure Vagrant will find the wrapper executable to hand off to the Cygwin envionment.

Simply copy the `ansible-win-wrapper.exe` into the same folder of the `vagrant.exe` and rename it to `ansible-playbook.exe`.

```cmd
copy ansible-win-wrapper C:\HashiCorp\Vagrant\bin\ansible-playbook.exe

c:\> vagrant --version
Vagrant 2.0.1

c:\> ansible-playbook --version
ansible-playbook 2.4.3.0
  config file = None
  configured module search path = [u'/cygdrive/c/Users/fred/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible-playbook
  python version = 2.7.14 (default, Oct 31 2017, 21:12:13) [GCC 6.4.0]

```

Et voilà, ansible-playbook should now work from vagrant.

Make sure that when you install vagrant plugins to use the command line shell else the ruby gems from your Cygwin environment and from the vagrant embedded msys environment get all mixed up. Check that your Windows command shell `PATH` variable contains the `c:\HashiCorp\Vagrant\bin` path for vagrant to work correctly.

Below an example of how to install 2 of the most commonly used plugins.

```batch
c:\> vagrant plugin install vagrant-vbguest

c:\> vagrant plugin install vagrant-hostmanager
```

### Fix Vagrant SSH Bug

Some SSH arguments used by ansible playbook shell commands are hardcoded in Vagrant and cannot be overridden by `ansible.cfg` settings. In particular it will override the `control_path = none` setting in `ansible.cfg` with a hardcoded `-o ControlMaster=auto` shell ssh parameter.

As of 2018 setting up persistent ssh transactions is [not possible on Windows](http://stackoverflow.com/questions/20959792/is-ssh-controlmaster-with-cygwin-on-windows-actually-possible). To disable ControlMaster, either comment out line 314 in `$VAGRANT_HOME/embedded/gems/gems/vagrant-2.0.1/plugins/provisioners/ansible/provisioner/host.rb` or change it to `ControlMaster=none` or to `ControlMaster=no` for OpenSSH SSH v7.+ executables.

```rb
# which are lost when ANSIBLE_SSH_ARGS is defined.
unless ssh_options.empty?
  ssh_options << "-o ControlMaster=no"
  # DISABLE ssh_options << "-o ControlPersist=60s"
  # Intentionally keep ControlPath undefined to let ansible-playbook
  # automatically sets this option to Ansible default value
end
```

### Test Example

Setup a Vagrant project folder with a few basic files. I use cygwin terminal for simplicity but you can also do all of this in windows command or powershell.

```sh
$ mkdir ~/vagrant-test
$ cd ~/vagrant-test
```

All 4 files listed below go into the project folder.

**`Vagrantfile`**

A basic Vagrant machine definition with ansible provisioner configuration.

```rb
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|

  config.vm.box = "hashicorp/precise64"

  config.vm .provision "ansible" do |ansible|
    ansible.verbose = "v"
    ansible.limit = "all"
    ansible.inventory_path = "./inventory"
    ansible.playbook = "playbook.yml"
  end

end
```

**`ansible.cfg`**

Ansible default configuration with some Windows specific config.

```properties
[defaults]
# default inventory file
inventory = ./inventory

# disable retry
retry_files_enabled = False

# disable host checking
host_key_ckecking = False
record_host_keys = False

[ssh_connection]
# below does not seem to work anymore so adding ssh args as is
ssh_args = -o ControlMaster=no -o UserKnownHostsFile=/dev/null -oStrictHostKeyChecking=no -o IdentitiesOnly=yes

# ControlMaster on cygwin OpenSSH does not work, must disable it
# otherwise ansible will not be able to connect to the target host
# control_path = none
```

**`inventory`**

Need to create an ansible inventory definition, the default Vagrant generated one does not work, vagrants ansible provisioner generates a inventory path arg that is Windows but must POSIX for ansible to work properly, so we just cheat a little.

```properties
default ansible_ssh_host=127.0.0.1 ansible_ssh_port=2222 ansible_ssh_user=vagrant ansible_ssh_private_key_file=./.vagrant/machines/default/virtualbox/private_key
```

Note: You may need to adjust the `ansible_ssh_port` to whatever the Vagrant machine bound to. You can get around all this by using a DNS plugin like `vagrant-hostmanager` and then just define actual DNS resolvable vagrant machine names in the inventory.

Also may need to `$ chmod 0644 inventory` depending on how your cygwin fstab is setup, ansible may complain about +x permissions.

**`playbook.yml`**

```yaml
---
- hosts: all
  tasks:
  - name: Greetings
    debug: msg="Hello Ansible from Vagrant {{ ansible_system }} {{ ansible_distribution }}"
  - name: Whats under the Hood
    command: uname -a
```

Lets run it:

```sh
$ vagrant up --no-provision

Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'hashicorp/precise64'...
...
==> default: Forwarding ports...
    default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2222
...
==> default: Machine booted and ready!
```

```sh
$ vagrant provision
==> default: Running provisioner: ansible...
Windows is not officially supported for the Ansible Control Machine.
Please check https://docs.ansible.com/intro_installation.html#control-machine-requirements
    default: Running ansible-playbook...

PLAY [all] *******************************************************************************************************************************************************************************************************

TASK [Gathering Facts] *******************************************************************************************************************************************************************************************
ok: [default]

TASK [Greetings] *************************************************************************************************************************************************************************************************
ok: [default] => {
    "msg": "Hello Ansible from Vagrant Linux Mandriva"
}

TASK [Whats under the Hood] **************************************************************************************************************************************************************************************
changed: [default] => {"changed": true, "cmd": ["uname", "-a"], "delta": "0:00:00.001658", "end": "2018-02-04 04:06:48.369022", "rc": 0, "start": "2018-02-04 04:06:48.367364", "stderr": "", "stderr_lines": [], "stdout": "Linux precise64 3.2.0-23-generic #36-Ubuntu SMP Tue Apr 10 20:39:51 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux", "stdout_lines": ["Linux precise64 3.2.0-23-generic #36-Ubuntu SMP Tue Apr 10 20:39:51 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux"]}

PLAY RECAP *******************************************************************************************************************************************************************************************************
default                    : ok=3    changed=1    unreachable=0    failed=0
```

### Random Historic Notes

#### Installing Crypto Dependencies

There also used to be a problem installing Ansible's dependency `pycrypto`. If you have an up-to-date version of Cygwin and its packages installed, you are fine. However if there are problems with `pycrypto`, here 2 options to install it on Cygwin.

Install pycrypto via pip using below compiler flag:

```sh
CFLAGS="-g -O2 -D_BSD_SOURCE" pip install -U pycrypto
```

or just compile it from sources:

```sh
mkdir -p ~/workspaces/python && cd ~/workspaces/python
# download and unpack pycrypto 2.6.1 sources
curl https://ftp.dlitz.net/pub/dlitz/crypto/pycrypto/pycrypto-2.6.1.tar.gz | tar xzvf -

# compile disabling BSD source
cd pycrypto-2.6.1
CFLAGS="-g -O2 -D_BSD_SOURCE" python setup.py build build_ext -DMS_WIN64

# install module
python setup.py install
```

#### Vagrant Ansible Provisioner Bug Fix (version 1.8.x only)

This one is not to be missed, Vagrant does not send extra args in json format properly to ansible on Windows. Some discussion documented [here](https://github.com/mitchellh/vagrant/issues/6726).

Basically when providing any additional playbook parameters as a hash in Vagrant using the `extra_args` configuration option, this data is not sent in the right format to the ansible playbook.

```rb
ansible.extra_vars = {
  my_special_param: Array.new(2){ |n| "#{(1 + n).to_s.rjust(2,'0')}" }
}
```

Expected:

`--extra-vars='{ \"my_special_param\":[\"01\",\"02\"] }'`

Actual:

`--extra-vars={my_special_param:[01,02]}`

This problem is caused by the way the JSON is generated for a ruby hash.

The first problem is that the generated json does not escape the double quotes which will get lost in the Subprocess call out.

The other problem is that `ansible-playbook` is very picky in the way it receives and parses the json in the `--extra-vars` argument. In particular it expects a space after the opening bracket `{` and a space before the closig bracket `}`.

What did the trick for me was to apply this hack to the following vagrant file `$VAGRANT_HOME/embedded/gems/gems/vagrant-1.8.7/plugins/provisioners/ansible/provisioner/base.rb`, obviously this will void your warranty but it works.

```rb
def extra_vars_argument
  if has_an_extra_vars_file_argument
    # A JSON or YAML file is referenced.
    config.extra_vars
  else
    # Expected to be a Hash after config validation.
    config.extra_vars.to_json.gsub('{', '{ ').gsub('}', ' }').gsub('"', '\\\"') # << the hacked line fixes space of the curlies and escapes the double quotes
  end
end
```


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

<feed xmlns="http://www.w3.org/2005/Atom">
    <title type="text">{{config.blog_name}}</title>
    <subtitle type="html">{{config.slogan}}</subtitle>
    <updated>{{updated|date("%Y-%m-%dT%H:%M:%SZ")}}</updated>
    <id>tag:{{config.host}},2009:atom.xml</id>
    <link rel="alternate" type="text/html" hreflang="en" href="http://{{config.host}}/" />
    <link rel="self" type="application/atom+xml" href="http://{{config.host}}/feeds/atom.xml" />
    <link rel="hub" href="{{config.hubbub_hub_url}}" />
    <rights>Copyright (c) 2009</rights>
    <generator uri="http://{{config.host}}/" version="1.0">
        Blog-O-Kay 1.0
    </generator>
    {% for post in posts %}
    <entry>
        <title>{{post.title|e}}</title>
        <link rel="alternate" type="text/html" href="http://{{config.host}}{{post.path}}" />
        <id>tag:{{config.host}},2009:post:{{post.key().id()}}</id>
        <updated>{{post.updated|date("%Y-%m-%dT%H:%M:%SZ")}}</updated>
        <published>{{post.published|date("%Y-%m-%dT%H:%M:%SZ")}}</published>
        <author>
            <name>{{config.author_name}}</name>
            <uri>http://{{config.host}}/</uri>
        </author>
        <content type="html">
            {{post.body|e}}
        </content>
    </entry>
    {% endfor %}
</feed>


text:
var gulp = require('gulp'), concat = require('gulp-concat'), uglify = require('gulp-uglify'),
    // jade = require('gulp-jade'),
    less = require('gulp-less'), path = require('path'),
    livereload = require('gulp-livereload'),  // Livereload plugin needed:
    // https://chrome.google.com/webstore/detail/livereload/jnihajbhpnppcggbcgedagnkighmdlei
    // marked = require('marked'), // For :markdown filter in jade
    path = require('path'), changed = require('gulp-changed'), prettify = require('gulp-html-prettify'),
    w3cjs = require('gulp-w3cjs'), rename = require('gulp-rename'),
    // flip = require('css-flip'),
    through = require('through2'), gutil = require('gulp-util'), htmlify = require('gulp-angular-htmlify'),
    minifyCSS = require('gulp-minify-css'), gulpFilter = require('gulp-filter'), expect = require('gulp-expect-file'),
    gulpsync = require('gulp-sync')(gulp), ngAnnotate = require('gulp-ng-annotate'),
    sourcemaps = require('gulp-sourcemaps'), del = require('del'), jsoncombine = require('gulp-jsoncombine'),
    ngConstant = require('gulp-ng-constant'), argv = require('yargs').argv, foreach = require('gulp-foreach'),
    gcallback = require('gulp-callback'), changeCase = require('change-case'),
    tag_version = require('gulp-tag-version'), PluginError = gutil.PluginError;

// LiveReload port. Change it only if there's a conflict
var lvr_port = 35729;

var W3C_OPTIONS = {
  // Set here your local validator if your using one. leave it empty if not
  // uri: 'http://validator/check',
  doctype: 'HTML5',
  output: 'json',
  // Remove some messages that angular will always display.
  filter: function(message) {
    if (/Element head is missing a required instance of child element title/.test(message)) return false;
    if (/Attribute .+ not allowed on element .+ at this point/.test(message)) return false;
    if (/Element .+ not allowed as child of element .+ in this context/.test(message)) return false;
    if (/Comments seen before doctype./.test(message)) return false;
  }
};

// production mode (see build task)
var isProduction = false;
var useSourceMaps = false;

// ignore everything that begins with underscore
var hidden_files = '**/_*.*';
var ignored_files = '!' + hidden_files;

var component_hidden_files = '**/js/**/*.*';
var component_ignored_files = '!' + component_hidden_files;

// VENDOR CONFIG
var vendor = {
  // vendor scripts required to start the app
  base: {source: require('./vendor.base.json'), dest: '../app/assets/js', name: 'base.js'},
  // vendor scripts to make to app work. Usually via lazy loading
  app: {source: require('./vendor.json'), dest: '../app/vendor'}
};

// SOURCES CONFIG
var source = {
  scripts: {
    app: [
      'js/app.preinit.js',
      'js/app.init.js',
      'js/app.config.js',
      'js/app.directive.js',
      'js/app.run.js',
      'js/app.service.js',
      'js/app.provider.js',
      'js/tabs.js',
      'js/sections.js',
      'shared/config/generated-config.js',
      'shared/js/modules/*.js',
      'shared/js/modules/controllers/*.js',
      'shared/js/modules/directives/*.js',
      'shared/js/modules/services/*.js',
      'components/*/js/**/*.js'
    ],
    watch: ['manifest.json', 'js/**/*.js', 'shared/**/*.js', 'components/*/js/**/*.js']
  },
  // templates: {
  //   app: {
  //       files : ['jade/index.jade'],
  //       watch: ['jade/index.jade', hidden_files]
  //   },
  //   views: {
  //       files : ['jade/views/*.jade', 'jade/views/**/*.jade', ignored_files],
  //       watch: ['jade/views/**/*.jade']
  //   },
  //   pages: {
  //       files : ['jade/pages/*.jade'],
  //       watch: ['jade/pages/*.jade']
  //   }
  // },

  styles: {
    app: {
      // , 'components/*/less/*.less'
      source: ['less/app/base.less', 'components/*/less/*.less'],
      dir: ['less/app', 'components'],
      watch: ['less/*.less', 'less/**/*.less', 'components/**/less/*.less', 'components/**/less/**/*.less']

    }
  },

  components: {
    source: [
      'components/**/*.*',
      component_ignored_files,
      '!components/**/config/*.*',
      '!master/shared/js/modules/config.js',
      '!components/*/less/*.*',
      '!components/**/less/**/*.*',
      '!components/**/README.md'
    ],
    dest: 'components',
    watch: [
      'components/**/*.*',
      component_ignored_files,
      '!components/**/config/*.*',
      '!master/shared/js/modules/config.js',
      '!components/**/less/*.*'
    ]
  },

  config: {
    watch: [
      'shared/config/development.json',
      'shared/config/production.json',
      'shared/config/development.json',
      'shared/config/production.json'
    ],
    dest: 'shared/config'
  },

  assets: {source: ['shared/assets/**/*.*'], dest: 'shared/assets', watch: ['shared/assets/**/*.*']}

  //,
  // bootstrap: {
  //   main: 'less/bootstrap/bootstrap.less',
  //   dir:  'less/bootstrap',
  //   watch: ['less/bootstrap/*.less']
  // }
};

// BUILD TARGET CONFIG
var build = {
  scripts: {app: {main: 'app.js', dir: '../app/assets/js'}},
  assets: '../app/shared/assets',
  styles: '../app/assets/css',
  components: {dir: '../app/components'}
};

function stringSrc(filename, string) {
  var src = require('stream').Readable({objectMode: true});
  src._read = function() {
    this.push(new gutil.File({cwd: "", base: "", path: filename, contents: new Buffer(string)}));
    this.push(null);
  };
  return src;
}

//---------------
// TASKS
//---------------

var manifestDirectory = function(manifestFile) {
  return manifestFile.relative.slice(0, '/manifest.json'.length * -1);
};

gulp.task('bundle-manifest', function() {
  var components = [];
  var namespace = [];
  gulp.src('./components/*/manifest.json')
      .pipe(foreach (function(stream, file) {
        var component = manifestDirectory(file);
        components.push(component);
        namespace.push(changeCase.camelCase(component));
        return stream;
      }))
      .pipe(gcallback(function() {
        var tabs = [];
        components.forEach(function(component) {
          tabs.push({component: component, title: changeCase.titleCase(component)});
        });
        stringSrc("tabs.js", 'app.value("tabs", ' + JSON.stringify(tabs) + ');').pipe(gulp.dest("js"));
        var _appNS = 'kubernetesApp.components.';
        var _appSkeleton = require('./js/app.skeleton.json');
        stringSrc("app.preinit.js",
                  _appSkeleton.appSkeleton.replace('%s', '"' + _appNS + namespace.join('", "' + _appNS) + '"'))
            .pipe(gulp.dest("js"));
      }));
});

gulp.task('bundle-manifest-routes', function() {
  var sections = [];
  gulp.src('./components/*/manifest.json')
      .pipe(foreach (function(stream, file) {
        var component = manifestDirectory(file);
        var manifestFile = require(file.path);
        var routes = [];
        if (manifestFile.routes) {
          manifestFile.routes.forEach(function(r) {
            // Hacky deep copy. Modifying manifestFile here will be repeated
            // each time the task is called (consider watch/reload) due to
            // cached file reads.
            var route = JSON.parse(JSON.stringify(r));
            if (route.url) {
              route.url = '/' + component + route.url;
            }
            routes.push(route);
          });
        }
        sections = sections.concat(routes);
        return stream;
      }))
      .pipe(gcallback(function() {
        var output_sections = JSON.stringify(sections);
        var _file_contents = 'app.constant("manifestRoutes", ' + output_sections + ');\n';
        stringSrc("sections.js", _file_contents).pipe(gulp.dest("js"));
      }));
});

// JS APP
gulp.task('scripts:app', ['bundle-manifest', 'bundle-manifest-routes', 'config', 'scripts:app:base']);

// JS APP BUILD
gulp.task('scripts:app:base', function() {
  // Minify and copy all JavaScript (except vendor scripts)
  return gulp.src(source.scripts.app)
      .pipe(useSourceMaps ? sourcemaps.init() : gutil.noop())
      .pipe(concat(build.scripts.app.main))
      .pipe(ngAnnotate())
      .on("error", handleError)
      .pipe(isProduction ? uglify({preserveComments: 'some'}) : gutil.noop())
      .on("error", handleError)
      .pipe(useSourceMaps ? sourcemaps.write() : gutil.noop())
      .pipe(gulp.dest(build.scripts.app.dir));
});

// VENDOR BUILD
gulp.task('scripts:vendor', ['scripts:vendor:base', 'scripts:vendor:app']);

//  This will be included vendor files statically
gulp.task('scripts:vendor:base', function() {

  // Minify and copy all JavaScript (except vendor scripts)
  return gulp.src(vendor.base.source)
      .pipe(expect(vendor.base.source))
      .pipe(uglify())
      .pipe(concat(vendor.base.name))
      .pipe(gulp.dest(vendor.base.dest));
});

// copy file from bower folder into the app vendor folder
gulp.task('scripts:vendor:app', function() {

  var jsFilter = gulpFilter('**/*.js');
  var cssFilter = gulpFilter('**/*.css');

  return gulp.src(vendor.app.source, {base: 'bower_components'})
      .pipe(expect(vendor.app.source))
      .pipe(jsFilter)
      .pipe(uglify())
      .pipe(jsFilter.restore())
      .pipe(cssFilter)
      .pipe(minifyCSS())
      .pipe(cssFilter.restore())
      .pipe(gulp.dest(vendor.app.dest));

});

// APP LESS
gulp.task('styles:app', function() {
  return gulp.src(source.styles.app.source)
      .pipe(foreach (function(stream, file) { return stringSrc('import.less', '@import "' + file.relative + '";\n'); }))
      .pipe(concat('app.less'))
      .pipe(useSourceMaps ? sourcemaps.init() : gutil.noop())
      .pipe(less({paths: source.styles.app.dir}))
      .on("error", handleError)
      .pipe(isProduction ? minifyCSS() : gutil.noop())
      .pipe(useSourceMaps ? sourcemaps.write() : gutil.noop())
      .pipe(gulp.dest(build.styles));
});

// // APP RTL
// gulp.task('styles:app:rtl', function() {
//     return gulp.src(source.styles.app.main)
//         .pipe( useSourceMaps ? sourcemaps.init() : gutil.noop())
//         .pipe(less({
//             paths: [source.styles.app.dir]
//         }))
//         .on("error", handleError)
//         .pipe(flipcss())
//         .pipe( isProduction ? minifyCSS() : gutil.noop() )
//         .pipe( useSourceMaps ? sourcemaps.write() : gutil.noop())
//         .pipe(rename(function(path) {
//             path.basename += "-rtl";
//             return path;
//         }))
//         .pipe(gulp.dest(build.styles));
// });

// Environment based configuration
// https://github.com/kubernetes-ui/kubernetes-ui/issues/21

gulp.task('config', ['config:base', 'config:copy']);

gulp.task('config:base', function() {
  return stringSrc('generated-config.js', 'angular.module("kubernetesApp.config", [])' +
                                              '\n' +
                                              '.constant("ENV", {})').pipe(gulp.dest(source.config.dest));
});

gulp.task('config:copy', function() {
  var environment = argv.env || 'development';  // change this to whatever default environment you need.

  return gulp.src(['shared/config/' + environment + '.json', 'components/**/config/' + environment + '.json'])
      .pipe(jsoncombine('generated-config.js',
                        function(data) {
                          var env = Object.keys(data).reduce(function(result, key) {
                            // Map the key "environment" to "/" and the keys "component/config/environment" to
                            // "component".
                            var newKey = key.replace(environment, '/').replace(/\/config\/\/$/, '');
                            result[newKey] = data[key];
                            return result;
                          }, {});

                          return new Buffer(JSON.stringify({'ENV': env}));
                        }))
      .pipe(ngConstant({name: 'kubernetesApp.config', deps: [], constants: {ngConstant: true}}))
      .pipe(gulp.dest(source.config.dest));
});

gulp.task('copy:components', function() {

  var jsFilter = gulpFilter('**/*.js');
  var cssFilter = gulpFilter('**/*.css');

  del.sync([build.components.dir], {force: true});

  return gulp.src(source.components.source, {base: 'components'})
      .pipe(expect(source.components.source))
      .pipe(jsFilter)
      .pipe(uglify())
      .pipe(jsFilter.restore())
      .pipe(cssFilter)
      .pipe(minifyCSS())
      .pipe(cssFilter.restore())
      .pipe(gulp.dest(build.components.dir));
});

gulp.task('copy:shared-assets', function() {
  del.sync([build.assets], {force: true});

  return gulp.src(source.assets.source, {base: 'shared/assets'})
      .pipe(gulp.dest(build.assets));
});

// Assuming there's "version: 1.2.3" in package.json,
// tag the last commit as "v1.2.3"//
gulp.task('tag', function() { return gulp.src(['./package.json']).pipe(tag_version()); });

// // BOOSTRAP
// gulp.task('bootstrap', function() {
//     return gulp.src(source.bootstrap.main)
//         .pipe(less({
//             paths: [source.bootstrap.dir]
//         }))
//         .on("error", handleError)
//         .pipe(gulp.dest(build.styles));
// });

// JADE
// gulp.task('templates:app', function() {
//     return gulp.src(source.templates.app.files)
//         .pipe(changed(build.templates.app, { extension: '.html' }))
//         .pipe(jade())
//         .on("error", handleError)
//         .pipe(prettify({
//             indent_char: ' ',
//             indent_size: 3,
//             unformatted: ['a', 'sub', 'sup', 'b', 'i', 'u']
//         }))
//         // .pipe(htmlify({
//         //     customPrefixes: ['ui-']
//         // }))
//         // .pipe(w3cjs( W3C_OPTIONS ))
//         .pipe(gulp.dest(build.templates.app))
//         ;
// });

// // JADE
// gulp.task('templates:pages', function() {
//     return gulp.src(source.templates.pages.files)
//         .pipe(changed(build.templates.pages, { extension: '.html' }))
//         .pipe(jade())
//         .on("error", handleError)
//         .pipe(prettify({
//             indent_char: ' ',
//             indent_size: 3,
//             unformatted: ['a', 'sub', 'sup', 'b', 'i', 'u']
//         }))
//         // .pipe(htmlify({
//         //     customPrefixes: ['ui-']
//         // }))
//         // .pipe(w3cjs( W3C_OPTIONS ))
//         .pipe(gulp.dest(build.templates.pages))
//         ;
// });

// // JADE
// gulp.task('templates:views', function() {
//     return gulp.src(source.templates.views.files)
//         .pipe(changed(build.templates.views, { extension: '.html' }))
//         .pipe(jade())
//         .on("error", handleError)
//         .pipe(prettify({
//             indent_char: ' ',
//             indent_size: 3,
//             unformatted: ['a', 'sub', 'sup', 'b', 'i', 'u']
//         }))
//         // .pipe(htmlify({
//         //     customPrefixes: ['ui-']
//         // }))
//         // .pipe(w3cjs( W3C_OPTIONS ))
//         .pipe(gulp.dest(build.templates.views))
//         ;
// });

//---------------
// WATCH
//---------------

// Rerun the task when a file changes
gulp.task('watch', function() {
  livereload.listen();

  gulp.watch(source.scripts.watch, ['scripts:app']);
  gulp.watch(source.styles.app.watch, ['styles:app']);
  gulp.watch(source.components.watch, ['copy:components']);
  gulp.watch(source.assets.watch, ['copy:shared-assets']);
  // gulp.watch(source.templates.pages.watch,   ['templates:pages']);
  // gulp.watch(source.templates.views.watch,   ['templates:views']);
  // gulp.watch(source.templates.app.watch,     ['templates:app']);

  gulp.watch([

                 '../app/**'

  ])
      .on('change', function(event) {

        livereload.changed(event.path);

      });

});

//---------------
// DEFAULT TASK
//---------------

// build for production (minify)
gulp.task('build', ['prod', 'default']);
gulp.task('prod', function() { isProduction = true; });

// build with sourcemaps (no minify)
gulp.task('sourcemaps', ['usesources', 'default']);
gulp.task('usesources', function() { useSourceMaps = true; });

// default (no minify)
gulp.task('default', gulpsync.sync(['scripts:vendor', 'copy:components', 'scripts:app', 'start']), function() {

  gutil.log(gutil.colors.cyan('************'));
  gutil.log(gutil.colors.cyan('* All Done *'),
            'You can start editing your code, LiveReload will update your browser after any change..');
  gutil.log(gutil.colors.cyan('************'));

});

gulp.task('start', [
  'styles:app',
  'copy:components',
  'copy:shared-assets',
  // 'templates:app',
  // 'templates:pages',
  // 'templates:views',
  'watch'
]);

gulp.task('done', function() {
  console.log('All Done!! You can start editing your code, LiveReload will update your browser after any change..');
});

// Error handler
function handleError(err) {
  console.log(err.toString());
  this.emit('end');
}

// // Mini gulp plugin to flip css (rtl)
// function flipcss(opt) {

//   if (!opt) opt = {};

//   // creating a stream through which each file will pass
//   var stream = through.obj(function(file, enc, cb) {
//     if(file.isNull()) return cb(null, file);

//     if(file.isStream()) {
//         console.log("todo: isStream!");
//     }

//     var flippedCss = flip(String(file.contents), opt);
//     file.contents = new Buffer(flippedCss);
//     cb(null, file);
//   });

//   // returning the file stream
//   return stream;
// }


text:
package projects.OldBetHop.nodes.edges;

import sinalgo.nodes.edges.Edge;
import sinalgo.tools.statistics.UniformDistribution;

public class EdgeOldBetHop extends Edge {
	public double etx;

	public EdgeOldBetHop() {
		super();
		UniformDistribution cte = new UniformDistribution(1, 100);
		this.etx = (int) cte.nextSample();
	}

	public double getEtx() {
		return etx;
	}

	public void setEtx(double etx) {
		this.etx = etx;
	}

	@Override
	public String toString() {
		return "EdgeHopBet [etx=" + etx + "]";
	}

}


text:
import { compose } from '../utils.js';

const curry2 = (fn) => (a, b) => {
  if (b === void 0) {
    return (b) => fn(a, b);
  }

  return fn(a, b);
};

export const leftPad = curry2((offset, string) =>
  string.padStart(string.length + offset)
);

export const rightPad = curry2((offset, string) =>
  string.padEnd(string.length + offset)
);

export const withMargin = compose([leftPad(1), rightPad(1)]);

export const typeAsString = (value) => {
  if (typeof value === 'object') {
    return value?.constructor?.name ?? String(value);
  }
  return typeof value;
};


text:
import Ember from 'ember';
const {computed} = Ember;

/**
 * simple helper to store the columns that will be used to for display & search on a paginate list
 */
export default Ember.Object.extend({

  //the friendly name
  displayName: null,

  //the model property
  fieldName: null,

  //list this field in the search component?
  enableSearch: true,

  //list this field in the main listing?
  enableDisplay: true,

  //order in which to display the fields
  order: 0,

  // show the quick filter or not
  showingFilter: false,

  // value on the filter for this column
  filterValue: null,

  // To make a column not searchable/sortable
  disableServerInteractions: false,

  // developer supplied value that maps to API field
  // this value is used in preference to fieldName when the client needs to interact with this api field
  apiName: null,

  // calculate to pull either the apiName or fieldName
  apiInteractionName: computed('fieldName', 'apiName', function () {
    if (Ember.isPresent(this.get('apiName'))) {
      return this.get('apiName');
    } else {
      // ie lastName >>  last_name
      return this.get('fieldName').underscore();
    }
  }),

  width: undefined,

  // Advanced Filter fields
  advFilterOperator: undefined,
  advFilterValue: undefined,
  advFilterValue2: undefined
});


text:
'use strict'

var test = require('tap').test
var pino = require('../')
var os = require('os')
var split = require('split2')
var hostname = os.hostname()

test('pino transform prettifies', function (t) {
  t.plan(4)
  var pretty = pino.pretty()
  pretty.pipe(split(function (line) {
    t.ok(line.match(/.*hello world$/), 'end of line matches')
    t.ok(line.match(/(?!^)INFO.*/), 'includes level')
    t.ok(line.indexOf('' + process.pid) > 0, 'includes pid')
    t.ok(line.indexOf('' + hostname) > 0, 'includes hostname')
    return line
  }))
  var instance = pino(pretty)

  instance.info('hello world')
})

test('pino pretty moves level to start on flag', function (t) {
  t.plan(4)
  var pretty = pino.pretty({ levelFirst: true })
  pretty.pipe(split(function (line) {
    t.ok(line.match(/.*hello world$/), 'end of line matches')
    t.ok(line.match(/^INFO.*/), 'level is at start of line')
    t.ok(line.indexOf('' + process.pid) > 0, 'includes pid')
    t.ok(line.indexOf('' + hostname) > 0, 'includes hostname')
    return line
  }))
  var instance = pino(pretty)

  instance.info('hello world')
})

test('pino transform can just parse the dates', function (t) {
  t.plan(1)
  var pretty = pino.pretty({ timeTransOnly: true })
  pretty.pipe(split(function (line) {
    var obj = JSON.parse(line)
    t.ok(typeof obj.time === 'string', 'time is a string')
    return line
  }))
  var instance = pino(pretty)

  instance.info('hello world')
})

test('pino transform prettifies Error', function (t) {
  var pretty = pino.pretty()
  var err = new Error('hello world')
  var expected = err.stack.split('\n')
  expected.unshift(err.message)

  t.plan(expected.length)

  pretty.pipe(split(function (line) {
    t.ok(line.indexOf(expected.shift()) >= 0, 'line matches')
    return line
  }))

  var instance = pino(pretty)

  instance.info(err)
})

test('pino transform preserve output if not valid JSON', function (t) {
  t.plan(1)
  var pretty = pino.pretty()
  var lines = []
  pretty.pipe(split(function (line) {
    lines.push(line)
    return line
  }))

  pretty.write('this is not json\nit\'s just regular output\n')
  pretty.end()

  t.deepEqual(lines, ['this is not json', 'it\'s just regular output'], 'preserved lines')
})

test('handles missing time', function (t) {
  t.plan(1)
  var pretty = pino.pretty()
  var lines = []
  pretty.pipe(split(function (line) {
    lines.push(line)
    return line
  }))

  pretty.write('{"hello":"world"}')
  pretty.end()

  t.deepEqual(lines, ['{"hello":"world"}'], 'preserved lines')
})


text:
/* eslint-disable import/no-extraneous-dependencies */
const fs = require('fs-extra');
const os = require('os');
const path = require('path');
const spawn = require('child_process').spawn;
const config = require('../package');

const DIR_DEPLOY = path.join(process.cwd(), config.version);
const DIR_DIST = path.join(process.cwd(), 'dist');
const DIR_TMP = path.join(os.tmpdir(), 'build');

function removeDirectory(directory) {
  return new Promise((resolve, reject) => {
    fs.remove(directory, (err) => {
      if (err) {
        reject(err);
        return;
      }

      resolve();
    });
  });
}

function copy(src, dest) {
  return new Promise((resolve, reject) => {
    fs.copy(src, dest, (err) => {
      if (err) {
        reject(err);
        return;
      }

      resolve();
    });
  });
}

function move(src, dest) {
  return new Promise((resolve, reject) => {
    fs.rename(src, dest, (err) => {
      if (err) {
        reject(err);
        return;
      }

      resolve();
    });
  });
}

function run(command, ...args) {
  console.log(command, ...args);

  return new Promise((resolve, reject) => {
    const process = spawn(command, args);
    let stdout = '';
    let stderr = '';

    process.stdout.on('data', data => (stdout += data));
    process.stderr.on('data', data => (stderr += data));

    process.on('close', (code) => {
      if (code > 0) {
        reject(`${code}: ${stderr}`);
      }

      resolve(stdout);
    });
  });
}

function getRemoteUrl() {
  return run('git', 'remote', 'get-url', '--push', 'origin')
    .then(repository => repository.replace(/^\s+|\s+$/, ''));
}

function getRemoteUrlWithCredentials(user, token) {
  return getRemoteUrl()
    .then(repository => repository.replace(/^https:\/\/github/i, `https://timseverien:${token}@github`));
}

function authenticate() {
  let repositoryUrl = '';

  return getRemoteUrlWithCredentials('timseverien', process.env.GITHUB_TOKEN)
    .then(repository => (repositoryUrl = repository))
    .then(() => run('git', 'remote', 'set-url', '--push', 'origin', repositoryUrl));
}

function deployVersion() {
  return move(DIR_TMP, DIR_DEPLOY)
    .then(() => run('git', 'status'))
    .then(() => run('git', 'add', '.'))
    .then(() => run('git', 'commit', '-m', `Update to ${config.version}`))
    .then(() => run('git', 'push', '--set-upstream', 'origin', 'master'))
    .then(() => console.log(`${config.version} is deployed.`));
}

removeDirectory(DIR_TMP)
  .then(() => copy(DIR_DIST, DIR_TMP))
  .then(() => authenticate())
  .then(() => run('git', 'checkout', 'gh-pages'))
  .then(deployVersion)
  .then(() => run('git', 'checkout', 'master'))
  .catch(err => console.error('Error:', err));