text:
--USE [TempData]

set nocount on
declare @counter int, @BatchSize int
set @counter = 1
set @BatchSize = 5000
while @counter < @BatchSize
begin
	INSERT INTO [dbo].[QueueMeta]
           ([QueueDateTime]
           ,[Title]
           ,[Status])
	OUTPUT INSERTED.[QueueID], REPLICATE('X', RAND() * 16000)
	INTO [dbo].[QueueData]
	VALUES(GETDATE(), 'Item no: ' + CONVERT(varchar(10), @counter), 0)
    set @counter = @counter + 1
end

--USE [TempData]
--GO

--TRUNCATE TABLE [dbo].[QueueMeta]
--TRUNCATE TABLE [dbo].[QueueData]


text:
import test from "ava";
import util from "util";
import { EventEmitter } from "../core/EventEmitter.js";
import { startDefaultLoop } from "./startDefaultLoop.js";

const promiseTimeout = util.promisify(setTimeout);

test("emits proper events", async (t) => {
  const app = { event: new EventEmitter() };
  startDefaultLoop(app);

  let expected = 0;
  let updates = 0;
  let draws = 0;

  app.event.addListener("update", () => {
    t.is(updates, expected, "Number of updates should match what we expect.");
    updates++;
  });
  app.event.addListener("draw", () => {
    t.is(draws, expected, "Number of draws should match what we expect.");
    draws++;
    expected++;
  });

  await promiseTimeout(200);
  t.not(updates, 0, "Updates should have occurred.");
  t.not(draws, 0, "Draws should have occurred.");
});

test("returns a function that terminates the loop", async (t) => {
  const app = { event: new EventEmitter() };
  let stopped = false;

  const stopLoop = startDefaultLoop(app);

  app.event.addListener("update", () => {
    if (stopped) t.fail("Should not emit any updates while stopped.");
  });

  stopLoop();
  stopped = true;

  await promiseTimeout(200);
  t.pass();
});

redpajama_set_name: RedPajamaGithub


text:
package com.jcodeshare.webtemplate.service;

import java.util.Date;
import java.util.List;

import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletResponse;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.jcodeshare.webtemplate.data.model.Comments;
import com.jcodeshare.webtemplate.data.model.Users;
import com.jcodeshare.webtemplate.data.service.CommentsService;
import com.jcodeshare.webtemplate.data.service.UsersService;
import com.jcodeshare.webtemplate.service.webdata.FormData;
import com.jcodeshare.webtemplate.service.webdata.FormActionResult;

import org.springframework.web.bind.annotation.CookieValue;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

//import com.fasterxml.jackson.databind.ObjectMapper;
//import com.fasterxml.jackson.annotation.JsonInclude;
//import com.fasterxml.jackson.databind.SerializationFeature;
//import com.fasterxml.jackson.databind.JsonSerializer;
//import com.fasterxml.jackson.core.JsonProcessingException;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.ExclusionStrategy;
import com.google.gson.FieldAttributes;

@RestController
public class UsersController {

    private final Logger logger = LoggerFactory
            .getLogger(CommentsController.class);
    private final static String userCookie = "username";

    // Autowire does not seem to work in tests so I tried putting a setter in
    // and declaring a bean
    @Autowired
    UsersService userService;

    @Autowired
    CommentsService commentService;

    @RequestMapping(value = "/login", method = RequestMethod.POST)
    public FormActionResult userLogin(
            @RequestBody FormData form,
            @CookieValue(value = "userCookie", defaultValue = Users.DEFAULT_USERNAME) String userCookie,
            HttpServletResponse response) {

        Users user = userService.findByUsername(form.getUsername());

        String loginMsg = "Failed to login.";
        String code = "300";
        //logger.info("LOGIN User: " + user);
        //logger.info("LOGIN Form: " + form);

        if ((user != null) && (user.getId() > 0)) {
            if (user.getPassword().equals(form.getPassword())) {
                response.addCookie(new Cookie("userCookie", user.getUsername()));
                loginMsg = "Login Successful";
                code = "200";
            }
        }

        FormActionResult result = new FormActionResult();
        result.setCode(code);
        result.setMsg(loginMsg);
        result.setFormData(form);
        return result;

    }

    @RequestMapping(value = "/register", method = RequestMethod.POST)
    public FormActionResult userRegister(
            @RequestBody FormData form,
            @CookieValue(value = "userCookie", defaultValue = Users.DEFAULT_USERNAME) String userCookie,
            HttpServletResponse response) {

        Users user = new Users();
        user.setPassword(form.getPassword());
        user.setUsername(form.getUsername());
        userService.saveUsers(user);

        String loginMsg = "Failed to create user.";
        String code = "301";
        logger.info("User: " + user);
        logger.info("Form: " + form);

        if ((user != null) && (user.getId() > 0)) {
                response.addCookie(new Cookie("userCookie", user.getUsername()));
                loginMsg = "User "+ user.getUsername() + " was successfuly created.";
                code = "200";
        }

        FormActionResult result = new FormActionResult();
        result.setCode(code);
        result.setMsg(loginMsg);
        result.setFormData(form);
        return result;

    }

    @Transactional
    @RequestMapping(value = "/getUserComments", method = RequestMethod.POST)
    public FormActionResult getUserComments(
            @RequestBody FormData form,
            @CookieValue(value = "userCookie", defaultValue = Users.DEFAULT_USERNAME) String userCookie,
            HttpServletResponse response) {
        //logger.info("GETUSERCOMMENTS userCookie: " + userCookie);
        Users user = userService.findByUsername(userCookie);
        List comments = userService.findAllComments(user);

        //logger.info("GETUSERCOMMENTS user: " + user);
        //logger.info("GETUSERCOMMENTS form: " + form);
        String code = "200";

        FormActionResult result = new FormActionResult();
        result.setCode(code);
        result.setComments(comments);
        result.setFormData(form);

        Gson gson = new GsonBuilder().setExclusionStrategies(
            new ExclusionStrategy() {
            public boolean shouldSkipClass(Class<?> clazz) {
                return false;
            }
            public boolean shouldSkipField(FieldAttributes f) {
                return (f.getDeclaringClass() == Users.class);
            }
         }).create();

        try {

        //logger.info("JSON JACKSON: \n" + gson.toJson(result));
        //logger.info("JSON JACKSON: \n" + gson.toJson(result.getComments()));
        } catch (Exception je) {
            je.printStackTrace();
        }
        //logger.info("Result: " + result);
        return result;

    }

}


text:
package org.conqat.lib.cqddl.parser;

import java.util.HashMap;
import java.util.Map;

import org.antlr.runtime.Parser;
import org.antlr.runtime.RecognitionException;
import org.antlr.runtime.RecognizerSharedState;
import org.antlr.runtime.TokenStream;
import org.conqat.lib.cqddl.function.CQDDLEvaluationException;
import org.conqat.lib.cqddl.function.ICQDDLFunction;

import org.conqat.lib.commons.collections.PairList;

/**
 * Base class for the CQDDL parser.
 *
 * @author hummelb
 * @author $Author: deissenb $
 * @version $Rev: 34252 $
 * @levd.rating YELLOW Hash: 80EFE38F4541B112567F5F8F7E61A957
 */
public abstract class CQDDLParserBase extends Parser {

	/** Stored objects. */
	private final Map<String, Object> storedObjects = new HashMap<String, Object>();

	/** The current set of parameters used for parsing. */
	private CQDDLParsingParameters parsingParameters = new CQDDLParsingParameters();

	/** Stores the error message. */
	private String errorMessage;

	/** Constructor. */
	protected CQDDLParserBase(TokenStream input, RecognizerSharedState state) {
		super(input, state);
	}

	/** Sets/replaced the currently used parsing parameters. */
	public void setParsingParameters(CQDDLParsingParameters parsingParameters) {
		this.parsingParameters = parsingParameters;
	}

	/** {@inheritDoc} */
	@Override
	public void reportError(RecognitionException ex) {
		errorMessage = getErrorMessage(ex, getTokenNames());
	}

	/** Returns the last error message (or null if none occurred). */
	public String getErrorMessage() {
		return errorMessage;
	}

	/** Stores the given object under the name provided. */
	public void storeObject(String name, Object value)
			throws CQDDLParseException {
		if (storedObjects.containsKey(name)) {
			throw new CQDDLParseException("Duplicate stored object name: "
					+ name);
		}
		storedObjects.put(name, value);
	}

	/** Returns a previously stored object. */
	protected Object retrieveObject(String name) throws CQDDLParseException {
		if (!storedObjects.containsKey(name)) {
			throw new CQDDLParseException("Unknown object to retrieve: " + name);
		}
		return storedObjects.get(name);
	}

	/**
	 * Returns the long version of the key if an abbreviation is registered;
	 * otherwise the key itself.
	 */
	protected String resolveKey(String key) {
		if (parsingParameters.keyAbbreviations.containsKey(key)) {
			return parsingParameters.keyAbbreviations.get(key);
		}
		return key;
	}

	/** Evaluates a function and returns the result. */
	protected Object eval(String functionName,
			PairList<String, Object> parameters) throws CQDDLParseException {
		ICQDDLFunction function = parsingParameters.functions.get(functionName);
		if (function == null) {
			throw new CQDDLParseException("No function of name " + functionName
					+ " found!");
		}

		try {
			return function.eval(parameters);
		} catch (CQDDLEvaluationException e) {
			throw new CQDDLParseException("Error while evaluating function "
					+ functionName, e);
		}
	}

	/** Removes quotes from a string. */
	protected static String unquote(String s) {
		return s.substring(1, s.length() - 1);
	}
}


text:
#pragma once
#include <aws/nimble/NimbleStudio_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <aws/core/utils/memory/stl/AWSVector.h>
#include <aws/nimble/model/StreamingImage.h>
#include <utility>

namespace Aws
{
template<typename RESULT_TYPE>
class AmazonWebServiceResult;

namespace Utils
{
namespace Json
{
  class JsonValue;
} // namespace Json
} // namespace Utils
namespace NimbleStudio
{
namespace Model
{
  class AWS_NIMBLESTUDIO_API ListStreamingImagesResult
  {
  public:
    ListStreamingImagesResult();
    ListStreamingImagesResult(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result);
    ListStreamingImagesResult& operator=(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result);

    /**
     *
The token for the next set of results, or null if there are no more
     * results.

     */
    inline const Aws::String& GetNextToken() const{ return m_nextToken; }

    /**
     *
The token for the next set of results, or null if there are no more
     * results.

     */
    inline void SetNextToken(const Aws::String& value) { m_nextToken = value; }

    /**
     *
The token for the next set of results, or null if there are no more
     * results.

     */
    inline void SetNextToken(Aws::String&& value) { m_nextToken = std::move(value); }

    /**
     *
The token for the next set of results, or null if there are no more
     * results.

     */
    inline void SetNextToken(const char* value) { m_nextToken.assign(value); }

    /**
     *
The token for the next set of results, or null if there are no more
     * results.

     */
    inline ListStreamingImagesResult& WithNextToken(const Aws::String& value) { SetNextToken(value); return *this;}

    /**
     *
The token for the next set of results, or null if there are no more
     * results.

     */
    inline ListStreamingImagesResult& WithNextToken(Aws::String&& value) { SetNextToken(std::move(value)); return *this;}

    /**
     *
The token for the next set of results, or null if there are no more
     * results.

     */
    inline ListStreamingImagesResult& WithNextToken(const char* value) { SetNextToken(value); return *this;}

    /**
     *
A collection of streaming images.

     */
    inline const Aws::Vector<StreamingImage>& GetStreamingImages() const{ return m_streamingImages; }

    /**
     *
A collection of streaming images.

     */
    inline void SetStreamingImages(const Aws::Vector<StreamingImage>& value) { m_streamingImages = value; }

    /**
     *
A collection of streaming images.

     */
    inline void SetStreamingImages(Aws::Vector<StreamingImage>&& value) { m_streamingImages = std::move(value); }

    /**
     *
A collection of streaming images.

     */
    inline ListStreamingImagesResult& WithStreamingImages(const Aws::Vector<StreamingImage>& value) { SetStreamingImages(value); return *this;}

    /**
     *
A collection of streaming images.

     */
    inline ListStreamingImagesResult& WithStreamingImages(Aws::Vector<StreamingImage>&& value) { SetStreamingImages(std::move(value)); return *this;}

    /**
     *
A collection of streaming images.

     */
    inline ListStreamingImagesResult& AddStreamingImages(const StreamingImage& value) { m_streamingImages.push_back(value); return *this; }

