text:
using RestBus.RabbitMQ;
using RestBus.RabbitMQ.Client;

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Optimization;
using System.Web.Routing;
using System.Web.Security;
using WebClientExample;

namespace WebClientExample
{
    public class Global : HttpApplication
    {
        public static RestBusClient HelloServiceClient = null;

        void Application_Start(object sender, EventArgs e)
        {
            // Code that runs on application startup
            BundleConfig.RegisterBundles(BundleTable.Bundles);
            AuthConfig.RegisterOpenAuth();
            RouteConfig.RegisterRoutes(RouteTable.Routes);

            //Init RestBus client
            var amqpUrl = "amqp://localhost:5672"; //AMQP URL for RabbitMQ installation
            var serviceName = "samba"; //The unique identifier for the target service

            var msgMapper = new BasicMessageMapper(amqpUrl, serviceName);
            HelloServiceClient = new RestBusClient(msgMapper);
        }

        void Application_End(object sender, EventArgs e)
        {
            //  Code that runs on application shutdown

            //Dispose restbus client
            if(HelloServiceClient != null)
                HelloServiceClient.Dispose();

        }

        void Application_Error(object sender, EventArgs e)
        {
            // Code that runs when an unhandled error occurs

        }
    }
}


text:
TEST( Timer, Construction )
{
    using namespace nge::util;

    Timer timer;
    Timer copy( timer );

    timer = copy;
}

TEST( Timer, StartAndStop )
{
    using namespace nge::util;

    Timer timer;

    ASSERT_EQ( 0.0f, timer.elapsed() );
    ASSERT_EQ( 0, timer.elapsedTicks() );

    timer.start();

	std::this_thread::sleep_for( std::chrono::microseconds( 1000 ) );

    EXPECT_TRUE( timer.elapsed() > 0.001f );
    EXPECT_TRUE( timer.elapsedTicks() > 1000000 );

    timer.stop();

	std::this_thread::sleep_for(std::chrono::microseconds(1000));

    EXPECT_TRUE( timer.elapsed() > 0.001f );
    EXPECT_TRUE( timer.elapsedTicks() > 1000000 );
    EXPECT_FALSE( timer.elapsed() > 0.002f );
    EXPECT_FALSE( timer.elapsedTicks() > 2000000 );

    timer.start();
    timer.stop();

    EXPECT_TRUE( timer.elapsed() < 0.001f );
    EXPECT_TRUE( timer.elapsedTicks() < 1000000 );
}

TEST( Timer, PauseAndResumeAndLapAndTotal )
{
    using namespace nge::util;

    Timer timer;

    ASSERT_EQ( 0.0f, timer.elapsed() );
    ASSERT_EQ( 0.0f, timer.elapsedTicks() );
    ASSERT_EQ( 0.0f, timer.lap() );

    timer.start();

	std::this_thread::sleep_for(std::chrono::microseconds(1000));

    EXPECT_TRUE( timer.elapsed() > 0.001f );
    EXPECT_TRUE( timer.elapsedTicks() > 1 );

    timer.pause();

	std::this_thread::sleep_for(std::chrono::microseconds(1000));

    EXPECT_TRUE( timer.elapsed() > 0.001f );
    EXPECT_TRUE( timer.elapsedTicks() > 1000000 );
    EXPECT_FALSE( timer.elapsed() > 0.002f );
    EXPECT_FALSE( timer.elapsedTicks() > 2000000 );

    timer.resume();

	std::this_thread::sleep_for(std::chrono::microseconds(1000));

    EXPECT_TRUE( timer.elapsed() > 0.002f );
    EXPECT_TRUE( timer.elapsedTicks() > 2000000 );

	std::this_thread::sleep_for(std::chrono::microseconds(1000));

    EXPECT_FALSE( timer.total() > 0.002f );
    EXPECT_FALSE( timer.totalTicks() > 2000000 );
    EXPECT_TRUE( timer.elapsed() > 0.002f );
    EXPECT_TRUE( timer.elapsedTicks() > 2000000 );

    timer.lap();

    EXPECT_TRUE( timer.total() > 0.002f );
    EXPECT_TRUE( timer.totalTicks() > 2000000 );
    EXPECT_TRUE( timer.elapsed() > 0.002f );
    EXPECT_TRUE( timer.elapsedTicks() > 2000000 );

    timer.stop();
}

TEST( Timer, TimeScale )
{
    using namespace nge::util;

    Timer timer;

    ASSERT_EQ( 1.0f, timer.timeScale() );

    timer.setTimeScale( 2.0f );
    timer.start();

	std::this_thread::sleep_for(std::chrono::microseconds(1000));

    EXPECT_TRUE( timer.elapsed() > 0.002f );
    EXPECT_TRUE( timer.elapsedTicks() > 2000000 );

    timer.stop();
    timer.setTimeScale( 0.5f );
    timer.start();

    EXPECT_FALSE( timer.elapsed() > 0.001f );
    EXPECT_FALSE( timer.elapsedTicks() > 1000000 );

    timer.stop();
}

redpajama_set_name: RedPajamaGithub


text:
package org.apache.directory.api.ldap.model.schema.syntaxes;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

import com.mycila.junit.concurrent.Concurrency;
import com.mycila.junit.concurrent.ConcurrentJunitRunner;

import org.apache.directory.api.ldap.model.schema.syntaxCheckers.FaxSyntaxChecker;
import org.junit.Test;
import org.junit.runner.RunWith;

/**
 * Test cases for FaxSyntaxChecker.
 *
 * @author Apache Directory Project
 */
@RunWith(ConcurrentJunitRunner.class)
@Concurrency()
public class FaxSyntaxCheckerTest
{
    FaxSyntaxChecker checker = new FaxSyntaxChecker();

    @Test
    public void testNullString()
    {
        assertTrue( checker.isValidSyntax( null ) );
    }

    @Test
    public void testEmptyString()
    {
        assertTrue( checker.isValidSyntax( "" ) );
    }

    @Test
    public void testOid()
    {
        assertEquals( "1.3.6.1.4.1.1466.115.121.1.23", checker.getOid() );
    }

    @Test
    public void testCorrectCase()
    {
        assertTrue( checker.isValidSyntax( "FALSE" ) );
        assertTrue( checker.isValidSyntax( new byte[]
            { 0x01, ( byte ) 0xFF } ) );
    }
}


text:
package com.thoughtworks.go.domain;

/**
 * @understands fetching properties for a job
 */
public interface JobPropertiesReader {

    Properties getPropertiesForJob(long id);
}


text:
package org.innovateuk.ifs.project.bankdetails.domain;

import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.innovateuk.ifs.address.domain.Address;
import org.innovateuk.ifs.organisation.domain.Organisation;
import org.innovateuk.ifs.project.core.domain.Project;

import javax.persistence.*;
import java.util.List;

import static org.innovateuk.ifs.project.constant.ProjectConstants.EXPERIAN_AUTOMATIC_APPROVAL_THRESHOLD_ADDRESS;
import static org.innovateuk.ifs.project.constant.ProjectConstants.EXPERIAN_AUTOMATIC_APPROVAL_THRESHOLD_COMPANY_NAME;

/**
 * Entity for persisting Bank Details for organisations associated with a project.
 */
@Entity
public class BankDetails {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    private String sortCode;

    private String accountNumber;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "projectId" , referencedColumnName = "id")
    private Project project;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "addressId" , referencedColumnName = "id")
    private Address address;

    @OneToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "organisationId", referencedColumnName = "id")
    private Organisation organisation;

    @Column(columnDefinition = "bit")
    private short companyNameScore;

    private boolean registrationNumberMatched;

    @Column(columnDefinition = "bit")
    private short addressScore;

    private boolean manualApproval;

    private boolean verified;

    @OneToMany(mappedBy = "bankDetails", cascade = CascadeType.ALL)
    private List<VerificationCondition> verificationConditions;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getSortCode() {
        return sortCode;
    }

    public void setSortCode(String sortCode) {
        this.sortCode = sortCode;
    }

    public String getAccountNumber() {
        return accountNumber;
    }

    public void setAccountNumber(String accountNumber) {
        this.accountNumber = accountNumber;
    }

    public Project getProject() {
        return project;
    }

    public void setProject(Project project) {
        this.project = project;
    }

    public Address getAddress() {
        return address;
    }

    public void setAddress(Address address) {
        this.address = address;
    }

    public Organisation getOrganisation() {
        return organisation;
    }

    public void setOrganisation(Organisation organisation) {
        this.organisation = organisation;
    }

    public short getCompanyNameScore() {
        return companyNameScore;
    }

    public void setCompanyNameScore(short companyNameScore) {
        this.companyNameScore = companyNameScore;
    }

    public boolean getRegistrationNumberMatched() {
        return registrationNumberMatched;
    }

    public void setRegistrationNumberMatched(boolean registrationNumberMatched) {
        this.registrationNumberMatched = registrationNumberMatched;
    }

    public short getAddressScore() {
        return addressScore;
    }

    public void setAddressScore(short addressScore) {
        this.addressScore = addressScore;
    }

    public boolean isManualApproval() {
        return manualApproval;
    }

    public void setManualApproval(boolean manualApproval) {
        this.manualApproval = manualApproval;
    }

    public boolean isVerified() {
        return verified;
    }

    public void setVerified(boolean verified) {
        this.verified = verified;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;

        if (o == null || getClass() != o.getClass()) return false;

        BankDetails that = (BankDetails) o;

        return new EqualsBuilder()
                .append(companyNameScore, that.companyNameScore)
                .append(registrationNumberMatched, that.registrationNumberMatched)
                .append(addressScore, that.addressScore)
                .append(manualApproval, that.manualApproval)
                .append(verified, that.verified)
                .append(id, that.id)
                .append(sortCode, that.sortCode)
                .append(accountNumber, that.accountNumber)
                .append(project, that.project)
                .append(address, that.address)
                .append(organisation, that.organisation)
                .isEquals();
    }

    @Override
    public int hashCode() {
        return new HashCodeBuilder(17, 37)
                .append(id)
                .append(sortCode)
                .append(accountNumber)
                .append(project)
                .append(address)
                .append(organisation)
                .append(companyNameScore)
                .append(registrationNumberMatched)
                .append(addressScore)
                .append(manualApproval)
                .append(verified)
                .toHashCode();
    }

    public boolean isRegistrationNumberMatched() {
        return registrationNumberMatched;
    }

    public List<VerificationCondition> getVerificationConditions() {
        return verificationConditions;
    }

    public void setVerificationConditions(List<VerificationCondition> verificationConditions) {
        this.verificationConditions = verificationConditions;
    }

    @Transient
    public boolean isApproved(){
        // Note that this criteria is temporary and will be adusted when we decide on thresholds.
        // It will likely be moved into a property file so it can be adjusted without code change.
        return manualApproval ||
                (verified &&
                        registrationNumberMatched &&
                        companyNameScore > EXPERIAN_AUTOMATIC_APPROVAL_THRESHOLD_COMPANY_NAME
                        && addressScore > EXPERIAN_AUTOMATIC_APPROVAL_THRESHOLD_ADDRESS);
    }
}


