text:
using System.Xml;
using Nancy.Authentication.Basic;

namespace BrightstarDB.Server.Modules.Authentication
{
    public interface IConfigurableUserValidator : IUserValidator
    {
        void Configure(XmlElement configurationElement);
    }
}

redpajama_set_name: RedPajamaGithub


text:
package rpraut.osgi.api.entity;

import com.hazelcast.nio.ObjectDataInput;
import com.hazelcast.nio.ObjectDataOutput;
import com.hazelcast.nio.serialization.Portable;
import com.hazelcast.nio.serialization.PortableReader;
import com.hazelcast.nio.serialization.PortableWriter;

import java.io.IOException;
import java.time.LocalDateTime;
import java.util.Calendar;
import java.util.Date;
import java.util.Objects;

/**
 * The type Employee.
 */
public class Employee implements Portable {

    private Integer id;
    private String name;
    private int age;
    private LocalDateTime localDateTime;
    private Calendar calendar;
    private Date date;

    /**
     * Gets id.
     *
     * @return the id
     */
    public Integer getId() {
        return id;
    }

    /**
     * Sets id.
     *
     * @param id the id
     */
    public void setId(Integer id) {
        this.id = id;
    }

    /**
     * Gets name.
     *
     * @return the name
     */
    public String getName() {
        return name;
    }

    /**
     * Sets name.
     *
     * @param name the name
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * Gets age.
     *
     * @return the age
     */
    public int getAge() {
        return age;
    }

    /**
     * Sets age.
     *
     * @param age the age
     */
    public void setAge(int age) {
        this.age = age;
    }

    /**
     * Gets local date time.
     *
     * @return the local date time
     */
    public LocalDateTime getLocalDateTime() {
        return localDateTime;
    }

    /**
     * Sets local date time.
     *
     * @param localDateTime the local date time
     */
    public void setLocalDateTime(LocalDateTime localDateTime) {
        this.localDateTime = localDateTime;
    }

    /**
     * Gets calendar.
     *
     * @return the calendar
     */
    public Calendar getCalendar() {
        return calendar;
    }

    /**
     * Sets calendar.
     *
     * @param calendar the calendar
     */
    public void setCalendar(Calendar calendar) {
        this.calendar = calendar;
    }

    /**
     * Gets date.
     *
     * @return the date
     */
    public Date getDate() {
        return date;
    }

    /**
     * Sets date.
     *
     * @param date the date
     */
    public void setDate(Date date) {
        this.date = date;
    }

    @Override
    public int getFactoryId() {
        return 0;
    }

    @Override
    public int getClassId() {
        return 0;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Employee employee = (Employee) o;
        return age == employee.age &&
                Objects.equals(id, employee.id) &&
                Objects.equals(name, employee.name) &&
                Objects.equals(localDateTime, employee.localDateTime) &&
                Objects.equals(calendar, employee.calendar) &&
                Objects.equals(date, employee.date);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, name, age, localDateTime, calendar, date);
    }

    @Override
    public void writePortable(PortableWriter out) throws IOException {
        out.writeUTF("name", name);
        out.writeInt("age", age);
        ObjectDataOutput rawDataOutput = out.getRawDataOutput();
        rawDataOutput.writeObject(id);
        rawDataOutput.writeObject(localDateTime);
        rawDataOutput.writeObject(calendar);
        rawDataOutput.writeObject(date);
    }

    @Override
    public void readPortable(PortableReader in) throws IOException {
        this.name = in.readUTF("name");
        this.age = in.readInt("age");
        ObjectDataInput rawDataInput = in.getRawDataInput();
        this.id = rawDataInput.readObject();
        this.localDateTime = rawDataInput.readObject();
        this.calendar = rawDataInput.readObject();
        this.date = rawDataInput.readObject();
    }

}


text:
package kina.testutils;

import java.io.Serializable;
import java.lang.reflect.Field;
import java.math.BigInteger;
import java.util.*;

import kina.entity.KinaType;
import kina.exceptions.GenericException;
import kina.exceptions.IOException;
import kina.testentity.CommonsTestEntity;
import kina.utils.Utils;
import org.testng.annotations.Test;

import static kina.utils.Utils.*;
import static org.testng.Assert.*;

public class UtilsTest {
    private static final String OUTPUT_KEYSPACE_NAME = "out_test_keyspace";
    private static final String OUTPUT_COLUMN_FAMILY = "out_test_page";

    class NotInstantiable implements KinaType {

        private static final long serialVersionUID = -3311345712290429412L;
    }

    @Test
    public void testAdditionalFilters() {
        assertEquals(additionalFilterGenerator(null), "");

        Map<String, Serializable> map = new TreeMap<>();
        assertEquals(additionalFilterGenerator(map), "");

        map.put("integer", 0L);
        assertEquals(additionalFilterGenerator(map), " AND \"integer\" = 0");
        map.remove("integer");

        map.put("lucene", null);

        assertEquals(additionalFilterGenerator(map), "");

        String filter = "address:* AND NOT address:*uropa*";

        map.put("lucene", filter);

        assertEquals(additionalFilterGenerator(map), " AND \"lucene\" = \'address:* AND NOT address:*uropa*\'");

        filter = "'address:* AND NOT address:*uropa*";

        map.put("lucene", filter);

        assertEquals(additionalFilterGenerator(map), " AND \"lucene\" = \'address:* AND NOT address:*uropa*\'");

        filter = "address:* AND NOT address:*uropa*'";

        map.put("lucene", filter);

        assertEquals(additionalFilterGenerator(map), " AND \"lucene\" = \'address:* AND NOT address:*uropa*\'");

        filter = "'address:* AND NOT address:*uropa*'";

        map.put("lucene", filter);

        assertEquals(additionalFilterGenerator(map), " AND \"lucene\" = \'address:* AND NOT address:*uropa*\'");
    }

    @Test
    public void testNewTypeInstance() {
        try {
            newTypeInstance(NotInstantiable.class);

            fail();
        } catch (GenericException e) {
            // OK
        } catch (Exception e) {
            fail();
        }

        Utils.newTypeInstance(CommonsTestEntity.class);
    }

    @Test
    public void testSingleQuote() {
        assertEquals(singleQuote(""), "");
        assertEquals(singleQuote("test"), "'test'");

        assertEquals(singleQuote(" test "), "'test'");
        assertEquals(singleQuote(" 'test'       "), "'test'");
        assertEquals(singleQuote("'test''"), "'test''");
    }

    @Test
    public void testQuote() {
        assertEquals(quote(""), "");

        assertEquals(quote("test"), "\"test\"");

        assertEquals(quote(" test "), "\"test\"");
        assertEquals(quote(" \"test\"       "), "\"test\"");
        assertEquals(quote("'test''"), "\"'test''\"");
    }

    @Test
    public void testBatchQueryGenerator() {
        String stmt1 = "CREATE TABLE " + OUTPUT_KEYSPACE_NAME + "." + OUTPUT_COLUMN_FAMILY +
                " (\"id1\" timeuuid, \"domain_name\" text, \"url\" text, " +
                "\"response_time\" bigint, \"response_code\" int, \"download_time\" timestamp, " +
                "PRIMARY KEY (\"id1\"));";

        String stmt2 = "UPDATE "
                + OUTPUT_KEYSPACE_NAME
                + "."
                + OUTPUT_COLUMN_FAMILY
                + " SET \"domain_name\" = ?, \"url\" = ?, \"response_time\" = ?, \"response_code\" = ?, " +
                "\"download_time\" = ? WHERE \"id1\" = ? AND \"id2\" = ?;";

        String stmt3 = "CREATE TABLE " + OUTPUT_KEYSPACE_NAME + "." + OUTPUT_COLUMN_FAMILY +
                " (\"id1\" timeuuid, \"domain_name\" text, \"url\" text, " +
                "\"response_time\" bigint, \"response_code\" int, \"download_time\" timestamp, " +
                "PRIMARY KEY (\"id1\"));";

        List<String> stmts = Arrays.asList(stmt1, stmt2, stmt3);

        String batch = batchQueryGenerator(stmts);

        assertEquals(batch,
                "BEGIN BATCH \n" + stmt1 + "\n" + stmt2 + "\n" + stmt3 + "\n" + " APPLY BATCH;");
    }

    @Test
    public void testFindSetter() {
        try {
            findSetter("not_existent_field", TestSetterClass.class, BigInteger.class);

            fail();
        } catch (IOException e) {
            // ok;
        }

        try {
            findSetter("description", TestSetterClass.class, String.class);

            fail();
        } catch (IOException e) {
            // ok;
        }

        assertNotNull(findSetter("id", TestSetterClass.class, Integer.class));
        assertNotNull(findSetter("uuid", TestSetterClass.class, UUID.class));
        assertNotNull(findSetter("scalalong", TestSetterClass.class, Long.class));
    }

    @Test
    public void testGetAllFields() {
        Field[] fields = getAllFields(CommonsTestEntity.class);
        assertTrue(fields.length >= 11);
    }

    class TestSetterClass implements KinaType {
        private Integer id;
        private UUID uuid;
        private String description;

        private Long scalalong;

        public Long getScalalong() {
            return scalalong;
        }

        public void scalalong_$eq(Long scalalong) {
            this.scalalong = scalalong;
        }

        public Integer getId() {
            return id;
        }

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

        public UUID getUuid() {
            return uuid;
        }

        public void setUuid(UUID uuid) {
            this.uuid = uuid;
        }

        public String getDescription() {
            return description;
        }
    }
}


text:
def pre_listen(task_id, transport, attrs):
    res = None
    for (scope, name, value) in attrs:
        print "# (%s, %s, %s)" % (scope, name, value)
        if scope == 'python':
            if name == 'test_func' and value != "pre_listen":
                raise "pre_listen called when ", value, " expected"
            elif name == 'expected_result':
                print "# evaluating", value
                exec value
    print "# res =", res
    return res

def post_listen(task_id, transport, local_contact, attrs):
    print "# task_id =", str(task_id)
    print "# transport =", str(transport)
    print "# local_contact =", str(local_contact)
    print "# attrs =", str(attrs)
    res = None
    for (scope, name, value) in attrs:
        print "# (%s, %s, %s)" % (scope, name, value)
        if scope == 'python':
            if name == 'test_func' and value != "post_listen":
                raise "post_listen called when ", value, " expected"
            elif name == 'expected_result':
                print "# evaluating", value
                exec value
    print "# res =", res
    return res

