text:
'use strict';

const Support   = require(__dirname + '/../support'),
  DataTypes = require(__dirname + '/../../../lib/data-types'),
  expectsql = Support.expectsql,
  current   = Support.sequelize,
  sql       = current.dialect.QueryGenerator;

// Notice: [] will be replaced by dialect specific tick/quote character when there is not dialect specific expectation but only a default expectation

describe(Support.getTestDialectTeaser('SQL'), () => {
  describe('insert', () => {
    it('with temp table for trigger', () => {
      const User = Support.sequelize.define('user', {
        username: {
          type: DataTypes.STRING,
          field: 'user_name'
        }
      }, {
        timestamps: false,
        hasTrigger: true
      });

      const options = {
        returning: true,
        hasTrigger: true
      };
      expectsql(sql.insertQuery(User.tableName, {user_name: 'triggertest'}, User.rawAttributes, options),
        {
          query: {
            mssql: 'declare @tmp table ([id] INTEGER,[user_name] NVARCHAR(255));INSERT INTO [users] ([user_name]) OUTPUT INSERTED.[id],INSERTED.[user_name] into @tmp VALUES ($1);select * from @tmp;',
            postgres: 'INSERT INTO "users" ("user_name") VALUES ($1) RETURNING *;',
            default: 'INSERT INTO `users` (`user_name`) VALUES ($1);'
          },
          bind: ['triggertest']
        });

    });
  });

  describe('dates', () => {
    it('formats the date correctly when inserting', () => {
      const timezoneSequelize = Support.createSequelizeInstance({
        timezone: Support.getTestDialect() === 'sqlite' ? '+00:00' : 'CET'
      });

      const User = timezoneSequelize.define('user', {
        date: {
          type: DataTypes.DATE
        }
      }, {
        timestamps: false
      });

      expectsql(timezoneSequelize.dialect.QueryGenerator.insertQuery(User.tableName, {date: new Date(Date.UTC(2015, 0, 20))}, User.rawAttributes, {}),
        {
          query: {
            postgres: 'INSERT INTO "users" ("date") VALUES ($1);',
            mssql: 'INSERT INTO [users] ([date]) VALUES ($1);',
            default: 'INSERT INTO `users` (`date`) VALUES ($1);'
          },
          bind: {
            sqlite: ['2015-01-20 00:00:00.000 +00:00'],
            mysql: ['2015-01-20 01:00:00'],
            default: ['2015-01-20 01:00:00.000 +01:00']
          }
        });
    });

    it('formats date correctly when sub-second precision is explicitly specified', () => {
      const timezoneSequelize = Support.createSequelizeInstance({
        timezone: Support.getTestDialect() === 'sqlite' ? '+00:00' : 'CET'
      });

      const User = timezoneSequelize.define('user', {
        date: {
          type: DataTypes.DATE(3)
        }
      }, {
        timestamps: false
      });

      expectsql(timezoneSequelize.dialect.QueryGenerator.insertQuery(User.tableName, {date: new Date(Date.UTC(2015, 0, 20, 1, 2, 3, 89))}, User.rawAttributes, {}),
        {
          query: {
            postgres: 'INSERT INTO "users" ("date") VALUES ($1);',
            mssql: 'INSERT INTO [users] ([date]) VALUES ($1);',
            default: 'INSERT INTO `users` (`date`) VALUES ($1);'
          },
          bind: {
            sqlite: ['2015-01-20 01:02:03.089 +00:00'],
            mysql: ['2015-01-20 02:02:03.089'],
            default: ['2015-01-20 02:02:03.089 +01:00']
          }
        });
    });
  });

  describe('bulkCreate', () => {
    it('bulk create with onDuplicateKeyUpdate', () => {
      const User = Support.sequelize.define('user', {
        username: {
          type: DataTypes.STRING,
          field: 'user_name'
        },
        password: {
          type: DataTypes.STRING,
          field: 'pass_word'
        },
        createdAt: {
          type: DataTypes.DATE,
          field: 'created_at'
        },
        updatedAt: {
          type: DataTypes.DATE,
          field: 'updated_at'
        }
      }, {
        timestamps: true
      });

      expectsql(sql.bulkInsertQuery(User.tableName, [{ user_name: 'testuser', pass_word: '12345' }], { updateOnDuplicate: ['user_name', 'pass_word', 'updated_at'] }, User.fieldRawAttributesMap),
        {
          default: 'INSERT INTO `users` (`user_name`,`pass_word`) VALUES (\'testuser\',\'12345\');',
          postgres: 'INSERT INTO "users" ("user_name","pass_word") VALUES (\'testuser\',\'12345\');',
          mssql: 'INSERT INTO [users] ([user_name],[pass_word]) VALUES (N\'testuser\',N\'12345\');',
          mysql: 'INSERT INTO `users` (`user_name`,`pass_word`) VALUES (\'testuser\',\'12345\') ON DUPLICATE KEY UPDATE `user_name`=VALUES(`user_name`),`pass_word`=VALUES(`pass_word`),`updated_at`=VALUES(`updated_at`);'
        });
    });
  });
});


text:
module GraphQL
  class Schema
    class Member
      module Scoped
        # This is called when a field has `scope: true`.
        # The field's return type class receives this call.
        #
        # By default, it's a no-op. Override it to scope your objects.
        #
        # @param items [Object] Some list-like object (eg, Array, ActiveRecord::Relation)
        # @param context [GraphQL::Query::Context]
        # @return [Object] Another list-like object, scoped to the current context
        def scope_items(items, context)
          items
        end
      end
    end
  end
end

redpajama_set_name: RedPajamaGithub


text:
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright (C) 2015 Actor LLC. <https://actor.im>
  -->

<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_selected="true">
        <shape android:shape="rectangle">
            <corners android:radius="2dp" />
            <solid android:color="@color/secondary_selected" />
        </shape>
    </item>
    <item android:state_pressed="true">
        <shape android:shape="rectangle">
            <corners android:radius="2dp" />
            <solid android:color="@color/secondary_pressed" />
        </shape>
    </item>
    <item android:state_hovered="true">
        <shape android:shape="rectangle">
            <corners android:radius="2dp" />
            <solid android:color="@color/secondary_selected" />
        </shape>
    </item>
    <item>
        <shape android:shape="rectangle">
            <corners android:radius="2dp" />
            <solid android:color="@color/secondary" />
        </shape>
    </item>
</selector>


text:
Types
=======================================================

