text:
from datetime import datetime

import logbook

import pytest

from .utils import get_total_delta_seconds

def test_timedate_format(activation_strategy, logger):
    """
    tests the logbook.set_datetime_format() function
    """
    FORMAT_STRING = '{record.time:%H:%M:%S.%f} {record.message}'
    handler = logbook.TestHandler(format_string=FORMAT_STRING)
    with activation_strategy(handler):
        logbook.set_datetime_format('utc')
        try:
            logger.warn('This is a warning.')
            time_utc = handler.records[0].time
            logbook.set_datetime_format('local')
            logger.warn('This is a warning.')
            time_local = handler.records[1].time
        finally:
            # put back the default time factory
            logbook.set_datetime_format('utc')

    # get the expected difference between local and utc time
    t1 = datetime.now()
    t2 = datetime.utcnow()

    tz_minutes_diff = get_total_delta_seconds(t1 - t2)/60.0

    if abs(tz_minutes_diff) < 1:
        pytest.skip('Cannot test utc/localtime differences '
                    'if they vary by less than one minute...')

    # get the difference between LogRecord local and utc times
    logbook_minutes_diff = get_total_delta_seconds(time_local - time_utc)/60.0
    assert abs(logbook_minutes_diff) > 1, ('Localtime does not differ from UTC by more than 1 '
                                           'minute (Local: %s, UTC: %s)' % (time_local, time_utc))

    ratio = logbook_minutes_diff / tz_minutes_diff

    assert ratio > 0.99
    assert ratio < 1.01


text:
package org.slf4j;

public class LoggerFactory {
    public static Logger getLogger(Class<?> loggedClass) {
        return new Logger(java.util.logging.Logger.getLogger(""));
    }
}

redpajama_set_name: RedPajamaGithub


text:
======
ds4drv
======

ds4drv is a Sony DualShock 4 userspace driver for Linux.

* Discussions: https://groups.google.com/forum/#!forum/ds4drv
* GitHub: https://github.com/chrippa/ds4drv
* PyPI: https://pypi.python.org/pypi/ds4drv

Features
--------

- Option to emulate the Xbox 360 controller for compatibility with Steam games
- Setting the LED color
- Reminding you about low battery by flashing the LED
- Using the trackpad as a mouse
- Custom mappings, map buttons and sticks to whatever mouse, key or joystick
  action you want
- Settings profiles that can be cycled through with a button binding

Installing
----------

Dependencies
^^^^^^^^^^^^

- `Python <http://python.org/>`_ 2.7 or 3.3+ (for Debian/Ubuntu you need to
  install the *python2.7-dev* or *python3.3-dev* package)
- `python-setuptools <https://pythonhosted.org/setuptools/>`_
- hcitool (usually available in the *bluez-utils* or equivalent package)

These packages will normally be installed automatically by the setup script,
but you may want to use your distro's packages if available:

- `pyudev <http://pyudev.readthedocs.org/>`_ 0.16 or higher
- `python-evdev <http://pythonhosted.org/evdev/>`_ 0.3.0 or higher

Stable release
^^^^^^^^^^^^^^

Installing the latest release is simple by using `pip <http://www.pip-installer.org/>`_:

.. code-block:: bash

    $ sudo pip install ds4drv

Development version
^^^^^^^^^^^^^^^^^^^

If you want to try out latest development code check out the source from
Github and install it with:

.. code-block:: bash

    $ git clone https://github.com/chrippa/ds4drv.git
    $ cd ds4drv
    $ sudo python setup.py install

Using
-----

ds4drv has two different modes to find DS4 devices, decide which one to use
depending on your use case.

Raw bluetooth mode
^^^^^^^^^^^^^^^^^^

Supported protocols: **Bluetooth**

Unless your system is using BlueZ 5.14 (which was released recently) or higher
it is not possible to pair with the DS4. Therefore this workaround exists,
which connects directly to the DS4 when it has been started in pairing mode
(by holding **Share + the PS button** until the LED starts blinking rapidly).

This is the default mode when running without any options:

.. code-block:: bash

   $ ds4drv

Hidraw mode
^^^^^^^^^^^

Supported protocols: **Bluetooth** and **USB**

This mode uses the Linux kernel feature *hidraw* to talk to already existing
devices on the system.

.. code-block:: bash

   $ ds4drv --hidraw

To use the DS4 via bluetooth in this mode you must pair it first. This requires
**BlueZ 5.14+** as there was a bug preventing pairing in earlier verions. How you
actually pair the DS4 with your computer depends on how your system is setup,
suggested googling: *<distro name> bluetooth pairing*

To use the DS4 via USB in this mode, simply connect your DS4 to your computer via
a micro USB cable.

Permissions
^^^^^^^^^^^

If you want to use ds4drv as a normal user, you need to make sure ds4drv has
permissions to use certain features on your system.

ds4drv uses the kernel module *uinput* to create input devices in user land and
the module *hidraw* to communicate with DualShock 4 controllers (when using
``--hidraw``), but this usually requires root permissions. You can change the
permissions by copying the `udev rules file <udev/50-ds4drv.rules>`_ to
``/etc/udev/rules.d/``.

You may have to reload your udev rules after this with:

.. code-block:: bash

    $ sudo udevadm control --reload-rules
    $ sudo udevadm trigger

Configuring
-----------

Configuration file
^^^^^^^^^^^^^^^^^^

The preferred way of configuring ds4drv is via a config file.
Take a look at `ds4drv.conf <ds4drv.conf>`_ for example usage.

ds4drv will look for the config file in the following paths:

- ``~/.config/ds4drv.conf``
- ``/etc/ds4drv.conf``

... or you can specify your own location with ``--config``.

Command line options
^^^^^^^^^^^^^^^^^^^^
You can also configure using command line options, this will set the LED
to a bright red:

.. code-block:: bash

   $ ds4drv --led ff0000

See ``ds4drv --help`` for a list of all the options.

Multiple controllers
^^^^^^^^^^^^^^^^^^^^

ds4drv does in theory support multiple controllers (I only have one
controller myself, so this is untested). You can give each controller
different options like this:

.. code-block:: bash

   $ ds4drv --led ff0000 --next-controller --led 00ff00

This will set the LED color to red on the first controller connected and
green on the second.

Known issues/limitations
------------------------

- `Bluetooth 2.0 dongles are known to have issues, 2.1+ is recommended. <https://github.com/chrippa/ds4drv/wiki/Bluetooth%20dongle%20compatibility>`_
- The controller will never be shut off, you need to do this manually by
  holding the PS button until the controller shuts off
- No rumble support

Troubleshooting
---------------

Check here for frequently encountered issues.

Failed to create input device: "/dev/uinput" cannot be opened for writing
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

This could be because the uinput kernel module is not running on your
computer. Doing ``lsmod | grep uinput`` should show if the module is loaded.
If it is blank, run ``sudo modprobe uinput`` to load it. (The uinput module
needs to be installed first. Please check with your distro's package
manager.)

To have the uinput module load on startup, you can add a file
to ``/etc/modules-load.d``. For example:

.. code-block:: bash

    # in file /etc/modules-load.d/uinput.conf
    # Load uinput module at boot
    uinput

References
----------

The DualShock 4 report format is not open and had to be reverse engineered.
These resources have been very helpful when creating ds4drv:

- http://www.psdevwiki.com/ps4/DualShock_4
- http://eleccelerator.com/wiki/index.php?title=DualShock_4
- https://gist.github.com/johndrinkwater/7708901
- https://github.com/ehd/node-ds4
- http://forums.pcsx2.net/Thread-DS4-To-XInput-Wrapper

----

.. |dogecoin| image:: http://targetmoon.com/img/dogecoin.png
  :alt: Dogecoin
  :target: http://dogecoin.com/

|dogecoin| DCbQgDa4aEbm9QNm4ix6zYV9vMirUDQLNj


text:
export interface RecipientResult {
  recipient: string;
  success: boolean;
  statusMessage?: string;
}

interface Result {
  /**
   * true if all recipients were successfully sent to; false otherwise
   */
  success: boolean;

  /**
   * per-recipient results
   */
  recipients: RecipientResult[];
}

export default Result;


text:
(function () {

    var modalType = "LANGUAGE_CREATED";
    function format(icon) {
        var originalOption = icon.element;
        return '<i class="' + $(originalOption).data('icon') + '"></i> ' + icon.text;
    }
    $(document).ready(function () {
        var $form = $("#createEditLang");
        var _languageAppService = abp.services.app.language;
        $form.on("submit", function (e) {
            e.preventDefault();
            var icon = $("#icon").val();
            var name = $("#name").val();
            var optionSelected = $("#name option:selected");
            var displayNameText = optionSelected.text();
            var displayName = displayNameText.substring(0, (displayNameText.indexOf("(") - 1));
            var data = {
                Icon: icon,
                LangCode: name,
                DisplayName: displayName
            }
            abp.ui.setBusy($form, _languageAppService.addLanguage(data)
                 .done(function () {
                     modalInstance.close({}, modalType);
                 }));

        });

        intializeSelect2Elements();

    });
    function intializeSelect2Elements() {
        $('.select2').select2({
            formatResult: format
        });
    }
})();


text:
ACCEPTED

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

#### Published in
Annls mycol. 23(3/6): 238 (1925)

#### Original name
Coniothyrium rostellatum Grove, 1886

### Remarks
null


text:
using System;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace Tank_Wars
{
	public class PowerIcon : Sprite
	{
		#region Declarations
		// Index của icon này trong powerIconList. (hay còn gọi là số thứ tự
		// bắt đầu từ 0)
		int powerIconListIndex;

		// Loại Power mà Icon này đại diện.
		public readonly Power Power;

		// Tên gọi đầy đủ của Power dưới dạng String.
		String powerName;

		// Trọng tâm của String.
		Vector2 powerNameOrigin;

		// Màu hiện tại của Icon.
		Color currentColor;

		// Bởi vì Texture truyền vào là một Sheet, ta cần biết được phải cắt
		// mảnh nào trong đó để vẽ, sourceRectangle phục vụ mục đích này.
		Rectangle sourceRectangle;
		#endregion

		#region Constructors
		public PowerIcon
			(
			GameplayScreen gameplayScreen, Texture2D textureImage, Rectangle sourceRectangle,
			Power power, String powerName, Point frameSize, Point sheetSize
			)
			: base
			(
			gameplayScreen, textureImage, Vector2.Zero, 0, frameSize, sheetSize
			)
		{
			this.drawLayer = 0.9f;
			this.powerIconListIndex = GameplayScreen.PowerIconList.Count;
			this.Power = power;
			this.powerName = powerName;
			this.origin = new Vector2(frameSize.X / 2, 0);
			this.powerNameOrigin = new Vector2
				(gameplayScreen.Content.Font.HUDFont.MeasureString(powerName).X / 2, 0);
			this.sourceRectangle = sourceRectangle;
			this.currentColor = Color.White;
		}
		#endregion

		#region Methods
		public override void Update(GameTime gameTime)
		{
			position = new Vector2
				(Camera.ViewportWidth / 2 -
				(GameplayScreen.PowerIconList.Count - 1) * 32 +
				powerIconListIndex * 64, 8);

			// Nếu Power của người chơi không trùng với Power mà Icon này
			// đại diện thì vẽ nó một cách bình thường.
			if (GameplayScreen.Player.PowerState != Power)
			{
				scale = MathHelper.Clamp(scale -= 0.01f, 1.0f, 1.1f);
				currentColor = Color.White;
			}
			// Ngược lại phóng to nó và đổi màu.
			else
			{
				scale = MathHelper.Clamp(scale += 0.01f, 1.0f, 1.1f);
				currentColor = Color.DeepSkyBlue;
			}
		}

		public override void Draw(GameTime gameTime, SpriteBatch spriteBatch)
		{
			// Nếu Power của người chơi trùng với Power mà Icon này đại diện
			// thì vẽ thêm 1 String ghi tên của Power bên dưới Icon này.
			if (GameplayScreen.Player.PowerState == Power)
			{
				spriteBatch.DrawString(GameplayScreen.Content.Font.HUDFont, powerName,
					new Vector2(CurrentWorldPosition.X, CurrentWorldPosition.Y + 62),
					currentColor * 0.6f, 0, powerNameOrigin, 1.0f,
					SpriteEffects.None, drawLayer);
				spriteBatch.DrawString(GameplayScreen.Content.Font.HUDFont, powerName,
					new Vector2(CurrentWorldPosition.X + 2, CurrentWorldPosition.Y + 64),
					Color.Black * 0.6f, 0, powerNameOrigin, 1.0f,
					SpriteEffects.None, drawLayer - 0.05f);
			}

			// Vẽ Power Icon.
			spriteBatch.Draw
				(
				textureImage, CurrentWorldPosition, sourceRectangle, currentColor * 0.8f,
				RotationAngle, origin, scale, SpriteEffects.None, drawLayer
				);
		}
		#endregion
	}
}