def end_listen(task_id, transport, local_contact, attrs):
    print "# task_id =", str(task_id)
    print "# transport =", str(transport)
    print "# local_contact =", str(local_contact)
    print "# attrs =", str(attrs)
    res = None
    for (scope, name, value) in attrs:
        print "# (%s, %s, %s)" % (scope, name, value)
        if scope == 'python':
            if name == 'test_func' and value != "end_listen":
                raise "post_listen called when ", value, " expected"
            elif name == 'expected_result':
                print "# evaluating", value
                exec value
    print "# res =", res
    return res

def pre_accept(task_id, transport, local_contact, attrs):
    print "# task_id =", str(task_id)
    print "# transport =", str(transport)
    print "# local_contact =", str(local_contact)
    print "# attrs =", str(attrs)
    res = None
    for (scope, name, value) in attrs:
        print "# (%s, %s, %s)" % (scope, name, value)
        if scope == 'python':
            if name == 'test_func' and value != "pre_accept":
                raise "pre_accept called when ", value, " expected"
            elif name == 'expected_result':
                print "# evaluating", value
                exec value
    print "# res =", res
    return res

def post_accept(task_id, transport, local_contact, remote_contact, attrs):
    print "# task_id =", str(task_id)
    print "# transport =", str(transport)
    print "# local_contact =", str(local_contact)
    print "# remote_contact =", str(remote_contact)
    print "# attrs =", str(attrs)
    res = None
    for (scope, name, value) in attrs:
        print "# (%s, %s, %s)" % (scope, name, value)
        if scope == 'python':
            if name == 'test_func' and value != "post_accept":
                raise "post_accept called when ", value, " expected"
            elif name == 'expected_result':
                print "# evaluating", value
                exec value
    print "# res =", res
    return res

def pre_connect(task_id, transport, remote_contact, attrs):
    print "# task_id =", str(task_id)
    print "# transport =", str(transport)
    print "# remote_contact =", str(remote_contact)
    print "# attrs =", str(attrs)
    res = None
    for (scope, name, value) in attrs:
        print "# (%s, %s, %s)" % (scope, name, value)
        if scope == 'python':
            if name == 'test_func' and value != "pre_connect":
                raise "pre_connect called when ", value, " expected"
            elif name == 'expected_result':
                print "# evaluating", value
                exec value
    print "# res =", res
    return res

def post_connect(task_id, transport, local_contact, remote_contact, attrs):
    print "# task_id =", str(task_id)
    print "# transport =", str(transport)
    print "# local_contact =", str(local_contact)
    print "# remote_contact =", str(remote_contact)
    print "# attrs =", str(attrs)
    res = None
    for (scope, name, value) in attrs:
        print "# (%s, %s, %s)" % (scope, name, value)
        if scope == 'python':
            if name == 'test_func' and value != "post_connect":
                raise "post_connect called when ", value, " expected"
            elif name == 'expected_result':
                print "# evaluating", value
                exec value
    print "# res =", res
    return res

def pre_close(task_id, transport, local_contact, remote_contact, attrs):
    print "# task_id =", str(task_id)
    print "# transport =", str(transport)
    print "# local_contact =", str(local_contact)
    print "# remote_contact =", str(remote_contact)
    print "# attrs =", str(attrs)
    res = None
    for (scope, name, value) in attrs:
        print "# (%s, %s, %s)" % (scope, name, value)
        if scope == 'python':
            if name == 'test_func' and value != "pre_close":
                raise "pre_close called when ", value, " expected"
            elif name == 'expected_result':
                print "# evaluating", value
                exec value
    print "# res =", res
    return res

def post_close(task_id, transport, local_contact, remote_contact, attrs):
    print "# task_id =", str(task_id)
    print "# transport =", str(transport)
    print "# local_contact =", str(local_contact)
    print "# remote_contact =", str(remote_contact)
    print "# attrs =", str(attrs)
    res = None
    for (scope, name, value) in attrs:
        print "# (%s, %s, %s)" % (scope, name, value)
        if scope == 'python':
            if name == 'test_func' and value != "post_close":
                raise "post_close called when ", value, " expected"
            elif name == 'expected_result':
                print "# evaluating", value
                exec value
    print "# res =", res
    return res


text:
"use strict";
/*
	- CommentBox
        - CommentList
          - Comment
        - CommentForm
*/
var CommentBox = React.createClass({

	loadCommentsFromServer: function(){
		$.ajax({
			url:this.props.url,
			dataType:'json',
			cache:false,
			success:function(data){
				this.setState({data:data});
			}.bind(this),
			error: function(xhr,status,err){
				console.error(this.props.url,status,err.toString());
			}.bind(this)
		});
	},

	handleCommentSubmit: function(comment) {
		var comments = this.state.data;
	    var newComments = comments.concat([comment]);
	    this.setState({data: newComments});
    	$.ajax({
	      url: this.props.url,
	      dataType: 'json',
	      type: 'POST',
	      data: comment,
	      success: function(data) {
	        this.setState({data: data});
	      }.bind(this),
	      error: function(xhr, status, err) {
	        console.error(this.props.url, status, err.toString());
	      }.bind(this)
	    });
  	},

	getInitialState: function(){
		return {data:[]};
	},

	componentDidMount: function(){
		this.loadCommentsFromServer();
    	setInterval(this.loadCommentsFromServer, this.props.pollInterval);
	},

    render: function() {
  	//add component CommentList and CommentBox
        return (

Comments

				<CommentList data={this.state.data}/>
				<CommentForm onCommentSubmit={this.handleCommentSubmit} />

        );
    }
});

var CommentList = React.createClass({

	render: function(){
		var commentNodes = this.props.data.map(function(comment){
			return(

				<Comment author={comment.author}>
					{comment.text}
				</Comment>

			);
		});
		return (

				CommentList
		        {commentNodes}

		);
	}
});

var CommentForm = React.createClass({

	handleSubmit: function(e){
		e.preventDefault();
		var author = this.refs.author.value.trim();
		var text = this.refs.text.value.trim();
		if(!text || !author){
			return;
		}
		//TODO: send request to the server
		this.props.onCommentSubmit({author: author, text: text});
		this.refs.author.value = '';
		this.refs.text.value = '';
		return;
	},

	render: function(){
		return (
			<form className="commentForm" onSubmit={this.handleSubmit}>
				CommentForm
				<input type="text" placeholder="Your name" ref="author"/>
				<textarea type="text" placeholder="Say something..." ref="text"/>
				<input type="submit" value="Post"/>
			</form>
		);
	}
});

var Comment = React.createClass({
	//protect from an XSS attack
	rawMarkup: function() {
		var rawMarkup = marked(this.props.children.toString(),{sanitize:true});
		return { __html:rawMarkup };
	},
	render: function(){
		//using propieties author and markup
		return (

					{this.props.author}

		);
	}
});

var data = [
	{author: "First Comment", text: "This is one comment"},
	{author: "Another Comment", text: "This is *another* comment"}
];

//rederize Main Component "CommentBox"
ReactDOM.render(
	<CommentBox url="/api/comments" pollInterval={2000}/>,
	document.getElementById("myContent")
	);


text:
/**
 * A repository implementation for the sql database and set_user data store.
 */
