text:
// Avoid `console` errors in browsers that lack a console.
(function() {
    var method;
    var noop = function() {};
    var methods = [
        'assert', 'clear', 'count', 'debug', 'dir', 'dirxml', 'error',
        'exception', 'group', 'groupCollapsed', 'groupEnd', 'info', 'log',
        'markTimeline', 'profile', 'profileEnd', 'table', 'time', 'timeEnd',
        'timeStamp', 'trace', 'warn'
    ];
    var length = methods.length;
    var console = (window.console = window.console || {});

    while (length--) {
        method = methods[length];
        if (!console[method]) {
            console[method] = noop;
        }
    }
}());
// Utils object (by convention, referred to as u within banner);

var createUtils = function() {
    'use strict';

    var my = {};

    function curry(fx) {

      var arity = fx.length;
      console.log("currying arity",fx.length,arguments)

      return function f1() {
        var args = Array.prototype.slice.call(arguments, 0);
        if (args.length >= arity) {
            console.log("in f1",args.length,arity)
          return fx.apply(null, args);
        }
        else {
          return function f2() {
            var args2 = Array.prototype.slice.call(arguments, 0);
            return f1.apply(null, args.concat(args2));
          }
        }
      };
    }

    my.imageLoadCount = 0;

    my.retina = (window.retina || window.devicePixelRatio > 1);
    my.inPreview = function(){

        return (getParameterByName('inPreview') === 'true');
    }
    function getParameterByName(name) {
    name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
    var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
        results = regex.exec(location.search);
    return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
    }
    my.eliminateRedundantAssetsBasedOnDPI = function(allAssets) {
        var returnedAssets;
        if (my.retina) {
            returnedAssets = my.pruneDuplicatesIn(my.filterOnLabel(allAssets, '_1x', true), my.filterOnLabel(allAssets, '_1x', false));
        } else {
            returnedAssets = my.pruneDuplicatesIn(my.filterOnLabel(allAssets, '_1x', false), my.filterOnLabel(allAssets, '_1x', true));
        }
        return returnedAssets;
    }
    my.filterOnLabel = function(assets, str, useFilteredItems) {
        var returnedObject = {};
        for (var a in assets) {
            if (assets.hasOwnProperty(a)) {
                if (useFilteredItems && a.indexOf(str) !== -1) {
                    returnedObject[a.replace(str, '')] = assets[a];
                } else if (!useFilteredItems && a.indexOf(str) === -1) {
                    returnedObject[a] = assets[a];
                }
            }
        }
        return returnedObject;
    }

    my.uniqLabels = function(a, b) {
        return my.uniq(my.getAllLabels(a), my.getAllLabels(b));
    }
    my.uniq = function(a, b) {
        var ab = a.concat(b);
        var o = {},
            i, l = ab.length,
            r = [];
        for (i = 0; i < l; i += 1) o[ab[i]] = ab[i];
        for (i in o) r.push(o[i]);
        return r;
    }
    my.getAllLabels = function(obj) {
        var returnedArray = [];
        for (var i in obj) {
            if (obj.hasOwnProperty(i)) {
                returnedArray.push(i);
            }
        }
        return returnedArray;
    }
    my.pruneDuplicatesIn = function(objectToPrune, objectToLeave) {
        // if something exists in objectToLeave, use it first.
        // then copy anything left from objectToPrune
        var returnedAssets = {};
        my.uniqLabels(objectToPrune, objectToLeave).forEach(function(result) {
            if (objectToLeave.hasOwnProperty(result)) {
                returnedAssets[result] = objectToLeave[result];
            } else {
                returnedAssets[result] = objectToPrune[result];
            }
        });

        return returnedAssets;
    }
    my.removeAllChildren = function(el) {
            while (el.firstChild) {
                el.removeChild(el.firstChild);
            }
        }
        //This will echo how many seconds have passed
    my.returnTimer = function(initialTime) {
        var stopWatch = ((new Date().getTime()) - initialTime) * .001;
    }
    my.createListFunction = function(callback) {
        return function() {
            for (var i = 0; i < arguments.length; i++) {
                if (arguments[i]) {
                    callback(arguments[i], i);
                }
            }
        }
    }
    my.kill = my.createListFunction(function(result, i) {
        if (result.parentNode) {
            result.parentNode.removeChild(result);
        }
    })
    my.hide = my.createListFunction(function(result, i) {
        result.style.opacity = 0;
    });
    my.show = my.createListFunction(function(result, i) {
        result.style.opacity = 1;
    });

    my.appendChildrenTo = function(parentNode) {
        return this.createListFunction(function(result, i) {
            if (result) {
                parentNode.appendChild(result);
            } else {
                throw new Error(result + ' not an object');
            }
        });
    }
    my.makeSizedSprite = function(imgURL, x, y, w, h) {
        var div = this.makeSizedContainer(w + 1, h + 1);
        this.addSpriteToDiv(div, imgURL, x, y, w, h);
        return div;
    }

    my.addSpriteToDiv = function(div, imgURL, x, y, w, h) {
        div.style.backgroundRepeat = 'no-repeat';
        var urlString = "url(\"" + imgURL + "\")"
        var image = new Image();
        image.onload = this.decrementImageLoadCount.bind(this);
        this.incrementImageLoadCount();
        image.src = imgURL;
        div.style.backgroundImage = urlString;
        div.style.backgroundSize = my.pixify(w) + ' ' + my.pixify(h);
        div.style.left = my.pixify(x);
        div.style.top = my.pixify(y);
    }
    my.decrementImageLoadCount = function() {

        this.imageLoadCount--;

        if (this.imageLoadCount < 1) {
            this.publish('loaded');
        }
    }
    my.incrementImageLoadCount = function() {
        this.imageLoadCount++;
    }
    my.subscribe = function(ev, callback) {
        var calls = this._callbacks || (this._callbacks = {});
        (this._callbacks[ev] || (this._callbacks[ev] = [])).push(callback);

        return this;
    };

    my.publish = function() {
        var args = Array.prototype.slice.call(arguments, 0);

        var ev = args.shift();

        var list, calls, i, l;

        if (!(calls = this._callbacks)) return this;
        if (!(list = this._callbacks[ev])) return this;

        for (i = 0, l = list.length; i < l; i++)
            list[i].apply(this, args);

        return this;
    }
    my.containerize = function(listOfSprites, bbox) {

        var container = this.makeSizedContainer(bbox.width * bbox.multiplier, bbox.height * bbox.multiplier);

        container.style.left = my.pixify(bbox.x * bbox.multiplier);
        container.style.top = my.pixify(bbox.y * bbox.multiplier);

        listOfSprites.forEach(function(result) {
            my.clone(result.style, {
                left: 0,
                top: 0
            });
            container.appendChild(result);
        })

        return container;
    }
    my.makeSprite = curry(function(dimensions,img ) {
        img.bbox = img.bbox || {};
        img.bbox.multipler = img.bbox.multiplier || 1;
        img.bbox.x = img.bbox.x || 0;
        img.bbox.y = img.bbox.y || 0;
        img.bbox.width = img.bbox.width === undefined ? dimensions.width / img.bbox.multiplier : img.bbox.width;
        img.bbox.height = img.bbox.height === undefined ? dimensions.height / img.bbox.multiplier : img.bbox.height;
        return my.makeSizedSprite(img.uri, img.bbox.x * img.bbox.multiplier, img.bbox.y * img.bbox.multiplier, img.bbox.width * img.bbox.multiplier, img.bbox.height * img.bbox.multiplier);
    })

    my.makeContainer = curry(function(dimensions) {
        return my.makeSizedContainer(dimensions.width, dimensions.height);
    })
    my.makeSizedContainer = function(w, h) {
        var div = document.createElement("div");
        div.style.width = my.pixify(w);
        div.style.height = my.pixify(h);
        div.style.position = "absolute";
        div.style.overflow = "hidden";
        return div;
    }
    my.clone = function(target, obj) {

        for (var i in obj) {
            try {
                target[i] = obj[i];
            } catch (e) {
                throw new Error("Couldn't clone property",i)
            }

        }

    }
    my.extractSize = function(str) {
        var widthMatch = /width\=(\d+)/.exec(str);
        var heightMatch = /height\=(\d+)/.exec(str);
        return {
            width: parseInt(widthMatch[1]),
            height: parseInt(heightMatch[1])
        }
    }

    my.makeSplitSprite = curry(function(dimensions,img) {
        if (typeof(img) !== 'object') {

            throw new Error("Used URI instead of object in makeSplitSprite");

        }
        var imageObj = new Image();
        var returnedContainer = my.makeContainer(dimensions);
        imageObj.onload = my.splitImage(imageObj, img.bbox, returnedContainer).bind(this);
        my.incrementImageLoadCount();
        imageObj.src = img.uri;
        return returnedContainer;

    })

    my.splitImage = function(imageObj, bbox, returnedContainer) {
        var scope = this;
        return function splitImageInClosure() {
            scope.decrementImageLoadCount();
            var canvas = document.createElement('canvas');
            var context = canvas.getContext('2d');

            var imageWidth = canvas.width = imageObj.width;
            var imageHeight = canvas.height = imageObj.height;
            var imageX = 0,
                imageY = 0;
            context.drawImage(imageObj, 0, 0);

            var imageData = context.getImageData(imageX, imageY, imageWidth, imageHeight);
            var data = imageData.data;
            var inContent = false;
            var currentInd = 0;
            var sections = [];
            // sections[currentInd] = {inpoint: 0};
            // iterate over all pixels based on x and y coordinates; find in and out points
            for (var y = 0; y < imageHeight; y++) {
                // loop through each column
                var blankLine = true;

                for (var x = 0; x < imageWidth; x++) {
                    var prevLines = imageWidth * y;
                    var currentPixel = ((prevLines) + x) * 4;
                    /* for (var b = 0; b < 4; b++) {
                         images[currentInd].push(data[currentPixel + b]);
                     }*/
                    if (data[currentPixel + 3] > 0) {
                        blankLine = false;
                        break;
                    }

                }
                if (!blankLine && !inContent) {
                    inContent = true;
                    sections[currentInd] = {};
                    sections[currentInd].inpoint = y;

                } else if (blankLine && inContent) {
                    inContent = false;
                    sections[currentInd].outpoint = y;

                    currentInd++;
                }
            }
            //  sections[currentInd].outpoint = 0;

            if (sections.length === 1) {
                scope.addSpriteToDiv(returnedContainer, imageObj.src, bbox.x * bbox.multiplier, bbox.y * bbox.multiplier, bbox.width * bbox.multiplier, bbox.height * bbox.multiplier);

                //returnedContainer.appendChild(newsprite);

            } else {
                sections.forEach(function(result) {
                    if (result.inpoint !== undefined && result.outpoint !== undefined) {
                        scope.addArrayAsImage(data, result.inpoint, result.outpoint, imageWidth, imageHeight, bbox, returnedContainer)
                    }
                })
            }

        }

    }

    my.copyPixelsExpensively = function(dataIn, inIndex, outIndex, dataOut) {
        for (var i = inIndex; i < outIndex; i++) {
            dataOut[i - inIndex] = dataIn[i];
        }
    }

    my.addArrayAsImage = function(data, inY, outY, w, h, bbox, container) {
        var canvas = document.createElement('canvas');
        canvas.width = w;
        canvas.height = outY - inY;
        var ctx = canvas.getContext('2d');
        var imgData = ctx.createImageData(w, h);
        if (imgData.data.set && data.slice) {
            var pixelArray = data.slice(inY * w * 4, outY * w * 4);
            imgData.data.set(new Uint8ClampedArray(pixelArray));
        } else {
            my.copyPixelsExpensively(data, inY * w * 4, outY * w * 4, imgData.data);
        }
        ctx.putImageData(imgData, 0, 0);
        canvas.style.position = 'absolute';
        canvas.style.width = my.pixify(w * bbox.multiplier);
        canvas.style.height = my.pixify(bbox.multiplier * (outY - inY));
        canvas.style.top = my.pixify((bbox.y * bbox.multiplier) + (inY * bbox.multiplier));
        canvas.style.left = my.pixify(bbox.x * bbox.multiplier);
        container.appendChild(canvas);
    }
    my.pixify = function(n) {
        return Math.round(n) + 'px'
    }

    return my;
}