    /**
     *
A collection of streaming images.

     */
    inline ListStreamingImagesResult& AddStreamingImages(StreamingImage&& value) { m_streamingImages.push_back(std::move(value)); return *this; }

  private:

    Aws::String m_nextToken;

    Aws::Vector<StreamingImage> m_streamingImages;
  };

} // namespace Model
} // namespace NimbleStudio
} // namespace Aws


text:
typedef struct _felem {
  float *feat;
} FElem;

typedef struct _features {
  FElem *elem;
  int  nfeats;
  int  nelems;
  int  nrows,ncols;
  int  Imax;
} Features;

/// Allocates memory for features
Features* CreateFeatures(int ncols, int nrows, int nfeats);

/// Deallocates memory for features
void DestroyFeatures(Features **f);

Features* CopyFeatures(Features* feat);

// using convolution with gaussian filters
Features *GaussImageFeats(Image *img, int nscales);
Features *GaussCImageFeats(CImage *cimg, int nscales);

Features* LabFeats(Features* rgb);

#endif // _FEATURE_H_


text:
var lineReader = require('line-reader');

function handleReader(reader, delay, callback) {
  if (reader.hasNextLine()) {
    reader.nextLine(callback);
    setTimeout(handleReader.bind(null, reader, delay, callback), delay);
  } else {
    reader.close();
  }
}

function lineByLine(file, delay, callback) {
  lineReader.open(file, function(reader) {
    handleReader(reader, delay, callback);
  });
}

// var lineByLine = require './lib/line-by-line'
// lineByLine('./test/test_data.csv', 1000, function(line) {
//   console.log(line);
// });

module.exports = lineByLine;


text:
// Copyright (c) Pomelo Foundation. All rights reserved.
// Licensed under the MIT. See LICENSE in the project root for license information.

using Microsoft.EntityFrameworkCore.Storage;

namespace Pomelo.EntityFrameworkCore.MySql.Storage.Internal
{
    public interface IDefaultValueCompatibilityAware
    {
        /// <summary>
        ///     Creates a copy of this mapping.
        /// </summary>
        /// <param name="isDefaultValueCompatible"> Use a default value compatible syntax, or not. </param>
        /// <returns> The newly created mapping. </returns>
        RelationalTypeMapping Clone(bool isDefaultValueCompatible = false);
    }
}


text:
<?xml version="1.0"?>
<package>
  <name>easydepthcalibration</name>
  <version>0.0.0</version>
  <description>The easyDepthCalib package</description>

  <maintainer email="dicicco@dis.uniroma1.it">Maurilio Di Cicco</maintainer>
  <license>BSD</license>
  <buildtool_depend>catkin</buildtool_depend>
  <build_depend>roscpp</build_depend>
  <build_depend>sensor_msgs</build_depend>
  <build_depend>std_msgs</build_depend>
  <build_depend>cv</build_depend>
  <run_depend>roscpp</run_depend>
  <run_depend>sensor_msgs</run_depend>
  <run_depend>std_msgs</run_depend>
  <build_depend>cv</build_depend>
</package>


text:
export const MARKER_TYPE = 'marker';

import {
  normalizeTagName
} from '../utils/dom-utils';
import {
  detect,
  commonItemLength
} from 'content-kit-editor/utils/array-utils';
import LinkedItem from "content-kit-editor/utils/linked-item";

const Marker = class Marker extends LinkedItem {
  constructor(value='', markups=[]) {
    super();
    this.value = value;
    this.markups = [];
    this.type = MARKER_TYPE;

    if (markups && markups.length) {
      markups.forEach(m => this.addMarkup(m));
    }
  }

  clone() {
    const clonedMarkups = this.markups.slice();
    return this.builder.createMarker(this.value, clonedMarkups);
  }

  get isEmpty() {
    return this.length === 0;
  }

  get length() {
    return this.value.length;
  }

  truncateFrom(offset) {
    this.value = this.value.substr(0, offset);
  }

  truncateTo(offset) {
    this.value = this.value.substr(offset);
  }

  clearMarkups() {
    this.markups = [];
  }

  addMarkup(markup) {
    this.markups.push(markup);
  }

  removeMarkup(markup) {
    const index = this.markups.indexOf(markup);
    if (index !== -1) {
      this.markups.splice(index, 1);
    }
  }

  // delete the character at this offset,
  // update the value with the new value
  deleteValueAtOffset(offset) {
    const [ left, right ] = [
      this.value.slice(0, offset),
      this.value.slice(offset+1)
    ];
    this.value = left + right;
  }

  hasMarkup(tagNameOrMarkup) {
    if (typeof tagNameOrMarkup === 'string') {
      let tagName = normalizeTagName(tagNameOrMarkup);
      return detect(this.markups, markup => markup.tagName === tagName);
    } else {
      let targetMarkup = tagNameOrMarkup;
      return detect(this.markups, markup => markup === targetMarkup);
    }
  }

  getMarkup(tagName) {
    return this.hasMarkup(tagName);
  }

  join(other) {
    const joined = this.builder.createMarker(this.value + other.value);
    this.markups.forEach(m => joined.addMarkup(m));
    other.markups.forEach(m => joined.addMarkup(m));

    return joined;
  }

  split(offset=0, endOffset=this.length) {
    let markers = [];

    markers = [
      this.builder.createMarker(this.value.substring(0, offset)),
      this.builder.createMarker(this.value.substring(offset, endOffset)),
      this.builder.createMarker(this.value.substring(endOffset))
    ];

    this.markups.forEach(mu => markers.forEach(m => m.addMarkup(mu)));
    return markers;
  }

  get openedMarkups() {
    let count = 0;
    if (this.prev) {
      count = commonItemLength(this.markups, this.prev.markups);
    }

    return this.markups.slice(count);
  }

  get closedMarkups() {
    let count = 0;
    if (this.next) {
      count = commonItemLength(this.markups, this.next.markups);
    }

    return this.markups.slice(count);
  }

};

export default Marker;


text:
\hypertarget{dir_d422163b96683743ed3963d4aac17747}{\section{/home/viki/\-Documents/\-E\-N\-P\-M808\-X/\-Midterm/\-Midterm\-\_\-\-Perception/app Directory Reference}
\label{dir_d422163b96683743ed3963d4aac17747}\index{/home/viki/\-Documents/\-E\-N\-P\-M808\-X/\-Midterm/\-Midterm\-\_\-\-Perception/app Directory Reference@{/home/viki/\-Documents/\-E\-N\-P\-M808\-X/\-Midterm/\-Midterm\-\_\-\-Perception/app Directory Reference}}
}
\subsection*{Files}
\begin{DoxyCompactItemize}
\item
file \hyperlink{camera_8cpp}{camera.\-cpp}
\begin{DoxyCompactList}\small\item\em \hyperlink{classCamera}{Camera} Class implementation. \end{DoxyCompactList}\item
file \hyperlink{laserRangeFinder_8cpp}{laser\-Range\-Finder.\-cpp}
\begin{DoxyCompactList}\small\item\em \hyperlink{classLaserRangeFinder}{Laser\-Range\-Finder} Class implementation. \end{DoxyCompactList}\item
file \hyperlink{main_8cpp}{main.\-cpp}
\begin{DoxyCompactList}\small\item\em Program main. \end{DoxyCompactList}\item
file \hyperlink{objectDetection_8cpp}{object\-Detection.\-cpp}
\begin{DoxyCompactList}\small\item\em \hyperlink{classObjectDetection}{Object\-Detection} Class implementation. \end{DoxyCompactList}\item
file \hyperlink{visionSystem_8cpp}{vision\-System.\-cpp}
\begin{DoxyCompactList}\small\item\em \hyperlink{classVisionSystem}{Vision\-System} Class implementation. \end{DoxyCompactList}\end{DoxyCompactItemize}


text:
package ecscni

import (
	"context"
	"errors"
	"time"

	"github.com/containernetworking/cni/pkg/types/current"
)

const (
	// vpcCNIPluginPath is the path of the cni plugin's log file.
	vpcCNIPluginPath = "/log/vpc-branch-eni.log"
)

// newCNIGuard returns a new instance of CNI guard for the CNI client.
// It is supported only on Windows.
func newCNIGuard() cniGuard {
	return &guard{
		mutex: nil,
	}
}

type cniPluginVersion struct{}

// setupNS is the called by SetupNS to setup the task namespace by invoking ADD for given CNI configurations
// On unsupported platforms, we will return an error
func (client *cniClient) setupNS(ctx context.Context, cfg *Config) (*current.Result, error) {
	return nil, errors.New("unsupported platform")
}

// ReleaseIPResource marks the ip available in the ipam db
// On unsupported platforms, we will return an error
func (client *cniClient) ReleaseIPResource(ctx context.Context, cfg *Config, timeout time.Duration) error {
	return errors.New("unsupported platform")
}

// str generates a string version of the CNI plugin version
// On unsupported platforms, we will return an empty string
func (version *cniPluginVersion) str() string {
	return ""
}


text:
[![Build Status](https://travis-ci.org/MonadNomads/PathFinder.svg?branch=master)](https://travis-ci.org/MonadNomads/PathFinder)

# PathFinder
Find your way in a multi-level maze with randomly behaving elevators!


text:
package com.example.share.adapter;

import com.example.share.R;
import com.example.share.adapter.HomePageListViewAdapter.Viewgroup;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class BroadcastListViewAdapter extends BaseAdapter{
	private Context mContext;
	public BroadcastListViewAdapter(Context mContext){
		this.mContext = mContext;
	}
	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return 4;
	}

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

	@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
		View view;
		Viewgroup viewgroup;
		if (convertView == null) {
			view = LayoutInflater.from(mContext).inflate(
					R.layout.broadcast_listview_item, null);
			viewgroup = new Viewgroup();
			// °ó¶¨id²Ù×÷
			viewgroup.name_tv = (TextView) view.findViewById(R.id.broadcast_user_name);
			viewgroup.comment_iv = (ImageView) view.findViewById(R.id.broadcast_comment_iv);
			viewgroup.comment_tv = (TextView) view.findViewById(R.id.broadcast_commentcounts);
			viewgroup.user_iv = (ImageView) view.findViewById(R.id.broadcast_user_logo);
			viewgroup.content_tv = (TextView) view.findViewById(R.id.broadcast_content);
			viewgroup.time_tv = (TextView) view.findViewById(R.id.broadcast_time);
			view.setTag(viewgroup);
		} else {
			view = convertView;
			viewgroup = (Viewgroup) view.getTag();
		}
		// ΪTextView¼ÓÉÏÄÚÈÝ
		return view;
	}

	// ¸ù¾ÝUserÀïÃæµÄÊôÐÔ½øÐÐÌí¼Ó
	class Viewgroup {
		TextView name_tv;
		ImageView user_iv;
		TextView content_tv;
		TextView comment_tv;
		ImageView comment_iv;
		TextView time_tv;
	}
}


text:
.container {
    display: grid;
    grid-template-columns: 250px auto;
    grid-template-row: 1fr auto 1fr;
    grid-gap: 10px;
}

header, aside, article, footer {
    background: #eee;
    padding: 3px;
}

header, footer {
    grid-column: 1 / 4;
}

article {
    grid-column: 2 / 4;
}

nav {
  justify-content: space-between !important;
}


text:
package org.lnu.is.domain.property;

import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.lnu.is.annotation.dbtable.OB;
import org.lnu.is.domain.InformationModel;

/**
 * Property entity.
 * @author illay
 *
 */
@OB
@Entity
@Table(name = "q_ob_property")
public class Property extends InformationModel {

	private static final long serialVersionUID = 1L;

	@ManyToOne
	@JoinColumn(name = "propertytype_id")
	private PropertyType propertyType;

	@ManyToOne
	@JoinColumn(name = "parent_id")
	private Property parent;

	@OneToMany(mappedBy = "property")
	private List<PropertyValue> values;

	@Column(name = "abbrname")
	private String abbrname;

	@Column(name = "name")
	private String name;

	@Column(name = "sortnum")
	private Integer sortNum;

	@Column(name = "priority")
	private Integer priority;

	public PropertyType getPropertyType() {
		return propertyType;
	}

	public void setPropertyType(final PropertyType propertyType) {
		this.propertyType = propertyType;
	}

	public Property getParent() {
		return parent;
	}

	public void setParent(final Property parent) {
		this.parent = parent;
	}

	public String getAbbrname() {
		return abbrname;
	}

	public void setAbbrname(final String abbrname) {
		this.abbrname = abbrname;
	}

	public String getName() {
		return name;
	}