define([ 'private/framework/repository/base_sql_repository',
		 'private/domain/repository/i_set_user_repository',
		 'framework/core/utils/clazz',
		 'domain/entity/set_user' ],
function(BaseSqlRepository,
		 ISetUserRepository,
		 ClazzUtils,
		 SetUser)
{
	var SetUserSqlRepository = function()
		{
			BaseSqlRepository.call(this);
			this._tableName = 'set_users';
			this._entityClazz = SetUser;
			this._setRepository = null;

			this.__innerJoinSql = ' INNER JOIN sets ON set_users.focusSetId = sets.id';
			this.__orderBySql = ' ORDER BY sets.dateReleased ASC';

			return this;
		};

 	SetUserSqlRepository.prototype = new BaseSqlRepository();
	ClazzUtils.generateProperties(SetUserSqlRepository);
	ClazzUtils.inheritProperties(SetUserSqlRepository, ISetUserRepository);

	// @override
	SetUserSqlRepository.prototype._getTableMapping = function()
	{
		return [
			{ name: 'id', type: 'integer' },
			{ name: 'focusSetId', type: 'integer' },
			{ name: 'userId', type: 'integer' },
			{ name: 'needAll', type: 'integer' },
			{ name: 'needMythics', type: 'integer' },
			{ name: 'needRares', type: 'integer' },
			{ name: 'needUncommons', type: 'integer' },
			{ name: 'needCommons', type: 'integer' },
			{ name: 'needLands', type: 'integer' },
			{ name: 'ownAll', type: 'integer' },
			{ name: 'ownMythics', type: 'integer' },
			{ name: 'ownRares', type: 'integer' },
			{ name: 'ownUncommons', type: 'integer' },
			{ name: 'ownCommons', type: 'integer' },
			{ name: 'ownLands', type: 'integer' },
			{ name: 'priceSet', type: 'float' },
			{ name: 'priceAll', type: 'float' },
			{ name: 'priceOwn', type: 'float' },
			{ name: 'priceNeed', type: 'float' },
			{ name: 'priceDateAcquired', type: 'date' },
			{ name: 'valid', type: 'boolean' },
			{ name: 'dateAdded', type: 'date' },
			{ name: 'dateChanged', type: 'date' }
		];
	};

	// @override
	SetUserSqlRepository.prototype.getByUserId = function(userId)
	{
		var sql = this._createSelectPrefix() + this.__innerJoinSql,
			setSelectList = this._setRepository._createSelectPrefix().split(' FROM ')[0];

		// Remove the select, id, valid, dateAdded, dateChanged from the setSelectList.
		setSelectList = setSelectList.split(', ');
		setSelectList = setSelectList.slice(1, setSelectList.length - 3);
		setSelectList = setSelectList.join(', ');

		sql = sql.replace(/FROM/, ',' + setSelectList + ' FROM')

		return this._queryAll({ 'set_users.userId': userId }, sql, this.__orderBySql);
	};

	// @override
	SetUserSqlRepository.prototype.getBySetIdAndUserId = function(setId, userId)
	{
		return this._querySingle({ focusSetId: setId, userId: userId });
	};

	return SetUserSqlRepository;
});


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using System.Data.SqlTypes;
using System.Data;
using Microsoft.SqlServer.Server;
using System.Text.RegularExpressions;
using System.Web;
namespace Rendition {
	public partial class Commerce {
		/// <summary>
		/// A category consists of a list of items.
		/// </summary>
		public class Category {
            #region Static Properties
            /// <summary>
            /// Gets all categories.
            /// </summary>
            public static List<Category> All {
                get {
                    return Main.Site.Categories.List;
                }
            }
            #endregion
            #region Instance Properties
            /// <summary>
			/// The name of the category.
			/// </summary>
            public string Name { get; internal set; }
			/// <summary>
			/// The id of the category.
			/// </summary>
            public Guid Id { get; internal set; }
			/// <summary>
			/// The list of items in this category.
			/// </summary>
            public List<Item> Items { get; internal set; }
            /// <summary>
            /// When true the category is visible to the public.
            /// </summary>
            public bool Enabled { get; internal set; }
            /// <summary>
            /// The Regex object for the category rewriter.
            /// </summary>
            internal Regex URLMatch = null;
            #endregion
            #region Constructors
            /// <summary>
			/// Initializes a new instance of the <see cref="Category"/> class.
			/// </summary>
			/// <param name="categoryName">Name of the category.</param>
			/// <param name="categoryId">The category id.</param>
            /// <param name="enabled">When true the category is enabled.</param>
			public Category( string categoryName, Guid categoryId, bool enabled ) {
                Items = new List<Item>();
				this.Id = categoryId;
				this.Name = categoryName.Trim();
                this.Enabled = enabled;
                URLMatch = new Regex(String.Format(Main.CategoryRewrite,
                    Name,
                    Id, Name.Replace(" ", "-"),
                    Name.Replace(" ", "_"),
                    Name.Replace(" ", ".")));
            }
            #endregion
            #region Static Methods
            /// <summary>
            /// Gets the category by name.
            /// </summary>
            /// <param name="f_categoryName">Name of the f_category.</param>
            /// <returns></returns>
            public static Category GetCategoryByName(string f_categoryName) {
                return Main.Site.Categories.GetCategoryByName(f_categoryName);
            }
            /// <summary>
            /// Gets the category by id.
            /// </summary>
            /// <param name="f_categoryId">The f_category id.</param>
            /// <returns></returns>
            public static Category GetCategoryById(Guid f_categoryId) {
                return Main.Site.Categories.GetCategoryById(f_categoryId);
            }
            #endregion
        }
		/// <summary>
		/// This class creates a list of categories and associated items.
		/// This class, when instantiated, connects to the data base and
		/// refreshes the list of items in categories.
		/// This list can be refreshed using the Rendition.Admin.refreshCategoriesCache() method.
		/// </summary>
		internal class Categories {
            #region Instance Fields
            /// <summary>
			/// List of categories.
			/// </summary>
			public List<Category> List = new List<Category>();
			private Guid CurrentId = Guid.NewGuid();
			private Category Cat;
			private Item I;
            #endregion
            #region Instance Methods
            /// <summary>
			/// Gets the category by looking up the name in the database.
			/// </summary>
			/// <param name="f_categoryName">Name of the category.</param>
			/// <returns>Selected category or null</returns>
			public Category GetCategoryByName( string f_categoryName ) {
				if( f_categoryName == null ) { return null; };
				return List.Find( delegate( Category c1 ) {
					return c1.Name.Trim().ToLower() == f_categoryName.Trim().ToLower();
				} );
			}
			/// <summary>
			/// Gets the category by its id in the database.
			/// </summary>
			/// <param name="f_categoryId">The category id.</param>
			/// <returns>Selected category or null</returns>
			public Category GetCategoryById( Guid f_categoryId ) {
				return List.Find( delegate( Category c1 ) {
					return c1.Id == f_categoryId;
				} );
			}
            #endregion
            #region Constructor
            /// <summary>
			/// Initializes a new instance of the <see cref="Categories"/> class.
			/// </summary>
			/// <param name="site">The site.</param>
			public Categories( Site site ) {
                using(SqlConnection cn = Site.CreateConnection(true, true)) {
                    cn.Open();
                    using(SqlCommand cmd = new SqlCommand("dbo.fullCategoryList", cn)) {
                        using(SqlDataReader categories = cmd.ExecuteReader()) {
                            while(categories.Read()) {
                                if(CurrentId != categories.GetGuid(categories.GetOrdinal("categoryId"))) {
                                    Cat = new Category(
                                        categories.GetString(categories.GetOrdinal("categoryName")),
                                        categories.GetGuid(categories.GetOrdinal("categoryId")),
                                        categories.GetBoolean(categories.GetOrdinal("enabled"))
                                    );
                                    CurrentId = Cat.Id;
                                    List.Add(Cat);
                                }
                                I = site.Item(categories.GetString(categories.GetOrdinal("itemNumber")));
                                if(I != null) {
                                    if(!categories.IsDBNull(categories.GetOrdinal("listOrder"))) {
                                        if(I.CategoryOrder == null) {
                                            I.CategoryOrder = new Dictionary<Guid, int>();
                                        }
                                        if(!I.CategoryOrder.ContainsKey(Cat.Id)) {
                                            I.CategoryOrder.Add(Cat.Id, categories.GetInt32(categories.GetOrdinal("listOrder")));
                                        }
                                    };
                                    if(!Cat.Items.Contains(I)) {
                                        Cat.Items.Add(I);
                                    }
                                }
                            }
                        }
                    }
                }
            }
            #endregion
        }
	}
}


text:
package net.laivuri.venueapi.service.favorites.dto;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import org.hibernate.validator.constraints.NotBlank;

/**
 *
 * @author Juhani Laitakari
 *
 * Favorite venue data that has an ID
 */
@JsonIgnoreProperties(ignoreUnknown = true)
public class FavoriteVenue extends FavoriteVenueData {

    @NotBlank(message = "Venue id cannot be empty")
    protected String id;

