text:
<?php

namespace Kanboard\Controller;

/**
 * Board controller
 *
 * @package  controller
 * @author   Frederic Guillot
 */
class Board extends Base
{
    /**
     * Display the public version of a board
     * Access checked by a simple token, no user login, read only, auto-refresh
     *
     * @access public
     */
    public function readonly()
    {
        $token = $this->request->getStringParam('token');
        $project = $this->project->getByToken($token);

        // Token verification
        if (empty($project)) {
            $this->forbidden(true);
        }

        // Display the board with a specific layout
        $this->response->html($this->template->layout('board/view_public', array(
            'project' => $project,
            'swimlanes' => $this->board->getBoard($project['id']),
            'title' => $project['name'],
            'description' => $project['description'],
            'no_layout' => true,
            'not_editable' => true,
            'board_public_refresh_interval' => $this->config->get('board_public_refresh_interval'),
            'board_private_refresh_interval' => $this->config->get('board_private_refresh_interval'),
            'board_highlight_period' => $this->config->get('board_highlight_period'),
        )));
    }

    /**
     * Show a board for a given project
     *
     * @access public
     */
    public function show()
    {
        $params = $this->getProjectFilters('board', 'show');

        $this->response->html($this->template->layout('board/view_private', array(
            'categories_list' => $this->category->getList($params['project']['id'], false),
            'users_list' => $this->projectUserRole->getAssignableUsersList($params['project']['id'], false),
            'custom_filters_list' => $this->customFilter->getAll($params['project']['id'], $this->userSession->getId()),
            'swimlanes' => $this->taskFilter->search($params['filters']['search'])->getBoard($params['project']['id']),
            'description' => $params['project']['description'],
            'board_private_refresh_interval' => $this->config->get('board_private_refresh_interval'),
            'board_highlight_period' => $this->config->get('board_highlight_period'),
        ) + $params));
    }

    /**
     * Save the board (Ajax request made by the drag and drop)
     *
     * @access public
     */
    public function save()
    {
        $project_id = $this->request->getIntegerParam('project_id');

        if (! $project_id || ! $this->request->isAjax()) {
            return $this->response->status(403);
        }

        $values = $this->request->getJson();

        $result =$this->taskPosition->movePosition(
            $project_id,
            $values['task_id'],
            $values['column_id'],
            $values['position'],
            $values['swimlane_id']
        );

        if (! $result) {
            return $this->response->status(400);
        }

        $this->response->html($this->renderBoard($project_id), 201);
    }

    /**
     * Check if the board have been changed
     *
     * @access public
     */
    public function check()
    {
        $project_id = $this->request->getIntegerParam('project_id');
        $timestamp = $this->request->getIntegerParam('timestamp');

        if (! $project_id || ! $this->request->isAjax()) {
            return $this->response->status(403);
        }

        if (! $this->project->isModifiedSince($project_id, $timestamp)) {
            return $this->response->status(304);
        }

        return $this->response->html($this->renderBoard($project_id));
    }

    /**
     * Reload the board with new filters
     *
     * @access public
     */
    public function reload()
    {
        $project_id = $this->request->getIntegerParam('project_id');

        if (! $project_id || ! $this->request->isAjax()) {
            return $this->response->status(403);
        }

        $values = $this->request->getJson();
        $this->userSession->setFilters($project_id, empty($values['search']) ? '' : $values['search']);

        $this->response->html($this->renderBoard($project_id));
    }

    /**
     * Enable collapsed mode
     *
     * @access public
     */
    public function collapse()
    {
        $this->changeDisplayMode(true);
    }

    /**
     * Enable expanded mode
     *
     * @access public
     */
    public function expand()
    {
        $this->changeDisplayMode(false);
    }

    /**
     * Change display mode
     *
     * @access private
     * @param  boolean $mode
     */
    private function changeDisplayMode($mode)
    {
        $project_id = $this->request->getIntegerParam('project_id');
        $this->userSession->setBoardDisplayMode($project_id, $mode);

        if ($this->request->isAjax()) {
            $this->response->html($this->renderBoard($project_id));
        } else {
            $this->response->redirect($this->helper->url->to('board', 'show', array('project_id' => $project_id)));
        }
    }

    /**
     * Render board
     *
     * @access private
     * @param  integer $project_id
     */
    private function renderBoard($project_id)
    {
        return $this->template->render('board/table_container', array(
            'project' => $this->project->getById($project_id),
            'swimlanes' => $this->taskFilter->search($this->userSession->getFilters($project_id))->getBoard($project_id),
            'board_private_refresh_interval' => $this->config->get('board_private_refresh_interval'),
            'board_highlight_period' => $this->config->get('board_highlight_period'),
        ));
    }
}


text:
module Rx {
    export interface Recorded {
        /**
         * Checks whether the given recorded object is equal to the current instance.
         *
         * @param {Recorded} other Recorded object to check for equality.
         * @returns {Boolean} true if both objects are equal; false otherwise.
         */
        equals(other: Recorded): boolean;
        /**
         * Returns a string representation of the current Recorded value.
         *
         * @returns {String} String representation of the current Recorded value.
         */
        toString(): string;
        time: number;
        value: any;
    }

    interface RecordedStatic {
        /**
         * Creates a new object recording the production of the specified value at the given virtual time.
         *
         * @constructor
         * @param {Number} time Virtual time the value was produced on.
         * @param {Mixed} value Value that was produced.
         * @param {Function} comparer An optional comparer.
         */
        new (time: number, value: any, equalityComparer?: _Comparer<any, boolean>): Recorded;
    }

    export var Recorded: RecordedStatic;
}

(function() {
    var r: Rx.Recorded = new Rx.Recorded(100, 'abc');
    var r: Rx.Recorded = new Rx.Recorded(100, 'abc', (x, y) => false);

    var b: boolean = r.equals(r);
    var s: string = r.toString();
    var t: number = r.time;
    var a: any = r.value;
});

redpajama_set_name: RedPajamaGithub


text:
class ProjectSerializer < BaseSerializer
  entity ProjectEntity
end


text:
"""
Utilities.
"""

import collections
import contextlib
import ConfigParser
import re
import StringIO
import time

# We only accept ASCII or ACE-encoded domain names. IDNs must be converted
# to ACE first.
FQDN_PATTERN = re.compile(r'^([-a-z0-9]{1,63})(\.[-a-z0-9]{1,63}){1,}$')

def make_config_parser(defaults=None, config_path=None):
    """
    Creates a config parser.
    """
    parser = ConfigParser.SafeConfigParser()
    if defaults is not None:
        with contextlib.closing(StringIO.StringIO(defaults)) as fp:
            parser.readfp(fp)
    if config_path is not None:
        parser.read(config_path)
    return parser

def is_well_formed_fqdn(fqdn):
    """
    Check if a string looks like a well formed FQDN.
    """
    return FQDN_PATTERN.match(fqdn) is not None

def split_fqdn(fqdn):
    """
    Splits an FQDN into the domain name and zone.

    >>> split_fqdn('stereochro.me')
    ['stereochro', 'me']
    >>> split_fqdn('stereochro.me.')
    ['stereochro', 'me']
    >>> split_fqdn('stereochrome')
    ['stereochrome']
    >>> split_fqdn('keithgaughan.co.uk')
    ['keithgaughan', 'co.uk']
    """
    return fqdn.rstrip('.').split('.', 1)

def to_bool(s):
    """
    Converts the given string to a boolean.
    """
    return s.lower() in ('1', 'true', 'yes', 'on')

def decode_value(s):
    """
    If a string is quoted, it's parsed like a python string, otherwise it's
    passed straight through as-is.

    >>> decode_value('foo')
    'foo'
    >>> decode_value('"foo"')
    'foo'
    >>> decode_value('"foo\\\\nbar\"')
    'foo\\nbar'
    >>> decode_value('foo\\nbar')
    'foo\\nbar'
    >>> decode_value('"foo')
    Traceback (most recent call last):
        ...
    ValueError: The trailing quote be present and match the leading quote.
    >>> decode_value("'foo")
    Traceback (most recent call last):
        ...
    ValueError: The trailing quote be present and match the leading quote.
    >>> decode_value("\\\"foo\\'")
    Traceback (most recent call last):
        ...
    ValueError: The trailing quote be present and match the leading quote.
    """
    if len(s) > 1 and s[0] in ('"', "'"):
        if s[0] != s[-1]:
            raise ValueError(
                "The trailing quote be present and match the leading quote.")
        return s[1:-1].decode('string_escape')
    return s