text:
// RobotBuilder Version: 1.5
//
// This file was generated by RobotBuilder. It contains sections of
// code that are automatically generated and assigned by robotbuilder.
// These sections will be updated in the future when you export to
// Java from RobotBuilder. Do not put any code or make any change in
// the blocks indicating autogenerated code or it will be lost on an
// update. Deleting the comments indicating the section will prevent
// it from being updated in the future.

package org.usfirst.frc.team4546.robot2.subsystems;

import org.usfirst.frc.team4546.robot2.Robot;
import org.usfirst.frc.team4546.robot2.RobotMap;
import org.usfirst.frc.team4546.robot2.commands.*;

import edu.wpi.first.wpilibj.*;
import edu.wpi.first.wpilibj.command.Subsystem;

/**
 *
 */
public class Lift extends Subsystem {

    Talon motor = RobotMap.liftMotor;

    DigitalInput upperLimit = RobotMap.liftUpperLimit;
    DigitalInput lowerLimit = RobotMap.liftLowerLimit;
    DigitalInput toteLimit = RobotMap.liftToteLimit;

    // Put methods for controlling this subsystem
    // here. Call these from Commands.

    public void move(double speed)	{

    	if (isFullyUp() == false || isFullyDown() == false)	{

    		motor.set(speed);
    	}
    }

    //Method to raise the lift
    public void  up()	{

    	if (isFullyUp() == false)	{

    		motor.set(1);
    	}

    }

    //Method to lower the lift
    public void down()	{

    	if (isFullyDown() == false)	{

    		motor.set(-1);
    	}
    }

    //Method to stop the lift
    public void stop()	{

    	motor.stopMotor();
    }

    //Boolean to check if the lift is all the way up
    public boolean isFullyUp()	{

    	return upperLimit.get();
    }

    //Boolean to check if the lift is all the way down
    public boolean isFullyDown()	{

    	return lowerLimit.get();
    }

    public boolean isUpOneTote()	{

    	return toteLimit.get();
    }

    //No default command
    @Override protected void initDefaultCommand() {}
}


text:
namespace shiny { namespace logging {

	using level_t = atma::log_level_t;
	using runtime_t = atma::logging_runtime_t;

	namespace detail
	{
		inline auto current_runtime() -> runtime_t*& { static runtime_t* R = nullptr; return R; }
		inline auto flush_after_error() -> std::atomic<bool>& { static std::atomic<bool> _{true}; return _; }
	}

	inline auto set_runtime(runtime_t* R) -> void
	{
		detail::current_runtime() = R;
	}

	extern std::atomic<bool> flush_after_error;
	//extern std::atomic<bool> flush_after_warning;

	inline auto set_flush_after_error(bool flush) { detail::flush_after_error() = flush; }

}}

namespace shiny { namespace log { namespace color {

	namespace
	{
		atma::colorbyte reset{0x07};

		// white-on-red for ERRORS
		atma::colorbyte error_text{0xcf};
		// dark-red-on-yellow for WARNINGS
		atma::colorbyte warn_text{0xe4};
		// white-on-blue for highlighting things
		atma::colorbyte highlight_text{0x1f};
	}

} } }

#define SHINY_LOG(level, ...) \
	::atma::send_log(::shiny::logging::detail::current_runtime(), \
		level, nullptr, __FILE__, __LINE__, __VA_ARGS__, "\n")

#define SHINY_TRACE(...) SHINY_LOG(::shiny::logging::level_t::verbose, __VA_ARGS__)
#define SHINY_INFO(...) SHINY_LOG(::shiny::logging::level_t::info,     __VA_ARGS__)
#define SHINY_DEBUG(...) SHINY_LOG(::shiny::logging::level_t::debug,   __VA_ARGS__)
#define SHINY_WARN(...) SHINY_LOG(::shiny::logging::level_t::warn,     __VA_ARGS__)
#define SHINY_ERROR(...) \
	do { \
		SHINY_LOG(::shiny::logging::level_t::error, __VA_ARGS__); \
		if (::shiny::logging::detail::flush_after_error()) \
			::shiny::logging::detail::current_runtime()->flush(); \
	} while (0)


text:
<?php

namespace s9e\SimpleDOM\Tests;
use s9e\SimpleDOM\SimpleDOM;

include_once __DIR__ . '/../src/SimpleDOM.php';

class isSameNodeTest extends \PHPUnit_Framework_TestCase
{
	public function testSameNode()
	{
		$root = new SimpleDOM('<root><child1 /><child2 /><child3 /></root>');
		$this->assertTrue($root->child1->isSameNode($root->child1));
	}

	public function testDifferentNodes()
	{
		$root = new SimpleDOM('<root><child1 /><child2 /><child3 /></root>');
		$this->assertFalse($root->child1->isSameNode($root->child2));
	}

	public function testClonedNodesAreNotTheSame()
	{
		$root = new SimpleDOM('<root><child1 /><child2 /><child3 /></root>');
		$this->assertFalse($root->child1->isSameNode($root->child1->cloneNode()));
	}
}


text:
import $ from 'jquery';
import { TweenLite, CSSPlugin } from 'gsap';
window.$ = $;

const carouselInit = () => {
  const $carousel = $(`.js-carousel`);
  const $prevPage = $(`.js-prev-page`);
  const $nextPage = $(`.js-next-page`);
  const $pages = $(`.js-page`);
  const $menu = $(`.js-menu`);
  const $menuLink = $(`.js-menu-link`);
  const menuLength = $menuLink.length;
  const firstImgId = 1;
  const lastImgId = $menuLink.eq(menuLength - 1).data(`id`) - 1;
  const pagesLength = $pages.length;
  const activeClass = `is-active`;
  const loadClass = `is-loaded`;
  let pageIndex = 1;

  const showMenu = () => {
    if (pageIndex > firstImgId) {
      $menu.addClass(activeClass);
    } else {
      $menu.removeClass(activeClass);
    }

    $menuLink.removeClass(activeClass);
    $menu.find(`[data-id="${pageIndex}"]`)
      .addClass(activeClass)
      .focus();
  };

  const showPage = () => {
    const $currPage = $carousel.find(`.${activeClass}`);
    const $nextPage = $pages.eq(pageIndex - 1);

    window.location.hash = pageIndex;

    TweenLite.to($currPage, 0.2, {
      opacity: 0,
      clearProps: `opacity`,
      onComplete: () => {
        $currPage.removeClass(`${activeClass} ${loadClass}`);
        $nextPage.addClass(activeClass);
        TweenLite.set($nextPage, {
          className: `+=${loadClass}`,
        });
      }
    });

    showMenu();
  };

  const lowerPageIndex = () => {
    pageIndex = pageIndex === 1 ? pagesLength : pageIndex - 1;

    showPage();
  };

  const increasePageIndex = () => {
    pageIndex = pageIndex === pagesLength ? 1 : pageIndex + 1;

    showPage();
  };

  const setPageIndex = (e) => {
    e.preventDefault();
    pageIndex = parseInt($(e.currentTarget).attr(`href`).substring(1));
    window.location.hash = pageIndex;
    showPage();
  };

  const swipeInit = () => {
    let xDown = null;
    let yDown = null;
    let doTouchBreak = null;
    const minDelta = 100;

    const handleTouchEnd = () => {
      doTouchBreak = null;
    };

    const handleTouchStart = (evt) => {
      xDown = evt.touches[0].clientX;
      yDown = evt.touches[0].clientY;
    };

    const handleTouchMove = (evt) => {
      if ( !xDown || !yDown || doTouchBreak) {
        return false;
      }

      const xUp = evt.touches[0].clientX;
      const yUp = evt.touches[0].clientY;
      const xDiff = xDown - xUp;
      const yDiff = yDown - yUp;

      if ( Math.abs( xDiff ) > Math.abs( yDiff ) ) {
        if ( xDiff > minDelta ) {
          increasePageIndex();
          doTouchBreak = true;
        } else if ( xDiff < -minDelta) {
          lowerPageIndex();
          doTouchBreak = true;
        }
      }

      if (doTouchBreak) {
        xDown = null;
        yDown = null;
      }
    };

    document.addEventListener('touchstart', handleTouchStart, false);
    document.addEventListener('touchmove', handleTouchMove, false);
    document.addEventListener('touchend', handleTouchEnd, false);
    document.addEventListener('touchcancel', handleTouchEnd, false);
  };

  if (window.location.hash) {
    const hash = window.location.hash;
    pageIndex = parseInt(hash.substring(1));
    showPage();
  } else {
    showPage();
  }

  $prevPage.on(`click`, lowerPageIndex);
  $nextPage.on(`click`, increasePageIndex);
  $menuLink.on(`click`, setPageIndex);
  swipeInit();

  $(`body`).keydown(function(e) {
    // Left, up, backspace
    if (e.keyCode == 37 || e.keyCode == 38 || e.keyCode == 8) { lowerPageIndex(); }
    // Right, down
    else if (e.keyCode == 39 || e.keyCode == 40) { increasePageIndex(); }
  });
};

export { carouselInit };


