text:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Web;
using System.Web.Caching;
using System.Xml.Serialization;

using DotNetNuke.Common.Utilities;
using DotNetNuke.ComponentModel.DataAnnotations;
using DotNetNuke.Entities.Users;

namespace DotNetNuke.Modules.Announcements.Components.Business
{
    [Serializable, XmlRoot("AnnouncementsSubscriber")]
    [TableName("AnnouncementsSubscribers")]
    [PrimaryKey("AnnouncementsSubscriberID")]
    [Scope("ModuleID")]
    public class AnnouncementsSubscriberInfo
    {

        public AnnouncementsSubscriberInfo()
        {
            CreatedOnDate = DateTime.Now;
            CreatedByUserID = Null.NullInteger;
            LastModifiedByUserID = Null.NullInteger;
            LastModifiedOnDate = CreatedOnDate;
        }

        #region DBFields

        public int AnnouncementsSubscriberID { get; set; }
        public int ModuleID { get; set; }
        public int UserID { get; set; }

        [Browsable(false), XmlIgnore]
        public int CreatedByUserID { get; set; }

        [Browsable(false), XmlIgnore]
        public DateTime CreatedOnDate { get; set; }

        [Browsable(false), XmlIgnore]
        public int LastModifiedByUserID { get; set; }

        [Browsable(false), XmlIgnore]
        public DateTime LastModifiedOnDate { get; set; }

        #endregion

        #region NonDB Fields

        [IgnoreColumn]
        public UserInfo CreatedByUser(int portalId)
        {
            if (CreatedByUserID > Null.NullInteger)
            {
                UserInfo user = UserController.GetUserById(portalId, CreatedByUserID);
                return user;
            }
            return null;
        }

        [IgnoreColumn]
        public UserInfo LastModifiedByUser(int portalId)
        {
            if (LastModifiedByUserID > Null.NullInteger)
            {
                UserInfo user = UserController.GetUserById(portalId, LastModifiedByUserID);
                return user;
            }
            return null;
        }
        #endregion

    }
}


text:
package org.jivesoftware.openfire.plugin.rest;

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

import javax.ws.rs.core.Response;

import org.jivesoftware.openfire.container.Plugin;
import org.jivesoftware.openfire.container.PluginManager;
import org.jivesoftware.openfire.plugin.rest.entity.SystemProperties;
import org.jivesoftware.openfire.plugin.rest.entity.SystemProperty;
import org.jivesoftware.openfire.plugin.rest.exceptions.ExceptionType;
import org.jivesoftware.openfire.plugin.rest.exceptions.ServiceException;
import org.jivesoftware.util.JiveGlobals;
import org.jivesoftware.util.PropertyEventDispatcher;
import org.jivesoftware.util.PropertyEventListener;
import org.jivesoftware.util.StringUtils;

/**
 * The Class RESTServicePlugin.
 */
public class RESTServicePlugin implements Plugin, PropertyEventListener {

	/** The Constant INSTANCE. */
	public static final RESTServicePlugin INSTANCE = new RESTServicePlugin();

	/** The secret. */
	private String secret;

	/** The allowed i ps. */
	private Collection<String> allowedIPs;

	/** The enabled. */
	private boolean enabled;

	/** The http basic auth. */
	private boolean httpBasicAuth;

	/**
	 * Gets the single instance of RESTServicePlugin.
	 *
	 * @return single instance of RESTServicePlugin
	 */
	public static RESTServicePlugin getInstance() {
		return INSTANCE;
	}

	/* (non-Javadoc)
	 * @see org.jivesoftware.openfire.container.Plugin#initializePlugin(org.jivesoftware.openfire.container.PluginManager, java.io.File)
	 */
	public void initializePlugin(PluginManager manager, File pluginDirectory) {
		secret = JiveGlobals.getProperty("plugin.restapi.secret", "");
		// If no secret key has been assigned, assign a random one.
		if ("".equals(secret)) {
			secret = StringUtils.randomString(16);
			setSecret(secret);
		}

		// See if the service is enabled or not.
		enabled = JiveGlobals.getBooleanProperty("plugin.restapi.enabled", false);

		// See if the HTTP Basic Auth is enabled or not.
		httpBasicAuth = JiveGlobals.getBooleanProperty("plugin.restapi.httpAuth.enabled", false);

		// Get the list of IP addresses that can use this service. An empty list
		// means that this filter is disabled.
		allowedIPs = StringUtils.stringToCollection(JiveGlobals.getProperty("plugin.restapi.allowedIPs", ""));

		// Listen to system property events
		PropertyEventDispatcher.addListener(this);
	}

	/* (non-Javadoc)
	 * @see org.jivesoftware.openfire.container.Plugin#destroyPlugin()
	 */
	public void destroyPlugin() {
		// Stop listening to system property events
		PropertyEventDispatcher.removeListener(this);
	}

	/**
	 * Gets the system properties.
	 *
	 * @return the system properties
	 */
	public SystemProperties getSystemProperties() {
		SystemProperties systemProperties = new SystemProperties();
		List<SystemProperty> propertiesList = new ArrayList<SystemProperty>();

		for(String propertyKey : JiveGlobals.getPropertyNames()) {
			String propertyValue = JiveGlobals.getProperty(propertyKey);
			propertiesList.add(new SystemProperty(propertyKey, propertyValue));
		}
		systemProperties.setProperties(propertiesList);
		return systemProperties;

	}

	/**
	 * Gets the system property.
	 *
	 * @param propertyKey the property key
	 * @return the system property
	 * @throws ServiceException the service exception
	 */
	public SystemProperty getSystemProperty(String propertyKey) throws ServiceException {
		String propertyValue = JiveGlobals.getProperty(propertyKey);
		if(propertyValue != null) {
		return new SystemProperty(propertyKey, propertyValue);
		} else {
			throw new ServiceException("Could not find property", propertyKey, ExceptionType.PROPERTY_NOT_FOUND,
					Response.Status.NOT_FOUND);
		}
	}

	/**
	 * Creates the system property.
	 *
	 * @param systemProperty the system property
	 */
	public void createSystemProperty(SystemProperty systemProperty) {
		JiveGlobals.setProperty(systemProperty.getKey(), systemProperty.getValue());
	}

	/**
	 * Delete system property.
	 *
	 * @param propertyKey the property key
	 * @throws ServiceException the service exception
	 */
	public void deleteSystemProperty(String propertyKey) throws ServiceException {
		if(JiveGlobals.getProperty(propertyKey) != null) {
			JiveGlobals.deleteProperty(propertyKey);
		} else {
			throw new ServiceException("Could not find property", propertyKey, ExceptionType.PROPERTY_NOT_FOUND,
					Response.Status.NOT_FOUND);
		}
	}

	/**
	 * Update system property.
	 *
	 * @param propertyKey the property key
	 * @param systemProperty the system property
	 * @throws ServiceException the service exception
	 */
	public void updateSystemProperty(String propertyKey, SystemProperty systemProperty) throws ServiceException {
		if(JiveGlobals.getProperty(propertyKey) != null) {
			if(systemProperty.getKey().equals(propertyKey)) {
				JiveGlobals.setProperty(propertyKey, systemProperty.getValue());
			} else {
				throw new ServiceException("Path property name and entity property name doesn't match", propertyKey, ExceptionType.ILLEGAL_ARGUMENT_EXCEPTION,
						Response.Status.BAD_REQUEST);
			}
		} else {
			throw new ServiceException("Could not find property for update", systemProperty.getKey(), ExceptionType.PROPERTY_NOT_FOUND,
					Response.Status.NOT_FOUND);
		}
	}

	/**
	 * Returns the secret key that only valid requests should know.
	 *
	 * @return the secret key.
	 */
	public String getSecret() {
		return secret;
	}

	/**
	 * Sets the secret key that grants permission to use the userservice.
	 *
	 * @param secret
	 *            the secret key.
	 */
	public void setSecret(String secret) {
		JiveGlobals.setProperty("plugin.restapi.secret", secret);
		this.secret = secret;
	}

	/**
	 * Gets the allowed i ps.
	 *
	 * @return the allowed i ps
	 */
	public Collection<String> getAllowedIPs() {
		return allowedIPs;
	}

	/**
	 * Sets the allowed i ps.
	 *
	 * @param allowedIPs the new allowed i ps
	 */
	public void setAllowedIPs(Collection<String> allowedIPs) {
		JiveGlobals.setProperty("plugin.restapi.allowedIPs", StringUtils.collectionToString(allowedIPs));
		this.allowedIPs = allowedIPs;
	}

	/**
	 * Returns true if the user service is enabled. If not enabled, it will not
	 * accept requests to create new accounts.
	 *
	 * @return true if the user service is enabled.
	 */
	public boolean isEnabled() {
		return enabled;
	}

	/**
	 * Enables or disables the user service. If not enabled, it will not accept
	 * requests to create new accounts.
	 *
	 * @param enabled
	 *            true if the user service should be enabled.
	 */
	public void setEnabled(boolean enabled) {
		this.enabled = enabled;
		JiveGlobals.setProperty("plugin.restapi.enabled", enabled ? "true" : "false");
	}

	/**
	 * Checks if is http basic auth.
	 *
	 * @return true, if is http basic auth
	 */
	public boolean isHttpBasicAuth() {
		return httpBasicAuth;
	}

	/**
	 * Sets the http basic auth.
	 *
	 * @param httpBasicAuth the new http basic auth
	 */
	public void setHttpBasicAuth(boolean httpBasicAuth) {
		this.httpBasicAuth = httpBasicAuth;
		JiveGlobals.setProperty("plugin.restapi.httpAuth.enabled", httpBasicAuth ? "true" : "false");
	}

	/* (non-Javadoc)
	 * @see org.jivesoftware.util.PropertyEventListener#propertySet(java.lang.String, java.util.Map)
	 */
	public void propertySet(String property, Map<String, Object> params) {
		if (property.equals("plugin.restapi.secret")) {
			this.secret = (String) params.get("value");
		} else if (property.equals("plugin.restapi.enabled")) {
			this.enabled = Boolean.parseBoolean((String) params.get("value"));
		} else if (property.equals("plugin.restapi.allowedIPs")) {
			this.allowedIPs = StringUtils.stringToCollection((String) params.get("value"));
		} else if (property.equals("plugin.restapi.httpAuth.enabled")) {
			this.httpBasicAuth = Boolean.parseBoolean((String) params.get("value"));
		}
	}