# pylint: disable-msg=R0924
class Cache(object):
    """
    A simple LFU cache.
    """

    # This is implemented as an LFU cache. The eviction queue contains
    # 2-tuples consisting of the time the item was put into the cache and the
    # cache key. The cache maps cache keys onto 2-tuples consisting of a
    # counter giving the number of times this item occurs on the eviction queue
    # and the value.
    #
    # I may end up reimplementing this as an LRU cache if it turns out that's
    # more apt, but I haven't went that route as an LRU cache is somewhat more
    # awkward and involved to implement correctly.

    __slots__ = (
        'cache',
        'clock',
        'max_age',
        'max_size',
        'queue',
    )

    def __init__(self, max_size=256, max_age=300, clock=time.time):
        self.cache = {}
        self.queue = collections.deque()
        self.max_size = max_size
        self.max_age = max_age
        self.clock = clock

    def evict_one(self):
        """
        Remove the item at the head of the eviction cache.
        """
        _, key = self.queue.popleft()
        self.attempt_eviction(key)

    def attempt_eviction(self, key):
        """
        Attempt to remove the named item from the cache.
        """
        counter, value = self.cache[key]
        counter -= 1
        if counter == 0:
            del self.cache[key]
        else:
            self.cache[key] = (counter, value)

    def evict_expired(self):
        """
        Evict any items older than the maximum age from the cache.
        """
        cutoff = self.clock() - self.max_age
        while len(self.queue) > 0:
            ts, key = self.queue.popleft()
            if ts > cutoff:
                self.queue.appendleft((ts, key))
                break
            self.attempt_eviction(key)

    def __len__(self):
        return len(self.cache)

    def __contains__(self, key):
        return key in self.cache

    def __getitem__(self, key):
        if key not in self.cache:
            raise IndexError
        _, value = self.cache[key]
        # Force this onto the top of the heap.
        self[key] = value
        return value

    def __setitem__(self, key, value):
        if len(self.queue) == self.max_size:
            self.evict_one()
        if key in self.cache:
            counter, _ = self.cache[key]
        else:
            counter = 0
        self.cache[key] = (counter + 1, value)
        self.queue.append((self.clock(), key))


text:
// Done by TheTutor

// This tutorial is all about "macros" -- As you may or may not recall, #define is
// a preprocessor directive that does a textual substitution BEFORE your .cpp file(s)
// are compiled.  So for example:

/*
	#define NUM 36

	#include <iostream>
	using namespace std;

	int main()
	{
		cout << NUM;		// Here NUM will LITERALLY be replaced with 36
		return 0;
	}

*/

// Macros are very similar, expect they are a "function-like" replacement.  So lets do
// a quick example:

/*
	#define DOUBLE_SPACE() cout << endl << endl;

	#include <iostream>
	using namespace std;

	int main()
	{
		cout << "HI";

		DOUBLE_SPACE()

		cout << "BYE";
		return 0;
	}

*/

// Okay now we will break down the example:

// #define DOUBLE_SPACE() cout << endl << endl;
//	  |
//	  |__  The "keyword" to declare a macro
//
// #define DOUBLE_SPACE() cout << endl << endl;
//				|
//				|__ The name of our macro, just like you give a function a name, you also
//					give a macro a name.
//
// #define DOUBLE_SPACE() cout << endl << endl;
//									|
//									|__ All of this: "cout << endl << endl;" is the
//										macro implementation.  This textual string gets
//										copied everywhere DOUBLE_SPACE() is found in the
//										.cpp file(s) BEFORE they get compiled.
//
// You can think of the example like this:
/*
	This is what you type in:

	#define DOUBLE_SPACE() cout << endl << endl;

	#include <iostream>
	using namespace std;

	int main()
	{
		cout << "HI";

		DOUBLE_SPACE()

		cout << "BYE";
		return 0;
	}

	Then you hit compile -- What the compiler does is FIRST runs through your code and
	changes everywhere it finds	"DOUBLE_SPACE()" to "cout << endl << endl;"

	Meaning your .cpp that ACTUALLY GETS COMPILED looks like this:

	#include <iostream>
	using namespace std;

	int main()
	{
		cout << "HI";

		cout << endl << endl;

		cout << "BYE";
		return 0;
	}

*/

// All right!  You are well on your way to becoming a "macro guru" :) -- In the code that
// follows, we are going to implement three different types of macros -- The first macro will
// just be the one used in the example, DOUBLE_SPACE() (just so you can see that it works :)
// The second will be a macro that takes an argument (so the macro is even more like a typical
// function) -- The last will be a macro that's definition is on multiple lines.  There's a
// special type of syntax required for macros that span more than one line of code.
//
// And now it's macro time

#define DOUBLE_SPACE() cout << endl << endl; // Hopefully this was pretty clear from the example
											// above -- Again everywhere in our code where
										   // "DOUBLE_SPACE()" is found, it will be replaced
										  // with "cout << endl << endl;".

// For the next macro we need to define PI
#define PI 3.141592653589

// Below is our macro that takes an argument -- It will convert degrees to radians.
// Notice how 'x' is NOT A VARIABLE (it's not an int, float, char, double, etc).
// This means you can pass in whatever you want, which is very handy.  The compiler should
// puke at you if you pass in a variable where the '*' operation is NOT DEFINED.  However, with
// this flexibility you have to be careful.  One thing to definitely notice is that how 'x' is
// wrapped in ()'s in the implementation part of the macro.  It is IMPERATIVE that you wrap all
// arguments to a macro in ()'s in the implementation part.  Why?  Well it's pretty simple.
// In main() we could do something like this:
//
// int main()
// {
//		float rad = DEG2RAD(45 + 90);
//
//		cout << rad;
//		return 0;
// }
//
// This line:  float rad = DEG2RAD(45 + 90); would expand out to this:
//
// float rad = 45 + 90 * PI / 180.0f;
//
// Now from recalling your math order of precedence rules, you can see very quickly that
// this WILL NOT produce the correct answer.  The 90 * PI will execute FIRST, we want the
// 45 + 90 to execute first.  This is why it is a good idea to place ()'s around your arguments
// in the implementation part of a macro.
#define DEG2RAD(x) ((x) * PI / 180.0f)

// The last macro we will create is going to be called TRIPLE_SPACE() -- It will print
// out three blank lines -- Now we could do this macro on one line of code, but we're going
// to create it on 3 separate lines so you can see the special syntax needed to write
// a macro on more than one line.
#define TRIPLE_SPACE() cout << endl \
					        << endl \
							<< endl;

// In the macro above the '\' means "this macro continues on the next line of code" -- Now
// if you're browsing through somebody else's header file(s) and you see some nasty syntax
// like this, you'll know what it means.  Again all the '\' does is continues the macro onto
// the next line of source code.

// Okay now here's our main to actually use these three macros

#include <iostream>	// So we can use cout
using namespace std; // We want to use the STanDard namespace

int main()
{
//	***** MACRO 1 *****

	cout << "Hello";

	DOUBLE_SPACE()

	cout << "World";

	DOUBLE_SPACE()

//	***** MACRO 2 *****

	int deg = 90;

	cout << deg << " degrees = " << DEG2RAD(deg) << " radians";

//	***** MACRO 3 *****

	TRIPLE_SPACE()

	cout << "And we're out..." << endl;
		return 0;
}

// Macro Miscellaneous:

// For the most part, you should only create "one line" macros -- Macros ARE NOT functions,
// they are "textual substitutions".  So if you create very long elaborate macros that are called
// all over in the .cpp file(s) your executable is going to become HUGE!!!!!  Plus, macros
// are very difficult to debug.  This is another reason a macro should be very straightforward
// as to what it is doing so there is NO reason to debug it.

// If you have further questions be sure to head to the www.gametutorials.com forums

/*-------------------------*\
|  Programmed by:  TheTutor	|
|  ©2006 GameTutorials, LLC	|
\*-------------------------*/


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

<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>CRONOS PHP API: Todo List</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>

CRONOS PHP API 1.0

A PHP Library to access to CRONOS database. CRONOS is hosted by State Climate Office of North Carolina

Main Page

Related Pages

Data Structures

Files

Todo List

Class CRONOS

Add quality control flags to getHourlyData and getDailyData. (CV)

Add ability to parse the comments for parameters and station metadata (CV)

Organize the hourly and daily output array by [station][date] = data vs. a list. (CV)

<address class="footer">Generated on Mon Jul 11 2011 12:35:08 for CRONOS PHP API by

 1.7.4 </address>


text:
package com.example.coolweather.db;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.database.sqlite.SQLiteOpenHelper;

public class CoolWeatherOpenHelper extends SQLiteOpenHelper {
	/*Province±í½¨±íÓï¾ä*/
	public static final String CREATE_PROVINCE="create table Province("
			+"id integer primary key autoincrement,"//×ÔÔö³¤Ö÷¼ü
			+"province_name text,"//Ê¡Ãû
			+"province_code text)";//Ê¡¼¶´úºÅ
	/*City±í½¨±íÓï¾ä*/
	public static final String CREATE_CITY="create table City("
			+"id integer primary key autoincrement,"//×ÔÔö³¤Ö÷¼ü
			+"city_name text,"//³ÇÊÐÃû
			+"city_code text,"//Êм¶´úºÅ
			+"province_id integer)";//City±í¹ØÁªProvince±íµÄÍâ¼ü
	/*County±í½¨±íÓï¾ä*/
	public static final String CREATE_COUNTY="create table County("
			+"id integer primary key autoincrement,"//×ÔÔö³¤Ö÷¼ü
			+"county_name text,"//ÏØÃû
			+"county_code text,"//Ïؼ¶´úºÅ
			+"city_id integer)";//County±í¹ØÁªCity±íµÄÍâ¼ü