text: console.info("Thank you for your interest in this type of pricing :)");

redpajama_set_name: RedPajamaGithub


text:
package beginner.basics.beginner.streamsandcollections;

import beginner.basics.beginner.inheritance.Cat;
import beginner.basics.beginner.inheritance.Dog;
import beginner.basics.beginner.inheritance.Pet;
import org.assertj.core.api.Assertions;
import org.testng.annotations.Test;

import java.util.*;

/**
 * Created by michal on 14.06.2016.
 */
public class EqualsAndHashCode {

    // rules for implementing equals and hashCode methods:

    // equals is a
    // reflexive relation:
    //  a is equal to a
    // symmetric relation:
    //  a is equal to b, so b is equal to a
    // transitive relation:
    //  a is equal to b, b is equal to c so a is equal to c

    // hashcode is consistent with equal method
    // if a is equal to b then a.hashcode is equal to b.hashcode

    // it is very important to have correct equals and hashcode
    // for classes used in Set and as keys in Map

    @Test
    public void equalsByValue() throws Exception {

        // String have value equality semantic

        Set<String> pets = new HashSet<>();
        pets.add(new String("Bella"));
        pets.add(new String("Cody"));
        pets.add(new String("Cody")); // another dog called Cody

        for (String pet : pets) {
            System.out.println(pet);
        }
        Assertions.assertThat(pets).hasSize(2);
    }

    @Test
    public void defaultImplementations() throws Exception {

        // Default implementation from Object class
        // have reference equality semantic
        // object is equal only to itself

        Set<Pet> pets = new HashSet<>();
        pets.add(new Cat("Bella"));
        pets.add(new Dog("Cody"));
        pets.add(new Dog("Cody")); // another dog called Cody

        for (Pet pet : pets) {
            System.out.println(pet.getName());
        }
        Assertions.assertThat(pets).hasSize(3);
    }

    // other important thing is to make those classes immutable
    @Test
    public void mutableMapKeysProblem() throws Exception {

        // old mutable java.util.Date representation
        Date date20160615 = new Date(2016 - 1900, 6 - 1, 15);

        Map<Date, Pet> birthdays = new HashMap<>();
        birthdays.put(date20160615, new Dog("Spark"));

        // obviously it is there
        Assertions.assertThat(birthdays).containsKey(date20160615);

        // change value of year
        Date duplicate = date20160615;
        date20160615.setYear(2020 - 1900);
        // same date instance but internal state is changed
        Assertions.assertThat(date20160615).isSameAs(duplicate);

        // but we will not find it in map
        //Assertions.assertThat(birthdays).containsKey(date20160615);

        birthdays.put(date20160615, new Dog("Spark"));
        Assertions.assertThat(birthdays).containsKey(date20160615);
        Assertions.assertThat(birthdays).hasSize(2);
        System.out.println(birthdays);
    }
}