	/* (non-Javadoc)
	 * @see org.jivesoftware.util.PropertyEventListener#propertyDeleted(java.lang.String, java.util.Map)
	 */
	public void propertyDeleted(String property, Map<String, Object> params) {
		if (property.equals("plugin.restapi.secret")) {
			this.secret = "";
		} else if (property.equals("plugin.restapi.enabled")) {
			this.enabled = false;
		} else if (property.equals("plugin.restapi.allowedIPs")) {
			this.allowedIPs = Collections.emptyList();
		} else if (property.equals("plugin.restapi.httpAuth.enabled")) {
			this.httpBasicAuth = false;
		}
	}

	/* (non-Javadoc)
	 * @see org.jivesoftware.util.PropertyEventListener#xmlPropertySet(java.lang.String, java.util.Map)
	 */
	public void xmlPropertySet(String property, Map<String, Object> params) {
		// Do nothing
	}

	/* (non-Javadoc)
	 * @see org.jivesoftware.util.PropertyEventListener#xmlPropertyDeleted(java.lang.String, java.util.Map)
	 */
	public void xmlPropertyDeleted(String property, Map<String, Object> params) {
		// Do nothing
	}
}

redpajama_set_name: RedPajamaGithub


text:
var amplitude,
    level,
    song,
    speed,
    amplitudeLevel,
    count = 0;

function preload(){
  song = loadSound('assets/FortunateSon.mp3');
}

function setup() {
  createCanvas(0, 0);
  song.play();
  amplitude = new p5.Amplitude();
}

function draw() {
  level = amplitude.getLevel();
  console.log(level)
  var size = map(level, 0, 1, 1, 30);
  count++;
  if (count === 1) {
    amplitudeLevel = createElement('span', size).addClass('amplitudeLevel');
  } else {
    amplitudeLevel.html('');
    amplitudeLevel = createElement('span', size).addClass('amplitudeLevel');
  }
}


text:
<?php

global $_MODULE;
$_MODULE = array();
$_MODULE['<{productscategory}cars>productscategory_8a4f5a66d0fcc9d13614516db6e3d47a'] = 'Products in the same category';
$_MODULE['<{productscategory}cars>productscategory_1d269d7f013c3d9d891a146f4379eb02'] = 'Adds a block on the product page that displays products from the same category.';
$_MODULE['<{productscategory}cars>productscategory_8dd2f915acf4ec98006d11c9a4b0945b'] = 'Settings updated successfully.';
$_MODULE['<{productscategory}cars>productscategory_f4f70727dc34561dfde1a3c529b6205c'] = 'Settings';
$_MODULE['<{productscategory}cars>productscategory_e06ba84b50810a88438ae0537405f65a'] = 'Display products\' prices';
$_MODULE['<{productscategory}cars>productscategory_1d986024f548d57b1d743ec7ea9b09d9'] = 'Show the prices of the products displayed in the block.';
$_MODULE['<{productscategory}cars>productscategory_00d23a76e43b46dae9ec7aa9dcbebb32'] = 'Enabled';
$_MODULE['<{productscategory}cars>productscategory_b9f5c797ebbf55adccdd8539a65a0241'] = 'Disabled';
$_MODULE['<{productscategory}cars>productscategory_c9cc8cce247e49bae79f15173ce97354'] = 'Save';
$_MODULE['<{productscategory}cars>productscategory_1f910bcf84a92cb7c71fa3d926c8a525'] = 'Other products in the same category';
$_MODULE['<{productscategory}cars>productscategory_dd1f775e443ff3b9a89270713580a51b'] = 'Previous';
$_MODULE['<{productscategory}cars>productscategory_10ac3d04253ef7e1ddc73e6091c0cd55'] = 'Next';


text:
package com.smart.cloud.fire.view;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.PopupWindow;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.smart.cloud.fire.base.presenter.BasePresenter;
import com.smart.cloud.fire.global.MyApp;
import com.smart.cloud.fire.mvp.fragment.MapFragment.HttpAreaResult;
import com.smart.cloud.fire.rxjava.ApiCallback;
import com.smart.cloud.fire.rxjava.SubscriberCallBack;

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

import fire.cloud.smart.com.smartcloudfire.R;
import rx.Observable;
import rx.functions.Func1;

public class BingoDropDowmListView extends LinearLayout {

    private TextView editText;
    private ImageView imageView;
    private PopupWindow popupWindow = null;
    private List<BingoViewModel> dataList =  new ArrayList<>();
    private Context mContext;
    ProgressBar loading_prg_monitor;
    private RelativeLayout clear_choice;

    public String getSelecedName() {
        return selecedName;
    }

    public String getSelecedId() {
        return selecedId;
    }

    String selecedName;
    String selecedId;

    public void setOnItemCheaked(OnItemCheaked mOnItemCheaked) {
        this.onItemCheaked = mOnItemCheaked;
    }

    public interface OnItemCheaked{
        public void onItemCheak(String selecedId);
    }

    private OnItemCheaked onItemCheaked;

    public BingoDropDowmListView(Context context) {
        this(context,null);
        // TODO Auto-generated constructor stub
    }
    public BingoDropDowmListView(Context context, AttributeSet attrs) {
        this(context, attrs, 0);
        // TODO Auto-generated constructor stub
    }
    public BingoDropDowmListView(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
        // TODO Auto-generated constructor stub
        initView();
    }

    public void initView(){
        mContext = getContext();
        String infServie = Context.LAYOUT_INFLATER_SERVICE;
        LayoutInflater layoutInflater;
        layoutInflater =  (LayoutInflater) getContext().getSystemService(infServie);
        View view  = layoutInflater.inflate(R.layout.dropdownlist_view, this,true);
        loading_prg_monitor = (ProgressBar) findViewById(R.id.loading_prg_monitor);
        editText= (TextView)findViewById(R.id.text);
        imageView = (ImageView)findViewById(R.id.btn);
        clear_choice = (RelativeLayout) findViewById(R.id.clear_choice);
        this.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                // TODO Auto-generated method stub
                if (popupWindow == null) {
                    showPopWindow();
                } else {
                    closePopWindow();
                }
            }
        });
        clear_choice.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                clearCheaked();
            }
        });
    }

    public void clearCheaked() {
        if (dataList.size() > 0) {
            selecedName=null;
            selecedId=null;

            imageView.setVisibility(View.VISIBLE);
            clear_choice.setVisibility(View.GONE);
            editText.setText("");
        }
    }

    public void showLoading(){
        imageView.setVisibility(View.GONE);
        loading_prg_monitor.setVisibility(View.VISIBLE);
    }

    public void closeLoading(){
        loading_prg_monitor.setVisibility(View.GONE);
        imageView.setVisibility(View.VISIBLE);
    }
    /**
     * 打开下拉列表弹窗
     */
    public void showPopWindow() {
        if(dataList==null||dataList.size()==0){
            return;
        }
        // 加载popupWindow的布局文件
        String infServie = Context.LAYOUT_INFLATER_SERVICE;
        LayoutInflater layoutInflater;
        layoutInflater =  (LayoutInflater) getContext().getSystemService(infServie);
        View contentView  = layoutInflater.inflate(R.layout.dropdownlist_popupwindow, null,false);
        ListView listView = (ListView)contentView.findViewById(R.id.listView);

        listView.setAdapter(new BingoDropDowmListView.XCDropDownListAdapter(getContext(), dataList));
        popupWindow = new PopupWindow(contentView,LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
        popupWindow.setOutsideTouchable(true);
        popupWindow.showAsDropDown(this);
    }
    /**
     * 关闭下拉列表弹窗
     */
    public void closePopWindow(){
        popupWindow.dismiss();
        popupWindow = null;
    }

    public boolean ifShow(){
        if (popupWindow == null) {
            return false;
        } else {
            return true;
        }
    }
    /**
     * 设置数据
     * @param list
     */
    public void setItemsData(List<BingoViewModel> list){
        dataList = list;
        editText.setText("");
    }

    public void setEditTextData(String editTextData){
        editText.setText(editTextData);
    }
    /**
     * 数据适配器
     * @author caizhiming
     *
     */
    class XCDropDownListAdapter extends BaseAdapter {

        Context mContext;
        List<BingoViewModel> mData;
        LayoutInflater inflater;
        public XCDropDownListAdapter(Context ctx,List<BingoViewModel> data){
            mContext  = ctx;
            mData = data;
            inflater = LayoutInflater.from(mContext);
        }
        @Override
        public int getCount() {
            // TODO Auto-generated method stub
            return mData.size();
        }

        @Override
        public Object getItem(int position) {
            // TODO Auto-generated method stub
            return mData.get(position);
        }

        @Override
        public long getItemId(int position) {
            // TODO Auto-generated method stub
            return position;
        }

        @Override
        public View getView(int position, View convertView, ViewGroup parent) {
            // TODO Auto-generated method stub
            // 自定义视图
            BingoDropDowmListView.ListItemView listItemView = null;
            if (convertView == null) {
                // 获取list_item布局文件的视图
                convertView = inflater.inflate(R.layout.dropdown_list_item, null);

                listItemView = new BingoDropDowmListView.ListItemView();
                // 获取控件对象
                listItemView.tv = (TextView) convertView
                        .findViewById(R.id.tv);
                listItemView.layout = (LinearLayout) convertView.findViewById(R.id.layout_container);
                // 设置控件集到convertView
                convertView.setTag(listItemView);
            } else {
                listItemView = (BingoDropDowmListView.ListItemView) convertView.getTag();
            }
            BingoViewModel model = mData.get(position);

            // 设置数据
            listItemView.tv.setText(model.getModelName());
            final String text = model.getModelName();
            listItemView.layout.setOnClickListener(new OnClickListener() {

                @Override
                public void onClick(View v) {
                    // TODO Auto-generated method stub
                    editText.setText(text);
                    imageView.setVisibility(View.GONE);
                    clear_choice.setVisibility(View.VISIBLE);
                    selecedId=model.getModelId();
                    selecedName=model.getModelName();
                    if(onItemCheaked!=null){
                        onItemCheaked.onItemCheak(selecedId);
                    }
                    closePopWindow();
                }
            });

            return convertView;
        }

    }
    private static class ListItemView{
        TextView tv;
        LinearLayout layout;
    }

    public void addFinish(){
        imageView.setVisibility(View.VISIBLE);
        clear_choice.setVisibility(View.GONE);
    }

    public void setEditTextHint(String textStr){
        editText.setHint(textStr);
    }

    public void initData(String Type){
        Observable mObservable ;
        mObservable= BasePresenter.apiStores1.getAreaId(MyApp.getUserID(), MyApp.getPrivilege()+"","").map(new Func1<HttpAreaResult,ArrayList<Object>>() {
            @Override
            public ArrayList<Object> call(HttpAreaResult o) {
                return o.getSmoke();
            }
        });

        BasePresenter.addSubscription(mObservable,new SubscriberCallBack<>(new ApiCallback<ArrayList<BingoViewModel>>() {
            @Override
            public void onSuccess(ArrayList<BingoViewModel> model) {
                if(model!=null&&model.size()>0){
                    dataList=model;
                }
            }
            @Override
            public void onFailure(int code, String msg) {

            }
            @Override
            public void onCompleted() {
            }
        }));
    }

}