    public String getId() {
        return id;
    }

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


text:
/*******************************************************************************

    USB Device header file

Summary:
    This file, with its associated C source file, provides the main substance of
    the USB device side stack.  These files will receive, transmit, and process
    various USB commands as well as take action when required for various events
    that occur on the bus.

Description:
    This file, with its associated C source file, provides the main substance of
    the USB device side stack.  These files will receive, transmit, and process
    various USB commands as well as take action when required for various events
    that occur on the bus.

    This file is located in the "\<Install Directory\>\\Microchip\\Include\\USB"
    directory.

    When including this file in a new project, this file can either be
    referenced from the directory in which it was installed or copied
    directly into the user application folder. If the first method is
    chosen to keep the file located in the folder in which it is installed
    then include paths need to be added so that the library and the
    application both know where to reference each others files. If the
    application folder is located in the same folder as the Microchip
    folder (like the current demo folders), then the following include
    paths need to be added to the application's project:

    ..\\..\\Microchip\\Include

    .

    If a different directory structure is used, modify the paths as
    required. An example using absolute paths instead of relative paths
    would be the following:

    C:\\Microchip Solutions\\Microchip\\Include

    C:\\Microchip Solutions\\My Demo Application

******************************************************************************/
//DOM-IGNORE-BEGIN
/******************************************************************************
 FileName:     	usb_device.h
 Dependencies:	See INCLUDES section
 Processor:		PIC18 or PIC24 USB Microcontrollers
 Hardware:		The code is natively intended to be used on the following
 				hardware platforms: PICDEM™ FS USB Demo Board,
 				PIC18F87J50 FS USB Plug-In Module, or
 				Explorer 16 + PIC24 USB PIM.  The firmware may be
 				modified for use on other USB platforms by editing the
 				HardwareProfile.h file.
 Complier:  	Microchip C18 (for PIC18) or C30 (for PIC24)
 Company:		Microchip Technology, Inc.

 Software License Agreement:

 The software supplied herewith by Microchip Technology Incorporated
 (the "Company") for its PIC® Microcontroller is intended and
 supplied to you, the Company's customer, for use solely and
 exclusively on Microchip PIC Microcontroller products. The
 software is owned by the Company and/or its supplier, and is
 protected under applicable copyright laws. All rights are reserved.
 Any use in violation of the foregoing restrictions may subject the
 user to criminal sanctions under applicable laws, as well as to
 civil liability for the breach of the terms and conditions of this
 license.

 THIS SOFTWARE IS PROVIDED IN AN "AS IS" CONDITION. NO WARRANTIES,
 WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED
 TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
 PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT,
 IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR
 CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
*******************************************************************/

/********************************************************************
 Change History:
  Rev    Description
  ----   -----------
  2.1    Added "(" & ")" to EP definitions
         updated for simplicity and to use common
         coding style

  2.6    Removed many of the device specific information to the
         HAL layer files.  Moved many of the CH9 defintions to the
         CH9 file.

  2.6a   No Change

  2.7    Fixed error where USBHandleGetAddr() didn't convert the
         return address from a physical address to a virtual address
         for PIC32.

         Added macro versions of USBDeviceAttach() and USBDeviceDetach()
         so they will compile without error when using polling mode.

********************************************************************/

#ifndef USBDEVICE_H
#define USBDEVICE_H
//DOM-IGNORE-END

/** DEFINITIONS ****************************************************/

//USB_HANDLE is a pointer to an entry in the BDT.  This pointer can be used
//  to read the length of the last transfer, the status of the last transfer,
//  and various other information.  Insure to initialize USB_HANDLE objects
//  to NULL so that they are in a known state during their first usage.
#define USB_HANDLE void*

#define USB_EP0_ROM            0x00     //Data comes from RAM
#define USB_EP0_RAM            0x01     //Data comes from ROM
#define USB_EP0_BUSY           0x80     //The PIPE is busy
#define USB_EP0_INCLUDE_ZERO   0x40     //include a trailing zero packet
#define USB_EP0_NO_DATA        0x00     //no data to send
#define USB_EP0_NO_OPTIONS     0x00     //no options set

/********************************************************************
 * Standard Request Codes
 * USB 2.0 Spec Ref Table 9-4
 *******************************************************************/

/* USB Device States as returned by USBGetDeviceState().  Only the defintions
   for these states should be used.  The actual value for each state should
   not be relied upon as constant and may change based on the implementation. */
typedef enum
{
    /* Detached is the state in which the device is not attached to the bus.  When
    in the detached state a device should not have any pull-ups attached to either
    the D+ or D- line.  */
    DETACHED_STATE
    /*DOM-IGNORE-BEGIN*/    = 0x00                         /*DOM-IGNORE-END*/,
    /* Attached is the state in which the device is attached ot the bus but the
    hub/port that it is attached to is not yet configured. */
    ATTACHED_STATE
    /*DOM-IGNORE-BEGIN*/    = 0x01                         /*DOM-IGNORE-END*/,
    /* Powered is the state in which the device is attached to the bus and the
    hub/port that it is attached to is configured. */
    POWERED_STATE
    /*DOM-IGNORE-BEGIN*/    = 0x02                         /*DOM-IGNORE-END*/,
    /* Default state is the state after the device receives a RESET command from
    the host. */
    DEFAULT_STATE
    /*DOM-IGNORE-BEGIN*/    = 0x04                         /*DOM-IGNORE-END*/,
    /* Address pending state is not an official state of the USB defined states.
    This state is internally used to indicate that the device has received a
    SET_ADDRESS command but has not received the STATUS stage of the transfer yet.
    The device is should not switch addresses until after the STATUS stage is
    complete.  */
    ADR_PENDING_STATE
    /*DOM-IGNORE-BEGIN*/    = 0x08                         /*DOM-IGNORE-END*/,
    /* Address is the state in which the device has its own specific address on the
    bus. */
    ADDRESS_STATE
    /*DOM-IGNORE-BEGIN*/    = 0x10                         /*DOM-IGNORE-END*/,
    /* Configured is the state where the device has been fully enumerated and is
    operating on the bus.  The device is now allowed to excute its application
    specific tasks.  It is also allowed to increase its current consumption to the
    value specified in the configuration descriptor of the current configuration.
    */
    CONFIGURED_STATE
    /*DOM-IGNORE-BEGIN*/    = 0x20                        /*DOM-IGNORE-END*/
} USB_DEVICE_STATE;

/* USB device stack events description here - DWF */
typedef enum
{
    // Notification that a SET_CONFIGURATION() command was received (device)
    EVENT_CONFIGURED
    /*DOM-IGNORE-BEGIN*/    = EVENT_DEVICE_STACK_BASE        /*DOM-IGNORE-END*/,

    // A SET_DESCRIPTOR request was received (device)
    EVENT_SET_DESCRIPTOR,

    // An endpoint 0 request was received that the stack did not know how to
    // handle.  This is most often a request for one of the class drivers.
    // Please refer to the class driver documenation for information related
    // to what to do if this request is received. (device)
    EVENT_EP0_REQUEST,

//    // A USB transfer has completed.  The data associated with this event is of
//    // the data type HOST_TRANSFER_DATA if the event is generated from the host
//    // stack.
//    EVENT_TRANSFER,
//
//    // A USB Start of Frame token has been received.  This event is not
//    // used by the Host stack.
//    EVENT_SOF,
//
//    // Device-mode resume received.  This event is not used by the Host stack.
//    EVENT_RESUME,
//
//    // Device-mode suspend/idle event received.  This event is not used by the
//    // Host stack.
//    EVENT_SUSPEND,
//
//    // Device-mode bus reset received.  This event is not used by the Host
//    // stack.
//    EVENT_RESET,

//    // Device Mode: A setup packet received (data: SETUP_PKT).  This event is
//    // not used by the Host stack.
//    EVENT_SETUP,

    // Device-mode USB cable has been attached.  This event is not used by the
    // Host stack.  The client driver may provide an application event when a
    // device attaches.
    EVENT_ATTACH

} USB_DEVICE_STACK_EVENTS;

/** Function Prototypes **********************************************/

/**************************************************************************
  Function:
        void USBDeviceTasks(void)

  Summary:
    This function is the main state machine of the USB device side stack.
    This function should be called periodically to receive and transmit
    packets through the stack. This function should be called preferably
    once every 100us during the enumeration process. After the enumeration
    process this function still needs to be called periodically to respond
    to various situations on the bus but is more relaxed in its time
    requirements. This function should also be called at least as fast as
    the OUT data expected from the PC.

  Description:
    This function is the main state machine of the USB device side stack.
    This function should be called periodically to receive and transmit
    packets through the stack. This function should be called preferably
    once every 100us during the enumeration process. After the enumeration
    process this function still needs to be called periodically to respond
    to various situations on the bus but is more relaxed in its time
    requirements. This function should also be called at least as fast as
    the OUT data expected from the PC.

    Typical usage:

    void main(void)
    {
        USBDeviceInit()
        while(1)
        {
            USBDeviceTasks();
            if((USBGetDeviceState() \< CONFIGURED_STATE) ||
               (USBIsDeviceSuspended() == TRUE))
            {
                //Either the device is not configured or we are suspended
                //  so we don't want to do execute any application code
                continue;   //go back to the top of the while loop
            }
            else
            {
                //Otherwise we are free to run user application code.
                UserApplication();
            }
        }
    }

  Conditions:
    None
  Remarks:
    This function should be called preferably once every 100us during the
    enumeration process. After the enumeration process this function still
    needs to be called periodically to respond to various situations on the
    bus but is more relaxed in its time requirements.
  **************************************************************************/
void USBDeviceTasks(void);

/**************************************************************************
    Function:
        void USBDeviceInit(void)

    Description:
        This function initializes the device stack it in the default state. The
        USB module will be completely reset including all of the internal
        variables, registers, and interrupt flags.

    Precondition:
        This function must be called before any of the other USB Device
        functions can be called, including USBDeviceTasks().

    Parameters:
        None

    Return Values:
        None

    Remarks:
        None

  **************************************************************************/
void USBDeviceInit(void);

/********************************************************************
  Function:
        BOOL USBGetRemoteWakeupStatus(void)

  Summary:
    This function indicates if remote wakeup has been enabled by the host.
    Devices that support remote wakeup should use this function to
    determine if it should send a remote wakeup.

  Description:
    This function indicates if remote wakeup has been enabled by the host.
    Devices that support remote wakeup should use this function to
    determine if it should send a remote wakeup.

    If a device does not support remote wakeup (the Remote wakeup bit, bit
    5, of the bmAttributes field of the Configuration descriptor is set to
    1), then it should not send a remote wakeup command to the PC and this
    function is not of any use to the device. If a device does support
    remote wakeup then it should use this function as described below.

    If this function returns FALSE and the device is suspended, it should
    not issue a remote wakeup (resume).

    If this function returns TRUE and the device is suspended, it should
    issue a remote wakeup (resume).

    A device can add remote wakeup support by having the _RWU symbol added
    in the configuration descriptor (located in the usb_descriptors.c file
    in the project). This done in the 8th byte of the configuration
    descriptor. For example:

    ROM BYTE configDescriptor1[]={
        0x09,                           // Size
        USB_DESCRIPTOR_CONFIGURATION,   // descriptor type
        DESC_CONFIG_WORD(0x0022),       // Total length
        1,                              // Number of interfaces
        1,                              // Index value of this cfg
        0,                              // Configuration string index
        _DEFAULT | _SELF | _RWU,        // Attributes, see usb_device.h
        50,                             // Max power consumption in 2X mA(100mA)

        //The rest of the configuration descriptor should follow

    For more information about remote wakeup, see the following section of
    the USB v2.0 specification available at www.usb.org:
        * Section 9.2.5.2
        * Table 9-10
        * Section 7.1.7.7
        * Section 9.4.5

  Conditions:
    None

  Return Values:
    TRUE -   Remote Wakeup has been enabled by the host
    FALSE -  Remote Wakeup is not currently enabled

  Remarks:
    None

  *******************************************************************/
BOOL USBGetRemoteWakeupStatus(void);
/*DOM-IGNORE-BEGIN*/
#define USBGetRemoteWakeupStatus() RemoteWakeup
/*DOM-IGNORE-END*/

/***************************************************************************
  Function:
        USB_DEVICE_STATE USBGetDeviceState(void)

  Summary:
    This function will return the current state of the device on the USB.
    This function should return CONFIGURED_STATE before an application
    tries to send information on the bus.
  Description:
    This function returns the current state of the device on the USB. This
    \function is used to determine when the device is ready to communicate
    on the bus. Applications should not try to send or receive data until
    this function returns CONFIGURED_STATE.

    It is also important that applications yield as much time as possible
    to the USBDeviceTasks() function as possible while the this function
    \returns any value between ATTACHED_STATE through CONFIGURED_STATE.

    For more information about the various device states, please refer to
    the USB specification section 9.1 available from www.usb.org.

    Typical usage:

    void main(void)
    {
        USBDeviceInit()
        while(1)
        {
            USBDeviceTasks();
            if((USBGetDeviceState() \< CONFIGURED_STATE) ||
               (USBIsDeviceSuspended() == TRUE))
            {
                //Either the device is not configured or we are suspended
                //  so we don't want to do execute any application code
                continue;   //go back to the top of the while loop
            }
            else
            {
                //Otherwise we are free to run user application code.
                UserApplication();
            }
        }
    }

  Conditions:
    None
  Return Values:
    USB_DEVICE_STATE - the current state of the device on the bus

  Remarks:
    None
  ***************************************************************************/
USB_DEVICE_STATE USBGetDeviceState(void);
/*DOM-IGNORE-BEGIN*/
#define USBGetDeviceState() USBDeviceState
/*DOM-IGNORE-END*/

/***************************************************************************
  Function:
        BOOL USBGetSuspendState(void)

  Summary:
    This function indicates if this device is currently suspended. When a
    device is suspended it will not be able to transfer data over the bus.
  Description:
    This function indicates if this device is currently suspended. When a
    device is suspended it will not be able to transfer data over the bus.
    This function can be used by the application to skip over section of
    code that do not need to exectute if the device is unable to send data
    over the bus.

    Typical usage:

       void main(void)
       {
           USBDeviceInit()
           while(1)
           {
               USBDeviceTasks();
               if((USBGetDeviceState() \< CONFIGURED_STATE) ||
                  (USBIsDeviceSuspended() == TRUE))
               {
                   //Either the device is not configured or we are suspended
                   //  so we don't want to do execute any application code
                   continue;   //go back to the top of the while loop
               }
               else
               {
                   //Otherwise we are free to run user application code.
                   UserApplication();
               }
           }
       }

  Conditions:
    None
  Return Values:
    TRUE -   this device is suspended.
    FALSE -  this device is not suspended.
  Remarks:
    None
  ***************************************************************************/
BOOL USBGetSuspendState(void);

/*******************************************************************************
  Function:
        void USBEnableEndpoint(BYTE ep, BYTE options)

  Summary:
    This function will enable the specified endpoint with the specified
    options
  Description:
    This function will enable the specified endpoint with the specified
    options.

    Typical Usage:

    void USBCBInitEP(void)
    {
        USBEnableEndpoint(MSD_DATA_IN_EP,USB_IN_ENABLED|USB_OUT_ENABLED|USB_HANDSHAKE_ENABLED|USB_DISALLOW_SETUP);
        USBMSDInit();
    }

    In the above example endpoint number MSD_DATA_IN_EP is being configured
    for both IN and OUT traffic with handshaking enabled. Also since
    MSD_DATA_IN_EP is not endpoint 0 (MSD does not allow this), then we can
    explicitly disable SETUP packets on this endpoint.
  Conditions:
    None
  Input:
    BYTE ep -       the endpoint to be configured
    BYTE options -  optional settings for the endpoint. The options should
                    be ORed together to form a single options string. The
                    available optional settings for the endpoint. The
                    options should be ORed together to form a single options
                    string. The available options are the following\:
                    * USB_HANDSHAKE_ENABLED enables USB handshaking (ACK,
                      NAK)
                    * USB_HANDSHAKE_DISABLED disables USB handshaking (ACK,
                      NAK)
                    * USB_OUT_ENABLED enables the out direction
                    * USB_OUT_DISABLED disables the out direction
                    * USB_IN_ENABLED enables the in direction
                    * USB_IN_DISABLED disables the in direction
                    * USB_ALLOW_SETUP enables control transfers
                    * USB_DISALLOW_SETUP disables control transfers
                    * USB_STALL_ENDPOINT STALLs this endpoint
  Return:
    None
  Remarks:
    None
  *****************************************************************************/
void USBEnableEndpoint(BYTE ep, BYTE options);

/*******************************************************************************
  Function:
        BOOL USBIsDeviceSuspended(void)

  Summary:
    This function indicates if the USB module is in suspend mode.

  Description:
    This function indicates if the USB module is in suspend mode.  This function
    does NOT indicate that a suspend request has been received.  It only
    reflects the state of the USB module.

    Typical Usage:

    if(USBIsDeviceSuspended() == TRUE)
    {
        return;
    }
    // otherwise do some application specific tasks

  Conditions:
    None
  Input:
    None
  Return:
    None
  Remarks:
    None
  *****************************************************************************/
BOOL USBIsDeviceSuspended(void);
/*DOM-IGNORE-BEGIN*/
#define USBIsDeviceSuspended() USBSuspendControl
/*DOM-IGNORE-END*/

/*******************************************************************************
  Function:
        void USBSoftDetach(void);

  Summary:
    This function performs a detach from the USB bus via software.

  Description:
    This function performs a detach from the USB bus via software.

  Conditions:
    None
  Input:
    None
  Return:
    None
  Remarks:
    Caution should be used when detaching from the bus.  Some PC drivers and
    programs may require additional time after a detach before a device can be
    reattached to the bus.
  *****************************************************************************/
void USBSoftDetach(void);
/*DOM-IGNORE-BEGIN*/
#define USBSoftDetach()  U1CON = 0; U1IE = 0; USBDeviceState = DETACHED_STATE;
/*DOM-IGNORE-END*/

/*************************************************************************
  Function:
    USB_HANDLE USBTransferOnePacket(BYTE ep, BYTE dir, BYTE* data, BYTE len)

  Summary:
    Transfers a single packet (one transaction) of data on the USB bus.

  Description:
    The USBTransferOnePacket() function prepares a USB endpoint
    so that it may send data to the host (an IN transaction), or
    receive data from the host (an OUT transaction).  The
    USBTransferOnePacket() function can be used both to receive	and
    send data to the host.  This function is the primary API function
    provided by the USB stack firmware for sending or receiving application
    data over the USB port.

    The USBTransferOnePacket() is intended for use with all application
    endpoints.  It is not used for sending or receiving applicaiton data
    through endpoint 0 by using control transfers.  Separate API
    functions, such as USBEP0Receive(), USBEP0SendRAMPtr(), and
    USBEP0SendROMPtr() are provided for this purpose.

    The	USBTransferOnePacket() writes to the Buffer Descriptor Table (BDT)
    entry associated with an endpoint buffer, and sets the UOWN bit, which
    prepares the USB hardware to allow the transaction to complete.  The
    application firmware can use the USBHandleBusy() macro to check the
    status of the transaction, to see if the data has been successfully
    transmitted yet.

    Typical Usage

    //make sure that the we are in the configured state
    if(USBGetDeviceState() == CONFIGURED_STATE)
    {
        //make sure that the last transaction isn't busy by checking the handle
        if(!USBHandleBusy(USBInHandle))
        {
	        //Write the new data that we wish to send to the host to the INPacket[] array
	        INPacket[0] = USEFUL_APPLICATION_VALUE1;
	        INPacket[1] = USEFUL_APPLICATION_VALUE2;
	        //INPacket[2] = ... (fill in the rest of the packet data)

            //Send the data contained in the INPacket[] array through endpoint "EP_NUM"
            USBInHandle = USBTransferOnePacket(EP_NUM,IN_TO_HOST,(BYTE*)&INPacket[0],sizeof(INPacket));
        }
    }

  Conditions:
    Before calling USBTransferOnePacket(), the following should be true.
    1.  The USB stack has already been initialized (USBDeviceInit() was called).
    2.  A transaction is not already pending on the specified endpoint.  This
        is done by checking the previous request using the USBHandleBusy()
        macro (see the typical usage example).
    3.  The host has already sent a set configuration request and the
        enumeration process is complete.
        This can be checked by verifying that the USBGetDeviceState()
        macro returns "CONFIGURED_STATE", prior to calling
        USBTransferOnePacket().

  Input:
    BYTE ep - The endpoint number that the data will be transmitted or
	          received on
    BYTE dir - The direction of the transfer
               This value is either OUT_FROM_HOST or IN_TO_HOST
    BYTE* data - For IN transactions: pointer to the RAM buffer containing
                 the data to be sent to the host.  For OUT transactions: pointer
                 to the RAM buffer that the received data should get written to.
   BYTE len - Length of the data needing to be sent (for IN transactions).
              For OUT transactions, the len parameter should normally be set
              to the endpoint size specified in the endpoint descriptor.

  Return Values:
    USB_HANDLE - handle to the transfer.  The handle is a pointer to
                 the BDT entry associated with this transaction.  The
                 status of the transaction (ex: if it is complete or still
                 pending) can be checked using the USBHandleBusy() macro
                 and supplying the USB_HANDLE provided by
                 USBTransferOnePacket().

  Remarks:
    If calling the USBTransferOnePacket() function from within the USBCBInitEP()
    callback function, the set configuration is still being processed and the
    USBDeviceState may not be == CONFIGURED_STATE yet.  In this	special case,
    the USBTransferOnePacket() may still be called, but make sure that the
    endpoint has been enabled and initialized by the USBEnableEndpoint()
    function first.

  *************************************************************************/
USB_HANDLE USBTransferOnePacket(BYTE ep,BYTE dir,BYTE* data,BYTE len);

/*************************************************************************
  Function:
    BOOL USBHandleBusy(USB_HANDLE handle)

  Summary:
    Checks to see if the input handle is busy

  Description:
    Checks to see if the input handle is busy

    Typical Usage

    //make sure that the last transfer isn't busy by checking the handle
    if(!USBHandleBusy(USBGenericInHandle))
    {
        //Send the data contained in the INPacket[] array out on
        //  endpoint USBGEN_EP_NUM
        USBGenericInHandle = USBGenWrite(USBGEN_EP_NUM,(BYTE*)&INPacket[0],sizeof(INPacket));
    }

  Conditions:
    None
  Input:
    USB_HANDLE handle -  handle of the transfer that you want to check the
                         status of
  Return Values:
    TRUE -   The specified handle is busy
    FALSE -  The specified handle is free and available for a transfer
  Remarks:
    None
  *************************************************************************/
BOOL USBHandleBusy(USB_HANDLE handle);
/*DOM-IGNORE-BEGIN*/
#define USBHandleBusy(handle) (handle==0?0:((volatile BDT_ENTRY*)handle)->STAT.UOWN)
/*DOM-IGNORE-END*/

/********************************************************************
    Function:
        WORD USBHandleGetLength(USB_HANDLE handle)

    Summary:
        Retrieves the length of the destination buffer of the input
        handle

    Description:
        Retrieves the length of the destination buffer of the input
        handle

    PreCondition:
        None

    Parameters:
        USB_HANDLE handle - the handle to the transfer you want the
        address for.

    Return Values:
        WORD - length of the current buffer that the input handle
        points to.  If the transfer is complete then this is the
        length of the data transmitted or the length of data
        actually received.

    Remarks:
        None

 *******************************************************************/
WORD USBHandleGetLength(USB_HANDLE handle);
/*DOM-IGNORE-BEGIN*/
#define USBHandleGetLength(handle) (((volatile BDT_ENTRY*)handle)->CNT)
/*DOM-IGNORE-END*/

/********************************************************************
    Function:
        WORD USBHandleGetAddr(USB_HANDLE)

    Summary:
        Retrieves the address of the destination buffer of the input
        handle

    Description:
        Retrieves the address of the destination buffer of the input
        handle

    PreCondition:
        None

    Parameters:
        USB_HANDLE handle - the handle to the transfer you want the
        address for.

    Return Values:
        WORD - address of the current buffer that the input handle
        points to.

    Remarks:
        None

 *******************************************************************/
WORD USBHandleGetAddr(USB_HANDLE);
/*DOM-IGNORE-BEGIN*/
#define USBHandleGetAddr(handle) ConvertToVirtualAddress((((volatile BDT_ENTRY*)handle)->ADR))
/*DOM-IGNORE-END*/

/********************************************************************
    Function:
        void USBEP0Transmit(BYTE options)

    Summary:
        Sets the address of the data to send over the
        control endpoint

    PreCondition:
        None

    Paramters:
        options - the various options that you want
                  when sending the control data. Options are:
                       USB_EP0_ROM
                       USB_EP0_RAM
                       USB_EP0_BUSY
                       USB_EP0_INCLUDE_ZERO
                       USB_EP0_NO_DATA
                       USB_EP0_NO_OPTIONS

    Return Values:
        None

    Remarks:
        None

 *******************************************************************/
void USBEP0Transmit(BYTE options);
/*DOM-IGNORE-BEGIN*/
#define USBEP0Transmit(options) inPipes[0].info.Val = options | USB_EP0_BUSY
/*DOM-IGNORE-END*/

/*************************************************************************
  Function:
        void USBEP0SendRAMPtr(BYTE* src, WORD size, BYTE Options)

  Summary:
    Sets the source, size, and options of the data you wish to send from a
    RAM source
  Conditions:
    None
  Input:
    src -      address of the data to send
    size -     the size of the data needing to be transmitted
    options -  the various options that you want when sending the control
               data. Options are\:
               * USB_EP0_ROM
               * USB_EP0_RAM
               * USB_EP0_BUSY
               * USB_EP0_INCLUDE_ZERO
               * USB_EP0_NO_DATA
               * USB_EP0_NO_OPTIONS
  Remarks:
    None
  *************************************************************************/
void USBEP0SendRAMPtr(BYTE* src, WORD size, BYTE Options);
/*DOM-IGNORE-BEGIN*/
#define USBEP0SendRAMPtr(src,size,options)  {\
            inPipes[0].pSrc.bRam = src;\
            inPipes[0].wCount.Val = size;\
            inPipes[0].info.Val = options | USB_EP0_BUSY | USB_EP0_RAM;\
            }