text:
#include "src/rangeSensorWorker.h"

#include <QtCore/QThread>
#include <QsLog.h>

static const int evSyn = 0;
static const int evAbs = 3;
static const int absDistance = 0x19;
static const int absMisc = 0x28;

using namespace trikControl;

RangeSensorWorker::RangeSensorWorker(const QString &eventFile, DeviceState &state
		, const trikHal::HardwareAbstractionInterface &hardwareAbstraction)
	: mState(state)
	, mHardwareAbstraction(hardwareAbstraction)
	, mEventFileName(eventFile)
{
}

RangeSensorWorker::~RangeSensorWorker()
{
	if (mState.isReady()) {
		stop();
	}
}

void RangeSensorWorker::stop()
{
	if (mState.isReady()) {
		mState.stop();
		if (mEventFile->close()) {
			mState.off();
		} else {
			mState.fail();
		}
	} else if (mState.status() == DeviceInterface::Status::starting) {
		// Maybe event file still waits for a driver to create event file, abort waiting.
		mEventFile->cancelWaiting();

		// In case of file is already opened --- close it. On unopened file "close" will do nothing.
		mEventFile->close();

		// Officially shut down sensor.
		mState.ready();
		mState.off();
	} else {
		QLOG_ERROR() << "Trying to stop range sensor that is not started, ignoring";
	}
}

void RangeSensorWorker::init()
{
	mState.start();

	mEventFile.reset(mHardwareAbstraction.createEventFile(mEventFileName, *QThread::currentThread()));

	connect(mEventFile.data(), SIGNAL(newEvent(int, int, int, trikKernel::TimeVal))
			, this, SLOT(onNewEvent(int, int, int, trikKernel::TimeVal)));

	if (mEventFile->open()) {
		mState.ready();
	} else {
		if (mState.status() == DeviceInterface::Status::off) {
			// Launching was aborted, do nothing.
			return;
		}

		// Sensor launch failed for some reason, assuming permanent failure.
		mState.fail();
	}
}

void RangeSensorWorker::onNewEvent(int eventType, int code, int value, const trikKernel::TimeVal &eventTime)
{
	if (!mState.isReady()) {
		return;
	}

	switch (eventType) {
	case evAbs:
		switch (code) {
		case absDistance:
			mDistance = value;
			break;
		case absMisc:
			mRawDistance = value;
			break;
		default:
			QLOG_ERROR() << "Unknown event in range sensor event file:" << eventType << code << value;
		}
		break;
	case evSyn:
		emit newData(mDistance, mRawDistance, eventTime);
		break;
	default:
		QLOG_ERROR() << "Unknown event in range sensor event file:" << eventType << code << value;
	}
}

int RangeSensorWorker::read()
{
	if (!mState.isReady()) {
		QLOG_ERROR() << "Trying to read from uninitialized sensor, ignoring";
		return -1;
	}

	return mDistance;
}

int RangeSensorWorker::readRawData()
{
	if (!mState.isReady()) {
		QLOG_ERROR() << "Trying to read from uninitialized sensor, ignoring";
		return -1;
	}

	return mRawDistance;
}


text:
// <copyright file="TestEvent.cs" company="Corsham Science">
// Copyright (c) Corsham Science. All rights reserved.
// </copyright>

namespace AggregateRepository.Core.Tests
{
    using System;

    internal class TestEvent
    {
        public TestEvent(Guid eventId) => EventId = eventId;

        public Guid EventId { get; }
    }
}


text:
/**
 * \file
 * \brief Private memory region layout for the Cortex-A57 MPCore
 */

/*
 * Copyright (c) 2016 ETH Zurich.
 * All rights reserved.
 *
 * This file is distributed under the terms in the attached LICENSE file.
 * If you do not find this file, copies can be found by writing to:
 * ETH Zurich D-INFK, Universitaetstrasse 6, CH-8092 Zurich. Attn: Systems Group.
 */

/* Offsets taken from ARM Cortex A57 MPCore TRM Table 8-1. */

#ifndef A57MPCORE_MAP_H
#define A57MPCORE_MAP_H 1

/*
 * Offset range from PERIPHBASE[43:18]
 *
 * It lists the address offsets for the GIC blocks relative to the PERIPHBASE
 * base address
 */

/* CPU interface */
#define A57MPCORE_GIC_CPU_OFFSET    0x0000
#define A57MPCORE_GIC_CPU_SIZE      0x2000

/* Virtual interface control */
#define A57MPCORE_GICH_CPU_OFFSET   0x10000
#define A57MPCORE_GICH_CPU_SIZE     0x1000

/* Virtual CPU interface (4KB page offset) */
#define A57MPCORE_GICV_OFFSET       0x20000
#define A57MPCORE_GICV_SIZE         0x2000

/* Alias of the Virtual CPU interface (64KB page offset alias) */
#define A57MPCORE_GICV_ALIAS_OFFSET 0x2F000
#define A57MPCORE_GICV_ALIAS_SIZE   0x2000

#endif /* A57MPCORE_MAP_H */


text:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>

	<artifactId>cathandsgendroid-core</artifactId>
	<name>${project.groupId}:${project.artifactId}</name>

	<parent>
		<groupId>net.cattaka</groupId>
		<artifactId>cathandsgendroid-parent</artifactId>
		<version>0.6.1-SNAPSHOT</version>
		<relativePath>../cathandsgendroid-parent</relativePath>
	</parent>

	<dependencies>
		<dependency>
			<groupId>com.google.android</groupId>
			<artifactId>android</artifactId>
			<version>4.1.1.4</version>
			<scope>provided</scope>
		</dependency>
	</dependencies>

  <scm>
    <tag>cathandsgendroid-0.1.2</tag>
  </scm>
</project>


text:
void loadData(const string& configFileName)
{
    MeaningExtractor::config.load(configFileName);

    WiktDB *wiktdb = new WiktDB();
    std::cout << "Loading DB..." << std::endl;
    wiktdb->loadDB(MeaningExtractor::config.wiktDBPath);
    std::cout << "DB loaded." << std::endl;

    MeaningExtractor::setDB(wiktdb);

    std::cout << "Preloading vectors..." << std::endl;
    MeaningExtractor::preloadVectors();
}

void writeConcepts(const string& oFileName)
{
    std::ofstream fMeanings;
    json meaningList = json::array();
    bool humanReadable = MeaningExtractor::config.humanReadable;

    fMeanings.open(oFileName);

    for (auto it = MeaningExtractor::reprCache.begin(); it != MeaningExtractor::reprCache.end(); ++it)
    {
        json meaning = json::object();

        meaning[FLD_ID] = it->first;
        meaning[FLD_TERM] = it->second.term;
        meaning[FLD_POS] = it->second.pos;
        meaning[FLD_DESCR] = it->second.descr;
        meaning[FLD_LANG] = it->second.lang;
        meaning[FLD_REPR] = MeaningExtractor::jsonRepr(it->second.repr, humanReadable);

        meaningList.push_back(meaning);
    }

    if (humanReadable)
        fMeanings <<  std::setw(2) << meaningList << std::endl;
    else
        fMeanings << meaningList;

    fMeanings.flush();
    fMeanings.close();
}

void writeVectors(const string& oFileName)
{
    std::ofstream fVectors;
    json meaningVectors = json::object();

    fVectors.open(oFileName);

    for (auto it = MeaningExtractor::reprCache.begin(); it != MeaningExtractor::reprCache.end(); ++it)
    {
        if (!meaningVectors.count(it->second.term))
        {
            meaningVectors[it->second.term] = json::array();
        }

        json meaning = json::object();
        meaning[FLD_ID] = it->first;
        meaning[FLD_POS] = it->second.pos;
        meaning["vec"] = MeaningExtractor::jsonRepr(it->second.repr, false);

        meaningVectors[it->second.term].push_back(meaning);
    }

    fVectors << meaningVectors;

    fVectors.flush();
    fVectors.close();
}

void writeCosines(const string& oFileName)
{
    std::ofstream fCosines;
    std::ofstream fConcepts;
    json concepts = json::array();

    fCosines.open(oFileName + ".cosines.bin", std::ios::binary);
    fConcepts.open(oFileName + ".concepts.json");

    ulong numConcepts = MeaningExtractor::reprCache.size();
    ulong countDone = 0;

	fCosines.write(reinterpret_cast<const char *>(&numConcepts), sizeof(ulong));

    for (auto it1 = MeaningExtractor::reprCache.begin(); it1 != MeaningExtractor::reprCache.end(); ++it1)
    {
        json meaning = json::object();
        meaning[FLD_ID] = it1->first;
        meaning[FLD_TERM] = it1->second.term;
        meaning[FLD_POS] = it1->second.pos;
        concepts.push_back(meaning);

        for (auto it2 = MeaningExtractor::reprCache.begin(); it2 != MeaningExtractor::reprCache.end(); ++it2)
        {
            float sim = 0;
            if (it1->first != it2->first)
                sim = MeaningExtractor::similarity(it1->second.term, it1->second.pos, it2->second.term, it2->second.pos, vector<string>(), 1);
            else
                sim = 1;

            //if (it2 != MeaningExtractor::reprCache.begin())
            //    fCosines << "\t";

            fCosines.write(reinterpret_cast<const char *>(&sim), sizeof(float));
        }

        //fCosines << std::endl;

        countDone++;

        //if (countDone % 10 == 0)
        std::cout << std::setw(4) << (float(countDone) * 100) / numConcepts << "% completed\r";
    }

    fConcepts << concepts << std::endl;

    fConcepts.flush();
    fCosines.flush();
    fConcepts.close();
    fCosines.close();
}

int main(int argc, char **argv)
{
    if (argc != 4)
    {
        std::cout << "Usage: " << argv[0] << " <config. filename> <output filename> <mode: (vectors|concepts|cosines)>" << std::endl;
    }
    else
    {
        string configFileName(argv[1]);
        string oFileName(argv[2]);
        string mode(argv[3]);

        loadData(configFileName);

        if (mode == "vectors")
            writeVectors(oFileName);
        else if (mode == "cosines")
            writeCosines(oFileName);
        else
            writeConcepts(oFileName);
    }

    return 0;
}


text:
var PingdomAdapter = require('../adapters/PingdomAdapter');
var VersionsAdapter = require('../adapters/VersionsAdapter');
var parse = require('url').parse;
var _ = require('lodash');

var Environment = function(title, url) {
  var _this = this;
  this.title = title;
  this.url = parse(url);
};

Environment.prototype = {
  get online() {
    var status_code = PingdomAdapter.getStatus(this.url.hostname);
    return (status_code === "up");
  },

  get prettyOnline() {
    return (this.online ? "Online!" : "Offline");
  },

  get uptime() {
    return PingdomAdapter.getUptime(this.url.hostname);
  },

  get timestamp() {
    return VersionsAdapter.getTimestamp(this.url.href);
  },

  get version() {
    return VersionsAdapter.getVersion(this.url.href);
  },

  get status() {
    if(!this.version) {
      return "warn";
    }

    return (this.online ? "good" : "bad");
  }
};

module.exports = Environment;


text:
You may update the editable properties of your profile here.

Name

An arbitrary human-readable name.

Metadata

The metadata yaml used to update the profile.


text:
namespace ofp {

class PortMod : public ProtocolMsg<PortMod, OFPT_PORT_MOD, 32> {
 public:
  PortNumber portNo() const { return portNo_; }
  MacAddress hwAddr() const { return hwAddr_; }
  OFPPortConfigFlags config() const { return config_; }
  OFPPortConfigFlags mask() const { return mask_; }

  PropertyRange properties() const;

  bool validateInput(Validation *context) const;

 private:
  Header header_;
  PortNumber portNo_;
  Padding<4> pad1_;
  MacAddress hwAddr_;
  Padding<2> pad2_;
  Big<OFPPortConfigFlags> config_;
  Big<OFPPortConfigFlags> mask_;

  // Only PortModBuilder can construct an actual instance.
  PortMod() : header_{type()} {}