text:
\documentclass[11pt]{article}
\usepackage{html}
\usepackage{psfig}
\usepackage{nomencl}
\oddsidemargin  -0.1in   %  Note that \oddsidemargin = \evensidemargin
\evensidemargin -0.1in

%\topmargin -55pt         %    Nominal distance from top of page to top
%                         %    of box containing running head.
\headheight 12pt         %    Height of box containing running head.
%\headsep 25pt            %    Space between running head and text.
%\footskip 60pt           %    Distance from baseline of box containing

\textheight 9.125in        % Height of text (including footnotes and
                         % figures, excluding running head and foot).
\textwidth 6.75in         % Width of text line.
                         % For two-column mode:

\textheight 9.125in        % Height of text (including footnotes and
                         % figures, excluding running head and foot).
\textwidth 6.75in         % Width of text line.
                         % For two-column mode:
\renewcommand{\baselinestretch}{1.2}

\newcommand{\docroot}{tinyos-1.x}

\begin{latexonly}
\title{\vspace{2.5in} TinySchema: Managing Attributes, Commands and Events in TinyOS}
\end{latexonly}
\begin{htmlonly}
\title{TinySchema: Managing Attributes, Commands and Events in TinyOS}
\end{htmlonly}
\author{Wei Hong and Sam Madden \\
	whong@intel-research.net, madden@cs.berkeley.edu}
\date{}

\begin{document}
\pagenumbering{arabic}
%\pagestyle{myheadings}
\markright{{\bf TinySchema Documentation. }}

\maketitle
\begin{latexonly}
\vspace{2in}
\end{latexonly}
\begin{center}
Version 1.1 \\
September, 2003
\end{center}

\begin{latexonly}\newpage\end{latexonly}
\section{Introduction}

{\em TinySchema} is a collection of TinyOS components that manages
a small respository of named attributes, commands and events that can be
easily queried, invoked or signaled from inside or outside a mote network.
A TinySchema {\em attribute} is much like a column in a traditional database system.
It has a name and a type.  In addition, TinySchema allows you to
associate arbitrary TinyOS code to each attribute for getting
and setting the attribute value.  Once an attribute is created, it can
be retrieved or updated through a unified interface provided by TinySchema.
{\em TinyDB} (see TinyDB document), the in-network query
processing system for TinyOS, is one of the applications built on top
of this interface.  You can also build your own application for manipulating
attributes based on the interfaces provided by TinySchema.  Typically, there
are three classes of attributes:
\begin{itemize}
\item Sensor Attributes.  These can be raw readings from sensors such as
temperature and photo sensors, accelerometers, magnetometers, etc.
They can also be computed sensor values after applying some calibration
or signal processing logic.
\item Introspective Attributes.  These are values from internal
software or hardware states, e.g., software version stamp, parent node
in routing tree, battery voltage, etc.  They are very useful for
monitoring the health and statistics of a mote network.
\item Constant Attributes.  These are constant values assigned to
a mote at programming time or run time, e.g., node id, group id, name,
location, etc.
\end{itemize}

A TinySchema {\em command} is much like a stored procedure in a traditional
database system.  It consists of a name, a list of arguments and a return
type.  You can associate arbitrary TinyOS code to each command.
TinySchema provides a unified interface for invoking these commands.
TinyDB is also built on top of the TinySchema command interfaces for
its trigger actions (see TinyDB document).  Typically, there are two
classes of commands:
\begin{itemize}
\item Actuation Command.  These are commands that cause some physical
actions on a mote, e.g., rebooting a mote, flash LEDs, sound buzzer,
raise a blind (when connected to an appropriate actuator), etc.
\item Tuning Command.  These are commands that adjust internal parameters,
e.g., routing policy, number of retransmissions, sample rate, etc.
\end{itemize}

A TinySchema {\em event} is introduced to capture asynchronous
events in sensor networks, e.g., detection of a bird, push of a button, etc.
TinySchema provides interfaces for registering and invoking events as well
as associating TinySchema commands with events as callbacks when events
are signaled.

Currently all attributes and all commands must be staticly built
into each mote.  We plan to integrate with the virtual machines being
developed for the TinyOS such as Mate and Mottle to allow dynamic
creation of attributes and commands.

TinySchema is part of TinyOS1.1 release.

\section{System Overview}

TinySchema has three separate components in {\tt \docroot/tos/lib/Attributes/Attr.nc},
{\tt \docroot/tos/lib/Commands/Command.nc}
and {\tt \docroot/tos/lib/Events/Event.nc}.
{\em Attr} provides all attributes
related interfaces, {\em Command} provides all command related interfaces,
and {\em Event} provides all event related interfaces.

{\em Attr} provides the following interfaces:
\begin{itemize}
\item {\tt StdControl} for initialization.
\item {\tt AttrRegister} for creating new attributes.  It is parametrized
by a {\tt uint8\_t} (for up to 256 such interfaces).  Each non-constant attribute must be
connected to one of these interfaces.  The coding convention is not
to hardwire a specific number when you wire to one these 256 interfaces, but
to wire your interface to {\tt Attr.Attr[unique("Attr")]} and let
the NesC compiler to automatically choose a unique number for you.
\item {\tt AttrRegisterConst} for creating new constant attributes.  It is a
simplified interface of AttrRegister for attributes associated to
constant values only.
\item {\tt AttrUse} for discovering and using attributes.
\end{itemize}

{\em Command} provides the following interfaces:
\begin{itemize}
\item {\tt StdControl} for initialization.
\item {\tt CommandRegister} for creating new commands.  It is parametrized
by a {\tt uint8\_t} (for up to 256 such interfaces).  Each command must be connected to
one of these interfaces.  The coding convention is not
to hardwire a specific number when you wire to one these 256 interfaces, but
to wire your interface to {\tt Command.Cmd[unique("Command")]} and let
the NesC compiler to automatically choose a unique number for you.
\item {\tt CommandUse} for discovering and using commands.
\end{itemize}

{\em Event} provides the following interfaces:
\begin{itemize}
\item {\tt StdControl} for initialization.
\item {\tt EventRegister} for creating new events.
\item {\tt EventUse} for discovering and signaling events as well as
creating command callbacks to events.
\end{itemize}

We will describe each of the above interfaces in details in the next
section.

\section{Detailed Interface Descriptions}

\subsection{Data Types and Error Codes}
All of TinySchema's data types and error codes are defined in
{\tt \docroot/tos/interfaces/SchemaTypes.h}.

The following data types are supported:
\begin{itemize}
\item {\tt VOID}: the void type.  Used for defining commands that do not
return anything.
\item {\tt INT8 and UINT8}: 8-bit signed and unsigned integer types.
\item {\tt INT16 and UINT16}: 16-bit signed and unsigned integer types.
\item {\tt INT32 and UINT32}: 32-bit signed and unsigned integer types.
\item {\tt TIMESTAMP}: not yet supported.
\item {\tt STRING}: null-terminated ASCII strings.
\item {\tt COMPLEX\_TYPE}: not yet supported.
\end{itemize}