	public void setName(final String name) {
		this.name = name;
	}

	public Integer getSortNum() {
		return sortNum;
	}

	public void setSortNum(final Integer sortNum) {
		this.sortNum = sortNum;
	}

	public Integer getPriority() {
		return priority;
	}

	public void setPriority(final Integer priority) {
		this.priority = priority;
	}

	public List<PropertyValue> getValues() {
		return values;
	}

	public void setValues(final List<PropertyValue> values) {
		this.values = values;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = super.hashCode();
		result = prime * result
				+ ((abbrname == null) ? 0 : abbrname.hashCode());
		result = prime * result + ((name == null) ? 0 : name.hashCode());
		result = prime * result
				+ ((priority == null) ? 0 : priority.hashCode());
		result = prime * result + ((sortNum == null) ? 0 : sortNum.hashCode());
		return result;
	}

	@Override
	public boolean equals(final Object obj) {
		if (this == obj) {
			return true;
		}
		if (!super.equals(obj)) {
			return false;
		}
		if (getClass() != obj.getClass()) {
			return false;
		}
		Property other = (Property) obj;
		if (abbrname == null) {
			if (other.abbrname != null) {
				return false;
			}
		} else if (!abbrname.equals(other.abbrname)) {
			return false;
		}
		if (name == null) {
			if (other.name != null) {
				return false;
			}
		} else if (!name.equals(other.name)) {
			return false;
		}
		if (priority == null) {
			if (other.priority != null) {
				return false;
			}
		} else if (!priority.equals(other.priority)) {
			return false;
		}
		if (sortNum == null) {
			if (other.sortNum != null) {
				return false;
			}
		} else if (!sortNum.equals(other.sortNum)) {
			return false;
		}
		return true;
	}

	@Override
	public String toString() {
		return "Property [abbrname=" + abbrname + ", name=" + name
				+ ", sortNum=" + sortNum + ", priority=" + priority + "]";
	}

}


text:
package com.bestxty.sault.internal.hunter;

import android.net.Uri;

import com.bestxty.sault.ApplicationTestCase;
import com.bestxty.sault.Downloader;
import com.bestxty.sault.Sault;
import com.bestxty.sault.internal.Utils;
import com.bestxty.sault.internal.di.modules.HunterModule;
import com.bestxty.sault.internal.dispatcher.HunterEventDispatcher;
import com.bestxty.sault.internal.di.components.DaggerSaultComponent;
import com.bestxty.sault.internal.di.components.SaultComponent;
import com.bestxty.sault.internal.di.modules.SaultModule;
import com.bestxty.sault.internal.task.PartedSaultTask;

import org.junit.Before;
import org.junit.Test;
import org.mockito.Matchers;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.api.support.membermodification.MemberMatcher;
import org.powermock.api.support.membermodification.MemberModifier;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.robolectric.RuntimeEnvironment;

import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.InterruptedIOException;
import java.nio.charset.Charset;

import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.mockito.Matchers.anyLong;
import static org.mockito.Mockito.atLeastOnce;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoMoreInteractions;
import static org.mockito.Mockito.when;

/**
 * @author 姜泰阳
 *         Created by 姜泰阳 on 2017/10/17.
 */
@PrepareForTest({Utils.class, Sault.class, SaultModule.class,
        DefaultSaultTaskHunter.class, DaggerHunterComponent.class,
        DaggerHunterComponent.Builder.class})
public class DefaultSaultTaskHunterTest extends ApplicationTestCase {

    private DefaultSaultTaskHunter taskHunter;

    private Sault sault;

    @Mock
    private PartedSaultTask task;

    @Mock
    private Downloader downloader;

    @Mock
    private Downloader.Response response;

    private InputStream inputStream;

    @Mock
    private Uri uri;

    @Mock
    private HunterEventDispatcher hunterEventDispatcher;

    @Override
    @Before
    public void setUp() throws Exception {
        super.setUp();
        sault = PowerMockito.mock(Sault.class);
        when(task.getSault()).thenReturn(sault);
        SaultComponent saultComponent = Mockito.mock(SaultComponent.class);
        when(sault.getSaultComponent()).thenReturn(saultComponent);

        DaggerHunterComponent hunterComponent = Mockito.mock(DaggerHunterComponent.class);
        DaggerHunterComponent.Builder builder = Mockito.mock(DaggerHunterComponent.Builder.class);
        PowerMockito.mockStatic(DaggerHunterComponent.class);

        PowerMockito.when(DaggerHunterComponent.builder()).thenReturn(builder);
        PowerMockito.when(builder, MemberMatcher.method(DaggerHunterComponent.Builder.class, "hunterModule", HunterModule.class))
                .withArguments(Matchers.any())
                .thenReturn(builder);
        PowerMockito.when(builder, MemberMatcher.method(DaggerHunterComponent.Builder.class, "saultComponent", SaultComponent.class))
                .withArguments(Matchers.any())
                .thenReturn(builder);
        PowerMockito.when(builder, MemberMatcher.method(DaggerHunterComponent.Builder.class, "build"))
                .withNoArguments()
                .thenReturn(hunterComponent);

        taskHunter = new DefaultSaultTaskHunter(task);

        inputStream = new ByteArrayInputStream("test".getBytes(Charset.forName("UTF-8")));

        MemberModifier.field(DefaultSaultTaskHunter.class, "downloader").set(taskHunter, downloader);
        MemberModifier.field(Downloader.Response.class, "stream").set(response, inputStream);
        MemberModifier.field(DefaultSaultTaskHunter.class, "eventDispatcher").set(taskHunter, hunterEventDispatcher);
        when(task.getUri()).thenReturn(uri);
    }

    @Test
    public void hunterWithContentLengthException() throws Exception {
        when(task.getStartPosition()).thenReturn(0L);
        when(task.getEndPosition()).thenReturn(1000L);
        MemberModifier.field(Downloader.Response.class, "contentLength").set(response, 0);
        when(downloader.load(uri, 0, 1000)).thenReturn(response);

        File target = createDummyFile();
        Utils.createTargetFile(target);
        when(task.getTarget()).thenReturn(target);

        taskHunter.hunter();
        if (taskHunter.getException() != null) taskHunter.getException().printStackTrace();
        assertNotNull(taskHunter.getException());
        verify(task, never()).notifyFinishedSize(anyLong());
        verify(hunterEventDispatcher, never()).dispatchHunterFinish(taskHunter);
        verify(hunterEventDispatcher, times(1)).dispatchHunterFailed(taskHunter);
        verify(hunterEventDispatcher, never()).dispatchHunterRetry(taskHunter);
        verify(hunterEventDispatcher, never()).dispatchHunterException(taskHunter);
        verifyNoMoreInteractions(hunterEventDispatcher);
    }

    @Test
    public void hunterWithStreamContentLengthException() throws Exception {
        when(task.getStartPosition()).thenReturn(0L);
        when(task.getEndPosition()).thenReturn(1000L);
        MemberModifier.field(Downloader.Response.class, "stream").set(response, null);
        MemberModifier.field(Downloader.Response.class, "contentLength").set(response, 1000);
        when(downloader.load(uri, 0, 1000)).thenReturn(response);

        File target = createDummyFile();
        Utils.createTargetFile(target);
        when(task.getTarget()).thenReturn(target);

        taskHunter.hunter();
        if (taskHunter.getException() != null) taskHunter.getException().printStackTrace();
        assertNotNull(taskHunter.getException());
        verify(task, never()).notifyFinishedSize(anyLong());
        verify(hunterEventDispatcher, never()).dispatchHunterFinish(taskHunter);
        verify(hunterEventDispatcher, times(1)).dispatchHunterFailed(taskHunter);
        verify(hunterEventDispatcher, never()).dispatchHunterRetry(taskHunter);
        verify(hunterEventDispatcher, never()).dispatchHunterException(taskHunter);
        verifyNoMoreInteractions(hunterEventDispatcher);
    }

    @Test
    public void hunterWithResponseException() throws Exception {
        when(task.getStartPosition()).thenReturn(0L);
        when(task.getEndPosition()).thenReturn(1000L);
        MemberModifier.field(Downloader.Response.class, "contentLength").set(response, 1000);
        when(downloader.load(uri, 0, 1000)).thenThrow(new Downloader.ResponseException("", 400));

        File target = createDummyFile();
        Utils.createTargetFile(target);
        when(task.getTarget()).thenReturn(target);

        taskHunter.hunter();
        if (taskHunter.getException() != null) taskHunter.getException().printStackTrace();
        assertNotNull(taskHunter.getException());
        verify(task, never()).notifyFinishedSize(anyLong());
        verify(hunterEventDispatcher, never()).dispatchHunterFinish(taskHunter);
        verify(hunterEventDispatcher, times(1)).dispatchHunterFailed(taskHunter);
        verify(hunterEventDispatcher, never()).dispatchHunterRetry(taskHunter);
        verify(hunterEventDispatcher, never()).dispatchHunterException(taskHunter);
        verifyNoMoreInteractions(hunterEventDispatcher);
    }

    @Test
    public void hunterWithInterruptedIOException() throws Exception {
        when(task.getStartPosition()).thenReturn(0L);
        when(task.getEndPosition()).thenReturn(1000L);
        MemberModifier.field(Downloader.Response.class, "contentLength").set(response, 1000);
        when(downloader.load(uri, 0, 1000)).thenReturn(response);
//        PowerMockito.when(task, "copyStream", inputStream,0L).thenThrow(new InterruptedIOException("test-exception"));
        MemberModifier.stub(MemberMatcher.method(DefaultSaultTaskHunter.class, "copyStream", InputStream.class, Long.TYPE))
                .toThrow(new InterruptedIOException("test-exception"));
        File target = createDummyFile();
        Utils.createTargetFile(target);
        when(task.getTarget()).thenReturn(target);

        taskHunter.hunter();
        if (taskHunter.getException() != null) taskHunter.getException().printStackTrace();
        assertNotNull(taskHunter.getException());
        verify(task, never()).notifyFinishedSize(anyLong());
        verify(hunterEventDispatcher, never()).dispatchHunterFinish(taskHunter);
        verify(hunterEventDispatcher, times(1)).dispatchHunterFailed(taskHunter);
        verify(hunterEventDispatcher, never()).dispatchHunterRetry(taskHunter);
        verify(hunterEventDispatcher, never()).dispatchHunterException(taskHunter);
        verifyNoMoreInteractions(hunterEventDispatcher);
    }

    @Test
    public void hunterWithIOException() throws Exception {
        when(task.getStartPosition()).thenReturn(0L);
        when(task.getEndPosition()).thenReturn(1000L);
        MemberModifier.field(Downloader.Response.class, "contentLength").set(response, 1000);
        when(downloader.load(uri, 0, 1000)).thenReturn(response);
//        PowerMockito.when(task, "copyStream", inputStream,0L).thenThrow(new InterruptedIOException("test-exception"));
        MemberModifier.stub(MemberMatcher.method(DefaultSaultTaskHunter.class, "copyStream", InputStream.class, Long.TYPE))
                .toThrow(new IOException("test-exception"));
        File target = createDummyFile();
        Utils.createTargetFile(target);
        when(task.getTarget()).thenReturn(target);

        taskHunter.hunter();
        if (taskHunter.getException() != null) taskHunter.getException().printStackTrace();
        assertNotNull(taskHunter.getException());
        verify(task, never()).notifyFinishedSize(anyLong());
        verify(hunterEventDispatcher, never()).dispatchHunterFinish(taskHunter);
        verify(hunterEventDispatcher, never()).dispatchHunterFailed(taskHunter);
        verify(hunterEventDispatcher, times(1)).dispatchHunterRetry(taskHunter);
        verify(hunterEventDispatcher, never()).dispatchHunterException(taskHunter);
        verifyNoMoreInteractions(hunterEventDispatcher);
    }

    @Test
    public void hunterWithException() throws Exception {
        when(task.getStartPosition()).thenReturn(0L);
        when(task.getEndPosition()).thenReturn(1000L);
        MemberModifier.field(Downloader.Response.class, "contentLength").set(response, 1000);
        when(downloader.load(uri, 0, 1000)).thenReturn(response);
//        PowerMockito.when(task, "copyStream", inputStream,0L).thenThrow(new InterruptedIOException("test-exception"));
        MemberModifier.stub(MemberMatcher.method(DefaultSaultTaskHunter.class, "copyStream", InputStream.class, Long.TYPE))
                .toThrow(new Exception("test-exception"));
        File target = createDummyFile();
        Utils.createTargetFile(target);
        when(task.getTarget()).thenReturn(target);

        taskHunter.hunter();
        if (taskHunter.getException() != null) taskHunter.getException().printStackTrace();
        assertNotNull(taskHunter.getException());
        verify(task, never()).notifyFinishedSize(anyLong());
        verify(hunterEventDispatcher, never()).dispatchHunterFinish(taskHunter);
        verify(hunterEventDispatcher, never()).dispatchHunterFailed(taskHunter);
        verify(hunterEventDispatcher, never()).dispatchHunterRetry(taskHunter);
        verify(hunterEventDispatcher, times(1)).dispatchHunterException(taskHunter);
        verifyNoMoreInteractions(hunterEventDispatcher);
    }