/*DOM-IGNORE-END*/

/**************************************************************************
  Function:
        void USBEP0SendROMPtr(BYTE* src, WORD size, BYTE Options)

  Summary:
    Sets the source, size, and options of the data you wish to send from a
    ROM source
  Conditions:
    None
  Input:
    src -      address of the data to send
    size -     the size of the data needing to be transmitted
    options -  the various options that you want when sending the control
               data. Options are\:
               * USB_EP0_ROM
               * USB_EP0_RAM
               * USB_EP0_BUSY
               * USB_EP0_INCLUDE_ZERO
               * USB_EP0_NO_DATA
               * USB_EP0_NO_OPTIONS
  Remarks:
    None
  **************************************************************************/
void USBEP0SendROMPtr(BYTE* src, WORD size, BYTE Options);
/*DOM-IGNORE-BEGIN*/
#define USBEP0SendROMPtr(src,size,options)  {\
            inPipes[0].pSrc.bRom = src;\
            inPipes[0].wCount.Val = size;\
            inPipes[0].info.Val = options | USB_EP0_BUSY | USB_EP0_ROM;\
            }
/*DOM-IGNORE-END*/

/***************************************************************************
  Function:
    void USBEP0Receive(BYTE* dest, WORD size, void (*function))
  Summary:
    Sets the destination, size, and a function to call on the completion of
    the next control write.
  Conditions:
    None
  Input:
    dest -        address of where the incoming data will go (make sure that this
                  address is directly accessable by the USB module for parts with
                  dedicated USB RAM this address must be in that space)
    size -        the size of the data being received (is almost always going tobe
                  presented by the preceeding setup packet SetupPkt.wLength)
    (*function) - a function that you want called once the data is received. If
                  this is specificed as NULL then no function is called.
  Remarks:
    None
  ***************************************************************************/