Here are the error codes used in all TinySchema interfaces:
\begin{itemize}
\item {\tt SCHEMA\_SUCCESS}: success!
\item {\tt SCHEMA\_ERROR}: something is wrong.
\item {\tt SCHEMA\_RESULT\_READY}: the return result is ready in the result
buffer.  Used for non-split-phase attributes and commands.
\item {\tt SCHEMA\_RESULT\_NULL}: the return result is null.
\item {\tt SCHEMA\_RESULT\_PENDING}: the return result is not yet filled in in the
result buffer.  Must wait for the data ready event.  Used for split-phase
attributes and commands.
\end{itemize}

\subsection{Attribute Related Interfaces}

\subsubsection{Attribute Data Structures}

All attribute related data structures are defined in
{\tt \docroot/tos/interfaces/Attr.h}.  The main data
structure is {\tt AttrDesc} which contains the definition
of each attribute.  {\tt AttrDescs} is just an array of
{\tt AttrDesc}'s for all the attributes defined in each mote.
You must pay attention to the constants defined at the beginning of the
file which defines the maximum number of attributes, maximum
attribute name length, etc.  Do not exceed those limits!  Increase
them as needed, but they cost more precious RAM space on a mote.

\subsubsection{AttrRegister}

\noindent{\tt command result\_t registerAttr(char *name, TOSType attrType, uint8\_t attrLen)}

This is the command you call to register an attribute.  The {\tt attrLen}
argument is only relevant to variable-length types such as STRING.
It is ignored for fixed-length types.

\noindent{\tt event result\_t getAttr(char *name, char *resultBuf, SchemaErrorNo *errorNo)}

This is the TinyOS code that you must provide for getting the value of the
attribute you just registered through {\tt registerAttr}.  {\tt name} is
the name of the attribute.  It is mostly redundent, but may come in handy
if you want to write one piece of code that supports mulitple attributes.
{\tt resultBuf} is a pointer to a pre-allocated buffer to hold the
value of this attribute.  You can assume
that enough space has been allocated to hold the value of this
attribute.  {\tt errorNo} is the return error code.  You are required
to do one of the following in {\tt getAttr}:
\begin{itemize}
\item fill in the attribute value in {\tt resultBuf} and set
{\tt *errorNo} to {\tt SCHEMA\_RESULT\_READY},
\item or set {\tt *errorNo} to
{\tt SCHEMA\_RESULT\_PENDING} and fill in {\tt resultBuf} later when the
data is ready and call {\tt getAttrDone},
\item or set {\tt *errorNo} to {\tt SCHEMA\_RESULT\_NULL},
\item or set {\tt *errorNo} to {\tt SCHEMA\_RESULT\_ERROR}.
\end{itemize}

\noindent{\tt event result\_t setAttr(char *name, char *attrVal)}

This is the TinyOS code that you must provide for setting the value of
the attribute you just registered through {\tt registerAttr}.
{\tt name} is
the name of the attribute.  It is mostly redundent, but may come in handy
if you want to write one piece of code that supports multiple attributes.
{\tt attrVal} is a pointer to a value of the same type as the attribute type.
NULL pointer means a null value.  If the value of this attribute cannot be set,
simply return {\tt FAIL}.

\noindent{\tt command result\_t getAttrDone(char *name, char *resultBuf, SchemaErrorNo errorNo)}

This is the command you must call for split-phase attributes.  In this case,
the {\tt getAttr} will initiate a split-phase operation, set {\tt *errorNo} to
{\tt SCHEMA\_RESULT\_PENDING} then return.  In the split-phase completion event
(e.g. {\tt ADC.dataReady()}), you must call this command with the attribute
value filled in {\tt resultBuf}.

\subsubsection{AttrRegisterConst}

\noindent{\tt command result\_t registerAttr(char *name, TOSType attrType, char *attrVal)}

This command provides a simplified way to associate a constant value to an
attribute without having to write the {\tt getAttr} and {\tt setAttr} code
as described above in the {\tt AttrRegister} interface.  {\tt attrVal} points
to a value of the {\tt attrType} type.  The {\tt Attr}
component preallocates space to hold values for a fixed number
({\tt MAX\_CONST\_ATTRS} defined in {\tt \docroot/tos/interfaces/Attr.h})
of constant attributes.  This command assigns a slot in the preallocated
space to hold the constant value at {\tt attrVal}.  The {\tt AttrUse}
interface to be described below will automatically handle the get and set
of the newly defined constant attributes just like any other attributes.
Currently, a constant attribute can be at most 4 bytes long.

\subsubsection{AttrUse}
\label{sec:attruse}

\noindent{\tt command AttrDescPtr getAttr(char *name)}

This command returns a pointer to the attribute descriptor
for the attribute with a name that matches the argument.
The name is case-insensitive.
NULL will be returned if the attribute does not exist.
The returned attribute descriptor is NOT to be freed.

\noindent{\tt command AttrDescPtr getAttrById(uint8\_t attrIdx)}

This command returns a pointer to the attribute descriptor
corresponding to an attribute index.

\noindent{\tt command uint8\_t numAttrs()}

This command returns the total number of attributes that have been registered.

\noindent{\tt command AttrDescsPtr getAttrs()}

This command returns the array of attribute descriptors for all the
the attributes that have been registered.

\noindent{\tt command result\_t getAttrValue(char *name, char *resultBuf, SchemaErorNo *errorNo)}

This is the command retrieves the value of an attribute by name.
{\tt name} is the name of the attribute.  {\tt resultBuf} is a pointer to
a preallocated buffer to hold the attribute value.  It must be at least
as big as the attribute length.  {\tt errorNo} is a return parameter of
the error code.  It has the following cases:
\begin{itemize}
\item {\tt SCHEMA\_RESULT\_READY}.  This means
that the value of the attribute has already been copied into {\tt resultBuf}.
This is not a split-phase attribute.
\item {\tt SCHEMA\_RESULT\_PENDING}.  This means that
the attribute value is not ready.  It will be ready when the
{\tt getAttrDone} event is signaled.  This is a split-phase attribute.
\item {\tt SCHEMA\_RESULT\_NULL}.  The value of this attribute is null.
\item {\tt SCHEMA\_RESULT\_ERROR}.  Something is wrong.
\end{itemize}

\noindent{\tt command result\_t setAttrValue(char *name, char *attrVal)}

This command sets the value of an attribute by name.  {\tt name} is the attribute name.  {\tt attrVal} is a pointer to a value of the same type as the
attribute.  This command will return FAIL if the attribute cannot be set.

\noindent{\tt event result\_t getAttrDone(char *name, char *resultBuf, SchemaErrorNo errorNo)}

This event will be signaled after a {\tt getAttrValue} command is called on
a split-phase attribute when the value of the attribute is ready.
By this time, the value of the attribute is already copied into resultBuf.
{\tt errorNo} are the same as described for {\tt getAttrValue}.

\noindent{\tt command result\_t startAttr(uint8\_t id)}

This command is called to start or restart the attribute with attribute id
{\tt id}.  It is typically
called after a mote wakes up after a sleep period for turning on
the corresponding
sensor associated with an attribute.

\noindent{\tt event result\_t startAttrDone(uint8\_t id)}

This event will be signaled after a {\tt startAttr} command is called
when the sensor associated with the attribute is ready for use.
{\tt getAttrValue} must not be called before this event is signaled.

\subsection{Command Related Interfaces}
\subsubsection{Command Data Structures}

All command related data structures are defined in
{\tt \docroot/tos/interfaces/Command.h}.
It defines the following important data structures:
\begin{itemize}
\item {\tt CommandDesc} is for a command descriptor.
\item {\tt CommandDescs} is for an array of command descriptors.
\item {\tt ParamList} is a list of parameter types used in command definitions.
There is a convinient varg function {\tt setParamList} to
populate a {\tt ParamList} with a list of types.
\item {\tt ParamVals} is a a list of parameter values for command invocation.
\end{itemize}