    @Test
    public void hunter() throws Exception {
        when(task.getStartPosition()).thenReturn(0L);
        when(task.getEndPosition()).thenReturn(1000L);
        MemberModifier.field(Downloader.Response.class, "contentLength").set(response, 1000);
        when(downloader.load(uri, 0, 1000)).thenReturn(response);

        File target = createDummyFile();
        Utils.createTargetFile(target);
        when(task.getTarget()).thenReturn(target);

        taskHunter.hunter();
        if (taskHunter.getException() != null) taskHunter.getException().printStackTrace();
        assertNull(taskHunter.getException());
        verify(task, atLeastOnce()).notifyFinishedSize(anyLong());
        verify(hunterEventDispatcher, times(1)).dispatchHunterFinish(taskHunter);
        verify(hunterEventDispatcher, never()).dispatchHunterFailed(taskHunter);
        verify(hunterEventDispatcher, never()).dispatchHunterRetry(taskHunter);
        verify(hunterEventDispatcher, never()).dispatchHunterException(taskHunter);
        verifyNoMoreInteractions(hunterEventDispatcher);
    }

    private File createDummyFile() {
        String dummyFilePath = RuntimeEnvironment.application.getCacheDir().getPath() + File.separator + "dummyFile";
        return new File(dummyFilePath);
    }

}


text:
package ru.agrin.array;

import org.junit.Test;

import static org.hamcrest.core.Is.is;
import static org.junit.Assert.*;
/**
 * Created by grin on 18.11.2016.
 */
public class BubbleTest {
    @Test
    public void testBubbleSort() {
        int[] array = new int[] {1, 2, 4, 5, 8};
	    Bubble bubble = new Bubble();
        int[] result = bubble.bubbleSort(bubble.values);
        assertThat(result, is(array));
    }
}


text:
import pytest
import re

from insights.tests import context_wrap
from insights.parsers import ethtool, ParseException
from insights.util import keys_in

SUCCESS_ETHTOOL_A = """
Pause parameters for enp0s25:
Autonegotiate : on
RX:             off
TX:             off
RX negotiated:  off
TX negotiated:  off
""".strip()

SUCCESS_ETHTOOL_A_PATH = """
sos_commands/networking/ethtool_-a_enp0s25
""".strip()

FAIL_ETHTOOL_A = """
Cannot get device pause settings: Operation not supported
Pause parameters for __wlp3s0:
""".strip()

FAIL_ETHTOOL_A_PATH = """
sos_commands/networking/ethtool_-a___wlp3s0
""".strip()

FAIL_ETHTOOL_A_1 = """
ethtool: bad command line argument(s)
For more information run ethtool -h
""".strip()
FAIL_ETHTOOL_A_PATH_1 = """
sos_commands/networking/ethtool_-a_bond0.1384@bond0
""".strip()

FAIL_ETHTOOL_A_2 = """
ethtool version 6
Usage:
ethtool DEVNAME Display standard information about device
    ethtool -s|--change DEVNAME
""".strip()
FAIL_ETHTOOL_A_PATH_2 = """
sos_commands/networking/ethtool_-a_g_bond2
""".strip()

SUCCESS_ETHTOOL_A_BLANK_LINE = """
Pause parameters for enp0s25:

Autonegotiate : on
RX:             off
TX:             off
RX negotiated:  off
TX negotiated:  off
""".strip()

def test_ethtool_a():
    context = context_wrap(SUCCESS_ETHTOOL_A)
    context.path = SUCCESS_ETHTOOL_A_PATH
    result = ethtool.Pause(context)
    assert result.ifname == "enp0s25"
    assert result.autonegotiate
    assert not result.rx
    assert not result.tx
    assert not result.rx_negotiated
    assert not result.tx_negotiated

def test_ethtool_a_1():
    context = context_wrap(FAIL_ETHTOOL_A)
    context.path = FAIL_ETHTOOL_A_PATH
    result = ethtool.Pause(context)
    assert result.ifname == "__wlp3s0"
    assert not result.autonegotiate

def test_ethtool_a_2():
    context = context_wrap(FAIL_ETHTOOL_A_1)
    context.path = FAIL_ETHTOOL_A_PATH_1
    result = ethtool.Pause(context)
    assert result.ifname == "bond0.1384@bond0"

def test_ethtool_a_3():
    context = context_wrap(FAIL_ETHTOOL_A_2)
    context.path = FAIL_ETHTOOL_A_PATH_2
    result = ethtool.Pause(context)
    assert result.ifname == "g_bond2"

def test_ethtool_a_blank_line():
    context = context_wrap(SUCCESS_ETHTOOL_A_BLANK_LINE, path=SUCCESS_ETHTOOL_A_PATH)
    result = ethtool.Pause(context)
    assert result.ifname == "enp0s25"

TEST_ETHTOOL_C = """
Coalesce parameters for eth2:
Adaptive RX: off  TX: off
pkt-rate-high: 10

tx-usecs-irq: 0
tx-frame-low: 25

tx-usecs-high: 0
tx-frame-high: 0

""".strip()

TEST_ETHTOOL_C_PATH = "sos_commands/networking/ethtool_-c_eth2"

TEST_ETHTOOL_C_CANNOT_GET = """
Cannot get device coalesce settings: Operation not supported
Coalesce parameters for usb0:
""".strip()

TEST_ETHTOOL_C_BAD_ARGS = """
ethtool: bad command line argument(s)
For more information run ethtool -h
"""

TEST_ETHTOOL_C_SHORT = """
Coalesce parameters for eth2:
""".strip()

def test_get_ethtool_c():
    context = context_wrap(TEST_ETHTOOL_C)
    context.path = TEST_ETHTOOL_C_PATH
    result = ethtool.CoalescingInfo(context)
    assert keys_in(["adaptive-rx", "adaptive-tx", "pkt-rate-high",
                    "tx-usecs-irq", "tx-frame-low", "tx-usecs-high", "tx-frame-high"], result.data)
    assert result.ifname == "eth2"
    assert not result.adaptive_rx
    assert not result.adaptive_tx
    assert result.pkt_rate_high == 10
    assert result.tx_usecs_irq == 0
    assert result.tx_frame_low == 25
    assert result.tx_usecs_high == 0
    assert result.tx_frame_high == 0

def test_get_ethtool_c_cannot_get():
    context = context_wrap(TEST_ETHTOOL_C_CANNOT_GET)
    context.path = 'sos_commands/networking/ethtool_-c_usb0'
    result = ethtool.CoalescingInfo(context)
    assert result.ifname == 'usb0'

def test_get_ethtool_c_bad_args():
    context = context_wrap(TEST_ETHTOOL_C_BAD_ARGS)
    context.path = 'sos_commands/networking/ethtool_-c_eth0'
    result = ethtool.CoalescingInfo(context)
    assert result.ifname == 'eth0'

def test_get_ethtool_c_short():
    context = context_wrap(TEST_ETHTOOL_C_SHORT, path=TEST_ETHTOOL_C_PATH)
    with pytest.raises(ParseException) as exc:
        ethtool.CoalescingInfo(context)
    assert 'Command output missing value data' in str(exc)

TEST_ETHTOOL_G = """
Ring parameters for eth2:
Pre-set maximums:
RX:     2047
RX Mini:    0
RX Jumbo:   0
TX:     511

Current hardware settings:
RX:     200
RX Mini:    0
RX Jumbo:   0
TX:     511

""".strip()

TEST_ETHTOOL_G_PATH = """
sos_commands/networking/ethtool_-g_eth2
""".strip()

TEST_ETHTOOL_G_1 = """
Cannot get device ring settings: No such device
Ring parameters for bond0.102@bond0:

"""

TEST_ETHTOOL_G_PATH_1 = """
sos-command/neworking/ethtool_-g_bond2.102@bond2
"""

TEST_ETHTOOL_G_2 = """
ethtool: bad command line argument(s)
For more information run ethtool -h
"""

TEST_ETHTOOL_G_PATH_2 = """
sos_commands/networkking/ethtool_-g_eth2
"""

def test_ethtool_g():
    context = context_wrap(TEST_ETHTOOL_G)
    context.path = TEST_ETHTOOL_G_PATH
    result = ethtool.Ring(context)
    assert keys_in(["max", "current"], result.data)

    assert result.ifname == "eth2"
    assert result.data['max'].rx == 2047
    assert result.data['max'].rx_mini == 0
    assert result.data['max'].rx_jumbo == 0
    assert result.data['max'].tx == 511
    assert result.max.rx == 2047
    assert result.max.rx_mini == 0
    assert result.max.rx_jumbo == 0
    assert result.max.tx == 511
    assert result.current.rx == 200
    assert result.current.rx_mini == 0
    assert result.current.rx_jumbo == 0
    assert result.current.tx == 511

def test_ethtool_g_1():
    context = context_wrap(TEST_ETHTOOL_G_1)
    context.path = TEST_ETHTOOL_G_PATH_1
    result = ethtool.Ring(context)
    assert result.ifname == "bond0.102@bond0"

def test_ethtool_g_2():
    context = context_wrap(TEST_ETHTOOL_G_2)
    context.path = TEST_ETHTOOL_G_PATH_2
    result = ethtool.Ring(context)
    assert result.ifname == "eth2"

TEST_ETHTOOL_I_GOOD = """
driver: virtio_net
version: 1.0.0
firmware-version:
bus-info: 0000:00:03.0
supports-statistics: no
supports-test: no
supports-eeprom-access: no
supports-register-dump: no
supports-priv-flags: no
"""

TEST_ETHTOOL_I_MISSING_KEYS = """
driver: virtio_net
firmware-version:
bus-info: 0000:00:03.0
supports-statistics: no
supports-test: no
supports-eeprom-access: no
supports-register-dump: no
supports-priv-flags: no
something without a colon here is ignored
"""

def test_good():
    context = context_wrap(TEST_ETHTOOL_I_GOOD)
    parsed = ethtool.Driver(context)
    assert parsed.version == "1.0.0"
    assert parsed.driver == 'virtio_net'
    assert parsed.firmware_version is None
    assert parsed.bus_info == '0000:00:03.0'
    assert not parsed.supports_statistics
    assert not parsed.supports_test
    assert not parsed.supports_eeprom_access
    assert not parsed.supports_register_dump
    assert not parsed.supports_priv_flags

def test_missing_version():
    context = context_wrap(TEST_ETHTOOL_I_MISSING_KEYS)
    parsed = ethtool.Driver(context)
    assert parsed.version is None

def test_missing_value():
    context = context_wrap(TEST_ETHTOOL_I_GOOD)
    parsed = ethtool.Driver(context)
    assert parsed.firmware_version is None

def test_iface():
    context = context_wrap(TEST_ETHTOOL_I_GOOD, path="sbin/ethtool_-i_eth0")
    parsed = ethtool.Driver(context)
    assert parsed.ifname == "eth0"

def test_no_iface():
    context = context_wrap(TEST_ETHTOOL_I_GOOD, path="foo/bar/baz/oopsie")
    parsed = ethtool.Driver(context)
    assert parsed.ifname is None

ETHTOOL_K_STANDARD = """
Features for bond0:
rx-checksumming: off [fixed]
tx-checksumming: on
    tx-checksum-ipv4: off [fixed]
    tx-checksum-unneeded: on [fixed]
    tx-checksum-ip-generic: off [fixed]
    tx-checksum-ipv6: off [fixed]
    tx-checksum-fcoe-crc: off [fixed]
    tx-checksum-sctp: off [fixed]
scatter-gather: on
    tx-scatter-gather: on [fixed]
    tx-scatter-gather-fraglist: off [fixed]
tcp-segmentation-offload: on
    tx-tcp-segmentation: on [fixed]
    tx-tcp-ecn-segmentation: on [fixed]
    tx-tcp6-segmentation: on [fixed]
udp-fragmentation-offload: off [fixed]
generic-segmentation-offload: off [requested on]
generic-receive-offload: on
large-receive-offload: on
rx-vlan-offload: on
tx-vlan-offload: on
ntuple-filters: off
receive-hashing: off
highdma: on [fixed]
rx-vlan-filter: on [fixed]
vlan-challenged: off [fixed]
tx-lockless: on [fixed]
netns-local: off [fixed]
tx-gso-robust: off [fixed]
tx-fcoe-segmentation: off [fixed]
tx-gre-segmentation: on [fixed]
tx-udp_tnl-segmentation: on [fixed]
fcoe-mtu: off [fixed]
loopback: off [fixed]
"""