  friend class PortModBuilder;
  template <class T>
  friend struct llvm::yaml::MappingTraits;
};

static_assert(sizeof(PortMod) == 32, "Unexpected size.");
static_assert(IsStandardLayout<PortMod>(), "Expected standard layout.");
static_assert(IsTriviallyCopyable<PortMod>(), "Expected trivially copyable.");

class PortModBuilder {
 public:
  PortModBuilder() = default;
  explicit PortModBuilder(const PortMod *msg);

  void setPortNo(PortNumber portNo) { msg_.portNo_ = portNo; }
  void setHwAddr(const MacAddress &hwAddr) { msg_.hwAddr_ = hwAddr; }
  void setConfig(OFPPortConfigFlags config) { msg_.config_ = config; }
  void setMask(OFPPortConfigFlags mask) { msg_.mask_ = mask; }

  void setProperties(const PropertyList &properties) {
    properties_ = properties;
  }

  UInt32 send(Writable *channel);

 private:
  PortMod msg_;
  PropertyList properties_;

  void sendV1(Writable *channel);

  template <class T>
  friend struct llvm::yaml::MappingTraits;
};

}  // namespace ofp

#endif  // OFP_PORTMOD_H_


text:
@implementation JYDickModel

@end


text:
@implementation SSStatusLoadingView

- (instancetype)initWithTapedHandler:(viewTapedHandler)tapedHandler tapedActionHandler:(viewTapedActionHandler)tapedActionHandler
{
    self = [super initWithTapedHandler:tapedHandler tapedActionHandler:tapedActionHandler];
    if (!self) return nil;

    [self addSubview:self.indicatorView];
    [self.indicatorView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self);
    }];

    [self.indicatorView startAnimating];

    return self;
}

- (UIActivityIndicatorView *)indicatorView
{
    if (!_indicatorView)
    {
        _indicatorView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite];
    }
    return _indicatorView;
}

@end


text:
/**
*   图片
*/
var str='';
var siteAdUrl = '';
str+='
';
    <icms id="site_ad_content" type="list">
        <![CDATA[
            siteAdUrl = '{f_SiteAdUrl}';
            str+='
';
                if(siteAdUrl.length<=0){
                    str+='{f_SiteAdContent}';
                }else{
                    str+='{f_SiteAdContent}';
                }
                str+='
';
        ]]>
    </icms>
str+='
';
$(".site_ad_{SiteAdId}").html(str);
$(".site_ad_{SiteAdId} img").css("width","{SiteAdWidth}");
$(".site_ad_{SiteAdId} img").css("height","{SiteAdHeight}");

var showOnce=getcookie('show_once_{SiteAdId}');
if(showOnce==1){
$(".site_ad_{SiteAdId}").hide();
}
setcookie('show_once_{SiteAdId}', {ShowOnce});


text:
package geekheads;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Optional;

import org.junit.Test;

import geekheads.tuples.Duple;
import geekheads.tuples.Tuple;

import static org.junit.Assert.assertEquals;

public class DupleTest {

  @Test
  public void testAsFunction() {
    Duple<Integer, String> mono = Tuple.of(1, "foo");
    Object[] values = Arrays.stream(new int[]{0, 1, 2})
      .mapToObj(mono)
      .filter(Optional::isPresent)
      .map(Optional::get)
      .toArray();
    assertEquals(2, values.length);
    assertEquals(1, values[0]);
    assertEquals("foo", values[1]);
  }

  @Test
  public void testAsComparable() {
    List<Duple<Integer, String>> list = new ArrayList<>();
    list.add(Tuple.of(3, "foo"));
    list.add(Tuple.of(2, "bar"));
    list.add(Tuple.of(2, "baz"));
    Collections.sort(list);
    assertEquals(2, (int) list.get(0).first);
    assertEquals("bar", (String) list.get(0).second);
    assertEquals(2, (int) list.get(1).first);
    assertEquals("baz", (String) list.get(1).second);
    assertEquals(3, (int) list.get(2).first);
    assertEquals("foo", (String) list.get(2).second);
  }
}


text:
package org.zbus.mq.server;

import java.io.IOException;

import org.zbus.net.core.Session;
import org.zbus.net.http.Message;

public class ReplyKit {

	public static void reply200(Message msg, Session sess) throws IOException {
		Message res = new Message();
		res.setId(msg.getId());
		res.setMq(msg.getMq());
		res.setResponseStatus(200);
		res.setBody("" + System.currentTimeMillis());

		sess.write(res);
	}

	public static void reply404(Message msg, Session sess) throws IOException {
		Message res = new Message();
		String mqName = msg.getMq();
		res.setId(msg.getId());
		res.setResponseStatus(404);
		res.setMq(mqName);
		res.setBody(String.format("MQ(%s) Not Found", mqName));

		sess.write(res);
	}

	public static void reply403(Message msg, Session sess) throws IOException {
		Message res = new Message();
		String mqName = msg.getMq();
		res.setId(msg.getId());
		res.setResponseStatus(403);
		res.setMq(mqName);
		res.setBody(String.format("MQ(%s) forbbiden", mqName));

		sess.write(res);
	}

	public static void reply400(Message msg, Session sess) throws IOException {
		Message res = new Message();
		res.setId(msg.getId());
		res.setResponseStatus(400);
		res.setMq(msg.getMq());
		res.setBody(String.format("Bad format: %s", msg.getBodyString()));
		sess.write(res);
	}

}