You must pay attention to the constants defined at the beginning
of {\tt Command.h} for the current limitations such as maximum number of
parameters in a command, maximum number of commands and maximum number of
characters in a command name.  These limits must be observed or extended
at the cost of more RAM consumption.

\subsubsection{CommandRegister}

\noindent{\tt command result\_t registerCommand(char *name, TOSType retType, uint8\_t retLen, ParamList *paramList)}

This NesC command registers a new TinySchema command.  {\tt name} is the
name of the command.  {\tt retType} is the return type of the command.
Use the {\tt VOID} type if the command does not return any value.
{\tt retLen} is the maximum length for the return value
for any variable length types such as {\tt STRING}.
It is ignored for fixed-length types.
{\tt paramList} is the list of parameter types that this
command expects when invoked.

\noindent{\tt event result\_t commandFunc(char *commandName, char *resultBuf, SchemaErrorNo *errorNo, ParamVals *params)}

This is the TinyOS code you provide that implements the command
that you just registered through {\tt registerCommand}.
{\tt commandName} is the name of the command.  It is mostly redundant, but may
come in handy when you want to write one piece of code to implement
multiple commands.  {\tt resultBuf} is a pointer to the preallocated buffer
this command's return value is supposed to be copied into.
{\tt errorNo} is the return parameter for error code.  {\tt params} is
the list of parameter values for the current invocation.
You are required to do one of the following in {\tt commandFunc}:
\begin{itemize}
\item Non-split-phase return.  Copy the return value to resultBuf,
set {\tt *errorNo}
to {\tt SCHEMA\_RESULT\_READY} or {\tt SCHEMA\_RESULT\_NULL} then return.
\item Split-phase return.  Initiate the split-phase operation,
set {\tt *errorNo}
to {\tt SCHEMA\_RESULT\_PENDING} then return.
{\tt commandDone} must be called
from the split-phase completion event.
\item Error.  Set {\tt *errorNo} to {\tt SCHEMA\_RESULT\_ERROR} then return.
\end{itemize}

\noindent{\tt command result\_t commandDone(char *commandName, char *resultBuf, SchemaErrorNo errorNo)}

This NesC command must be called in the split-phase completion event if
{\tt commandFunc} returns an error code of {\tt SCHEMA\_RESULT\_PENDING}.
{\tt commandName} is the command name.  {\tt resultBuf} is a pointer to
a buffer the return value is supposed to be copied into.
{\tt errorNo} is the error code.

\subsubsection{CommandUse}

\noindent{\tt command CommandDescPtr getCommand(char *name)}

This NesC command looks up a TinySchema command descriptor by name.  The name
is case-insensitive.  NULL is returned
if the command does not exist.

\noindent{\tt command CommandDescPtr getCommandById(uint8\_t idx)}

This NesC command looks up a TinySchema command descriptor by index.

\noindent{\tt command uint8\_t numCommands()}

This NesC command returns the total number of TinySchema commands
currently registered.

\noindent{\tt command CommandDescsPtr getCommands()}

This NesC command returns an array of command descriptors for all
the currently registered TinySchema commands.

\noindent{\tt command result\_t invoke(char *commandName, char *resultBuf, SchemaErrorNo *errorNo, ParamVals *params)}

This NesC command is for invoking a TinySchema command.  {\tt commandName} is
the name of the TinySchema command.  {\tt resultBuf} is a pointer to
the buffer the return value is supposed to be copied into.  {\tt errorNo} is
the return parameter for error code.  {\tt ParamVals} is the
list of parameter values to be passed into this TinySchema command.
See the description of {\tt getAttrValue} in Section~\ref{sec:attruse}
for all the error codes you should handle.

\noindent{\tt command result\_t invokeMsg(TOS\_MsgPtr msg, char *resultBuf, SchemaErrorNo *errorNo)}

This NesC command is a wrapper over {\tt invoke}.  It first parses the
{\tt TOS\_Msg} into a command name and a list of parameter values then calls
{\tt invoke}.  {\tt msg.data} is expected to start with the null-terminated
string for command name followed by the list of parameter values tightly
packed one after the other.  This NesC command is introduced for
supporting remote invocation of TinySchema commands via the radio.

\noindent{\tt event result\_t commandDone(char *commandName, char *resultBuf, SchemaErrorNo errorNo)}

This is the event you are supposed to implement to handle split-phase
command completion.  See the description for {\tt getAttrDone} event
in Section~\ref{sec:attruse}.

\subsection{Event Related Interfaces}
\subsubsection{Event Data Structures}

All event related data structures are defined in
{\tt \docroot/tos/interfaces/Event.h}.
It defines the following important data structures:
\begin{itemize}
\item {\tt EventDesc} is for a command descriptor.
\item {\tt EventDescs} is for an array of command descriptors.
\item {\tt EventInstance} represents an instance of an event that is signaled
\item {\tt EventQueue} is a queue of {\tt EventInstance}'s.
\end{itemize}

\subsubsection{EventRegister}

\noindent{\tt command result\_t registerEvent(char *name, ParamList *paramList)}

This NesC command registers a new TinySchema event.  {\tt name} is the
name of the command.
{\tt paramList} is the list of parameter types that this
event will be signaled with.

\noindent{\tt command result\_t deleteEvent(char *name)}

This NesC command deletes a registered event.

\subsubsection{EventUse}

\noindent{\tt command EventDescPtr getEvent(char *name)}

This NesC command looks up a TinySchema event descriptor by name.  The name
is case-insensitive.  NULL is returned
if the event does not exist.

\noindent{\tt command EventDescPtr getEventById(uint8\_t idx)}

This NesC command looks up a TinySchema event descriptor by index.

\noindent{\tt command EventDescsPtr getEvents()}

This NesC command returns an array of event descriptors for all
the currently registered TinySchema events.

\noindent{\tt command result\_t signalEvent(char *eventName, ParamVals *params)}

This NesC command is for signaling a TinySchema event.  {\tt eventName} is
the name of the TinySchema event.
{\tt ParamVals} is the
list of parameter values to be passed into this TinySchema event.

\noindent{\tt command result\_t signalEventMsg(TOS\_MsgPtr msg)}

This NesC command is a wrapper over {\tt signalEvent}.  It first parses the
{\tt TOS\_Msg} into a event name and a list of parameter values then calls
{\tt signalEvent}.  {\tt msg.data} is expected to start with the null-terminated
string for command name followed by the list of parameter values tightly
packed one after the other.  This NesC command is introduced for
supporting remote signaling of TinySchema events via the radio.

\noindent{\tt command result\_t registerEventCallback(char *eventName, char *cmdName)}

This NesC command registers an event interest by associating a TinySchema
command to a TinySchema event.  The TinySchema command will be
invoked when the TinySchema event is signaled.  The maximum number
of TinySchema commands that can be associated with each event is
defined in Event.h.

\noindent{\tt event result\_t eventDone(char *name, SchemaErrorNo errorNo)}

This NesC event is signaled upon completion of all the commands
associated with the event.

\section{Examples}