ETHTOOL_K_BAD_ARGS = """
ethtool: bad command line argument(s)
For more information run ethtool -h
""".strip()

ETHTOOL_K_CANNOT_GET = """
Cannot get stats strings information: Operation not supported
""".strip()

ETHTOOL_K_MISSING_COLON = """
Features for bond0:
rx-checksumming off [fixed]
tx-checksumming on
"""

def test_Features_good():
    # Test picking up interface from header line rather than path
    features = ethtool.Features(
        context_wrap(ETHTOOL_K_STANDARD, path='sos_commands/networking/ethtool_-k_bond0'))
    assert features.ifname == 'bond0'
    assert features.iface == 'bond0'

    assert not features.is_on('rx-checksumming')
    assert features.is_on('tx-checksumming')

    assert features.is_fixed('rx-checksumming')
    assert not features.is_fixed('tx-checksumming')

def test_Features_bad_args():
    # Even if content is bad, interface should be available from path
    features = ethtool.Features(
        context_wrap(ETHTOOL_K_BAD_ARGS, path="sbin/ethtool_-k_bond0"))
    assert features.ifname == 'bond0'
    assert features.iface == 'bond0'
    assert features.data == {}

def test_Features_cannot_get():
    features = ethtool.Features(
        context_wrap(ETHTOOL_K_CANNOT_GET, path="sbin/ethtool_-k_eth1"))
    assert features.ifname == 'eth1'
    assert features.iface == 'eth1'

    assert features.data == {}

def test_Features_missing_colon():
    features = ethtool.Features(
        context_wrap(ETHTOOL_K_MISSING_COLON, path="sbin/ethtool_-k_bond0"))
    assert features.ifname == 'bond0'
    assert features.data == {}

SUCCEED_ETHTOOL_S = '''
NIC statistics:
    rx_packets: 912398
    tx_packets: 965449
    rx_bytes: 96506134
    tx_bytes: 190360255
    rx_broadcast: 4246
    tx_broadcast: 4248
    rx_multicast: 18
    tx_multicast: 20
    multicast: 18
    collisions: 0
    rx_crc_errors: 0
    rx_no_buffer_count: 0
    rx_missed_errors: 0
    tx_aborted_errors: 0
    tx_carrier_errors: 0
    tx_window_errors: 0
    tx_abort_late_coll: 0
    tx_deferred_ok: 0
    tx_single_coll_ok: 0
    tx_multi_coll_ok: 0
    tx_timeout_count: 0
    rx_long_length_errors: 0
    rx_short_length_errors: 0
    rx_align_errors: 0
    tx_tcp_seg_good: 0
    tx_tcp_seg_failed: 0
    rx_flow_control_xon: 0
    rx_flow_control_xoff: 0
    tx_flow_control_xon: 0
    tx_flow_control_xoff: 0
    rx_long_byte_count: 96506134
    tx_dma_out_of_sync: 0
    tx_smbus: 0
    rx_smbus: 0
    dropped_smbus: 0
    os2bmc_rx_by_bmc: 0
    os2bmc_tx_by_bmc: 0
    os2bmc_tx_by_host: 0
    os2bmc_rx_by_host: 0
    tx_hwtstamp_timeouts: 0
    rx_hwtstamp_cleared: 0
    rx_errors: 0
    tx_errors: 0
    tx_dropped: 0
    rx_length_errors: 0
    rx_over_errors: 0
    rx_frame_errors: 0
    rx_fifo_errors: 0
    tx_fifo_errors: 0
    tx_heartbeat_errors: 0
    tx_queue_0_packets: 613
    tx_queue_0_bytes: 240342
    tx_queue_0_restart: 0
    tx_queue_1_packets: 935473
    tx_queue_1_bytes: 181899495
    tx_queue_1_restart: 0
    tx_queue_2_packets: 6
    tx_queue_2_bytes: 412
    tx_queue_2_restart: 0
    tx_queue_3_packets: 29357
    tx_queue_3_bytes: 4358198
    tx_queue_3_restart: 0
    rx_queue_0_packets: 912398
    rx_queue_0_bytes: 92856542
    rx_queue_0_drops: 0
    rx_queue_0_csum_err: 0
    rx_queue_0_alloc_failed: 0
    rx_queue_1_packets: 0
    rx_queue_1_bytes: 0
    rx_queue_1_drops: 0
    rx_queue_1_csum_err: 0
    rx_queue_1_alloc_failed: 0
    rx_queue_2_packets: 0
    rx_queue_2_bytes: 0
    rx_queue_2_drops: 0
    rx_queue_2_csum_err: 0
    rx_queue_2_alloc_failed: 0
    rx_queue_3_packets: 0
    rx_queue_3_bytes: 0
    rx_queue_3_drops: 0
    rx_queue_3_csum_err: 0
    rx_queue_3_alloc_failed: 0
'''

ETHTOOL_S_eth0_1 = """NIC statistics:
    rxq0: rx_pkts: 5000000
    rxq0: rx_drops_no_frags: 5000
    rxq1: rx_pkts: 5000000
    rxq1: rx_drops_no_frags: 5000
"""

FAILED_ETHTOOL_S_ONE = "no stats avilable "

FAILED_ETHTOOL_S_TWO = "Cannot get stats strings information: Operation not supported"

FAILED_ETHTOOL_S_THREE = """NIC statistics:
Nothing to see here
"""

def test_ethtool_S():
    ethtool_S_info = ethtool.Statistics(context_wrap(SUCCEED_ETHTOOL_S))
    ret = {}
    for line in SUCCEED_ETHTOOL_S.split('\n')[2:-1]:
        key, value = line.split(':')
        ret[key.strip()] = int(value.strip()) if value else None
    eth_data = dict(ethtool_S_info.data)
    assert eth_data == ret

    # Test search functionality
    assert ethtool_S_info.search(r'rx_queue_3') == {
        'rx_queue_3_packets': 0,
        'rx_queue_3_bytes': 0,
        'rx_queue_3_drops': 0,
        'rx_queue_3_csum_err': 0,
        'rx_queue_3_alloc_failed': 0,
    }
    assert ethtool_S_info.search(r'RX_QUEUE_3', flags=re.IGNORECASE) == {
        'rx_queue_3_packets': 0,
        'rx_queue_3_bytes': 0,
        'rx_queue_3_drops': 0,
        'rx_queue_3_csum_err': 0,
        'rx_queue_3_alloc_failed': 0,
    }

def test_ethtool_S_subinterface():
    ethtool_S_info = ethtool.Statistics(context_wrap(ETHTOOL_S_eth0_1))
    assert sorted(ethtool_S_info.data.keys()) == sorted([
        'rxq0: rx_pkts', 'rxq0: rx_drops_no_frags',
        'rxq1: rx_pkts', 'rxq1: rx_drops_no_frags'
    ])
    assert ethtool_S_info.data['rxq0: rx_pkts'] == 5000000

def test_ethtool_S_f():
    ethtool_S_info_f1 = ethtool.Statistics(context_wrap(FAILED_ETHTOOL_S_ONE))
    assert not ethtool_S_info_f1.ifname
    ethtool_S_info_f2 = ethtool.Statistics(context_wrap(FAILED_ETHTOOL_S_TWO))
    assert not ethtool_S_info_f2.ifname
    ethtool_S_info_f2 = ethtool.Statistics(context_wrap(FAILED_ETHTOOL_S_THREE))
    assert not ethtool_S_info_f2.ifname

TEST_EXTRACT_FROM_PATH_1 = """
    ethtool_-a_eth0
""".strip()
TEST_EXTRACT_FROM_PATH_2 = """
    ethtool_-a_bond0.104_bond0
""".strip()
TEST_EXTRACT_FROM_PATH_3 = """
    ethtool_-a___tmp199222
""".strip()
TEST_EXTRACT_FROM_PATH_4 = """
    ethtool_-a_macvtap_bond0
""".strip()
TEST_EXTRACT_FROM_PATH_5 = """
    ethtool_-a_p3p2.2002-fcoe_p3p2
""".strip()
TEST_EXTRACT_FROM_PATH_PARAM = """
    ethtool_-a
""".strip()

def test_extract_from_path_1():
    test_data = [
        (TEST_EXTRACT_FROM_PATH_1, "eth0"),
        (TEST_EXTRACT_FROM_PATH_2, "bond0.104@bond0"),
        (TEST_EXTRACT_FROM_PATH_3, "__tmp199222"),
        (TEST_EXTRACT_FROM_PATH_4, "macvtap@bond0"),
        (TEST_EXTRACT_FROM_PATH_5, "p3p2.2002-fcoe@p3p2"),
    ]
    for input_, value in test_data:
        ifname = ethtool.extract_iface_name_from_path(input_, TEST_EXTRACT_FROM_PATH_PARAM)
        assert ifname == value

ETHTOOL_INFO = """
Settings for eth1:
    Supported ports: [ TP MII ]
    Supported link modes: 10baseT/Half 10baseT/Full
                          100baseT/Half 100baseT/Full
                          1000baseT/Full
    Supported pause frame use: Symmetric
    Supports auto-negotiation: Yes
    Advertised link modes: 10baseT/Half 10baseT/Full
                           100baseT/Half 100baseT/Full
                           1000baseT/Full
    Advertised pause frame use: Symmetric
    Advertised auto-negotiation: Yes
    Speed: 1000Mb/s
    Duplex: Full
    Port: Twisted Pair
    PHYAD: 1
    Transceiver: internal
    Auto-negotiation: on
    MDI-X: off (auto)
    Supports Wake-on: pumbg
    Wake-on: d
    Current message level: 0x00000007 (7)
                           drv probe link
    Link detected: yes
""".strip()

ETHTOOL_INFO_TEST = """
Settings for eth1:
    Supported pause frame use: Symmetric

    Supports auto-negotiation: Yes
""".strip()

def test_ethtool():
    ethtool_info = ethtool.Ethtool(context_wrap(ETHTOOL_INFO, path="ethtool_eth1"))
    assert ethtool_info.ifname == "eth1"
    assert ethtool_info.link_detected
    assert ethtool_info.speed == ['1000Mb/s']
    assert ethtool_info.supported_link_modes == [
        '10baseT/Half', '10baseT/Full',
        '100baseT/Half', '100baseT/Full',
        '1000baseT/Full'
    ]
    assert ethtool_info.advertised_link_modes == [
        '10baseT/Half', '10baseT/Full',
        '100baseT/Half', '100baseT/Full',
        '1000baseT/Full'
    ]
    assert ethtool_info.supported_ports == ['TP', 'MII']

def test_ethtool_corner_cases():
    ethtool_info = ethtool.Ethtool(context_wrap(ETHTOOL_INFO_TEST, path="ethtool_eth1"))
    assert ethtool_info.ifname == "eth1"

ETHTOOL_INFO_BAD_1 = """
Settings for dummy2:
No data available
""".strip()

ETHTOOL_INFO_BAD_2 = """
No data available
""".strip()

ETHTOOL_INFO_BAD_3 = """
Settings for eth1:
    Supported ports
    Supported link modes 10baseT/Half 10baseT/Full
                          100baseT/Half 100baseT/Full
"""

def test_ethtool_fail():
    with pytest.raises(ParseException):
        ethtool.Ethtool(context_wrap(FAIL_ETHTOOL_A_1, path="ethtool_eth1"))
    with pytest.raises(ParseException) as e:
        ethtool.Ethtool(context_wrap(ETHTOOL_INFO_BAD_1, path="ethtool_eth1"))
    assert "Fake ethnic as ethtool command argument" in str(e.value)

    with pytest.raises(ParseException) as e:
        ethtool.Ethtool(context_wrap(ETHTOOL_INFO_BAD_2, path="ethtool_eth1"))
    assert "ethtool: unrecognised first line " in str(e.value)

    with pytest.raises(ParseException) as e:
        ethtool.Ethtool(context_wrap(ETHTOOL_INFO_BAD_3, path="ethtool_eth1"))
    assert 'Ethtool unable to parse content' in str(e.value)