text:
<?php
    /**
     *	Base include file for SimpleTest
     *	@package	SimpleTest
     *	@subpackage	WebTester
     *	@version	$Id: browser.php,v 1.1 2005/12/22 06:40:44 lucholaf Exp $
     */

    /**#@+
     *	include other SimpleTest class files
     */
    require_once(dirname(__FILE__) . '/options.php');
    require_once(dirname(__FILE__) . '/http.php');
    require_once(dirname(__FILE__) . '/encoding.php');
    require_once(dirname(__FILE__) . '/page.php');
    require_once(dirname(__FILE__) . '/frames.php');
    require_once(dirname(__FILE__) . '/user_agent.php');
    /**#@-*/

    define('DEFAULT_MAX_NESTED_FRAMES', 3);

    /**
     *    Browser history list.
	 *    @package SimpleTest
	 *    @subpackage WebTester
     */
    class SimpleBrowserHistory {
        var $_sequence;
        var $_position;

        /**
         *    Starts empty.
         *    @access public
         */
        function SimpleBrowserHistory() {
            $this->_sequence = array();
            $this->_position = -1;
        }

        /**
         *    Test for no entries yet.
         *    @return boolean        True if empty.
         *    @access private
         */
        function _isEmpty() {
            return ($this->_position == -1);
        }

        /**
         *    Test for being at the beginning.
         *    @return boolean        True if first.
         *    @access private
         */
        function _atBeginning() {
            return ($this->_position == 0) && ! $this->_isEmpty();
        }

        /**
         *    Test for being at the last entry.
         *    @return boolean        True if last.
         *    @access private
         */
        function _atEnd() {
            return ($this->_position + 1 >= count($this->_sequence)) && ! $this->_isEmpty();
        }

        /**
         *    Adds a successfully fetched page to the history.
         *    @param string $method                 GET or POST.
         *    @param SimpleUrl $url                 URL of fetch.
         *    @param SimpleFormEncoding $parameters Any post data with the fetch.
         *    @access public
         */
        function recordEntry($method, $url, $parameters) {
            $this->_dropFuture();
            array_push(
                    $this->_sequence,
                    array('method' => $method, 'url' => $url, 'parameters' => $parameters));
            $this->_position++;
        }

        /**
         *    Last fetching method for current history
         *    position.
         *    @return string      GET or POST for this point in
         *                        the history.
         *    @access public
         */
        function getMethod() {
            if ($this->_isEmpty()) {
                return false;
            }
            return $this->_sequence[$this->_position]['method'];
        }

        /**
         *    Last fully qualified URL for current history
         *    position.
         *    @return SimpleUrl        URL for this position.
         *    @access public
         */
        function getUrl() {
            if ($this->_isEmpty()) {
                return false;
            }
            return $this->_sequence[$this->_position]['url'];
        }

        /**
         *    Parameters of last fetch from current history
         *    position.
         *    @return SimpleFormEncoding    Post parameters.
         *    @access public
         */
        function getParameters() {
            if ($this->_isEmpty()) {
                return false;
            }
            return $this->_sequence[$this->_position]['parameters'];
        }

        /**
         *    Step back one place in the history. Stops at
         *    the first page.
         *    @return boolean     True if any previous entries.
         *    @access public
         */
        function back() {
            if ($this->_isEmpty() || $this->_atBeginning()) {
                return false;
            }
            $this->_position--;
            return true;
        }

        /**
         *    Step forward one place. If already at the
         *    latest entry then nothing will happen.
         *    @return boolean     True if any future entries.
         *    @access public
         */
        function forward() {
            if ($this->_isEmpty() || $this->_atEnd()) {
                return false;
            }
            $this->_position++;
            return true;
        }

        /**
         *    Ditches all future entries beyond the current
         *    point.
         *    @access private
         */
        function _dropFuture() {
            if ($this->_isEmpty()) {
                return;
            }
            while (! $this->_atEnd()) {
                array_pop($this->_sequence);
            }
        }
    }

    /**
     *    Simulated web browser. This is an aggregate of
     *    the user agent, the HTML parsing, request history
     *    and the last header set.
	 *    @package SimpleTest
	 *    @subpackage WebTester
     */
    class SimpleBrowser {
        var $_user_agent;
        var $_page;
        var $_history;
        var $_ignore_frames;
        var $_maximum_nested_frames;

        /**
         *    Starts with a fresh browser with no
         *    cookie or any other state information. The
         *    exception is that a default proxy will be
         *    set up if specified in the options.
         *    @access public
         */
        function SimpleBrowser() {
            $this->_user_agent = &$this->_createUserAgent();
            $this->_user_agent->useProxy(
                    SimpleTestOptions::getDefaultProxy(),
                    SimpleTestOptions::getDefaultProxyUsername(),
                    SimpleTestOptions::getDefaultProxyPassword());
            $this->_page = &new SimplePage();
            $this->_history = &$this->_createHistory();
            $this->_ignore_frames = false;
            $this->_maximum_nested_frames = DEFAULT_MAX_NESTED_FRAMES;
        }

        /**
         *    Creates the underlying user agent.
         *    @return SimpleFetcher    Content fetcher.
         *    @access protected
         */
        function &_createUserAgent() {
            return new SimpleUserAgent();
        }

        /**
         *    Creates a new empty history list.
         *    @return SimpleBrowserHistory    New list.
         *    @access protected
         */
        function &_createHistory() {
            return new SimpleBrowserHistory();
        }

        /**
         *    Disables frames support. Frames will not be fetched
         *    and the frameset page will be used instead.
         *    @access public
         */
        function ignoreFrames() {
            $this->_ignore_frames = true;
        }

        /**
         *    Enables frames support. Frames will be fetched from
         *    now on.
         *    @access public
         */
        function useFrames() {
            $this->_ignore_frames = false;
        }

        /**
         *    Parses the raw content into a page. Will load further
         *    frame pages unless frames are disabled.
         *    @param SimpleHttpResponse $response    Response from fetch.
         *    @param integer $depth                  Nested frameset depth.
         *    @return SimplePage                     Parsed HTML.
         *    @access protected
         */
        function &_parse($response, $depth = 0) {
            $builder = &new SimplePageBuilder();
            $page = &$builder->parse($response);
            if ($this->_ignore_frames || ! $page->hasFrames() || ($depth > $this->_maximum_nested_frames)) {
                return $page;
            }
            $frameset = &new SimpleFrameset($page);
            foreach ($page->getFrameset() as $key => $url) {
                $frame = &$this->_fetch('GET', $url, array(), $depth + 1);
                $frameset->addFrame($frame, $key);
            }
            return $frameset;
        }

        /**
         *    Fetches a page.
         *    @param string $method                   GET or POST.
         *    @param string/SimpleUrl $url            Target to fetch as string.
         *    @param SimpleFormEncoding $parameters   POST parameters.
         *    @param integer $depth                   Nested frameset depth protection.
         *    @return SimplePage                      Parsed page.
         *    @access private
         */
        function &_fetch($method, $url, $parameters, $depth = 0) {
            $response = &$this->_user_agent->fetchResponse($method, $url, $parameters);
            if ($response->isError()) {
                return new SimplePage($response);
            }
            return $this->_parse($response, $depth);
        }

        /**
         *    Fetches a page or a single frame if that is the current
         *    focus.
         *    @param string $method                   GET or POST.
         *    @param string/SimpleUrl $url            Target to fetch as string.
         *    @param SimpleFormEncoding $parameters   POST parameters.
         *    @return string                          Raw content of page.
         *    @access private
         */
        function _load($method, $url, $parameters = false) {
            $frame = $url->getTarget();
            if (! $frame || ! $this->_page->hasFrames() || (strtolower($frame) == '_top')) {
                return $this->_loadPage($method, $url, $parameters);
            }
            return $this->_loadFrame(array($frame), $method, $url, $parameters);
        }

        /**
         *    Fetches a page and makes it the current page/frame.
         *    @param string $method                   GET or POST.
         *    @param string/SimpleUrl $url            Target to fetch as string.
         *    @param SimpleFormEncoding $parameters   POST parameters.
         *    @return string                          Raw content of page.
         *    @access private
         */
        function _loadPage($method, $url, $parameters = false) {
            $this->_page = &$this->_fetch(strtoupper($method), $url, $parameters);
            $this->_history->recordEntry(
                    $this->_page->getMethod(),
                    $this->_page->getUrl(),
                    $this->_page->getRequestData());
            return $this->_page->getRaw();
        }

        /**
         *    Fetches a frame into the existing frameset replacing the
         *    original.
         *    @param array $frames                    List of names to drill down.
         *    @param string $method                   GET or POST.
         *    @param string/SimpleUrl $url            Target to fetch as string.
         *    @param SimpleFormEncoding $parameters   POST parameters.
         *    @return string                          Raw content of page.
         *    @access private
         */
        function _loadFrame($frames, $method, $url, $parameters = false) {
            $page = &$this->_fetch(strtoupper($method), $url, $parameters);
            $this->_page->setFrame($frames, $page);
        }

        /**
         *    Removes expired and temporary cookies as if
         *    the browser was closed and re-opened.
         *    @param string/integer $date   Time when session restarted.
         *                                  If omitted then all persistent
         *                                  cookies are kept.
         *    @access public
         */
        function restart($date = false) {
            $this->_user_agent->restart($date);
        }

        /**
         *    Adds a header to every fetch.
         *    @param string $header       Header line to add to every
         *                                request until cleared.
         *    @access public
         */
        function addHeader($header) {
            $this->_user_agent->addHeader($header);
        }

        /**
         *    Ages the cookies by the specified time.
         *    @param integer $interval    Amount in seconds.
         *    @access public
         */
        function ageCookies($interval) {
            $this->_user_agent->ageCookies($interval);
        }

        /**
         *    Sets an additional cookie. If a cookie has
         *    the same name and path it is replaced.
         *    @param string $name       Cookie key.
         *    @param string $value      Value of cookie.
         *    @param string $host       Host upon which the cookie is valid.
         *    @param string $path       Cookie path if not host wide.
         *    @param string $expiry     Expiry date.
         *    @access public
         */
        function setCookie($name, $value, $host = false, $path = '/', $expiry = false) {
            $this->_user_agent->setCookie($name, $value, $host, $path, $expiry);
        }

        /**
         *    Reads the most specific cookie value from the
         *    browser cookies.
         *    @param string $host        Host to search.
         *    @param string $path        Applicable path.
         *    @param string $name        Name of cookie to read.
         *    @return string             False if not present, else the
         *                               value as a string.
         *    @access public
         */
        function getCookieValue($host, $path, $name) {
            return $this->_user_agent->getCookieValue($host, $path, $name);
        }

        /**
         *    Reads the current cookies for the current URL.
         *    @param string $name   Key of cookie to find.
         *    @return string        Null if there is no current URL, false
         *                          if the cookie is not set.
         *    @access public
         */
        function getCurrentCookieValue($name) {
            return $this->_user_agent->getBaseCookieValue($name, $this->_page->getUrl());
        }

        /**
         *    Sets the maximum number of redirects before
         *    a page will be loaded anyway.
         *    @param integer $max        Most hops allowed.
         *    @access public
         */
        function setMaximumRedirects($max) {
            $this->_user_agent->setMaximumRedirects($max);
        }

        /**
         *    Sets the maximum number of nesting of framed pages
         *    within a framed page to prevent loops.
         *    @param integer $max        Highest depth allowed.
         *    @access public
         */
        function setMaximumNestedFrames($max) {
            $this->_maximum_nested_frames = $max;
        }

        /**
         *    Sets the socket timeout for opening a connection.
         *    @param integer $timeout      Maximum time in seconds.
         *    @access public
         */
        function setConnectionTimeout($timeout) {
            $this->_user_agent->setConnectionTimeout($timeout);
        }

        /**
         *    Sets proxy to use on all requests for when
         *    testing from behind a firewall. Set URL
         *    to false to disable.
         *    @param string $proxy        Proxy URL.
         *    @param string $username     Proxy username for authentication.
         *    @param string $password     Proxy password for authentication.
         *    @access public
         */
        function useProxy($proxy, $username = false, $password = false) {
            $this->_user_agent->useProxy($proxy, $username, $password);
        }

        /**
         *    Fetches the page content with a HEAD request.
         *    Will affect cookies, but will not change the base URL.
         *    @param string/SimpleUrl $url                Target to fetch as string.
         *    @param hash/SimpleFormEncoding $parameters  Additional parameters for
         *                                                HEAD request.
         *    @return boolean                             True if successful.
         *    @access public
         */
        function head($url, $parameters = false) {
            if (! is_object($url)) {
                $url = new SimpleUrl($url);
            }
            if (is_array($parameters)) {
                $parameters = new SimpleFormEncoding($parameters);
            }
            if ($this->getUrl()) {
                $url = $url->makeAbsolute($this->getUrl());
            }
            $response = &$this->_user_agent->fetchResponse(
                    'HEAD',
                    $url,
                    $parameters);
            return ! $response->isError();
        }

        /**
         *    Fetches the page content with a simple GET request.
         *    @param string/SimpleUrl $url                Target to fetch.
         *    @param hash/SimpleFormEncoding $parameters  Additional parameters for
         *                                                GET request.
         *    @return string                              Content of page or false.
         *    @access public
         */
        function get($url, $parameters = false) {
            if (! is_object($url)) {
                $url = new SimpleUrl($url);
            }
            if (is_array($parameters)) {
                $parameters = new SimpleFormEncoding($parameters);
            }
            if ($this->getUrl()) {
                $url = $url->makeAbsolute($this->getUrl());
            }
            return $this->_load('GET', $url, $parameters);
        }

        /**
         *    Fetches the page content with a POST request.
         *    @param string/SimpleUrl $url                Target to fetch as string.
         *    @param hash/SimpleFormEncoding $parameters  POST parameters.
         *    @return string                              Content of page.
         *    @access public
         */
        function post($url, $parameters = false) {
            if (! is_object($url)) {
                $url = new SimpleUrl($url);
            }
            if (is_array($parameters)) {
                $parameters = new SimpleFormEncoding($parameters);
            }
            if ($this->getUrl()) {
                $url = $url->makeAbsolute($this->getUrl());
            }
            return $this->_load('POST', $url, $parameters);
        }

        /**
         *    Equivalent to hitting the retry button on the
         *    browser. Will attempt to repeat the page fetch. If
         *    there is no history to repeat it will give false.
         *    @return string/boolean   Content if fetch succeeded
         *                             else false.
         *    @access public
         */
        function retry() {
            $frames = $this->_page->getFrameFocus();
            if (count($frames) > 0) {
                $this->_loadFrame(
                        $frames,
                        $this->_page->getMethod(),
                        $this->_page->getUrl(),
                        $this->_page->getRequestData());
                return $this->_page->getRaw();
            }
            if ($method = $this->_history->getMethod()) {
                $this->_page = &$this->_fetch(
                        $method,
                        $this->_history->getUrl(),
                        $this->_history->getParameters());
                return $this->_page->getRaw();
            }
            return false;
        }

        /**
         *    Equivalent to hitting the back button on the
         *    browser. The browser history is unchanged on
         *    failure.
         *    @return boolean     True if history entry and
         *                        fetch succeeded
         *    @access public
         */
        function back() {
            if (! $this->_history->back()) {
                return false;
            }
            $content = $this->retry();
            if (! $content) {
                $this->_history->forward();
            }
            return $content;
        }

        /**
         *    Equivalent to hitting the forward button on the
         *    browser. The browser history is unchanged on
         *    failure.
         *    @return boolean     True if history entry and
         *                        fetch succeeded
         *    @access public
         */
        function forward() {
            if (! $this->_history->forward()) {
                return false;
            }
            $content = $this->retry();
            if (! $content) {
                $this->_history->back();
            }
            return $content;
        }

        /**
         *    Retries a request after setting the authentication
         *    for the current realm.
         *    @param string $username    Username for realm.
         *    @param string $password    Password for realm.
         *    @return boolean            True if successful fetch. Note
         *                               that authentication may still have
         *                               failed.
         *    @access public
         */
        function authenticate($username, $password) {
            if (! $this->_page->getRealm()) {
                return false;
            }
            $url = $this->_page->getUrl();
            if (! $url) {
                return false;
            }
            $this->_user_agent->setIdentity(
                    $url->getHost(),
                    $this->_page->getRealm(),
                    $username,
                    $password);
            return $this->retry();
        }

        /**
         *    Accessor for a breakdown of the frameset.
         *    @return array   Hash tree of frames by name
         *                    or index if no name.
         *    @access public
         */
        function getFrames() {
            return $this->_page->getFrames();
        }

        /**
         *    Accessor for current frame focus. Will be
         *    false if no frame has focus.
         *    @return integer/string/boolean    Label if any, otherwise
         *                                      the position in the frameset
         *                                      or false if none.
         *    @access public
         */
        function getFrameFocus() {
            return $this->_page->getFrameFocus();
        }

        /**
         *    Sets the focus by index. The integer index starts from 1.
         *    @param integer $choice    Chosen frame.
         *    @return boolean           True if frame exists.
         *    @access public
         */
        function setFrameFocusByIndex($choice) {
            return $this->_page->setFrameFocusByIndex($choice);
        }

        /**
         *    Sets the focus by name.
         *    @param string $name    Chosen frame.
         *    @return boolean        True if frame exists.
         *    @access public
         */
        function setFrameFocus($name) {
            return $this->_page->setFrameFocus($name);
        }

        /**
         *    Clears the frame focus. All frames will be searched
         *    for content.
         *    @access public
         */
        function clearFrameFocus() {
            return $this->_page->clearFrameFocus();
        }

        /**
         *    Accessor for last error.
         *    @return string        Error from last response.
         *    @access public
         */
        function getTransportError() {
            return $this->_page->getTransportError();
        }

        /**
         *    Accessor for current MIME type.
         *    @return string    MIME type as string; e.g. 'text/html'
         *    @access public
         */
        function getMimeType() {
            return $this->_page->getMimeType();
        }

        /**
         *    Accessor for last response code.
         *    @return integer    Last HTTP response code received.
         *    @access public
         */
        function getResponseCode() {
            return $this->_page->getResponseCode();
        }

        /**
         *    Accessor for last Authentication type. Only valid
         *    straight after a challenge (401).
         *    @return string    Description of challenge type.
         *    @access public
         */
        function getAuthentication() {
            return $this->_page->getAuthentication();
        }

        /**
         *    Accessor for last Authentication realm. Only valid
         *    straight after a challenge (401).
         *    @return string    Name of security realm.
         *    @access public
         */
        function getRealm() {
            return $this->_page->getRealm();
        }

        /**
         *    Accessor for current URL of page or frame if
         *    focused.
         *    @return string    Location of current page or frame as
         *                      a string.
         */
        function getUrl() {
            $url = $this->_page->getUrl();
            return $url ? $url->asString() : false;
        }

        /**
         *    Accessor for raw bytes sent down the wire.
         *    @return string      Original text sent.
         *    @access public
         */
        function getRequest() {
            return $this->_page->getRequest();
        }

        /**
         *    Accessor for raw header information.
         *    @return string      Header block.
         *    @access public
         */
        function getHeaders() {
            return $this->_page->getHeaders();
        }

        /**
         *    Accessor for raw page information.
         *    @return string      Original text content of web page.
         *    @access public
         */
        function getContent() {
            return $this->_page->getRaw();
        }

        /**
         *    Accessor for plain text version of the page.
         *    @return string      Normalised text representation.
         *    @access public
         */
        function getContentAsText() {
            return $this->_page->getText();
        }

        /**
         *    Accessor for parsed title.
         *    @return string     Title or false if no title is present.
         *    @access public
         */
        function getTitle() {
            return $this->_page->getTitle();
        }

        /**
         *    Accessor for a list of all fixed links in current page.
         *    @return array   List of urls with scheme of
         *                    http or https and hostname.
         *    @access public
         */
        function getAbsoluteUrls() {
            return $this->_page->getAbsoluteUrls();
        }

        /**
         *    Accessor for a list of all relative links.
         *    @return array      List of urls without hostname.
         *    @access public
         */
        function getRelativeUrls() {
            return $this->_page->getRelativeUrls();
        }

        /**
         *    Sets all form fields with that name.
         *    @param string $name    Name of field in forms.
         *    @param string $value   New value of field.
         *    @return boolean        True if field exists, otherwise false.
         *    @access public
         */
        function setField($name, $value) {
            return $this->_page->setField($name, $value);
        }

        /**
         *    Sets all form fields with that id attribute.
         *    @param string/integer $id   Id of field in forms.
         *    @param string $value        New value of field.
         *    @return boolean             True if field exists, otherwise false.
         *    @access public
         */
        function setFieldById($id, $value) {
            return $this->_page->setFieldById($id, $value);
        }

        /**
         *    Accessor for a form element value within the page.
         *    Finds the first match.
         *    @param string $name        Field name.
         *    @return string/boolean     A string if the field is
         *                               present, false if unchecked
         *                               and null if missing.
         *    @access public
         */
        function getField($name) {
            return $this->_page->getField($name);
        }

        /**
         *    Accessor for a form element value within the page.
         *    @param string/integer $id  Id of field in forms.
         *    @return string/boolean     A string if the field is
         *                               present, false if unchecked
         *                               and null if missing.
         *    @access public
         */
        function getFieldById($id) {
            return $this->_page->getFieldById($id);
        }

        /**
         *    Clicks the submit button by label. The owning
         *    form will be submitted by this.
         *    @param string $label    Button label. An unlabeled
         *                            button can be triggered by 'Submit'.
         *    @param hash $additional Additional form data.
         *    @return string/boolean  Page on success.
         *    @access public
         */
        function clickSubmit($label = 'Submit', $additional = false) {
            if (! ($form = &$this->_page->getFormBySubmitLabel($label))) {
                return false;
            }
            $success = $this->_load(
                    $form->getMethod(),
                    $form->getAction(),
                    $form->submitButtonByLabel($label, $additional));
            return ($success ? $this->getContent() : $success);
        }

        /**
         *    Clicks the submit button by name attribute. The owning
         *    form will be submitted by this.
         *    @param string $name     Button name.
         *    @param hash $additional Additional form data.
         *    @return string/boolean  Page on success.
         *    @access public
         */
        function clickSubmitByName($name, $additional = false) {
            if (! ($form = &$this->_page->getFormBySubmitName($name))) {
                return false;
            }
            $success = $this->_load(
                    $form->getMethod(),
                    $form->getAction(),
                    $form->submitButtonByName($name, $additional));
            return ($success ? $this->getContent() : $success);
        }

        /**
         *    Clicks the submit button by ID attribute of the button
         *    itself. The owning form will be submitted by this.
         *    @param string $id       Button ID.
         *    @param hash $additional Additional form data.
         *    @return string/boolean  Page on success.
         *    @access public
         */
        function clickSubmitById($id, $additional = false) {
            if (! ($form = &$this->_page->getFormBySubmitId($id))) {
                return false;
            }
            $success = $this->_load(
                    $form->getMethod(),
                    $form->getAction(),
                    $form->submitButtonById($id, $additional));
            return ($success ? $this->getContent() : $success);
        }

        /**
         *    Clicks the submit image by some kind of label. Usually
         *    the alt tag or the nearest equivalent. The owning
         *    form will be submitted by this. Clicking outside of
         *    the boundary of the coordinates will result in
         *    a failure.
         *    @param string $label    ID attribute of button.
         *    @param integer $x       X-coordinate of imaginary click.
         *    @param integer $y       Y-coordinate of imaginary click.
         *    @param hash $additional Additional form data.
         *    @return string/boolean  Page on success.
         *    @access public
         */
        function clickImage($label, $x = 1, $y = 1, $additional = false) {
            if (! ($form = &$this->_page->getFormByImageLabel($label))) {
                return false;
            }
            $success = $this->_load(
                    $form->getMethod(),
                    $form->getAction(),
                    $form->submitImageByLabel($label, $x, $y, $additional));
            return ($success ? $this->getContent() : $success);
        }

        /**
         *    Clicks the submit image by the name. Usually
         *    the alt tag or the nearest equivalent. The owning
         *    form will be submitted by this. Clicking outside of
         *    the boundary of the coordinates will result in
         *    a failure.
         *    @param string $name     Name attribute of button.
         *    @param integer $x       X-coordinate of imaginary click.
         *    @param integer $y       Y-coordinate of imaginary click.
         *    @param hash $additional Additional form data.
         *    @return string/boolean  Page on success.
         *    @access public
         */
        function clickImageByName($name, $x = 1, $y = 1, $additional = false) {
            if (! ($form = &$this->_page->getFormByImageName($name))) {
                return false;
            }
            $success = $this->_load(
                    $form->getMethod(),
                    $form->getAction(),
                    $form->submitImageByName($name, $x, $y, $additional));
            return ($success ? $this->getContent() : $success);
        }

        /**
         *    Clicks the submit image by ID attribute. The owning
         *    form will be submitted by this. Clicking outside of
         *    the boundary of the coordinates will result in
         *    a failure.
         *    @param integer/string $id    ID attribute of button.
         *    @param integer $x            X-coordinate of imaginary click.
         *    @param integer $y            Y-coordinate of imaginary click.
         *    @param hash $additional      Additional form data.
         *    @return string/boolean       Page on success.
         *    @access public
         */
        function clickImageById($id, $x = 1, $y = 1, $additional = false) {
            if (! ($form = &$this->_page->getFormByImageId($id))) {
                return false;
            }
            $success = $this->_load(
                    $form->getMethod(),
                    $form->getAction(),
                    $form->submitImageById($id, $x, $y, $additional));
            return ($success ? $this->getContent() : $success);
        }

        /**
         *    Submits a form by the ID.
         *    @param string $id       The form ID. No submit button value
         *                            will be sent.
         *    @return string/boolean  Page on success.
         *    @access public
         */
        function submitFormById($id) {
            if (! ($form = &$this->_page->getFormById($id))) {
                return false;
            }
            $success = $this->_load(
                    $form->getMethod(),
                    $form->getAction(),
                    $form->submit());
            return ($success ? $this->getContent() : $success);
        }

        /**
         *    Follows a link by label. Will click the first link
         *    found with this link text by default, or a later
         *    one if an index is given. The match ignores case and
         *    white space issues.
         *    @param string $label     Text between the anchor tags.
         *    @param integer $index    Link position counting from zero.
         *    @return string/boolean   Page on success.
         *    @access public
         */
        function clickLink($label, $index = 0) {
            $urls = $this->_page->getUrlsByLabel($label);
            if (count($urls) == 0) {
                return false;
            }
            if (count($urls) < $index + 1) {
                return false;
            }
            $this->_load('GET', $urls[$index]);
            return $this->getContent();
        }

        /**
         *    Tests to see if a link is present by label.
         *    @param string $label     Text of value attribute.
         *    @return boolean          True if link present.
         *    @access public
         */
        function isLink($label) {
            return (count($this->_page->getUrlsByLabel($label)) > 0);
        }

        /**
         *    Follows a link by id attribute.
         *    @param string $id        ID attribute value.
         *    @return string/boolean   Page on success.
         *    @access public
         */
        function clickLinkById($id) {
            if (! ($url = $this->_page->getUrlById($id))) {
                return false;
            }
            $this->_load('GET', $url);
            return $this->getContent();
        }

        /**
         *    Tests to see if a link is present by ID attribute.
         *    @param string $id     Text of id attribute.
         *    @return boolean       True if link present.
         *    @access public
         */
        function isLinkById($id) {
            return (boolean)$this->_page->getUrlById($id);
        }
    }