void USBEP0Receive(BYTE* dest, WORD size, void (*function));
/*DOM-IGNORE-BEGIN*/
#define USBEP0Receive(dest,size,function)  {outPipes[0].pDst.bRam = dest;outPipes[0].wCount.Val = size;outPipes[0].pFunc = function;outPipes[0].info.bits.busy = 1; }
/*DOM-IGNORE-END*/

/********************************************************************
    Function:
        USB_HANDLE USBTxOnePacket(BYTE ep, BYTE* data, WORD len)

    Summary:
        Sends the specified data out the specified endpoint

    PreCondition:
        None

    Parameters:
        ep - the endpoint you want to send the data out of
        data - the data that you wish to send
        len - the length of the data that you wish to send

    Return Values:
        USB_HANDLE - a handle for the transfer.  This information
        should be kept to track the status of the transfer

    Remarks:
        None

 *******************************************************************/
USB_HANDLE USBTxOnePacket(BYTE ep, BYTE* data, WORD len);
/*DOM-IGNORE-BEGIN*/
#define USBTxOnePacket(ep,data,len)     USBTransferOnePacket(ep,IN_TO_HOST,data,len)
/*DOM-IGNORE-END*/

/********************************************************************
    Function:
        USB_HANDLE USBRxOnePacket(BYTE ep, BYTE* data, WORD len)

    Summary:
        Receives the specified data out the specified endpoint

    PreCondition:
        None

    Parameters:
        ep - the endpoint you want to receive the data into
        data - where the data will go when it arrives
        len - the length of the data that you wish to receive

    Return Values:
        None

    Remarks:
        None

 *******************************************************************/
USB_HANDLE USBRxOnePacket(BYTE ep, BYTE* data, WORD len);
/*DOM-IGNORE-BEGIN*/
#define USBRxOnePacket(ep,data,len)      USBTransferOnePacket(ep,OUT_FROM_HOST,data,len)
/*DOM-IGNORE-END*/

/********************************************************************
    Function:
        void USBStallEndpoint(BYTE ep, BYTE dir)

    Summary:
         STALLs the specified endpoint

    PreCondition:
        None

    Parameters:
        BYTE ep - the endpoint the data will be transmitted on
        BYTE dir - the direction of the transfer

    Return Values:
        None

    Remarks:
        None

 *******************************************************************/
void USBStallEndpoint(BYTE ep, BYTE dir);

/**************************************************************************
    Function:
        void USBDeviceDetach(void)

    Summary:
        This function indicates to the USB module that the USB device has been
        detached from the bus.

    Description:
        This function indicates to the USB module that the USB device has been
        detached from the bus.  This function needs to be called in order for the
        device to start to properly prepare for the next attachment.

    Precondition:
        Should only be called when USB_INTERRUPT is defined.

    Parameters:
        None

    Return Values:
        None

    Remarks:
        None

  **************************************************************************/
void USBDeviceDetach(void);

/*DOM-IGNORE-BEGIN*/
#if !defined(USB_INTERRUPT)
    #define USBDeviceDetach()
#endif
/*DOM-IGNORE-END*/

/**************************************************************************
    Function:
        void USBDeviceAttach(void)

    Summary:
        This function indicates to the USB module that the USB device has been
        attached to the bus.

    Description:
        This function indicates to the USB module that the USB device has been
        attached to the bus.  This function needs to be called in order for the
        device to start to enumerate on the bus.

    Precondition:
        Should only be called when USB_INTERRUPT is defined.

        For normal USB devices:
        Make sure that if the module was previously on, that it has been turned off
        for a long time (ex: 100ms+) before calling this function to re-enable the module.
        If the device turns off the D+ (for full speed) or D- (for low speed) ~1.5k ohm
        pull up resistor, and then turns it back on very quickly, common hosts will sometimes
        reject this event, since no human could ever unplug and reattach a USB device in a
        microseconds (or nanoseconds) timescale.  The host could simply treat this as some kind
        of glitch and ignore the event altogether.
    Parameters:
        None

    Return Values:
        None
****************************************************************************/
void USBDeviceAttach(void);

/*DOM-IGNORE-BEGIN*/
#if !defined(USB_INTERRUPT)
    #define USBDeviceAttach()
#endif
/*DOM-IGNORE-END*/

/*******************************************************************************
  Function:
    BOOL USB_APPLICATION_EVENT_HANDLER(BYTE address, USB_EVENT event, void *pdata, WORD size);

  Summary:
    This function is called whenever the USB stack wants to notify the user of
    an event.

  Description:
    This function is called whenever the USB stack wants to notify the user of
    an event.  This function should be implemented by the user.

    Example Usage:
  Conditions:
    None

  Input:
    BYTE address -  the address of the device when the event happened
    BYTE event   -  The event input specifies which event happened.  The
                    possible options are listed in the USB_DEVICE_STACK_EVENTS
                    enumeration.

  Return:
    None
  Remarks:
    None
  *****************************************************************************/
BOOL USB_APPLICATION_EVENT_HANDLER(BYTE address, USB_EVENT event, void *pdata, WORD size);

/*******************************************************************************
  Function:
    ROM void *USBDeviceCBGetDescriptor (UINT16 *length, DESCRIPTOR_ID *id);

  Summary:
    This function is called whenever the USB stack gets a USB GET_DESCRIPTOR
    request.

  Description:
    This function is called whenever the USB stack gets a USB GET_DESCRIPTOR
    request.  This function is responsible for returning a pointer to the
    requested descriptor and setting that the length for the that descriptor.

    This function should be implemented by the user.  This function might be
    generated automatically by the USB configuration tool.

  Conditions:
    None

  Input:
    BYTE *length -  pointer to a variable that should be set to the length of
                    the requested descriptor.
    BYTE *id     -  This structure contains information about the requested
                    descriptor

  Return:
    ROM void* - pointer to the requested descriptor.
  Remarks:
    None
  *****************************************************************************/
ROM void *USBDeviceCBGetDescriptor (UINT16 *length, DESCRIPTOR_ID *id);

/**************************************************************************
    Function:
        void USBCancelIO(BYTE endpoint)

    Description:
        This function cancels the transfers pending on the specified endpoint.
        This function can only be used after a SETUP packet is received and
        before that setup packet is handled.  This is the time period in which
        the EVENT_EP0_REQUEST is thrown, before the event handler function
        returns to the stack.

    Precondition:

    Parameters:
        BYTE endpoint - the endpoint number you wish to cancel the transfers for

    Return Values:
        None

    Remarks:
        None

  **************************************************************************/
void USBCancelIO(BYTE endpoint);

/** Section: MACROS ******************************************************/

/* The DESC_CONFIG_WORD() macro is implemented for convinence.  Since the
    configuration descriptor array is a BYTE array, each entry needs to be a
    BYTE in LSB format.  The DESC_CONFIG_WORD() macro breaks up a WORD into
    the appropriate BYTE entries in LSB.
    Typical Usage:

        ROM BYTE configDescriptor1[]={
            0x09,                           // Size of this descriptor in bytes
            USB_DESCRIPTOR_CONFIGURATION,   // CONFIGURATION descriptor type
            DESC_CONFIG_WORD(0x0022),       // Total length of data for this cfg

*/
#define DESC_CONFIG_WORD(a) (a&0xFF),((a>>8)&0xFF)

/* The DESC_CONFIG_DWORD() macro is implemented for convinence.  Since the
    configuration descriptor array is a BYTE array, each entry needs to be a
    BYTE in LSB format.  The DESC_CONFIG_DWORD() macro breaks up a DWORD into
    the appropriate BYTE entries in LSB.
*/
#define DESC_CONFIG_DWORD(a) (a&0xFF),((a>>8)&0xFF),((a>>16)&0xFF),((a>>24)&0xFF)

/* The DESC_CONFIG_BYTE() macro is implemented for convinence.  The
    DESC_CONFIG_BYTE() macro provides a consistant macro for use with a byte
    when generating a configuratin descriptor when using either the
    DESC_CONFIG_WORD() or DESC_CONFIG_DWORD() macros.
*/
#define DESC_CONFIG_BYTE(a) (a)