text:
/**
 * @license Licensed under the Apache License, Version 2.0 (the "License"):
 *          http://www.apache.org/licenses/LICENSE-2.0
 */

/**
 * @fileoverview Generating Arduino code for the logic blocks.
 */
'use strict';

goog.provide('Blockly.Arduino.logic');

goog.require('Blockly.Arduino');

/**
 * Code generator to create if/if else/else statement.
 * Arduino code: loop { if (X)/else if ()/else { X } }
 * @param {!Blockly.Block} block Block to generate the code from.
 * @return {string} Completed code.
 */
Blockly.Arduino['controls_if'] = function(block) {
  var n = 0;
  var argument = Blockly.Arduino.valueToCode(block, 'IF' + n,
      Blockly.Arduino.ORDER_NONE) || 'false';
  var branch = Blockly.Arduino.statementToCode(block, 'DO' + n);
  var code = 'if (' + argument + ') {\n' + branch + '}';
  for (n = 1; n <= block.elseifCount_; n++) {
    argument = Blockly.Arduino.valueToCode(block, 'IF' + n,
        Blockly.Arduino.ORDER_NONE) || 'false';
    branch = Blockly.Arduino.statementToCode(block, 'DO' + n);
    code += ' else if (' + argument + ') {\n' + branch + '}';
  }
  if (block.elseCount_) {
    branch = Blockly.Arduino.statementToCode(block, 'ELSE');
    code += ' else {\n' + branch + '}';
  }
  return code + '\n';
};

/**
 * Code generator for the comparison operator block.
 * Arduino code: loop { X operator Y }
 * @param {!Blockly.Block} block Block to generate the code from.
 * @return {array} Completed code with order of operation.
 */
Blockly.Arduino['logic_compare'] = function(block) {
  var OPERATORS = {
    'EQ': '==',
    'NEQ': '!=',
    'LT': '<',
    'LTE': '<=',
    'GT': '>',
    'GTE': '>='
  };
  var operator = OPERATORS[block.getFieldValue('OP')];
  var order = (operator == '==' || operator == '!=') ?
      Blockly.Arduino.ORDER_EQUALITY : Blockly.Arduino.ORDER_RELATIONAL;
  var argument0 = Blockly.Arduino.valueToCode(block, 'A', order) || '0';
  var argument1 = Blockly.Arduino.valueToCode(block, 'B', order) || '0';
  var code = argument0 + ' ' + operator + ' ' + argument1;
  return [code, order];
};

/**
 * Code generator for the logic operator block.
 * Arduino code: loop { X operator Y }
 * @param {!Blockly.Block} block Block to generate the code from.
 * @return {array} Completed code with order of operation.
 */
Blockly.Arduino['logic_operation'] = function(block) {
  var operator = (block.getFieldValue('OP') == 'AND') ? '&&' : '||';
  var order = (operator == '&&') ? Blockly.Arduino.ORDER_LOGICAL_AND :
      Blockly.Arduino.ORDER_LOGICAL_OR;
  var argument0 = Blockly.Arduino.valueToCode(block, 'A', order) || 'false';
  var argument1 = Blockly.Arduino.valueToCode(block, 'B', order) || 'false';
  if (!argument0 && !argument1) {
    // If there are no arguments, then the return value is false.
    argument0 = 'false';
    argument1 = 'false';
  } else {
    // Single missing arguments have no effect on the return value.
    var defaultArgument = (operator == '&&') ? 'true' : 'false';
    if (!argument0) {
      argument0 = defaultArgument;
    }
    if (!argument1) {
      argument1 = defaultArgument;
    }
  }
  var code = argument0 + ' ' + operator + ' ' + argument1;
  return [code, order];
};

/**
 * Code generator for the logic negate operator.
 * Arduino code: loop { !X }
 * @param {!Blockly.Block} block Block to generate the code from.
 * @return {array} Completed code with order of operation.
 */
Blockly.Arduino['logic_negate'] = function(block) {
  var order = Blockly.Arduino.ORDER_UNARY_PREFIX;
  var argument0 = Blockly.Arduino.valueToCode(block, 'BOOL', order) || 'false';
  var code = '!' + argument0;
  return [code, order];
};

/**
 * Code generator for the boolean values true and false.
 * Arduino code: loop { true/false }
 * @param {!Blockly.Block} block Block to generate the code from.
 * @return {array} Completed code with order of operation.
 */
Blockly.Arduino['logic_boolean'] = function(block) {
  var code = (block.getFieldValue('BOOL') == 'TRUE') ? 'true' : 'false';
  return [code, Blockly.Arduino.ORDER_ATOMIC];
};

/**
 * Code generator for the null value.
 * Arduino code: loop { X ? Y : Z }
 * @param {!Blockly.Block} block Block to generate the code from.
 * @return {array} Completed code with order of operation.
 */
Blockly.Arduino['logic_null'] = function(block) {
  var code = 'NULL';
  return [code, Blockly.Arduino.ORDER_ATOMIC];
};

/**
 * Code generator for the ternary operator.
 * Arduino code: loop { NULL }
 * @param {!Blockly.Block} block Block to generate the code from.
 * @return {array} Completed code with order of operation.
 *
 * TODO: Check types of THEN and ELSE blocks and add warning to this block if
 *       they are different from each other.
 */
Blockly.Arduino['logic_ternary'] = function(block) {
  var valueIf = Blockly.Arduino.valueToCode(block, 'IF',
      Blockly.Arduino.ORDER_CONDITIONAL) || 'false';
  var valueThen = Blockly.Arduino.valueToCode(block, 'THEN',
      Blockly.Arduino.ORDER_CONDITIONAL) || 'null';
  var valueElse = Blockly.Arduino.valueToCode(block, 'ELSE',
      Blockly.Arduino.ORDER_CONDITIONAL) || 'null';
  var code = valueIf + ' ? ' + valueThen + ' : ' + valueElse;
  return [code, Blockly.Arduino.ORDER_CONDITIONAL];
};


text:
package io.druid.sql.avatica;

import com.fasterxml.jackson.annotation.JsonProperty;
import org.joda.time.Period;

public class AvaticaServerConfig
{
  @JsonProperty
  public int maxConnections = 25;

  @JsonProperty
  public int maxStatementsPerConnection = 4;

  @JsonProperty
  public Period connectionIdleTimeout = new Period("PT5M");

  @JsonProperty
  public int maxRowsPerFrame = 5000;

  public int getMaxConnections()
  {
    return maxConnections;
  }

  public int getMaxStatementsPerConnection()
  {
    return maxStatementsPerConnection;
  }

  public Period getConnectionIdleTimeout()
  {
    return connectionIdleTimeout;
  }

  public int getMaxRowsPerFrame()
  {
    return maxRowsPerFrame;
  }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 322115 $ -->
<refentry xml:id="haruannotation.setborderstyle" xmlns="http://docbook.org/ns/docbook">
 <refnamediv>
  <refname>HaruAnnotation::setBorderStyle</refname>
  <refpurpose>Set the border style of the annotation</refpurpose>
 </refnamediv>

 <refsect1 role="description">
  &reftitle.description;
  <methodsynopsis>
   <type>bool</type><methodname>HaruAnnotation::setBorderStyle</methodname>
   <methodparam><type>float</type><parameter>width</parameter></methodparam>
   <methodparam><type>int</type><parameter>dash_on</parameter></methodparam>
   <methodparam><type>int</type><parameter>dash_off</parameter></methodparam>
  </methodsynopsis>
  <para>
   Defines the style of the border of the annotation.
   This function may be used with link annotations only.
  </para>
 </refsect1>

 <refsect1 role="parameters">
  &reftitle.parameters;
  <para>
   <variablelist>
    <varlistentry>
     <term><parameter>width</parameter></term>
     <listitem>
      <para>
       The width of the border line.
      </para>
     </listitem>
    </varlistentry>
    <varlistentry>
     <term><parameter>dash_on</parameter></term>
     <listitem>
      <para>
       The dash style.
      </para>
     </listitem>
    </varlistentry>
    <varlistentry>
     <term><parameter>dash_off</parameter></term>
     <listitem>
      <para>
       The dash style.
      </para>
     </listitem>
    </varlistentry>
   </variablelist>
  </para>
 </refsect1>

 <refsect1 role="returnvalues">
  &reftitle.returnvalues;
  <para>
   Returns &true; on success.
  </para>
 </refsect1>
 <refsect1 role="errors">
  &reftitle.errors;
  &haru.error;
 </refsect1>

</refentry>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->


text:
using System;
using System.Windows;
using System.Windows.Controls;
using GraphSharp.Controls.Animations;
using GraphSharp.Controls.Transitions;

namespace GraphSharp.Controls
{
    public class GraphCanvas : Panel
    {
        #region Attached Dependency Property registrations
        public static readonly DependencyProperty XProperty =
            DependencyProperty.RegisterAttached("X", typeof(double), typeof(GraphCanvas),
                                                 new FrameworkPropertyMetadata(double.NaN,
                                                                                FrameworkPropertyMetadataOptions.AffectsMeasure |
                                                                                FrameworkPropertyMetadataOptions.AffectsArrange |
                                                                                FrameworkPropertyMetadataOptions.AffectsRender |
                                                                                FrameworkPropertyMetadataOptions.AffectsParentMeasure |
                                                                                FrameworkPropertyMetadataOptions.AffectsParentArrange |
                                                                                FrameworkPropertyMetadataOptions.BindsTwoWayByDefault,
                                                                                XPropertyChanged));

        private static void XPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            var xChange = (double)e.NewValue - (double)e.OldValue;
            PositionChanged(d, xChange, 0);
        }

        public static readonly DependencyProperty YProperty =
            DependencyProperty.RegisterAttached("Y", typeof(double), typeof(GraphCanvas),
                                                 new FrameworkPropertyMetadata(double.NaN,
                                                                                FrameworkPropertyMetadataOptions.AffectsMeasure |
                                                                                FrameworkPropertyMetadataOptions.AffectsArrange |
                                                                                FrameworkPropertyMetadataOptions.AffectsRender |
                                                                                FrameworkPropertyMetadataOptions.AffectsParentMeasure |
                                                                                FrameworkPropertyMetadataOptions.AffectsParentArrange |
                                                                                FrameworkPropertyMetadataOptions.BindsTwoWayByDefault,
                                                                                YPropertyChanged));

        private static void YPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            var yChange = (double)e.NewValue - (double)e.OldValue;
            PositionChanged(d, 0, yChange);
        }

        private static void PositionChanged(DependencyObject d, double xChange, double yChange)
        {
            var e = d as UIElement;
            if (e != null)
                e.RaiseEvent(new PositionChangedEventArgs(PositionChangedEvent, e, xChange, yChange));
        }

        #endregion

        #region Attached Properties
        [AttachedPropertyBrowsableForChildren]
        public static double GetX(DependencyObject obj)
        {
            return (double)obj.GetValue(XProperty);
        }

        public static void SetX(DependencyObject obj, double value)
        {
            obj.SetValue(XProperty, value);
        }

        [AttachedPropertyBrowsableForChildren]
        public static double GetY(DependencyObject obj)
        {
            return (double)obj.GetValue(YProperty);
        }

        public static void SetY(DependencyObject obj, double value)
        {
            obj.SetValue(YProperty, value);
        }

        #endregion

        #region Attached Routed Events
        public static readonly RoutedEvent PositionChangedEvent =
            EventManager.RegisterRoutedEvent("PositionChanged", RoutingStrategy.Bubble, typeof(PositionChangedEventHandler), typeof(GraphCanvas));
        public static void AddPositionChangedHandler(DependencyObject d, RoutedEventHandler handler)
        {
            var e = d as UIElement;
            if (e != null)
                e.AddHandler(PositionChangedEvent, handler);
        }

        public static void RemovePositionChangedHandler(DependencyObject d, RoutedEventHandler handler)
        {
            var e = d as UIElement;
            if (e != null)
                e.RemoveHandler(PositionChangedEvent, handler);
        }
        #endregion

        #region Measure & Arrange

        /// The position of the topLeft corner of the most top-left vertex.
        private Point _topLeft;

        /// The position of the bottom right corner of the most bottom-right vertex.
        private Point _bottomRight;