?>


text:
<?xml version="1.0" encoding="utf-8"?><!--
  ~ Copyright (c) 2014. FarrelltonSolar
  ~
  ~  Licensed under the Apache License, Version 2.0 (the "License");
  ~  you may not use this file except in compliance with the License.
  ~  You may obtain a copy of the License at
  ~
  ~         http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~  Unless required by applicable law or agreed to in writing, software
  ~  distributed under the License is distributed on an "AS IS" BASIS,
  ~  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~  See the License for the specific language governing permissions and
  ~  limitations under the License.
  -->

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_weight="30"
    android:orientation="vertical"
    android:weightSum="100">

    <ca.farrelltonsolar.uicomponents.SolarGauge
        android:id="@+id/AHNetValue"
        android:layout_width="fill_parent"
        android:layout_height="0dp"
        android:layout_margin="20dp"
        android:layout_weight="50"
        app:autoScale="true"
        app:gaugeTitle="@string/NetCapacityGaugeTitle"
        app:readingPrecision="0"
        app:readingUnit="@string/amp_hours_unit"
        app:register="NetAmpHours"
        app:biDirectional="true"
        app:scaleEndValue="10"
        app:scaleStartValue="0"
        app:showInnerRim="false"
        app:showReading="true" />

    <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="0dp"
        android:layout_gravity="center_vertical|top"
        android:layout_marginBottom="50dp"
        android:layout_marginLeft="25dp"
        android:layout_weight="50">

        <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_marginRight="20dp"
            android:orientation="vertical"
            android:weightSum="100">

            <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
                android:layout_width="fill_parent"
                android:layout_height="0dp"
                android:layout_weight="25"
                android:layout_gravity="center_vertical|top"
                android:gravity="center_vertical|top"
                android:orientation="vertical"
                android:weightSum="100">

                <TextView
                    android:layout_width="fill_parent"
                    android:layout_height="0dp"
                    android:layout_weight="40"
                    android:gravity="center_vertical|left"
                    android:labelFor="@+id/Value"

                    android:text="@string/TotalCapacityTitle"
                    android:shadowColor="@color/material_blue_grey_800"
                    android:shadowDx="1"
                    android:shadowDy="1"
                    android:shadowRadius="1"
                    android:singleLine="true"
                    android:textColor="@color/black_87"
                    android:textSize="@dimen/textSizeLarge" />

                <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
                    android:layout_width="fill_parent"
                    android:layout_height="0dp"

                    android:layout_weight="60"
                    android:orientation="horizontal"
                    android:weightSum="100">

                    <ca.farrelltonsolar.uicomponents.Odometer
                        android:id="@+id/AHTotalValue"
                        android:layout_width="0dp"
                        android:layout_height="fill_parent"
                        android:layout_weight="90" />

                    <TextView
                        android:layout_width="0dp"
                        android:layout_height="match_parent"
                        android:layout_gravity="bottom|right"
                        android:layout_weight="10"
                        android:gravity="center"
                        android:paddingLeft="2dp"
                        android:shadowColor="@color/material_blue_grey_800"
                        android:shadowDx="1"
                        android:shadowDy="1"
                        android:shadowRadius="1"
                        android:singleLine="true"
                        android:text="@string/amp_hours_unit"
                        android:textColor="@color/black_87"
                        android:textSize="@dimen/textSizeMedium" />
                </LinearLayout>
            </LinearLayout>

            <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
                android:layout_width="fill_parent"
                android:layout_height="0dp"
                android:layout_gravity="center_vertical|top"
                android:layout_weight="25"
                android:gravity="center_vertical|top"
                android:orientation="vertical"
                android:weightSum="100">

                <TextView
                    android:layout_width="fill_parent"
                    android:layout_height="0dp"
                    android:layout_weight="40"
                    android:gravity="center_vertical|left"
                    android:labelFor="@+id/Value"
                    android:shadowColor="@color/material_blue_grey_800"
                    android:shadowDx="1"
                    android:shadowDy="1"
                    android:shadowRadius="1"
                    android:singleLine="true"
                    android:text="@string/RemainingCapacityTitle"
                    android:textColor="@color/black_87"
                    android:textSize="@dimen/textSizeLarge" />

                <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
                    android:layout_width="fill_parent"
                    android:layout_height="0dp"

                    android:layout_weight="60"
                    android:orientation="horizontal"
                    android:weightSum="100">

                    <ca.farrelltonsolar.uicomponents.Odometer
                        android:id="@+id/RemainingAHValue"
                        android:layout_width="0dp"
                        android:layout_height="fill_parent"
                        android:layout_weight="90" />

                    <TextView
                        android:layout_width="0dp"
                        android:layout_height="match_parent"
                        android:layout_gravity="bottom|right"
                        android:layout_weight="10"
                        android:gravity="center"
                        android:paddingLeft="2dp"
                        android:shadowColor="@color/material_blue_grey_800"
                        android:shadowDx="1"
                        android:shadowDy="1"
                        android:shadowRadius="1"
                        android:singleLine="true"
                        android:text="@string/amp_hours_unit"
                        android:textColor="@color/black_87"
                        android:textSize="@dimen/textSizeMedium" />
                </LinearLayout>
            </LinearLayout>

            <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
                android:layout_width="fill_parent"
                android:layout_height="0dp"
                android:layout_gravity="center_vertical|top"
                android:layout_weight="25"
                android:gravity="center_vertical|top"
                android:orientation="vertical"
                android:weightSum="100">

                <TextView
                    android:layout_width="fill_parent"
                    android:layout_height="0dp"
                    android:layout_weight="40"
                    android:gravity="center_vertical|left"
                    android:labelFor="@+id/Value"
                    android:shadowColor="@color/material_blue_grey_800"
                    android:shadowDx="1"
                    android:shadowDy="1"
                    android:shadowRadius="1"
                    android:singleLine="true"
                    android:text="@string/Negative_AH_Title"
                    android:textColor="@color/black_87"
                    android:textSize="@dimen/textSizeLarge" />

                <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
                    android:layout_width="fill_parent"
                    android:layout_height="0dp"

                    android:layout_weight="60"
                    android:orientation="horizontal"
                    android:weightSum="100">

                    <ca.farrelltonsolar.uicomponents.Odometer
                        android:id="@+id/AHMinusValue"
                        android:layout_width="0dp"
                        android:layout_height="fill_parent"
                        android:layout_weight="90" />

                    <TextView
                        android:layout_width="0dp"
                        android:layout_height="match_parent"
                        android:layout_gravity="bottom|right"
                        android:layout_weight="10"
                        android:gravity="center"
                        android:paddingLeft="2dp"
                        android:shadowColor="@color/material_blue_grey_800"
                        android:shadowDx="1"
                        android:shadowDy="1"
                        android:shadowRadius="1"
                        android:singleLine="true"
                        android:text="@string/amp_hours_unit"
                        android:textColor="@color/black_87"
                        android:textSize="@dimen/textSizeMedium" />
                </LinearLayout>
            </LinearLayout>

            <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
                android:layout_width="fill_parent"
                android:layout_height="0dp"
                android:layout_gravity="center_vertical|top"
                android:layout_weight="25"

                android:gravity="center_vertical|top"
                android:orientation="vertical"
                android:weightSum="100">

                <TextView
                    android:layout_width="fill_parent"
                    android:layout_height="0dp"
                    android:layout_weight="40"
                    android:gravity="center_vertical|left"
                    android:labelFor="@+id/Value"
                    android:shadowColor="@color/material_blue_grey_800"
                    android:shadowDx="1"
                    android:shadowDy="1"
                    android:shadowRadius="1"
                    android:singleLine="true"
                    android:text="@string/Positive_AH_Title"
                    android:textColor="@color/black_87"
                    android:textSize="@dimen/textSizeLarge" />

                <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
                    android:layout_width="fill_parent"
                    android:layout_height="0dp"

                    android:layout_weight="60"
                    android:orientation="horizontal"
                    android:weightSum="100">

                    <ca.farrelltonsolar.uicomponents.Odometer
                        android:id="@+id/AHPlusValue"
                        android:layout_width="0dp"
                        android:layout_height="fill_parent"
                        android:layout_weight="90" />

                    <TextView
                        android:layout_width="0dp"
                        android:layout_height="match_parent"
                        android:layout_gravity="bottom|right"
                        android:layout_weight="10"
                        android:gravity="center"
                        android:paddingLeft="2dp"
                        android:shadowColor="@color/material_blue_grey_800"
                        android:shadowDx="1"
                        android:shadowDy="1"
                        android:shadowRadius="1"
                        android:singleLine="true"
                        android:text="@string/amp_hours_unit"
                        android:textColor="@color/black_87"
                        android:textSize="@dimen/textSizeMedium" />
                </LinearLayout>
            </LinearLayout>

        </LinearLayout>
    </FrameLayout>