text:
const initialState = {
  id: null
};

const reducer = (state = initialState, action) => {
  switch (action.type) {
    case 'SOCKET_CONNECTED':
      return {
        id: action.id
      };

    default:
      return state;
  }
};

export default reducer;


text:
namespace cc {

class FakeTileManagerClient : public TileManagerClient {
 public:
  FakeTileManagerClient();
  virtual ~FakeTileManagerClient();

  // TileManagerClient implementation.
  virtual const std::vector<PictureLayerImpl*>& GetPictureLayers() OVERRIDE;
  virtual void NotifyReadyToActivate() OVERRIDE {}
  virtual void NotifyTileStateChanged(const Tile* tile) OVERRIDE {}

 private:
  std::vector<PictureLayerImpl*> picture_layers_;
};

}  // namespace cc

#endif  // CC_TEST_FAKE_TILE_MANAGER_CLIENT_H_


text:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<parent>
		<groupId>org.springframework.cloud</groupId>
		<artifactId>spring-cloud-dataflow-parent</artifactId>
		<version>1.7.0.BUILD-SNAPSHOT</version>
	</parent>
	<artifactId>spring-cloud-dataflow-skipper-docs</artifactId>
	<name>Spring Cloud Data Flow Skipper Docs</name>
	<description>Spring Cloud Data Flow Skipper Docs</description>
	<dependencies>
		<dependency>
			<groupId>org.springframework.cloud</groupId>
			<artifactId>spring-cloud-starter-dataflow-server-local</artifactId>
			<version>1.7.0.BUILD-SNAPSHOT</version>
			<type>test-jar</type>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.springframework.cloud</groupId>
			<artifactId>spring-cloud-skipper-server</artifactId>
			<version>${spring-cloud-skipper.version}</version>
			<type>test-jar</type>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.springframework.restdocs</groupId>
			<artifactId>spring-restdocs-mockmvc</artifactId>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.springframework.restdocs</groupId>
			<artifactId>spring-restdocs-core</artifactId>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>com.jayway.jsonpath</groupId>
			<artifactId>json-path</artifactId>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>io.projectreactor</groupId>
			<artifactId>reactor-core</artifactId>
			<version>3.1.8.RELEASE</version>
			<scope>test</scope>
		</dependency>
	</dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <configuration>
                    <includes>
                        <include>**/*Documentation.java</include>
                        <include>**/*Tests.java</include>
                    </includes>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>


text:
/**
 *Copyright [2009-2010] [dennis zhuang(killme2008@gmail.com)]
 *Licensed under the Apache License, Version 2.0 (the "License");
 *you may not use this file except in compliance with the License.
 *You may obtain a copy of the License at
 *             http://www.apache.org/licenses/LICENSE-2.0
 *Unless required by applicable law or agreed to in writing,
 *software distributed under the License is distributed on an "AS IS" BASIS,
 *WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
 *either express or implied. See the License for the specific language governing permissions and limitations under the License
 */
package com.google.code.hs4j.network.util;

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

import com.google.code.hs4j.network.buffer.IoBuffer;

/**
 * ByteBuffer matcher based on shift-or algorithm
 *
 * @author dennis
 *
 */
public class ShiftOrByteBufferMatcher implements ByteBufferMatcher {

    private int[] b;
    private int lim;

    private int patternLen;

    public ShiftOrByteBufferMatcher(IoBuffer pat) {
        if (pat == null || pat.remaining() == 0) {
            throw new IllegalArgumentException("blank buffer");
        }
        this.patternLen = pat.remaining();
        preprocess(pat);
    }

    /**
     * Ԥ����
     *
     * @param pat
     */
    private void preprocess(IoBuffer pat) {
        this.b = new int[256];
        this.lim = 0;
        for (int i = 0; i < 256; i++) {
            this.b[i] = ~0;

        }
        for (int i = 0, j = 1; i < this.patternLen; i++, j <<= 1) {
            this.b[ByteBufferUtils.uByte(pat.get(i))] &= ~j;
            this.lim |= j;
        }
        this.lim = ~(this.lim >> 1);

    }

    public final List<Integer> matchAll(IoBuffer buffer) {
        List<Integer> matches = new ArrayList<Integer>();
        int bufferLimit = buffer.limit();
        int state = ~0;
        for (int pos = buffer.position(); pos < bufferLimit; pos++) {
            state <<= 1;
            state |= this.b[ByteBufferUtils.uByte(buffer.get(pos))];
            if (state < this.lim) {
                matches.add(pos - this.patternLen + 1);
            }
        }
        return matches;
    }

    public final int matchFirst(IoBuffer buffer) {
        if (buffer == null) {
            return -1;
        }
        int bufferLimit = buffer.limit();
        int state = ~0;
        for (int pos = buffer.position(); pos < bufferLimit; pos++) {
            state = (state <<= 1) | this.b[ByteBufferUtils.uByte(buffer.get(pos))];
            if (state < this.lim) {
                return pos - this.patternLen + 1;
            }
        }
        return -1;
    }

}


text:
module Distribution.Simple.BuildPaths (
    defaultDistPref, srcPref,
    hscolourPref, haddockPref,
    autogenModulesDir,

    autogenModuleName,
    cppHeaderName,
    haddockName,

    mkLibName,
    mkProfLibName,
    mkSharedLibName,

    exeExtension,
    objExtension,
    dllExtension,

  ) where

import Distribution.Package
import Distribution.ModuleName as ModuleName
import Distribution.Compiler
import Distribution.PackageDescription
import Distribution.Simple.LocalBuildInfo
import Distribution.Simple.Setup
import Distribution.Text
import Distribution.System

import System.FilePath ((</>), (<.>))

-- ---------------------------------------------------------------------------
-- Build directories and files

srcPref :: FilePath -> FilePath
srcPref distPref = distPref </> "src"

hscolourPref :: FilePath -> PackageDescription -> FilePath
hscolourPref = haddockPref

haddockPref :: FilePath -> PackageDescription -> FilePath
haddockPref distPref pkg_descr
    = distPref </> "doc" </> "html" </> display (packageName pkg_descr)

-- |The directory in which we put auto-generated modules
autogenModulesDir :: LocalBuildInfo -> String
autogenModulesDir lbi = buildDir lbi </> "autogen"

cppHeaderName :: String
cppHeaderName = "cabal_macros.h"

-- |The name of the auto-generated module associated with a package
autogenModuleName :: PackageDescription -> ModuleName
autogenModuleName pkg_descr =
  ModuleName.fromString $
    "Paths_" ++ map fixchar (display (packageName pkg_descr))
  where fixchar '-' = '_'
        fixchar c   = c

haddockName :: PackageDescription -> FilePath
haddockName pkg_descr = display (packageName pkg_descr) <.> "haddock"

-- ---------------------------------------------------------------------------
-- Library file names

mkLibName :: UnitId -> String
mkLibName lib = "lib" ++ getHSLibraryName lib <.> "a"

mkProfLibName :: UnitId -> String
mkProfLibName lib =  "lib" ++ getHSLibraryName lib ++ "_p" <.> "a"

-- Implement proper name mangling for dynamical shared objects
-- libHS<packagename>-<compilerFlavour><compilerVersion>
-- e.g. libHSbase-2.1-ghc6.6.1.so
mkSharedLibName :: CompilerId -> UnitId -> String
mkSharedLibName (CompilerId compilerFlavor compilerVersion) lib
  = "lib" ++ getHSLibraryName lib ++ "-" ++ comp <.> dllExtension
  where comp = display compilerFlavor ++ display compilerVersion

-- ------------------------------------------------------------
-- * Platform file extensions
-- ------------------------------------------------------------