        /// Arranges the size of the control.
        /// <param name="arrangeSize">The arranged size of the control.</param>
        /// <returns>The size of the control.</returns>
        protected override Size ArrangeOverride(Size arrangeSize)
        {
            var translate = new Vector(-_topLeft.X, -_topLeft.Y);
            Vector graphSize = (_bottomRight - _topLeft);

            if (double.IsNaN(graphSize.X) || double.IsNaN(graphSize.Y) ||
                 double.IsInfinity(graphSize.X) || double.IsInfinity(graphSize.Y))
                translate = new Vector(0, 0);

            Translation = translate;

            graphSize = InternalChildren.Count > 0
                            ? new Vector(double.NegativeInfinity, double.NegativeInfinity)
                            : new Vector(0, 0);

            //translate with the topLeft
            foreach (UIElement child in InternalChildren)
            {
                double x = GetX(child);
                double y = GetY(child);
                if (double.IsNaN(x) || double.IsNaN(y))
                {
                    //not a vertex, set the coordinates of the top-left corner
                    x = double.IsNaN(x) ? translate.X : x;
                    y = double.IsNaN(y) ? translate.Y : y;
                }
                else
                {
                    //this is a vertex
                    x += translate.X;
                    y += translate.Y;

                    //get the top-left corner
                    x -= child.DesiredSize.Width * 0.5;
                    y -= child.DesiredSize.Height * 0.5;
                }
                child.Arrange(new Rect(new Point(x, y), child.DesiredSize));

                graphSize.X = Math.Max(0, Math.Max(graphSize.X, x + child.DesiredSize.Width));
                graphSize.Y = Math.Max(0, Math.Max(graphSize.Y, y + child.DesiredSize.Height));
            }

            return new Size(graphSize.X, graphSize.Y);
        }

        /// Overridden measure. It calculates a size where all of of the vertices are visible.
        /// <param name="constraint">The size constraint.</param>
        /// <returns>The calculated size.</returns>
        protected override Size MeasureOverride(Size constraint)
        {
            _topLeft = new Point(double.PositiveInfinity, double.PositiveInfinity);
            _bottomRight = new Point(double.NegativeInfinity, double.NegativeInfinity);

            foreach (UIElement child in InternalChildren)
            {
                //measure the child
                child.Measure(constraint);

                //get the position of the vertex
                double left = GetX(child);
                double top = GetY(child);

                double halfWidth = child.DesiredSize.Width * 0.5;
                double halfHeight = child.DesiredSize.Height * 0.5;

                if (double.IsNaN(left) || double.IsNaN(top))
                {
                    left = halfWidth;
                    top = halfHeight;
                }

                //get the top left corner point
                _topLeft.X = Math.Min(_topLeft.X, left - halfWidth - Origo.X);
                _topLeft.Y = Math.Min(_topLeft.Y, top - halfHeight - Origo.Y);

                //calculate the bottom right corner point
                _bottomRight.X = Math.Max(_bottomRight.X, left + halfWidth - Origo.X);
                _bottomRight.Y = Math.Max(_bottomRight.Y, top + halfHeight - Origo.Y);
            }

            var graphSize = (Size)(_bottomRight - _topLeft);
            graphSize.Width = Math.Max(0, graphSize.Width);
            graphSize.Height = Math.Max(0, graphSize.Height);

            if (double.IsNaN(graphSize.Width) || double.IsNaN(graphSize.Height) ||
                 double.IsInfinity(graphSize.Width) || double.IsInfinity(graphSize.Height))
                return new Size(0, 0);

            return graphSize;
        }
        #endregion

        #region DP - Animation length

        ///
        /// Gets or sets the length of the animation.
        /// If the length of the animations is 0:0:0.000,
        /// there won't be any animations.
        ///
        /// Default value is 500 ms.
        ///
        public TimeSpan AnimationLength
        {
            get { return (TimeSpan)GetValue(AnimationLengthProperty); }
            set { SetValue(AnimationLengthProperty, value); }
        }

        public static readonly DependencyProperty AnimationLengthProperty =
            DependencyProperty.Register("AnimationLength", typeof(TimeSpan), typeof(GraphCanvas), new UIPropertyMetadata(new TimeSpan(0, 0, 0, 0, 500)));
        #endregion

        #region DP - CreationAnimation

        ///
        /// Gets or sets the animation controller for the 'Control Creation' animation.
        ///
        public ITransition CreationTransition
        {
            get { return (ITransition)GetValue(CreationTransitionProperty); }
            set { SetValue(CreationTransitionProperty, value); }
        }

        public static readonly DependencyProperty CreationTransitionProperty =
            DependencyProperty.Register("CreationTransition", typeof(ITransition), typeof(GraphCanvas), new UIPropertyMetadata(new FadeInTransition()));

        #endregion

        #region IsAnimationEnabled

        ///
        /// If this property is true, and the other animation disabler
        /// properties are also true, the animation is enabled.
        /// If this is false, the animations will be disabled.
        ///
        public bool IsAnimationEnabled
        {
            get { return (bool)GetValue(IsAnimationEnabledProperty); }
            set { SetValue(IsAnimationEnabledProperty, value); }
        }

        public static readonly DependencyProperty IsAnimationEnabledProperty =
            DependencyProperty.Register("IsAnimationEnabled", typeof(bool), typeof(GraphCanvas), new UIPropertyMetadata(true));

        #endregion

        #region DP - MoveAnimation

        ///
        /// Gets or sets the animation controller for the 'Control Moving' animation.
        ///
        public IAnimation MoveAnimation
        {
            get { return (IAnimation)GetValue(MoveAnimationProperty); }
            set { SetValue(MoveAnimationProperty, value); }
        }

        public static readonly DependencyProperty MoveAnimationProperty =
            DependencyProperty.Register("MoveAnimation", typeof(IAnimation), typeof(GraphCanvas), new UIPropertyMetadata(new SimpleMoveAnimation()));

        #endregion

        #region DP - DestructionAnimation

        ///
        /// Gets or sets the transition controller for the 'Control Descruction' animation.
        ///
        public ITransition DestructionTransition
        {
            get { return (ITransition)GetValue(DestructionTransitionProperty); }
            set { SetValue(DestructionTransitionProperty, value); }
        }

        // Using a DependencyProperty as the backing store for DestructionAnimation.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty DestructionTransitionProperty =
            DependencyProperty.Register("DestructionTransition", typeof(ITransition), typeof(GraphCanvas), new UIPropertyMetadata(new FadeOutTransition()));

        #endregion

        #region DP - Origo

        ///
        /// Gets or sets the virtual origo of the canvas.
        ///
        public Point Origo
        {
            get { return (Point)GetValue(OrigoProperty); }
            set { SetValue(OrigoProperty, value); }
        }

        public static readonly DependencyProperty OrigoProperty =
            DependencyProperty.Register("Origo", typeof(Point), typeof(GraphCanvas),
                new FrameworkPropertyMetadata(
                    new Point(),
                    FrameworkPropertyMetadataOptions.AffectsMeasure |
                    FrameworkPropertyMetadataOptions.AffectsArrange |
                    FrameworkPropertyMetadataOptions.AffectsRender |
                    FrameworkPropertyMetadataOptions.AffectsParentMeasure |
                    FrameworkPropertyMetadataOptions.AffectsParentArrange));

        #endregion

        public Vector Translation
        {
            get { return (Vector)GetValue(TranslationProperty); }
            protected set { SetValue(TranslationPropertyKey, value); }
        }

        public static readonly DependencyProperty TranslationProperty;
        protected static readonly DependencyPropertyKey TranslationPropertyKey =
            DependencyProperty.RegisterReadOnly("Translation", typeof(Vector), typeof(GraphCanvas), new UIPropertyMetadata(new Vector()));

        static GraphCanvas()
        {
            TranslationProperty = TranslationPropertyKey.DependencyProperty;
        }

        /// The layout process will be initialized with the current vertex positions.
        ///
        public virtual void ContinueLayout()
        {
        }

        /// The layout process will be started without initial vertex positions.
        public virtual void Relayout()
        {
        }

        private IAnimationContext _animationContext;

        /// Gets the context of the animation.
        public virtual IAnimationContext AnimationContext
        {
            get
            {
                if (_animationContext == null)
                    _animationContext = new AnimationContext(this);

                return _animationContext;
            }
        }

        /// Gets whether the animation could be run, or not.
        public virtual bool CanAnimate
        {
            get
            {
                return IsAnimationEnabled;
            }
        }

        /// Does a transition for the control which has been already added to this container.
        /// <param name="control">The control which has been added.</param>
        protected virtual void RunCreationTransition(Control control)
        {
            if (CreationTransition == null)
                return;

            CreationTransition.Run(AnimationContext, control, AnimationLength);
        }

        /// Animates the position of the given control to the given positions.
        /// <param name="control">The control which should be moved.</param>
        /// <param name="x">The new horizontal position of the control.</param>
        /// <param name="y">The new vertical position of the control.</param>
        protected virtual void RunMoveAnimation(Control control, double x, double y)
        {
            if (MoveAnimation != null && CanAnimate)
                //animate to the given position
                MoveAnimation.Animate(AnimationContext, control, x, y, AnimationLength);
            else
            {
                //cannot animate, only the given positions
                SetX(control, x);
                SetY(control, y);
            }
        }

        /// Transites a control which gonna' be removed from this container.
        /// <param name="control">The control which will be removed.</param>
        /// <param name="dontRemoveAfter">If it's true, the control won't be removed
        /// automatically from this container's Children.</param>
        protected virtual void RunDestructionTransition(Control control, bool dontRemoveAfter)
        {
            if (DestructionTransition == null)
            {
                if (!dontRemoveAfter)
                {
                    Children.Remove(control);
                }
            }
            else
            {
                if (dontRemoveAfter)
                    DestructionTransition.Run(AnimationContext, control, AnimationLength);
                else
                    DestructionTransition.Run(AnimationContext, control, AnimationLength, Children.Remove);
            }
        }
    }
}


text:
FOUNDATION_EXPORT double SideboxVersionNumber;
FOUNDATION_EXPORT const unsigned char SideboxVersionString[];


text:
#include "operators.h"
#include "operators_priv.h"

#include "../util/numaallocate.h"
#include "../util/numaasserts.h"

#ifdef ENABLE_NUMA
#include <numa.h>
#else
#include <iostream>
using std::cerr;
using std::endl;
#endif

using std::make_pair;

void GenericAggregate::init(libconfig::Config& root, libconfig::Setting& cfg)
{
	Operator::init(root, cfg);

	// Read aggregation fields. This is either a number (if aggregating on a
	// single field) or a list of numbers (for aggregation on a composite key).
	// An empty vector indicates no grouping, ie. compute aggregation over
	// entire input.
	//
	if (cfg.exists("fields"))
	{
		libconfig::Setting& field = cfg["fields"];
		dbgassert(field.isAggregate());

		for (int i=0; i<field.getLength(); ++i)
		{
			int fieldno = field[i];
			aggfields.push_back(fieldno);
		}
	}
	else
	{
		dbgassert(cfg.exists("field"));
		libconfig::Setting& field = cfg["field"];
		dbgassert(field.isNumber());
		int fieldno = field;
		aggfields.push_back(fieldno);
	}

	// If fields vector is empty, it is okay if hash function has not been specified.
	// pre-fill "alwayszero" hash function.
	//
	if (aggfields.empty() && (cfg.exists("hash") == false))
	{
		libconfig::Setting& hashnode = cfg.add("hash", libconfig::Setting::TypeGroup);
		hashnode.add("fn", libconfig::Setting::TypeString) = "alwayszero";
	}

	// Read user-defined schema.
	//
	Schema& uds = foldinit(root, cfg);
	dbgassert(uds.columns() != 0);

	// Get data type of aggregation attributes, then add user-defined schema.
	//
	for (unsigned int i=0; i<aggfields.size(); ++i)
	{
		ColumnSpec cs = nextOp->getOutSchema().get(aggfields[i]);
		schema.add(cs);
	}
	for (unsigned int i=0; i<uds.columns(); ++i)
	{
		schema.add(uds.get(i));
	}

	// Create object for comparisons.
	//
	vector <unsigned short> tempvec;	// [0,1,2,...]
	for (unsigned int i=0; i<aggfields.size(); ++i)
	{
		tempvec.push_back(i);
	}
	comparator.init(schema, nextOp->getOutSchema(), tempvec, aggfields);

	assert(aggregationmode == Unset);

	if (cfg.exists("presorted"))
	{
		aggregationmode = OnTheFly;
		throw NotYetImplemented();
	}
	else
	{
		hashfn = TupleHasher::create(nextOp->getOutSchema(), cfg["hash"]);
		if (cfg.exists("global"))
		{
			aggregationmode = Global;

			int thr = cfg["threads"];
			threads = thr;

			vector<char> allocpolicy;

#ifdef ENABLE_NUMA
			int maxnuma = numa_max_node() + 1;

			// Stripe on all NUMA nodes.
			//
			for (char i=0; i<maxnuma; ++i)
			{
				allocpolicy.push_back(i);
			}
#else
			cerr << " ** NUMA POLICY WARNING: Memory policy is ignored, "
				<< "NUMA disabled at compile." << endl;
#endif

			hashtable.push_back( HashTable() );
			hashtable[0].init(
				hashfn.buckets(),        // number of hash buckets
				schema.getTupleSize()*4, // space for each bucket
				schema.getTupleSize(),	 // size of each tuple
				allocpolicy,			 // stripe across all
				this);

			barrier.init(threads);
		}
		else
		{
			aggregationmode = ThreadLocal;
			for (int i=0; i<MAX_THREADS; ++i)
			{
				hashtable.push_back( HashTable() );
			}
		}
	}

	for (int i=0; i<MAX_THREADS; ++i)
	{
		output.push_back(NULL);
		state.push_back( State(HashTable::Iterator()) );
	}
}