text:
/* add-template-plan-modal.js */
plenty_admin.UI.add_template_plan = {
	modal: $("body").find(".modal#add-template-plan"),
	init: function(){
		//check if it has already been INIT'd
		if(plenty_admin.UI.add_template_plan.modal.data("ready")){
			return;
		}
		//populate the organizations dropdown in Add Plan modal
		console.log("plenty_admin.UI.add_template_plan - INIT");
		var organizationOptionsHTML = "";
		for(id in plenty_admin.DATA.organizations)
		{
			if(
				plenty_admin.DATA.organizations.hasOwnProperty(id)
				&& id !== "length"
			){
				var org = plenty_admin.DATA.organizations[id];
				organizationOptionsHTML += "<option value='"+id+"'>"+org.name+"</option>";
			}
		}

		var owningOrgIdList = plenty_admin.UI.add_template_plan.modal
		.find("select#add_plan_owningOrgId");

		owningOrgIdList
		.find("option")
		.remove()
		.end()
		.append(organizationOptionsHTML);

		//get the equipmentEquipment types for this org and populate the equipment dropdowns
		var equipmentTypeList = plenty_admin.UI.add_template_plan.modal
		.find("select#add_task_equipment_types");

		equipmentTypeList
		.find("option")
		.remove()
		.end()
		.append("<option value='' disabled selected style='display:none;'>Choose equipment type</option>");

		//populate equipment types
		for(id in plenty_admin.DATA.equipmentTypes)
		{
			if(
				plenty_admin.DATA.equipmentTypes.hasOwnProperty(id)
				&& id !== "length"
			){
				var equip = plenty_admin.DATA.equipmentTypes[id];
				var $equipmentTypeOptionsHTML = $("<option value='"+id+"'>"+equip.name+"</option>");

				$equipmentTypeOptionsHTML
				.data("dto", equip);

				equipmentTypeList
				.append($equipmentTypeOptionsHTML);

				var specificEquipment = {};
				for(_id in plenty_admin.DATA.equipmentEquipmentTypes){
					if(plenty_admin.DATA.equipmentEquipmentTypes.hasOwnProperty(_id)){
						var et = plenty_admin.DATA.equipmentEquipmentTypes[_id];
						//console.log("equipment: ", et, id);
						if(et.equipmentTypeId === parseInt(id)){
							specificEquipment[et.id] = et;
						}
					}
				}
				$equipmentTypeOptionsHTML.data("items", specificEquipment);
			}
		}

		//populate product types
		var productTypeList = plenty_admin.UI.add_template_plan.modal
		.find("select#add_task_product_types");

		productTypeList
		.find("option")
		.remove()
		.end()
		.append("<option value='' disabled selected style='display:none;'>Choose product type</option>");

		for(id in plenty_admin.DATA.productTypes)
		{
			if(
				plenty_admin.DATA.productTypes.hasOwnProperty(id)
				&& id !== "length"
			){
				var prod = plenty_admin.DATA.productTypes[id];
				var $productTypeOptionsHTML = $("<option value='"+id+"'>"+prod.name+"</option>");

				$productTypeOptionsHTML.data("dto", prod);

				productTypeList
				.append($productTypeOptionsHTML);

				var specificProduct = {};
				for(_id in plenty_admin.DATA.allProducts){
					if(plenty_admin.DATA.allProducts.hasOwnProperty(_id)){
						var pt = plenty_admin.DATA.allProducts[_id];
						//console.log("product: ", pt, id);
						if(pt.productTypeId === parseInt(id)){
							specificProduct[pt.id] = pt;
						}
					}
				}
				$productTypeOptionsHTML.data("items", specificProduct);
			}
		}

		//populate activity types
		var activityTypeOptionsHTML = "";
		for(id in plenty_admin.DATA.activityTypes)
		{
			if(
				plenty_admin.DATA.activityTypes.hasOwnProperty(id)
				&& id !== "length"
			){
				var activity = plenty_admin.DATA.activityTypes[id];
				activityTypeOptionsHTML += "<option value='"+id+"'>"+activity.name+"</option>";
			}
		}

		var activityTypeList = plenty_admin.UI.add_template_plan.modal
		.find("select#add_activity_type");

		activityTypeList
		.find("option")
		.remove()
		.end()
		.append(activityTypeOptionsHTML);

		plenty_admin.UI.add_template_plan.modal
		.on('show.bs.modal', function () {
			$(this).find('.modal-content').css('height', $( window ).height()*0.9);

			//populate lists that are spicific to the selected organization
			//populate skill types
			var skillTypeList = plenty_admin.UI.add_template_plan.modal
			.find("select#add_task_labour_types");

			skillTypeList
			.find("option")
			.remove()
			.end()
			.append("<option value='' disabled selected style='display:none;'>Choose labour type</option>");

			for(id in plenty_admin.DATA.labourTypes)
			{
				if(
					plenty_admin.DATA.labourTypes.hasOwnProperty(id)
					&& id !== "length"
				){
					var skill = plenty_admin.DATA.labourTypes[id];
					var $skillTypeOptionsHTML = $("<option value='"+id+"'>"+skill.name+"</option>");

					$skillTypeOptionsHTML
					.data("dto", skill);

					skillTypeList
					.append($skillTypeOptionsHTML);

					var specificESkills = {};
					//for(var s=0; s<plenty_admin.DATA.current_organization.skills.length; s++){
					for(_id in plenty_admin.DATA.current_organization.skillsAndRates){
						if(plenty_admin.DATA.current_organization.skillsAndRates.hasOwnProperty(_id)){
							var _skill = plenty_admin.DATA.current_organization.skillsAndRates[_id];
							//console.log("_skill: ", _skill.skillId, id);
							if(_skill.skillId === parseInt(id)){
								specificESkills[_skill.id] = _skill;
							}
						}
					}
					$skillTypeOptionsHTML.data("items", specificESkills);
				}
			}
		})
		.on('hidden.bs.modal', function () {
			plenty_admin.UI.add_template_plan.clear();
		})
		.find(".task-types-tabs a")
		.click(function (e) {
		  e.preventDefault()
		  console.log("tab clicked", $(this));
		  $(this).tab('show');
		})
		.on('shown.bs.tab', function (e) {
			var url = $(e.target).prop("href");
			var hash = url.substring(url.indexOf('#')+1);
			console.log("hash", hash);
			plenty_admin.UI.add_template_plan.modal
			.find(".tab-content.task-types .tab-pane")
			.removeClass("active")
			.end()
			.find(".tab-content.task-types .tab-pane#"+hash)
			.addClass("active");
		})
		.end()
		.find("select.specific_items")
		.on("change", function(){
			var $this = $(this);
			var type = null;

			if($this.prop("id").indexOf("product") > -1){
				type = "product";
			}else if($this.prop("id").indexOf("equipment") > -1){
				type = "equipment";
			}else if($this.prop("id").indexOf("product") > -1){
				type = "product";
			}

			console.log("type", type);
			if(
				$(this).find("option:selected").val()
				&& type === "product"
			){
				$(this)
				.closest(".tab-pane")
				.find(".component_qty")
				.prop("disabled", false);
			}else{
				$(this)
				.closest(".tab-pane")
				.find(".component_qty")
				.val(1)
				.prop("disabled", true);
			}

		})
		.end()
		.find("select#add_activity_type")
		.on("change", function(){
			plenty_admin.UI.add_template_plan.addActivityForm
			.removeClass("harvest");

			if($(this).find("option:selected").text().toLowerCase() === "harvest"){
				plenty_admin.UI.add_template_plan.addActivityForm
				.addClass("harvest");
			}
		})
		.end()
		.find("select.component_type")
		.on("change", function(){
			var $this = $(this);
			var selected = $this.find("option:selected");
			var selectedDto = selected.data("dto");
			var specificItems = selected.data("items");
			var specificItemsList = $this.parent().find("select.specific_items");

			if(selectedDto.unitName){
				$this
				.closest(".tab-pane")
				.find(".uom")
				.text(selectedDto.unitName)
				.show();
			}

			var type = null;
			if($this.prop("id").indexOf("product") > -1){
				type = "product";
			}else if($this.prop("id").indexOf("equipment") > -1){
				type = "equipment";
			}else if($this.prop("id").indexOf("labour") > -1){
				type = "labour";
			}

			if(Object.keys(specificItems).length > 0){
				//list specific items for this type and show them
				var nameProp = "name";
				switch(type){
					case "product":
						nameProp = "productName";
					break;

					case "equipment":
						nameProp = "equipmentName";
					break;

					case "labour":
						nameProp = "userFirstAndLastName";
					break;
				}
				var specificItemsHTML = "<option value='' selected'>Choose specific "+selected.text()+"</option>";
				for(id in specificItems){
					if(specificItems.hasOwnProperty(id)){
						var item = specificItems[id];
						specificItemsHTML += "<option value='"+item.id+"'>"+item[nameProp]+"</option>";
					}
				}

				specificItemsList
				.find("option")
				.remove()
				.end()
				.append(specificItemsHTML)
				.show();
			}

			return false;
		})
		.end()
		.find("button.task_add_component")
		.on("click", function(){
			var $this = $(this);
			var $tp = $this.closest(".tab-pane");
			var valid = plenty_admin.HELPER.validateForm($tp);

			if(valid){
				var type = $tp.data("type");
				var $task_items_table = $tp.find("table.task-items tbody");

				//create the task item
				var task_component = {
					id: 		parseInt($tp.find(".component_type option:selected").val()),
					qty: 	parseInt($tp.find(".component_qty").val()),
				};

				//check if a specific item has been added - if so, add it to the task component
				if($tp.find("select.specific_items option:selected").length > 0){
					task_component.specificId = parseInt($tp.find("select.specific_items option:selected").val());
				}

				console.log("task_component", task_component);

				//disable this type so it can only be added once
				$tp
				.find(".component_type option:selected")
				.prop("disabled", true)
				.end()
				.find(".component_type option:eq(0)")
				.show()
				.prop("selected", true)
				.end()
				.find("select.specific_items, .uom")
				.hide();

				//add the task item to the correct DOM table
				var $taskComponent = plenty_admin.UI.add_template_plan.build_task_component(task_component, type);
				$task_items_table.append($taskComponent);
			}

			return false;
		})
		.end()
		.find("button.save_activity")
		.on("click", function(){
			var $this = $(this);
			plenty_admin.UI.add_template_plan.generate_activityDto($(this), false);
			return false;
		})
		.end()
		.find("button.update_activity")
		.on("click", function(){
			var index = $(this).data("activity").data("index");
			console.log("index", index);
			plenty_admin.UI.add_template_plan.generate_activityDto($(this), true, index);
			return false;
		})
		.end()
		.find("button.add_activity")
		.on("click", function(){
			var $this = $(this);

			$this
			.hide();

			plenty_admin.UI.add_template_plan.addActivityForm
			.find(".save_activity")
			.show()
			.end()
			.find(".update_activity")
			.hide()
			.end()
			.slideDown("fast");
		})
		.end()
		.find("button.add_task")
		.on("click", function(){
			var $this = $(this);

			$this
			.slideUp("fast");

			plenty_admin.UI.add_template_plan.minimise_all_tasks();

			plenty_admin.UI.add_template_plan.addTaskAndTaskComponents
			.slideDown("fast");
		})
		.end()
		.find("button.save_task")
		.on("click", function(){
			plenty_admin.UI.add_template_plan.generate_templateTaskDto($(this), false);
			return false;
		})
		.end()
		.find("button.update_task")
		.on("click", function(){
			plenty_admin.UI.add_template_plan.generate_templateTaskDto($(this), true);
			return false;
		})
		.end()
		.find("button.cancel_activity")
		.on("click", function(e){
			e.preventDefault();
			var $this = $(this);

			$this
			.closest(".activities_management")
			.find("form")
			.slideUp("fast", function(){
				plenty_admin.UI.add_template_plan.clear_add_activity_form();

				$this
				.closest(".activities_management")
				.find(".activity_list")
				.slideDown("fast")
				.end()
				.find("button.add_activity")
				.slideDown("fast");
			});
		})
		.end()
		.find("button.cancel_task")
		.on("click", function(e){
			e.preventDefault();
			var $this = $(this);

			//remove active class from all tasks
			plenty_admin.UI.add_template_plan.taskListHolder
			.find(".task.active")
			.removeClass("active");

			plenty_admin.UI.add_template_plan.addTaskAndTaskComponents
			.slideUp("fast", function(){
				plenty_admin.UI.add_template_plan.clear_add_task_form();

				plenty_admin.UI.add_template_plan.addTaskBtn
				.slideDown("fast");
			})
		})
		.end()
		.find("button.add")
		.on("click", function(){
			//collect all activities and their associated tasks
			var addPlanForm = plenty_admin.UI.add_template_plan.modal.find("form.add_plan_form");
			var valid = plenty_admin.HELPER.validateForm(addPlanForm);
			var $this = $(this);

			//hide any current errors in activities
			plenty_admin.UI.add_template_plan.modal.find(".activity .alert.help-block").slideUp("fast");

			if(valid){
				var activities = plenty_admin.UI.add_template_plan.modal.find(".activity");
				console.log("activities", activities, activities.length);
				if(activities.length <= 0){
					plenty_admin.UI.add_template_plan.activityListHolder
					.parent()
					.find(".alert.help-block:eq(0)")
					.slideDown("fast");
				}else{
					plenty_admin.UI.add_template_plan.activityListHolder
					.parent()
					.find(".alert.help-text:eq(0)")
					.hide();

					var activitiesAndTasks = [];
					for(var a=0; a<activities.length; a++){
						var $activity = $(activities[a]);
						var templateTaskDtos = [];
						var activityTasksList = plenty_admin.UI.add_template_plan.taskListHolder.find("ul.task_list.activity_tasks_"+$activity.data("index")+" .task");

						//alert the user if an activity has no tasks
						if(activityTasksList.length <= 0){
							$activity
							.find(".help-block.alert")
							.slideDown("fast");

							console.log("Activity Has No Tasks ;(");

							return false;
						}

						for(var t=0; t<activityTasksList.length; t++){
							var $task = $(activityTasksList[t]);
							templateTaskDtos.push($task.data("taskDto"));
						}

						$activity.data("activityDto").indexInPlan = $activity.index();

						var taskWithActivities = {
							templateActivityDto:$activity.data("activityDto"),
							templateTaskDtos:templateTaskDtos
						};
						activitiesAndTasks.push(taskWithActivities);
					}

					//all validation tests passed - disable the button
					$this
					.button("loading");

					plenty_admin.HELPER.showLoadingOverlay("New Plan");

					var TemplatePlanCreationDto = {
							owningOrgId:plenty_admin.DATA.current_organization.id,//parseInt(owningOrgIdList.find("option:selected").val()),
							planName:addPlanForm.find("#add_plan_name").val(),
							planDescription:addPlanForm.find("#add_plan_desc").val(),
							activitiesAndTasks:activitiesAndTasks
					}

					console.log("TemplatePlanCreationDto", TemplatePlanCreationDto);

					plenty_admin.REST.plans.createTemplatePlan(TemplatePlanCreationDto, function(templatePlan){
						console.log("add this templatePlan to the list: ", templatePlan);
						var $planHTML = plenty_admin.UI.organization.addItemFunctionality($(plenty_admin.UI.create_item(templatePlan, "plans")));

						plenty_admin.UI.organization.DOM.find("table.plansList")
						.find(".noItemsText")
						.remove()
						.end()
						.append($planHTML);

						var $tableHeader = plenty_admin.UI.organization.DOM.find("table.plansListHeader");

						//build the table header if it does not already exist
						if($tableHeader.find("thead").length == 0){
							var headerHTML = plenty_admin.UI.create_header_row(templatePlan, "plans");

							$tableHeader
							.html("")
							.append(headerHTML);
						}

						plenty_admin.UI.add_template_plan.hide();

						plenty_admin.HELPER.hideLoadingOverlay();
					});
				}
			}

			return false;
		})
		.end();

		plenty_admin.UI.add_template_plan.modal
		.data("ready", true);
	},
	minimise_all_tasks: function(){
		//minimise all existing tasks
		plenty_admin.UI.add_template_plan.taskListHolder
		.find(".task_list .task")
		.removeClass("open")
		.find(".task-components")
		.slideUp("fast");
	},
	generate_activityDto: function($this, replaceEl, index){
		var addActivityForm = plenty_admin.UI.add_template_plan.addActivityForm;

		var valid = plenty_admin.HELPER.validateForm(addActivityForm);

		if(valid){
			var activityDto = {
				templatePlanId:		null,
				activityTypeId:		parseInt(addActivityForm.find("#add_activity_type option:selected").val()),
				daysFromPlanting:	parseInt(addActivityForm.find("#add_activity_days_from_planting").val())
			}

			if(addActivityForm.hasClass("harvest")){
				activityDto.expectedYieldPerAcre = addActivityForm.find("#add_activity_expected_yield").val();
				activityDto.uomId = 1;
				//need to add yield UOM here once DB supports it
			}

			console.log("activityDto", activityDto);

			if(replaceEl){
				$this.data("activity").replaceWith(plenty_admin.UI.add_template_plan.build_activity_element(activityDto, index));
			}else{
				plenty_admin.UI.add_template_plan.build_activity_element(activityDto);
			}

			$this
			.closest(".activities_management")
			.find(".alert.help-block:eq(0)")
			.hide()
			.end()
			.find("form")
			.slideUp("fast", function(){
				plenty_admin.UI.add_template_plan.clear_add_activity_form();

				$this
				.closest(".activities_management")
				.find(".activity_list")
				.slideDown("fast")
				.end()
				.find("button.add_activity")
				.slideDown("fast");

				plenty_admin.UI.add_template_plan.addTaskAndTaskComponents
				.slideDown("fast");

				plenty_admin.UI.add_template_plan.addTaskBtn
				.slideUp("fast")
				.prop("disabled", false);

				plenty_admin.UI.add_template_plan
				.modal
				.find(".noActivityForTasks")
				.slideUp("fast");

				plenty_admin.UI.add_template_plan.minimise_all_tasks();
			});

			if(plenty_admin.UI.add_template_plan.activityListHolder.find("li.list-group-item.activity").length >1){
				//sort the list based on days from activity start
				plenty_admin.UI.add_template_plan.order_activities_by_days_from_planting();
			}
		}
	},
	generate_templateTaskDto: function($this, replaceEl){
		var addTaskForm = plenty_admin.UI.add_template_plan.addTaskForm;
		var addTaskAndTaskComponents = plenty_admin.UI.add_template_plan.addTaskAndTaskComponents;

		var equipmentComponents = addTaskAndTaskComponents.find("table.equipment-items tbody tr.task-element");
		var labourComponents = addTaskAndTaskComponents.find("table.labour-items tbody tr.task-element");
		var productComponents = addTaskAndTaskComponents.find("table.product-items tbody tr.task-element");
		var numTaskElements = equipmentComponents.length + labourComponents.length + productComponents.length;

		var valid = plenty_admin.HELPER.validateForm(addTaskForm);

		if(
			valid
			&& numTaskElements >= 1
		){
			//get the list of selected equipment IDs
			var equipmentIds = [];
			var anySpecificEquipmentIds = [];
			for(var l=0; l<equipmentComponents.length; l++){
				var taskComponent = $(equipmentComponents[l]).data("task_component");

				if(taskComponent.specificId){
					anySpecificEquipmentIds.push(taskComponent.specificId);
				}else{
					equipmentIds.push(taskComponent.id);
				}
			}
			console.log("equipmentIds:", equipmentIds);
			console.log("anySpecificEquipmentIds:", anySpecificEquipmentIds);

			//get the list of selected labour IDs
			var labourIds = [];
			var anySpecificLabourIds = [];

			for(var l=0; l<labourComponents.length; l++){
				var taskComponent = $(labourComponents[l]).data("task_component");
				if(taskComponent.specificId){
					anySpecificLabourIds.push(taskComponent.specificId);
				}else{
					labourIds.push($(labourComponents[l]).data("task_component").id);
				}

			}
			console.log("labourIds:", labourIds);
			console.log("anySpecificLabourIds:", anySpecificLabourIds);

			//get the list of selected labour IDs
			var productAmountPairs = [];
			var anySpecificProductIds = [];
			for(var l=0; l<productComponents.length; l++){
				var taskComponent = $(productComponents[l]).data("task_component");
				var prod = {
					productTypeId:taskComponent.id,
					amount:taskComponent.qty
				};

				productAmountPairs.push(prod);

				if(taskComponent.specificId){
					anySpecificProductIds.push(taskComponent.specificId);
				}
			}
			console.log("productAmountPairs:", productAmountPairs);
			console.log("anySpecificProductIds:", anySpecificProductIds);

			var templateTaskDto = {
				id:null,
				created:null,
				lastModified:null,
				name:addTaskForm.find("#add_task_name").val(),
				templateActivityId:null,
				daysFromActivityStart:parseInt(addTaskForm.find("#add_task_days_from_start").val()),
				labourIds:labourIds,
				equipmentIds:equipmentIds,
				productAmountPairs:productAmountPairs,
				anySpecificEquipmentIds:anySpecificEquipmentIds,
				anySpecificProductIds:anySpecificProductIds,
				anySpecificLabourIds:anySpecificLabourIds
			}

			console.log("templateTaskDto", templateTaskDto);

			//add the task element to the DOM
			if(replaceEl){
				$this.data("task").replaceWith(plenty_admin.UI.add_template_plan.build_task_element(templateTaskDto));
			}else{
				plenty_admin.UI.add_template_plan.build_task_element(templateTaskDto);
			}

			var selectedActivityIndex = plenty_admin.UI.add_template_plan.activityListHolder.find(".activity.active").data("index");
			var task_list = plenty_admin.UI.add_template_plan.taskListHolder.find("ul.task_list.activity_tasks_"+selectedActivityIndex);

			if(task_list.find(".task").length >1){
				plenty_admin.UI.add_template_plan.order_tasks_by_days_from_activity_start(task_list);
			}

			//remove the active class
			if($this.data("task")){
				$this
				.data("task")
				.removeClass("active");
			}

			addTaskAndTaskComponents
			.slideUp("fast", function(){
				plenty_admin.UI.add_template_plan.addTaskBtn
				.slideDown("fast");

				plenty_admin.UI.add_template_plan.clear_add_task_form();
			});
		}
	},
	show: function(){
		plenty_admin.UI.add_template_plan.modal
		.modal("show");
	},
	hide: function(){
		plenty_admin.UI.add_template_plan.modal
		.modal("hide");
	},
	clear: function(){
		//clear activities
		plenty_admin.UI.add_template_plan.activityListHolder
		.find("li.activity")
		.remove()
		.end()
		.parent()
		.find("form.add_activity_form")
		.show()
		.end()
		.find("button.add_activity")
		.hide();

		//clear tasks
		plenty_admin.UI.add_template_plan.taskListHolder
		.find(".task, .task_list")
		.remove()
		.end()
		.parent()
		.find("button.add_task")
		.hide()
		.end()
		.find("p.noActivityForTasks")
		.show();

		//reset form elements
		plenty_admin.UI.add_template_plan.modal
		.find("input, textarea")
		.each(function(){
			if($(this).data("default") !== "undefined"){
				if($(this).prop("type") === "number"){
					$(this).val(parseInt($(this).data("default")));
				}else{
					$(this).val($(this).data("default"));
				}
			}else{
				$(this).val("");
			}
		})
		.end()
		.find("select")
		.each(function(){
			$(this)
			.find("option:eq(0)")
			.prop("selected", true);

			$(this)
			.find("option:gt(0)")
			.each(function(){
				$(this)
				.prop("disabled", false);
			});
		})
		.end()
		.find(".uom, .specific_items")
		.hide()
		.end()
		.find("button.add")
		.button("reset");

		//remove any old task elements
		plenty_admin.UI.add_template_plan.modal
		.find("tr.task-element")
		.remove();

		//hide the add task form
		plenty_admin.UI.add_template_plan
		.addTaskAndTaskComponents
		.hide();

		//remove activity type classes from add activity form
		plenty_admin.UI.add_template_plan.addActivityForm
		.removeClass("harvest");

	},
	build_task_component: function(task_component, type){
		console.log("build_task_component", task_component, type);
		var componentName = null;
		if(task_component.specificId){
			var specificComponentList = null;
			switch(type){
				case "product":
				componentName = plenty_admin.DATA.allProducts[task_component.specificId].productName;
				break;

				case "equipment":
				componentName = plenty_admin.DATA.equipmentEquipmentTypes[task_component.specificId].equipmentName;
				break;

				case "labour":
				componentName = plenty_admin.DATA.current_organization.skillsAndRates[task_component.specificId].userFirstAndLastName;
				break;
			}
		}else{
			componentName = plenty_admin.DATA[type+"Types"][task_component.id].name;
		}
		var $taskComponent = $([
			'<tr class="reveal-on-hover-wrap task-element">',
				'<td width="55%">'+componentName+'</td>',
				'<td width="20%">'+task_component.qty+'</td>',
				'<td width="25%"><button class="btn btn-sm btn-danger delete reveal-on-hover-element btn-block"><span class="fa fa-trash-o"></span> Delete</button></td>',
			'</tr>'
		].join(""))
		.data("task_component", task_component)
		.find("button.delete")
		.click(function(){
			var $this = $(this);
			var $tc = $this.closest("tr");
			var tcDto = $tc.data("task_component");

			$this
			.closest(".tab-pane")
			.find(".component_type option[value="+tcDto.id+"]").prop("disabled", false);

			$tc
			.remove();

			return false;
		})
		.end();

		return $taskComponent;
	},
	build_task_component_saved: function(component, type){
		switch(type){
			case "equipment":
			case "labour":
				return $('<p class="task-component well">'+component.name+' <a href="" class="remove pull-right ptn pbn pln prn"><i class="fa fa-trash-o"></i></a></p>');
			break;

			case "product":
				return $('<p class="task-component well">'+component.name+' | '+component.amount+' '+component.uom+' <a href="" class="remove pull-right ptn pbn pln prn"><i class="fa fa-trash-o"></i></a></p>');
			break;
		}

	},
	update_activity_cost: function(index){
		console.log("update_activity_cost", index);
		var activityCost = 0;
		var task_list = plenty_admin.UI.add_template_plan.taskListHolder.find(".activity_tasks_"+index);
		console.log("task_list", task_list);

		task_list
		.find(".task")
		.each(function(){
			console.log("task", $(this));
			activityCost += $(this).data("taskCost");
		});

		plenty_admin.UI.add_template_plan.activityListHolder
		.find(".activity_"+task_list.data("index"))
		.data("activityCost", activityCost)
		.find(".activityCost")
		.text(numeral(activityCost).format('$0,0.00'));

		//update the total plan cost
		plenty_admin.UI.add_template_plan.update_plan_cost();
	},
	update_plan_cost: function(){
		var planCost = 0;
		plenty_admin.UI.add_template_plan.activityListHolder
		.find(".activity")
		.each(function(){
			planCost += ($(this).data("activityCost") ? $(this).data("activityCost") : 0);
		});

		plenty_admin.UI.add_template_plan.activityListHolder
		.parent()
		.find(".plan_total")
		.text(numeral(planCost).format('$0,0.00'));
	},
	build_task_element: function(taskDto){
		console.log("build_task_element", taskDto);
		var $taskDOM = $([
			'<li class="list-group-item overflowFix reveal-on-hover-wrap task open">',
				'<div class="col-md-12">',
					'<h4 class="pull-left col-md-6 prn pln"><a class="pull-left pln twistie" href=""><span class="glyphicon glyphicon-triangle-right"></span><span class="glyphicon glyphicon-triangle-bottom"></span></a>'+taskDto.name+'</h4>',
					'<h4 class="pull-left col-md-3">+'+taskDto.daysFromActivityStart+' days</h4>',
					'<h4 class="col-md-3 prn text-right"><span class="task-cost">$00.00</span></h4>',
					'<p class="reveal-on-hover-element text-right fix-right-controls" role="group" aria-label="...">',
						'<button class="btn btn-sm btn-danger reveal-on-hover-element delete-task"><span class="fa fa-trash-o"></span> <span class="hidden-xs">Delete</span></button>',
						'<button type="button" class="btn btn-sm btn-primary edit-task mls"><span class="glyphicon glyphicon-edit"></span> <span class="hidden-xs">Edit</span></button>',
					'</p>',
				'</div>',
				'<div class="col-md-12 task-components">',
					'<div class="col-md-12 clear equipment prn pln">',
						'<p class="mbn"><b>Equipment</b></p>',
					'</div>',
					'<div class="col-md-12 labour prn pln">',
						'<p class="mbn"><b>Labour</b></p>',
					'</div>',
					'<div class="col-md-12 product prn pln">',
						'<p class="mbn"><b>Product</b></p>',
					'</div>',
				'</div>',
			'</li>'
		].join(""))
		.data("taskDto", taskDto);

		//calculate the costs for this task
		plenty_admin.REST.plans.getCostForTemplateTask(taskDto, $taskDOM, function(taskCosts, $el){
			console.log("got costs for task: ", taskCosts, $el);
			$el
			.data("taskCost", taskCosts)
			.find(".task-cost")
			.text(numeral(taskCosts).format('$0,0.00'));

			plenty_admin.UI.add_template_plan.update_activity_cost($el.closest(".task_list").data("index"));
		});

		//build equipment taskItems
		for(var e=0; e<taskDto.equipmentIds.length; e++){
			var equip = taskDto.equipmentIds[e];
			var componentData = {name: plenty_admin.DATA.equipmentTypes[equip].name};
			$equipment_task_item = plenty_admin.UI.add_template_plan.build_task_component_saved(componentData, "equipment");

			$equipment_task_item
			.data("id", equip)
			.data("type", "equipmentIds")
			.find("a.remove")
			.click(function(){
				var $this = $(this);
				var taskComponent = $this.parent();
				var idList = $this.closest(".task").data("taskDto")[taskComponent.data("type")];
				console.log("idList", idList);
				var index = -1;
				for(var i=0; i<idList.length; i++){
					if(parseInt(taskComponent.data("id")) === idList[i]){
						index = i;
					}
					break;
				}

				console.log("index", index);

				if(index >= -1){
					idList.splice(index, 1);
				}

				$(this)
				.closest("p")
				.remove();

				//calculate the costs for this task
				plenty_admin.REST.plans.getCostForTemplateTask(taskDto, $taskDOM, function(taskCosts, $el){
					console.log("got costs for task: ", taskCosts, $el);
					$el
					.data("taskCost", taskCosts)
					.find(".task-cost")
					.text(numeral(taskCosts).format('$0,0.00'));

					plenty_admin.UI.add_template_plan.update_activity_cost($el.closest(".task_list").data("index"));
				});

				return false;
			})
			.end();

			$taskDOM
			.find(".equipment")
			.append($equipment_task_item);
		}

		//build specific equipment taskItems
		for(var e=0; e<taskDto.anySpecificEquipmentIds.length; e++){
			var equip = taskDto.anySpecificEquipmentIds[e];
			var componentData = {name: plenty_admin.DATA.equipmentEquipmentTypes[equip].equipmentName};
			$equipment_task_item = plenty_admin.UI.add_template_plan.build_task_component_saved(componentData, "equipment");

			$equipment_task_item
			.data("id", equip)
			.data("type", "anySpecificEquipmentIds")
			.find("a.remove")
			.click(function(){
				$(this)
				.closest("p")
				.remove();

				//calculate the costs for this task
				plenty_admin.REST.plans.getCostForTemplateTask(taskDto, $taskDOM, function(taskCosts, $el){
					console.log("got costs for task: ", taskCosts, $el);
					$el
					.data("taskCost", taskCosts)
					.find(".task-cost")
					.text(numeral(taskCosts).format('$0,0.00'));

					plenty_admin.UI.add_template_plan.update_activity_cost($el.closest(".task_list").data("index"));
				});

				return false;
			});

			$taskDOM
			.find(".equipment")
			.append($equipment_task_item);
		}

		//build labour taskItems
		for(var e=0; e<taskDto.labourIds.length; e++){
			var labour = taskDto.labourIds[e];
			var componentData = {name: plenty_admin.DATA.labourTypes[labour].name};
			$labour_task_item = plenty_admin.UI.add_template_plan.build_task_component_saved(componentData, "labour");
			$labour_task_item
			.data("id", labour)
			.data("type", "labourIds")
			.find("a.remove")
			.click(function(){
				var $this = $(this);
				var taskComponent = $this.parent();
				var idList = $this.closest(".task").data("taskDto")[taskComponent.data("type")];
				console.log("idList", idList);
				var index = -1;
				for(var i=0; i<idList.length; i++){
					if(parseInt(taskComponent.data("id")) === idList[i]){
						index = i;
					}
					break;
				}

				console.log("index", index);

				if(index >= -1){
					idList.splice(index, 1);
				}

				$(this)
				.closest("p")
				.remove();

				//calculate the costs for this task
				plenty_admin.REST.plans.getCostForTemplateTask(taskDto, $taskDOM, function(taskCosts, $el){
					console.log("got costs for task: ", taskCosts, $el);
					$el
					.data("taskCost", taskCosts)
					.find(".task-cost")
					.text(numeral(taskCosts).format('$0,0.00'));

					plenty_admin.UI.add_template_plan.update_activity_cost($el.closest(".task_list").data("index"));
				});

				return false;
			});

			$taskDOM
			.find(".labour")
			.append($labour_task_item);
		}
		//build specific equipment taskItems
		for(var e=0; e<taskDto.anySpecificLabourIds.length; e++){
			var labour = taskDto.anySpecificLabourIds[e];
			var componentData = {name: plenty_admin.DATA.current_organization.skillsAndRates[labour].userFirstAndLastName};
			$labour_task_item = plenty_admin.UI.add_template_plan.build_task_component_saved(componentData, "labour");

			$labour_task_item
			.data("id", labour)
			.data("type", "labourIds")
			.find("a.remove")
			.click(function(){
				var $this = $(this);
				var taskComponent = $this.parent();
				var idList = $this.closest(".task").data("taskDto")[taskComponent.data("type")];
				console.log("idList", idList);
				var index = -1;
				for(var i=0; i<idList.length; i++){
					if(parseInt(taskComponent.data("id")) === idList[i]){
						index = i;
					}
					break;
				}

				console.log("index", index);

				if(index >= -1){
					idList.splice(index, 1);
				}

				$(this)
				.closest("p")
				.remove();

				//calculate the costs for this task
				plenty_admin.REST.plans.getCostForTemplateTask(taskDto, $taskDOM, function(taskCosts, $el){
					console.log("got costs for task: ", taskCosts, $el);
					$el
					.data("taskCost", taskCosts)
					.find(".task-cost")
					.text(numeral(taskCosts).format('$0,0.00'));

					plenty_admin.UI.add_template_plan.update_activity_cost($el.closest(".task_list").data("index"));
				});

				return false;
			});

			$taskDOM
			.find(".labour")
			.append($labour_task_item);
		}

		//build product taskItems
		for(var e=0; e<taskDto.productAmountPairs.length; e++){
			var prod = taskDto.productAmountPairs[e];
			var componentData = {
									name: plenty_admin.DATA.productTypes[prod.productTypeId].name,
									amount: prod.amount,
									uom: plenty_admin.DATA.productTypes[prod.productTypeId].unitName
								};

			if(taskDto.anySpecificProductIds.length > 0){
				for(var p=0; p<taskDto.anySpecificProductIds.length; p++){
					var specProd = taskDto.anySpecificProductIds[p];
					console.log("specProd", specProd, plenty_admin.DATA.allProducts[specProd], prod);
					if(plenty_admin.DATA.allProducts[specProd].productTypeId === prod.productTypeId){
						componentData.name += " ("+plenty_admin.DATA.allProducts[specProd].productName+")";
					}
				}
			}

			$product_task_item = plenty_admin.UI.add_template_plan.build_task_component_saved(componentData, "product");

			$product_task_item
			.data("id", prod)
			.data("type", "productAmountPairs")
			.find("a.remove")
			.click(function(){
				var $this = $(this);
				var taskComponent = $this.parent();
				var idList = $this.closest(".task").data("taskDto")[taskComponent.data("type")];
				console.log("idList", idList);
				var index = -1;
				for(var i=0; i<idList.length; i++){
					if(parseInt(taskComponent.data("id").productTypeId) === idList[i]){
						index = i;
					}
					break;
				}

				console.log("index", index);

				if(index >= -1){
					idList.splice(index, 1);
				}

				$(this)
				.closest("p")
				.remove();

				//calculate the costs for this task
				plenty_admin.REST.plans.getCostForTemplateTask(taskDto, $taskDOM, function(taskCosts, $el){
					console.log("got costs for task: ", taskCosts, $el);
					$el
					.data("taskCost", taskCosts)
					.find(".task-cost")
					.text(numeral(taskCosts).format('$0,0.00'));

					plenty_admin.UI.add_template_plan.update_activity_cost($el.closest(".task_list").data("index"));
				});

				return false;
			});

			$taskDOM
			.find(".product")
			.append($product_task_item);
		}

		$taskDOM
		.find("button.delete-task")
		.click(function(){
			var allTasks = plenty_admin.UI.add_template_plan.taskListHolder
			.find("ul.task_list li.task");

			var index = $(this).closest(".task_list").data("index");

			$taskDOM
			.remove();

			plenty_admin.UI.add_template_plan.update_activity_cost(index);

			return false;
		})
		.end()
		.find("button.edit-task")
		.click(function(){
			plenty_admin.UI.add_template_plan.edit_task($(this).closest(".task"));
			return false;
		})
		.end()
		.find(".twistie")
		.click(function(){
			$taskDOM
			.find(".task-components")
			.slideToggle("fast");

			if($taskDOM.hasClass("open")){
				$taskDOM.removeClass("open");
			}else{
				$taskDOM.addClass("open");
			}

			return false;
		})
		.end()

		var selectedActivityIndex = plenty_admin.UI.add_template_plan.activityListHolder.find(".activity.active").data("index");
		plenty_admin.UI.add_template_plan.taskListHolder
		.find("ul.task_list")
		.hide();

		plenty_admin.UI.add_template_plan.taskListHolder
		.find("ul.task_list.activity_tasks_"+selectedActivityIndex)
		.append($taskDOM)
		.show();
	},
	clear_add_activity_form: function(){
		plenty_admin.UI.add_template_plan.addActivityForm
		.find("select option:eq(0)").prop("selected", true)
		.end()
		.find("input").each(function(){
			if($(this).data("default") !== "undefined"){
				if($(this).prop("type") === "number"){
					$(this).val(parseInt($(this).data("default")));
				}else{
					$(this).val($(this).data("default"));
				}
			}else{
				$(this).val("");
			}
		});
	},
	clear_add_task_form: function(){
		plenty_admin.UI.add_template_plan.addTaskAndTaskComponents
		.find("input")
		.each(function(){
			if($(this).data("default") !== "undefined"){
				if($(this).prop("type") === "number"){
					$(this).val(parseInt($(this).data("default")));
				}else{
					$(this).val($(this).data("default"));
				}
			}else{
				$(this).val("");
			}
		})
		.end()
		.find("table.task-items tbody tr")
		.remove()
		.end()
		.parent()
		.find("select :nth-child(0)")
		.prop("selected", true)
		.end()
		.find("select option:gt(0)")
		.prop("disabled", false)
		.end()
		.find("select.specific_items, .uom")
		.hide();
	},
	edit_activity: function($activity){
		console.log("edit_activity", $activity);
		var dto = $activity.data("activityDto");
		plenty_admin.UI.add_template_plan.addActivityBtn
		.hide();

		plenty_admin.UI.add_template_plan.addActivityForm
		.find(".save_activity")
		.hide()
		.end()
		.find(".update_activity")
		.data("activity", $activity)
		.show()
		.end()
		.find("#add_activity_type option[value="+dto.activityTypeId+"]")
		.prop("selected", true)
		.end()
		.find("#add_activity_days_from_planting")
		.val(dto.daysFromPlanting)
		.end()
		.slideDown("fast");
	},
	edit_task: function($task){
		console.log("edit_task", $task);
		var dto = $task.data("taskDto");

		$task.addClass("active");

		//render the task components
		plenty_admin.UI.add_template_plan.addTaskAndTaskComponents
		.find("#add_task_name")
		.val(dto.name)
		.end()
		.find("#add_task_days_from_start")
		.val(dto.daysFromActivityStart)
		.end()
		.find("button.save_task")
		.hide()
		.end()
		.find("button.update_task")
		.data("task", $task)
		.show();

		//loop dto and add task components to the table
		for(prop in dto){
			if(dto.hasOwnProperty(prop)){
				//we are only processing the arrays in this DTO
				if(Array.isArray(dto[prop])){
					var lcProp = prop.toLowerCase();
					var type = null;
					var specific = false;

					if(lcProp.indexOf("equipment") > -1){
						type = "equipment";
					}else if(lcProp.indexOf("labour") > -1){
						type = "labour";
					}else if(lcProp.indexOf("product") > -1){
						type = "product";
					}

					if(lcProp.indexOf("specific") > -1){
						specific = true;
					}

					var $task_items_table = plenty_admin.UI.add_template_plan.addTaskAndTaskComponents.find(".tab-pane#"+type+"_tab table."+type+"-items");

					for(var p=0; p<dto[prop].length; p++){
						//skip rendering specific products separately
						if(type == "product" && specific){
							continue;
						}

						var tc = dto[prop][p];
						//create the task item
						//console.log("typeof tc: ", typeof tc);
						if(typeof tc === "object"){
							var task_component = {
								id: 		tc.productTypeId,
								qty: 	tc.amount
							};
							if(specific){
								task_component.specificId = tc.productTypeId;
							}
						}else if(typeof tc === "number"){
							var task_component = {
								id: 		tc,
								qty: 	1 // NOTE - these should also be type/amount pairs as we do not currently have a record of how many labourers / equipments
							};
							if(specific){
								task_component.specificId = tc;
							}
						}
						var $taskComponent = plenty_admin.UI.add_template_plan.build_task_component(task_component, type);
						$task_items_table.append($taskComponent);
					}
				}
			}
		}

		//hide the add task button
		plenty_admin.UI.add_template_plan.addTaskBtn
		.slideUp("fast");

		//show the add task form immediately
		plenty_admin.UI.add_template_plan.addTaskAndTaskComponents
		.slideDown("fast");

		//minimise all current tasks
		plenty_admin.UI.add_template_plan.minimise_all_tasks();
	},
	order_activities_by_days_from_planting: function(){
		plenty_admin.UI.add_template_plan.activityListHolder
		.find(".activity")
		.sort(sort_activities)
		.appendTo(plenty_admin.UI.add_template_plan.activityListHolder);

		function sort_activities(a, b){
			return ($(b).data('activityDto').daysFromPlanting) < ($(a).data('activityDto').daysFromPlanting) ? 1 : -1;
		}
	},
	order_tasks_by_days_from_activity_start: function(task_list){
		task_list
		.find(".task")
		.sort(sort_tasks)
		.appendTo(task_list);

		function sort_tasks(a, b){
			return ($(b).data('taskDto').daysFromActivityStart) < ($(a).data('taskDto').daysFromActivityStart) ? 1 : -1;
		}
	},
	build_activity_element: function(activityDto, index){
		console.log("build_activity_element", activityDto);
		var $activityDOM = $([
			'<li class="list-group-item reveal-on-hover-wrap active activity col-md-12">',
				'<div class="help-block alert alert-danger error mtn mbs" style="display:none;"',
					'<h3>This activity has no tasks associated with it.</h3>',
					'<p>Either add tasks to it or remove this activity.</p>',
				'</div>',
				'<h4 class="mtn mbn">',
					'<a href="" class="overflowFix">',
						'<span class="col-md-6 pln prn">'+plenty_admin.DATA.activityTypes[activityDto.activityTypeId].name+'</span>',
						'<span class="col-md-3">'+(activityDto.daysFromPlanting >= 0 ? "+" : "")+activityDto.daysFromPlanting+' days</span>',
						'<span class="col-md-3 activityCost prn text-right">$00.00</span>',
						'<span class="reveal-on-hover-element fix-right-controls">',
							'<button class="btn btn-danger btn-sm delete-activity"><span class="fa fa-trash-o"></span> <span class="hidden-xs">Delete</span></button>',
							'<button type="button" class="btn btn-sm btn-primary edit-activity mls"><span class="glyphicon glyphicon-edit"></span> <span class="hidden-xs">Edit</span></button>',
						'</span>',
					'</a>',
				'</h4>',
			'</li>'
		].join(""))
		.data("activityDto", activityDto)
		.find("a")
		.click(function(){
			var selectedActivityIndex = $(this).closest("li").data("index");
			var allActivityTaskContainers = plenty_admin.UI.add_template_plan.taskListHolder.find("ul.task_list");
			var activityTasksContainer = plenty_admin.UI.add_template_plan.taskListHolder.find("ul.task_list.activity_tasks_"+selectedActivityIndex);
			var activityTasks = activityTasksContainer.find(".task");

			//hide all task containers
			allActivityTaskContainers
			.hide();

			//show the task container for this activity
			activityTasksContainer
			.show();

			if(activityTasks.length > 0){
				//hide the add task form
				plenty_admin.UI.add_template_plan.addTaskAndTaskComponents
				.slideUp("fast");

				//show the tasks for this activity
				plenty_admin.UI.add_template_plan.addTaskBtn
				.slideDown("fast");

			}else{
				//hide the add task button
				plenty_admin.UI.add_template_plan.addTaskBtn
				.slideUp("fast");

				//show the add task form immediately
				plenty_admin.UI.add_template_plan.addTaskAndTaskComponents
				.slideDown("fast");
			}

			plenty_admin.UI.add_template_plan.activityListHolder
			.find("li.list-group-item.active")
			.removeClass("active");

			$(this)
			.closest(".activity")
			.addClass("active");

			return false;
		})
		.end()
		.find("button.delete-activity")
		.click(function(){
			plenty_admin.UI.add_template_plan.taskListHolder.find(".task_list.list-group.activity_tasks_"+$activityDOM.data("index"))
			.remove();

			$(this)
			.closest("li")
			.remove();

			if($(this).closest(".activities_management").find("li.activity").length <= 0){
				plenty_admin.UI.add_template_plan
				.modal
				.find(".noActivityForTasks")
				.slideDown("fast");

				//hide the add task form immediately
				plenty_admin.UI.add_template_plan.addTaskAndTaskComponents
				.slideUp("fast");

				plenty_admin.UI.add_template_plan.addTaskBtn
				.slideUp("fast");
			}

			//update the total plan cost
			plenty_admin.UI.add_template_plan.update_plan_cost();

			return false;
		})
		.end()
		.find("button.edit-activity")
		.click(function(){
			plenty_admin.UI.add_template_plan.edit_activity($(this).closest(".activity"));
		})
		.end();

		//add the activity element to the DOM
		plenty_admin.UI.add_template_plan.activityListHolder
		.find("li.list-group-item.active")
		.removeClass("active")
		.end()
		.append($activityDOM);

		$activityDOM
		.data("index", (index != undefined ? index : $activityDOM.index()))
		.addClass("activity_" + (index != undefined ? index : $activityDOM.index()));

		//create a task container for this activity element
		if(plenty_admin.UI.add_template_plan.taskListHolder.find(".task_list.list-group.activity_tasks_"+$activityDOM.data("index")).length == 0){
			var taskList = $('<ul class="task_list list-group activity_tasks_'+$activityDOM.data("index")+' mbn" style="display:none;"></ul>');
			taskList.data("index", $activityDOM.data("index"));

			plenty_admin.UI.add_template_plan.taskListHolder
			.append(taskList);
		}
	}
};