-- ToDo: This should be determined via autoconf (AC_EXEEXT)
-- | Extension for executable files
-- (typically @\"\"@ on Unix and @\"exe\"@ on Windows or OS\/2)
exeExtension :: String
exeExtension = case buildOS of
                   Windows -> "exe"
                   _       -> ""

-- TODO: This should be determined via autoconf (AC_OBJEXT)
-- | Extension for object files. For GHC the extension is @\"o\"@.
objExtension :: String
objExtension = "o"

-- | Extension for dynamically linked (or shared) libraries
-- (typically @\"so\"@ on Unix and @\"dll\"@ on Windows)
dllExtension :: String
dllExtension = case buildOS of
                   Windows -> "dll"
                   OSX     -> "dylib"
                   _       -> "so"


text:
package io.confluent.kafka.serializers;

import org.apache.avro.Schema;
import org.apache.avro.generic.GenericContainer;
import org.apache.avro.generic.GenericDatumReader;
import org.apache.avro.io.DatumReader;
import org.apache.avro.io.DecoderFactory;
import org.apache.avro.specific.SpecificData;
import org.apache.avro.specific.SpecificDatumReader;
import org.apache.avro.specific.SpecificRecord;
import org.apache.kafka.common.config.ConfigException;
import org.apache.kafka.common.errors.SerializationException;
import org.codehaus.jackson.node.JsonNodeFactory;

import java.io.IOException;
import java.nio.ByteBuffer;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

import io.confluent.kafka.schemaregistry.client.CachedSchemaRegistryClient;
import io.confluent.kafka.schemaregistry.client.rest.exceptions.RestClientException;
import kafka.utils.VerifiableProperties;

public abstract class AbstractKafkaAvroDeserializer extends AbstractKafkaAvroSerDe {
  public static final String SCHEMA_REGISTRY_SCHEMA_VERSION_PROP =
      "schema.registry.schema.version";

  private final DecoderFactory decoderFactory = DecoderFactory.get();
  protected boolean useSpecificAvroReader = false;
  private final Map<String, Schema> readerSchemaCache = new ConcurrentHashMap<String, Schema>();

  protected void configure(KafkaAvroDeserializerConfig config) {
    try {
      List<String> urls = config.getList(KafkaAvroDeserializerConfig.SCHEMA_REGISTRY_URL_CONFIG);
      int  maxSchemaObject = config
          .getInt(KafkaAvroDeserializerConfig.MAX_SCHEMAS_PER_SUBJECT_CONFIG);
      schemaRegistry = new CachedSchemaRegistryClient(urls, maxSchemaObject);
      configureNonClientProperties(config);
    } catch (io.confluent.common.config.ConfigException e) {
      throw new ConfigException(e.getMessage());
    }
  }

  /**
   * Sets properties for this deserializer without overriding the schema registry client itself.
   * Useful for testing, where a mock client is injected.
   */
  protected void configureNonClientProperties(KafkaAvroDeserializerConfig config) {
    useSpecificAvroReader = config
        .getBoolean(KafkaAvroDeserializerConfig.SPECIFIC_AVRO_READER_CONFIG);
  }

  protected KafkaAvroDeserializerConfig deserializerConfig(Map<String, ?> props) {
    try {
      return new KafkaAvroDeserializerConfig(props);
    } catch (io.confluent.common.config.ConfigException e) {
      throw new ConfigException(e.getMessage());
    }
  }

  protected KafkaAvroDeserializerConfig deserializerConfig(VerifiableProperties props) {
    try {
      return new KafkaAvroDeserializerConfig(props.props());
    } catch (io.confluent.common.config.ConfigException e) {
      throw new ConfigException(e.getMessage());
    }
  }

  private ByteBuffer getByteBuffer(byte[] payload) {
    ByteBuffer buffer = ByteBuffer.wrap(payload);
    if (buffer.get() != MAGIC_BYTE) {
      throw new SerializationException("Unknown magic byte!");
    }
    return buffer;
  }

  /**
   * Deserializes the payload without including schema information for primitive types, maps, and arrays. Just the resulting
   * deserialized object is returned.
   *
   * This behavior is the norm for Decoders/Deserializers.
   *
   * @param payload serialized data
   * @return the deserialized object
   * @throws SerializationException
   */
  protected Object deserialize(byte[] payload) throws SerializationException {
    return deserialize(false, null, null, payload);
  }

  // The Object return type is a bit messy, but this is the simplest way to have flexible decoding and not duplicate
  // deserialization code multiple times for different variants.
  protected Object deserialize(boolean includeSchemaAndVersion, String topic, Boolean isKey, byte[] payload) throws SerializationException {
    // Even if the caller requests schema & version, if the payload is null we cannot include it. The caller must handle
    // this case.
    if (payload == null) {
      return null;
    }

    int id = -1;
    try {
      ByteBuffer buffer = getByteBuffer(payload);
      id = buffer.getInt();
      Schema schema = schemaRegistry.getByID(id);
      int length = buffer.limit() - 1 - idSize;
      final Object result;
      if (schema.getType().equals(Schema.Type.BYTES)) {
        byte[] bytes = new byte[length];
        buffer.get(bytes, 0, length);
        result = bytes;
      } else {
        int start = buffer.position() + buffer.arrayOffset();
        DatumReader reader = getDatumReader(schema);
        Object object = reader.read(null, decoderFactory.binaryDecoder(buffer.array(), start, length, null));

        if (schema.getType().equals(Schema.Type.STRING)) {
          object = object.toString(); // Utf8 -> String
        }
        result = object;
      }

      if (includeSchemaAndVersion) {
        // Annotate the schema with the version. Note that we only do this if the schema +
        // version are requested, i.e. in Kafka Connect converters. This is critical because that
        // code *will not* rely on exact schema equality. Regular deserializers *must not* include
        // this information because it would return schemas which are not equivalent.
        //
        // Note, however, that we also do not fill in the connect.version field. This allows the
        // Converter to let a version provided by a Kafka Connect source take priority over the
        // schema registry's ordering (which is implicit by auto-registration time rather than
        // explicit from the Connector).
        Integer version = schemaRegistry.getVersion(getSubjectName(topic, isKey), schema);
        if (schema.getType() == Schema.Type.UNION) {
          // Can't set additional properties on a union schema since it's just a list, so set it
          // on the first non-null entry
          for (Schema memberSchema : schema.getTypes()) {
            if (memberSchema.getType() != Schema.Type.NULL) {
              memberSchema.addProp(SCHEMA_REGISTRY_SCHEMA_VERSION_PROP,
                                   JsonNodeFactory.instance.numberNode(version));
              break;
            }
          }
        } else {
          schema.addProp(SCHEMA_REGISTRY_SCHEMA_VERSION_PROP,
                         JsonNodeFactory.instance.numberNode(version));
        }
        if (schema.getType().equals(Schema.Type.RECORD)) {
          return result;
        } else {
          return new NonRecordContainer(schema, result);
        }
      } else {
        return result;
      }
    } catch (IOException e) {
      throw new SerializationException("Error deserializing Avro message for id " + id, e);
    } catch (RestClientException e) {
      throw new SerializationException("Error retrieving Avro schema for id " + id, e);
    } catch (RuntimeException e) {
      // avro deserialization may throw AvroRuntimeException, NullPointerException, etc
      throw new SerializationException("Error deserializing Avro message for id " + id, e);
    }
  }

  /**
   * Deserializes the payload and includes schema information, with version information from the schema registry embedded
   * in the schema.
   *
   * @param payload the serialized data
   * @return a GenericContainer with the schema and data, either as a {@link NonRecordContainer},
   *         {@link org.apache.avro.generic.GenericRecord}, or {@link SpecificRecord}
   * @throws SerializationException
   */
  protected GenericContainer deserializeWithSchemaAndVersion(String topic, boolean isKey, byte[] payload) throws SerializationException {
    return (GenericContainer) deserialize(true, topic, isKey, payload);
  }

  private DatumReader getDatumReader(Schema writerSchema) {
    if (useSpecificAvroReader) {
      return new SpecificDatumReader(writerSchema, getReaderSchema(writerSchema));
    } else {
      return new GenericDatumReader(writerSchema);
    }
  }

  private Schema getReaderSchema(Schema writerSchema) {
    Schema readerSchema = readerSchemaCache.get(writerSchema.getFullName());
    if (readerSchema == null) {
      Class<SpecificRecord> readerClass = SpecificData.get().getClass(writerSchema);
      if (readerClass != null) {
        try {
          readerSchema = readerClass.newInstance().getSchema();
        } catch (InstantiationException e) {
          throw new SerializationException(writerSchema.getFullName() + " specified by the " +
            "writers schema could not be instantiated to find the readers schema.");
        } catch (IllegalAccessException e) {
          throw new SerializationException(writerSchema.getFullName() + " specified by the " +
            "writers schema is not allowed to be instantiated to find the readers schema.");
        }
        readerSchemaCache.put(writerSchema.getFullName(), readerSchema);
      } else {
        throw new SerializationException("Could not find class " +  writerSchema.getFullName() +
          " specified in writer's schema whilst finding reader's schema for a SpecificRecord.");
      }
    }
    return readerSchema;
  }

}


text:
package msn;

import java.util.Date;

import models.Group;
import models.MessageLog;
import net.sf.jml.MsnContact;
import net.sf.jml.MsnMessenger;
import net.sf.jml.MsnOwner;
import net.sf.jml.MsnProtocol;
import net.sf.jml.MsnSwitchboard;
import net.sf.jml.event.MsnMessageListener;
import net.sf.jml.message.MsnControlMessage;
import net.sf.jml.message.MsnDatacastMessage;
import net.sf.jml.message.MsnInstantMessage;
import net.sf.jml.message.MsnSystemMessage;
import net.sf.jml.message.MsnUnknownMessage;
import net.sf.jml.message.p2p.MsnFileDeclineMessage;
import net.sf.jml.message.p2p.MsnFileInviteMessage;
import net.sf.jml.message.p2p.MsnFileOkMessage;
import net.sf.jml.message.p2p.MsnP2PDataMessage;
import net.sf.jml.message.p2p.MsnP2PMessage;
import net.sf.jml.protocol.MsnIncomingMessage;
import net.sf.jml.protocol.MsnOutgoingMessage;
import net.sf.jml.protocol.outgoing.OutgoingMSG;
import play.Logger;
import play.db.jpa.JPAPlugin;

import command.Processor;

public class MessageListener implements MsnMessageListener {

  public static final MessageListener instance = new MessageListener();

  public void controlMessageReceived(MsnSwitchboard switchboard,
      MsnControlMessage message, MsnContact contact) {
  }

  public void datacastMessageReceived(MsnSwitchboard switchboard,
      MsnDatacastMessage message, MsnContact contact) {
    Messenger messenger = (Messenger) switchboard.getMessenger();
    MsnContact[] contacts = messenger.getContactList().getContacts();
    for (MsnContact other : contacts) {
      if (!other.getEmail().getEmailAddress()
          .equals(contact.getEmail().getEmailAddress())) {
        messenger.sendMessage(other.getEmail(), message);
      }
    }
  }

  public void instantMessageReceived(MsnSwitchboard switchboard,
      MsnInstantMessage message, MsnContact contact) {
    Messenger messenger = (Messenger) switchboard.getMessenger();

    Processor processor = Processor.instance;
    if (!processor.process(messenger, contact, message.getContent())) {
      String announce = String.format("%s: %s", contact.getFriendlyName(),
          message.getContent());
      JPAPlugin.startTx(false);

      Group group = Group.fromEmail(messenger.getOwner().getEmail()
          .getEmailAddress());
      MessageLog.log(group, contact.getEmail().getEmailAddress(), announce);

      JPAPlugin.closeTx(false);

      message.setContent(announce);
      MsnContact[] contacts = messenger.getContactList().getContacts();
      for (MsnContact receiver : contacts) {
        if (!receiver.getEmail().getEmailAddress()
            .equals(contact.getEmail().getEmailAddress())) {
          messenger.sendMessage(receiver.getEmail(), message);
        }
      }
    }
  }

  public void p2pMessageReceived(MsnSwitchboard switchboard,
      MsnP2PMessage message, MsnContact contact) {
    MsnFileDeclineMessage declineMessage = new MsnFileDeclineMessage();
    Messenger messenger = (Messenger) switchboard.getMessenger();
    messenger.sendMessage(contact.getEmail(), declineMessage);
  }

  public void systemMessageReceived(MsnMessenger messenger,
      MsnSystemMessage message) {
  }

  public void unknownMessageReceived(MsnSwitchboard switchboard,
      MsnUnknownMessage message, MsnContact contact) {
  }

  public void offlineMessageReceived(String body, String contentType,
      String encoding, Date date, MsnContact contact) {

  }

}


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="shortcut icon" href="assets/img/logo.png">

    <title>EPIC - Júnior Empresa de Engenharias</title>

    <link href="assets/css/bootstrap.css" rel="stylesheet">

    <link href="assets/css/main.css" rel="stylesheet">
	<link rel="stylesheet" href="assets/css/font-awesome.min.css">

    <link href='http://fonts.googleapis.com/css?family=Oswald:400,300,700' rel='stylesheet' type='text/css'>
    <link href='http://fonts.googleapis.com/css?family=EB+Garamond' rel='stylesheet' type='text/css'>

EPIC

			Home
			Sobre nós
			Serviços
			Departamentos
			 Equipa
      Contato

 Because   EPIC   things happen

SOBRE NÓS

Junta-te a nós para tornar o teu percurso épico!

<button type="button" class="btn btn-warning">Junta-te a nós!</button>

A EPIC, júnior empresa de engenharias da Universidade do Minho, é composta por estudantes universitários dos cursos de engenharia, os quais prestam serviços e realizam projetos para diversas empresas como complemento prático da aprendizagem universitária.

SERVIÇOS

DEPARTAMENTOS

Este é o departmento Técnico, que é onde se faz cenas bué fixes!!!

Este é o departmento Técnico, que é onde se faz cenas bué fixes!!!

Este é o departmento Técnico, que é onde se faz cenas bué fixes!!!

Este é o departmento Técnico, que é onde se faz cenas bué fixes!!!

Este é o departmento Técnico, que é onde se faz cenas bué fixes!!!

CONTACTO

Universidade do Minho - Campus de Azurém, Departamento Téxtil, Sala B.3.53 4800-058 Guimarães, Portugal

 epic.junior.uminho@gmail.com

<button type="button" class="btn btn-warning">  Contacta-nos! </button>


text:
/**
 * Created by Craig Wann on 2/16/15.
 */
var VimeoCover = new Class({
    defaults: {
        selector: '.vimeo-cover'
    },
    options: {},
    element: null,
    lastWidth: 0,

    initialize: function (element, options) {
        jQuery(element).data('vimeoCover', this);
        this.options = $.extend({}, this.defaults, options);
        (new Image()).src = jQuery(element).attr('vimeo-placeholder');

        this.resize(element);
        this.loadBackground(element);

        jQuery(element).click($.proxy(function (event) {
            this.turnOn(element);
        },this));

        jQuery(window).resize($.proxy(function (event) {
            this.resize(element);
        },this));
    },

    loadBackground: function(element) {
        jQuery(element).css('transition', 'opacity 2s ease-out');
        jQuery(element).css('opacity', 0);
        var imageUrl = jQuery(element).attr('vimeo-placeholder');
        var preload = [imageUrl];
        var promises = [];
        for (var i = 0; i < preload.length; i++) {
            (function(url, promise) {
                var img = new Image();
                img.onload = function() {
                    promise.resolve();
                };
                img.src = url;
            })(preload[i], promises[i] = $.Deferred());
        }
        $.when.apply($, promises).done(function() {
            jQuery(element).removeClass('preloader');
            jQuery(element).css('background-image', "url('"+imageUrl+"')");
            jQuery(element).css('background-size', 'cover');
            jQuery(element).css('opacity', 1);
        });
    },

    resize: function(element) {
        if ((this.lastWidth == jQuery(element).width()) && (jQuery(element).height())) {
            return;
        }
        this.lastWidth = jQuery(element).width();
        jQuery(element).css('height', (56.22/100*jQuery(element).width()));
        this.turnOff(element);
    },

    turnOn: function (element) {
        var self = this;
        $(this.options.selector).each(function(index) {
            self.turnOff(this);
        });
        jQuery(element).html('<iframe src="https://player.vimeo.com/video/' + jQuery(element).attr('vimeo-id') + '?title=0&byline=0&portrait=0&autoplay=1" width="' + jQuery(element).width() + '" height="' + jQuery(element).height() + '" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen autoplay=true></iframe>');
        jQuery(element).addClass('on');
    },

    turnOff: function (element) {
        jQuery(element).removeClass('on');
        jQuery(element).empty();
    }

});


text:
package cz.afrosoft.whattoeat.cookbook.ingredient.logic.service;

import cz.afrosoft.whattoeat.cookbook.ingredient.data.entity.NutritionFactsEntity;
import cz.afrosoft.whattoeat.cookbook.ingredient.logic.model.NutritionFacts;
import cz.afrosoft.whattoeat.cookbook.recipe.logic.model.Recipe;
import cz.afrosoft.whattoeat.cookbook.recipe.logic.model.RecipeRef;
import cz.afrosoft.whattoeat.diet.generator.model.MealNutritionFacts;
import cz.afrosoft.whattoeat.diet.list.logic.model.DayDiet;
import cz.afrosoft.whattoeat.diet.list.logic.model.Meal;
import cz.afrosoft.whattoeat.diet.list.logic.model.RecipeDataForDayDietDialog;

import java.util.Collection;
import java.util.List;
import java.util.Optional;

/**
 * @author Tomas Rejent
 */
public interface NutritionFactsService {

    NutritionFactsUpdateObject getCreateObject();

    NutritionFactsUpdateObject getUpdateObject(NutritionFacts nutritionFacts);

    NutritionFactsEntity toEntity(NutritionFactsUpdateObject nutritionFacts);

    Optional<NutritionFacts> toNutritionFacts(NutritionFactsEntity nutritionFacts);

    /**
     * Converts basic energy rate joule/g to human readable kJ/100g.
     * @param baseEnergy
     * @return
     */
    Float energyToHumanReadable(Float baseEnergy);

    /**
     * Converts human readable energy kJ/100g to base joule/g.
     * @param humanReadableEnergy
     * @return
     */
    Float energyToBase(Float humanReadableEnergy);

    /**
     * Converts from base nutrition /g to human readable /100g.
     * @param baseNutrition
     * @return
     */
    Float nutritionToHumanReadable(Float baseNutrition);

    /**
     * Converts from human readable /100g to base /g.
     * @param humanReadableNutrition
     * @return
     */
    Float nutritionToBase(Float humanReadableNutrition);

    MealNutritionFacts getMealNutritionFacts(Meal meal);

    MealNutritionFacts getMealNutritionFacts(final RecipeRef recipeRef, final float servings);

    List<MealNutritionFacts> getDayDietNutritionFacts(DayDiet dayDiet);

    Collection<RecipeDataForDayDietDialog> toDayDietView(Collection<Recipe> recipes);
}


text:
package com.b2international.snowowl.snomed.core.rest.domain;

import com.b2international.snowowl.core.rest.domain.ResourceRequest;
import com.google.common.base.MoreObjects.ToStringHelper;

/**
 * @since 1.0
 * @param <T> - the actual resource request body
 */
public final class SnomedResourceRequest<T> extends ResourceRequest<T> {

	private String defaultModuleId;

	public String getDefaultModuleId() {
		return defaultModuleId;
	}

	public void setDefaultModuleId(final String defaultModuleId) {
		this.defaultModuleId = defaultModuleId;
	}

	@Override
	protected void doToString(ToStringHelper toStringHelper) {
		toStringHelper.add("defaultModuleId", defaultModuleId);
	}
}


text:
package net.minidev.ovh.api.pack.xdsl.addressmove;

import net.minidev.ovh.api.xdsl.eligibility.OvhAddress;
import net.minidev.ovh.api.xdsl.eligibility.OvhBookMeetingSlot;

/**
 * The parameters needed to create a new landline
 */
public class OvhCreation {
	/**
	 * The address
	 *
	 * canBeNull
	 */
	public OvhAddress address;

	/**
	 * Data to book a meeting slot
	 *
	 * canBeNull
	 */
	public OvhBookMeetingSlot meeting;
}


text:
__license__ = """
GoLismero 2.0 - The web knife - Copyright (C) 2011-2014

Golismero project site: https://github.com/golismero
Golismero project mail: contact@golismero-project.com

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
"""

__all__ = ["CSVReport"]

from golismero.api import VERSION
from golismero.api.audit import get_audit_times, parse_audit_times
from golismero.api.config import Config
from golismero.api.data import Data
from golismero.api.data.db import Database
from golismero.api.logger import Logger
from golismero.api.plugin import ReportPlugin
from golismero.api.text.text_utils import to_utf8

from datetime import datetime

import csv

# Load the fast C version of pickle,
# if not available use the pure-Python version.
try:
    import cPickle as pickle
except ImportError:
    import pickle

#------------------------------------------------------------------------------
class CSVReport(ReportPlugin):
    """
    Creates reports in CSV format.
    """

    EXTENSION = ".csv"

    #--------------------------------------------------------------------------
    def generate_report(self, output_file):
        Logger.log_verbose(
            "Writing CSV report to file: %s" % output_file)

        # All rows have the same format but the first.
        # There's always 26 columns in every row.
        # Most columns are for Vulnerability objects, empty for other types.
        # Read the source code for more details, it's really simple. :)

        # Open the output file.
        with open(output_file, "w") as f:
            writer = csv.writer(f)

            # Write the first row, describing the report itself.
            report_time = datetime.utcnow()
            start_time, stop_time, run_time = parse_audit_times(
                                                        *get_audit_times())
            row = [
                "GoLismero " + VERSION,
                1,  # format version
                Config.audit_name,
                start_time,
                stop_time,
                run_time,
                report_time,
                None,
                None,
                None,
                None,
                None,
                None,
                None,
                None,
                None,
                None,
                None,
                None,
                None,
                None,
                None,
                None,
                None,
                pickle.dumps(Config.audit_config, protocol=0).encode("hex"),
                pickle.dumps(Config.audit_scope, protocol=0).encode("hex"),
            ]
            row = [to_utf8(x) if x is not None else "" for x in row]
            writer.writerow(row)

            # Used to convert the false_positive flag to a string value.
            fp = {
                True: 1,
                False: 0,
                None: -1,
            }

            # Just the vulnerabilities?
            if Config.audit_config.only_vulns:

                # Dump only Vulnerability objects that are not false positives.
                for vuln in self.__iterate_data(
                        data_type=Data.TYPE_VULNERABILITY):
                    if vuln.false_positive:
                        continue
                    target = vuln.target
                    row = [
                        vuln.identity,
                        vuln.data_type,
                        vuln.data_subtype,
                        None,
                        vuln.display_name,
                        vuln.plugin_id,
                        vuln.tool_id,
                        vuln.custom_id,
                        vuln.level,
                        vuln.risk,
                        vuln.severity,
                        vuln.impact,
                        vuln.cvss_base,
                        vuln.cvss_score,
                        vuln.cvss_vector,
                        fp[vuln.false_positive],
                        target.identity,
                        target.display_name,
                        vuln.title,
                        vuln.description,
                        vuln.solution,
                        "\n".join(vuln.references),
                        "\n".join(vuln.taxonomies),
                        str(target),
                        pickle.dumps(vuln, protocol=0).encode("hex"),
                        pickle.dumps(target, protocol=0).encode("hex"),
                    ]
                    row = [to_utf8(x) if x is not None else "" for x in row]
                    writer.writerow(row)

            # Full database dump?
            else:

                # Dump all objects in the database.
                for data in self.__iterate_data():
                    if data.data_type == Data.TYPE_VULNERABILITY:
                        vuln = data
                        target = vuln.target
                        row = [
                            vuln.identity,
                            vuln.data_type,
                            vuln.data_subtype,
                            None,
                            vuln.display_name,
                            vuln.plugin_id,
                            vuln.tool_id,
                            vuln.custom_id,
                            vuln.level,
                            vuln.risk,
                            vuln.severity,
                            vuln.impact,
                            vuln.cvss_base,
                            vuln.cvss_score,
                            vuln.cvss_vector,
                            fp[vuln.false_positive],
                            target.identity,
                            target.display_name,
                            vuln.title,
                            vuln.description,
                            vuln.solution,
                            "\n".join(vuln.references),
                            "\n".join(vuln.taxonomies),
                            str(target),
                            pickle.dumps(vuln, protocol=0).encode("hex"),
                            pickle.dumps(target, protocol=0).encode("hex"),
                        ]
                    else:
                        row = [
                            data.identity,
                            data.data_type,
                            data.data_subtype,
                            getattr(data, "category", None),
                            data.display_name,
                            None,
                            None,
                            None,
                            None,
                            None,
                            None,
                            None,
                            None,
                            None,
                            None,
                            0,
                            None,
                            None,
                            None,
                            None,
                            None,
                            None,
                            None,
                            str(data),
                            None,
                            pickle.dumps(data, protocol=0).encode("hex"),
                        ]
                    row = [to_utf8(x) if x is not None else "" for x in row]
                    writer.writerow(row)

    #--------------------------------------------------------------------------
    def __iterate_data(self,
                       identities = None,
                       data_type = None,
                       data_subtype = None):
        if identities is None:
            identities = list(Database.keys(data_type, data_subtype))
        if identities:
            for page in xrange(0, len(identities), 100):
                for data in Database.get_many(identities[page:page + 100]):
                    yield data


text:
class RenameEventsToEventInstances < ActiveRecord::Migration[5.1]
  # Stub models for migration in case they get renamed in the future
  class MyEventInstance < ActiveRecord::Base
    self.table_name = 'event_instances'
  end
  class MyEvent < ActiveRecord::Base
    self.table_name = 'events'
  end

  def up
    rename_event_instances_and_create_new_events_table

    # Creating and naming nu-events isn't directly reversible
    MyEventInstance.all.each do |event_instance|
      ev = MyEvent.find_by(name: event_instance.name) || MyEvent.create!(name: event_instance.name)
      event_instance.event_id = ev.id
      event_instance.save
    end

    remove_event_instance_name_col
  end

  def down
    revert { remove_event_instance_name_col }

    # Add names back to EventInstance objects in preparation for that becoming required
    # again when they revert to being Event objects.
    # Loop through all Event and EventInstance objects and select related items explicitly,
    # instead of relying on :has_many or any other relations still being in place.
    all_instances = MyEventInstance.all
    MyEvent.all.each do |event|
      # Reduce the number of loops we'll have to do by pre-filtering the array
      instances = all_instances.select { |inst| inst.event_id == event.id }
      instances.each do |instance|
        instance.name = event.name
        instance.save
      end
    end

    revert { rename_event_instances_and_create_new_events_table }
  end

  private

  def rename_event_instances_and_create_new_events_table
    # Rename events to event_instances first, to clear the namespace
    rename_table :events, :event_instances
    # Follow through and rename the association on submissions
    rename_column :submissions, :event_id, :event_instance_id

    # Create the new events table
    create_table :events do |t|
      t.string :name
      t.index  :name, unique: true

      t.timestamps
    end

    # Associate event_instances to events
    add_reference :event_instances, :event, foreign_key: true
  end

  def remove_event_instance_name_col
    remove_column :event_instances, :name, :string
  end
end


text:
title: Twenty Fifteen Theme Problems
categories:
- Review
tags:
- wordpress
- theme
# https://www.iconfinder.com/icons/287518/wordpress_icon
thumbnail: thumbnail.svg
---

I don't like this year's default theme. I was excited for a few months looking at the previews and news circulating around, but it ended up not meeting my expectations.

<!-- more -->

WordPress provides a new default theme every year  which strives to bring out the most important blogging principles and features as possible. With the arrival of WordPress 4.1, they bring along Twenty Fifteen, the replacement of the last theme Twenty Fourteen.

I really wanted a theme that could flesh my content in a easily readable and presentable way. These are the problems I are stopping me switching to Twenty Fifteen:

### Everything is big

The font is a lot bigger than Twenty Fourteen but amazing still fits everything Twenty Fourteen did. It feels if I'm just trying to make content for the sake of it, like when you write a report and waffle on and on to pad the word count.

![one page 2015](one-page-2015.png)

### Mobile theme

When on your mobile, the Twenty Fourteen theme nicely compacted your posts into a list, only showing their title, date and author.

_Viewing Twenty Fourteen on a Galaxy S4_:

![Viewing TwentyFourteen on a Galaxy S4](mobile-t14.png)

On the Twenty Fifteen theme, the entire post is shown as if you're on a desktop.

_Viewing the Twenty Fifteen on a Galaxy S4 - the entire opening of the post is shown._:

![Viewing the TwentyFifteen on a Galaxy S4 - the entire opening of the post is shown.](mobile-t15.png)

Now if I'm on a mobile, I'd prefer the most compact and easily navigable layout as possible - which Twenty Fourteen does better than Twenty Fifteen. On a tablet this looks okay but not on mobiles.

### Existing Featured Images from Twenty Fourteen don't stretch

This is a bit annoying, creating a lump of white space on either side of the image

![Not flush](not-flush1.png)

This is really ugly when you look at it, like I didn't put any effort into creating and editing my pictures. Some pictures are small I know but at least they should automagically stretch.


text:
namespace Microsoft.Azure.Management.StorageSync.Models
{
    using Newtonsoft.Json;
    using System.Collections;
    using System.Collections.Generic;
    using System.Linq;

    /// <summary>
    /// Pre Restore request object.
    /// </summary>
    public partial class PreRestoreRequest
    {
        /// <summary>
        /// Initializes a new instance of the PreRestoreRequest class.
        /// </summary>
        public PreRestoreRequest()
        {
            CustomInit();
        }

        /// <summary>
        /// Initializes a new instance of the PreRestoreRequest class.
        /// </summary>
        /// <param name="partition">Pre Restore partition.</param>
        /// <param name="replicaGroup">Pre Restore replica group.</param>
        /// <param name="requestId">Pre Restore request id.</param>
        /// <param name="azureFileShareUri">Pre Restore Azure file share
        /// uri.</param>
        /// <param name="status">Pre Restore Azure status.</param>
        /// <param name="sourceAzureFileShareUri">Pre Restore Azure source
        /// azure file share uri.</param>
        /// <param name="backupMetadataPropertyBag">Pre Restore backup metadata
        /// property bag.</param>
        /// <param name="restoreFileSpec">Pre Restore restore file spec
        /// array.</param>
        /// <param name="pauseWaitForSyncDrainTimePeriodInSeconds">Pre Restore
        /// pause wait for sync drain time period in seconds.</param>
        public PreRestoreRequest(string partition = default(string), string replicaGroup = default(string), string requestId = default(string), string azureFileShareUri = default(string), string status = default(string), string sourceAzureFileShareUri = default(string), string backupMetadataPropertyBag = default(string), IList<RestoreFileSpec> restoreFileSpec = default(IList<RestoreFileSpec>), int? pauseWaitForSyncDrainTimePeriodInSeconds = default(int?))
        {
            Partition = partition;
            ReplicaGroup = replicaGroup;
            RequestId = requestId;
            AzureFileShareUri = azureFileShareUri;
            Status = status;
            SourceAzureFileShareUri = sourceAzureFileShareUri;
            BackupMetadataPropertyBag = backupMetadataPropertyBag;
            RestoreFileSpec = restoreFileSpec;
            PauseWaitForSyncDrainTimePeriodInSeconds = pauseWaitForSyncDrainTimePeriodInSeconds;
            CustomInit();
        }

        /// <summary>
        /// An initialization method that performs custom operations like setting defaults
        /// </summary>
        partial void CustomInit();

        /// <summary>
        /// Gets or sets pre Restore partition.
        /// </summary>
        [JsonProperty(PropertyName = "partition")]
        public string Partition { get; set; }

        /// <summary>
        /// Gets or sets pre Restore replica group.
        /// </summary>
        [JsonProperty(PropertyName = "replicaGroup")]
        public string ReplicaGroup { get; set; }

        /// <summary>
        /// Gets or sets pre Restore request id.
        /// </summary>
        [JsonProperty(PropertyName = "requestId")]
        public string RequestId { get; set; }

        /// <summary>
        /// Gets or sets pre Restore Azure file share uri.
        /// </summary>
        [JsonProperty(PropertyName = "azureFileShareUri")]
        public string AzureFileShareUri { get; set; }

        /// <summary>
        /// Gets or sets pre Restore Azure status.
        /// </summary>
        [JsonProperty(PropertyName = "status")]
        public string Status { get; set; }

        /// <summary>
        /// Gets or sets pre Restore Azure source azure file share uri.
        /// </summary>
        [JsonProperty(PropertyName = "sourceAzureFileShareUri")]
        public string SourceAzureFileShareUri { get; set; }

        /// <summary>
        /// Gets or sets pre Restore backup metadata property bag.
        /// </summary>
        [JsonProperty(PropertyName = "backupMetadataPropertyBag")]
        public string BackupMetadataPropertyBag { get; set; }

        /// <summary>
        /// Gets or sets pre Restore restore file spec array.
        /// </summary>
        [JsonProperty(PropertyName = "restoreFileSpec")]
        public IList<RestoreFileSpec> RestoreFileSpec { get; set; }

        /// <summary>
        /// Gets or sets pre Restore pause wait for sync drain time period in
        /// seconds.
        /// </summary>
        [JsonProperty(PropertyName = "pauseWaitForSyncDrainTimePeriodInSeconds")]
        public int? PauseWaitForSyncDrainTimePeriodInSeconds { get; set; }

    }
}


text:
wordpress_id: 339
title: Good news to all livejournal users
wordpress_url: http://spaetzel.com/PermaLink,guid,87.aspx
layout: post
---
As you can see I found a script which automatically posts all posts that I put up on redune.com onto
        my livejournal. So it'll be
        easier for all you livejournallers to keep up with me.

        Though I highly reccomend going to redune.com instead... It is much nicer looking,
        and the photos will be visible, it is likely not possible to set it up so that the
        photo links will work correctly.


text:
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.

#include "EnginePrivate.h"

#include "SGameLayerManager.h"

#include "Engine/UserInterfaceSettings.h"
#include "Slate/SceneViewport.h"

#include "STooltipPresenter.h"
#include "Widgets/Layout/SScissorRectBox.h"
#include "Widgets/Layout/SDPIScaler.h"
#include "Widgets/Layout/SPopup.h"

/* SGameLayerManager interface
 *****************************************************************************/

SGameLayerManager::SGameLayerManager()
{
}

void SGameLayerManager::Construct(const SGameLayerManager::FArguments& InArgs)
{
	SceneViewport = InArgs._SceneViewport;

	TSharedRef<SDPIScaler> DPIScaler =
		SNew(SDPIScaler)
		.DPIScale(this, &SGameLayerManager::GetGameViewportDPIScale)
		[
			SNew(SOverlay)

			+ SOverlay::Slot()
			[
				SAssignNew(PlayerCanvas, SCanvas)
			]

			+ SOverlay::Slot()
			[
				InArgs._Content.Widget
			]

			+ SOverlay::Slot()
			[
				SNew(SPopup)
				[
					SAssignNew(TooltipPresenter, STooltipPresenter)
				]
			]
		];

	if ( InArgs._UseScissor )
	{
		ChildSlot
		[
			SNew(SScissorRectBox)
			[
				DPIScaler
			]
		];
	}
	else
	{
		ChildSlot
		[
			DPIScaler
		];
	}
}

void SGameLayerManager::NotifyPlayerAdded(int32 PlayerIndex, ULocalPlayer* AddedPlayer)
{
	UpdateLayout();
}

void SGameLayerManager::NotifyPlayerRemoved(int32 PlayerIndex, ULocalPlayer* RemovedPlayer)
{
	UpdateLayout();
}

void SGameLayerManager::AddWidgetForPlayer(ULocalPlayer* Player, TSharedRef<SWidget> ViewportContent, const int32 ZOrder)
{
	TSharedPtr<FPlayerLayer> PlayerLayer = FindOrCreatePlayerLayer(Player);

	// NOTE: Returns FSimpleSlot but we're ignoring here.  Could be used for alignment though.
	PlayerLayer->Widget->AddSlot(ZOrder)
	[
		ViewportContent
	];
}

void SGameLayerManager::RemoveWidgetForPlayer(ULocalPlayer* Player, TSharedRef<SWidget> ViewportContent)
{
	TSharedPtr<FPlayerLayer>* PlayerLayerPtr = PlayerLayers.Find(Player);
	if ( PlayerLayerPtr )
	{
		TSharedPtr<FPlayerLayer> PlayerLayer = *PlayerLayerPtr;
		PlayerLayer->Widget->RemoveSlot(ViewportContent);
	}
}

void SGameLayerManager::ClearWidgetsForPlayer(ULocalPlayer* Player)
{
	TSharedPtr<FPlayerLayer>* PlayerLayerPtr = PlayerLayers.Find(Player);
	if ( PlayerLayerPtr )
	{
		TSharedPtr<FPlayerLayer> PlayerLayer = *PlayerLayerPtr;
		PlayerLayer->Widget->ClearChildren();
	}
}

TSharedPtr<IGameLayer> SGameLayerManager::FindLayerForPlayer(ULocalPlayer* Player, const FName& LayerName)
{
	TSharedPtr<FPlayerLayer>* PlayerLayerPtr = PlayerLayers.Find(Player);
	if ( PlayerLayerPtr )
	{
		return (*PlayerLayerPtr)->Layers.FindRef(LayerName);
	}

	return TSharedPtr<IGameLayer>();
}

bool SGameLayerManager::AddLayerForPlayer(ULocalPlayer* Player, const FName& LayerName, TSharedRef<IGameLayer> Layer, int32 ZOrder)
{
	TSharedPtr<FPlayerLayer> PlayerLayer = FindOrCreatePlayerLayer(Player);
	if ( PlayerLayer.IsValid() )
	{
		TSharedPtr<IGameLayer> ExistingLayer = PlayerLayer->Layers.FindRef(LayerName);
		if ( ExistingLayer.IsValid() )
		{
			return false;
		}

		PlayerLayer->Layers.Add(LayerName, Layer);

		PlayerLayer->Widget->AddSlot(ZOrder)
		[
			Layer->AsWidget()
		];

		return true;
	}

	return false;
}

void SGameLayerManager::ClearWidgets()
{
	PlayerCanvas->ClearChildren();

	for(const auto& LayerIt : PlayerLayers)
	{
		const TSharedPtr<FPlayerLayer>& Layer = LayerIt.Value;
		if (Layer.IsValid())
		{
			Layer->Slot = nullptr;
		}
	}
	PlayerLayers.Reset();
}

void SGameLayerManager::Tick(const FGeometry& AllottedGeometry, const double InCurrentTime, const float InDeltaTime)
{
	CachedGeometry = AllottedGeometry;

	UpdateLayout();
}

bool SGameLayerManager::OnVisualizeTooltip(const TSharedPtr<SWidget>& TooltipContent)
{
	TooltipPresenter->SetContent(TooltipContent.IsValid() ? TooltipContent.ToSharedRef() : SNullWidget::NullWidget);

	return true;
}

float SGameLayerManager::GetGameViewportDPIScale() const
{
	if ( const FSceneViewport* Viewport = SceneViewport.Get() )
	{
		FIntPoint ViewportSize = Viewport->GetSize();
		return GetDefault<UUserInterfaceSettings>(UUserInterfaceSettings::StaticClass())->GetDPIScaleBasedOnSize(ViewportSize);
	}

	return 1;
}

void SGameLayerManager::UpdateLayout()
{
	if ( const FSceneViewport* Viewport = SceneViewport.Get() )
	{
		if ( UWorld* World = Viewport->GetClient()->GetWorld() )
		{
			if ( World->IsGameWorld() == false )
			{
				PlayerLayers.Reset();
				return;
			}

			if ( UGameViewportClient* ViewportClient = World->GetGameViewport() )
			{
				const TArray<ULocalPlayer*>& GamePlayers = GEngine->GetGamePlayers(World);

				RemoveMissingPlayerLayers(GamePlayers);
				AddOrUpdatePlayerLayers(CachedGeometry, ViewportClient, GamePlayers);
			}
		}
	}
}

TSharedPtr<SGameLayerManager::FPlayerLayer> SGameLayerManager::FindOrCreatePlayerLayer(ULocalPlayer* LocalPlayer)
{
	TSharedPtr<FPlayerLayer>* PlayerLayerPtr = PlayerLayers.Find(LocalPlayer);
	if ( PlayerLayerPtr == nullptr )
	{
		// Prevent any navigation outside of a player's layer once focus has been placed there.
		TSharedRef<FNavigationMetaData> StopNavigation = MakeShareable(new FNavigationMetaData());
		StopNavigation->SetNavigationStop(EUINavigation::Up);
		StopNavigation->SetNavigationStop(EUINavigation::Down);
		StopNavigation->SetNavigationStop(EUINavigation::Left);
		StopNavigation->SetNavigationStop(EUINavigation::Right);
		StopNavigation->SetNavigationStop(EUINavigation::Previous);
		StopNavigation->SetNavigationStop(EUINavigation::Next);

		// Create a new entry for the player
		TSharedPtr<FPlayerLayer> NewLayer = MakeShareable(new FPlayerLayer());

		// Create a new overlay widget to house any widgets we want to display for the player.
		NewLayer->Widget = SNew(SOverlay)
			.AddMetaData(StopNavigation);

		// Add the overlay to the player canvas, which we'll update every frame to match
		// the dimensions of the player's split screen rect.
		PlayerCanvas->AddSlot()
			.HAlign(HAlign_Fill)
			.VAlign(VAlign_Fill)
			.Expose(NewLayer->Slot)
			[
				NewLayer->Widget.ToSharedRef()
			];

		PlayerLayerPtr = &PlayerLayers.Add(LocalPlayer, NewLayer);
	}

	return *PlayerLayerPtr;
}

void SGameLayerManager::RemoveMissingPlayerLayers(const TArray<ULocalPlayer*>& GamePlayers)
{
	TArray<ULocalPlayer*> ToRemove;

	// Find the player layers for players that no longer exist
	for ( TMap< ULocalPlayer*, TSharedPtr<FPlayerLayer> >::TIterator It(PlayerLayers); It; ++It )
	{
		ULocalPlayer* Key = ( *It ).Key;
		if ( !GamePlayers.Contains(Key) )
		{
			ToRemove.Add(Key);
		}
	}

	// Remove the missing players
	for ( ULocalPlayer* Player : ToRemove )
	{
		RemovePlayerWidgets(Player);
	}
}

void SGameLayerManager::RemovePlayerWidgets(ULocalPlayer* LocalPlayer)
{
	TSharedPtr<FPlayerLayer> Layer = PlayerLayers.FindRef(LocalPlayer);
	PlayerCanvas->RemoveSlot(Layer->Widget.ToSharedRef());

	PlayerLayers.Remove(LocalPlayer);
}

void SGameLayerManager::AddOrUpdatePlayerLayers(const FGeometry& AllottedGeometry, UGameViewportClient* ViewportClient, const TArray<ULocalPlayer*>& GamePlayers)
{
	ESplitScreenType::Type SplitType = ViewportClient->GetCurrentSplitscreenConfiguration();
	TArray<struct FSplitscreenData>& SplitInfo = ViewportClient->SplitscreenInfo;

	float InverseDPIScale = 1.0f / GetGameViewportDPIScale();

	// Add and Update Player Layers
	for ( int32 PlayerIndex = 0; PlayerIndex < GamePlayers.Num(); PlayerIndex++ )
	{
		ULocalPlayer* Player = GamePlayers[PlayerIndex];

		if ( SplitType < SplitInfo.Num() && PlayerIndex < SplitInfo[SplitType].PlayerData.Num() )
		{
			TSharedPtr<FPlayerLayer> PlayerLayer = FindOrCreatePlayerLayer(Player);
			FPerPlayerSplitscreenData& SplitData = SplitInfo[SplitType].PlayerData[PlayerIndex];

			// Viewport Sizes
			FVector2D Size, Position;
			Size.X = SplitData.SizeX;
			Size.Y = SplitData.SizeY;
			Position.X = SplitData.OriginX;
			Position.Y = SplitData.OriginY;

			Size = Size * AllottedGeometry.GetLocalSize() * InverseDPIScale;
			Position = Position * AllottedGeometry.GetLocalSize() * InverseDPIScale;

			PlayerLayer->Slot->Size(Size);
			PlayerLayer->Slot->Position(Position);
		}
	}
}


text:
package org.jetbrains.plugins.scala.lang.controlFlow

import com.intellij.openapi.editor.SelectionModel
import com.intellij.psi.PsiElement
import com.intellij.psi.util.PsiTreeUtil
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase
import junit.framework.Assert
import org.jetbrains.plugins.scala.ScalaFileType
import org.jetbrains.plugins.scala.lang.psi.api.{ScControlFlowOwner, ScalaFile}
import org.jetbrains.plugins.scala.lang.psi.controlFlow.Instruction
import org.jetbrains.plugins.scala.util.TestUtils
/**
 * @author ilyas
 */

class ControlFlowTest extends LightCodeInsightFixtureTestCase {
  protected override def getBasePath = TestUtils.getTestDataPath + "/controlFlow/"

  override def setUp() {
    super.setUp()
    myFixture.setTestDataPath(getBasePath)
  }

  def doTest() {
    val input: java.util.List[String] = TestUtils.readInput(getBasePath + getTestName(true) + ".test")
    myFixture.configureByText(ScalaFileType.SCALA_FILE_TYPE, input.get(0))
    val file: ScalaFile = myFixture.getFile.asInstanceOf[ScalaFile]
    val model: SelectionModel = myFixture.getEditor.getSelectionModel
    val start: PsiElement = file.findElementAt(if (model.hasSelection) model.getSelectionStart else 0)
    val end: PsiElement = file.findElementAt(if (model.hasSelection) model.getSelectionEnd - 1 else file.getTextLength - 1)
    val owner: ScControlFlowOwner = PsiTreeUtil.getParentOfType(PsiTreeUtil.findCommonParent(start, end), classOf[ScControlFlowOwner], false)
    val instructions = owner.getControlFlow()
    val cf: String = dumpControlFlow(instructions)
    Assert.assertEquals(input.get(1).trim, cf.trim)
  }

  protected def dumpControlFlow(instructions: Seq[Instruction]) = instructions.mkString("\n")

  def testAssignment() {doTest()}
  def testIfStatement() {doTest()}
  def testIfStatement2() {doTest()}
  def testWhile() {doTest()}
  def testWhile2() {doTest()}
  def testMatch1() {doTest()}
  def testFor1() {doTest()}
  def testFor2() {doTest()}
  def testDoWhile1() {doTest()}
  def testReturn1() {doTest()}
  def testMethod1() {doTest()}
  def testThrow1() {doTest()}
  def testKaplan_1703() {doTest()}
  def testKaplan_1703_2() {doTest()}
  def testTry1() {doTest()}
  def testTry2() {doTest()}
  def testTry3() {doTest()}
  def testNoneThrow() = doTest()
  def testScl_7393() = doTest()
  def testUnresolvedParamThrow() = doTest()
}


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

<menu xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto">
    <item
        android:id="@+id/action_share"
        android:title="@string/action_share"
        app:actionProviderClass="android.support.v7.widget.ShareActionProvider"
        app:showAsAction="always" />
</menu>
<!-- From: file:/Users/outlaw/Udacity/WorkSpace/Sunshine-Version-2-2.09_display_data/app/src/main/res/menu/detailfragment.xml -->


text:
<!DOCTYPE html>
<html>

<head>
  <title>Violin</title>

  <!-- rhizome includes -->
  <script src="/rhizome/rhizome.js"></script>
  <script>
    // var window.client;

    window.client = new rhizome.Client()

    // `rhizome.start` is the first function that should be called.
    // The function inside is executed once the client managed to connect.
    client.start(function(err) {
      if (err) {
        $('body').html('client failed starting : ' + err)
        throw err
      }

      client.send('/sys/subscribe', ['/'])
    })

    client.on('connected', function() {
      alert('connected!')
    })

    client.on('connection lost', function() {
      alert('connection lost!')
    })

    client.on('server full', function() {
      alert('server is full!')
    })
  </script>

  <link rel="stylesheet" type="text/css" href="css/styles.css" />
  <meta name="viewport" content="user-scalable=no,initial-scale=1,maximum-scale=1,minimum-scale=1,width=device-width">
</head>

<body>
  <!-- p5js includes -->
  <script src="js/notationTest.js" type="text/javascript"></script>
  <script src="js/recipe.js" type="text/javascript"></script>
  <script src="libraries/p5.js" type="text/javascript"></script>
</body>

</html>


text:
import functools
from flask import jsonify

def json(f):
    """Generate a JSON response from a database model or a Python
    dictionary."""
    @functools.wraps(f)
    def wrapped(*args, **kwargs):
        # invoke the wrapped function
        rv = f(*args, **kwargs)

        # the wrapped function can return the dictionary alone,
        # or can also include a status code and/or headers.
        # here we separate all these items
        status = None
        headers = None
        if isinstance(rv, tuple):
            rv, status, headers = rv + (None,) * (3 - len(rv))
        if isinstance(status, (dict, list)):
            headers, status = status, None

        # if the response was a database model, then convert it to a
        # dictionary
        if not isinstance(rv, dict):
            rv = rv.export_data()

        # generate the JSON response
        rv = jsonify(rv)
        if status is not None:
            rv.status_code = status
        if headers is not None:
            rv.headers.extend(headers)
        return rv
    return wrapped


text:
package org.apache.camel.component.rabbitmq;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadPoolExecutor;

import com.rabbitmq.client.AlreadyClosedException;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import com.rabbitmq.client.Consumer;
import org.apache.camel.Processor;
import org.junit.Test;
import org.mockito.Mockito;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.ArgumentMatchers.anyString;

public class RabbitMQConsumerTest {

    private RabbitMQEndpoint endpoint = Mockito.mock(RabbitMQEndpoint.class);
    private Connection conn = Mockito.mock(Connection.class);
    private Processor processor = Mockito.mock(Processor.class);
    private Channel channel = Mockito.mock(Channel.class);

    @Test
    public void testStoppingConsumerShutdownExecutor() throws Exception {
        RabbitMQConsumer consumer = new RabbitMQConsumer(endpoint, processor);

        ThreadPoolExecutor e = (ThreadPoolExecutor)Executors.newFixedThreadPool(3);
        Mockito.when(endpoint.createExecutor()).thenReturn(e);
        Mockito.when(endpoint.getConcurrentConsumers()).thenReturn(1);
        Mockito.when(endpoint.connect(any(ExecutorService.class))).thenReturn(conn);
        Mockito.when(conn.createChannel()).thenReturn(channel);

        consumer.doStart();
        assertFalse(e.isShutdown());

        consumer.doStop();
        assertTrue(e.isShutdown());
    }

    @Test
    public void testStoppingConsumerShutdownConnection() throws Exception {
        RabbitMQConsumer consumer = new RabbitMQConsumer(endpoint, processor);

        Mockito.when(endpoint.createExecutor()).thenReturn(Executors.newFixedThreadPool(3));
        Mockito.when(endpoint.getConcurrentConsumers()).thenReturn(1);
        Mockito.when(endpoint.connect(any(ExecutorService.class))).thenReturn(conn);
        Mockito.when(conn.createChannel()).thenReturn(channel);

        consumer.doStart();
        consumer.doStop();

        Mockito.verify(conn).close(30 * 1000);
    }

    @Test
    public void testStoppingConsumerShutdownConnectionWhenServerHasClosedChannel() throws Exception {
        AlreadyClosedException alreadyClosedException = Mockito.mock(AlreadyClosedException.class);

        RabbitMQConsumer consumer = new RabbitMQConsumer(endpoint, processor);

        Mockito.when(endpoint.createExecutor()).thenReturn(Executors.newFixedThreadPool(3));
        Mockito.when(endpoint.getConcurrentConsumers()).thenReturn(1);
        Mockito.when(endpoint.connect(any(ExecutorService.class))).thenReturn(conn);
        Mockito.when(conn.createChannel()).thenReturn(channel);
        Mockito.when(channel.basicConsume(anyString(), anyBoolean(), any(Consumer.class))).thenReturn("TAG");
        Mockito.when(channel.isOpen()).thenReturn(false);
        Mockito.doThrow(alreadyClosedException).when(channel).basicCancel("TAG");
        Mockito.doThrow(alreadyClosedException).when(channel).close();

        consumer.doStart();
        consumer.doStop();

        Mockito.verify(conn).close(30 * 1000);
    }
}


text:
<?php

// MrRestBundle::layout.html.twig
return array (
);