[![Build Status](https://travis-ci.org/lasp-lang/types.svg?branch=master)](https://travis-ci.org/lasp-lang/types)

## Types

Reference implementation for Conflict-free Replicated Data Types in
Erlang.


text:
DDH.game2048 = DDH.game2048 || {};

DDH.game2048.build = function(ops) {
    "use strict";

    // Global Variables Declaration
    var WINNUM = 2048,
        SIZE = 4,
        TILE_COUNT = SIZE * SIZE,
        started = false,
        tiles = init_area(),
        $game_area,
        $game_area_container,
        $game_points,
        $game_points_addition,
        $result_msg,
        $result_box,
        score = 0;

    function rc_to_index(row, col) {
        return row * SIZE + col;
    }

    function index_to_rc(index) {
        return { 'row' : Math.floor(index / SIZE), 'col' : index % SIZE };
    }

    function move(dir) {
        var points = 0;
        var transposed = false;
        var swapped =  false;

        if (dir === 'w' || dir === 's') {
            transpose_area();
            transposed = true;
        }
        if (dir === 'd' || dir === 's') {
            swap_cols_area();
            swapped = true;
        }

        var result = handle_move(transposed, swapped);

        if (dir === 'd' || dir === 's')
            swap_cols_area();
        if (dir === 'w' || dir === 's')
            transpose_area();

        if(result.points > 0)
            increase_points(result.points);

        return result.moved;
    }

    function handle_move(transposed, swapped) {
        var result = {'moved': false, 'points': false};

        var moves = 0;

        for(var i = 0; i < TILE_COUNT; ++i) {
            var row = Math.floor(i / SIZE),
                col = i % SIZE;
            moves = col === 0 ? 0 : moves;

            if (tiles[i].val === 0) {
                ++moves;
                continue;
            }

            //Move across empty tiles
            if(moves > 0) {
                var temp_tile = tiles[rc_to_index(row, col - moves)];
                temp_tile.val = 0;

                tiles[rc_to_index(row, col - moves)] = tiles[i];
                tiles[i] = temp_tile;

                result.moved = true;
            }

            //Find and merge two matching tiles
            for(var j = col + 1; j < SIZE; ++j) {
                var tile_a = tiles[rc_to_index(row, col - moves)];
                var tile_b = tiles[rc_to_index(row, j)];

                if(tile_b.val === 0)
                    continue;

                if(tile_a.val === tile_b.val) {
                    merge(tile_a, tile_b, row, col - moves, transposed, swapped);

                    result.points = tile_a.val;
                    result.moved = true;
                }
                break;
            }
        }

        return result;
    }

    function gen_translate_string(row, col) {
        return "translate(" + (col * 85 + 5) + "px," + (row * 85 + 5) + "px)";
    }

    //Row and col indicate the place where the animation should end
    function merge(tile_a, tile_b, row, col, transposed, swapped) {
        tile_a.val += tile_b.val;
        tile_b.val = 0;

        //Recalculate the real world pos
        if(swapped)
            col = SIZE - 1 - col;

        if(transposed) {
            var tmp = col;
            col = row;
            row = tmp;
        }

        var translate_string = gen_translate_string(row, col);

        tile_b.tile_div.css({ "-ms-transform" : translate_string,
                        "-webkit-transform" : translate_string,
                        "transform" : translate_string,
                        "opacity" : 0.00 });

        tile_b.tile_div.on("transitionend webkitTransitionEnd oTransitionEnd otransitionend MSTransitionEnd", function () {
            $(this).remove();
        });
    }

    // Updates the 'points' div
    function increase_points(points) {
        score += points;
        var addition = $("<div>").addClass("score-addition").text(points);

        $game_points.text(score);
        $game_points_addition.html(addition);
    }

    function reset_points() {
        score = 0;
        $game_points.text(0);
    }

    //Update the board
    function update_tiles() {
        for(var i = 0; i < TILE_COUNT; ++i) {
            var pos = index_to_rc(i);
            var tile = tiles[i];

            if("undefined" !== typeof(tile.tile_div) && tile.val > 0) {
                var translate_string = gen_translate_string(pos.row, pos.col);
                tile.tile_div
                    .html(tile.val)
                    .addClass("boxtile val-" + tile.val)
                    .css({
                        "-ms-transform" : translate_string,
                        "-webkit-transform" : translate_string,
                        "transform" : translate_string,
                        "display" : "block"
                    });
            }
        }
    }

    function init_area() {
        var tiles = [TILE_COUNT];

        for(var i = 0; i < TILE_COUNT; ++i) {
            tiles[i] = { val: 0 };
        }

        return tiles;
    }

    function swap_tiles(a, b) {
        var tmp = tiles[a];
        tiles[a] = tiles[b];
        tiles[b] = tmp;
    }

    function transpose_area() {
        for(var i = 0; i < TILE_COUNT; ++i) {
            var pos = index_to_rc(i);

            if(pos.col >= pos.row)
                continue;

            var index_to_swap = rc_to_index(pos.col, pos.row);
            swap_tiles(i, index_to_swap);
        }
    }

    function swap_cols_area() {
        for(var i = 0; i < TILE_COUNT; ++i) {
            var pos = index_to_rc(i);

            if(pos.col >= SIZE / 2)
                continue;

            var index_to_swap = rc_to_index(pos.row, SIZE - 1 - pos.col);
            swap_tiles(i, index_to_swap);
        }
    }

    //4 has a 10% chance of being chosen
    function add_random_tile() {
        var unused_tiles = [];
        for(var i = 0; i < TILE_COUNT; ++i) {
            if(tiles[i].val === 0) {
                unused_tiles.push(i);
            }
        }

        var rand_tile = unused_tiles[Math.floor(Math.random() * unused_tiles.length)];
        var rand_val = Math.floor(Math.random() * 11) < 2 ? 4 : 2;

        tiles[rand_tile].tile_div = create_tile_div();
        tiles[rand_tile].val = rand_val;
    }

    function create_tile_div() {
        //Hide the div initially as a workaround for funky IE9 animations
        var tile_div = $("<div>").hide();
        $game_area_container.append(tile_div);
        return tile_div;
    }

    function has_won() {
        for(var i = 0; i < TILE_COUNT; ++i) {
            if (tiles[i].val === WINNUM) {
                game_over_message(true);
                return true;
            }
        }
        return false;
    }

    function has_lost() {
        for(var i = 0; i < TILE_COUNT; ++i) {
            if (tiles[i].val === 0)
                return false;

            var pos = index_to_rc(i);

            // check all possible movements
            if ((pos.row !== 0 && tiles[i].val === tiles[i - SIZE].val) ||
                (pos.row !== SIZE - 1 && tiles[i].val === tiles[i + SIZE].val) ||
                (pos.col !== 0 && tiles[i].val === tiles[i - 1].val) ||
                (pos.col !== SIZE - 1 && tiles[i].val === tiles[i + 1].val)) {
                return false;
            }
        }

        game_over_message(false);
        return true;
    }

    function is_game_over() {
        return has_won() || has_lost();
    }

    function game_over_message(game_won) {
        if (game_won) {
            $result_msg.text("You Won!");
            $result_box.addClass("game2048__won");
        } else {
            $result_msg.text("You Lost!");
            $result_box.removeClass("game2048__won");
        }
        $result_box.show();
    }

    function init_game() {
        reset_points();
        $result_box.hide();

        //Clear displayed board
        $game_area_container.children(".boxtile").remove();
        $game_area.focus();

        //Clear internal tile administration
        tiles = init_area();

        //Start over
        add_random_tile();
        update_tiles();
    }

    function handle_buttons(e) {
        e.preventDefault();

        var move_made = false;

        if (is_game_over())
            return false;

        if (e.keyCode === 87 || e.keyCode === 38) { // w or up arrow
            move_made = move('w');
        } else if (e.keyCode === 65 || e.keyCode === 37) { // a or left arrow
            move_made = move('a');
        } else if (e.keyCode === 83 || e.keyCode === 40) { // s or dowm arrow
            move_made = move('s');
        } else if (e.keyCode === 68 || e.keyCode === 39) { // d or right arrow
            move_made = move('d');
        }

        if (move_made) {
            add_random_tile();
            update_tiles();
        }
        return false;
    }

    return {
        onShow: function() {
            //Hide this goodie on mobile devices for now
            if(DDG.device.isMobile || DDG.device.isMobileDevice) {
                DDH.spice_tabs.game2048.hideLink();
                DDH.spice_tabs.game2048.hide();
                return;
            }

            //'started' is a boolean variable used in order to avoid the
            //duplication of the gaming tiles. Moving around the DDG tabs the
            //'onShow' function is executed over and over. This simple solution
            //prevents the problem
            if (started)
                return;

            started = true;
            $game_area = $('#game2048__area');
            $game_area_container = $("#game2048__area_container");
            $game_points = $('.game2048__points');
            $game_points_addition = $('.game2048__points_addition');
            $result_msg = $('#game2048__area_container .game2048__message p');
            $result_box = $('#game2048__area_container .game2048__message');
            var $new_game_button = $(".zci--game2048 .game2048__new_game")

            $game_area.keydown(handle_buttons);

            init_game();

            //Register new game button listener
            $new_game_button.on("click", function(e) {
                e.preventDefault();
                init_game();
            });
        }
    };
};


text:
package io.buoyant.transformer.perHost

import com.fasterxml.jackson.annotation.JsonIgnore
import com.twitter.finagle.{Path, Stack}
import io.buoyant.config.types.Port
import io.buoyant.namer.{NameTreeTransformer, TransformerConfig, TransformerInitializer}

class PortTransformerInitializer extends TransformerInitializer {
  val configClass = classOf[PortTransformerConfig]
  override val configId = "io.l5d.port"
}

case class PortTransformerConfig(port: Port) extends TransformerConfig {

  @JsonIgnore
  val defaultPrefix = Path.read(s"/io.l5d.port/${port.port}")

  override def mk(params: Stack.Params): NameTreeTransformer = new PortTransformer(prefix, port.port)
}


text:
package adapters;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.squareup.picasso.Picasso;

import java.util.ArrayList;
import java.util.List;

import io.github.project_travel_mate.R;
import objects.Contributor;

/**
 * @author amoraitis
 */
public class ContributorsAdapter extends BaseAdapter {
    private final Context mContext;
    private List<Contributor> mContributors;

    public ContributorsAdapter(Context context, List<Contributor> contributors) {
        mContext = context;
        mContributors = contributors;
    }

    @Override
    public int getCount() {
        return mContributors.size();
    }

    @Override
    public Object getItem(int i) {
        return mContributors.get(i);
    }

    @Override
    public long getItemId(int i) {
        return 0;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        final Contributor contributor = mContributors.get(position);
        if (convertView == null) {
            final LayoutInflater layoutInflater = LayoutInflater.from(mContext);
            convertView = layoutInflater.inflate(R.layout.contributors_gridview_item, null);
        }

        final ImageView contributor_avatarImageView = convertView.findViewById(R.id.contributor_image);
        final TextView contributor_unameTextView = convertView.findViewById(R.id.contributor_name);
        final TextView contributor_contibutionsTextView =
                convertView.findViewById(R.id.contributor_contributions);
        String contributorAvatarUrl = contributor.getAvatarUrl();
        Picasso.with(mContext).load(contributorAvatarUrl).centerCrop()
                .resize(250, 250)
                .into(contributor_avatarImageView);
        final String unameFormatted = "@" + contributor.getUsername();
        contributor_unameTextView.setText(unameFormatted);
        contributor_contibutionsTextView.setText(String.valueOf(contributor.getContributions()));
        return convertView;
    }

    /**
     * Replaces dataset with the argument's dataset
     * ans notifies the UI about those changes
     *
     * @param newContributors - new data to be set to list
     */
    public void update(ArrayList<Contributor> newContributors) {
        mContributors.clear();
        this.mContributors = newContributors;
        this.notifyDataSetChanged();
    }
}


text:
package org.jboss.hal.ballroom.dataprovider;

import org.junit.Test;

import static org.junit.Assert.assertEquals;

public class PageInfoTest {

    private static final int PAGE_SIZE = 10;

    @Test
    public void empty() throws Exception {
        PageInfo pageInfo = new PageInfo(PAGE_SIZE);
        assertEmpty(pageInfo);
    }

    @Test
    public void reset() throws Exception {
        PageInfo pageInfo = new PageInfo(PAGE_SIZE, 1, 2, 3);
        pageInfo.reset();
        assertEmpty(pageInfo);
    }

    @Test
    public void setPageSize() throws Exception {
        PageInfo pageInfo = new PageInfo(PAGE_SIZE, 0, 50, 100);
        assertEquals(10, pageInfo.getPages());

        pageInfo.setPageSize(15);
        assertEquals(7, pageInfo.getPages());

        pageInfo.setPageSize(20);
        assertEquals(5, pageInfo.getPages());
    }

    @Test
    public void setIllegalPageSize() throws Exception {
        PageInfo pageInfo = new PageInfo(PAGE_SIZE);
        pageInfo.setPageSize(-1);
        assertEquals(1, pageInfo.getPageSize());
    }

    @Test
    public void setPage() throws Exception {
        PageInfo pageInfo = new PageInfo(PAGE_SIZE, 0, 50, 100);
        pageInfo.setPage(1);
        assertEquals(1, pageInfo.getPage());
        assertEquals(11, pageInfo.getFrom());
        assertEquals(20, pageInfo.getTo());
    }

    @Test
    public void setIllegalPage() throws Exception {
        PageInfo pageInfo = new PageInfo(PAGE_SIZE, 0, 50, 100);
        pageInfo.setPage(-1);
        assertEquals(0, pageInfo.getPage());
        pageInfo.setPage(10);
        assertEquals(9, pageInfo.getPage());
    }

    @Test
    public void setVisible() throws Exception {
        PageInfo pageInfo = new PageInfo(PAGE_SIZE, 0, 50, 100);
        pageInfo.setVisible(66);
        assertEquals(66, pageInfo.getVisible());
    }

    @Test
    public void setIllegalVisible() throws Exception {
        PageInfo pageInfo = new PageInfo(PAGE_SIZE, 0, 50, 100);
        pageInfo.setVisible(101);
        assertEquals(100, pageInfo.getVisible());
    }

    private void assertEmpty(PageInfo pageInfo) {
        assertEquals(PAGE_SIZE, pageInfo.getPageSize());
        assertEquals(0, pageInfo.getPage());
        assertEquals(1, pageInfo.getPages());
        assertEquals(0, pageInfo.getVisible());
        assertEquals(0, pageInfo.getTotal());
        assertEquals(0, pageInfo.getFrom());
        assertEquals(0, pageInfo.getTo());
    }
}


text:
FROM ubuntu:14.04
MAINTAINER Michael Mayr <michael@dermitch.de>

ENV DEBIAN_FRONTEND noninteractive
RUN echo "force-unsafe-io" > /etc/dpkg/dpkg.cfg.d/02apt-speedup; \
    echo "Acquire::http {No-Cache=True;};" > /etc/apt/apt.conf.d/no-cache; \
    apt-get update;

RUN apt-get install -y --no-install-recommends squid-deb-proxy

# Configuration
# 4000 MB should be enough for a lot of packages
RUN install --owner=proxy --group=proxy -d /cache; \
	sed -i 's/http_port 8000/http_port 80/' /etc/squid-deb-proxy/squid-deb-proxy.conf; \
	sed -i 's/cache_dir aufs \/var\/cache\/squid-deb-proxy 40000 16 256/cache_dir aufs \/cache 4000 16 256/' /etc/squid-deb-proxy/squid-deb-proxy.conf; \
	sed -i '/^cache_access_log/d' /etc/squid-deb-proxy/squid-deb-proxy.conf; \
	sed -i '/^cache_log/d' /etc/squid-deb-proxy/squid-deb-proxy.conf; \
	sed -i '/^cache_store_log/d' /etc/squid-deb-proxy/squid-deb-proxy.conf;

ADD extra-mirrors.list /etc/squid-deb-proxy/mirror-dstdomain.acl.d/20-extra
ADD boot.sh /boot.sh

EXPOSE 80
VOLUME "/cache"
CMD ["/boot.sh"]


text:
package com.cisco.oss.foundation.directory.impl;

import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;

import org.junit.BeforeClass;
import org.junit.Test;

import com.cisco.oss.foundation.directory.LookupManager;
import com.cisco.oss.foundation.directory.RegistrationManager;
import com.cisco.oss.foundation.directory.ServiceInstanceChangeListener;
import com.cisco.oss.foundation.directory.entity.InstanceChange;
import com.cisco.oss.foundation.directory.entity.OperationalStatus;
import com.cisco.oss.foundation.directory.entity.ProvidedServiceInstance;
import com.cisco.oss.foundation.directory.entity.ServiceInstance;
import com.cisco.oss.foundation.directory.exception.ErrorCode;
import com.cisco.oss.foundation.directory.exception.ServiceException;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.mockito.Mockito.mock;

import static com.cisco.oss.foundation.directory.impl.ServiceDirectoryConfig.ClientType.IN_MEMORY;

/**
 * Unit Test for ServiceInstanceChangeListener
 */
public class ServiceInstanceChangeListenerTest {
    @BeforeClass
    public static void setUp() throws Exception {
        factory = ServiceDirectoryConfig.config().setCacheEnabled(false).setClientType(IN_MEMORY).build();
        final ProvidedServiceInstance fooInstance = new ProvidedServiceInstance("foo","192.168.1.1");
        fooInstance.setUri("http://foo/service");
        fooInstance.setStatus(OperationalStatus.DOWN);
        factory.getRegistrationManager().registerService(fooInstance);
        TimeUnit.MILLISECONDS.sleep(1L); //make sure change check start time is later than registration.
        factory.start();
    }

    private static ConfigurableServiceDirectoryManagerFactory factory;

    @Test
    public void testAddRemove() {
        ServiceInstanceChangeListener listener = mock(ServiceInstanceChangeListener.class);

        try (LookupManager lookup = factory.getLookupManager()){
            // test for normal add/remove OK
            lookup.addInstanceChangeListener("foo", listener);
            lookup.removeInstanceChangeListener("foo", listener);

            // test for not_exist service
            try {
                lookup.addInstanceChangeListener("not_exist", listener);
                fail();
            } catch (ServiceException e) {
                assertEquals(ErrorCode.SERVICE_DOES_NOT_EXIST, e.getErrorCode());
            }

            // test for handler not found
            lookup.addInstanceChangeListener("foo", listener);
            try {
                // the handler is not myHandler
                lookup.removeInstanceChangeListener("foo", mock(ServiceInstanceChangeListener.class));
            }catch(ServiceException e){
                assertEquals(ErrorCode.SERVICE_INSTANCE_LISTENER_DOES_NOT_EXIST,e.getErrorCode());
            }
        }
    }

    @Test
    public void testOnChange() throws Exception {
        final CountDownLatch countDown = new CountDownLatch(1);
        final AtomicReference<ServiceInstance> lastInst = new AtomicReference<>();
        final ServiceInstanceChangeListener listener = new ServiceInstanceChangeListener() {
            @Override
            public void onChange(InstanceChange.ChangeType type, InstanceChange<ServiceInstance> change) throws Exception {
                System.out.printf("%s%n",change);
                if(type== InstanceChange.ChangeType.REMOVE){ // the last one is remove
                    lastInst.set(change.from);
                    countDown.countDown();
                }
            }
        };
        try (LookupManager lookup = factory.getLookupManager();RegistrationManager reg = factory.getRegistrationManager()){
            lookup.addInstanceChangeListener("foo", listener);
            reg.updateServiceOperationalStatus("foo", "192.168.1.1", OperationalStatus.UP);
            assertEquals(OperationalStatus.UP, lookup.lookupInstance("foo").getStatus());
            reg.updateServiceOperationalStatus("foo", "192.168.1.1", OperationalStatus.DOWN);
            assertEquals(OperationalStatus.DOWN, lookup.getInstanceByAddress("foo","192.168.1.1").getStatus());
            reg.updateServiceOperationalStatus("foo", "192.168.1.1", OperationalStatus.UP);
            assertEquals(OperationalStatus.UP, lookup.lookupInstance("foo").getStatus());

            reg.registerService(new ProvidedServiceInstance("foo", "192.168.1.2","http://cisco.com/foo/2",
                    OperationalStatus.DOWN, null));
            TimeUnit.MILLISECONDS.sleep(10L);
            reg.updateServiceOperationalStatus("foo", "192.168.1.2", OperationalStatus.UP);
            reg.unregisterService("foo", "192.168.1.2");
            assertTrue("Should not wait more than 5 sec", countDown.await(5, TimeUnit.SECONDS));
            assertEquals("192.168.1.2", lastInst.get().getAddress());
            lookup.removeInstanceChangeListener("foo", listener);
        }
    }

    @Test
    public void testOnTimeOut() throws Exception{
        final CountDownLatch countDown = new CountDownLatch(1);
        final ServiceInstanceChangeListener evilOne = new ServiceInstanceChangeListener() {
            @Override
            public void onChange(InstanceChange.ChangeType type, InstanceChange<ServiceInstance> change) throws Exception {
                System.out.printf("Evil One : %s%n",change);
                TimeUnit.SECONDS.sleep(5L);
                fail("Evil One : should not be finished!");
            }
        };
        final ServiceInstanceChangeListener goodOne = new ServiceInstanceChangeListener() {
            @Override
            public void onChange(InstanceChange.ChangeType type, InstanceChange<ServiceInstance> change) throws Exception {
                System.out.printf("Good One : %s%n",change);
                countDown.countDown();
                System.out.printf("Good One : has been countDown.%n");
            }
        };
        try (LookupManager lookup = factory.getLookupManager();RegistrationManager reg = factory.getRegistrationManager()) {
            lookup.addInstanceChangeListener("foo", evilOne);
            lookup.addInstanceChangeListener("foo", goodOne);
            reg.updateServiceOperationalStatus("foo", "192.168.1.1", OperationalStatus.UP);
            assertTrue("should not wait for more than 5s", countDown.await(5, TimeUnit.SECONDS));
            lookup.removeInstanceChangeListener("foo", evilOne); //must remove this one
            lookup.removeInstanceChangeListener("foo",goodOne);
        }
    }

    @Test
    public void testOnException() throws Exception{
        final CountDownLatch countDown = new CountDownLatch(1);
        final ServiceInstanceChangeListener exceptionOne = new ServiceInstanceChangeListener() {
            @Override
            public void onChange(InstanceChange.ChangeType type, InstanceChange<ServiceInstance> change) throws Exception {
                System.out.printf("Exception One : %s%n",change);
                throw new Exception("Oops!");
            }
        };
        final ServiceInstanceChangeListener goodOne = new ServiceInstanceChangeListener() {
            @Override
            public void onChange(InstanceChange.ChangeType type, InstanceChange<ServiceInstance> change) throws Exception {
                System.out.printf("Good One : %s%n",change);
                countDown.countDown();
                System.out.printf("Good One : has been countDown.%n");
            }
        };

        try (LookupManager lookup = factory.getLookupManager();RegistrationManager reg = factory.getRegistrationManager()) {
            lookup.addInstanceChangeListener("foo", exceptionOne);
            lookup.addInstanceChangeListener("foo", goodOne);
            reg.updateServiceOperationalStatus("foo", "192.168.1.1", OperationalStatus.UP);
            countDown.await();
            lookup.removeInstanceChangeListener("foo", exceptionOne);
            lookup.removeInstanceChangeListener("foo", goodOne);
        }
    }
}


text:
static NSString* kDROPBOX_KEY = @"4ibrxvwy9xmb6o0";
static NSString* kDROPBOX_SECRET = @"tr904xkznrhppsk";

extern NSString *dropboxLinkSucceeded;

@implementation CSAppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    // Override point for customization after application launch.
    DBAccountManager *accountManager = [[DBAccountManager alloc] initWithAppKey:kDROPBOX_KEY secret:kDROPBOX_SECRET];
    [DBAccountManager setSharedManager:accountManager];

    [self performSelector:@selector(linkDropbox) withObject:nil afterDelay:0.f];
    return YES;
}

- (void)linkDropbox{
    DBAccount *account = [[DBAccountManager sharedManager] linkedAccount];
    if(!account)
        [[DBAccountManager sharedManager] linkFromController:self.window.rootViewController];
}

- (void)applicationWillResignActive:(UIApplication *)application
{
    // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
    // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}

- (void)applicationDidEnterBackground:(UIApplication *)application
{
    // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
    // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}

- (void)applicationWillEnterForeground:(UIApplication *)application
{
    // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
}

- (void)applicationDidBecomeActive:(UIApplication *)application
{
    // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}

- (void)applicationWillTerminate:(UIApplication *)application
{
    // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}

- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url
  sourceApplication:(NSString *)source annotation:(id)annotation {
    DBAccount *account = [[DBAccountManager sharedManager] handleOpenURL:url];
    if (account) {
        NSLog(@"App linked successfully!");

        [[NSNotificationCenter defaultCenter] postNotificationName:dropboxLinkSucceeded object:nil];
        return YES;
    }
    return NO;
}

@end


text:
ObjC-Environments
=================

Quick Environments Loading mechanism


text:
from flask import Flask, render_template
# from flask.ext.script import Manager
from flask.ext.bootstrap import Bootstrap

app = Flask(__name__)

# manager = Manager(app)
bootstrap = Bootstrap(app)

DEBUG = True

@app.route('/')
def index():
    return render_template('index.html')

@app.route('/user/<name>')
def user(name):
    return render_template('user.html', name=name)

if __name__ == '__main__':
    app.run(host='0.0.0.0', port=3000)


text:
import { Container } from "./container.js";
import { Field } from "./field.js";

export class Dictionary extends Container {
  /**
   * @param {import("../tokeniser.js").Tokeniser} tokeniser
   * @param {object} [options]
   * @param {import("../tokeniser.js").Token} [options.partial]
   */
  static parse(tokeniser, { partial } = {}) {
    const tokens = { partial };
    tokens.base = tokeniser.consume("dictionary");
    if (!tokens.base) {
      return;
    }
    return Container.parse(
      tokeniser,
      new Dictionary({ source: tokeniser.source, tokens }),
      {
        inheritable: !partial,
        allowedMembers: [[Field.parse]],
      }
    );
  }

  get type() {
    return "dictionary";
  }
}


text:
package com.continuum.nova;

import com.sun.jna.*;

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

public interface NovaNative extends Library
{
    NovaNative INSTANCE = (NovaNative) Native.loadLibrary("nova-renderer", NovaNative.class);

    class mc_atlas_texture extends Structure
    {
        public int width;
        public int height;
        public int num_components;
        public Pointer texture_data;

        public mc_atlas_texture(int width, int height, int num_components, byte[] texture_data)
        {
            this.width = width;
            this.height = height;
            this.num_components = num_components;
            this.texture_data = new Memory(width * height * num_components * Native.getNativeSize(Byte.TYPE));

            for (int i = 0; i < width * height * num_components; i++)
            {
                this.texture_data.setByte(i, texture_data[i]);
            }
        }

        @Override
        public List<String> getFieldOrder()
        {
            return Arrays.asList("width", "height", "num_components", "texture_data");
        }
    }

    class mc_texture_atlas_location extends Structure
    {
        public String name;
        public float min_u;
        public float max_u;
        public float min_v;
        public float max_v;

        public mc_texture_atlas_location(String name, float min_u, float min_v, float max_u, float max_v)
        {
            this.name = name;
            this.min_u = min_u;
            this.max_u = max_u;
            this.min_v = min_v;
            this.max_v = max_v;
        }

        @Override
        public List<String> getFieldOrder()
        {
            return Arrays.asList("name", "min_u", "max_u", "min_v", "max_v");
        }
    }

    class mc_block extends Structure
    {
        public boolean is_on_fire;
        public int block_id;

        @Override
        public List<String> getFieldOrder()
        {
            return Arrays.asList("is_on_fire", "block_id");
        }
    }

    class mc_chunk extends Structure
    {
        public long chunk_id;

        public boolean is_dirty;
        public mc_block[] blocks = new mc_block[16 * 16 * 16];

        @Override
        public List<String> getFieldOrder()
        {
            return Arrays.asList("chunk_id", "is_dirty", "blocks");
        }
    }

    class mc_gui_button extends Structure
    {
        public int x_position;
        public int y_position;
        public int width;
        public int height;
        public String text;
        public boolean is_pressed;

        @Override
        protected List<String> getFieldOrder()
        {
            return Arrays.asList("x_position", "y_position", "width", "height", "is_pressed");
        }
    }

    class mc_gui_screen extends Structure
    {
        public mc_gui_button[] buttons = new mc_gui_button[22];
        public int num_buttons;

        @Override
        public List<String> getFieldOrder()
        {
            return Arrays.asList("buttons", "num_buttons");
        }
    }

    class mc_render_menu_params extends Structure
    {
        public mc_gui_screen cur_screen;

        @Override
        protected List<String> getFieldOrder()
        {
            return Collections.singletonList("cur_screen");
        }
    }

    class mc_render_world_params extends Structure
    {
        public double camera_x;
        public double camera_y;
        public double camera_z;

        @Override
        protected List<String> getFieldOrder()
        {
            return Arrays.asList(
                       "camera_x", "camera_y", "camera_z"
                   );
        }
    }

    class mc_render_command extends Structure
    {
        public long previous_frame_time;

        public float mouse_x;
        public float mouse_y;

        public mc_render_world_params world_params;
        public mc_render_menu_params menu_params;

        @Override
        protected List<String> getFieldOrder()
        {
            return Arrays.asList("previous_frame_time", "mouse_x", "mouse_y", "world_params", "menu_params");
        }
    }

    class mc_settings extends Structure
    {
        public boolean render_menu;

        public boolean anaglyph;

        public double fog_color_red;
        public double fog_color_green;
        public double fog_color_blue;

        public int display_width;
        public int display_height;

        public boolean view_bobbing;
        public int should_render_clouds;

        public int render_distance;

        public boolean has_blindness;

        @Override
        protected List<String> getFieldOrder()
        {
            return Arrays.asList(
                       "anaglyph", "fog_color_red", "fog_color_green", "fog_color_blue", "display_width",
                       "display_height", "view_bobbing", "should_render_clouds", "render_distance", "render_menu",
                       "has_blindness"
                   );
        }
    }

    class mc_add_chunk_command extends Structure
    {
        public mc_chunk new_chunk;

        public float chunk_x;
        public float chunk_y;
        public float chunk_z;

        @Override
        protected List<String> getFieldOrder()
        {
            return Arrays.asList("new_chunk", "chunk_x", "chunk_y", "chunk_x");
        }
    }

    class mc_set_gui_screen_command extends Structure
    {
        public mc_gui_screen screen;

        @Override
        protected List<String> getFieldOrder()
        {
            return Collections.singletonList("screen");
        }
    }

    enum AtlasType
    {
        TERRAIN,
        ENTITIES,
        GUI,
        PARTICLES,
        EFFECTS,
        FONT,
        NUM_ATLASES
    }

    enum TextureType
    {
        ALBEDO,
        NORMAL,
        SPECULAR
    }

    void init_nova();

    void add_texture(mc_atlas_texture texture, int atlas_type, int texture_type);

    void add_texture_location(mc_texture_atlas_location location);

    int get_max_texture_size();

    void reset_texture_manager();

    void send_render_command(mc_render_command cmd);

    void do_test_render();

    boolean should_close();

    void send_change_gui_screen_command(mc_set_gui_screen_command set_gui_screen);
}


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

#ifndef ADOBE_ALGORITHM_RANDOM_SHUFFLE_HPP
#define ADOBE_ALGORITHM_RANDOM_SHUFFLE_HPP

#include <adobe/config.hpp>

#include <boost/range/begin.hpp>
#include <boost/range/end.hpp>
#include <boost/bind.hpp>

#include <algorithm>

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

namespace adobe {

/*************************************************************************************************/
/*!
\defgroup random_shuffle random_shuffle
\ingroup mutating_algorithm

\see
    - STL documentation for \ref stldoc_random_shuffle
*/
/*************************************************************************************************/
/*!
    \ingroup random_shuffle

    \brief random_shuffle implementation
*/
template <class RandomAccessRange>
inline void random_shuffle(RandomAccessRange& range)
{
    return std::random_shuffle(boost::begin(range), boost::end(range));
}

/*!
    \ingroup random_shuffle

    \brief random_shuffle implementation
*/
template <class RandomAccessIterator, class RandomNumberGenerator>
inline void
random_shuffle(RandomAccessIterator first, RandomAccessIterator last, RandomNumberGenerator& rand)
{
    return std::random_shuffle(first, last, boost::bind(rand, _1));
}

/*!
    \ingroup random_shuffle

    \brief random_shuffle implementation
*/
template <class RandomAccessRange, class RandomNumberGenerator>
inline void random_shuffle(RandomAccessRange& range, RandomNumberGenerator& rand)
{
    return adobe::random_shuffle(boost::begin(range), boost::end(range), rand);
}

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

} // namespace adobe

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

#endif

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


text:
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Server.Model
{
    [Table("ROLE")]
    public class Role : BaseEntity
    {
        [Required]
        public virtual string Name { get; set; }

        public virtual bool UserCreation { get; set; }
        public virtual bool RoleCreation { get; set; }
        public virtual bool MenuCreation { get; set; }
        public virtual bool CreateUpdateDeleteAll { get; set; }

        public override string ToString()
        {
            return Name;
        }
    }
}


text:
We like to go on big hacker camps, like SHA2017, CCC Summer Camp etc.

When going to such a camp there are some things that make life MUCH easier.

This repository is intended to help you get your things ready, so we provide
a few checklist, which may inspire you to remember things.

The Generic Camp checklist is generic-checklist.md and would be a good starting point.

There are also a couple of examples of "real checklists" I have used, and since
for instance BornHack repeats every year, I re-use and expand that one.

So have fun, and let me know if you think something should be added.


text:
* [cattonum announcement](/cattonum-announcement.html)
* [cattonum accepted to CRAN](https://CRAN.R-project.org/package=cattonum)
* [Promotion](https://www.bizjournals.com/cincinnati/potmsearch/detail/submission/6433408/Bernie_Gray)
* [Ask the Actuary Series (1)](https://research.nd.edu/news/69968-young-alumni-present-from-actuarial-science-to-a-predictive-analytics-career/)
* [Ask the Actuary Series (2)](http://science.nd.edu/events/2016/09/19/ask-the-actuaries-seminar-from-actuarial-science-to-a-predictive-analytics-career/)
* [Math career panel (1)](http://scientia.nd.edu/news/55474-the-benefits-of-graduating-with-a-math-degree/)
* [Math career panel (2)](http://math.nd.edu/assets/113721/panelposterfull10_10.pdf)
* [Eagle Scout](http://troop52campers.org/eagle-honor-role)


text:
using System.Linq;
using System.Text;
using Essentions.IO;
using NSubstitute;
using NUnit.Framework;

namespace Essentions.Tests.IO
{
    public sealed class FileExtensionsTests
    {
        public sealed class TheOpenMethod
        {
            public sealed class WithFileMode
            {
                [Test]
                public void Should_Throw_If_File_Is_Null()
                {
                    // Given, When
                    var result = Assert.Catch(() => FileExtensions.Open(null, FileMode.Create));

                    // Then
                    AssertEx.IsArgumentNullException(result, "file");
                }

                [Test]
                [TestCase(FileMode.Append, FileAccess.Write)]
                [TestCase(FileMode.Create, FileAccess.ReadWrite)]
                [TestCase(FileMode.CreateNew, FileAccess.ReadWrite)]
                [TestCase(FileMode.Open, FileAccess.ReadWrite)]
                [TestCase(FileMode.OpenOrCreate, FileAccess.ReadWrite)]
                [TestCase(FileMode.Truncate, FileAccess.ReadWrite)]
                public void Should_Open_With_Specified_File_Mode_And_Infer_File_Access(FileMode mode, FileAccess access)
                {
                    // Given
                    var file = Substitute.For<IFile>();

                    // When
                    file.Open(mode);

                    // Then
                    file.Received(1).Open(mode, access, FileShare.None);
                }
            }

            public sealed class WithFileModeAndFileAccess
            {
                [Test]
                public void Should_Throw_If_File_Is_Null()
                {
                    // Given, When
                    var result = Assert.Catch(() => FileExtensions.Open(null, FileMode.Create, FileAccess.Write));

                    // Then
                    AssertEx.IsArgumentNullException(result, "file");
                }

                [Test]
                [TestCase(FileMode.Append, FileAccess.Write)]
                [TestCase(FileMode.Create, FileAccess.ReadWrite)]
                [TestCase(FileMode.CreateNew, FileAccess.ReadWrite)]
                [TestCase(FileMode.Open, FileAccess.ReadWrite)]
                [TestCase(FileMode.OpenOrCreate, FileAccess.ReadWrite)]
                [TestCase(FileMode.Truncate, FileAccess.ReadWrite)]
                public void Should_Open_With_Specified_File_Mode_And_Infer_File_Access(FileMode mode, FileAccess access)
                {
                    // Given
                    var file = Substitute.For<IFile>();

                    // When
                    file.Open(mode, access);

                    // Then
                    file.Received(1).Open(mode, access, FileShare.None);
                }
            }
        }

        public sealed class TheOpenReadMethod
        {
            [Test]
            public void Should_Throw_If_File_Is_Null()
            {
                // Given, When
                var result = Assert.Catch(() => FileExtensions.OpenRead(null));

                // Then
                AssertEx.IsArgumentNullException(result, "file");
            }

            [Test]
            public void Should_Open_Stream_With_Expected_FileMode_And_FileAccess()
            {
                // Given
                var file = Substitute.For<IFile>();

                // When
                file.OpenRead();

                // Then
                file.Received(1).Open(FileMode.Open, FileAccess.Read, FileShare.Read);
            }
        }

        public sealed class TheOpenWriteMethod
        {
            [Test]
            public void Should_Throw_If_File_Is_Null()
            {
                // Given, When
                var result = Assert.Catch(() => FileExtensions.OpenWrite(null));

                // Then
                AssertEx.IsArgumentNullException(result, "file");
            }

            [Test]
            public void Should_Open_Stream_With_Expected_FileMode_And_FileAccess()
            {
                // Given
                var file = Substitute.For<IFile>();

                // When
                file.OpenWrite();

                // Then
                file.Received(1).Open(FileMode.Create, FileAccess.Write, FileShare.None);
            }
        }

        public sealed class TheReadLinesMethod
        {
            [Test]
            public void Should_Throw_If_File_Is_Null()
            {
                // Given, When
                var result = Assert.Catch(() => FileExtensions.ReadLines(null, Encoding.UTF8));

                // Then
                AssertEx.IsArgumentNullException(result, "file");
            }

            [Test]
            public void Should_Return_Empty_List_If_File_Contains_No_Lines()
            {
                // Given
                var environment = FakeEnvironment.CreateUnixEnvironment();
                var fileSystem = new FakeFileSystem(environment);
                var file = fileSystem.CreateFile("text.txt");

                // When
                var result = file.ReadLines(Encoding.UTF8).ToList();

                // Then
                Assert.AreEqual(0, result.Count);
            }

            [Test]
            public void Should_Read_File_With_Single_Line_Correctly()
            {
                // Given
                var environment = FakeEnvironment.CreateUnixEnvironment();
                var fileSystem = new FakeFileSystem(environment);
                var file = fileSystem.CreateFile("text.txt").SetText("Hello World");

                // When
                var result = file.ReadLines(Encoding.UTF8).ToList();

                // Then
                Assert.AreEqual(1, result.Count);
            }

            [Test]
            public void Should_Read_File_With_Multiple_Lines_Correctly()
            {
                // Given
                var environment = FakeEnvironment.CreateUnixEnvironment();
                var fileSystem = new FakeFileSystem(environment);
                var content = new StringBuilder();
                content.AppendLine("1");
                content.AppendLine("2");
                content.AppendLine("3");
                var file = fileSystem.CreateFile("text.txt").SetText(content.ToString());

                // When
                var result = file.ReadLines(Encoding.UTF8).ToList();

                // Then
                Assert.AreEqual(3, result.Count);
                Assert.AreEqual("1", result[0]);
                Assert.AreEqual("2", result[1]);
                Assert.AreEqual("3", result[2]);
            }
        }
    }
}


text:
<?php

class DBConfigTest extends TestCase {
    public function testGet() {
        TestHelper::populateDB([
            [FOO\DBConfig::$TABLE, 0, 'a', 'b'],
        ]);

        $cfg = new FOO\DBConfig;
        $this->assertSame('b', $cfg['a']);
        $this->assertSame(null, $cfg['b']);
    }
}


text:
/* Automatically generated code, don't edit ! */

package org.urish.gwtit.titanium;

import org.urish.gwtit.client.EventCallback;
import org.urish.gwtit.titanium.events.CalibrationHandler;
import org.urish.gwtit.titanium.events.HeadingHandler;
import org.urish.gwtit.titanium.events.LocationHandler;

import com.google.gwt.core.client.JavaScriptObject;

/**
 * The top level Geolocation module. The Geolocation module is used for
 * accessing device location based information.
 *
 * @since 0.1
 */
public class Geolocation extends org.urish.gwtit.titanium.Module {
	protected Geolocation() {
	}

	private static native final int value_ACCURACY_BEST()
	/*-{
		return Titanium.Geolocation.ACCURACY_BEST;
	}-*/;

	public static final int ACCURACY_BEST = value_ACCURACY_BEST();

	private static native final int value_ACCURACY_HUNDRED_METERS()
	/*-{
		return Titanium.Geolocation.ACCURACY_HUNDRED_METERS;
	}-*/;

	public static final int ACCURACY_HUNDRED_METERS = value_ACCURACY_HUNDRED_METERS();

	private static native final int value_ACCURACY_KILOMETER()
	/*-{
		return Titanium.Geolocation.ACCURACY_KILOMETER;
	}-*/;

	public static final int ACCURACY_KILOMETER = value_ACCURACY_KILOMETER();

	private static native final int value_ACCURACY_NEAREST_TEN_METERS()
	/*-{
		return Titanium.Geolocation.ACCURACY_NEAREST_TEN_METERS;
	}-*/;

	public static final int ACCURACY_NEAREST_TEN_METERS = value_ACCURACY_NEAREST_TEN_METERS();

	private static native final int value_ACCURACY_THREE_KILOMETERS()
	/*-{
		return Titanium.Geolocation.ACCURACY_THREE_KILOMETERS;
	}-*/;

	public static final int ACCURACY_THREE_KILOMETERS = value_ACCURACY_THREE_KILOMETERS();

	private static native final int value_AUTHORIZATION_AUTHORIZED()
	/*-{
		return Titanium.Geolocation.AUTHORIZATION_AUTHORIZED;
	}-*/;

	public static final int AUTHORIZATION_AUTHORIZED = value_AUTHORIZATION_AUTHORIZED();

	private static native final int value_AUTHORIZATION_DENIED()
	/*-{
		return Titanium.Geolocation.AUTHORIZATION_DENIED;
	}-*/;

	public static final int AUTHORIZATION_DENIED = value_AUTHORIZATION_DENIED();

	private static native final int value_AUTHORIZATION_RESTRICTED()
	/*-{
		return Titanium.Geolocation.AUTHORIZATION_RESTRICTED;
	}-*/;

	public static final int AUTHORIZATION_RESTRICTED = value_AUTHORIZATION_RESTRICTED();

	private static native final int value_AUTHORIZATION_UNKNOWN()
	/*-{
		return Titanium.Geolocation.AUTHORIZATION_UNKNOWN;
	}-*/;

	public static final int AUTHORIZATION_UNKNOWN = value_AUTHORIZATION_UNKNOWN();

	private static native final int value_ERROR_DENIED()
	/*-{
		return Titanium.Geolocation.ERROR_DENIED;
	}-*/;

	public static final int ERROR_DENIED = value_ERROR_DENIED();

	private static native final int value_ERROR_HEADING_FAILURE()
	/*-{
		return Titanium.Geolocation.ERROR_HEADING_FAILURE;
	}-*/;

	public static final int ERROR_HEADING_FAILURE = value_ERROR_HEADING_FAILURE();

	private static native final int value_ERROR_LOCATION_UNKNOWN()
	/*-{
		return Titanium.Geolocation.ERROR_LOCATION_UNKNOWN;
	}-*/;

	public static final int ERROR_LOCATION_UNKNOWN = value_ERROR_LOCATION_UNKNOWN();

	private static native final int value_ERROR_NETWORK()
	/*-{
		return Titanium.Geolocation.ERROR_NETWORK;
	}-*/;

	public static final int ERROR_NETWORK = value_ERROR_NETWORK();

	private static native final int value_ERROR_REGION_MONITORING_DELAYED()
	/*-{
		return Titanium.Geolocation.ERROR_REGION_MONITORING_DELAYED;
	}-*/;

	public static final int ERROR_REGION_MONITORING_DELAYED = value_ERROR_REGION_MONITORING_DELAYED();

	private static native final int value_ERROR_REGION_MONITORING_DENIED()
	/*-{
		return Titanium.Geolocation.ERROR_REGION_MONITORING_DENIED;
	}-*/;

	public static final int ERROR_REGION_MONITORING_DENIED = value_ERROR_REGION_MONITORING_DENIED();

	private static native final int value_ERROR_REGION_MONITORING_FAILURE()
	/*-{
		return Titanium.Geolocation.ERROR_REGION_MONITORING_FAILURE;
	}-*/;

	public static final int ERROR_REGION_MONITORING_FAILURE = value_ERROR_REGION_MONITORING_FAILURE();

	private static native final String value_PROVIDER_GPS()
	/*-{
		return Titanium.Geolocation.PROVIDER_GPS;
	}-*/;

	public static final String PROVIDER_GPS = value_PROVIDER_GPS();

	private static native final String value_PROVIDER_NETWORK()
	/*-{
		return Titanium.Geolocation.PROVIDER_NETWORK;
	}-*/;

	public static final String PROVIDER_NETWORK = value_PROVIDER_NETWORK();

	/**
	 * @return The minimum change of position (in meters) before a 'location'
	 *         event is fired. Default is 0, meaning that location events are
	 *         continuously generated.
	 */
	public static native double getDistanceFilter()
	/*-{
		return Titanium.Geolocation.distanceFilter;
	}-*/;

	public static native void setDistanceFilter(double value)
	/*-{
		Titanium.Geolocation.distanceFilter = value;
	}-*/;

	/**
	 * @return The minium change of heading (in degrees) before a 'heading'
	 *         event is fired. Default is 0, meaning that heading events are
	 *         continuously generated.
	 */
	public static native double getHeadingFilter()
	/*-{
		return Titanium.Geolocation.headingFilter;
	}-*/;

	public static native void setHeadingFilter(double value)
	/*-{
		Titanium.Geolocation.headingFilter = value;
	}-*/;

	/**
	 * @return Returns an authorization constant indicating if the application
	 *         has access to location services. Always returns
	 *         AUTHORIZATION_UNKNOWN on pre-4.2 devices. Attempting to
	 *         re-authorize when AUTHORIZATION_RESTRICTED will lead to issues
	 * @platforms iphone, ipad
	 */
	public static native int getLocationServicesAuthorization()
	/*-{
		return Titanium.Geolocation.locationServicesAuthorization;
	}-*/;

	public static native void setLocationServicesAuthorization(int value)
	/*-{
		Titanium.Geolocation.locationServicesAuthorization = value;
	}-*/;

	/**
	 * @return Returns true if the user has enabled or disable location services
	 *         for the device (not the application).
	 */
	public static native boolean getLocationServicesEnabled()
	/*-{
		return Titanium.Geolocation.locationServicesEnabled;
	}-*/;

	public static native void setLocationServicesEnabled(boolean value)
	/*-{
		Titanium.Geolocation.locationServicesEnabled = value;
	}-*/;

	/**
	 * @return Allows setting of the preferred location provider. Returns
	 *         undefined when the preferred provider is auto-detected
	 */
	public static native String getPreferredProvider()
	/*-{
		return Titanium.Geolocation.preferredProvider;
	}-*/;

	public static native void setPreferredProvider(String value)
	/*-{
		Titanium.Geolocation.preferredProvider = value;
	}-*/;

	/**
	 * @return This property informs the end-user why location services are
	 *         being requested by the application. This string will be display
	 *         in the permission dialog. This property is REQUIRED starting in
	 *         4.0.
	 * @platforms iphone, ipad
	 */
	public static native String getPurpose()
	/*-{
		return Titanium.Geolocation.purpose;
	}-*/;

	public static native void setPurpose(String value)
	/*-{
		Titanium.Geolocation.purpose = value;
	}-*/;

	/**
	 * @return Returns true if the calibration UI can show
	 */
	public static native boolean getShowCalibration()
	/*-{
		return Titanium.Geolocation.showCalibration;
	}-*/;

	public static native void setShowCalibration(boolean value)
	/*-{
		Titanium.Geolocation.showCalibration = value;
	}-*/;

	/**
	 * Tries to resolve an address to a location.
	 *
	 * @param address
	 *            address to resolve.
	 */
	public static native void forwardGeocoder(String address,
			EventCallback<org.urish.gwtit.titanium.geolocation.Place> callback)
	/*-{
		return Titanium.Geolocation.forwardGeocoder(address, function(e) { callback.@org.urish.gwtit.client.EventCallback::onEvent(Lcom/google/gwt/core/client/JavaScriptObject;)(e); });
	}-*/;

	/**
	 * Retrieve the current compass heading.
	 */
	public static native void getCurrentHeading(EventCallback<org.urish.gwtit.titanium.events.HeadingEvent> callback)
	/*-{
		return Titanium.Geolocation.getCurrentHeading(function(e) { callback.@org.urish.gwtit.client.EventCallback::onEvent(Lcom/google/gwt/core/client/JavaScriptObject;)(e); });
	}-*/;

	/**
	 * Retrieve the last known location from the device. On Android, the radios
	 * are not turned on to update the location. On iOS the radios MAY be used
	 * if the location is too "old".
	 */
	public static native void getCurrentPosition(EventCallback<org.urish.gwtit.titanium.events.LocationEvent> callback)
	/*-{
		return Titanium.Geolocation.getCurrentPosition(function(e) { callback.@org.urish.gwtit.client.EventCallback::onEvent(Lcom/google/gwt/core/client/JavaScriptObject;)(e); });
	}-*/;

	/**
	 * Tries to resolve a location to an address.
	 *
	 * @param latitude
	 *            latitude to search
	 * @param longitude
	 *            longitude to search
	 */
	public static native void reverseGeocoder(double latitude, double longitude,
			EventCallback<org.urish.gwtit.titanium.geolocation.ReverseGeocoderResult> callback)
	/*-{
		return Titanium.Geolocation.reverseGeocoder(latitude, longitude, function(e) { callback.@org.urish.gwtit.client.EventCallback::onEvent(Lcom/google/gwt/core/client/JavaScriptObject;)(e); });
	}-*/;

	/**
	 * Add an event listener for the instance to receive triggered events
	 *
	 * @param name
	 *            name of the event
	 */
	public static native void addEventListener(String name, EventCallback<JavaScriptObject> callback)
	/*-{
		return Titanium.Geolocation.addEventListener(name, function(e) { callback.@org.urish.gwtit.client.EventCallback::onEvent(Lcom/google/gwt/core/client/JavaScriptObject;)(e); });
	}-*/;

	/**
	 * Remove a previously added event listener
	 *
	 * @param name
	 *            name of the event
	 */
	public static native void removeEventListener(String name, EventCallback<JavaScriptObject> callback)
	/*-{
		return Titanium.Geolocation.removeEventListener(name, function(e) { callback.@org.urish.gwtit.client.EventCallback::onEvent(Lcom/google/gwt/core/client/JavaScriptObject;)(e); });
	}-*/;

	/**
	 * Fire a synthesized event to the views listener
	 *
	 * @param name
	 *            name of the event.
	 * @param event
	 *            event object
	 */
	public static native void fireEvent(String name, JavaScriptObject event)
	/*-{
		return Titanium.Geolocation.fireEvent(name, event);
	}-*/;

	public static native void addCalibrationHandler(CalibrationHandler handler)
	/*-{
		return Titanium.Geolocation.addEventListener('calibration', function(e) { handler.@org.urish.gwtit.titanium.events.CalibrationHandler::onCalibration(Lorg/urish/gwtit/titanium/events/CalibrationEvent;)(e); } );
	}-*/;

	public static native void addHeadingHandler(HeadingHandler handler)
	/*-{
		return Titanium.Geolocation.addEventListener('heading', function(e) { handler.@org.urish.gwtit.titanium.events.HeadingHandler::onHeading(Lorg/urish/gwtit/titanium/events/HeadingEvent;)(e); } );
	}-*/;

	public static native void addLocationHandler(LocationHandler handler)
	/*-{
		return Titanium.Geolocation.addEventListener('location', function(e) { handler.@org.urish.gwtit.titanium.events.LocationHandler::onLocation(Lorg/urish/gwtit/titanium/events/LocationEvent;)(e); } );
	}-*/;

}


text:
package org.jrivets.beans.auth;

import java.util.UUID;

import org.jrivets.util.UID;

public final class Session {

    final UID id;

    final UID entityId;

    Session(UID entityId) {
        this(new UID(UUID.randomUUID()), entityId);
    }

    Session(UID id, UID entityId) {
        if (id == null) {
            throw new NullPointerException("Session id cannot be null");
        }
        this.id = id;
        this.entityId = entityId;
    }

    public UID getEntityId() {
        return entityId;
    }

    public UID getId() {
        return id;
    }

    @Override
    public int hashCode() {
        return id.hashCode();
    }

    @Override
    public boolean equals(Object obj) {
        if (obj instanceof Session) {
            return id.equals(((Session) obj).id);
        }
        return false;
    }

    @Override
    public String toString() {
        return "{id=" + id + ", entityId=" + entityId + "}";
    }
}


text:
from django.conf.urls import include, patterns, url
from django.views.decorators.csrf import csrf_exempt
from django.shortcuts import redirect
from django.views.decorators.cache import cache_page

from olympia.reviews.urls import review_patterns
from olympia.stats.urls import stats_patterns
from . import buttons
from . import views

ADDON_ID = r"""(?P<addon_id>[^/<>"']+)"""

# These will all start with /addon/<addon_id>/
detail_patterns = patterns(
    '',
    url('^$', views.addon_detail, name='addons.detail'),
    url('^more$', views.addon_detail, name='addons.detail_more'),
    url('^eula/(?P<file_id>\d+)?$', views.eula, name='addons.eula'),
    url('^license/(?P<version>[^/]+)?', views.license, name='addons.license'),
    url('^privacy/', views.privacy, name='addons.privacy'),
    url('^abuse/', views.report_abuse, name='addons.abuse'),

    url('^developers$', views.developers,
        {'page': 'developers'}, name='addons.meet'),
    url('^contribute/roadblock/', views.developers,
        {'page': 'roadblock'}, name='addons.roadblock'),
    url('^contribute/installed/', views.developers,
        {'page': 'installed'}, name='addons.installed'),
    url('^contribute/thanks',
        csrf_exempt(lambda r, addon_id: redirect('addons.detail', addon_id)),
        name='addons.thanks'),
    url('^contribute/$', views.contribute, name='addons.contribute'),
    url('^contribute/(?P<status>cancel|complete)$', views.paypal_result,
        name='addons.paypal'),

    url('^about$',
        lambda r, addon_id: redirect('addons.installed',
                                     addon_id, permanent=True),
        name='addons.about'),

    ('^reviews/', include(review_patterns('addons'))),
    ('^statistics/', include(stats_patterns)),
    ('^versions/', include('olympia.versions.urls')),
)

urlpatterns = patterns(
    '',
    # Promo modules for the homepage
    url('^i/promos$', views.homepage_promos, name='addons.homepage_promos'),

    # See https://github.com/mozilla/addons-server/issues/3130
    # Hardcode because there is no relation from blocklist items and the
    # add-on they block :-(
    url('^addon/icloud-bookmarks/$', views.icloud_bookmarks_redirect,
        name='addons.icloudbookmarksredirect'),

    # URLs for a single add-on.
    ('^addon/%s/' % ADDON_ID, include(detail_patterns)),

    # Button messages to be used by JavaScript.
    # Should always be called with a cache-busting querystring.
    url('^addons/buttons\.js$',
        cache_page(60 * 60 * 24 * 365)(buttons.js),
        name='addons.buttons.js'),

    # Remora EULA and Privacy policy URLS
    ('^addons/policy/0/(?P<addon_id>\d+)/(?P<file_id>\d+)',
     lambda r, addon_id, file_id: redirect('addons.eula',
                                           addon_id, file_id, permanent=True)),
    ('^addons/policy/0/(?P<addon_id>\d+)/',
     lambda r, addon_id: redirect('addons.privacy',
                                  addon_id, permanent=True)),

    ('^versions/license/(\d+)$', views.license_redirect),
)


text:
require 'spec_helper'
require 'active_support/all'

describe RRuleParser::ComputableRule do
  it "calculates duration" do
    t1 = Time.now
    t2 = Time.now + 2.hours
    rule = RRuleParser::ComputableRule.new(t1, t2, "RRULE:FREQ=DAILY;COUNT=1")
    expect(rule.duration).to eq(t2-t1)
  end

  describe "calculations for Tue, June 2, 2015" do
    # June 2015 has 4 weeks and June 1, 2015 is Monday. That's convinient
    # We start everything on Tue, June 2 2015
    let (:start)  { Time.parse("2015-06-02T03:00:00+03:00") }
    let (:finish) { Time.parse("2015-06-02T04:00:00+03:00") }
    let (:rule)   { RRuleParser::ComputableRule.new(start, finish, expr) }

    describe "DAILY" do
      describe "with 4 occurrencies" do
        let (:expr)   { "RRULE:FREQ=DAILY;COUNT=4" }

        it "will produce 4 occurrencies" do
          expect(rule.dates.count).to eq(4)
        end

        it "first date will be Tue, Jun 2" do
          expect(rule.start.to_date).to eq(Date.new(2015, 6, 2))
        end

        it "last date will be Fri, Jun 5" do
          expect(rule.end.to_date).to eq(Date.new(2015, 6, 5))
        end
      end

      describe "with 1 occurrence" do
        let (:expr)   { "RRULE:FREQ=DAILY;COUNT=1" }

        it "will produce 1 occurrencies" do
          expect(rule.dates.count).to eq(1)
        end

        it "first date will be Tue, Jun 2" do
          expect(rule.start.to_date).to eq(Date.new(2015, 6, 2))
        end

        it "last date will be Tue, Jun 2" do
          expect(rule.end.to_date).to eq(Date.new(2015, 6, 2))
        end
      end

      describe "until Sunday" do
        let (:expr)   { "RRULE:FREQ=DAILY;UNTIL=20150607T120000Z" }

        it "will produce 6 occurrencies" do
          expect(rule.dates.count).to eq(6)
        end

        it "first date will be Tue, Jun 2" do
          expect(rule.start.to_date).to eq(Date.new(2015, 6, 2))
        end

        it "last date will be Sun, Jun 7" do
          expect(rule.end.to_date).to eq(Date.new(2015, 6, 7))
        end
      end

      describe "each 2 days with 4 occurrencies" do
        let (:expr)   { "RRULE:FREQ=DAILY;INTERVAL=2;COUNT=4" }

        it "will produce 4 occurrencies" do
          expect(rule.dates.count).to eq(4)
        end

        it "first date will be Tue, Jun 2" do
          expect(rule.start.to_date).to eq(Date.new(2015, 6, 2))
        end

        it "last date will be Tue, Jun 8" do
          expect(rule.end.to_date).to eq(Date.new(2015, 6, 8))
        end
      end

      describe "each 2 days until sunday" do
        let (:expr)   { "RRULE:FREQ=DAILY;INTERVAL=2;UNTIL=20150607T120000Z" }

        it "will produce 3 occurrencies" do
          expect(rule.dates.count).to eq(3)
        end

        it "first date will be Tue, Jun 2" do
          expect(rule.start.to_date).to eq(Date.new(2015, 6, 2))
        end

        it "last date will be Sat, Jun 6" do
          expect(rule.end.to_date).to eq(Date.new(2015, 6, 6))
        end
      end
    end

    describe "WEEKLY" do
      describe "every Tuesday with 4 occurrencies" do
        let (:expr) { "RRULE:FREQ=WEEKLY;COUNT=4;BYDAY=TU" }

        it "will produce 4 occurrencies" do
          expect(rule.dates.count).to eq(4)
        end

        it "first date will be Tue, Jun 2" do
          expect(rule.start.to_date).to eq(Date.new(2015, 6, 2))
        end

        it "last date will be Tue, Jun 23" do
          expect(rule.end.to_date).to eq(Date.new(2015, 6, 23))
        end
      end

      describe "every Tuesday and Friday with 4 occurrencies" do
        let (:expr) { "RRULE:FREQ=WEEKLY;COUNT=4;BYDAY=TU,FR" }

        it "will produce 4 occurrencies" do
          expect(rule.dates.count).to eq(4)
        end

        it "first date will be Tue, Jun 2" do
          expect(rule.start.to_date).to eq(Date.new(2015, 6, 2))
        end

        it "last date will be Fri, Jun 12" do
          expect(rule.end.to_date).to eq(Date.new(2015, 6, 12))
        end
      end

      describe "every Tuesday with interval of 2 weeks and 3 occurrencies" do
        let (:expr) { "RRULE:FREQ=WEEKLY;COUNT=3;INTERVAL=2;BYDAY=TU" }

        it "will produce 3 occurrencies" do
          expect(rule.dates.count).to eq(3)
        end

        it "first date will be Tue, Jun 2" do
          expect(rule.start.to_date).to eq(Date.new(2015, 6, 2))
        end

        it "last date will be Tue, Jun 30" do
          expect(rule.end.to_date).to eq(Date.new(2015, 6, 30))
        end
      end

      describe "every Monday and Tuesday with interval of 2 weeks and 6 occurrencies" do
        let (:expr) { "RRULE:FREQ=WEEKLY;COUNT=6;INTERVAL=2;BYDAY=MO,TU" }

        it "will produce 6 occurrencies" do
          expect(rule.dates.count).to eq(6)
        end

        it "first date will be Tue, Jun 2" do
          expect(rule.start.to_date).to eq(Date.new(2015, 6, 2))
        end

        it "last date will be Mon, July 13" do
          expect(rule.end.to_date).to eq(Date.new(2015, 7, 13))
        end
      end

      describe "every Monday and Tuesday with interval of 2 weeks and ending June 16" do
        let (:expr) { "RRULE:FREQ=WEEKLY;INTERVAL=2;UNTIL=20150630T120000Z;BYDAY=MO,TU" }

        it "will produce 5 occurrencies" do
          expect(rule.dates.count).to eq(5)
        end

        it "first date will be Tue, Jun 2" do
          expect(rule.start.to_date).to eq(Date.new(2015, 6, 2))
        end

        it "last date will be Mon, June 30" do
          expect(rule.end.to_date).to eq(Date.new(2015, 6, 30))
        end
      end
    end

    describe "Monthly calculations" do
      describe "every month at 2nd day of month with 4 occurrencies" do
        let (:expr) { "RRULE:FREQ=MONTHLY;COUNT=4" }

        it "will produce 4 occurrencies" do
          expect(rule.dates.count).to eq(4)
        end

        it "first date will be Tue, Jun 2" do
          expect(rule.start.to_date).to eq(Date.new(2015, 6, 2))
        end

        it "last date will be Sep 2" do
          expect(rule.end.to_date).to eq(Date.new(2015, 9, 2))
        end
      end

      describe "every month at 2nd day of month with interval of 2 and 4 occurrencies" do
        let (:expr) { "RRULE:FREQ=MONTHLY;INTERVAL=2;COUNT=4" }

        it "will produce 4 occurrencies" do
          expect(rule.dates.count).to eq(4)
        end

        it "first date will be Tue, Jun 2" do
          expect(rule.start.to_date).to eq(Date.new(2015, 6, 2))
        end

        it "last date will be Dec 2" do
          expect(rule.end.to_date).to eq(Date.new(2015, 12, 2))
        end
      end

      describe "Given day of month does not work yet" do
      end
    end

    describe "Yearly calculations" do
      describe "every year at Jun 2 with 4 occurrencies" do
        let (:expr) { "RRULE:FREQ=YEARLY;COUNT=4" }
        it "will produce 4 occurrencies" do
          expect(rule.dates.count).to eq(4)
        end

        it "first date will be Jun 2 2015" do
          expect(rule.start.to_date).to eq(Date.new(2015, 6, 2))
        end

        it "last date will be Jun 2 2018" do
          expect(rule.end.to_date).to eq(Date.new(2018, 6, 2))
        end
      end
    end

    describe "unlimited" do
      let (:expr) { "RRULE:FREQ=DAILY" }

      it "will produce 1000 occurrencies by default" do
        expect(rule.dates.count).to eq(1000)
      end
    end

    describe "limited with end date far in the future" do
      let (:expr)   { "RRULE:FREQ=DAILY;UNTIL=29991212T120000Z" }

      it "will produce 1000 occurrencies" do
        expect(rule.dates.count).to eq(1000)
      end
    end

    describe "limited with really big count" do
      let (:expr)   { "RRULE:FREQ=WEEKLY;COUNT=999999;BYDAY=MO,TU,FR" }

      it "will produce 1000 occurrencies" do
        expect(rule.dates.count).to eq(1000)
      end
    end
  end

  describe "calculations for Sun, July 12, 2015" do
    let (:start)  { Time.parse("2015-07-12T03:00:00+03:00") }
    let (:finish) { Time.parse("2015-07-12T05:00:00+03:00") }
    let (:rule)   { RRuleParser::ComputableRule.new(start, finish, expr) }

    describe "Weekly on SU and SA ending August 1 2015" do
      let(:expr) { "RRULE:FREQ=WEEKLY;UNTIL=20150801T000000Z;BYDAY=SU,SA"}

      it "first date will be July 12 2015" do
        expect(rule.start.to_date).to eq(Date.new(2015, 7, 12))
      end

      it "second date will be July 18 2015" do
        expect(rule.dates[1].to_date).to eq(Date.new(2015, 7, 18))
      end

      it "third date will be July 19 2015" do
        expect(rule.dates[2].to_date).to eq(Date.new(2015, 7, 19))
      end

      it "last date will be Aug 1 2015" do
        expect(rule.start.to_date).to eq(Date.new(2015, 7, 12))
      end
    end
  end
end


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>Uses of Class org.jsimpledb.JSimpleDBFactory (Java Class Library API)</title>
<meta name="date" content="2015-04-16">
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes

Uses of Class
org.jsimpledb.JSimpleDBFactory

Packages that use JSimpleDBFactory

Package
Description

org.jsimpledb

Abstraction layer allowing access to a Database using normal Java objects.

org.jsimpledb.util

General utility classes used with JSimpleDB.

Uses of JSimpleDBFactory in org.jsimpledb

Methods in org.jsimpledb that return JSimpleDBFactory

Modifier and Type
Method and Description

JSimpleDBFactory
JSimpleDBFactory.setDatabase(Database database)

Configure the underlying Database for this instance.

JSimpleDBFactory
JSimpleDBFactory.setModelClasses(Class<?>... modelClasses)

Configure the Java model classes.

JSimpleDBFactory
JSimpleDBFactory.setModelClasses(Iterable<? extends Class<?>> modelClasses)

Configure the Java model classes.

JSimpleDBFactory
JSimpleDBFactory.setSchemaVersion(int schemaVersion)

Configure the schema version number associated with the configured Java model classes.

JSimpleDBFactory
JSimpleDBFactory.setStorageIdGenerator(StorageIdGenerator storageIdGenerator)

Configure the StorageIdGenerator for auto-generating storage ID's when not explicitly
 specified in @JSimpleClass,
 @JField, etc., annotations.

Uses of JSimpleDBFactory in org.jsimpledb.util

Methods in org.jsimpledb.util that return JSimpleDBFactory

Modifier and Type
Method and Description

JSimpleDBFactory
AbstractMain.getJSimpleDBFactory(Database db)

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes


text:
<title>Attributes - GNU Compiler Collection (GCC) Internals</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="GNU Compiler Collection (GCC) Internals">
<meta name="generator" content="makeinfo 4.8">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="GENERIC.html#GENERIC" title="GENERIC">
<link rel="prev" href="Declarations.html#Declarations" title="Declarations">
<link rel="next" href="Expression-trees.html#Expression-trees" title="Expression trees">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">

<meta http-equiv="Content-Style-Type" content="text/css">

Next: Expression trees,
Previous: Declarations,
Up: GENERIC

10.5 Attributes in trees

Attributes, as specified using the __attribute__ keyword, are
represented internally as a TREE_LIST.  The TREE_PURPOSE
is the name of the attribute, as an IDENTIFIER_NODE.  The
TREE_VALUE is a TREE_LIST of the arguments of the
attribute, if any, or NULL_TREE if there are no arguments; the
arguments are stored as the TREE_VALUE of successive entries in
the list, and may be identifiers or expressions.  The TREE_CHAIN
of the attribute is the next attribute in a list of attributes applying
to the same declaration or type, or NULL_TREE if there are no
further attributes in the list.

Attributes may be attached to declarations and to types; these
attributes may be accessed with the following macros.  All attributes
are stored in this way, and many also cause other changes to the
declaration or type or to other internal compiler data structures.

— Tree Macro: tree DECL_ATTRIBUTES (<var>tree decl</var>)<var></var>

This macro returns the attributes on the declaration <var>decl</var>.

— Tree Macro: tree TYPE_ATTRIBUTES (<var>tree type</var>)<var></var>

This macro returns the attributes on the type <var>type</var>.


text:
require 'spec_helper'

if ENV['OS'] == 'Windows_NT'
  splunk_base_dir = 'C:/Program Files/SplunkUniversalForwarder'
  splunk_command = 'C:\\"Program Files"\\SplunkUniversalForwarder\\bin\\splunk.exe'
  describe file("#{splunk_base_dir}/bin/splunk.exe") do
    it { should exist }
  end
else
  splunk_base_dir = '/opt/splunkforwarder'
  splunk_command = "#{splunk_base_dir}/bin/splunk"
  describe file("#{splunk_command}") do
    it { should exist }
    it { should be_executable }
  end
end
describe file("#{splunk_base_dir}/bin/") do
  it { should exist }
  it { should be_directory }
end

describe service("#{$node['splunk']['service']}") do
  it { should be_enabled }
end

describe 'inputs config should be configured per node attributes' do
  describe file("#{splunk_base_dir}/etc/system/local/inputs.conf") do
    it { should be_file }
    its(:content) { should match(/\[tcp:\/\/:123123\]/) }
    its(:content) { should match(/connection_host = dns/) }
    its(:content) { should match(/sourcetype = syslog/) }
    its(:content) { should match(/source = tcp:123123/) }
  end
end

describe 'outputs config should be configured per node attributes' do
  describe file("#{splunk_base_dir}/etc/system/local/outputs.conf") do
    it { should be_file }
    its(:content) { should match(/defaultGroup = #{$node['splunk']['indexers_group1']['name']}, #{$node['splunk']['indexers_group2']['name']}/) }
    # from the default attributes
    its(:content) { should match(/forwardedindex.0.whitelist = .*/) }
    its(:content) { should match(/forwardedindex.1.blacklist = _.*/) }
    its(:content) { should match(/forwardedindex.2.whitelist = _audit/) }
    its(:content) { should match(/forwardedindex.filter.disable = false/) }
    # tcpout
    its(:content) { should match(/[tcpout:#{$node['splunk']['indexers_group1']['name']}]/) }
    its(:content) { should match(/[tcpout:#{$node['splunk']['indexers_group2']['name']}]/) }
    # ['indexers_group1']['splunk_servers']
    its(:content) { should match(/server = #{$node['splunk']['indexers_group1']['splunk_servers']}/) }
    # ['indexers_group2']['splunk_servers']
    its(:content) { should match(/server = #{$node['splunk']['indexers_group2']['splunk_servers']}/) }
    # attributes for dynamic definition
    its(:content) { should match(/sslCertPath = \$SPLUNK_HOME\/etc\/certs\/cert.pem/) }
    its(:content) { should match(/sslCommonNameToCheck = sslCommonName/) }
    its(:content) { should match(/sslRootCAPath = \$SPLUNK_HOME\/etc\/certs\/cacert.pem/) }
    its(:content) { should match(/sslVerifyServerCert = false/) }
  end
end

describe 'splunk app bistro 1.0.3 should be installed' do
  describe file("#{splunk_base_dir}/etc/apps/bistro/default/app.conf") do
    it { should exist }
    it { should be_file }
    its(:content) { should match(/version = 1.0.3/) }
    its(:content) { should match(/id = bistro/) }
  end
  describe command('/opt/splunkforwarder/bin/splunk btool --app=bistro app list') do
    its(:exit_status) { should eq 0 }
    its(:stdout) { should_not match /disabled\s*=\s*(0|false)/ }
  end
end

describe 'splunk app sanitycheck should be installed' do
  describe file("#{splunk_base_dir}/etc/apps/sanitycheck") do
    it { should exist }
    it { should be_directory}
  end
end

describe 'splunk app sanitycheck2 should be removed' do
  describe file("#{splunk_base_dir}/etc/apps/sanitycheck2") do
    it { should_not exist }
  end
end

describe 'splunk app bistro-1.0.2 should be removed' do
  describe file("#{splunk_base_dir}/etc/apps/bistro-1.0.2") do
    it { should_not exist }
  end
end

describe 'splunk app test 0.0.2 should be installed' do
  describe file("#{splunk_base_dir}/etc/apps/test/default/app.conf") do
    it { should exist }
    it { should be_file }
    its(:content) { should match(/version = '0.0.2'/) }
  end
  describe command("#{splunk_base_dir}/bin/splunk btool --app=test app list") do
    its(:exit_status) { should eq 0 }
    its(:stdout) { should_not match /disabled\s*=\s*(0|false)/ }
  end
end

describe 'splunk app generallogs_inputs should be installed' do
  describe file("#{splunk_base_dir}/etc/apps/generallogs_inputs/local/inputs.conf") do
    it { should exist }
    it { should be_file }
    its(:content) { should match(/index = main/) }
    its(:content) { should match(/sourcetype=syslog/) }
    its(:content) { should match(/disabled = 0/) }
  end
  describe command("#{splunk_base_dir}/bin/splunk btool --app=generallogs_inputs app list") do
    its(:exit_status) { should eq 0 }
    its(:stdout) { should_not match /disabled\s*=\s*(0|false)/ }
  end
  describe package('splunkforwarder') do
    it { should be_installed }
    it { should be_installed.with_version($node['splunk']['forwarder']['package_version']) } unless $node['splunk']['forwarder']['package_version'].nil?
  end
  describe command('yum list splunkforwarder') do
    its(:stdout) { should match /gdcustom/ }
  end
end


text:
/*---
description: Fails by calling $ERROR
expected:
  pass: false
  message: failure message
features: [C]
---*/

$ERROR('failure message');


text:
CUDA code to find transpose of a matrix on a GPU
For optimization the kernel uses shared memory to make the reads and writes to global memory coalesced
To compile use `nvcc kernel.cu`


text:
namespace base {
class HistogramBase;
class TickClock;
}

namespace ash {

namespace test {
class TaskSwitchTimeTrackerTestAPI;
}  // namespace test

// Tracks time deltas between task switches and records them in a histogram.
class ASH_EXPORT TaskSwitchTimeTracker {
 public:
  // Create a TaskSwitchTimeTracker that will record data to the histogram with
  // the given |histogram_name|.
  explicit TaskSwitchTimeTracker(const std::string& histogram_name);

  ~TaskSwitchTimeTracker();

  // Notifies |this| that a task switch has occurred. A histogram data point
  // will be recorded for all calls but the first.
  void OnTaskSwitch();

 private:
  friend class test::TaskSwitchTimeTrackerTestAPI;

  // Private constructor that the test::TaskSwitchTimeTrackerTestAPI can use to
  // inject a custom |tick_clock|.
  TaskSwitchTimeTracker(const std::string& histogram_name,
                        scoped_ptr<base::TickClock> tick_clock);

  // Returns true if |last_action_time_| has a valid value.
  bool HasLastActionTime() const;

  // Sets the |last_action_time_| to |tick_clock_|'s current value and returns
  // the previous value for |last_action_time_|.
  base::TimeTicks SetLastActionTime();

  // Records a data point in the histogram.
  void RecordTimeDelta();

  // Lazily obtains and sets the |histogram_|.
  base::HistogramBase* GetHistogram();

  // The histogram name to record data to.
  std::string histogram_name_;

  // The histogram to log data to. Set via GetHistogram() using lazy load.
  base::HistogramBase* histogram_ = nullptr;

  // Tracks the last time OnTaskSwitch() was called. A value of
  // base::TimeTicks() should be interpreted as not set.
  base::TimeTicks last_action_time_ = base::TimeTicks();

  // The clock used to determine the |last_action_time_|.
  scoped_ptr<base::TickClock> tick_clock_;

  DISALLOW_COPY_AND_ASSIGN(TaskSwitchTimeTracker);
};

}  // namespace ash

#endif  // ASH_METRICS_TASK_SWITCH_TIME_TRACKE_H_


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

<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>objective-c-sql-query-builder: Class Members</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="search/search.css" rel="stylesheet" type="text/css"/>

<link href="doxygen.css" rel="stylesheet" type="text/css"/>

objective-c-sql-query-builder

Main Page

Classes

Files

          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)"
               onblur="searchBox.OnSearchFieldFocus(false)"
               onkeyup="searchBox.OnSearchFieldChange(event)"/>

Class List

Class Index

Class Hierarchy

Class Members

All

Functions

Variables

Properties

_

a

b

c

d

e

f

g

h

i

j

l

m

o

p

q

r

s

t

u

v

w

Here is a list of all class members with links to the classes they belong to:

- w -

when:operator:column:
: ZIMSqlCreateTriggerStatement

when:operator:column:connector:
: ZIMSqlCreateTriggerStatement

when:operator:value:
: ZIMSqlCreateTriggerStatement

when:operator:value:connector:
: ZIMSqlCreateTriggerStatement

whenBlock:
: ZIMSqlCreateTriggerStatement

whenBlock:connector:
: ZIMSqlCreateTriggerStatement

where:operator:column:
: ZIMSqlDeleteStatement
, ZIMSqlSelectStatement
, ZIMSqlUpdateStatement
, ZIMOrmSelectStatement

where:operator:column:connector:
: ZIMOrmSelectStatement
, ZIMSqlDeleteStatement
, ZIMSqlSelectStatement
, ZIMSqlUpdateStatement

where:operator:value:
: ZIMSqlDeleteStatement
, ZIMSqlSelectStatement
, ZIMSqlUpdateStatement
, ZIMOrmSelectStatement

where:operator:value:connector:
: ZIMSqlDeleteStatement
, ZIMSqlSelectStatement
, ZIMSqlUpdateStatement
, ZIMOrmSelectStatement

whereBlock:
: ZIMOrmSelectStatement
, ZIMSqlSelectStatement
, ZIMSqlUpdateStatement
, ZIMSqlDeleteStatement

whereBlock:connector:
: ZIMSqlDeleteStatement
, ZIMSqlSelectStatement
, ZIMOrmSelectStatement
, ZIMSqlUpdateStatement

 All Classes Files Functions Variables Properties Defines

<address class="footer">Generated by

 1.7.4 </address>


text:
      ,-#&%&%-,  ,-#&%&%-,  ,-#&%&#%-,
     / .-----~  / .-----~  /___  ___/
     \ \____    \ \____       / /
      \_____`\   \_____`\    / /
     ______/ /  ______/ /   / /
    /_______/  /_______/   /_/

# SST (SQL Schema Transformer)

SST is a Common Lisp program that transforms an s-expression based database
schema format medium into appropriate SQL commands for specified RDBMS. SST is
capable of

* Dividing produced queries into logically separate (schemas, tables, primary keys, foreign keys, indexes) files.
* Customized (and extendable) identifier formatters. (You can adopt a naming scheme you prefer to name tables, indexes, etc.)
* `FOREIGN KEY` data type mismatch detection.
* Invalid `FOREIGN KEY` reference detection.
* Missing index detection for `ON DELETE`/`UPDATE CASCADE` references.
* `FOREIGN KEY` reference auto-completion. (You don't need to supply column of the referenced table. SST infers it for you.)

# Why SST?

SST is used to keep database schema consistency between various RDBMSes. At time
of this writing, SST is used to produce schema creation queries from an SST
medium containing ~200 tables in a CVS repository for PostgreSQL and Microsoft
SQL Server systems that are in production use. Every modification commited into
the SST medium in CVS repository gets propogated to production systems for
various RDBMes. Using such a scheme supplied below advantages:

* Unified synchronization between saveral R&D developments being worked on concurrently.
* Database schema modification history. (One can easily switch to a database schema branch of a point in time he/she wants.)
* Avoids writing RDBMS specific SQL queries. (One medium to rule them all!)

While there are [some other projects](http://sqlfairy.sourceforge.net/) on the
web that are (so called) capable of doing what SST is designed for, several
reasons (huge package dependency, complicated interface, lack of a proper
documentation, no (community) support, etc.) drived me to roll my own
solution.

# Installation

SST is `ASDF-INSTALL`able. On most modern Common Lisp implementations, ASDF
comes builtin. Assuming your Common Lisp implementation supports ASDF,
installation is just a single step:

    CL-USER> (asdf-install:install :sst)

# Example Usage

    $ cat /home/vy/projects/sst/examples/schema.lisp
    (with-schema ()
        "public"
      (with-table ()
          "companies"
          ((id serial :primary-key t)
           (name text :not-null t)))
      (with-table ()
          "units"
          (("id" (serial :start 10 :increment 2) :primary-key t)
           ("type" char :foreign-key ("types" :schema "meta"))
           ("code" float :default -3.4)
           ("company" text :foreign-key "companies"))
        (with-index (:unique t) "type")
        (with-index () ("code" :descending t) "type")))

    (with-schema ()
        "meta"
      (with-table ()
          "types"
          (("id" serial :primary-key t)
           ("name" text))))

    $ sbcl
    ...
    CL-USER> (asdf:oos 'asdf:load-op :cl-sst)
    ...
    CL-USER> (sst:produce-sql-output
    	  "/home/vy/projects/sst/examples/schema.lisp"
    	  "/home/vy/projects/sst/examples/pgsql/"
    	  'sst:rdbms-pgsql)

    WARNING: Expected (CHAR) data type doesn't match with the referenced (SERIAL)
    data type for constraint #<SQL-FOREIGN-KEY-CONSTRAINT {10038A6FA1}> on "type"
    column of "units" table in "public" schema.
    NIL
    CL-USER> (sst:produce-sql-output
    	  "/home/vy/projects/sst/examples/schema.lisp"
    	  "/home/vy/projects/sst/examples/mssql/"
    	  'sst:rdbms-mssql
    	  :identifier-case :upcase)
    WARNING: Expected (CHAR) data type doesn't match with the referenced (SERIAL)
    data type for constraint #<SQL-FOREIGN-KEY-CONSTRAINT {10047DA3C1}> on "type"
    column of "units" table in "public" schema.
    NIL

    $ cd /home/vy/projects/sst/examples

    $ ls -l pgsql/
    total 24
    -rw-r--r-- 1 vy vy 170 2008-09-20 14:31 foreign-keys
    -rw-r--r-- 1 vy vy 214 2008-09-20 16:49 foreign-keys.sql
    -rw-r--r-- 1 vy vy 122 2008-09-20 16:49 indexes.sql
    -rw-r--r-- 1 vy vy 216 2008-09-20 16:49 primary-keys.sql
    -rw-r--r-- 1 vy vy  42 2008-09-20 16:49 schemas.sql
    -rw-r--r-- 1 vy vy 294 2008-09-20 16:49 tables.sql

    $ cat pgsql/{schemas,tables,primary-keys,indexes,foreign-keys}.sql
    CREATE SCHEMA meta;
    CREATE SCHEMA public;
    CREATE TABLE meta.types (
        id serial,
        name text
    );
    CREATE TABLE public.companies (
        id serial,
        name text NOT NULL
    );
    CREATE TABLE public.units (
        id serial,
        type char,
        code float DEFAULT -3.4,
        company int
    );
    ALTER SEQUENCE public.units_id_seq START 10 INCREMENT 2;
    ALTER TABLE meta.types ADD CONSTRAINT types_id_pk PRIMARY KEY (id);
    ALTER TABLE public.companies ADD CONSTRAINT companies_id_pk PRIMARY KEY (id);
    ALTER TABLE public.units ADD CONSTRAINT units_id_pk PRIMARY KEY (id);
    CREATE INDEX units_code_desc_type_idx ON public.units (code DESC, type);
    CREATE UNIQUE INDEX units_type_unq ON public.units (type);
    ALTER TABLE public.units ADD CONSTRAINT units_company_fk FOREIGN KEY (company)
    REFERENCES public.companies (id);
    ALTER TABLE public.units ADD CONSTRAINT units_type_fk FOREIGN KEY (type)
    REFERENCES meta.types (id);

    $ ls -l mssql/
    total 20
    -rw-r--r-- 1 vy vy 218 2008-09-20 16:51 foreign-keys.sql
    -rw-r--r-- 1 vy vy 124 2008-09-20 16:51 indexes.sql
    -rw-r--r-- 1 vy vy 222 2008-09-20 16:51 primary-keys.sql
    -rw-r--r-- 1 vy vy  46 2008-09-20 16:51 schemas.sql
    -rw-r--r-- 1 vy vy 293 2008-09-20 16:51 tables.sql

    $ cat mssql/{schemas,tables,primary-keys,indexes,foreign-keys}.sql
    CREATE SCHEMA META
    GO
    CREATE SCHEMA PUBLIC
    GO
    CREATE TABLE META.TYPES (
        ID int IDENTITY(1,1),
        NAME varchar(max)
    )
    GO
    CREATE TABLE PUBLIC.COMPANIES (
        ID int IDENTITY(1,1),
        NAME varchar(max) NOT NULL
    )
    GO
    CREATE TABLE PUBLIC.UNITS (
        ID int IDENTITY(10,2),
        TYPE char,
        CODE float DEFAULT -3.4,
        COMPANY int
    )
    GO
    ALTER TABLE META.TYPES ADD CONSTRAINT PK_TYPES_ID PRIMARY KEY (ID)
    GO
    ALTER TABLE PUBLIC.COMPANIES ADD CONSTRAINT PK_COMPANIES_ID PRIMARY KEY (ID)
    GO
    ALTER TABLE PUBLIC.UNITS ADD CONSTRAINT PK_UNITS_ID PRIMARY KEY (ID)
    GO
    CREATE INDEX IX_UNITS_CODE_DESC_TYPE ON PUBLIC.UNITS (CODE DESC, TYPE)
    GO
    CREATE UNIQUE INDEX UK_UNITS_TYPE ON PUBLIC.UNITS (TYPE)
    GO
    ALTER TABLE PUBLIC.UNITS ADD CONSTRAINT FK_UNITS_COMPANY FOREIGN KEY (COMPANY)
    REFERENCES PUBLIC.COMPANIES (ID)
    GO
    ALTER TABLE PUBLIC.UNITS ADD CONSTRAINT FK_UNITS_TYPE FOREIGN KEY (TYPE)
    REFERENCES META.TYPES (ID)
    GO

# Syntax

    (PRODUCE-SQL-OUTPUT
      PATHNAME OUTPUT-DIRECTORY RDBMS
      &KEY IDENTIFIER-CASE SCHEMA-OUTPUT-FILE TABLE-OUTPUT-FILE
           PRIMARY-KEY-OUTPUT-FILE FOREIGN-KEY-OUTPUT-FILE INDEX-OUTPUT-FILE)

> `PRODUCE-SQL-OUTPUT` expands macros in the SST medium pointed by `PATHNAME`. It places output files under `OUTPUT-DIRECTORY`. Produced commands will be specific to given RDBMS and identifiers are case converted according to `IDENTIFIER-CASE`. (Valid values for `IDENTIFIER-CASE` are `:DOWNCASE`, `:UPCASE`, and `:QUOTE`.)

    (WITH-SCHEMA ATTRIBUTES SCHEMA-NAME &REST WITH-TABLE-COMPONENTS)
    (WITH-TABLE ATTRIBUTES TABLE-NAME COLUMNS &REST WITH-INDEX-COMPONENTS)

> List of `COLUMNS` forms are gets transformed to `WITH-COLUMN` expressions.

    (WITH-COLUMN COLUMN-NAME DATA-TYPE
      &KEY NOT-NULL DEFAULT PRIMARY-KEY FOREIGN-KEY)

> `DATA-TYPE`, `PRIMARY-KEY`, and `FOREIGN-KEY` forms are respectively transformed into `WITH-DATA-TYPE`, `WITH-PRIMARY-KEY`, and `WITH-FOREIGN-KEY` expressions.

    (WITH-DATA-TYPE DATA-TYPE &REST ATTRIBUTES)

> Supported data-types and relevant attributes are

    (BIGINT)
    (BIGSERIAL &KEY START INCREMENT)
    (BIT &OPTIONAL SIZE)
    (CHAR &OPTIONAL SIZE &KEY UNICODE)
    (FLOAT)
    (INT)
    (SERIAL &KEY START INCREMENT)
    (SMALLINT)
    (TEXT &KEY UNICODE)
    (TIMESTAMP &KEY WITH-TIME-ZONE)
    (VARCHAR &OPTIONAL SIZE &KEY UNICODE)

> Caveats are
>
> - At the moment, `UNICODE` key is meaningful only to Microsoft SQL Server.
> - At the moment, `WITH-TIME-ZONE` key is meaningful only to PostgreSQL.
>
> If one won't use any attributes of a data type, using list representation is optional.

    (WITH-FOREIGN-KEY TABLE &KEY SCHEMA ON-DELETE-CASCADE ON-UPDATE-CASCADE)

> Unless `SCHEMA` of the referenced `TABLE` is not in the current schema of current parsing scope, it's optional to supply a `SCHEMA`.

    (WITH-INDEX (&KEY UNIQUE) COLUMNS)