plenty_admin.UI.add_template_plan.activityListHolder = plenty_admin.UI.add_template_plan.modal.find(".activities_management .activity_list");
plenty_admin.UI.add_template_plan.addActivityForm = plenty_admin.UI.add_template_plan.modal.find("form.add_activity_form");
plenty_admin.UI.add_template_plan.addActivityBtn = plenty_admin.UI.add_template_plan.modal.find("button.add_activity");

plenty_admin.UI.add_template_plan.taskListHolder = plenty_admin.UI.add_template_plan.modal.find(".tasks_management .task_lists");
plenty_admin.UI.add_template_plan.addTaskForm = plenty_admin.UI.add_template_plan.modal.find("form.add_task_form");
plenty_admin.UI.add_template_plan.addTaskAndTaskComponents = plenty_admin.UI.add_template_plan.modal.find(".add_task_and_task_components");
plenty_admin.UI.add_template_plan.addTaskBtn = plenty_admin.UI.add_template_plan.modal.find("button.add_task");


text:
package de.intarsys.cwt.font.truetype;

import java.io.IOException;
import java.util.Arrays;
import java.util.Map;

import de.intarsys.cwt.font.FontStyle;
import de.intarsys.tools.locator.ILocator;
import de.intarsys.tools.randomaccess.IRandomAccess;
import de.intarsys.tools.stream.StreamTools;
import de.intarsys.tools.string.StringTools;