</LinearLayout>


text:
package com.thoughtworks.go.publishers;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Collection;
import java.util.Properties;
import java.util.zip.Deflater;
import javax.servlet.http.HttpServletResponse;

import com.thoughtworks.go.domain.DownloadAction;
import com.thoughtworks.go.domain.builder.FetchArtifactBuilder;
import com.thoughtworks.go.domain.JobIdentifier;
import com.thoughtworks.go.domain.Property;
import com.thoughtworks.go.domain.exception.ArtifactPublishingException;
import com.thoughtworks.go.remote.AgentIdentifier;
import com.thoughtworks.go.remote.work.ConsoleOutputTransmitter;
import com.thoughtworks.go.remote.work.RemoteConsoleAppender;
import com.thoughtworks.go.util.*;
import com.thoughtworks.go.util.HttpService;
import com.thoughtworks.go.util.URLService;
import com.thoughtworks.go.work.DefaultGoPublisher;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import static com.thoughtworks.go.util.ArtifactLogUtil.getConsoleOutputFolderAndFileNameUrl;
import static com.thoughtworks.go.util.CachedDigestUtils.md5Hex;
import static com.thoughtworks.go.util.GoConstants.PUBLISH_MAX_RETRIES;
import static com.thoughtworks.go.util.ExceptionUtils.bomb;
import static com.thoughtworks.go.util.FileUtil.normalizePath;
import static java.lang.String.format;
import static org.apache.commons.lang.StringUtils.removeStart;