	public CoolWeatherOpenHelper(Context context, String name,
			CursorFactory factory, int version) {
		super(context, name, factory, version);
	}

	@Override
	public void onCreate(SQLiteDatabase db) {
		db.execSQL(CREATE_PROVINCE);//´´½¨Province±í
		db.execSQL(CREATE_CITY);//´´½¨City±í
		db.execSQL(CREATE_COUNTY);//´´½¨County±í

	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
	}

}


text:
package com.amazonaws.services.lightsail.model;

import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;

/**
 *

 * Describes an Amazon Lightsail SSL/TLS certificate.
 *

 *
 * @see AWS API
 *      Documentation
 */
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class CertificateSummary implements Serializable, Cloneable, StructuredPojo {

    /**
     *

     * The Amazon Resource Name (ARN) of the certificate.
     *

     */
    private String certificateArn;
    /**
     *

     * The name of the certificate.
     *

     */
    private String certificateName;
    /**
     *

     * The domain name of the certificate.
     *

     */
    private String domainName;
    /**
     *

     * An object that describes a certificate in detail.
     *

     */
    private Certificate certificateDetail;
    /**
     *

     * The tag keys and optional values for the resource. For more information about tags in Lightsail, see the Amazon Lightsail Developer
     * Guide.
     *

     */
    private java.util.List<Tag> tags;

    /**
     *

     * The Amazon Resource Name (ARN) of the certificate.
     *

     *
     * @param certificateArn
     *        The Amazon Resource Name (ARN) of the certificate.
     */

    public void setCertificateArn(String certificateArn) {
        this.certificateArn = certificateArn;
    }

    /**
     *

     * The Amazon Resource Name (ARN) of the certificate.
     *

     *
     * @return The Amazon Resource Name (ARN) of the certificate.
     */

    public String getCertificateArn() {
        return this.certificateArn;
    }

    /**
     *

     * The Amazon Resource Name (ARN) of the certificate.
     *

     *
     * @param certificateArn
     *        The Amazon Resource Name (ARN) of the certificate.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public CertificateSummary withCertificateArn(String certificateArn) {
        setCertificateArn(certificateArn);
        return this;
    }

    /**
     *

     * The name of the certificate.
     *

     *
     * @param certificateName
     *        The name of the certificate.
     */

    public void setCertificateName(String certificateName) {
        this.certificateName = certificateName;
    }

    /**
     *

     * The name of the certificate.
     *

     *
     * @return The name of the certificate.
     */

    public String getCertificateName() {
        return this.certificateName;
    }

    /**
     *

     * The name of the certificate.
     *

     *
     * @param certificateName
     *        The name of the certificate.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public CertificateSummary withCertificateName(String certificateName) {
        setCertificateName(certificateName);
        return this;
    }

    /**
     *

     * The domain name of the certificate.
     *

     *
     * @param domainName
     *        The domain name of the certificate.
     */

    public void setDomainName(String domainName) {
        this.domainName = domainName;
    }

    /**
     *

     * The domain name of the certificate.
     *

     *
     * @return The domain name of the certificate.
     */

    public String getDomainName() {
        return this.domainName;
    }

    /**
     *

     * The domain name of the certificate.
     *

     *
     * @param domainName
     *        The domain name of the certificate.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public CertificateSummary withDomainName(String domainName) {
        setDomainName(domainName);
        return this;
    }

    /**
     *

     * An object that describes a certificate in detail.
     *

     *
     * @param certificateDetail
     *        An object that describes a certificate in detail.
     */

    public void setCertificateDetail(Certificate certificateDetail) {
        this.certificateDetail = certificateDetail;
    }

    /**
     *

     * An object that describes a certificate in detail.
     *

     *
     * @return An object that describes a certificate in detail.
     */

    public Certificate getCertificateDetail() {
        return this.certificateDetail;
    }

    /**
     *

     * An object that describes a certificate in detail.
     *

     *
     * @param certificateDetail
     *        An object that describes a certificate in detail.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public CertificateSummary withCertificateDetail(Certificate certificateDetail) {
        setCertificateDetail(certificateDetail);
        return this;
    }

    /**
     *

     * The tag keys and optional values for the resource. For more information about tags in Lightsail, see the Amazon Lightsail Developer
     * Guide.
     *

     *
     * @return The tag keys and optional values for the resource. For more information about tags in Lightsail, see the
     *         Amazon Lightsail
     *         Developer Guide.
     */

    public java.util.List<Tag> getTags() {
        return tags;
    }

    /**
     *

     * The tag keys and optional values for the resource. For more information about tags in Lightsail, see the Amazon Lightsail Developer
     * Guide.
     *

     *
     * @param tags
     *        The tag keys and optional values for the resource. For more information about tags in Lightsail, see the
     *        Amazon Lightsail
     *        Developer Guide.
     */

    public void setTags(java.util.Collection<Tag> tags) {
        if (tags == null) {
            this.tags = null;
            return;
        }

        this.tags = new java.util.ArrayList<Tag>(tags);
    }

    /**
     *

     * The tag keys and optional values for the resource. For more information about tags in Lightsail, see the Amazon Lightsail Developer
     * Guide.
     *

     *

     * NOTE: This method appends the values to the existing list (if any). Use
     * {@link #setTags(java.util.Collection)} or {@link #withTags(java.util.Collection)} if you want to override the
     * existing values.
     *

     *
     * @param tags
     *        The tag keys and optional values for the resource. For more information about tags in Lightsail, see the
     *        Amazon Lightsail
     *        Developer Guide.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public CertificateSummary withTags(Tag... tags) {
        if (this.tags == null) {
            setTags(new java.util.ArrayList<Tag>(tags.length));
        }
        for (Tag ele : tags) {
            this.tags.add(ele);
        }
        return this;
    }

    /**
     *

     * The tag keys and optional values for the resource. For more information about tags in Lightsail, see the Amazon Lightsail Developer
     * Guide.
     *

     *
     * @param tags
     *        The tag keys and optional values for the resource. For more information about tags in Lightsail, see the
     *        Amazon Lightsail
     *        Developer Guide.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public CertificateSummary withTags(java.util.Collection<Tag> tags) {
        setTags(tags);
        return this;
    }

    /**
     * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
     * redacted from this string using a placeholder value.
     *
     * @return A string representation of this object.
     *
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getCertificateArn() != null)
            sb.append("CertificateArn: ").append(getCertificateArn()).append(",");
        if (getCertificateName() != null)
            sb.append("CertificateName: ").append(getCertificateName()).append(",");
        if (getDomainName() != null)
            sb.append("DomainName: ").append(getDomainName()).append(",");
        if (getCertificateDetail() != null)
            sb.append("CertificateDetail: ").append(getCertificateDetail()).append(",");
        if (getTags() != null)
            sb.append("Tags: ").append(getTags());
        sb.append("}");
        return sb.toString();
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;

        if (obj instanceof CertificateSummary == false)
            return false;
        CertificateSummary other = (CertificateSummary) obj;
        if (other.getCertificateArn() == null ^ this.getCertificateArn() == null)
            return false;
        if (other.getCertificateArn() != null && other.getCertificateArn().equals(this.getCertificateArn()) == false)
            return false;
        if (other.getCertificateName() == null ^ this.getCertificateName() == null)
            return false;
        if (other.getCertificateName() != null && other.getCertificateName().equals(this.getCertificateName()) == false)
            return false;
        if (other.getDomainName() == null ^ this.getDomainName() == null)
            return false;
        if (other.getDomainName() != null && other.getDomainName().equals(this.getDomainName()) == false)
            return false;
        if (other.getCertificateDetail() == null ^ this.getCertificateDetail() == null)
            return false;
        if (other.getCertificateDetail() != null && other.getCertificateDetail().equals(this.getCertificateDetail()) == false)
            return false;
        if (other.getTags() == null ^ this.getTags() == null)
            return false;
        if (other.getTags() != null && other.getTags().equals(this.getTags()) == false)
            return false;
        return true;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;

        hashCode = prime * hashCode + ((getCertificateArn() == null) ? 0 : getCertificateArn().hashCode());
        hashCode = prime * hashCode + ((getCertificateName() == null) ? 0 : getCertificateName().hashCode());
        hashCode = prime * hashCode + ((getDomainName() == null) ? 0 : getDomainName().hashCode());
        hashCode = prime * hashCode + ((getCertificateDetail() == null) ? 0 : getCertificateDetail().hashCode());
        hashCode = prime * hashCode + ((getTags() == null) ? 0 : getTags().hashCode());
        return hashCode;
    }

    @Override
    public CertificateSummary clone() {
        try {
            return (CertificateSummary) super.clone();
        } catch (CloneNotSupportedException e) {
            throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
        }
    }

    @com.amazonaws.annotation.SdkInternalApi
    @Override
    public void marshall(ProtocolMarshaller protocolMarshaller) {
        com.amazonaws.services.lightsail.model.transform.CertificateSummaryMarshaller.getInstance().marshall(this, protocolMarshaller);
    }
}


text:
<?php
/*
Plugin Name: Private Only
Plugin URI: http://www.pixert.com/
Description: Redirects all non-logged in users to login form with custom login capability
Version: 3.5.1
Author: Kate Mag (Pixel Insert)
Author URI: http://www.pixert.com
*/
/*
Copyright 2009 Kate Mag-Pixel Insert (email:studio[at]pixert dot com)
This program is free softwate; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version

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

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Fondation, Inc.,
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 US
*/
?>
<?php
/* Localization */
load_plugin_textdomain('private-only', false, basename( dirname( __FILE__ ) ) . '/languages' );
//login page - sweet!
//define constant folder to the plugin
$wp_content_dir = WP_CONTENT_DIR;
$wp_plugin_dir = $wp_content_dir . '/plugins';
define( 'PO_LOGIN', $wp_plugin_dir . '/private-only' );
define( 'PO_LOGIN_URL', $wp_plugin_dir . '/private-only' );
define( 'PO_LOGIN_ADMIN', $wp_plugin_dir . '/private-only/admin' );
define( 'PO_LOGIN_CSS', $wp_plugin_dir . '/private-only/css' );

//load settings from database
if ( is_admin() )
	require_once( PO_LOGIN_ADMIN . '/settings-admin.php' );
	$po_login = get_option( 'po_login_settings' );
  	function po_login_add_pages() {
		if ( function_exists( 'add_options_page' ) )
			$page=add_options_page( 'Private Only Custom Login', 'Private Only Custom Login', 'update_plugins' , 'privateonly.php', 'po_login_page');
  	}
  //main function
  function po_custom_login() {
	global $po_login;
		echo '' . "\n\n";
?>
<?php if (isset($po_login[ 'use_wp_logo' ]) && $po_login[ 'use_wp_logo' ] == "true" ) {} else { ?>
<?php if (isset($po_login[ 'po_logo' ]) && !empty($po_login[ 'po_logo']) ) { ?>

<?php } else { ?>

<?php } } ?>
<?php if (isset($po_login[ 'remove_lost_password' ]) && $po_login[ 'remove_lost_password' ] == "true" ) { ?>

<?php } ?>
<?php if (isset($po_login[ 'remove_backtoblog' ]) && $po_login[ 'remove_backtoblog' ] == "true" ) { ?>

<?php } ?>
<?php if (isset($po_login['use_custom_css']) && $po_login['use_custom_css'] == "true") { ?>
<link rel="stylesheet" type="text/css" href="<?php echo get_bloginfo('stylesheet_directory') ?>/custom.css" />
<?php } ?>
<?php
		echo '' . "\n\n";
  }
  function po_login_plugin_actions($links, $file ) {
 	  if( $file == 'private-only/privateonly.php' && function_exists( "admin_url" ) ) {
		  $settings_link = '' . __('Private Only Custom Login') . '';
		  array_unshift( $links, $settings_link ); // before other links
	}
	return $links;
  }
  //add a settings page to menu
	add_action( 'admin_menu', 'po_login_add_pages' );
	add_action( 'login_head', 'po_custom_login' );
	//Add a settings page to the plugin menu
	add_filter( 'plugin_action_links', 'po_login_plugin_actions', 10, 2 );

//Main Private Only features
function private_only () {
	$settings = get_option( 'po_login_settings' );
	$pagelink = get_permalink($settings['public_pages']);
	/* New Feature, code added by Ivan Ricotti. Thanks */
	if (!is_user_logged_in() && !is_feed() && isset($settings['public_pages']) && $settings['public_pages'] && is_page($settings['public_pages'])) {
		return;
	}
	if (!is_user_logged_in() && !is_feed() && (!is_page($settings['public_pages']) || empty($settings['public_pages']) || $settings['public_pages'] == '')) {
		auth_redirect();
  }
}
//Redirect to Homepage after Login
function default_login_redirect( $redirect, $request_redirect )
{
    if ( $request_redirect === '' )
        $redirect = home_url();
    return $redirect;
}
add_filter( 'login_redirect', 'default_login_redirect', 10, 2 );
function no_index () {
	echo "<meta name='robots' content='noindex,nofollow' />\n";
}
/* Fix Login Page Message */
function custom_login_message() {
$settings = get_option( 'po_login_settings' );
$pagetitle = get_the_title($settings['public_pages']);
$pagelink = get_permalink($settings['public_pages']);
if (isset($settings['login_message']) && !empty($settings['login_message'])) {
$message = '
'.$settings['login_message'].'
';
} else {
$message = '
'.__('Only registered and logged in users are allowed to view this site. Please login now','private-only').'
';
}
if (isset($settings['public_pages']) && $settings['public_pages']) {
$message .= __('Visit our public page:','private-only') .' '.$pagetitle.'
';
} else {
$message .= '
';
}
return $message;
}
add_filter('login_message', 'custom_login_message');
function custom_register_message() {
$message ='
'.printf(__('Welcome,you need to be registered to see content','private-only')).'

';
return $message;
}
add_filter('register_message', 'custom_register_message');
/* Fix Logo Title */;
function change_login_headertitle(){
	return get_bloginfo('title', 'display' );
}
/* Change Logo URL */
// Use your own external URL logo link
function wpc_url_login(){
global $po_login;
if (isset($po_login['logo_url']) && $po_login['logo_url'] == true) {
	return $po_login['logo_url']; // your URL here
}
}
add_filter('login_headertitle', 'change_login_headertitle');
add_filter('login_headerurl', 'wpc_url_login');
add_action('template_redirect','private_only');
add_action('login_head','no_index');
?>


text:
import _middlewareInjector from "./middleware-injector";

export const middlewareInjector = _middlewareInjector;


text:
title: "Industrial Reactor Cleaning Robot"
excerpt: "Consultancy project for Reliance Industries Ltd."
header:
  teaser: assets/images/reactor-robot.png
sidebar:
  - title: "Sep 2015 - Feb 2016"
    image: assets/images/reactor-robot.png
    image_alt: "CAD model of our reactor cleaning robot"
    text: "Consultancy project for Reliance Industries Ltd."
  - title: "People Involved"
    text: "Pankaj Verma, Abhishek Sharma, Dhrupal Shah"
---
As a part of Agilo Technologies, I developed the control system and user interface for a 3 link planar robotic arm to be used in cleaning industrial chemical reactors at the largest crude oil refinery in the world operated by Reliance Industries Ltd.

We implemented an inverse kinematic solution with singularity robustness to make sure the teleoperated robot did not accidentally go into a singularity configuration.
The software stack for the control pipeline, incorporating encoder and limit feedback, kinematic calculations, actuator control and the user interface for teleoperation was built using ROS.


text:
<!doctype html>

<meta charset="utf-8">
<title>FoodUtilitiesTest</title>

<link rel="stylesheet" href="http://code.jquery.com/qunit/qunit-1.15.0.css">


text:
window.hf = {
  models: {},
  views: {},
  collections: {}
};

// Use mustache style templates.
// Now use {{ }} instead of <%= => for underscore templates
_.templateSettings = {
  //interpolate: /\{\{(.+?)\}\}/g
  evaluate: /\{\[([\s\S]+?)\]\}/g,
  interpolate: /\{\{([\s\S]+?)\}\}/g
};

$(function() {

  // **************************************************************************
  // Resource lists

  var javascriptResources = [
    {
      name: "Javascript",
      url: "https://developer.mozilla.org/en-US/docs/JavaScript",
      links: [
        {
          name: "ref",
          url: "https://developer.mozilla.org/en-US/docs/JavaScript/Reference"
        },
        {
          name: "string",
          url: "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String"
        },
        {
          name: "array",
          url: "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array"
        },
        {
          name: "date",
          url: "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date"
        }
      ]
    },
    {
      name: "JQuery",
      url: "http://jquery.com/",
      links: [
        {
          name: "api",
          url: "http://api.jquery.com/"
        },
        {
          name: "code",
          url: "https://github.com/jquery/jquery/tree/master/src"
        },
        {
          name: "github",
          url: "https://github.com/jquery/jquery"
        }
      ]
    },
    {
      name: "Twitter Bootstrap",
      url: "http://twitter.github.com/bootstrap/",
      links: [
        {
          name: "api",
          url: "http://twitter.github.com/bootstrap/javascript.html"
        },
        {
          name: "css",
          url: "https://github.com/twitter/bootstrap/blob/master/docs/assets/css/bootstrap.css"
        },
        {
          name: "js",
          url: "https://github.com/twitter/bootstrap/blob/master/docs/assets/js/bootstrap.js"
        },
        {
          name: "github",
          url: "https://github.com/twitter/bootstrap"
        }
      ]
    },
    {
      name: "Backbone.js",
      url: "http://www.backbonejs.com",
      links: [
      {
        name: "api",
        url: "http://www.backbonejs.com"
      },
        {
          name: "code",
          url: "https://github.com/documentcloud/backbone/blob/master/backbone.js"
        },
        {
          name: "github",
          url: "https://github.com/documentcloud/backbone"
        }
      ]
    },
    {
      name: "Underscore.js",
      url: "http://underscorejs.org",
      links: [
        {
          name: "api",
          url: "http://underscorejs.org"
        },
        {
          name: "code",
          url: "https://github.com/documentcloud/underscore/blob/master/underscore.js"
        },
        {
          name: "github",
          url: "https://github.com/documentcloud/underscore"
        }
      ]
    },
    {
      name: "Underscore.string.js",
      url: "http://epeli.github.com/underscore.string/",
      links: [
        {
          name: "api",
          url: "https://github.com/epeli/underscore.string#readme"
        },
        {
          name: "code",
          url: "https://github.com/epeli/underscore.string/blob/master/lib/underscore.string.js"
        },
        {
          name: "github",
          url: "https://github.com/epeli/underscore.string"
        }
      ]
    },
    {
      name: "Knockout.js",
      url: "http://knockoutjs.com/",
      links: [
        {
          name: "api",
          url: "http://knockoutjs.com/documentation/introduction.html"
        },
        {
          name: "code",
          url: "https://github.com/SteveSanderson/knockout/tree/master/src"
        },
        {
          name: "github",
          url: "https://github.com/SteveSanderson/knockout"
        }
      ]
    }
  ];

  var railsResources = [
    {
      name: "Ruby",
      url: "http://www.ruby-lang.org/en/",
      links: [
        {
          name: "core",
          url: "http://www.ruby-doc.org/core-1.9.3/"
        },
        {
          name: "std-lib",
          url: "http://www.ruby-doc.org/stdlib-1.9.3/"
        },
        {
          name: "toolbox",
          url: "https://www.ruby-toolbox.com/blog"
        },
        {
          name: "github",
          url: "https://github.com/ruby/ruby"
        }
      ]
    },
    {
      name: "Rails",
      url: "http://rubyonrails.org/",
      links: [
        {
          name: "api",
          url: "http://api.rubyonrails.org/"
        },
        {
          name: "guide",
          url: "http://guides.rubyonrails.org/"
        },
        {
          name: "railscasts",
          url: "http://railscasts.com/"
        },
        {
          name: "github",
          url: "https://github.com/rails/rails"
        }
      ]
    }
  ];

  /****************************************************************************
   * Code
   */

  hf.models.Resource = Backbone.Model.extend({
    defaults: {
      name: "",
      url: ""
    }
  });

  hf.collections.Resources = Backbone.Collection.extend({
    model: hf.models.Resource
  });

  hf.views.Resource = Backbone.View.extend({
    initialize: function(options) {
      this.template = _.template(options.template.html());
    },

    render: function() {
      //remember the underscore templates take A JSON object NOT the model itself.s
      this.$el.html(this.template(this.model.toJSON()));
      return this;
    }
  });

  hf.views.ResourceTable = Backbone.View.extend({

    initialize: function(options) {
      this.collection = new hf.collections.Resources(options.resourceJSON);
      this.render();
    },

    render: function() {
      var that = this;
      this.collection.each(function(model) {
        var resourceView = new hf.views.Resource({
          template: $('#resourceTemplate'),
          model: model,
          tagName: 'tr'
        });
        that.$el.append(resourceView.render().el);
      });
    }
  });

  hf.views.Appview = Backbone.View.extend({
    initialize: function() {
      var javascriptTableView = new hf.views.ResourceTable({
        el: $('#javascript-resource'),
        resourceJSON: javascriptResources
      });
      var railsTableView = new hf.views.ResourceTable({
        el: $('#rails-resource'),
        resourceJSON: railsResources
      });
    }
  });

  var appView = new hf.views.Appview({
    el: $('body')
  });

  // Other code

  // set all a links to have a target of _blank
  $('a').each(function(index, element) {
    var $elm = $(element);
    if(typeof $elm.attr('target') === 'undefined') {
      $elm.attr('target', '_blank');
    }
  });

});


text:
package com.amazonaws.services.ec2.model;

/**
 *

 *
 *

 */
public class AttachVpnGatewayResult {

    /**
     *
     */
    private VpcAttachment vpcAttachement;

    /**
     *
     *
     * @return
     */
    public VpcAttachment getVpcAttachement() {
        return vpcAttachement;
    }

    /**
     *
     *
     * @param vpcAttachement
     */
    public void setVpcAttachement(VpcAttachment vpcAttachement) {
        this.vpcAttachement = vpcAttachement;
    }

    /**
     *
     *

     * Returns a reference to this object so that method calls can be chained together.
     *
     * @param vpcAttachement
     *
     * @return A reference to this updated object so that method calls can be chained
     *         together.
     */
    public AttachVpnGatewayResult withVpcAttachement(VpcAttachment vpcAttachement) {
        this.vpcAttachement = vpcAttachement;
        return this;
    }

    /**
     * Returns a string representation of this object; useful for testing and
     * debugging.
     *
     * @return A string representation of this object.
     *
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        sb.append("VpcAttachement: " + vpcAttachement + ", ");
        sb.append("}");
        return sb.toString();
    }

}


text:
class Sufia::StatsAdmin
  def self.matches?(request)
    current_user = request.env['warden'].user
    return false if current_user.blank?
    current_user.groups.include? 'umg/up.dlt.scholarsphere-admin-viewers'
  end
end


text:
package com.truecaller.androidactors;

import androidx.annotation.NonNull;

import java.util.concurrent.ThreadFactory;

/* package */ class ActorThreadPoolThreadsFactory implements ThreadFactory {

    @NonNull
    private final String mName;

    /* package */ ActorThreadPoolThreadsFactory(@NonNull String name) {
        mName = name;
    }

    @Override
    public Thread newThread(Runnable r) {
        return new Thread(r, mName);
    }
}


text:
package game.map;

import game.Constants;
import game.graphic.SpriteResources;

import java.awt.image.BufferedImage;

public class Tileset {

	private String tilesetName;
	private String spritesetName;
	private BufferedImage[][] spriteset;
	private boolean[][] solid;
	private int width;
	private int height;

	public Tileset(String tilesetName, String spritesetName) {
		this.tilesetName=tilesetName;
		this.spritesetName=spritesetName;
		spriteset=SpriteResources.getLibrary().requestSpriteset(spritesetName, Constants.TILE_WIDTH, Constants.TILE_HEIGHT, Constants.SPRITE_SCALE);
		width=spriteset[0].length;
		height=spriteset.length;
		solid=new boolean[height][width];

		//TODO debug
		solid[3][9]=true;
	}

	public boolean isSolid(int x, int y) {
		return solid[y][x];
	}

	public BufferedImage getSprite(int x, int y) {
		return spriteset[y][x];
	}

	public int getWidth() {
		return width;
	}

	public int getHeight() {
		return height;
	}

}


text:
<?php

namespace Oro\Bundle\ActionBundle\Command;

use Symfony\Component\Console\Input\InputArgument;

/**
 * Displays current "conditions" for an application
 */
class DebugConditionCommand extends AbstractDebugCommand
{
    public const ARGUMENT_NAME = 'condition-name';

    /** @var string */
    protected static $defaultName = 'oro:debug:condition';

    /**
     * {@inheritdoc}
     */
    protected function configure()
    {
        $this->setDescription('Displays current "conditions" for an application')
            ->addArgument(self::ARGUMENT_NAME, InputArgument::OPTIONAL, 'A condition name')
            ->setHelp(
                <<<EOF
The <info>%command.name%</info> displays list of all conditions with full description:

  <info>php %command.full_name%</info>
EOF
            );
    }

    /**
     * {@inheritdoc}
     */
    protected function getArgumentName(): string
    {
        return self::ARGUMENT_NAME;
    }
}


text:
/* This is the custom css stylesheet used to override bootstrap styles as well as defined our own styles for different
classes, tag ids, etc...
*/
.navbar {
    border-radius:0;
}


text:
/**
 * @author      Yongnan
 * @version     1.0
 * @time        9/16/2014
 * @name        PathBubble_object2D
 */
PATHBUBBLES.Object2D = function () {
    this.id = PATHBUBBLES.Object2DIdCount++;
    this.name = '';
    this.parent = undefined;
    this.children = [];
    this.offsetX = 0;
    this.offsetY = 0;
    this.x = 0;
    this.y = 0;
};
PATHBUBBLES.Object2D.prototype = {

    constructor: PATHBUBBLES.Object2D,
    add: function (object) {
        if (arguments.length > 1) {
            for (var i = 0; i < arguments.length; i++) {
                this.add(arguments[ i ]);
            }
            return this;
        }

        if (object === this) {
            console.error("PATHBUBBLES.Object2D.add:", object, "can't be added as a child of itself.");
            return this;
        }

        if (object) {
            if (object.parent !== undefined) {
                object.parent.remove(object);
            }

            object.parent = this;
            //object.dispatchEvent( { type: 'added' } );

            this.children.push(object);

            // add to scene
            var scene = this;
            while (scene.parent !== undefined) {
                scene = scene.parent;
            }

            if (scene !== undefined && scene instanceof  PATHBUBBLES.Scene) {
                scene.addObject(object);
            }

        }
        return this;
    },
    remove: function (object) {
        if (arguments.length > 1) {
            for (var i = 0; i < arguments.length; i++) {
                this.remove(arguments[ i ]);
            }
        }
        ;
        var index = this.children.indexOf(object);
        if (index !== -1) {
            object.parent = undefined;
            this.children.splice(index, 1);
            // remove from scene
            var scene = this;
            while (scene.parent !== undefined) {
                scene = scene.parent;
            }
            if (scene !== undefined && scene instanceof PATHBUBBLES.Scene) {
                scene.removeObject(object);
            }
        }
    },
    traverse: function (callback) {
        callback(this);
        for (var i = 0, l = this.children.length; i < l; i++) {
            this.children[ i ].traverse(callback);
        }
    },

    getObjectById: function (id, recursive) {

        for (var i = 0, l = this.children.length; i < l; i++) {
            var child = this.children[ i ];
            if (child.id === id) {
                return child;
            }

            if (recursive === true) {
                child = child.getObjectById(id, recursive);
                if (child !== undefined) {
                    return child;
                }
            }
        }
        return undefined;
    },
    getObjectByName: function (name, recursive) {

        for (var i = 0, l = this.children.length; i < l; i++) {
            var child = this.children[ i ];
            if (child.name === name) {
                return child;
            }

            if (recursive === true) {
                child = child.getObjectByName(name, recursive);
                if (child !== undefined) {
                    return child;
                }
            }
        }
        return undefined;
    }
};
PATHBUBBLES.Object2DIdCount = 0;


text:
@interface SDLShow : SDLRPCRequest {}

-(id) init;
-(id) initWithDictionary:(NSMutableDictionary*) dict;

@property(strong) NSString* mainField1;
@property(strong) NSString* mainField2;
@property(strong) NSString* mainField3;
@property(strong) NSString* mainField4;
@property(strong) SDLTextAlignment* alignment;
@property(strong) NSString* statusBar;
@property(strong) NSString* mediaClock;
@property(strong) NSString* mediaTrack;
@property(strong) SDLImage* graphic;
@property(strong) SDLImage* secondaryGraphic;
@property(strong) NSMutableArray* softButtons;
@property(strong) NSMutableArray* customPresets;

@end


text:
<?php

final class PhabricatorEdgeEditType
  extends PhabricatorPHIDListEditType {

  private $edgeOperation;
  private $valueDescription;

  public function setEdgeOperation($edge_operation) {
    $this->edgeOperation = $edge_operation;
    return $this;
  }

  public function getEdgeOperation() {
    return $this->edgeOperation;
  }

  public function generateTransactions(
    PhabricatorApplicationTransaction $template,
    array $spec) {

    $value = idx($spec, 'value');

    if ($this->getEdgeOperation() !== null) {
      $value = array_fuse($value);
      $value = array(
        $this->getEdgeOperation() => $value,
      );
    }

    $xaction = $this->newTransaction($template)
      ->setNewValue($value);

    return array($xaction);
  }

  public function setValueDescription($value_description) {
    $this->valueDescription = $value_description;
    return $this;
  }

  public function getValueDescription() {
    return $this->valueDescription;
  }

}


text:
using HtmlAgilityPack;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.ServiceModel.Syndication;
using System.Text;
using System.Text.RegularExpressions;
using System.Xml.Linq;

namespace WPAppStudio.Entities.Base
{
    public class RssUtil
    {
	    private static readonly Dictionary<string, string[]> ValidHtmlTags =
            new Dictionary<string, string[]>
            {
                {"p", new[] {"style", "class", "align"}},
                {"div", new[] {"style", "class", "align"}},
                {"span", new[] {"style", "class"}},
                {"br", new[] {"style", "class"}},
                {"hr", new[] {"style", "class"}},
                {"label", new[] {"style", "class"}},
                {"h1", new[] {"style", "class"}},
                {"h2", new[] {"style", "class"}},
                {"h3", new[] {"style", "class"}},
                {"h4", new[] {"style", "class"}},
                {"h5", new[] {"style", "class"}},
                {"h6", new[] {"style", "class"}},
                {"font", new[] {"style", "class", "color", "face", "size"}},
                {"strong", new[] {"style", "class"}},
                {"b", new[] {"style", "class"}},
                {"em", new[] {"style", "class"}},
                {"i", new[] {"style", "class"}},
                {"u", new[] {"style", "class"}},
                {"strike", new[] {"style", "class"}},
                {"ol", new[] {"style", "class"}},
                {"ul", new[] {"style", "class"}},
                {"li", new[] {"style", "class"}},
                {"blockquote", new[] {"style", "class"}},
                {"code", new[] {"style", "class"}},
                {"a", new[] {"style", "class", "href", "title"}},
                {
                    "img", new[]
                    {
                        "style", "class", "src", "height", "width",
                        "alt", "title", "hspace", "vspace", "border"
                    }
                },
                {"table", new[] {"style", "class"}},
                {"thead", new[] {"style", "class"}},
                {"tbody", new[] {"style", "class"}},
                {"tfoot", new[] {"style", "class"}},
                {"th", new[] {"style", "class", "scope"}},
                {"tr", new[] {"style", "class"}},
                {"td", new[] {"style", "class", "colspan"}},
                {"q", new[] {"style", "class", "cite"}},
                {"cite", new[] {"style", "class"}},
                {"abbr", new[] {"style", "class"}},
                {"acronym", new[] {"style", "class"}},
                {"del", new[] {"style", "class"}},
                {"ins", new[] {"style", "class"}}
            };

        public static string GetSummary(SyndicationItem item)
        {
            var summary = item.Summary != null && item.Summary.Text != null ?
                          (item.Summary.Text) :
                          string.Empty;
            if (string.IsNullOrEmpty(summary) && item.Content is TextSyndicationContent)
                summary = ((TextSyndicationContent)item.Content).Text;

            return DeleteImages(summary);
        }

        public static string GetImage(SyndicationItem item, bool searchInSummary)
        {
            string feedDataImage = null;
            try
            {
                foreach (SyndicationLink link in from link in item.Links
                                                 let linkImagen = link.Uri.AbsoluteUri.ToLower()
                                                 where linkImagen.Contains(".jpg") || linkImagen.Contains(".jpeg") || linkImagen.Contains(".png") || linkImagen.Contains(".gif")
                                                 select link)
                {
                    feedDataImage = link.Uri.AbsoluteUri;
                }

                if (string.IsNullOrEmpty(feedDataImage))
                    foreach (var link in from link in item.ElementExtensions
                                         let linkImagen = link.OuterName.ToLower()
                                         where linkImagen.Contains(".jpg") || linkImagen.Contains(".jpeg") || linkImagen.Contains(".png") || linkImagen.Contains(".gif")
                                         select link)
                    {
                        feedDataImage = link.OuterName;
                    }

                if (string.IsNullOrEmpty(feedDataImage) && searchInSummary)
                {
                    if (item.Summary != null && item.Summary.Text.Contains("<img "))
                    {
                        string aux = item.Summary.Text.Substring(item.Summary.Text.IndexOf("<img ", StringComparison.Ordinal));
                        aux = aux.Substring(0, aux.IndexOf(">", StringComparison.Ordinal));
                        aux = aux.Substring(aux.IndexOf("src=", StringComparison.Ordinal));

                        if (aux.Contains("https")) aux = aux.Substring(aux.IndexOf("https", StringComparison.Ordinal));
                        else if (aux.Contains("http"))
                        {
                            aux = aux.Substring(aux.IndexOf("http", StringComparison.Ordinal));
                            if (aux.Contains(".jpg"))
                                feedDataImage = aux.Substring(0, aux.LastIndexOf(".jpg", StringComparison.Ordinal) + 4);
                            else if (aux.Contains(".png"))
                                feedDataImage = aux.Substring(0, aux.LastIndexOf(".png", StringComparison.Ordinal) + 4);
                            else if (aux.Contains(".jpeg"))
                                feedDataImage = aux.Substring(0, aux.LastIndexOf(".", StringComparison.Ordinal) + 5);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine("There was an error getting image from RSS. Error: {0}", ex);
            }
            return feedDataImage;
        }

        public static string GetExtraImage(SyndicationItem rssItem)
        {
            string feedMediaImage = null;
            try
            {
                SyndicationElementExtensionCollection extensions = rssItem.ElementExtensions;

                // Read extension items in order to find images: png, jpg preference to the bigger.
                if (extensions != null && extensions.Count > 0)
                {
                    var listImages = new List<XElement>();
                    // media:thumbnail and itunes
                    if (extensions.Any(p => p.OuterName == "thumbnail" || p.OuterName == "image"))
                    {
                        var extensionImages = new List<SyndicationElementExtension>(extensions.Where(p => p.OuterName == "thumbnail" || p.OuterName == "image"));
                        listImages.AddRange(extensionImages.Select(aux => new XElement(aux.GetObject<XElement>())));
                    }

                    if (listImages != null)
                    {
                        // Apply filter to get higher images.
                        var filteredImages = new List<XElement>();

                        foreach (XElement elem in listImages)
                        {
                            // 1.- Ask for .png - checking that the URL is an absolute URL.
                            if (elem.Attribute("url") != null && elem.Attribute("url").Value.ToLower().Contains("http")
                                                                && elem.Attribute("url").Value.ToLower().Contains("png"))
                            {
                                filteredImages.Add(elem);
                            }
                            else if (elem.Value.ToLower().Contains("http") && elem.Value.ToLower().Contains("png")) // in itunes the image url is not an attribute.
                            {
                                filteredImages.Add(elem);
                            }
                        }
                        if (filteredImages.Count == 0)
                        {
                            // 2.- Ask for .jpg - checking that the URL is an absolute URL.
                            foreach (XElement elem in listImages)
                            {
                                if (elem.Attribute("url") != null && elem.Attribute("url").Value.ToLower().Contains("http")
                                                                && elem.Attribute("url").Value.ToLower().Contains("jpg"))
                                {
                                    filteredImages.Add(elem);
                                }
                                else if (elem.Value.ToLower().Contains("http") && elem.Value.ToLower().Contains("jpg")) // in itunes the image url is not an attribute.
                                {
                                    filteredImages.Add(elem);
                                }
                            }
                        }
                        // 3.- Get the bigger.
                        if (filteredImages != null)
                        {
                            var compareImagesBySize = new Comparison<XElement>(CompareImagesBySize);
                            filteredImages.Sort(compareImagesBySize);
                            XElement resultImage = filteredImages.FirstOrDefault();
                            if (resultImage != null)
                                feedMediaImage = (resultImage.Attribute("url") != null) ? resultImage.Attribute("url").Value : resultImage.Value;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine("There was an error getting extra image from RSS. Error: {0}", ex);
            }

            return feedMediaImage;
        }

        public static string GetItemFeedLink(SyndicationItem item)
        {
			var link = string.Empty;
            try
            {
                if (item.Links != null && item.Links.Any())
                    link = item.Links.FirstOrDefault().Uri.AbsoluteUri;
                else
                {
                    // Read extensions in order to find feed link info, supported cases: wfw:commentRss, c9:feed.
                    if (item.ElementExtensions != null && item.ElementExtensions.Count > 0)
                    {
                        // commentRss
                        if (item.ElementExtensions.Count(p => p.OuterName == "commentRss") > 0)
                        {
                            SyndicationElementExtension ext = item.ElementExtensions.First(p => p.OuterName == "commentRss");
                            var elem = ext.GetObject<XElement>();
                            link = elem.Value;
                        }
                        // feed
                        if (link == string.Empty && item.ElementExtensions.Any(p => p.OuterName == "feed"))
                        {
                            SyndicationElementExtension ext = item.ElementExtensions.First(p => p.OuterName == "feed");
                            var elem = ext.GetObject<XElement>();
                            link = elem.Value;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine("There was an error getting feed item from RSS. Error: {0}", ex);
            }

            return link;
        }

        public static string GetMediaVideoURL(SyndicationItem item)
        {
            string mediaVideoUrl = string.Empty;

            try
            {
                SyndicationElementExtensionCollection extensions = item.ElementExtensions;

                // Read extension items in order to find videos -> media:content.
                if (extensions != null && extensions.Count > 0)
                {
                    // media:group & media:content's
                    if (extensions.Count(p => p.OuterName == "group") == 1)
                    {
                        SyndicationElementExtension extensionGroup = extensions.First(p => p.OuterName == "group");
                        if (extensionGroup != null)
                        {
                            XNode groupNode = XDocument.ReadFrom(extensionGroup.GetReader());
                            XDocument doc = XDocument.Parse(groupNode.ToString());
                            XNamespace media = "http://search.yahoo.com/mrss/";
                            // Get content subitems inside group.
                            var query = (from contentElem in doc.Descendants(media + "content")
                                         select contentElem);
                            List<XElement> listContent = query.ToList();

                            if (listContent.Count > 0)
                            {
                                // Filter by type "video/mp4" | "video/x-ms-wmv"
                                var videoElems = new List<XElement>(listContent.Where(c => c.Attribute("type").Value == "video/mp4" && c.Attribute("url").Value.ToUpper().Contains("HIGH")));

                                if (!videoElems.Any())
                                {
                                    videoElems = new List<XElement>(listContent.Where(c => c.Attribute("type").Value == "video/mp4"));
                                    if (!videoElems.Any())
                                    {
                                        videoElems = new List<XElement>(listContent.Where(c => c.Attribute("type").Value == "video/x-ms-wmv"));
                                    }
                                }
                                if (videoElems.Any() && videoElems.First().Attribute("url") != null)
                                {
                                    mediaVideoUrl = videoElems.First().Attribute("url").Value;
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine("There was an error getting media video from RSS. Error: {0}", ex);
            }

            return mediaVideoUrl;
        }

        private static int CompareImagesBySize(XElement elem1, XElement elem2)
        {
            int size1 = elem1.Attribute("width") != null ? int.Parse(elem1.Attribute("width").Value) : 0;
            if (size1 == 0)
            {
                size1 = elem1.Attribute("height") != null ? int.Parse(elem1.Attribute("height").Value) : 0;
            }

            int size2 = elem2.Attribute("width") != null ? int.Parse(elem2.Attribute("width").Value) : 0;
            if (size2 == 0)
            {
                size2 = elem1.Attribute("height") != null ? int.Parse(elem2.Attribute("height").Value) : 0;
            }

            return size2.CompareTo(size1);
        }

        private static string DeleteImages(string html)
        {
            const string pattern = @"<(img)[^>]*>(?<content>[^<]*)";
            var regex = new Regex(pattern);
            var m = regex.Match(html);
            if (m.Success)
            {
                string img = m.Value;
                html = html.Replace(img, string.Empty);
            }

            return html;
        }

		   /// <summary>
        ///     Takes raw HTML input and cleans against a whitelist
        /// </summary>
        /// <param name="source">Html source</param>
        /// <returns>Clean output</returns>
        public static string SanitizeHtml(string source)
        {
            HtmlDocument html = GetHtml(source);
            if (html == null) return String.Empty;

            // All the nodes
            HtmlNode allNodes = html.DocumentNode;

            // Select whitelist tag names
            string[] whitelist = (from kv in ValidHtmlTags
                select kv.Key).ToArray();

            // Scrub tags not in whitelist
            CleanNodes(allNodes, whitelist);

            // Filter the attributes of the remaining
            foreach (var tag in ValidHtmlTags)
            {
                IEnumerable<HtmlNode> nodes = (from n in allNodes.DescendantsAndSelf()
                    where n.Name == tag.Key
                    select n);

                foreach (HtmlNode n in nodes)
                {
                    if (!n.HasAttributes) continue;

                    // Get all the allowed attributes for this tag
                    HtmlAttribute[] attr = n.Attributes.ToArray();
                    foreach (HtmlAttribute a in attr)
                    {
                        if (!tag.Value.Contains(a.Name))
                        {
                            a.Remove(); // Wasn't in the list
                        }
                    }
                }
            }

            return allNodes.InnerHtml;
        }

        /// <summary>
        ///     Takes a raw source and removes all HTML tags
        /// </summary>
        /// <param name="source"></param>
        /// <returns></returns>
        public static string StripHtml(string source)
        {
            source = SanitizeHtml(source);

            // No need to continue if we have no clean Html
            if (String.IsNullOrEmpty(source))
                return String.Empty;

            HtmlDocument html = GetHtml(source);
            var result = new StringBuilder();

            // For each node, extract only the innerText
            foreach (HtmlNode node in html.DocumentNode.ChildNodes)
                result.Append(node.InnerText);

            return result.ToString();
        }

        /// <summary>
        ///     Recursively delete nodes not in the whitelist
        /// </summary>
        private static void CleanNodes(HtmlNode node, string[] whitelist)
        {
            if (node.NodeType == HtmlNodeType.Element)
            {
                if (!whitelist.Contains(node.Name))
                {
                    node.ParentNode.RemoveChild(node);
                    return; // We're done
                }
            }

            if (node.HasChildNodes)
                CleanChildren(node, whitelist);
        }

        /// <summary>
        ///     Apply CleanNodes to each of the child nodes
        /// </summary>
        private static void CleanChildren(HtmlNode parent, string[] whitelist)
        {
            for (int i = parent.ChildNodes.Count - 1; i >= 0; i--)
                CleanNodes(parent.ChildNodes[i], whitelist);
        }

        /// <summary>
        ///     Helper function that returns an HTML document from text
        /// </summary>
        private static HtmlDocument GetHtml(string source)
        {
            var html = new HtmlDocument();
            html.OptionFixNestedTags = true;
            html.OptionAutoCloseOnEnd = true;
            html.OptionDefaultStreamEncoding = Encoding.UTF8;

            html.LoadHtml(source);

            return html;
        }
    }
}


text:
package org.unitedid.yhsm.internal;

import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
import org.unitedid.yhsm.SetupCommon;
import org.unitedid.yhsm.utility.Utils;

import static org.testng.Assert.assertEquals;
import static org.unitedid.yhsm.internal.Defines.YSM_ECHO;

public class DeviceHandlerTest extends SetupCommon {

    @BeforeTest
    public void setUp() throws Exception {
        super.setUp();
    }

    @AfterTest
    public void tearDown() throws Exception {
        super.tearDown();
    }

    @Test
    public void testDrainClearInput() throws YubiHSMErrorException {
        CommandHandler.execute(deviceHandler, YSM_ECHO, Utils.addLengthToData("ekoeko".getBytes()), false);
        assertEquals(deviceHandler.available(), 9);
        deviceHandler.drain();
        assertEquals(deviceHandler.available(), 0);
    }
}


text:
package cefet.rba.chromossome;

public class MagicSquareChromosomeFactory implements ChromosomeFactory<Integer> {

	private final int squareSide;

	public MagicSquareChromosomeFactory(int squareSide) {
		this.squareSide = squareSide;
	}

	@Override
	public Chromosome<Integer> makeIt() {
		return new MagicSquareChromosome(squareSide);
	}
}


text:
/**
 * @author Petru Cojocar <petru.cojocar@gmail.com>.
 */

try { angular.module('Web.Components') } catch(err) { angular.module('Web.Components', []) }

angular.module('Web.Components')
    .factory('Web.Components.DataSource', [
        '$rootScope',
        function ($rootScope)
        {
            var DataSource = {
                /**
                 * NON Singleton Object Instance
                 * @returns {*}
                 * @constructor
                 */
                Instance : function ()
                {
                    var $private = {
                        // current request
                        request: null,
                        // headers parsers
                        parseResponseHeaders: function (headerStr)
                        {
                            var headers = {};
                            if (!headerStr) {
                                return headers;
                            }
                            var headerPairs = headerStr.split('\u000d\u000a');
                            for (var i = 0; i < headerPairs.length; i++) {
                                var headerPair = headerPairs[i];
                                // Can't use split() here because it does the wrong thing
                                // if the header value has the string ": " in it.
                                var index = headerPair.indexOf('\u003a\u0020');
                                if (index > 0) {
                                    var key = headerPair.substring(0, index);
                                    var val = headerPair.substring(index + 2);
                                    headers[key] = val;
                                }
                            }

                            return headers;
                        }
                    };

                    var $this = {
                        /**
                         * Request Config for the AJAX request
                         */
                        requestConfig: {
                            method: 'GET',
                            url: null,
                            contentType: 'application/json', // data format sent TO server
                            dataType: 'json', // data format received FROM server
                            data: null,
                            headers: {},
                            cache: false,
                            timeout: 1000 * 60 * 5 // 5 minutes timeout
                        },

                        /**
                         * Loading state: true:loading / false:not loading
                         */
                        state: false,

                        /**
                         * Parameters that will be added to the request
                         * @type {*}
                         */
                        params: {}
                    };

                    /**
                     * Default response handler (does nothing)
                     * @param data
                     * @param status
                     * @param headers
                     */
                    $private.responseHandler = function (data, status, headers)
                    {
                        $this.state = false;
                    };

                    /**
                     * Make a new request
                     * @returns {{promise: null, timeoutExpired: boolean, abortTimer: Number, abortPromise: Deferred, aborted: boolean, abort: abort}}
                     */
                    $private.makeNewRequest = function ()
                    {
                        var requestConfig = _.deepClone($this.requestConfig);

                        var request = $.ajax(requestConfig.url,
                            {
                                type: requestConfig.method,
                                contentType: requestConfig.contentType,
                                dataType: requestConfig.dataType,
                                timeout: requestConfig.timeout,
                                headers: requestConfig.headers,
                                data: requestConfig.data ? JSON.stringify(requestConfig.data) : null,
                                success: function (responsePayload, status, jqXHR) {
                                    // update state
                                    $this.state = false;

                                    $private.responseHandler.apply($private.responseHandler, [responsePayload, status, $private.parseResponseHeaders(jqXHR.getAllResponseHeaders())]);

                                    $rootScope.$applyAsync();

                                    // clear the current request
                                    $private.request = null;
                                },
                                error: function (jqXHR, status, error) {
                                    // update state
                                    $this.state = false;

                                    if (status === 500) {
                                        $private.responseHandler.apply($private.responseHandler, [null, status, $private.parseResponseHeaders(jqXHR.getAllResponseHeaders())]);
                                    } else {
                                        $private.responseHandler.apply($private.responseHandler, [false, status, $private.parseResponseHeaders(jqXHR.getAllResponseHeaders())]);
                                    }

                                    $rootScope.$applyAsync();

                                    // clear the current request
                                    $private.request = null;
                                }
                            });

                        return request;
                    };

                    /**
                     * Initiate the loading data
                     * @param callback
                     */
                    $this.load = function (callback)
                    {
                        // overwrite existing callback ?
                        if (typeof(callback) !== 'undefined' && _.isFunction(callback)) {
                            $this.setResponseHandler(callback);
                        }

                        // handle parameters
                        _.deepExtend($this.params, $this.requestConfig['data']);
                        if (_.size($this.params) > 0) {
                            $this.requestConfig['data'] = $this.params;
                        }

                        // if there is a request in progress then we will abort it
                        if (!_.isNull($private.request)) {
                            $private.request.abort();
                        }
                        // create new request
                        $private.request = $private.makeNewRequest();

                        // update state
                        $this.state = true;
                    };

                    /**
                     * Set response handler
                     * @param callback
                     */
                    $this.setResponseHandler = function (callback)
                    {
                        if (typeof(callback) !== 'undefined' && _.isFunction(callback)) {
                            $private.responseHandler = callback;
                        } else {
                            throw 'DataSource::Response Handler is not valid ['+callback+']';
                        }
                    };

                    /**
                     * Get current response handler
                     * @returns {responseHandler|*|$private.responseHandler}
                     */
                    $this.getResponseHandler = function ()
                    {
                        return $private.responseHandler;
                    };

                    /**
                     * Set the config params for AJAX request
                     * @param params
                     */
                    $this.setRequestConfig = function (params)
                    {
                        _.deepExtend($this.requestConfig, params);
                    };

                    /**
                     * Add parameter to datasource
                     * @param paramName
                     * @param paramExpression
                     * @param reload
                     * @returns {*}
                     */
                    $this.addParam = function (paramName, paramExpression, reload)
                    {
                        $this.params[paramName] = paramExpression;

                        if (typeof(reload) !== 'undefined' && reload) {
                            return $this.load();
                        }
                    };

                    /**
                     * Remove a parameter
                     * @param paramName
                     * @param reload
                     * @returns {*}
                     */
                    $this.clearParam = function (paramName, reload)
                    {
                        $this.params[paramName] = null;

                        if (typeof(reload) !== 'undefined' && reload) {
                            return $this.load();
                        }
                    };

                    /**
                     * Get all parameters
                     * @returns {{}|*}
                     */
                    $this.getParams = function ()
                    {
                        return $this.params;
                    };

                    /**
                     * Clear all parameters
                     * @param reload
                     * @returns {*}
                     */
                    $this.resetParams = function (reload)
                    {
                        $this.params = {};

                        if (typeof(reload) !== 'undefined' && reload) {
                            return $this.load();
                        }
                    };

                    return $this;
                }
            };

            return DataSource;
        }
    ]);


text:
@interface ZKSaveResult : ZKXmlDeserializer {
}

- (NSString *)id;
- (BOOL)success;
- (NSString *)statusCode;
- (NSString *)message;

@end


text:
package pubsub.transport.channel.source;

import java.util.HashMap;
import java.util.Map;
import pubsub.ForwardIdentifier;

/**
 *
 * @author John Gasparis
 */
public class StreamInfoMap {

    private Map<Integer, ForwardIdentifier> map;

    public StreamInfoMap() {
        map = new HashMap<Integer, ForwardIdentifier>();
    }

    public void put(int id, ForwardIdentifier fid) {
        ForwardIdentifier temp = fid;
        if (map.containsKey(id)) {
            temp = map.get(id);
            temp.getBloomFilter().or(fid.getBloomFilter());
        }

        map.put(id, temp);
    }

    public ForwardIdentifier get(int id) {
        return map.get(id);
    }
}