Directories {\tt \docroot/tos/lib/Attributes} and
{\tt \docroot/tos/lib/Commands}
contain all the ready-to-use components that implements
the most common attributes and commands.
These are also the attributes and commands that are built into TinyDB.
They also serve as examples of TinySchema attribute and
command implementations.
The following is the list of files in these two directories and the
corresponding attributes and commands that they implement.  If you want to
use any of these predefined attributes or commands in your application,
simply wire the {\tt StdControl} interface of these components to
{\tt Main.StdControl} and the attributes or commands will be automatically
registered and ready to use.

\begin{itemize}
\item {\tt \docroot/tos/lib/Attributes/}
\begin{itemize}
\item {\tt \{AttrAccel,AttrAccelM\}.nc} defines two attributes: {\em accel\_x}
and {\em accel\_y} for the raw accelerometer readings in the X and Y axis
respectively.
\item {\tt \{AttrGlobal,AttrGlobalM\}.nc} defines two attributes: {\em nodeid}
and {\em group} for the node id and group id respectively.
\item {\tt \{AttrMag,AttrMagM\}.nc} defines two attributes: {\em mag\_x}
and {\em mag\_y}.  They are maximum magnetometer readings in the X or Y axis
at 32 samples/second since the last time you get their values.  At the same
time, they also automatically adjust the X and Y potentiometers
of the magnetometer to keep the readings centered and avoid railing.
These two attributes are designed for detecting moving magnetic fields.
For example, they are used in the car tracking demo in TinyDB in which
the car (with a magnet) is detected by a mote based on spikes in
the values of these two attributes.
\item {\tt \{AttrMic,AttrMicM\}.nc} defines four attributes: {\em rawmic},
{\em noise}, {\em rawtone} and {\em tones}.  {\em rawmic} is the raw
microphone ADC reading.  {\em noise} is the maximum microphone reading
at 32 samples/second since last time the attribute is read.  {\em rawtone}
returns 1 if a sounder tone is detected, 0 otherwise.  {\em tones} returns
the total number of tones detected at 32 samples/second since the last
time this attribute is read.
\item {\tt \{AttrPhoto,AttrPhotoM\}.nc} defines the {\em light} attribute.
It returns the raw ADC reading from the photo sensor.
\item {\tt \{AttrPot,AttrPotM\}.nc} defines the {\em pot} attribute.  It
returns the current potentiometer setting (transmit power).
This attribute can also be set.
\item {\tt \{AttrTemp,AttrTempM\}.nc} defines the {\em temp} attribute.  It
returns the raw temperature sensor reading.
\item {\tt \{AttrVoltage,AttrVoltageM\}.nc} defines the {\em voltage} attribute.
It returns the ADC reading for the current battery voltage.  It is an indicator
of how much battery power is remaining.
\end{itemize}
\item {\tt \docroot/tos/lib/Commands/}
\begin{itemize}
\item {\tt \{CommandLeds,CommandLedsM\}.nc} defines three commands:
{\em SetLedR(UINT8)}, {\em SetLedG(UINT8)} and {\em SetLedY(UINT8)}.
They control the Red, Green and Yellow LEDs on a mote respectively.
An argument of 0 means turning the LED off, 1 means on and 2 means toggle.
All three commands return VOID.
\item {\tt \{CommandPot,CommandPotM\}.nc} defines the {\em SetPot(UINT8)}
command.  It sets the potentiometer value (transmit power) on a mote.
\item {\tt \{CommandReset,CommandResetM\}.nc} defines the dangerous
{\em reset} command.  It reboots a mote.
\item {\tt \{CommandSounder,CommandSounderM\}.nc} defines the
{\em SetSnd(INT16)} command.  It turns on the buzzer for
a period specified by the argument (in milliseconds).
\item {\tt \{CommandAttr,CommandAttrM\}.nc} defines the
{\em addattr(STRING, UINT8, UINT32)} command.  It dynamically
registers a new constant attribute.  The first argument is the
name of the attribute.  The second argument is the type id for the
attribute as defined in {\tt \docroot/tos/interfaces/SchemaType.h}.
The third argument is the constant value to be associated with the
attribute.
\end{itemize}
\end{itemize}

\end{document}