@Component
public class GoArtifactsManipulator {
    private final HttpService httpService;
    private final URLService urlService;
    private final ZipUtil zipUtil;
    private static final Logger LOGGER = Logger.getLogger(GoArtifactsManipulator.class);

    @Autowired
    public GoArtifactsManipulator(HttpService httpService, URLService urlService, ZipUtil zipUtil) {
        this.httpService = httpService;
        this.urlService = urlService;
        this.zipUtil = zipUtil;
    }

    public void publish(DefaultGoPublisher goPublisher, String destPath, File source, JobIdentifier jobIdentifier) {
        if (!source.exists()) {
            String message = "Failed to find " + source.getAbsolutePath();
            goPublisher.consumeLineWithPrefix(message);
            bomb(message);
        }

        int publishingAttempts = 0;
        Throwable lastException = null;
        while (publishingAttempts < PUBLISH_MAX_RETRIES) {
            File tmpDir = null;
            try {
                publishingAttempts++;

                tmpDir = FileUtil.createTempFolder();
                File dataToUpload = new File(tmpDir, source.getName() + ".zip");
                zipUtil.zip(source, dataToUpload, Deflater.BEST_SPEED);

                long size = 0;
                if (source.isDirectory()) {
                    size = FileUtils.sizeOfDirectory(source);
                } else {
                    size = source.length();
                }

                goPublisher.consumeLineWithPrefix("Uploading artifacts from " + source.getAbsolutePath() + " to " + getDestPath(destPath));

                String normalizedDestPath = normalizePath(destPath);
                String url = urlService.getUploadUrlOfAgent(jobIdentifier, normalizedDestPath, publishingAttempts);

                int statusCode = httpService.upload(url, size, dataToUpload, artifactChecksums(source, normalizedDestPath));

                if (statusCode == HttpServletResponse.SC_REQUEST_ENTITY_TOO_LARGE) {
                    String message = String.format("Artifact upload for file %s (Size: %s) was denied by the server. This usually happens when server runs out of disk space.",
                            source.getAbsolutePath(), size);
                    goPublisher.consumeLineWithPrefix(message);
                    LOGGER.error("[Artifact Upload] Artifact upload was denied by the server. This usually happens when server runs out of disk space.");
                    publishingAttempts = PUBLISH_MAX_RETRIES;
                    bomb(message + ".  HTTP return code is " + statusCode);
                }
                if (statusCode < HttpServletResponse.SC_OK || statusCode >= HttpServletResponse.SC_MULTIPLE_CHOICES) {
                    bomb("Failed to upload " + source.getAbsolutePath() + ".  HTTP return code is " + statusCode);
                }
                return;
            } catch (Throwable e) {
                String message = "Failed to upload " + source.getAbsolutePath();
                LOGGER.error(message, e);
                goPublisher.consumeLineWithPrefix(message);
                lastException = e;
            } finally {
                FileUtil.deleteFolder(tmpDir);
            }
        }
        if (lastException != null) {
            throw new RuntimeException(lastException);
        }
    }

    private Properties artifactChecksums(File source, String destPath) throws IOException {
        if (source.isDirectory()) {
            return computeChecksumForContentsOfDirectory(source, destPath);
        }

        FileInputStream inputStream = null;
        Properties properties = null;
        try {
            inputStream = new FileInputStream(source);
            properties = computeChecksumForFile(source.getName(), md5Hex(inputStream), destPath);
        } finally {
            if (inputStream != null) {
                inputStream.close();
            }
        }
        return properties;
    }

    private Properties computeChecksumForContentsOfDirectory(File directory, String destPath) throws IOException {
        Collection<File> fileStructure = FileUtils.listFiles(directory, null, true);
        Properties checksumProperties = new Properties();
        for (File file : fileStructure) {
            String filePath = removeStart(file.getAbsolutePath(), directory.getParentFile().getAbsolutePath());
            FileInputStream inputStream = null;
            try {
                inputStream = new FileInputStream(file);
                checksumProperties.setProperty(getEffectiveFileName(destPath, normalizePath(filePath)), md5Hex(inputStream));
            } finally {
                if (inputStream != null) {
                    inputStream.close();
                }
            }
        }
        return checksumProperties;
    }

    private Properties computeChecksumForFile(String sourceName, String md5, String destPath) throws IOException {
        String effectiveFileName = getEffectiveFileName(destPath, sourceName);
        Properties properties = new Properties();
        properties.setProperty(effectiveFileName, md5);
        return properties;
    }

    private String getEffectiveFileName(String computedDestPath, String filePath) {
        File artifactDest = computedDestPath.isEmpty() ? new File(filePath) : new File(computedDestPath, filePath);
        return removeLeadingSlash(artifactDest);
    }

    private String removeLeadingSlash(File artifactDest) {
        return removeStart(normalizePath(artifactDest.getPath()), "/");
    }