/**
 * This class represents a true type font. Currently only single font files are
 * supported.
 * <p>
 * This class is under construction and not meant for a complete TT
 * implementation.
 */
public class TTFont {
	public static final int ARG_1_AND_2_ARE_WORDS = 1;

	public static final int MORE_COMPONENTS = 32;

	public static final int SFNT_TRUETYPE = 0x00010000;

	public static final byte[] TABLE_CMAP = "cmap".getBytes(); //$NON-NLS-1$

	public static final byte[] TABLE_CVT = "cvt ".getBytes(); //$NON-NLS-1$

	public static final byte[] TABLE_FGPM = "fpgm".getBytes(); //$NON-NLS-1$

	public static final byte[] TABLE_GLYF = "glyf".getBytes(); //$NON-NLS-1$

	public static final byte[] TABLE_HEAD = "head".getBytes(); //$NON-NLS-1$

	public static final byte[] TABLE_HHEA = "hhea".getBytes(); //$NON-NLS-1$

	public static final byte[] TABLE_HMTX = "hmtx".getBytes(); //$NON-NLS-1$

	public static final byte[] TABLE_LOCA = "loca".getBytes(); //$NON-NLS-1$

	public static final byte[] TABLE_MAXP = "maxp".getBytes(); //$NON-NLS-1$