/* DOM-IGNORE-BEGIN */
/*******************************************************************************
********************************************************************************
********************************************************************************
    This section contains implementation specific information that may vary
    between releases as the implementation needs to change.  This section is
    included for compilation reasons only.
********************************************************************************
********************************************************************************
*******************************************************************************/

#if defined(USB_POLLING)
    #define USB_VOLATILE
#else
    #define USB_VOLATILE volatile
#endif

#define CTRL_TRF_RETURN void
#define CTRL_TRF_PARAMS void

// Defintion of the PIPE structure
//  This structure is used to keep track of data that is sent out
//  of the stack automatically.
typedef struct __attribute__ ((packed))
{
    union __attribute__ ((packed))
    {
        //Various options of pointers that are available to
        // get the data from
        BYTE *bRam;
        ROM BYTE *bRom;
        WORD *wRam;
        ROM WORD *wRom;
    }pSrc;
    union __attribute__ ((packed))
    {
        struct __attribute__ ((packed))
        {
            //is this transfer from RAM or ROM?
            BYTE ctrl_trf_mem          :1;
            BYTE reserved              :5;
            //include a zero length packet after
            //data is done if data_size%ep_size = 0?
            BYTE includeZero           :1;
            //is this PIPE currently in use
            BYTE busy                  :1;
        }bits;
        BYTE Val;
    }info;
    WORD_VAL wCount;
}IN_PIPE;

extern USB_VOLATILE IN_PIPE inPipes[];

typedef struct __attribute__ ((packed))
{
    union __attribute__ ((packed))
    {
        //Various options of pointers that are available to
        // get the data from
        BYTE *bRam;
        WORD *wRam;
    }pDst;
    union __attribute__ ((packed))
    {
        struct __attribute__ ((packed))
        {
            BYTE reserved              :7;
            //is this PIPE currently in use
            BYTE busy                  :1;
        }bits;
        BYTE Val;
    }info;
    WORD_VAL wCount;
    CTRL_TRF_RETURN (*pFunc)(CTRL_TRF_PARAMS);
}OUT_PIPE;

/************* DWF - SHOULD BE REIMPLEMENTED AS AN EVENT *******************/
//#if defined(ENABLE_EP0_DATA_RECEIVED_CALLBACK)
//    void USBCBEP0DataReceived(void);
//    #define USBCB_EP0_DATA_RECEIVED() USBCBEP0DataReceived()
//#else
//    #define USBCB_EP0_DATA_RECEIVED()
//#endif

extern USB_VOLATILE BOOL RemoteWakeup;
extern USB_VOLATILE USB_DEVICE_STATE USBDeviceState;
extern USB_VOLATILE BYTE USBActiveConfiguration;
/******************************************************************************/
/* DOM-IGNORE-END */

#endif //USBD_H


text:
Bootstrap Stylus 3.3.4

Port of the amazing Bootstrap 3.3.4 to Stylus 0.47.0.

There might be some slight color differences due to the differences between the color functions in LESS and those in Stylus.

Installing

Latest version via Bower:

$ bower install bootstrap-stylus

Legacy 2.3.2 version is kept in this release and can be installed via Bower as well, however it does not include any build scripts.

$ bower install bootstrap-stylus#2.3.2

Via npm:

$ npm install bootstrap-styl

Example of requiring and using bootstrap middleware to create compile function to utilize in other frameworks.

var bootstrap = require('bootstrap-styl'),
    stylus    = require('stylus');

function compile(str) {
  return stylus(str)
    .use(bootstrap());
}

To import whole bootstrap in your stylus file:

@import bootstrap

Alternatively to import individual components:

@import 'bootstrap/alerts'
@import 'bootstrap/variables'
@import 'bootstrap/mixins'

Compiling CSS from Stylus

Bootstrap Stylus uses Grunt with convenient methods for working with the framework. To use it, install the required dependencies as directed and then run some Grunt commands.

Install Grunt

From the command line:

Install grunt-cli globally with npm install -g grunt-cli.

Install the necessary local dependencies via npm install

When completed, you'll be able to run the various Grunt commands provided from the command line.

Unfamiliar with npm? Don't have node installed? That's a-okay. npm stands for node packaged modules and is a way to manage development dependencies through node.js. Download and install node.js before proceeding.

Available Grunt commands

Compile CSS and JavaScript - grunt dist

grunt dist creates the /dist directory with compiled files. Uses UglifyJS.

Legacy 2.3.2 Theme - grunt theme

This will compile the theme.styl separately and output it to the /dist folder.

Watch - grunt watch

This is a convenience method for watching just Stylus files and automatically building them whenever you save.

Troubleshooting dependencies

Should you encounter problems with installing dependencies or running Grunt commands, uninstall all previous dependency versions (global and local). Then, rerun npm install.

Usage

You may select what css components you want to include by editing stylus/bootstrap.styl.

You may override bootstrap variables in your private code, for example
// myStyles.styl
$font-family-serif ?= 'Merriweather', serif
$font-family-base ?= $font-family-serif
@import "bower_components/bootstrap-stylus/stylus/bootstrap.styl" // Or wherever your bootstrap.styl is located

this allows flexibility for easily updating to new bootstrap versions. See ?=.

You may select what javascript components you want by editing the uglify task in gulpfile.js. You can ommit components by removing them from the uglify:dist:files list.

Original Authors

Mark Otto

http://twitter.com/mdo

http://github.com/mdo

Jacob Thornton

http://twitter.com/fat

http://github.com/fat

Copyright and license

Copyright 2013 Twitter, Inc under the Apache 2.0 license.


text:
package io.proleap.cobol.asg.metamodel.data.screen.impl;

import io.proleap.cobol.CobolParser.ScreenDescriptionReverseVideoClauseContext;
import io.proleap.cobol.asg.metamodel.ProgramUnit;
import io.proleap.cobol.asg.metamodel.data.screen.ReverseVideoClause;
import io.proleap.cobol.asg.metamodel.impl.CobolDivisionElementImpl;

public class ReverseVideoClauseImpl extends CobolDivisionElementImpl implements ReverseVideoClause {

	protected ScreenDescriptionReverseVideoClauseContext ctx;

	protected boolean reverseVideo;

	public ReverseVideoClauseImpl(final ProgramUnit programUnit, final ScreenDescriptionReverseVideoClauseContext ctx) {
		super(programUnit, ctx);

		this.ctx = ctx;
	}

	@Override
	public boolean isReverseVideo() {
		return reverseVideo;
	}

	@Override
	public void setReverseVideo(final boolean reverseVideo) {
		this.reverseVideo = reverseVideo;
	}

}


text:
var geocoder = new google.maps.Geocoder();
var infowindow = new google.maps.InfoWindow();
var mapObject = null;
var restURL = "http://"+window.location.hostname + ":8080/secunity-backend/api/";
var nominatim = "http://nominatim.openstreetmap.org/search/";

var markerClusterer = null;
var imageUrl = 'http://chart.apis.google.com/chart?cht=mm&chs=24x32&' +
	'chco=FFFFFF,008CFF,000000&ext=.png';

function writeAddressName(latLng) {
        geocoder.geocode({
          "location": latLng
        },
        function(results, status) {
          if (status == google.maps.GeocoderStatus.OK)
            console.log(results[0].formatted_address);
          else
            console.log("Unable to retrieve your address" + "
");
        });
      }

      function geolocationSuccess(position) {
        var userLatLng = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);
        // Write the formatted address
        writeAddressName(userLatLng);

        var myOptions = {
          zoom : 5,
          center : userLatLng,
          mapTypeId : google.maps.MapTypeId.ROADMAP,
          minZoom: 2
        };
        // Draw the map
        mapObject = new google.maps.Map(document.getElementById("map"), myOptions);

        initialize();
      }

      function geolocationError(positionError) {
        document.getElementById("error").innerHTML += "Error: " + positionError.message + "
";
        var center = new google.maps.LatLng(47.5, 19.05);

        mapObject = new google.maps.Map(document.getElementById('map'), {
          zoom: 5,
          center: center,
          mapTypeId: google.maps.MapTypeId.ROADMAP,
          minZoom: 2
        });
        initialize();
      }

      function geolocateUser() {
        // If the browser supports the Geolocation API
        if (navigator.geolocation)
        {
          var positionOptions = {
            enableHighAccuracy: true,
            timeout: 10 * 1000 // 10 seconds
          };
          navigator.geolocation.getCurrentPosition(geolocationSuccess, geolocationError, positionOptions);
        }
        else
          console.log("Your browser doesn't support the Geolocation API");
      }

      function loadFromdirection(direction){
        geocodeAddress(geocoder, mapObject, direction);
      }

      function geocodeAddress(geocoder, resultsMap, address) {
        geocoder.geocode({'address': address}, function(results, status) {
          if (status === google.maps.GeocoderStatus.OK) {
            resultsMap.setCenter(results[0].geometry.location);
            var marker = new google.maps.Marker({
              map: resultsMap,
              position: results[0].geometry.location
            });
          } else {
            console.log('Geocode was not successful for the following reason: ' + status);
          }
        });
      }

      function drawmarker(resultsMap, latlong, inst) {
        var title = decodeURIComponent(inst["su:has_full_name"]);
        var marker = new google.maps.Marker({
          map: resultsMap,
          position: latlong,
          title: title
          });
        google.maps.event.addListener(marker, 'click', function() {
          var details = formatInstituteDetails(inst);

          // getInstitute(v, function(inst) {
          //   assertLocation(inst.entity[v])
          // });

          infowindow.setContent(details);
          infowindow.open(resultsMap, this);
        });
        markerClusterer.addMarker(marker, true);
        markerClusterer.redraw();
        }

function getTitleDetailHTML(title, detail){
  console.log(detail);
  return "
" + title +"
"
                +"
" +detail+ "
";

}

function clearClusters(e) {
        e.preventDefault();
        e.stopPropagation();
        markerClusterer.clearMarkers();
      }
function initialize() {
  var institutions = queryInstitutions();
  var markers = [];
  /*for (var i = 0; i < 100; i++) {
    var dataPhoto = data.photos[i];
    var latLng = new google.maps.LatLng(dataPhoto.latitude,
      dataPhoto.longitude);
    var marker = new google.maps.Marker({
      position: latLng,
      label: ''+i
      });
    markers.push(marker);
  }*/
  markerClusterer = new MarkerClusterer(mapObject, markers);
}

function queryInstitutions(){
     getInstitutes(50, 0, true, function(data) {
        $.each(data.entity, function(k, v) {
          // Assert location for each institution
          getInstitute(v, function(inst) {
            assertLocation(inst.entity[v])
          });
        });
    });
}