    public void fetch(DefaultGoPublisher goPublisher, FetchArtifactBuilder fetchArtifactBuilder) {
        try {
            String fetchMsg = String.format("Fetching artifact [%s] from [%s]", fetchArtifactBuilder.getSrc(),
                    fetchArtifactBuilder.jobLocatorForDisplay());
            goPublisher.consumeLineWithPrefix(fetchMsg);
            fetchArtifactBuilder.fetch(new DownloadAction(httpService, goPublisher, new SystemTimeClock()), urlService);
        } catch (Exception e) {
            String fetchMsg = String.format("Failed to save artifact [%s] to [%s]",
                    fetchArtifactBuilder.getSrc(), fetchArtifactBuilder.getDest());
            LOGGER.error(fetchMsg, e);
            goPublisher.consumeLineWithPrefix(fetchMsg);
            throw new RuntimeException(e);
        }
    }

    private String getDestPath(String file) {
        if (StringUtils.isEmpty(file)) {
            return "[defaultRoot]";
        } else {
            return file;
        }
    }

    public void setProperty(JobIdentifier jobIdentifier, Property property) {
        try {
            String propertiesUrl = urlService.getPropertiesUrl(jobIdentifier, property.getKey());
            httpService.postToUrl(propertiesUrl, property.getValue());
        } catch (Exception e) {
            throw new ArtifactPublishingException(format("Failed to set property %s with value %s", property.getKey(), property.getValue()), e);
        }
    }

    public ConsoleOutputTransmitter createConsoleOutputTransmitter(JobIdentifier jobIdentifier,
                                                                   AgentIdentifier agentIdentifier) {
        String consoleUrl = urlService.getUploadUrlOfAgent(jobIdentifier, getConsoleOutputFolderAndFileNameUrl());
        return new ConsoleOutputTransmitter(new RemoteConsoleAppender(consoleUrl, httpService, agentIdentifier));
    }

}


text:
#ifndef ASM_TC_H
#define ASM_TC_H

extern unsigned long system_base;

/*
 * Search for a TURBOchannel Option Module
 * with a certain name. Returns slot number
 * of the first card not in use or -ENODEV
 * if none found.
 */
extern int search_tc_card(const char *);
/*
 * Marks the card in slot as used
 */
extern void claim_tc_card(int);
/*
 * Marks the card in slot as free
 */
extern void release_tc_card(int);
/*
 * Return base address of card in slot
 */
extern unsigned long get_tc_base_addr(int);
/*
 * Return interrupt number of slot
 */
extern unsigned long get_tc_irq_nr(int);
/*
 * Return TURBOchannel clock frequency in hz
 */
extern unsigned long get_tc_speed(void);

#endif


text:
<?php

define('hostname', 'localhost');
define('user', 'root');
define('password', '');
define('databaseName', 'tutorial');

$connect = mysqli_connect(hostname, user, password, databaseName);

?>