void GenericAggregate::threadInit(unsigned short threadid)
{
	void* space = numaallocate_local("GnAg", sizeof(Page), this);
	output[threadid] = new(space) Page(buffsize, schema.getTupleSize(), this);
	switch(aggregationmode)
	{
		case ThreadLocal:
			hashtable[threadid].init(
				hashfn.buckets(),        // number of hash buckets
				schema.getTupleSize()*4, // space for each bucket
				schema.getTupleSize(),	 // size of each tuple
				vector<char>(),          // always allocate locally
				this);
			hashtable[threadid].bucketclear(0, 1);
			break;

		case Global:
			hashtable[0].bucketclear(threadid, threads);
			barrier.Arrive();
			break;

		default:
			throw NotYetImplemented();
	}
	unsigned short htid = 0;
	if (aggregationmode == ThreadLocal)
	{
		htid = threadid;
	}
	state[threadid] = State(hashtable[htid].createIterator());
}

void GenericAggregate::threadClose(unsigned short threadid)
{
	if (output[threadid]) {
		numadeallocate(output[threadid]);
	}
	output[threadid] = NULL;

	switch(aggregationmode)
	{
		case ThreadLocal:
			hashtable[threadid].bucketclear(0, 1);
			hashtable[threadid].destroy();
			break;

		case Global:
			barrier.Arrive();
			hashtable[0].bucketclear(threadid, threads);
			break;

		default:
			throw NotYetImplemented();
	}
}

void GenericAggregate::destroy()
{
	if (aggregationmode == Global)
		hashtable[0].destroy();
	hashfn.destroy();
	hashtable.clear();
	aggregationmode = Unset;
}

void GenericAggregate::remember(void* tuple, HashTable::Iterator& it, unsigned short htid)
{
	void* candidate;
	int totalaggfields = aggfields.size();
	Schema& inschema = nextOp->getOutSchema();

	// Identify key and hash it to find the hashtable bucket.
	//
	unsigned int h = hashfn.hash(tuple);
	if (aggregationmode == Global)
	{
		hashtable[htid].lockbucket(h);
	}
	hashtable[htid].placeIterator(it, h);

	// Scan bucket.
	//
	while ( (candidate = it.next()) )
	{
		// Compare keys of tuple stored in hash chain with input tuple.
		// If match found, increment count and return immediately.
		//
		if (comparator.eval(candidate, tuple)) {
			fold(schema.calcOffset(candidate, totalaggfields), tuple);
			goto unlockandexit;
		}
	}

	// If no match found on hash chain, allocate space and add tuple.
	//
	candidate = hashtable[htid].allocate(h, this);
	for (int i=0; i<totalaggfields; ++i)
	{
		schema.writeData(candidate, i, inschema.calcOffset(tuple, aggfields[i]));
	}
	foldstart(schema.calcOffset(candidate, totalaggfields), tuple);

unlockandexit:
	if (aggregationmode == Global)
	{
		hashtable[htid].unlockbucket(h);
	}
}

Operator::ResultCode GenericAggregate::scanStart(unsigned short threadid,
		Page* indexdatapage, Schema& indexdataschema)
{
	// Read and aggregate until source depleted.
	//
	Page* in;
	Operator::GetNextResultT result;
	unsigned short htid = 0;
	if (aggregationmode == ThreadLocal)
	{
		htid = threadid;
	}
	HashTable::Iterator htit = hashtable[htid].createIterator();
	ResultCode rescode;

	rescode = nextOp->scanStart(threadid, indexdatapage, indexdataschema);
	if (rescode != Operator::Ready) {
		return rescode;
	}

	do {
		result = nextOp->getNext(threadid);

		in = result.second;

		Page::Iterator it = in->createIterator();
		void* tuple;
		while ( (tuple = it.next()) ) {
			remember(tuple, htit, htid);
		}
	} while(result.first == Operator::Ready);

	rescode = nextOp->scanStop(threadid);

#ifdef ENABLE_NUMA
	unsigned int maxnuma = numa_max_node() + 1;
#else
	unsigned int maxnuma = 1;
#endif

	switch (aggregationmode)
	{
		case ThreadLocal:
			state[threadid].bucket = 0;
			break;

		case Global:
			{
			if (threads > maxnuma)
			{
				// Threads from this NUMA node participating
				//
				unsigned int participants = threads/maxnuma;
				if ((threadid % maxnuma) < (threads % maxnuma))
				{
					participants++;
				}

				// Compute offset
				//
				unsigned int startoffset = threadid % maxnuma;
				startoffset += (threadid/maxnuma)
					* (((hashfn.buckets()/maxnuma)/participants)*maxnuma);

				state[threadid].bucket = startoffset;
			}
			else
			{
				state[threadid].bucket = threadid;
			}

			barrier.Arrive();

			break;
			}

		default:
			throw NotYetImplemented();
	}
	state[threadid].startoffset = state[threadid].bucket;

	unsigned int step;
	switch (aggregationmode)
	{
		case Global:
			step = (threads > maxnuma) ? maxnuma : threads;
			break;

		default:
			step = 1;
			break;
	}
	state[threadid].step = step;

	unsigned int hashbuckets = hashfn.buckets();
	unsigned int endoffset;
	if (aggregationmode == Global)
	{
		if (threadid >= (threads - maxnuma))
		{
			endoffset = hashbuckets;
		}
		else
		{
			// Threads from this NUMA node participating
			//
			unsigned int participants = threads/maxnuma;
			if ((threadid % maxnuma) < (threads % maxnuma))
			{
				participants++;
			}

			// Compute offset
			//
			endoffset = (threadid % maxnuma);
			endoffset += ((threadid+maxnuma)/maxnuma)
						* (((hashbuckets/maxnuma)/participants)*maxnuma);
		}
	}
	else
	{
		endoffset = hashbuckets;
	}
	state[threadid].endoffset = endoffset;

	hashtable[htid].placeIterator(state[threadid].iterator, state[threadid].bucket);

	// If scan failed, return Error. Otherwise return what scanClose returned.
	//
	return ((result.first != Operator::Error) ? rescode : Operator::Error);
}

Operator::GetNextResultT GenericAggregate::getNext(unsigned short threadid)
{
	void* tuple;

	// Restore iterator from saved state.
	//
	HashTable::Iterator& it = state[threadid].iterator;

	Page* out = output[threadid];
	out->clear();

	unsigned short htid = 0;
	if (aggregationmode == ThreadLocal)
	{
		htid = threadid;
	}

	const unsigned int endoffset = state[threadid].endoffset;
	const unsigned int step = state[threadid].step;

	for (unsigned int i=state[threadid].bucket; i<endoffset; i+=step)
	{
		// Output aggregates, page-by-page.
		//
		while ( (tuple = it.next()) )
		{
#ifdef DEBUG2
#ifdef ENABLE_NUMA
#warning Hardcoded NUMA socket number.
			unsigned int maxnuma = 4;
// Disabled for perf.
//			unsigned int maxnuma = numa_max_node() + 1;
#else
			unsigned int maxnuma = 1;
#endif
			if (threads >= maxnuma)
			{
				assertaddresslocal(tuple);
			}
#endif

			// Do copy to output buffer.
			//
			void* dest = out->allocateTuple();
			dbgassert(out->isValidTupleAddress(dest));
			schema.copyTuple(dest, tuple);

			// If output buffer full, record state and return.
			//
			if (!out->canStoreTuple()) {
				state[threadid].bucket = i;
				return make_pair(Ready, out);
			}
		}

		// Making iterator wrap-around so as to avoid past-the-end placement.
		//
		if ((i+step) < endoffset)
		{
			hashtable[htid].placeIterator(it, (i+step));
		}
		else
		{
			hashtable[htid].placeIterator(it, 0);
		}
	}

	return make_pair(Finished, out);
}

vector<unsigned int> GenericAggregate::statAggBuckets()
{
	vector<unsigned int> ret;

	for (unsigned int i=0; i<hashtable.size(); ++i)
	{
		vector<unsigned int> htstats = hashtable.at(i).statBuckets();
		const unsigned int htstatsize = htstats.size();

		if (htstatsize >= ret.size())
			ret.resize(htstatsize, 0);

		for (unsigned int j=0; j<htstatsize; ++j)
		{
			ret.at(j) += htstats.at(j);
		}
	}

	return ret;
}


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:minHeight="?android:attr/listPreferredItemHeight" >

    <TextView android:id="@+id/text1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="8dip"
        android:textAppearance="?android:attr/textAppearanceListItem" />

    <TextView android:id="@+id/text2"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@android:id/text1"
        android:layout_alignLeft="@android:id/text1"
        android:layout_alignStart="@android:id/text1"
        android:textAppearance="?android:attr/textAppearanceListItemSecondary" />

</LinearLayout>


text:
        /**
         * In General, this function does pretty much just this pretty
         * simple thing. This can't be deduced by the test's documentation
         * though, and must be written by the author.
         *
         * ************************************************************
         * ####UnitTest Specifications
         *
         * This is the new text
         * This is line two
         *
         * ************************************************************
         *
         * @param  string $parameter1 a String
         * @param  string $parameter2 a String
         * @return string             a String
         */


text:
namespace me {
	// basic optional implementation.
	template<class T>
	class Optional {
		T *m_object;

	public:
		Optional() : m_object(0) { }

		// copy constructor
		Optional(const Optional<T>& other) : m_object(new T(*other)) { }

		// move constructor
		Optional(Optional<T>&& other) : m_object(other.m_object) {
			other.m_object = 0;
		}

		Optional(const T& other) : m_object(new T(other)) { }

		// destructor
		~Optional() {
			delete m_object;  // delete 0 is a no-op, so we are fine here.
		}

		// copy assignment operator
		Optional& operator=(const Optional<T>& other) {
			delete m_object;  // delete 0 is a no-op
			m_object = new T(*other);
			return *this;
		}

		Optional& operator=(const T& other) {
			delete m_object;  // delete 0 is a no-op
			m_object = new T(other);
			return *this;
		}

		// move assignment operator
		Optional& operator=(Optional<T>&& other) {
			delete m_object;  // delete 0 is a no-op
			m_object = other.m_object;
			other.m_object = 0;
			return *this;
		}

		operator bool() const {
			return m_object != 0;
		}

		T& operator *() const {
			return *m_object;
		}

		T* operator ->() const {
			return m_object;
		}

		T* pointer() const {
			return m_object;
		}
	};

	// splitting.
	std::vector<std::string> &split(const std::string &s, char delim, std::vector<std::string> &elems);
	std::vector<std::string> split(const std::string &s, char delim);
}


text:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Solution {

    public static void main(String [] args) {
        try(BufferedReader bf = new BufferedReader(new InputStreamReader(System.in))) {

            int n = Integer.parseInt(bf.readLine());
            String [] line;
            int [] arr = new int [n];
            line = bf.readLine().split(" ");
            for(int i = 0; i<n; i++)
                arr[i] = Integer.parseInt(line[i]);
            long sum = 0l;
            for(int m : arr)
                sum += m;
            System.out.println(sum);

        } catch(IOException e) {}
    }
}


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="author" content="Mark Kravinskiy">

    <title>Time Tracking Application</title>

    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"
          integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">

    <link rel="stylesheet" href="resources/css/style.css">
    <link rel="stylesheet" href="resources/css/font-awesome.min.css">

                    Home

                    Dashboard

                    Settings

                    Logout

                    Login

                    Sign Up

Time Tracking V1.0

© Mark Kravinskiy