function assertLocation(institution){
  if(!institution.hasOwnProperty("su:loc_lat") || !institution.hasOwnProperty("su:loc_lng") ){
    queryNtimGeocoding(institution, true);
  }else{
    var loc = new google.maps.LatLng(institution["su:loc_lat"], institution["su:loc_lng"]);
    drawmarker(mapObject, loc, institution);
  }
}

function queryGmapsGeocoding(institution, retry_if_over_limit){
  geocoder.geocode({'address': buildAddressforGeoCode(institution)}, function(results, status) {
      if (status === google.maps.GeocoderStatus.OK) {
        postLocation(institution.key, results[0].geometry.location.lat(), results[0].geometry.location.lng());
        var loc = new google.maps.LatLng(results[0].geometry.location.lat(), results[0].geometry.location.lng());
        drawmarker(mapObject, loc, institution);
      } else if(status == google.maps.GeocoderStatus.OVER_QUERY_LIMIT){
            if(retry_if_over_limit){
              setTimeout(function(){
                geocoder = new google.maps.Geocoder();
                queryGmapsGeocoding(institution, true);
              }, 2000);
            }
            console.log("Google: Over query limit");
          }else{
            console.log("Google:resolution failed");
          }
        });
}

function queryNtimGeocoding(institution){
  console.log("REQUEST: " + nominatim+buildAddressforNominatime(institution)+"?format=json");
    $.getJSON(nominatim+buildAddressforNominatime(institution)+"?format=json",function(data){
      if(data.length){
        var result = data[0];
        postLocation(institution.key, result.lat, result.lon)
        var loc = new google.maps.LatLng(result.lat, result.lon);
        drawmarker(mapObject, loc, institution);
      }else{
        queryGmapsGeocoding(institution);
      }
    });
}

function buildAddressforNominatime(inst){
  var street = inst["su:address_street"];
  var city = inst["su:address_city"];
  var country = inst["su:address_country"];
  var postalcode = inst["su:address_postcode"];
  var address = "";
  address += street ? street + ",+" : ""
  address += city ? city + ",+" : ""
  address += country ? country + ",+" : ""
  //address += postalcode ? postalcode : ""
  if(address.endsWith(",+"))
    address = address.substring(0, address.length - 2);
  var replacer1 = new RegExp("%20","g");
  var replacer2 = new RegExp("\"","g");
  address = address.replace(replacer1,"+");
  return address.replace(replacer2,"");
}

function buildAddressforGeoCode(inst){
  var street = inst["su:address_street"];
  var city = inst["su:address_city"];
  var country = inst["su:address_country"];
  var postalcode = inst["su:address_postcode"];
  var address = "";
  address += street ? street + ",+" : ""
  address += city ? city + ",+" : ""
  address += country ? country + ",+" : ""
  address += postalcode ? postalcode : ""
  if(address.endsWith(",+"))
    address = address.substring(0, address.length - 2);
  var replacer1 = new RegExp("%20","g");
  var replacer2 = new RegExp("\"","g");
  address = address.replace(replacer1," ");
  return address.replace(replacer2,"");
}

function postLocation(instName, lat, lng){
  if (!instName)
    return;
  $.put(restURL+"institution/"+instName, "{su:loc_lat='"+lat+"', su:loc_lng='" + lng + "'}", function(data,code){}, "application/json; charset=UTF-8");

}

function formatInstituteDetails(inst){
  var details = "";
  var prop = "";
  prop = "su:has_full_name";
  if(inst.hasOwnProperty(prop) && inst[prop])
    details += getTitleDetailHTML("Name", decodeURIComponent(inst[prop]));
  prop = "su:has_short_name";
  if(inst.hasOwnProperty(prop) && inst[prop] && inst[prop] != inst["su:has_full_name"])
    details += getTitleDetailHTML("Short", decodeURIComponent(inst[prop]));
  prop = "akts:sub-unit-of-organization-unit";
  if(inst.hasOwnProperty(prop) && inst[prop])
    details += getTitleDetailHTML("Sub organisation of", decodeURIComponent(inst[prop]));
  prop = "akts:has-web-address";
  if(inst.hasOwnProperty(prop) && inst[prop])
    details += getTitleDetailHTML("Website", decodeURIComponent(inst[prop]));
  prop = "su:address_street";
  if(inst.hasOwnProperty(prop) && inst[prop])
    details += getTitleDetailHTML("Street and number", decodeURIComponent(inst[prop]));
  prop = "su:address_city";
  if(inst.hasOwnProperty(prop) && inst[prop])
    details += getTitleDetailHTML("City", decodeURIComponent(inst[prop]));
  prop = "su:address_postcode";
  if(inst.hasOwnProperty(prop) && inst[prop])
    details += getTitleDetailHTML("Postal code", decodeURIComponent(inst[prop]));
  prop = "su:address_country";
  if(inst.hasOwnProperty(prop) && inst[prop])
    details += getTitleDetailHTML("Country", decodeURIComponent(inst[prop]));
  prop = "su:participated_in_project";
  if(inst.hasOwnProperty(prop) && inst[prop])
    details += getTitleDetailHTML("Participates in project", decodeURIComponent(inst[prop]));
  prop = "su:has_title";
  if(inst.hasOwnProperty(prop) && inst[prop])
    details += getTitleDetailHTML("Title", decodeURIComponent(inst[prop]));
  prop = "su:has_first_name";
  if(inst.hasOwnProperty(prop) && inst[prop])
    details += getTitleDetailHTML("First name", decodeURIComponent(inst[prop]));
  prop = "su:has_last_name";
  if(inst.hasOwnProperty(prop) && inst[prop])
    details += getTitleDetailHTML("Last name", decodeURIComponent(inst[prop]));
  prop = "su:has_phone_number";
  if(inst.hasOwnProperty(prop) && inst[prop])
    details += getTitleDetailHTML("Phone number", decodeURIComponent(inst[prop]));
  prop = "su:has_fax_number";
  if(inst.hasOwnProperty(prop) && inst[prop])
    details += getTitleDetailHTML("Fax", decodeURIComponent(inst[prop]));
  return details;
}

google.maps.event.addDomListener(window, 'load', geolocateUser);


text:
<?php

defined('BASEPATH') OR exit('No direct script access allowed');

class Municipios extends CI_Controller {

	public function index( )
	{
		redirect(base_url().'inicio');
	}

  public function municipio( $municipio = NULL, $servicio = NULL)
	{
		if ( is_null($municipio) && is_null($servicio) )
		{
			redirect(base_url().'inicio');
		}
		else if ( is_null($servicio) )
		{
			$municipio = str_replace('%20', ' ', $municipio);

			$data['municipio'] 		 = $this->Municipio_model->get_municipio($municipio);
			$data['serv_sugerido'] = $this->Servicio_model->get_servicios_municipio_sug($municipio);
			$data['servicios'] 		 = $this->Servicio_model->get_servicios_municipio($municipio);
			$data['oficina'] 			 = $this->Oficina_model->get_datos_municipio($municipio);

			$this->load->view('plantillas/app_hmunicipios.php');

			$this->load->view('municipios.php', $data);

			$this->load->view('plantillas/app_footer_municipios.php');
		}
		else
		{
			$municipio = str_replace('%20', ' ', $municipio);
			$servicio = str_replace('%20', ' ', $servicio);

			$data['servicio'] 		 = $this->Servicio_model->get_servicio($servicio);
			$data['municipio'] 		 = $municipio;
			$data['servicios_sug'] = $this->Servicio_model->get_servicios_municipio_sug($municipio);
			$data['valoraciones']  = $this->Valoracion_model->get_datos_valoracion($servicio);;

			$this->load->view('plantillas/app_hservicios.php');

			$this->load->view('servicios.php', $data);

			$this->load->view('plantillas/app_footer_servicios.php');
		}
	}

}

?>


text:
import json
import pytest

from petlib.ec import EcPt

from claimchain.crypto.params import PublicParams, LocalParams

@pytest.fixture
def local_params():
    with LocalParams.generate().as_default() as params:
        yield params

def test_local_params_public_export(local_params):
    G = PublicParams.get_default().ec_group
    exported = local_params.public_export()

    for key in exported:
        assert not key.endswith("_sk")

    local_params1 = LocalParams.from_dict(exported)

    assert local_params1.vrf.pk == local_params.vrf.pk
    assert local_params1.sig.pk == local_params.sig.pk
    assert local_params1.dh.pk == local_params.dh.pk
    assert local_params1.rescue.pk == local_params.rescue.pk
    assert local_params1.vrf.sk is None
    assert local_params1.sig.sk is None
    assert local_params1.dh.sk is None
    assert local_params1.rescue.sk is None

def test_local_params_private_export(local_params):
    G = PublicParams.get_default().ec_group
    public_exported = local_params.public_export()
    private_exported = local_params.private_export()

    assert public_exported != private_exported
    for key, val in public_exported.items():
        assert private_exported[key] == val

    # check that export contains no bytes and is json dumpable
    data = json.dumps(private_exported)
    imp = json.loads(data)

    local_params1 = LocalParams.from_dict(imp)

    assert local_params1.vrf.sk == local_params.vrf.sk
    assert local_params1.sig.sk == local_params.sig.sk


text:
from distutils.core import setup

# Convert README.md to long description
try:
    import pypandoc
    long_description = pypandoc.convert('README.md', 'rst')
    long_description = long_description.replace("\r", "")  # YOU NEED THIS LINE
except (ImportError, OSError, IOError):
    print("Pandoc not found. Long_description conversion failure.")
    import io
    # pandoc is not installed, fallback to using raw contents
    with io.open('README.md', encoding="utf-8") as f:
        long_description = f.read()

setup(
    name='optimal',
    version='0.2.1',
    packages=['optimal', 'optimal.algorithms'],
    # Include example and test files
    package_data={'optimal': ['examples/*.py', 'tests/*.py', 'tests/algorithms/*.py']},
    # Include readme
    data_files=[('', ['README.md'])],
    # Dependencies
    install_requires=[
        'numpy'
    ],

    # Metadata
    author='Justin Lovinger',
    license='MIT',
    description="A python metaheuristic optimization library. Currently supports Genetic Algorithms, Gravitational Search, and Cross Entropy.",
    long_description=long_description,
    keywords=['optimization', 'metaheuristic', 'genetic algorithm', 'GA',
              'gravitational search algorithm', 'GSA', 'cross entropy'],

    url='https://github.com/JustinLovinger/optimal',
)