text:
$(document).ready(function(){

    var currentThreeCards = null;

    var cardToImageMapper = new CardToImageMapper();

    var getExpectedText = function(card1, card2, card3) {
        var suitValuePairs = PAOTrainer.SUIT_VALUE_MAPPING;

        var first = suitValuePairs[card1.suit][card1.value];
        var token1 = first.split(" ")[0];

        var second = suitValuePairs[card2.suit][card2.value];
        var token2 = second.split(" ")[1];

        var third = suitValuePairs[card3.suit][card3.value];
        var token3 = third.split(" ")[2];

        var expected = token1 + " " + token2 + " " + token3;
        return expected;
    }

    var drawThreeNewCards = function(){
        var deck = new Deck();
        var cards = [];
        cards.push(deck.draw());
        cards.push(deck.draw());
        cards.push(deck.draw());
        return cards;
    }

    var displayCards = function(threeCardList){
        $("#cards").html("");
        var $cards = $("#cards");

        var card1 = threeCardList[0];
        var card2 = threeCardList[1];
        var card3 = threeCardList[2];

        var offset1 = cardToImageMapper.getOffset(card1.suit, card1.value);
        var offset2 = cardToImageMapper.getOffset(card2.suit, card2.value);
        var offset3 = cardToImageMapper.getOffset(card3.suit, card3.value);
        var $i1 = $("

");
        $i1.css("background", "url(images/cards.png) "+offset1.x+" "+offset1.y);
        $i1.css("width", "73px");
        $i1.css("height", "100px");
        $i1.css("min-height", "1px");
        $cards.append($i1);

        var $i2 = $("

");
        $i2.css("background", "url(images/cards.png) "+offset2.x+" "+offset2.y);
        $i2.css("width", "73px");
        $i2.css("height", "100px");
        $i2.css("min-height", "1px");
        $cards.append($i2);

        var $i3 = $("

");
        $i3.css("background", "url(images/cards.png) "+offset3.x+" "+offset3.y);
        $i3.css("width", "73px");
        $i3.css("height", "100px");
        $i3.css("min-height", "1px");
        $cards.append($i3);
    }

    var drawAndDisplayThreeCards = function(){
        currentThreeCards = drawThreeNewCards();
        displayCards(currentThreeCards);
    }

    $("#pao").submit(function(e){
        e.preventDefault();
        e.stopImmediatePropagation();

        var userInput = $("#text").val();

        var expectedText = getExpectedText(
            currentThreeCards[0],
            currentThreeCards[1],
            currentThreeCards[2]);

        isUserInputCorrect = expectedText === userInput;

        if (isUserInputCorrect){
            $("body").css("background-color", "green");
            drawAndDisplayThreeCards();
        }else{
            console.log("Wrong, the correct answer is: " + expectedText)
            $("body").css("background-color", "red");
        }

        $("#text").val("");

        // Animate the flashing color of background
        setTimeout(function(){
            $("body").css("background-color", "white");
        }, 200);

    });
    drawAndDisplayThreeCards();
});


text:
/**
* BxSlider v4.0 - Fully loaded, responsive content slider
* http://bxslider.com
*
* Written by: Steven Wanderski, 2012
* http://stevenwanderski.com
* (while drinking Belgian ales and listening to jazz)
*
* CEO and founder of bxCreative, LTD
* http://bxcreative.com
*/

/** RESET AND LAYOUT
===================================*/
.bx-wrapper{position:relative; margin:0 auto 60px; padding:0; *zoom:1}
.bx-wrapper img{max-width:100%; display:block}

/** THEME
===================================*/
.bx-wrapper .bx-viewport{-moz-box-shadow:0 0 5px #ccc; -webkit-box-shadow:0 0 5px #ccc; box-shadow:0 0 5px #ccc; border:solid #fff 5px; background:#fff}
.bx-wrapper .bx-pager, .bx-wrapper .bx-controls-auto{position:absolute; bottom:-30px; width:100%}

/* LOADER */
.bx-wrapper .bx-loading{min-height:50px; background:url("images/bx_loader.gif") center center no-repeat #fff; height:100%; width:100%; position:absolute; top:0; left:0; z-index:2000}

/* PAGER */
.bx-wrapper .bx-pager{text-align:center; font-size:.85em; font-family:Arial; font-weight:bold; color:#666; padding-top:20px}
.bx-wrapper .bx-pager .bx-pager-item,
.bx-wrapper .bx-controls-auto .bx-controls-auto-item{display:inline-block; *zoom:1; *display:inline}
.bx-wrapper .bx-pager.bx-default-pager a{background:#666; text-indent:-9999px; display:block; width:10px; height:10px; margin:0 5px; outline:0; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px}
.bx-wrapper .bx-pager.bx-default-pager a:hover,
.bx-wrapper .bx-pager.bx-default-pager a.active{background:#000}

/* DIRECTION CONTROLS (NEXT / PREV) */
.bx-wrapper .bx-prev{left:10px; background:url("images/controls.png") no-repeat 0 -32px}
.bx-wrapper .bx-next{right:10px; background:url("images/controls.png") no-repeat -43px -32px}
.bx-wrapper .bx-prev:hover{background-position:0 0}
.bx-wrapper .bx-next:hover{background-position:-43px 0}
.bx-wrapper .bx-controls-direction a{position:absolute; top:50%; margin-top:-16px; outline:0; width:32px; height:32px; text-indent:-9999px; z-index:9999}
.bx-wrapper .bx-controls-direction a.disabled{display:none}

/* AUTO CONTROLS (START / STOP) */
.bx-wrapper .bx-controls-auto{text-align:center}
.bx-wrapper .bx-controls-auto .bx-start{display:block; text-indent:-9999px; width:10px; height:11px; outline:0; background:url("images/controls.png") -86px -11px no-repeat; margin:0 3px}
.bx-wrapper .bx-controls-auto .bx-start:hover,
.bx-wrapper .bx-controls-auto .bx-start.active{background-position:-86px 0}
.bx-wrapper .bx-controls-auto .bx-stop{display:block; text-indent:-9999px; width:9px; height:11px; outline:0; background:url("images/controls.png") -86px -44px no-repeat; margin:0 3px}
.bx-wrapper .bx-controls-auto .bx-stop:hover,
.bx-wrapper .bx-controls-auto .bx-stop.active{background-position:-86px -33px}

/* PAGER WITH AUTO-CONTROLS HYBRID LAYOUT */
.bx-wrapper .bx-controls.bx-has-controls-auto.bx-has-pager .bx-pager{text-align:left; width:80%}
.bx-wrapper .bx-controls.bx-has-controls-auto.bx-has-pager .bx-controls-auto{right:0; width:35px}

/* IMAGE CAPTIONS */
.bx-wrapper .bx-caption{position:absolute; bottom:0; left:0; background:#666\9; background:rgba(80,80,80,0.75); width:100%}
.bx-wrapper .bx-caption span{color:#FFF; display:block; font-family:Arial; font-size:16px; padding:20px}


text:
module Ms
  class Spectrum
    include Enumerable

    # The underlying data store.
    attr_reader :data

    # data takes an array: [mzs, intensities]
    # @return [Ms::Spectrum]
    # @param [Array] data two element array of mzs and intensities
    def initialize(data)
      @data = data
    end

    def self.from_peaks(ar_of_doublets)
      _mzs = []
      _ints = []
      ar_of_doublets.each do |mz, int|
        _mzs << mz
        _ints << int
      end
      self.new([_mzs, _ints])
    end

    # An array of the mz data.
    def mzs
      @data[0]
    end

    # An array of the intensities data, corresponding to mzs.
    def intensities
      @data[1]
    end

    def mzs_and_intensities
      [@data[0], @data[1]]
    end

    # retrieve an m/z and intensity doublet at that index
    def [](array_index)
      [mzs[array_index], intensities[array_index]]
    end

    # yields(mz, inten) across the spectrum, or array of doublets if no block
    def peaks(&block)
      (m, i) = mzs_and_intensities
      m.zip(i, &block)
    end

    alias_method :each, :peaks
    alias_method :each_peak, :peaks

    # if the mzs and intensities are the same then the spectra are considered
    # equal
    def ==(other)
      mzs == other.mzs && intensities == other.intensities
    end

    # returns a new spectrum whose intensities have been normalized by the tic
    def normalize
      tic = self.intensities.inject(0.0) {|sum,int| sum += int }
      Ms::Spectrum.new([self.mzs, self.intensities.map {|v| v / tic }])
    end

    ## uses index function and returns the intensity at that value
    #def intensity_at_mz(mz)
      #if x = index(mz)
        #intensities[x]
      #else
        #nil
      #end
    #end

    ## index mz, tolerance = :nearest(1), Float, :nearest_within_integer

    ## returns the index of the first value matching that m/z.  the argument m/z
    ## may be less precise than the actual m/z (rounding to the same precision
    ## given) but must be at least integer precision (after rounding)
    ## implemented as binary search (bsearch from the web)
    #def index(mz)
      #mz_ar = mzs
      #return_val = nil
      #ind = mz_ar.bsearch_lower_boundary{|x| x <=> mz }
      #if mz_ar[ind] == mz
        #return_val = ind
      #else
        ## do a rounding game to see which one is it, or nil
        ## find all the values rounding to the same integer in the locale
        ## test each one fully in turn
        #mz = mz.to_f
        #mz_size = mz_ar.size
        #if ((ind < mz_size) and equal_after_rounding?(mz_ar[ind], mz))
          #return_val = ind
        #else # run the loop
          #up = ind
          #loop do
            #up += 1
            #if up >= mz_size
              #break
            #end
            #mz_up = mz_ar[up]
            #if (mz_up.ceil  - mz.ceil >= 2)
              #break
            #else
              #if equal_after_rounding?(mz_up, mz)
                #return_val = up
                #return return_val
              #end
            #end
          #end
          #dn= ind
          #loop do
            #dn -= 1
            #if dn < 0
              #break
            #end
            #mz_dn = mz_ar[dn]
            #if (mz.floor - mz_dn.floor >= 2)
              #break
            #else
              #if equal_after_rounding?(mz_dn, mz)
                #return_val = dn
                #return return_val
              #end
            #end
          #end
        #end
      #end
      #return_val
    #end

    ## less_precise should be a float
    ## precise should be a float
    #def equal_after_rounding?(precise, less_precise) # :nodoc:
      ## determine the precision of less_precise
      #exp10 = precision_as_neg_int(less_precise)
      ##puts "EXP10: #{exp10}"
      #answ = ((precise*exp10).round == (less_precise*exp10).round)
      ##puts "TESTING FOR EQUAL: #{precise} #{less_precise}"
      ##puts answ
      #(precise*exp10).round == (less_precise*exp10).round
    #end

    ## returns 1 for ones place, 10 for tenths, 100 for hundredths
    ## to a precision exceeding 1e-6
    #def precision_as_neg_int(float) # :nodoc:
      #neg_exp10 = 1
      #loop do
        #over = float * neg_exp10
        #rounded = over.round
        #if (over - rounded).abs <= 1e-6
          #break
        #end
        #neg_exp10 *= 10
      #end
      #neg_exp10
    #end

  end
end


text:
package org.librairy.modeler.lda.functions;

import org.apache.spark.api.java.function.Function;
import org.apache.spark.mllib.linalg.Vector;
import org.librairy.modeler.lda.models.ResourceShape;
import scala.Tuple2;

import java.io.Serializable;

/**
 * @author Badenes Olmedo, Carlos <cbadenes@fi.upm.es>
 */
public class TupleToResourceShape implements Serializable, Function<Tuple2<Object, Vector>, ResourceShape> {

    private final String uri;

    public TupleToResourceShape(String uri){
        this.uri = uri;
    }

    @Override
    public ResourceShape call(Tuple2<Object, Vector> objectVectorTuple2) throws Exception {
        ResourceShape shape = new ResourceShape();
        shape.setUri(uri);
        shape.setVector(objectVectorTuple2._2.toArray());
        return shape;
    }
}


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta http-equiv="content-language" content="es"/>
<link rel="stylesheet" type="text/css" href="css/main.css" />
<title>Verificación de requerimientos de Yii</title>

Verificación de requerimientos de Yii

Descripción

Este script verifica que la configuración de su servidor cumpla con los requerimientos
para poder ejecutar aplicaciones Web Yii.
El mismo verifica que el servidor este corriendo una versión adecuada de PHP,
que las extensiones PHP necesarias hayan sido cargadas y que las configuraciones del archivo php.ini sean correctas.

Conclusión

<?php if($result>0): ?>
Felicitaciones! Su servidor satisface todos los requerimientos de Yii.
<?php elseif($result<0): ?>
La configuración de su servidor satisface los requerimientos mínimos de Yii. Por favor preste atención a las advertencias listadas en el cuadro más abajo si su aplicación utiliza alguna de esas características.
<?php else: ?>
Desafortunadamente la configuración de su servidor no satisface los requerimientos de Yii.
<?php endif; ?>

Detalles

Nombre	Resultado	Requerido por	Memo

<?php foreach($requirements as $requirement): ?>

	<?php echo $requirement[0]; ?>

	<td class="<?php echo $requirement[2] ? 'passed' : ($requirement[1] ? 'failed' : 'warning'); ?>">
	<?php echo $requirement[2] ? 'Paso' : 'Fallo'; ?>

	<?php echo $requirement[3]; ?>

	<?php echo $requirement[4]; ?>

<?php endforeach; ?>

 	paso
 	fallo
 	advertencia

<?php echo $serverInfo; ?>


text:
package org.rythmengine.internal.parser.build_in;

/*-
 * #%L
 * Rythm Template Engine
 * %%
 * Copyright (C) 2017 - 2021 OSGL (Open Source General Library)
 * %%
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * #L%
 */

import com.stevesoft.pat.Regex;
import org.rythmengine.internal.CodeBuilder;
import org.rythmengine.internal.IContext;
import org.rythmengine.internal.IParser;
import org.rythmengine.internal.Token;
import org.rythmengine.internal.dialect.Rythm;
import org.rythmengine.internal.parser.ParserBase;

/**
 * Parse invocation:
 *
 * "@myMacro()" Note since this is also a pattern for expression parser, InvokeMacroParser must
 * be put in front of InvokeTagParser and expression parser
 */
public class InvokeMacroParser extends CaretParserFactoryBase {

    @Override
    public IParser create(IContext ctx) {
        return new ParserBase(ctx) {

            @Override
            public Token go() {
                Regex r = new Regex(String.format(patternStr(), dialect().a()));
                if (!r.search(remain())) return null;
                String macro = r.stringMatched(2);
                CodeBuilder cb = ctx().getCodeBuilder();
                // inline tag has higher priority than macro
                if (cb.hasInlineTagWithoutArgument(macro)) return null;
                if (!cb.hasMacro(macro)) return null;
                int curLine = currentLine();
                step(r.stringMatched().length());
                return new ExecMacroToken(macro, ctx(), curLine);
            }
        };
    }

    private static String patternStr() {
        return "^(%s([_a-zA-Z][a-zA-Z$_\\.0-9]+)[ \t]*\\([ \t]*\\))";
    }

    public static void main(String[] args) {
        InvokeMacroParser P = new InvokeMacroParser();
        Regex r = new Regex(String.format(P.patternStr(), Rythm.INSTANCE.a()));
        String s = "@ab ( )";
        p(s, r);
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto">

    <data>

        <import type="android.view.View" />

        <variable
            name="viewModel"
            type="me.rei_m.hbfavmaterial.viewmodel.widget.fragment.UserBookmarkFragmentViewModel" />
    </data>

    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <android.support.v4.widget.SwipeRefreshLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:colorSchemeResource1="@{@color/pull_to_refresh_1}"
            app:colorSchemeResource2="@{@color/pull_to_refresh_2}"
            app:colorSchemeResource3="@{@color/pull_to_refresh_3}"
            app:onRefresh="@{viewModel::onRefresh}"
            app:refreshing="@{viewModel.isRefreshing}">

            <ListView
                android:id="@+id/list_view"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:onItemClick="@{viewModel::onItemClick}"
                android:onScroll="@{viewModel::onScroll}"
                android:visibility="@{viewModel.isVisibleProgress ? View.GONE : View.VISIBLE}" />

        </android.support.v4.widget.SwipeRefreshLayout>

        <TextView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:gravity="center"
            android:padding="@dimen/margin_outline"
            android:text="@string/message_text_empty_bookmark_user"
            android:visibility="@{viewModel.isVisibleEmpty ? View.VISIBLE : View.GONE}" />

        <TextView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:gravity="center"
            android:padding="@dimen/margin_outline"
            android:text="@string/message_error_network"
            android:visibility="@{viewModel.isVisibleError ? View.VISIBLE : View.GONE}" />

        <FrameLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@android:color/white"
            android:visibility="@{viewModel.isVisibleProgress ? View.VISIBLE : View.GONE}">

            <ProgressBar
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center" />

        </FrameLayout>

    </FrameLayout>
</layout>


text:
package org.conqat.engine.resource.text;

import org.conqat.engine.resource.IResource;
import org.conqat.engine.resource.build.ResourceBuilder;
import org.conqat.engine.resource.test.ResourceProcessorTestCaseBase;
import org.conqat.engine.resource.util.ResourceTraversalUtils;

/**
 * Tests the {@link TextResourceSelector}.
 *
 * @author hummelb
 * @author $Author: deissenb $
 * @version $Rev: 34252 $
 * @levd.rating GREEN Hash: D9F6ACD3AB23C1F073819519D6F586BB
 */
public class TextResourceSelectorTest extends ResourceProcessorTestCaseBase {

	/** Tests the basic behavior. */
	public void testBasic() throws Exception {
		IResource input = (IResource) executeProcessor(
				ResourceBuilder.class,
				"(scope=(ref=memScope('TEST/a/b.txt'=B, 'TEST/a/c.bin'=C, 'TEST/d.txt'=D, 'TEST/x/y/z.bin'=E)), ",
				"factory=(pattern='**/*.txt', ref=textFactory()), factory=(pattern='**', ref=binFactory()))");

		IResource result = (IResource) executeProcessor(
				TextResourceSelector.class, "(input=(ref=", input, "))");

		assertNoEmptyContainer(result, TextContainer.class);
		assertEquals(2, ResourceTraversalUtils.countNonContainers(result));
		assertValidPath((TextContainer) result, "TEST/a/b.txt", TextContainer.class,
				TextElement.class);
		assertValidPath((TextContainer) result, "TEST/d.txt", TextContainer.class,
				TextElement.class);
	}

}