	public static final byte[] TABLE_NAME = "name".getBytes(); //$NON-NLS-1$

	public static final byte[] TABLE_OS2 = "OS/2".getBytes(); //$NON-NLS-1$

	public static final byte[] TABLE_POST = "post".getBytes();//$NON-NLS-1$

	public static final byte[] TABLE_PREP = "prep".getBytes(); //$NON-NLS-1$

	public static final int WE_HAVE_A_SCALE = 8;

	public static final int WE_HAVE_A_TWO_BY_TWO = 128;

	public static final int WE_HAVE_AN_X_AND_Y_SCALE = 64;

	static public int align(int newLength) {
		return (newLength + 3) & (~3);
	}

	public static TTFont createFromLocator(ILocator locator) throws IOException {
		TTFont result = new TTFont();
		result.setLocator(locator);
		result.initializeFromLocator();
		return result;
	}

	/** objectified versions of the "cmap" tables and subtables */
	private Map cmaps;

	// Font names in Postscript notation
	private String fontFamilyName = null;

	/** "objectified" version of the "head" table */
	private TTFontHeader fontHeader;

	/** The style of this font */
	private FontStyle fontStyle = FontStyle.REGULAR;

	/** objectified version of the "hmtx" table */
	private int[] glyphWidths;

	/** objectified version of the "hhea" table */
	private TTHorizontalHeader horizontalHeader;

	private ILocator locator;

	/** objectified version of the "os/2" table */
	private TTMetrics metrics;

	/** objectified version of the "naming" table */
	private TTNaming naming;

	/** objectified versions of the "post" table */
	private TTPostScriptInformation postScriptInformation;

	private String psName = null;

	private int sfntVersion;

	/** the parsed table directory information */
	private TTTable[] tables;

	/**
	 * Create an empty true type font.
	 */
	protected TTFont() {
		super();
	}

	public Map getCMaps() throws TrueTypeException {
		if (cmaps == null) {
			TTFontParser parser = new TTFontParser();

			try {
				cmaps = parser.parseTable_cmap(getTable(TABLE_CMAP));
			} catch (IOException e) {
				throw new TrueTypeException(e.getMessage());
			}
		}

		return cmaps;
	}

	public Map getCMapsAt(int platformID, int platformSpecificID)
			throws TrueTypeException {
		String key = StringTools.EMPTY + platformID + ":" + platformSpecificID; //$NON-NLS-1$
		Object result = getCMaps().get(key);

		if (result instanceof TTTable) {
			// not yet parsed
			TTFontParser parser = new TTFontParser();

			try {
				Map submap = parser.parseTable_cmap_subtable((TTTable) result);
				getCMaps().put(key, submap);
				result = submap;
			} catch (IOException e) {
				throw new TrueTypeException(e.getMessage());
			}
		}

		return (Map) result;
	}

	public String getFontFamilyName() {
		return fontFamilyName;
	}

	public TTFontHeader getFontHeader() throws TrueTypeException {
		if (fontHeader == null) {
			TTFontParser parser = new TTFontParser();

			try {
				fontHeader = parser.parseTable_head(getTable(TABLE_HEAD));
			} catch (IOException e) {
				throw new TrueTypeException(e.getMessage());
			}
		}

		return fontHeader;
	}

	/*
	 * (non-Javadoc)
	 *
	 * @see de.intarsys.font.IFont#getFontName()
	 */
	public String getFontName() {
		return getPsName();
	}

	public FontStyle getFontStyle() {
		return fontStyle;
	}

	public int getGlyphWidth(int codePoint) throws TrueTypeException {
		if (codePoint < getGlyphWidths().length) {
			return getGlyphWidths()[codePoint];
		}
		return getGlyphWidths()[getGlyphWidths().length - 1];
	}

	protected int[] getGlyphWidths() throws TrueTypeException {
		if (glyphWidths == null) {
			TTFontParser parser = new TTFontParser();

			try {
				glyphWidths = parser.parseTable_hmtx(getTable(TABLE_HMTX),
						getHorizontalHeader().getNumberOfHMetrics());
			} catch (IOException e) {
				throw new TrueTypeException(e.getMessage());
			}
		}

		return glyphWidths;
	}

	public TTHorizontalHeader getHorizontalHeader() throws TrueTypeException {
		if (horizontalHeader == null) {
			TTFontParser parser = new TTFontParser();

			try {
				horizontalHeader = parser.parseTable_hhea(getTable(TABLE_HHEA));
			} catch (IOException e) {
				throw new TrueTypeException(e.getMessage());
			}
		}

		return horizontalHeader;
	}

	public ILocator getLocator() {
		return locator;
	}

	public TTMetrics getMetrics() throws TrueTypeException {
		if (metrics == null) {
			TTFontParser parser = new TTFontParser();

			try {
				metrics = parser.parseTable_os2(getTable(TABLE_OS2));
			} catch (IOException e) {
				throw new TrueTypeException(e.getMessage());
			}
		}

		return metrics;
	}

	public TTNaming getNaming() throws TrueTypeException {
		if (naming == null) {
			TTFontParser parser = new TTFontParser();

			try {
				TTTable table = getTable(TABLE_NAME);
				if (table != null) {
					naming = parser.parseTable_name(table);
				}
			} catch (IOException e) {
				throw new TrueTypeException(e.getMessage());
			}
		}
		return naming;
	}

	public TTPostScriptInformation getPostScriptInformation()
			throws TrueTypeException {
		if (postScriptInformation == null) {
			TTFontParser parser = new TTFontParser();

			try {
				postScriptInformation = parser
						.parseTable_post(getTable(TABLE_POST));
			} catch (IOException e) {
				throw new TrueTypeException(e.getMessage());
			}
		}

		return postScriptInformation;
	}

	public String getPsName() {
		return psName;
	}

	public int getSfntVersion() {
		return sfntVersion;
	}

	public TTTable getTable(byte[] name) {
		for (int i = 0; i < getTables().length; i++) {
			TTTable current = tables[i];

			if (Arrays.equals(current.getName(), name)) {
				return current;
			}
		}

		return null;
	}

	public TTTable[] getTables() {
		return tables;
	}

	protected void initializeFromLocator() throws IOException {
		IRandomAccess random = null;
		try {
			random = getLocator().getRandomAccess();
			TTFontParser parser = new TTFontParser();
			parser.parseTables(this);
			try {
				setFontName(this);
			} catch (TrueTypeException e) {
				throw new IOException(e.getMessage());
			}

		} finally {
			StreamTools.close(random);
		}
	}