text:
(function() {
"use strict";
angular.module('mjv')
.controller('HomeCtrl', function ($scope, $timeout, $http, $state, $cookies, $location, Upload) {

    var url = $location.url();
    if(url === '/')
        $state.go('home.knowledgeportal');
    $scope.HeaderItems = [{
                    name: "Knowledge Portal",

                    link: "home.knowledgeportal"

                },
                {
                    name: "Wonders Of JRG",

                    link: "home.wondersofjrg"},
            {
                    name: "Need Help",

                    link: "home.needhelp"},
            {
                    name: "Donations",

                    link: "home.donations"}];

            if($cookies.get('token') && $cookies.get('token') !==''){
                 $http.get("../MJV_SERVICES/services/services.php?q=getUserProfile").then(function(response){
                     console.log(response);
                    $scope.user = response.data;
                });
                 $http.defaults.headers.common.Authorization = $cookies.get('token');

            }
            $('.sec-list-view').on('click','li',function(){
             $('.sec-list-view li').removeClass('active-link');
                $(this).addClass('active-link');

            });
     $scope.slides = [
                     {image: './uploads/Gallery/IMG-20160327-WA0000.jpg', description: 'Image 00'},
                     {image: './uploads/Gallery/IMG-20160327-WA0001.jpg', description: 'Image 04'},
                     {image: './uploads/Gallery/IMG-20160327-WA0005.jpg', description: 'Image 01'},
                     {image: './uploads/Gallery/IMG-20160327-WA0007.jpg', description: 'Image 02'},
                     {image: './uploads/Gallery/IMG-20160327-WA0008.jpg', description: 'Image 03'}

                 ];
             $scope.setCurrentSlideIndex = function (index) {
                $scope.currentIndex = index;
            };

            $scope.isCurrentSlideIndex = function (index) {
                return $scope.currentIndex === index;
            };

            $scope.prevSlide = function () {
                $scope.currentIndex = ($scope.currentIndex < $scope.slides.length - 1) ? ++$scope.currentIndex : 0;
            };

            $scope.nextSlide = function () {
                $scope.currentIndex = ($scope.currentIndex > 0) ? --$scope.currentIndex : $scope.slides.length - 1;
            };

            var slidesInSlideshow = 4;
            var slidesTimeIntervalInMs = 3000;

            $scope.slideshow = 1;
            var slideTimer =
                    $timeout(function interval() {

                        $scope.prevSlide();
                        $scope.slideshow = ($scope.slideshow % slidesInSlideshow) + 1;
                        slideTimer = $timeout(interval, slidesTimeIntervalInMs);
                    }, slidesTimeIntervalInMs);
//    $http({ method: 'GET',
//  url: 'http://192.168.1.7/MJV_Service/services/getportaldetails.php'
//}).then(function(response) {
//    console.log(response);
//},function errorCallback(response) {
//console.log(response);
//    // called asynchronously if an error occurs
//    // or server returns response with an error status.
//  });
            $scope.user = {name: '', emailId: '', roles: []};
            $scope.contributions = [
                {id: 1, label: 'General Updates'},
                {id: 2, label: 'Health & Welfare'},
                {id: 3, label: 'Career & Education'},
                {id: 4, label: 'Social & Security'},
                {id: 5, label: 'Art & Culture'},
                {id: 6, label: 'Women welfare'}
            ];
            $scope.idProofOptions = [
                {id: 1, label: 'Aadhar Card'},
                {id: 2, label: 'Electoral Id'},
                {id: 3, label: 'Pan Card'},
                {id: 4, label: 'Passport'},
                {id: 5, label: 'Driving License'},
                {id: 6, label: 'Others'}
            ];
            $scope.idProofSelect = function (options) {

                if (options.id === 6) {
                    $scope.lIdProofName = 1;
                    $scope.user.idProofName = '';
                }
                else {
                    $scope.lIdProofName = 0;
                    $scope.user.idProofName = options.label;
                }
            }
            $scope.saveUser = function (user) {

                // $scope.master = angular.copy(user);
                console.log($scope.user);
                $scope.uploadFile($scope.user.fileToUpload);
            };
            $scope.selectImg = 'Select Image';

            $scope.uploadImg = function(file){
                console.log(file);

                angular.element('.imgT').show();
                $scope.imgPic = file.$ngfBlobUrl;
                var name = file.name;
                $scope.selectImg = name;

            };

            $scope.uploadFile = function (file) {
                Upload.upload({
                    url: '../MJV_SERVICES/services/fileuploadservice.php?q=user',
                    data: {file: file, 'userDeatils': $scope.user}
                }).then(function (resp) {
                    angular.element('body').append('
Success! Save Successfully...
');
                    angular.element('#dismissModal').trigger('click');
                    console.log('Success ' + resp.config.data.file.name + 'uploaded. Response: ' + resp.data);
                }, function (resp) {
                    console.log('Error status: ' + resp.status);
                }, function (evt) {
                    var progressPercentage = parseInt(100.0 * evt.loaded / evt.total);
                    console.log('progress: ' + progressPercentage + '% ' + evt.config.data.file.name);
                });
            };

if(url.search("knowledgeportal") > -1 )
    $scope.HeaderItems[0].class = "active-link";
if(url.search("needhelp") > -1 )
$scope.HeaderItems[2].class = "active-link";

if(url.search("donations") > -1 )
    $scope.HeaderItems[3].class = "active-link";
if(url.search("wondersofjrg") > -1 )
    $scope.HeaderItems[1].class = "active-link";

        });
})();


text:
@interface PodsDummy_Pods_VendingMachine : NSObject
@end
@implementation PodsDummy_Pods_VendingMachine
@end


text:
package org.bulldog.core.gpio.base;

import org.bulldog.core.Signal;
import org.bulldog.core.gpio.DigitalOutput;
import org.bulldog.core.gpio.Pin;
import org.bulldog.core.gpio.util.Blinker;

public abstract class AbstractDigitalOutput extends AbstractPinFeature implements DigitalOutput {

	private static final String NAME_FORMAT = "Digital Output - Signal '%s' on Pin %s";

	private Signal signal = Signal.Low;
	private Blinker blinker;

	public AbstractDigitalOutput(Pin pin) {
		super(pin);
		blinker = new Blinker(this);
	}

	public String getName() {
		return String.format(NAME_FORMAT, signal, getPin().getName());
	}

	public void write(Signal signal) {
		applySignal(signal);
	}

	public void applySignal(Signal signal) {
		this.signal = signal;
		applySignalImpl(this.signal);
	}

	public void high() {
		applySignal(Signal.High);
	}

	public void low() {
		applySignal(Signal.Low);
	}

	public boolean isHigh() {
		return signal == Signal.High;
	}

	public boolean isLow() {
		return signal == Signal.Low;
	}

	public void toggle() {
		applySignal(signal.inverse());
	}

	public Signal getAppliedSignal() {
		return signal;
	}

	public void startBlinking(int periodMilliseconds) {
		blinker.startBlinking(periodMilliseconds);
	}

	public void startBlinking(int periodMilliseconds, int durationMilliseconds) {
		blinker.startBlinking(periodMilliseconds, durationMilliseconds);
	}

	public void stopBlinking() {
		blinker.stopBlinking();
	}

	public void blinkTimes(int periodMilliseconds, int times) {
		blinker.blinkTimes(periodMilliseconds, times);
	}

	public boolean isBlinking() {
		return blinker.isBlinking();
	}

	public void awaitBlinkingStopped() {
		blinker.awaitBlinkingStopped();
	}

	protected abstract void applySignalImpl(Signal signal);
}


text:
<?php

namespace Phorms;

class Element_Select_Option {
  var $value, $caption, $group;

  function __construct($value, $caption, $group=null) {
    $this->value = $value;
    $this->caption = $caption;
    $this->group = $group;
  }
}

class Element_Select extends Control {
  protected $_options = array();

  // is this a 'multiple' style dropdown?
  protected $_multiple = False;
  // what should the list size be set to
  protected $_size = NULL;
  // prefix printed before control
  protected $_prefix = '';
  // suffix printed before control
  protected $_suffix = '';
  // allow the select box to be empty
  protected $_allow_empty = False;

  /**
   * Settings for when data is posted from external sources
   **/
  // letters to trim off entries
  protected $_trim = NULL;
  // may any alternative values be submitted?
  protected $_alternatives = array();
  // is the dropdown case sensitive
  protected $_case = True;

  static function countOptionLines($options) {
    $last_group = NULL;
    $lines = 0;
    foreach ($options as $option) {
      if ($option->group && $option->group != $last_group) {
        $last_group = $option->group;
        $lines++;
      }
      $lines++;
    }
    return $lines;
  }

  static function renderOptions($options, $default=null, $multiple=False) {
    $output = '';
    $last_group = NULL;
    foreach ($options as $key => $option) {
      if ($option->group && $option->group != $last_group) {
        if ($last_group) $output .= '</optgroup>'."\n";
        $output .= '<optgroup label="'.Html::encode($option->group).'">'."\n";
        $last_group = $option->group;
      }

      // is this option selected?
      $selected = NULL;
      if ($multiple) {
        // Do not use type sensitive in_array, due to php int=>str in array keys
        $selected = ($default && in_array($option->value, $default));
      } else {
        $selected = ($default == $option->value);
      }

      $output .= '<option'.Html::attributes(array(
        'value'=>$option->value,
        'selected'=>$selected?'selected':NULL
      )).'>'.Html::encode($option->caption).'</option>'."\n";
    }
    if ($last_group) $output .= '</optgroup>'."\n";

    return $output;
  }

  // Format a value according to the current options
  function formatValue($value) {
    foreach ($this->options as $option) {
      if (isset($option['key']) && $option['key'] == $value) {
        if (isset($option['caption'])) return $option['caption'];
      }
    }

    return parent::formatValue($value);
  }

  // Override setProperties and convert ->options to objects
	function setProperties($data) {
    if (isset($data['options'])) {
      $options = [];

      foreach ($data['options'] as $key => $option) {
        if (!$option instanceof Element_Select_Option) {
          if (is_string($option)) {
            $option = new Element_Select_Option($key, $option);
          }elseif (is_array($option)) {
            $value = isset($option['value']) ? $option['value'] : $key;
            $caption = isset($option['caption']) ? $option['caption'] : NULL;
            $group = isset($option['group']) ? $option['group'] : NULL;

            // Pull normal indexed options for caption / group
            $index = 0;
            if ($caption === null && isset($option[$index])) $caption = $option[$index++];
            if ($group === null   && isset($option[$index])) $group   = $option[$index++];

            $option = new Element_Select_Option($value, $caption, $group);
          }
        }
        $options[] = $option;
      }

			$data['options'] = $options;
		}

		parent::setProperties($data);

    if ($this->multiple && substr($this->name, -2) == '[]') {
      throw new Exception('Select boxes of type \'multiple\' are automatically named as arrays');
    }
	}

  function getAttributes($value, $prefix='') {
    return array(
      'name'=>$prefix.$this->name.($this->multiple?'[]':''),
      'id'=>$prefix.$this->id,
      'class'=> $this->class,
      'multiple' => $this->multiple,
      'disabled' => $this->disabled,
      'size' => $this->multiple ? ($this->size ?: min(5, self::countOptionLines($this->options))) : NULL,
    );
  }

  /***
   * Converts a value to match the correct case / alternative
   **/
  function convertValue($value) {
    // Without any options no conversion required
    if (!$this->options) {
      return $value;
    }

    if ($value === NULL && !$this->multiple && !$this->optional) {
      $value = $this->options[0]->key;
    }

    if ($this->trim) {
      $value = trim($value, $this->trim);
    }

		if ($value && !$this->case && $this->options) {
      foreach ($this->options as $option) {
        if (strcasecmp(ARR($option, 'key'), $value) == 0) {
          $value = ARR($option, 'key');
        }
      }
		}
		if ($this->alternatives) {
			$cmp = !$this->case ? 'strcasecmp' : 'strcmp';
			foreach ($this->alternatives as $v=>$aka) {
				if ($cmp($v, $value) == 0) { $value = $aka; break; }
			}
		}

    // All dashes is equivalent to empty (for required fields)
    if (!$this->multiple) {
      if ($this->optional && $value === NULL) {
        return NULL;
      }elseif (trim($value) == str_repeat('-', strlen(trim($value)))) {
        return '';
      }
    }

    return $value;
  }

	function getValue($values) {
		$value = parent::getValue($values);

    if ($this->multiple && !$value) {
      $value = array();
    }

    // Deal with repeat control results
    if (is_array($value)) {
      foreach ($value as $k => $v) {
        $value[$k] = $this->convertValue($v);
      }
      return $value;
    }else{
      return $this->convertValue($value);
    }
	}

	function validate($value) {

    // Pick a comparison function
    $cmpfn = $this->case ? 'strcmp' : 'strcasecmp';

    foreach ($this->options as $option) {
      if ($cmpfn($option->value, $value) == 0) {
        return parent::validate($value);
      }
    }

    if ($this->alternatives) {
      foreach ($this->alternatives as $alternative=>$aka) {
        if ($cmpfn($value, $alternative) == 0) {
          return self::validate($aka);
        }
      }
    }

    return False;
	}

	function checkValue($value) {

    if (!$this->options) {
      // If we are allowing empty box, take empty value
      if ($this->allow_empty && !$value) {
        return array();
      }

      return array($this->name => 'The '.strtolower($this->caption ?: ucwords($this->name)).' field does not have any options.');
    }

    if ($this->multiple) {
      if ($this->required && !$value) {
        return array($this->name => 'The '.strtolower($this->caption ?: ucwords($this->name)).' field is required.');
      }

      foreach ($value as $v) {
        if ($errors = parent::checkValue($v)) {
          return $errors;
        }
      }
      return array();
    }else return parent::checkValue($value);
  }
}


text:
'use strict'

module.exports = class Swarm {

    constructor(name, managers, nodes) {
        this.name = name;
        this.managers = managers;
        this.nodes = nodes;
    }

    getName() {
        return this.name;
    }

    getManagers() {
        return this.managers;
    }

    getNodes() {
        return this.nodes;
    }
};


text:
package gobblin.hive.spec;

import org.apache.hadoop.fs.Path;

import com.google.common.base.Objects;
import com.google.common.base.Optional;
import com.google.common.base.Preconditions;
import com.google.common.base.Predicate;
import com.google.common.collect.Lists;

import gobblin.annotation.Alpha;
import gobblin.hive.HivePartition;
import gobblin.hive.HiveTable;
import gobblin.hive.HiveRegister;
import gobblin.hive.spec.activity.Activity;

import lombok.Builder;
import lombok.Getter;
import lombok.Singular;

import java.util.Collection;

/**
 * A base implementation of {@link HiveSpec}.
 */
@Getter
@Alpha
@Builder(builderClassName = "Builder")
public class SimpleHiveSpec
    implements HiveSpec, HiveSpecWithPreActivities, HiveSpecWithPostActivities, HiveSpecWithPredicates {

  protected final Path path;
  protected final HiveTable table;
  protected final Optional<HivePartition> partition;
  @Singular
  @Getter
  protected final Collection<Activity> preActivities;
  @Singular
  @Getter
  protected final Collection<Activity> postActivities;
  @Singular
  @Getter
  protected final Collection<Predicate<HiveRegister>> predicates;

  protected SimpleHiveSpec(Builder<?> builder) {
    this.path = builder.path;
    this.table = builder.table;
    this.partition = builder.partition != null ? builder.partition : Optional.<HivePartition> absent();
    this.preActivities = builder.preActivities;
    this.postActivities = builder.postActivities;
    this.predicates = builder.predicates;
  }

  @Override
  public String toString() {
    return Objects.toStringHelper(this).omitNullValues().add("path", this.path.toString())
        .add("db", this.table.getDbName()).add("table", this.table.getTableName())
        .add("partition", this.partition.orNull()).toString();
  }

  public static class Builder<T extends Builder<?>> {
    @Getter
    private Path path;

    @Getter
    private HiveTable table;

    @Getter
    private Optional<HivePartition> partition;

    private Builder() {
      this.path = null;
    }

    public Builder(Path path) {
      this.path = path;
      this.preActivities = Lists.newArrayList();
      this.postActivities = Lists.newArrayList();
      this.predicates = Lists.newArrayList();
    }

    @SuppressWarnings("unchecked")
    public T withTable(HiveTable table) {
      this.table = table;
      return (T) this;
    }

    @SuppressWarnings("unchecked")
    public T withPartition(Optional<HivePartition> partition) {
      this.partition = partition;
      return (T) this;
    }

    public SimpleHiveSpec build() {
      Preconditions.checkNotNull(this.path);
      Preconditions.checkNotNull(this.table);

      return new SimpleHiveSpec(this);
    }
  }

}


text:
<?php

namespace Rior\Bundle\GruntDistBundle;

use Symfony\Component\HttpKernel\Bundle\Bundle;

class RiorGruntDistBundle extends Bundle
{
}


text:
#ifndef _FN_FORM_PARAM_HPP__
#define _FN_FORM_PARAM_HPP__ 1

#include "CTPP2VMSyscall.hpp"

/**
  @file FnFormParam.hpp
  @brief Virtual machine standard library function, format hidden field for HTML form
*/

namespace CTPP // C++ Template Engine
{

class CDT;
class Logger;

/**
  @class FnFormParam FnFormParam.hpp <FnFormParam.hpp>
  @brief Format hidden field for HTML form
*/
class FnFormParam:
  public SyscallHandler
{
	/**
	  @brief Constructor
	*/
 	FnFormParam();

	/**
	  @brief A destructor
	*/
	~FnFormParam() throw();

private:
	friend class STDLibInitializer;

	/**
	  @brief Handler
	  @param aArguments - list of arguments
	  @param iArgNum - number of arguments
	  @param oCDTRetVal - return value
	  @param oLogger - logger
	  @return 0 - if success, -1 - otherwise
	*/
	INT_32 Handler(CDT            * aArguments,
	               const UINT_32    iArgNum,
	               CDT            & oCDTRetVal,
	               Logger         & oLogger);

	/**
	  @brief Get function name
	*/
	CCHAR_P GetName() const;
};

} // namespace CTPP
#endif // _FN_FORM_PARAM_HPP__
// End.