	public void removeCMapsAt(int platformID, int platformSpecificID)
			throws TrueTypeException, IOException {
		TTTable data = getTable(TTFont.TABLE_CMAP);
		if (data == null) {
			return;
		}
		IRandomAccess random = data.getRandomAccess();
		TTFontSerializer serializer = new TTFontSerializer();
		TTFontParser parser = new TTFontParser();
		try {
			random.seek(0);
			int version = parser.readShort(random);
			int count = parser.readUShort(random);
			int i = 0;
			long readPos = random.getOffset();
			long writePos = random.getOffset();
			while (i < count) {
				random.seek(readPos);
				int tempPlatformID = parser.readUShort(random);
				int tempPlatformSpecificID = parser.readUShort(random);
				int offset = parser.readInt(random);
				if (platformID != tempPlatformID
						|| platformSpecificID != tempPlatformSpecificID) {
					if (readPos != writePos) {
						random.seek(writePos);
						serializer.writeShort(random, tempPlatformID);
						serializer.writeShort(random, tempPlatformSpecificID);
						serializer.writeInt(random, offset);
					}
					writePos = writePos + 8;
				}
				readPos = readPos + 8;
				i++;
			}
			if (readPos != writePos) {
				// clear removed entry
				random.seek(writePos);
				serializer.writeShort(random, 0);
				serializer.writeShort(random, 0);
				serializer.writeInt(random, 0);
				//
				random.seek(0);
				// skip version
				random.seekBy(2);
				// decrement count
				serializer.writeShort(random, count - 1);
			}
		} finally {
			StreamTools.close(random);
		}
		cmaps = null;
	}

	protected void setFontFamilyName(String string) {
		fontFamilyName = string;
	}

	protected void setFontName(TTFont font) throws TrueTypeException {
		TTNaming tempNaming = font.getNaming();
		if (tempNaming != null) {
			font.setFontFamilyName(tempNaming
					.getValue(ITTNamingIDs.FontFamilyName));
			String styleName = tempNaming
					.getValue(ITTNamingIDs.FontSubfamilyName);
			font.setFontStyle(FontStyle.getFontStyle(styleName));
			font.setPsName(tempNaming.getValue(ITTNamingIDs.PSName));
			if (font.getPsName() == null) {
				// Here we should use operating system specific information
				// which can't be done by Java. So we use our own
				// implementation and hope we it works.
				// todo postscript name
				font.setPsName(font.getFontFamilyName() + "-" //$NON-NLS-1$
						+ font.getFontStyle().getId());
			}
		}
	}

	protected void setFontStyle(FontStyle fontStyle) {
		this.fontStyle = fontStyle;
	}

	protected void setLocator(ILocator locator) {
		this.locator = locator;
	}

	public void setPsName(String string) {
		psName = string;
	}

	protected void setSfntVersion(int sfntVersion) {
		// this is not true for all valid font files, skip version check
		// if (sfntVersion != SFNT_TRUETYPE) {
		// throw new IOException("not a valid TTF file.");
		// }

		this.sfntVersion = sfntVersion;
	}

	protected void setTables(TTTable[] tables) {
		this.tables = tables;
	}

}


text:
module Furnace::AVM2::ABC
  class AS3IncLocal < ArithmeticOpcode
    instruction 0x92
    write_barrier :local, :memory

    body do
      vuint30 :reg_index
    end

    consume 0
    produce 0

    type :number
  end
end


text: This is the repository of my project laboratory work in Spring framework.


text:
"""
 Write a script that uses Cloud DNS to create a
 new A record when passed a FQDN and IP address as arguments.
 *Worth 1 Point*
"""

from __future__ import print_function
import argparse
import pyrax
import re
import socket
from os.path import expanduser

def is_valid_ip(ip):
    """
     Returns true if the IP is valid
    """
    try:
        socket.inet_aton(ip)
        return True
    except socket.error:
        return False

def is_valid_hostname(hostname):
    """
     Returns true if the hostname is valid
    """
    if len(hostname) > 255:
        return False
    if hostname[-1:] == '.':
        # strip exactly one dot from the right, if present
        hostname = hostname[:-1]
    allowed = re.compile('(?!-)[A-Z\d-]{1,63}(?<!-)$', re.IGNORECASE)
    return all(allowed.match(x) for x in hostname.split('.'))

if __name__ == '__main__':
    parser = argparse.ArgumentParser(description='Builds servers')
    parser.add_argument('--verbose', '-v', action='store_true',
                        help='Turn up verbosity to 10')
    parser.add_argument('--veryverbose', action='store_true',
                        help='Turn up verbosity to 11')
    parser.add_argument('--hostname', '-n', required=True,
                        help='The base name for your instances')
    parser.add_argument('--address', '-a', required=True,
                        help='The base name for your instances')
    args = parser.parse_args()
    if args.veryverbose:
        args.verbose = True
        print(parser.parse_args())
    if not is_valid_hostname(args.hostname):
        print('You need to give me a valid hostname')
        exit()
    if not is_valid_ip(args.address):
        print('You need to give me a valid IP address')
        exit()
    dns_dict_list = [{'type': 'A',
                      'name': args.hostname,
                      'data': args.address}]
    pyrax.set_credential_file(expanduser("~/.rackspace_cloud_credentials"))
    dns = pyrax.cloud_dns
    dns.create(name=args.hostname,
               emailAddress='foo@bar.com',
               records=dns_dict_list)


text:
package org.androidtransfuse.gen.componentBuilder;

import com.sun.codemodel.JBlock;
import com.sun.codemodel.JClassAlreadyExistsException;
import com.sun.codemodel.JExpression;
import org.androidtransfuse.TransfuseAnalysisException;
import org.androidtransfuse.adapter.ASTMethod;
import org.androidtransfuse.experiment.ComponentBuilder;
import org.androidtransfuse.experiment.ComponentMethodGenerator;
import org.androidtransfuse.experiment.GenerationPhase;
import org.androidtransfuse.gen.InjectionFragmentGenerator;
import org.androidtransfuse.gen.InstantiationStrategyFactory;
import org.androidtransfuse.model.InjectionNode;
import org.androidtransfuse.model.InjectionNodeLogger;
import org.androidtransfuse.model.MethodDescriptor;
import org.androidtransfuse.model.TypedExpression;

import javax.inject.Inject;
import javax.inject.Named;
import java.util.Map;

/**
 * @author John Ericksen
 */
public class ViewRegistrationGenerator implements RegistrationGenerator {

    private final InjectionNode viewInjectionNode;
    private final String method;
    private final InjectionNode injectionNode;
    private final ViewRegistrationInvocationBuilder viewRegistrationInvocationBuilder;
    private final InjectionFragmentGenerator injectionFragmentGenerator;
    private final InstantiationStrategyFactory instantiationStrategyFactory;

    @Inject
    public ViewRegistrationGenerator(/*@Assisted("viewInjectionNode")*/ @Named("viewInjectionNode") InjectionNode viewInjectionNode,
                                     /*@Assisted*/ String method,
                                     /*@Assisted("targetInjectionNode")*/ @Named("targetInjectionNode") InjectionNode injectionNode,
                                     /*@Assisted*/ ViewRegistrationInvocationBuilder viewRegistrationInvocationBuilder,
                                     InjectionFragmentGenerator injectionFragmentGenerator,
                                     InstantiationStrategyFactory instantiationStrategyFactory) {
        this.viewInjectionNode = viewInjectionNode;
        this.method = method;
        this.injectionNode = injectionNode;
        this.viewRegistrationInvocationBuilder = viewRegistrationInvocationBuilder;
        this.injectionFragmentGenerator = injectionFragmentGenerator;
        this.instantiationStrategyFactory = instantiationStrategyFactory;
    }

    @Override
    public void build(final ComponentBuilder componentBuilder, ASTMethod creationMethod, final TypedExpression value) {

        componentBuilder.add(creationMethod, GenerationPhase.REGISTRATION, new ComponentMethodGenerator() {
            @Override
            public void generate(MethodDescriptor methodDescriptor, JBlock block) {
                try {
                    //todo: map scopes
                    Map<InjectionNode, TypedExpression> viewExpressionMap = injectionFragmentGenerator.buildFragment(block,
                            instantiationStrategyFactory.buildMethodStrategy(block, null), componentBuilder.getDefinedClass(), viewInjectionNode, null);

                    JExpression viewExpression = viewExpressionMap.get(viewInjectionNode).getExpression();

                    viewRegistrationInvocationBuilder.buildInvocation(componentBuilder.getDefinedClass(), block, value, viewExpression, method, injectionNode);

                } catch (JClassAlreadyExistsException e) {
                    throw new TransfuseAnalysisException("Class already exists", e);
                }
            }
        });
    }

    @Override
    public void log(InjectionNodeLogger logger) {
        logger.append("ViewRegistrationGenerator");
    }
}


text:
class SkImageFilter;

namespace blink {

// An ordered list of filter operations.
class PLATFORM_EXPORT CompositorFilterOperations {
    WTF_MAKE_NONCOPYABLE(CompositorFilterOperations);
public:
    CompositorFilterOperations();

    const cc::FilterOperations& asFilterOperations() const;

    void appendGrayscaleFilter(float amount);
    void appendSepiaFilter(float amount);
    void appendSaturateFilter(float amount);
    void appendHueRotateFilter(float amount);
    void appendInvertFilter(float amount);
    void appendBrightnessFilter(float amount);
    void appendContrastFilter(float amount);
    void appendOpacityFilter(float amount);
    void appendBlurFilter(float amount);
    void appendDropShadowFilter(IntPoint offset, float stdDeviation, Color);
    void appendColorMatrixFilter(SkScalar matrix[20]);
    void appendZoomFilter(float amount, int inset);
    void appendSaturatingBrightnessFilter(float amount);

    // This grabs a ref on the passed-in filter.
    void appendReferenceFilter(SkImageFilter*);

    void clear();
    bool isEmpty() const;

private:
    cc::FilterOperations m_filterOperations;
};

} // namespace blink

#endif // CompositorFilterOperations_h


text:
// Check that a node module exists, but treat it as external.
export default function () {
  return {
    name: 'node-external',
    resolveId(id) {
      try {
        require.resolve(id);
        return { id, external: true };
      } catch (err) {}
    },
  };
}


text:
package org.frozenarc.zeframework.model;

/**
 * The class is used with action or view.
 * When a view starts loading, it loads data into the models.
 * When a action starts handling, it populates request data into the models.
 * The model can be in one of theree type of scope (request, session, application).
 * @author Manan
 */
public interface Model {

    /**
     * The model can be in any scope, so request generation doesn't mean that new model.
     * So, when action request is generated the method will be called.
     * @param info Can be passed from jsp page via 'modelinfo' tag.
     */
    void actionInit(ModelInfo info);

    /**
     * The model can be in any scope, so request generation doesn't mean that new model.
     * So, when view request is generated the method will be called.
     */
    void viewInit();
}


text:
Meetup CSS SP
======

[Início](../README.md) > [Meetups](../meetups.md) > 10 de abril de 2015 - FastCommerce

## Meetup #07

* **Local:** Centro de Treinamento Novatec
* **Endereço:** Av. Cruzeiro do Sul, 2463
* **Patrocinadores:** [Centro de Treinamento Novatec](http://ctnovatec.com.br/) e [Conferência CSS Brasil](http://conferenciacssbrasil.com.br)
* **Participantes:** 50 pessoas
* **Fotos:** [Link](https://www.flickr.com/photos/raphaelfabeni/sets/72157651506731998/)
* **Link do Meetup:** [Link](http://www.meetup.com/CSS-SP/events/221348953/)
* **Vídeo:** Link em breve!

### Talks

| Talk                                             | Quem
| -----------------------------------------------  | ------------------------------------------------------------------
| [Papo de Dinossauro](http://pt.slideshare.net/Maujor/meetup-css-7-no-ctnovatec-sp)    | [Maujor](https://twitter.com/maujor)

Tem algum link relacionado ao tema ou que foi discutido no meetup? Abre um PR e adiciona aqui :heart_eyes:

* [Eric Meyer](http://meyerweb.com/)
  * [Twitter](https://twitter.com/meyerweb)
  * [Eric Meyer on CSS](http://www.ericmeyeroncss.com/)
* [Jeffrey Zeldman](http://www.zeldman.com/)
  * [Twitter](https://twitter.com/zeldman)
  * [A List Apart](http://alistapart.com/author/zeldman)