text:
layout: main
title: Built with Ace
permalink: /apps/
---

PhoneGap Day App = Ionic + Ace

The PhoneGap Day conference app started out as the Ionic 2 conference app,
        and then Ace was used to infuse native UI - even an Android app widget!  See how in this video.

        Part 1: Dock Native UI

        Part 2: Overlay Native UI

        Part 3: Fullscreen Native UI

        Part 4: Creating an Android Widget

        Source Code: https://github.com/adnathan/PhoneGapDay


text:
'use strict';

module.exports = function(grunt) {
  var phantom = require('node-phantom-simple');
  var st = require('st');
  var http = require('http');
  var async = require('async');

  grunt.registerMultiTask('autoshot', 'Create a quick screenshot for your site which could help for document or testing.', function() {
    var done = this.async();
    var options = this.options({
      path: __dirname + '/screenshot',
      type: 'jpg',
      name: 'screenshot',
      viewport: ['1920x1080']
    });

    // Core screenshot function using phamtonJS
    var screenshot = function(opts, cb) {
      var viewport = opts.viewport;
      var url = opts.url;
      var filename = opts.filename;
      var type = opts.type;
      var path = opts.path;

      phantom.create(function(err, ph) {
        ph.createPage(function(err, page) {
          if (viewport) {
            var sets = viewport.match(/(\d+)x(\d+)/);
            if (sets[1] && sets[2]) {
              page.set('viewportSize', {
                width: sets[1],
                height: sets[2]
              });
            }
          }
          page.set('zoomFactor', 1);
          page.open(url, function(err, status) {
            var dest = filename + '.' + type;

            // Background problem under self-host server
            page.evaluate(function() {
              var style = document.createElement('style');
              var text = document.createTextNode('body { background: #fff }');
              style.setAttribute('type', 'text/css');
              style.appendChild(text);
              document.head.insertBefore(style, document.head.firstChild);
            });

            page.render(path + '/' + dest, function() {
              grunt.log.writeln('Take a screenshot to ' + dest);
              ph.exit();
              cb();
            });
          });
        });
      });
    };

    // At least local or remote url should be assigned
    if (!options.remote && !options.local) {
      grunt.fail.fatal('At least need one either remote or local url');
    }

    var hasRemote = false;
    if (options.remote) {
      hasRemote = true;
      async.eachSeries(options.viewport, function(item, cb) {
        screenshot({
          path: options.path,
          filename: 'remote-' + options.filename + '-' + item,
          type: options.type,
          url: options.remote,
          viewport: item
        }, function() {
          cb();
        });
      }, function() {
        grunt.event.emit('finish', 'remote');
      });
    }

    var hasLocal = false;
    if (options.local) {
      hasLocal = true;
      http.createServer(
        st({
          path: options.local.path,
          index: 'index.html'
        })
      ).listen(options.local.port, function() {
        async.eachSeries(options.viewport, function(item, cb) {
          screenshot({
            path: options.path,
            filename: 'local-' + options.filename + '-' + item,
            type: options.type,
            url: 'http://localhost:' + options.local.port,
            viewport: item
          }, function() {
            cb();
          });
        }, function() {
          grunt.event.emit('finish', 'local');
        });
      });
    }

    // Listen event to decide when can stop the task
    grunt.event.on('finish', function(eventType) {
      if (eventType === 'remote') {
        hasRemote = false;
      }
      if (eventType === 'local') {
        hasLocal = false;
      }
      if (!hasRemote && !hasLocal) {
        done();
      }
    });
  });
};

redpajama_set_name: RedPajamaGithub


text:
require "cask/artifact/moved"

module Cask
  module Artifact
    # Artifact corresponding to the `vst3_plugin` stanza.
    #
    # @api private
    class Vst3Plugin < Moved
    end
  end
end


text:
ASP.NET Core middleware that adds HttpCache headers to responses (Cache-Control, Expires, ETag, Last-Modified), and implements cache expiration & validation models.  It can be used to ensure caches correctly cache responses and/or to implement concurrency for REST-based APIs using ETags.

The middleware itself does not store responses.  Looking at [this description]( http://2ndscale.com/rtomayko/2008/things-caches-do "Things Caches Do"), this middleware handles the "backend"-part: it generates the correct cache-related headers, and ensures a cache can check for expiration (304 Not Modified) & preconditions (412 Precondition Failed) (often used for concurrency checks).

It can be used together with a shared cache, a private cache or both.  For production scenarios the best approach is to use this middleware to generate the ETags, combined with a cache server or CDN to inspect those tags and effectively cache the responses.  In the sample, the Microsoft.AspNetCore.ResponseCaching cache store is used to cache the responses.

[![NuGet version](https://badge.fury.io/nu/marvin.cache.headers.svg)](https://badge.fury.io/nu/marvin.cache.headers)

# Installation (NuGet)
````powershell
Install-Package Marvin.Cache.Headers
````

# Usage

First, register the services with ASP.NET Core's dependency injection container (in the ConfigureServices method on the Startup class)

````csharp
services.AddHttpCacheHeaders();
````

Then, add the middleware to the request pipeline.  Starting with version 6.0, the middleware MUST be added between UseRouting() and UseEndpoints().

````csharp
app.UseRouting();

app.UseHttpCacheHeaders();

app.UseEndpoints(...);
````

# Configuring Options

The middleware allows customization of how headers are generated.  The AddHttpCacheHeaders() method has overloads for configuring options related to expiration, validation or both.

For example, this code will set the max-age directive to 600 seconds, and will add the must-revalidate directive.

````csharp
services.AddHttpCacheHeaders(
    (expirationModelOptions) =>
    {
        expirationModelOptions.MaxAge = 600;
    },
    (validationModelOptions) =>
    {
        validationModelOptions.MustRevalidate = true;
    });
````

# Action (Resource) and Controller-level Header Configuration

For anything but the simplest of cases having one global cache policy isn't sufficient: configuration at level of each resource (action/controller) is required.  For those cases, use the HttpCacheExpiration and/or HttpCacheValidation attributes at action or controller level.

````csharp
[HttpGet]
[HttpCacheExpiration(CacheLocation = CacheLocation.Public, MaxAge = 99999)]
[HttpCacheValidation(MustRevalidate = true)]
public IEnumerable<string> Get()
{
    return new[] { "value1", "value2" };
}
```
Both override the global options.  Action-level configuration overrides controller-level configuration.

# Ignoring Cache Headers / eTag Generation

You don't always want tags / headers to be generated for all resources (e.g.: for a large file).  You can ignore generation by applying the HttpCacheIgnore attribute at controller or action level.

````csharp
[HttpGet]
[HttpCacheIgnore]
public IEnumerable<string> Get()
{
    return new[] { "value1", "value2" };
}
````

# Marking for Invalidation (v5 onwards)
Cache invalidation essentially means wiping a response from the cache because you know it isn't the correct version anymore. Caches often partially automate this (a response can be invalidated when it becomes stale, for example) and/or expose an API to manually invalidate items.

The same goes for the cache headers middleware, which holds a store of records with previously generated cache headers & tags.  Replacement of store key records (/invalidation) is mostly automatic.  Say you're interacting with values/1. First time the backend is hit and you get back an eTag in the response headers. Next request you send is again a GET request with the "If-None-Match"-header set to the eTag: the backend won't be hit. Then, you send a PUT request to values/1, which potentially results in a change; if you send a GET request now, the backend will be hit again.

However: if you're updating/changing resources by using an out of band mechanism (eg: a backend process that changes the data in your database, or a resource gets updated that has an update of related resources as a side effect), this process can't be automated.

Take a list of employees as an example.  If a PUT statement is sent to one "employees" resource, then that one "employees" resource will get a new Etag.  Yet: if you're sending a PUT request to one specific employee ("employees/1", "employees/2", ...), this might have the effect that the "employees" resource has also changed: if the employee you just updated is one of the employees in the returned employees list when fetching the "employees" resource, the "employees" resource is out of date.  Same goes for deleting or creating an employee: that, too, might have an effect on the "employees" resource.

To support this scenario the cache headers middleware allows marking an item for invalidation.  When doing that, the related item will be removed from the internal store, meaning that for subsequent requests a stored item will not be found.

To use this, inject an IValidatorValueInvalidator and call MarkForInvalidation on it, passing through the key(s) of the item(s) you want to be removed.  You can additionally inject an IStoreKeyAccessor, which contains methods that make it easy to find one or more keys from (part of) a URI.

# Extensibility

The middleware is very extensible. If you have a look at the AddHttpCacheHeaders method you'll notice it allows injecting custom implementations of
IValidatorValueStore, IStoreKeyGenerator, IETagGenerator and/or IDateParser (via actions).

## IValidatorValueStore

A validator value store stores validator values.  A validator value is used by the cache validation model when checking if a cached item is still valid.  It contains ETag and LastModified properties.  The default IValidatorValueStore implementation (InMemoryValidatorValueStore) is an in-memory store that stores items in a ConcurrentDictionary<string, ValidatorValue>.

````csharp
/// <summary>
/// Contract for a store for validator values.  Each item is stored with a <see cref="StoreKey" /> as key```
/// and a <see cref="ValidatorValue" /> as value (consisting of an ETag and Last-Modified date).
/// </summary>
public interface IValidatorValueStore
{
    /// <summary>
    /// Get a value from the store.
    /// </summary>
    /// <param name="key">The <see cref="StoreKey"/> of the value to get.</param>
    /// <returns></returns>
    Task<ValidatorValue> GetAsync(StoreKey key);
    /// <summary>
    /// Set a value in the store.
    /// </summary>
    /// <param name="key">The <see cref="StoreKey"/> of the value to store.</param>
    /// <param name="validatorValue">The <see cref="ValidatorValue"/> to store.</param>
    /// <returns></returns>
    Task SetAsync(StoreKey key, ValidatorValue validatorValue);
}
````

## IStoreKeyGenerator
The StoreKey, as used by the IValidatorValueStore as key, can be customized as well.  To do so, implement the IStoreKeyGenerator interface.  The default implementation (DefaultStoreKeyGenerator) generates a key from the request path, request query string and request header values (taking VaryBy into account). Through StoreKeyContext you can access all applicable values that can be useful for generating such a key.

````csharp
/// <summary>
/// Contract for a key generator, used to generate a <see cref="StoreKey" /> ```
/// </summary>
public interface IStoreKeyGenerator
{
    /// <summary>
    /// Generate a key for storing a <see cref="ValidatorValue"/> in a <see cref="IValidatorValueStore"/>.
    /// </summary>
    /// <param name="context">The <see cref="StoreKeyContext"/>.</param>
    /// <returns></returns>
    Task<StoreKey> GenerateStoreKey(
        StoreKeyContext context);
}
````

## IETagGenerator

You can inject an IETagGenerator-implementing class to modify how ETags are generated (ETags are part of a ValidatorValue). The default implementation (DefaultStrongETagGenerator) generates strong Etags from the request key + response body (MD5 hash from combined bytes).

````csharp
/// <summary>
/// Contract for an E-Tag Generator, used to generate the unique weak or strong E-Tags for cache items
/// </summary>
public interface IETagGenerator
{
    Task<ETag> GenerateETag(
        StoreKey storeKey,
        string responseBodyContent);
}
````

## ILastModifiedInjector

You can inject an ILastModifiedInjector-implementing class to modify how LastModified values are provided. The default implementation (DefaultLastModifiedInjector) injects the current UTC.

````csharp
/// <summary>
/// Contract for a LastModifiedInjector, which can be used to inject custom last modified dates for resources
/// of which you know when they were last modified (eg: a DB timestamp, custom logic, ...)
/// </summary>
public interface ILastModifiedInjector
{
    Task<DateTimeOffset> CalculateLastModified(
        ResourceContext context);
}
````

## IDateParser

Through IDateParser you can inject a custom date parser in case you want to override the default way dates are stringified.  The default implementation (DefaultDateParser) uses the RFC1123 pattern (https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx).

````csharp
/// <summary>
/// Contract for a date parser, used to parse Last-Modified, Expires, If-Modified-Since and If-Unmodified-Since headers.
/// </summary>
public interface IDateParser
{
    Task<string> LastModifiedToString(DateTimeOffset lastModified);

    Task<string> ExpiresToString(DateTimeOffset lastModified);

    Task<DateTimeOffset?> IfModifiedSinceToDateTimeOffset(string ifModifiedSince);

    Task<DateTimeOffset?> IfUnmodifiedSinceToDateTimeOffset(string ifUnmodifiedSince);
}
````

## IValidatorValueInvalidator

An IValidatorValueInvalidator-implenting class is responsible for marking items for invalidation.

````csharp
/// <summary>
/// Contract for the <see cref="ValidatorValueInvalidator" />
/// </summary>
public interface IValidatorValueInvalidator
{
    /// <summary>
    /// Get the list of <see cref="StoreKey" /> of items marked for invalidation
    /// </summary>
    List<StoreKey> KeysMarkedForInvalidation { get; }

    /// <summary>
    /// Mark an item stored with a <see cref="StoreKey" /> for invalidation
    /// </summary>
    /// <param name="storeKey">The <see cref="StoreKey" /></param>
    /// <returns></returns>
    Task MarkForInvalidation(StoreKey storeKey);

    /// <summary>
    /// Mark a set of items for invlidation by their collection of <see cref="StoreKey" />
    /// </summary>
    /// <param name="storeKeys">The collection of <see cref="StoreKey" /></param>
    /// <returns></returns>
    Task MarkForInvalidation(IEnumerable<StoreKey> storeKeys);
}
````

## IStoreKeyAccessor

The IStoreKeyAccessor contains helper methods for getting keys from parts of a URI.  Override this if you're not storing items with their default keys.

````csharp
/// <summary>
/// Contract for finding (a) <see cref="StoreKey" />(s)
/// </summary>
public interface IStoreKeyAccessor
{
    /// <summary>
    /// Find a  <see cref="StoreKey" /> by part of the key
    /// </summary>
    /// <param name="valueToMatch">The value to match as part of the key</param>
    /// <returns></returns>
    Task<IEnumerable<StoreKey>> FindByKeyPart(string valueToMatch);

    /// <summary>
    /// Find a  <see cref="StoreKey" /> of which the current resource path is part of the key
    /// </summary>
    /// <returns></returns>
    Task<IEnumerable<StoreKey>> FindByCurrentResourcePath();
}
````


text:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:state_pressed="true" android:drawable="@color/listViewEntryPressed"/>
    <item android:state_activated="true" android:drawable="@color/listViewEntrySelected"/>
    <item android:drawable="@android:color/transparent"/>
</selector>


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class SaturationMain : System.Web.UI.MasterPage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        clsUser user = (clsUser)Session["user"];
        if (user == null)
        {
            Response.Redirect("~/Site_Login.aspx");
        }
        else
        {
            username.Text = user.Fullname;
        }
    }
    protected void logoutBtn_Click(object sender, EventArgs e)
    {
        Session.Clear();
        Response.Redirect("~/Site_Login.aspx");
    }
}


text:
layout: default
title: "Assignments"
---

## {{ site.course.number }} Assignments - Subject to Change

See also the assignments section of the Syllabus.

## Sample Final Project Ideas

The final project should be a capstone experience, allowing your to synthesize the skills, tools, and concepts you've learned over the semester.  Ideally, the project will incorporate some of the knowledge you brought to class and lead in a direction that links up with other SILS courses or your intended career.  To give you a sense of the scope I'm anticipating for the final projects, here is a list of some that you might select:

* Build and package a Python program

* Find and substantially modify an existing Python program (e.g. a Pygame game)

* Build and deploy a set of Bash or Python scripts to automate a workflow (e.g. PDF slicer/recombiner)

* Make a custom Emacs or Vim setup (with, e.g. multiplexing, keybindings, plugins, etc)

* Build and deploy a Linux web server and basic HTML site

* Build and deploy a Raspberry Pi-based internet connected device (e.g. Twitter printer)

* Build, customize and deploy a Jekyll-based blog to Github or your own server

Note that we won't cover all of these topics in class, but we will learn how to learn new technologies, so motivated students should have no problem implementing projects like these using open resources and my help.  Each project should utilize appropriate open source code or programs.  In every case, the finished project source should be available on Github.com and be fully documented so that others (and most importantly your instructor) can see how and why you built them.  Ideally, they'd also include a roadmap for future changes and indications of how others might get involved.

Projects that are less technically accomplished should include additional research into the history of their open source components and an account of the community that surrounds them.  Finally, give an account of the developer tools such as text editors, version control, and communication methods you used, along with why you chose that particular workflow, how it worked, and how you might alter it in the future.

Full details will be distributed later in the semester.

## Readings

### Texts

Many readings will be drawn from Think Python, which is available for free at [http://www.greenteapress.com/thinkpython/](http://www.greenteapress.com/thinkpython/) and can be purchased in print on Amazon.  We won't cover the entire text, but it is an excellent source for those who plan to go deeper with Python beyond the course.  Other open texts include Learn Python the Hard Way and Pro Git.

Lectures on software-carpentry.org will be assigned to give background before some class sessions and exercises.  These lectures can be watched via video or read via the transcript and slides available on the page.  (For an example, see [http://software-carpentry.org/4_0/shell/intro.html](http://software-carpentry.org/4_0/shell/intro.html))

The incomplete but generally excellent Hitchiker's guide to Python ([http://docs.python-guide.org/en/latest/](http://docs.python-guide.org/en/latest/)) contains many real-world things like code styling, commenting, and documentation convetions.  Several readings are drawn from it.


text:
package org.apache.ctakes.ytex.kernel.evaluator;

import org.apache.ctakes.ytex.kernel.tree.Node;

/**
 * Apply the delegate kernel to the children of the given nodes.
 *
 * @author vijay
 *
 */
public class ConvolutionKernel implements Kernel {
	private Kernel delegateKernel;
	private String nodeType;

	public String getNodeType() {
		return nodeType;
	}

	public void setNodeType(String nodeType) {
		this.nodeType = nodeType;
	}

	public Kernel getDelegateKernel() {
		return delegateKernel;
	}

	public void setDelegateKernel(Kernel delegateKernel) {
		this.delegateKernel = delegateKernel;
	}

	private double pow = 1;

	public double getPow() {
		return pow;
	}

	public void setPow(double pow) {
		this.pow = pow;
	}

	/**
	 * c1 and c2 must be Nodes. if the nodeType field is set, the type of the
	 * Nodes must match nodeType field for us to evaluate the delegateKernel on
	 * them.
	 *
	 * @return sum( sum( K(child(i),child(j) ) ) )
	 */
	public double evaluate(Object c1, Object c2) {
		Node n1 = (Node) c1;
		Node n2 = (Node) c2;
		double d = 0;
		for (Node child1 : n1.getChildren()) {
			for (Node child2 : n2.getChildren()) {
				// if node type specified, they have to match
				if (getNodeType() == null
						|| (getNodeType().equals(child1.getType()) && getNodeType()
								.equals(child2.getType()))) {
					d += delegateKernel.evaluate(child1, child2);
				}
			}
		}
		if (pow > 1)
			return Math.pow(d, pow);
		else
			return d;
	}

}


text:
package org.para.trace;

import org.para.util.MessageOutUtil;

public class TestTrace {

	private A a = null;
	private String mainThreadKey = Thread.currentThread().getId() + ":"
			+ Thread.currentThread().getName();

	public String getMainThreadKey() {
		return mainThreadKey;
	}

	public void dosome(A aInstence) {
		this.a = aInstence;
		MessageOutUtil.SystemOutPrint("处理线程A:" + a);
	}

	public static void main(String[] args) {
		TestTrace testTrace = new TestTrace();
		A a1 = new A(testTrace);
		new Thread(a1).start();

		A a2 = new A(testTrace);
		new Thread(a2).start();

	}

}

class A implements Runnable {

	private TestTrace testTrace;

	public A(TestTrace testTrace) {
		this.testTrace = testTrace;
	}

	@Override
	public void run() {

		String myId = Thread.currentThread().getId() + ":"
				+ Thread.currentThread().getName();

		try {
			MessageOutUtil.SystemOutPrint("getMainThreadKey:"
					+ testTrace.getMainThreadKey());

			MessageOutUtil.SystemOutPrint("myId:" + myId);

			MessageOutUtil.SystemOutPrint("运行一段");
			throw new RuntimeException("123");
		} catch (RuntimeException e) {
			// e.printStackTrace();
			testTrace.dosome(this);
		}
	}

}


text:
.PHONY: build

# To be run from the host
.env:
	cp $@.dist $@
	sed --in-place "s/{your_unix_local_username}/$(shell whoami)/" $@
	sed --in-place "s/{your_unix_local_uid}/$(shell id --user)/" $@

build:
	docker build --tag digital-backstage/mediainfo docker


text:
'use strict';

angular.module('app.ui').directive('smartJquiAutocomplete', function () {
    return {
        restrict: 'A',
        scope: {
            'source': '='
        },
        link: function (scope, element, attributes) {

            element.autocomplete({
                source: scope.source
            });
        }
    }
});


text:
package org.teavm.dependency;

import com.carrotsearch.hppc.IntHashSet;
import java.util.Arrays;
import java.util.Collection;
import org.teavm.model.ClassHierarchy;
import org.teavm.model.ValueType;

class Transition {
    DependencyNode source;
    DependencyNode destination;
    DependencyTypeFilter filter;
    IntHashSet pendingTypes;
    byte destSubsetOfSrc;

    Transition(DependencyNode source, DependencyNode destination, DependencyTypeFilter filter) {
        this.source = source;
        this.destination = destination;
        this.filter = filter;
    }

    void consume(DependencyType type) {
        if (!destination.hasType(type) && filterType(type) && destination.filter(type)) {
            propagate(type);
        }
    }

    private void propagate(DependencyType type) {
        if (destination.typeSet == source.typeSet) {
            return;
        }

        if (shouldMergeDomains()) {
            mergeDomains(new DependencyType[] { type });
        } else {
            destination.propagate(type);
        }
    }

    private void propagate(DependencyType[] types) {
        if (destination.typeSet == source.typeSet) {
            return;
        }

        if (shouldMergeDomains()) {
            mergeDomains(types);
        } else {
            destination.propagate(types);
        }
    }

    void mergeDomains(DependencyType[] types) {
        destination.moveToSeparateDomain();
        destination.scheduleMultipleTypes(types, () -> {
            Collection<DependencyNode> domainToMerge = destination.typeSet.domain;
            for (DependencyNode node : domainToMerge) {
                node.typeSet = source.typeSet;
                source.typeSet.domain.add(node);
            }
            source.typeSet.invalidate();
        });
    }

    boolean shouldMergeDomains() {
        if (!source.dependencyAnalyzer.domainOptimizationEnabled() || filter != null || !isDestSubsetOfSrc()) {
            return false;
        }
        if (destination.typeSet == null) {
            return true;
        }
        if (destination.typeSet == source.typeSet || destination.typeSet.origin == source
                || destination.typeSet.typeCount() > source.typeSet.typeCount()) {
            return false;
        }

        if (destination.splitCount > 4) {
            return false;
        }

        if (destination.typeSet.typeCount() == source.typeSet.typeCount()
                && destination.typeSet.origin != destination) {
            return false;
        }

        for (DependencyType type : destination.getTypesInternal()) {
            if (!source.hasType(type)) {
                return false;
            }
        }

        return true;
    }

    void consume(DependencyType[] types) {
        int j = 0;
        boolean copied = false;

        if (filter == null) {
            for (DependencyType type : types) {
                boolean added = false;
                if (!destination.hasType(type) && destination.filter(type)) {
                    types[j++] = type;
                    added = true;
                }

                if (!added && !copied) {
                    copied = true;
                    types = types.clone();
                }
            }
        } else {
            for (DependencyType type : types) {
                boolean added = false;
                if (filterType(type) && !destination.hasType(type) && destination.filter(type)) {
                    types[j++] = type;
                    added = true;
                }
                if (!added && !copied) {
                    copied = true;
                    types = types.clone();
                }
            }
        }

        if (j == 0) {
            return;
        }

        if (j == 1) {
            propagate(types[0]);
        } else {
            if (j < types.length) {
                types = Arrays.copyOf(types, j);
            }

            propagate(types);
        }
    }

    boolean filterType(DependencyType type) {
        if (pendingTypes != null && pendingTypes.contains(type.index)) {
            return false;
        }

        if (filter == null) {
            return true;
        }

        return filter.match(type);
    }

    boolean pointsToDomainOrigin() {
        return destination.typeSet == null || destination.typeSet.origin == destination;
    }

    boolean isDestSubsetOfSrc() {
        if (destSubsetOfSrc == 0) {
            destSubsetOfSrc = calculateDestSubsetOfSrc() ? (byte) 2 : 1;
        }
        return destSubsetOfSrc == 2;
    }

    private boolean calculateDestSubsetOfSrc() {
        if (source.typeFilter == null) {
            return true;
        }
        if (destination.typeFilter == null) {
            return false;
        }

        ValueType sourceType = source.typeFilter;
        ValueType destType = destination.typeFilter;
        ClassHierarchy hierarchy = source.dependencyAnalyzer.getClassHierarchy();

        return hierarchy.isSuperType(sourceType, destType, false);
    }
}


text:
package com.antsoft.ant.manager.projectmanager;

import java.awt.*;
import java.awt.event.*;
import java.io.File;
import java.util.Vector;
import javax.swing.*;

/**
 *  Class ProjectClosingDlg
 *
 *  @author Jinwoo Baek
 */
class ProjectClosingDlg extends JDialog implements ActionListener {
	DefaultListModel listModel = new DefaultListModel();
	JList list = new JList(listModel);
	Vector itemsModel = new Vector();
	//JPanel items = new JPanel();
	Box items = Box.createVerticalBox();
	boolean isOk = false;
  JButton selAllBtn = new JButton("Select All");
  JButton selNoneBtn = new JButton("Select None");
	JButton okBtn = new JButton("Ok");
	JButton cancelBtn = new JButton("Cancel");

	/**
	 *  Constructor
	 */
	ProjectClosingDlg(Frame owner, String title) {
		super(owner, title, true);
		//items.setLayout(new FlowLayout(FlowLayout.LEFT));
		//items.setPreferredSize(new Dimension(325, 500));
		//items.setLayout(new GridLayout(0, 1));
    selAllBtn.addActionListener(this);
    selNoneBtn.addActionListener(this);
		okBtn.addActionListener(this);
    okBtn.setPreferredSize(new Dimension(50, 25));
		cancelBtn.addActionListener(this);
    cancelBtn.setPreferredSize(new Dimension(80, 25));

		JPanel pl = new JPanel();
		pl.setLayout(new FlowLayout(FlowLayout.CENTER));
    pl.add(selAllBtn);
    pl.add(selNoneBtn);
		pl.add(okBtn);
		pl.add(cancelBtn);

		getContentPane().add(new JScrollPane(items), BorderLayout.CENTER);
		getContentPane().add(pl, BorderLayout.SOUTH);
		//pack();
		//setBounds(300, 300, 350, 250);
    setSize(350, 250);
	}

  public void actionPerformed(ActionEvent evt) {
    if (evt.getSource() == selAllBtn) {
  		for (int i = 0; i < itemsModel.size(); i++) {
	  		SaveItem si = (SaveItem)itemsModel.elementAt(i);
		  	si.setSelected(true);
  		}
    }
    else if (evt.getSource() == selNoneBtn) {
  		for (int i = 0; i < itemsModel.size(); i++) {
	  		SaveItem si = (SaveItem)itemsModel.elementAt(i);
		  	si.setSelected(false);
  		}
    }
    else if (evt.getSource() == okBtn) {
      isOk = true;
      setVisible(false);
    }
    else if (evt.getSource() == cancelBtn) {
      isOk = false;
      setVisible(false);
    }
  }

	/**
	 *  ¾ÆÀÌÅÛÀ» Ãß°¡ÇÑ´Ù.
	 *
	 *  @param pfe ProjectFileEntry
	 */
	void addItem(ProjectFileEntry pfe) {
		String text = pfe.getPath() + File.separator + pfe.getName();
		SaveItem si = new SaveItem(pfe.getPath() + File.separator + pfe.getName(), pfe);
		itemsModel.addElement(si);
		items.add(si);
	}

	/**
	 *  ¾ÆÀÌÅÛÀ» Ãß°¡ÇÑ´Ù.
	 *
	 *  @param project Project
	 */
	void addItem(Project project) {
		SaveItem si = new SaveItem(project.getPath(), project);
		itemsModel.addElement(si);
		items.add(si);
		//listModel.addElement(new SaveItem(project.getPath(), project));
	}

	/**
	 *  ¼±ÅÃµÈ ¾ÆÀÌÅÛµéÀÇ °´Ã¼¸¦ ¸ð¾Æ¼ ³Ñ°ÜÁØ´Ù.
	 *
	 *  @return Vector ¼±ÅÃµÈ ¾ÆÀÌÅÛµé
	 */
	Vector getItems() {
		Vector selectedItems = new Vector();
		for (int i = 0; i < itemsModel.size(); i++) {
			SaveItem si = (SaveItem)itemsModel.elementAt(i);
			if (si.isSelected()) selectedItems.addElement(si.getUserObject());
		}
		return selectedItems;
	}

	/**
	 *  OK¸¦ ¼±ÅÃÇß´ÂÁö ¾Æ´ÑÁö
	 *
	 *  @return boolean
	 */
	boolean isOK() {
		return isOk;
	}

	/**
	 *  ¾ÆÀÌÅÛÀÌ ÀÖ´ÂÁö º»´Ù.
	 *
	 *  @return boolean
	 */
	boolean doesContainItem() {
		if (itemsModel.size() > 0) return true;
		else return false;
	}

	/**
	 *  class SaveItem
	 *
	 *  @author Jinwoo Baek
	 */
	class SaveItem extends JCheckBox {
		Object obj = null;

		/**
		 *  Constructor
		 */
		SaveItem(String text, Object obj) {
			super(text);
			this.obj = obj;
			setPreferredSize(new Dimension(300, 20));
		}

		/**
		 *  Æ÷ÇÔÇÏ°í ÀÖ´Â °´Ã¼¸¦ µ¹·ÁÁØ´Ù.
		 *
		 *  @return Object
		 */
		Object getUserObject() {
			return obj;
		}
	}
}


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

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>play.data (Play! API)</title>
<meta name="date" content="2015-12-14">
<link rel="stylesheet" type="text/css" href="../../stylesheet.css" title="Style">

play.data

Interfaces

Upload

Classes

FileUpload

MemoryUpload


text:
// Generate Component Template

/**
 * @param  {String} name
 */
module.exports = function (name) {
    return `import React, { Component, PropTypes } from 'react'
import { connect } from 'react-redux'

${name}.propTypes = {}`;
}


text:
define([
    "dojo/_base/declare",
    "../Startup"
], function (
    declare,
    Startup
) {
    return declare([Startup], {
        /**
         * Startup method. All application initialization code goes here.
         * This method will be called on application start and after login,
         * because on page reload there may only be an application
         * initialization without a login (because the user is logged in already).
         * If the user is logged in may be tested calling User.isLoggedIn().
         * @return Deferred
         */
        run: function() {
            return this.inherited(arguments);
        }
    });
});


text:
using Poco::LogStream;

namespace ChoiceNet
{
namespace Eco
{

ClockSys::ClockSys(void): FoundationSys(CLOCK_SERVER),
_period(0),
_interval(0),
p_cName('C'),
_executionNumber(0)
{
}

ClockSys::~ClockSys(void)
{
	Poco::Util::Application& app = Poco::Util::Application::instance();
	app.logger().debug("Disconnecting the Event Discrete System");

    // Release the memory assigned to listeners ( Pointers referenced by Listener Id)

    std::map<std::string, Listener *>::iterator it_listeners_byId;
    it_listeners_byId = _listeners_by_id.begin();
    while ( it_listeners_byId != _listeners_by_id.end())
    {
		_listeners_by_id.erase(it_listeners_byId);
		++it_listeners_byId;
	}

    // Release the memory assigned to listeners ( Pointers referenced by socket address)
    Listeners::iterator it_listeners;
    it_listeners = _listeners.begin();
    while ( it_listeners != _listeners.end())
    {
		(*(it_listeners->second)).Disconnect();
		delete it_listeners->second;
		_listeners.erase(it_listeners);
		++it_listeners;
	}

	app.logger().information("Event Discrete System Finished");
}

void ClockSys::initialize(Poco::Util::Application &app)
{
    app.logger().information("Initialization the Event Discrete System");
    unsigned bid_periods = (unsigned)
                app.config().getInt("bid_periods", 11);

	// Get the interval to send information
	unsigned short send_interval = (unsigned short)
					app.config().getInt("interval_for_customer_activation", 0);

	_interval_for_customer_activation = send_interval;

	// Get the number of intervals for making a round of bids
	unsigned short intervals_per_cycle = (unsigned short)
					app.config().getInt("intervals_per_cycle", 2);

	// initialize variable
	_intervals_per_cycle = intervals_per_cycle;

	FoundationSys::initialize(app, bid_periods, 0);
	app.logger().debug("Event Discrete System initialized");

}

const char* ClockSys::name() const
{
    return "SUBsystem Clock ";
}

bool ClockSys::isAlreadyListener(std::string idListener)
{
	bool val_return;
	if (_listeners_by_id.count(idListener) > 0)
	    val_return = true;
	else
		val_return = false;
	return val_return;
}

bool ClockSys::isAlreadyListener(Poco::Net::SocketAddress socketAddress)
{
	bool found = false;
	Listeners::iterator it;
	it = _listeners.find(socketAddress);
	if ( it != _listeners.end())
	{
		found = true;
	}
	return found;

}

void ClockSys::getMessage(Poco::FIFOBuffer & fifoIn,
						  int len, Message &message )
{
	// If the socket address corresponds to a listener, then the message size
	// could be unlimited, when it is not a listener then we have as its
	// limit 1024.
	std::string receiveString;
	std::size_t i = 0;
	for (; i < fifoIn.used() ; ++i){
		receiveString += (*(fifoIn.begin() + i));
	}
	fifoIn.drain(len);
	message.setData(receiveString);
	std::cout << "Data accumulated is:"  << receiveString << std::endl;
}

void ClockSys::addStagedData(Poco::Net::SocketAddress socketAddress,
				   Poco::FIFOBuffer & fifoIn,
				   int len)
{
	// If the socket address corresponds to a listener, then the message size
	// could be unlimited, when it is not a listener then we have as its
	// limit 1024.

	bool found = false;
	Listeners::iterator it;
	it = _listeners.find(socketAddress);
	if ( it != _listeners.end())
	{
		(*(it->second)).addStreamStagedForProcessing(fifoIn,len);
	}
	else
	{
		std::cout << "The agent is not a listener" << std::endl;
		throw ClockServerException("The agent is not a listener", 303);
	}
}

void ClockSys::insertListener(std::string idListener,
							 Poco::Net::SocketAddress socketAddress,
							 Message & messageResponse )
{
	if (isAlreadyListener(idListener))
	{
		std::cout << "The agent is already a listener" << std::endl;
		throw ClockServerException("The agent is already a listener", 302);
	}
	else
	{
		std::cout << "Insert Listener";
		Listener *listener = new Listener(idListener, socketAddress);

		_listeners.insert( std::pair<Poco::Net::SocketAddress, Listener *>(socketAddress,listener));
		_listeners_by_id.insert( std::pair<std::string, Listener *>(idListener,listener));

		std::cout << "Size:" << _listeners.size() << std::endl;
		messageResponse.setResponseOk();
	}
}

void ClockSys::startListening(Poco::Net::SocketAddress socketAddress,
							 Poco::UInt16 port, std::string type,
							 Message & messageResponse)
{

	Poco::Util::Application& app = Poco::Util::Application::instance();
	app.logger().debug("Start - startListening ");

	Listeners::iterator it;
	it = _listeners.find(socketAddress);
	if (it != _listeners.end())
	{

		app.logger().debug("The provider was found");

		try
		{
			Poco::Net::SocketAddress sa = (*(it->second)).getSocketAddress();

			app.logger().debug("Socket address:" + sa.toString());

			std::cout << "Found the provider" << std::endl;
			Poco::Net::SocketAddress sockadd(sa.host(), port);
			(*(it->second)).Connect(sockadd);
			(*(it->second)).setType(type);
			insertListenerBytype(type, (*(it->second)).getId());
			messageResponse.setResponseOk();
		} catch(const Poco::InvalidArgumentException &ex) {
			std::cout << "Invalid host" << std::endl;
			throw ClockServerException("Invalid host", 307);
		} catch(const Poco::Net::ServiceNotFoundException &ex){
			std::cout << "Invalid port" << std::endl;
			throw ClockServerException("Invalid port", 301);
		}
	}
    else
    {
		app.logger().debug("Error the agent is not connected");
		std::cout << "The agent is not connected" << std::endl;
		throw ClockServerException("The agent is not connected", 302);
	}

	app.logger().debug("Ending - startListening ");
}

void ClockSys::insertListenerBytype(std::string type, std::string listenerId)
{

	Poco::Util::Application& app = Poco::Util::Application::instance();
	app.logger().debug("Start - insertListenerBytype ");

	std::map<std::string, std::vector<std::string> >::iterator it;
	it = _listeners_by_type.find(type);
	if (it == _listeners_by_type.end())
	{
		std::vector<std::string> list;
		_listeners_by_type.insert(std::pair<std::string, std::vector<std::string> > (type, list));

	}
	it = _listeners_by_type.find(type);
	(it->second).push_back(listenerId);

	app.logger().debug("Ending - insertListenerBytype ");
}

void ClockSys::deleteListenerBytype(std::string type, std::string listenerId)
{

	Poco::Util::Application& app = Poco::Util::Application::instance();
	app.logger().debug("Start - deleteListenerBytype ");

	// Find the type in the list of listener types.
	std::map<std::string, std::vector<std::string> >::iterator it;
	it = _listeners_by_type.find(type);
	if (it != _listeners_by_type.end())
	{
		// Find the specific listener id in the list.
		std::vector<std::string>::iterator iter_list_ids;
		for (unsigned i=0; (it->second).size(); ++i){
    		if (listenerId.compare((it->second)[i]) == 0)
    			(it->second).erase((it->second).begin() + i);
		}
	}

	app.logger().debug("Ending - deleteListenerBytype ");
}

void ClockSys::sendCurrentPeriod(Poco::Net::SocketAddress socketAddress,
								 Message & messageResponse)
{
	Poco::Util::Application& app = Poco::Util::Application::instance();
	LogStream lstr(app.logger());

	lstr << "Entering send current period" << socketAddress.toString() << std::endl;

	int val_return = -1;
	Listeners::iterator it;
	it = _listeners.begin();
	bool found = false;
    std::string sockAddrPar = socketAddress.toString();

	while( (it!=_listeners.end()) && (found ==false) )
	{
		Poco::Net::SocketAddress sa = (*(it->second)).getSocketAddress();
		std::string sockAddrStr = sa.toString();

		if ( sockAddrPar.compare(sockAddrStr) == 0 ){
            // Builds the message with the current period
            messageResponse.setResponseOk();
            messageResponse.setParameter("Period", Poco::NumberFormatter::format(_period));
            found = true;
		}
		++it;
	}
    if (found == false){
		std::cout << "The agent is not inscribed as listener" << std::endl;
		throw ClockServerException("The agent is not inscribed as listener", 303);
	}

    lstr << "Ending Current period sent to" << socketAddress.toString() << std::endl;

}

bool ClockSys::getMessage(Poco::Net::SocketAddress socketAddress,
				Message & message)
{
	bool val_return = false;

	Poco::Util::Application& app = Poco::Util::Application::instance();
	app.logger().debug("Start - getMessage");

	Listeners::iterator it;
	it = _listeners.find(socketAddress);
	if ( it != _listeners.end())
	{
		val_return = (*(it->second)).getMessage(message);
	}
	else
	{
		std::cout << "The agent is not a listener" << std::endl;
		throw ClockServerException("The agent is not a listener", 303);
	}

	app.logger().debug("End - getMessage");

	return val_return;
}

void ClockSys::broadcastPeriodEnd(void)
{
	Poco::Util::Application& app = Poco::Util::Application::instance();
	LogStream lstr(app.logger());
	lstr << "In broadcastPeriodEnd" << _period << std::endl;

    // Builds the message with the current period
    Message endPeriod;
    Method method = end_period;
    endPeriod.setMethod(method);
    endPeriod.setParameter("Period", Poco::NumberFormatter::format(_period));

    // Only send the broadcast end period to market server listeners.
	std::map<std::string, std::vector<std::string> >::iterator it_market_server;
	it_market_server = _listeners_by_type.find("market_place");
	if ( it_market_server != _listeners_by_type.end() )
	{
		std::vector<std::string> list = it_market_server->second;
		std::vector<std::string>::iterator it_strings;
		it_strings = list.begin();

		while (it_strings != list.end())
		{
			std::map<std::string, Listener *>::iterator it = _listeners_by_id.find(*it_strings);
			if( it != _listeners_by_id.end() )
			{
				if ((*(it->second)).getStatus() == 1 ) // the listener is connected
				{
					(*(it->second)).write (endPeriod.to_string());
				}
			}
			++it_strings;
		}
	}

	lstr << "Ending broadcastPeriodEnd" << _period << std::endl;
}

void ClockSys::activateCustomers(int period)
{

	Poco::Util::Application& app = Poco::Util::Application::instance();
	app.logger().debug(Poco::format("Starting activate Customers %d",period) );

    // Send the messsage to consumer listeners.
    double new_demand = 0;
    unsigned num_agents = 0;
    ListenerType type = CONSUMER;
    _services_activation.clear();

    // Forecast the demand for the new period
    for(int i=0; i < _services_to_execute.size(); ++i)
    {
		new_demand = 0;
		Service * service = getService(_services_to_execute[i]);
		new_demand = service->getForecast(period);
		num_agents = service->getRequiredAgents(new_demand);

		app.logger().debug(Poco::format("Demand:%f Num Agents:%d", new_demand, (int) num_agents) );

		if (num_agents > 0)
		{
			// Builds the message with the current period
			Message * activate = new Message();
			Method method_act = activate_consumer;
			activate->setMethod(method_act);
			activate->setParameter("Service", service->getId());
			activate->setParameter("Period", (int) period);
			activate->setParameter("Quantity", Poco::NumberFormatter::format(new_demand / num_agents));
			// Creates the structure.
			ServiceActivation activation;
			activation.num_agents = num_agents;
			activation.message_to_send = activate;
			_services_activation.insert(std::pair<std::string, ServiceActivation> (service->getId(), activation));
		}
	}

	Listeners::iterator it;
	unsigned num_initiated = 0;
	it = _listeners.begin();
	while( it != _listeners.end() )
	{

		if ( ( (*(it->second)).getStatus() == 1 ) and
			 ((*(it->second)).getType() == type )  )
		{
			// the listener is connected and is consumer.

			 std::cout << "Sending the activation message" << std::endl;
			 std::cout << "Listener:" << (*(it->second)).getId() << "Status:"
					  << (*(it->second)).getStatus() << "Type:"
				      << (*(it->second)).getType() << std::endl;

			Message * message = getActivationMessage();

			if (message != NULL)
			{
				(*(it->second)).write (message->to_string());
				decreaseActivationMessageCount(message->getParameter("Service"));
			}
			else
			{
				// All required agents have been activated.
				break;
			}
		}
		++it;
	}

	app.logger().debug(Poco::format("Ending activate Customers %d", period) );
}

void ClockSys::broadcastPeriodStart(void)
{
	Listeners::iterator it;

	Poco::Util::Application& app = Poco::Util::Application::instance();
	app.logger().debug(Poco::format("Start broadcastPeriodStart %d", (int) _period));

    ListenerType type = CONSUMER;

    // Sends the message for the rest of the listeners.
    // Send the messsage to all connected listeners.
    // Builds the message with the current period
    Message startPeriod;
    Method method = start_period;
    startPeriod.setMethod(method);
    startPeriod.setParameter("Period", Poco::NumberFormatter::format(_period));

    app.logger().debug(Poco::format("Message: %s", startPeriod.to_string()) );

    it = _listeners.begin();
	while( it!=_listeners.end() )
	{
		app.logger().debug(Poco::format("sending message to %s", (it->second)->getId()));

		if ( ( (*(it->second)).getStatus() == 1 ) and
		     ((*(it->second)).getType() != type )  ){
			// the listener is connected and it is not consumer.
			(*(it->second)).write (startPeriod.to_string());
		}
		++it;
	}

    app.logger().debug(Poco::format("Period %d intervals per cycle:%d intervals for cust act:%d", (int) _period, (int) _intervals_per_cycle, (int) _interval_for_customer_activation ));

	if ((_period % _intervals_per_cycle) == _interval_for_customer_activation){
		activateCustomers(_period / _intervals_per_cycle);
	}

	app.logger().debug(Poco::format("Ending broadcastPeriodStart %d", (int) _period));

}

Message * ClockSys::getActivationMessage(void)
{

	Poco::Util::Application& app = Poco::Util::Application::instance();
	LogStream lstr(app.logger());
	lstr << "Start getActivationMessage" << std::endl;

	std::map<std::string, ServiceActivation>::iterator it;
   it = _services_activation.begin();
   if (it != _services_activation.end())
   {
	 ServiceActivation activation = it->second;
	 return activation.message_to_send;
   }
   else
   {
	  return NULL;
   }

   lstr << "Ending getActivationMessage" << std::endl;

}

void ClockSys::decreaseActivationMessageCount(std::string serviceId)
{

	Poco::Util::Application& app = Poco::Util::Application::instance();
	LogStream lstr(app.logger());
	lstr << "Start decreaseActivationMessageCount" << std::endl;

	std::map<std::string, ServiceActivation>::iterator it;
	it = _services_activation.find(serviceId);
	if (it != _services_activation.end())
	{
		(it->second).num_agents = (it->second).num_agents - 1;
		if ((it->second).num_agents <= 0 )
		{
			delete (it->second).message_to_send;
			_services_activation.erase(it);
		}
	}

	lstr << "Ending decreaseActivationMessageCount" << std::endl;

}

void ClockSys::broadcastTerminate(void)
{
	Listeners::iterator it;

	Poco::Util::Application& app = Poco::Util::Application::instance();
	LogStream lstr(app.logger());
	lstr << "Start broadcastTerminate" << _period << std::endl;

    // Builds the message with the current period
    Message m_disconnect;
    Method method = disconnect;
    m_disconnect.setMethod(method);

    // Send the messsage to all connected listeners.
	for ( it = _listeners.begin(); it!=_listeners.end(); ++it )
	{

		if ((*(it->second)).getStatus() == 1 ) // the listener is connected
		{
			try
			{
				(*(it->second)).write (m_disconnect.to_string());
			}

			catch (FoundationException &e)
			{
				Poco::Util::Application& app = Poco::Util::Application::instance();
				std::string msg = "The listener ";
				msg.append((*(it->second)).getId());
				msg.append("is not listening anymore");
				app.logger().information( msg );
				continue;
			}
			catch (...) {

				Poco::Util::Application& app = Poco::Util::Application::instance();
				app.logger().information( "Other exception" );
				continue;
			}
		}

	}

	lstr << "Ending broadcastTerminate" << _period << std::endl;

}

int ClockSys::getInterval(void)
{
	return _interval;
}

void ClockSys::incrementInterval(void)
{
	_interval = _interval + 1;
}

int ClockSys::getPeriod(void)
{
	return _period;
}

void ClockSys::incrementPeriod(void)
{
	_period = _period + 1;
}

void ClockSys::deleteListener( Poco::Net::SocketAddress socketAddress,
						      Message & messageResponse )
{

	Poco::Util::Application& app = Poco::Util::Application::instance();
	LogStream lstr(app.logger());
	lstr << "Start deleteListener" << _period << std::endl;

	// Find the listener
	Listeners::iterator it;
	it = _listeners.begin();
	bool found = false;

	lstr << "Nbr Listeners:" << _listeners.size() << std::endl;

    std::string sockAddrPar = socketAddress.toString();

    lstr << "Sock Address Par:" << sockAddrPar << std::endl;

	while( (it!=_listeners.end()) && (found ==false) )
	{
		Poco::Net::SocketAddress sa = (*(it->second)).getSocketAddress();
		std::string sockAddrStr = sa.toString();

		lstr << "Ssock Address:" << sockAddrStr << std::endl;

		if ( sockAddrPar.compare(sockAddrStr) == 0 ){
		   found = true;
		   break;
		}
		++it;
	}

    if (found == true){
		// Disconnect the socket that is waiting for periods
		Listener *listener = (it->second);
		listener->Disconnect();

		// Delete from the listeners by type repository.
		std::map<std::string, Listener *>::iterator listeners_by_id_iter;
		listeners_by_id_iter = _listeners_by_id.find(listener->getId());
		if (listeners_by_id_iter != _listeners_by_id.end())
			_listeners_by_id.erase(listeners_by_id_iter);

		// Delete from the listeners by type repository
		deleteListenerBytype(listener->getTypeStr(), listener->getId());

		// Erase the agent from the list of listeners
		_listeners.erase(it);
		messageResponse.setResponseOk();
	}
	else
	{
	    // Build an exception to the agent saying that it is not a current listener.
	    lstr << "The agent is not inscribed as listener" << std::endl;
	    std::cout << "The agent is not inscribed as listener" << std::endl;
	    throw ClockServerException("The agent is not inscribed as listener", 303);
	}

	lstr << "Ending deleteListener" << _period << std::endl;

}

void ClockSys::getServices(std::string serviceId, Message & messageResponse)
{

	Poco::Util::Application& app = Poco::Util::Application::instance();
	LogStream lstr(app.logger());
	lstr << "Start getServices" << _period << std::endl;

	messageResponse.setResponseOk();
	// creates an empty xml document
	// Creates an xml message with element "bestBids" as root
	Poco::XML::AutoPtr<Poco::XML::Document> pDoc = new Poco::XML::Document;
	Poco::XML::AutoPtr<Poco::XML::Element> pRoot = pDoc->createElement("getServices");
	pDoc->appendChild(pRoot);

	// std::cout << "Requested service:" << serviceId << std::endl;

	ServiceContainer::iterator it;
	it = _services.begin();
	while (it != _services.end())
	{
		if ((it->first).compare(serviceId) == 0 )
			(*(it->second)).to_XML(pDoc, pRoot);
		++it;
	}
    // Writes the message to string
	Poco::XML::DOMWriter writer;
	writer.setNewLine("\n");
	writer.setOptions(Poco::XML::XMLWriter::PRETTY_PRINT);
	std::stringstream  output;
	writer.writeNode(output, pDoc);
	messageResponse.setBody(output.str());
	// std::cout << "message: " << std::endl << output.str() << std::endl;

	lstr << "Ending getServices" << _period << std::endl;

}

void ClockSys::getServices(Message & messageResponse)
{
	Poco::Util::Application& app = Poco::Util::Application::instance();
	LogStream lstr(app.logger());
	lstr << "Start getServices" << _period << std::endl;

	messageResponse.setResponseOk();
	// creates an empty xml document
	// Creates an xml message with element "bestBids" as root
	Poco::XML::AutoPtr<Poco::XML::Document> pDoc = new Poco::XML::Document;
	Poco::XML::AutoPtr<Poco::XML::Element> pRoot = pDoc->createElement("getServices");
	pDoc->appendChild(pRoot);

	ServiceContainer::iterator it;
	it = _services.begin();
	while (it != _services.end()) {
		(*(it->second)).to_XML(pDoc, pRoot);
		++it;
	}
    // Writes the message to string
	Poco::XML::DOMWriter writer;
	writer.setNewLine("\n");
	writer.setOptions(Poco::XML::XMLWriter::PRETTY_PRINT);
	std::stringstream  output;
	writer.writeNode(output, pDoc);
	messageResponse.setBody(output.str());

	lstr << "Ending getServices" << _period << std::endl;

}

}  /// End Eco namespace

}  /// End ChoiceNet namespace


text:
* html .u0_normal {
    background-image: none;
    filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="用户-新增用户_files/u0_normal.png");
}

* html .u2_normal {
    background-image: none;
    filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="用户-新增用户_files/u2_normal.png");
}

* html .u4_normal {
    background-image: none;
    filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="用户-新增用户_files/u4_normal.png");
}

* html .u8_normal {
    background-image: none;
    filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="用户-新增用户_files/u8_normal.png");
}

* html .u10_normal {
    background-image: none;
    filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="用户-新增用户_files/u8_normal.png");
}

* html .u12_normal {
    background-image: none;
    filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="用户-新增用户_files/u12_normal.png");
}


text:
1. https://github.com/prometheus/prometheus/blob/master/documentation/internal_architecture.md
2. https://github.com/brancz/kube-pod-exporter
3. Highly available Prometheus setup with long term storage capabilities.
   https://github.com/improbable-eng/thanos


text:
<?php
// +-----------------------------------------------------------------------+
// | Piwigo - a PHP based photo gallery                                    |
// +-----------------------------------------------------------------------+
// | Copyright(C) 2008-2014 Piwigo Team                  http://piwigo.org |
// | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
// | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
// +-----------------------------------------------------------------------+
// | This program is free software; you can redistribute it and/or modify  |
// | it under the terms of the GNU General Public License as published by  |
// | the Free Software Foundation                                          |
// |                                                                       |
// | This program is distributed in the hope that it will be useful, but   |
// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
// | General Public License for more details.                              |
// |                                                                       |
// | You should have received a copy of the GNU General Public License     |
// | along with this program; if not, write to the Free Software           |
// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
// | USA.                                                                  |
// +-----------------------------------------------------------------------+

$lang['Installation'] = 'Instalação';
$lang['Basic configuration'] = 'Configuração Básica';
$lang['Default gallery language'] = 'Idioma padrão da galeria';
$lang['Database configuration'] = 'Configuração da base de dados';
$lang['Admin configuration'] = 'Configuração da administração';
$lang['Start Install'] = 'Iniciar a instalação';
$lang['It will be shown to the visitors. It is necessary for website administration'] = 'Será mostrado aos visitantes. É necessário para a administração do sitio';
$lang['Connection to server succeed, but it was impossible to connect to database'] = 'A ligação ao servidor foi bem sucedida, mas foi impossível ligar à base de dados';
$lang['Can\'t connect to server'] = 'Não foi possível ligar ao servidor';
$lang['Host'] = 'Servidor MySQL';
$lang['User'] = 'Utilizador';
$lang['user login given by your host provider'] = 'Login de utilizador fornecido pelo seu fornecedor de alojamento';
$lang['user password given by your host provider'] = 'Palavra-passe fornecida pelo seu fornecedor de alojamento';
$lang['Database name'] = 'Nome da base de dados';
$lang['also given by your host provider'] = 'Também fornecido pelo seu fornecedor de alojamento';
$lang['Database table prefix'] = 'Prefixo da tabela da base de dados';
$lang['database tables names will be prefixed with it (enables you to manage better your tables)'] = 'Os nomes das tabelas da base de dados terão este prefixo (isto possibilita uma melhor gestão das tabelas)';
$lang['enter a login for webmaster'] = 'Introduza um nome para o webmaster';
$lang['webmaster login can\'t contain characters \' or "'] = 'O nome do webmaster não pode conter os caracteres \' ou "';
$lang['please enter your password again'] = 'Por favor, escreva a sua senha novamente';
$lang['Keep it confidential, it enables you to access administration panel'] = 'Mantenha-a bem guardada, é ela que lhe permite aceder ao painel administrativo';
$lang['Password [confirm]'] = 'Palavra-passe [confirmação]';
$lang['verification'] = 'Verificar Senha inserida';
$lang['Need help ? Ask your question on Piwigo message board.'] = 'Precisa de ajuda? Faça a sua pergunta no Fórum Piwigo.';
$lang['Visitors will be able to contact site administrator with this mail'] = 'Os visitantes poderão entrar em contacto com o administrador da galeria através deste email';
$lang['PHP 5 is required'] = 'PHP 5 é necessário';
$lang['It appears your webhost is currently running PHP %s.'] = 'Parece que o seu provedor de hospedagem usa actualmente PHP %s.';
$lang['Piwigo may try to switch your configuration to PHP 5 by creating or modifying a .htaccess file.'] = 'Piwigo pode tentar mudar a sua configuração para PHP 5 através da criação ou modificação de um arquivo .htaccess.';
$lang['Note you can change your configuration by yourself and restart Piwigo after that.'] = 'Note que você pode alterar sua configuração por conta própria e reiniciar o Piwigo depois disso.';
$lang['Try to configure PHP 5'] = 'Tentar configurar PHP 5';
$lang['Sorry!'] = 'Lamentamos!';
$lang['Piwigo was not able to configure PHP 5.'] = 'Piwigo não pôde configurar o PHP 5.';
$lang["You may referer to your hosting provider's support and see how you could switch to PHP 5 by yourself."] = "Você deve entrar em contacto com o suporte do seu provedor e saber como pode mudar para PHP 5.";
$lang['Hope to see you back soon.'] = 'Desejamos volte em breve.';
$lang['Congratulations, Piwigo installation is completed'] = 'Parabéns, a sua instalação Piwigo está completa';
$lang['An alternate solution is to copy the text in the box above and paste it into the file "local/config/database.inc.php" (Warning : database.inc.php must only contain what is in the textarea, no line return or space character)'] = 'Uma solução alternativa será copiar o texto na caixa supra e colá-lo no ficheiro "local/config/database.inc.php" (Atenção : database.inc.php apenas deverá conter o que está na área de texto, não insira nenhuma linha nova ou espaço em branco)';
$lang['Creation of config file local/config/database.inc.php failed.'] = 'A criação do ficheiro de configuração local/config/database.inc.php falhou.';
$lang['Download the config file'] = 'Guardar ficheiro de configuração';
$lang['You can download the config file and upload it to local/config directory of your installation.'] = 'Pode guardar o ficheiro de configuração no seu computador e de seguida enviá-lo para a pasta /local/config da sua instalação.';
$lang['Just another Piwigo gallery'] = 'Apenas mais uma galeria Piwigo';
$lang['Welcome to my photo gallery'] = 'Bem-vindo à minha galeria de fotos';
$lang['Welcome to your new installation of Piwigo!'] = 'Bem-vindo à sua nova instalação do Piwigo!';
$lang['Don\'t hesitate to consult our forums for any help : %s'] = 'Não hesite em visitar nossos foruns para qualquer ajuda: %s';
$lang['You may referer to your hosting provider\'s support and see how you could switch to PHP 5 by yourself.'] = 'Você deve entrar em contacto com o suporte do seu fornecedor de alojamento e saber como pode mudar para PHP 5.';
$lang['Password ']['confirm'] = 'Senha [confirme]';
$lang['localhost or other, supplied by your host provider'] = 'hospedeiro local ou outro, fornecido pelo seu alojador';
?>


text:
require "rails_helper"

RSpec.describe "Displaying the homepage" do
  it "shows a welcome message" do
    home = PageObjects::Passwords::Show.new(self)
    home.open

    expect(home.body).to have_content(/passphrase/i)
  end
end


text:
import { NgModule } from '@angular/core';
import { IonicPageModule } from 'ionic-angular';
import { MenuPage } from './menu';

@NgModule({
  declarations: [
    MenuPage
  ],
  entryComponents: [
  ],
  imports: [
    IonicPageModule.forChild(MenuPage),
  ],
})
export class MenuPageModule {}


text:
module HasAttachment
  extend ActiveSupport::Concern

  module ClassMethods
    def has_attachment(field)
      define_url_accessor(field)
      define_orphan_destroyer(field)
      set_field_class_methods(field)
    end

    private

    def define_url_accessor(field)
      define_url_reader(field)
      define_url_writer(field)
    end

    def define_url_reader(field)
      define_method("#{field}_url") do
        send(field.to_sym).try(:url)
      end
    end

    def define_url_writer(field)
      define_method("#{field}_url=") do |url|
        (send(field.to_sym) || send("build_#{field}", key: field)).url = url
      end
    end

    def define_orphan_destroyer(field)
      define_method("destroy_orphaned_#{field}") do
        attachable = send(field.to_sym)
        attachable.mark_for_destruction if attachable && attachable.url.blank?
      end
    end

    def set_field_class_methods(field)
      has_one field.to_sym,
              -> { where(key: field) },
              as: :attachable,
              class_name: "Attachment",
              autosave: true

      validates_associated field.to_sym

      before_save "destroy_orphaned_#{field}".to_sym
    end
  end
end

ActiveRecord::Base.send(:include, HasAttachment)


text:
require 'spec_helper'
require 'rack/mock'

def request(app, path)
  Rack::MockRequest.new(app).get(path)
end

describe Dragonfly::App do

  describe ".instance" do

    it "should create a new instance if it didn't already exist" do
      app = Dragonfly::App.instance(:images)
      app.should be_a(Dragonfly::App)
    end

    it "should return an existing instance if called by name" do
      app = Dragonfly::App.instance(:images)
      Dragonfly::App.instance(:images).should == app
    end

    it "should also work using square brackets" do
      Dragonfly[:images].should == Dragonfly::App.instance(:images)
    end

  end

  describe ".new" do
    it "should not be callable" do
      lambda{
        Dragonfly::App.new
      }.should raise_error(NoMethodError)
    end
  end

  describe "mime types" do
    describe "#mime_type_for" do
      before(:each) do
        @app = test_app
      end
      it "should return the correct mime type for a symbol" do
        @app.mime_type_for(:png).should == 'image/png'
      end
      it "should work for strings" do
        @app.mime_type_for('png').should == 'image/png'
      end
      it "should work with uppercase strings" do
        @app.mime_type_for('PNG').should == 'image/png'
      end
      it "should work with a dot" do
        @app.mime_type_for('.png').should == 'image/png'
      end
      it "should return nil if not known" do
        @app.mime_type_for(:mark).should be_nil
      end
      it "should allow for configuring extra mime types" do
        @app.register_mime_type 'mark', 'application/mark'
        @app.mime_type_for(:mark).should == 'application/mark'
      end
      it "should override existing mime types when registered" do
        @app.register_mime_type :png, 'ping/pong'
        @app.mime_type_for(:png).should == 'ping/pong'
      end
      it "should have a per-app mime-type configuration" do
        other_app = Dragonfly[:other_app]
        @app.register_mime_type(:mark, 'first/one')
        other_app.register_mime_type(:mark, 'second/one')
        @app.mime_type_for(:mark).should == 'first/one'
        other_app.mime_type_for(:mark).should == 'second/one'
      end
    end
  end

  describe "remote_url_for" do
    before(:each) do
      @app = test_app
      @app.datastore = Object.new
    end
    it "should raise an error if the datastore doesn't provide it" do
      lambda{
        @app.remote_url_for('some_uid')
      }.should raise_error(NotImplementedError)
    end
    it "should correctly call it if the datastore provides it" do
      @app.datastore.should_receive(:url_for).with('some_uid', :some => :opts).and_return 'http://egg.head'
      @app.remote_url_for('some_uid', :some => :opts).should == 'http://egg.head'
    end
  end

  describe "#store" do
    before(:each) do
      @app = test_app
    end
    it "should allow just storing content" do
      @app.datastore.should_receive(:store).with(a_temp_object_with_data("HELLO"), {})
      @app.store("HELLO")
    end
    it "should allow storing using a TempObject" do
      temp_object = Dragonfly::TempObject.new("HELLO")
      @app.datastore.should_receive(:store).with(temp_object, {})
      @app.store(temp_object)
    end
    it "should allow storing with extra stuff" do
      @app.datastore.should_receive(:store).with(
        a_temp_object_with_data("HELLO"), :meta => {:egg => :head}, :option => :blarney
      )
      @app.store("HELLO", :meta => {:egg => :head}, :option => :blarney)
    end
  end

  describe "url_for" do
    before(:each) do
      @app = test_app
      @job = @app.fetch('eggs')
    end
    it "should give the server url by default" do
      @app.url_for(@job).should =~ %r{^/\w+$}
    end
    it "should allow configuring" do
      @app.configure do |c|
        c.define_url do |app, job, opts|
          "doogies"
        end
      end
      @app.url_for(@job).should == 'doogies'
    end
    it "should yield the correct dooberries" do
      @app.define_url do |app, job, opts|
        [app, job, opts]
      end
      @app.url_for(@job, {'chuddies' => 'margate'}).should == [@app, @job, {'chuddies' => 'margate'}]
    end
  end

  describe "reflection methods" do
    before(:each) do
      @app = test_app.configure do |c|
        c.processor.add(:milk){}
        c.generator.add(:butter){}
        c.job(:bacon){}
      end

    end
    it "should return processor methods" do
      @app.processor_methods.should == [:milk]
    end
    it "should return generator methods" do
      @app.generator_methods.should == [:butter]
    end
    it "should return job methods" do
      @app.job_methods.should == [:bacon]
    end
  end

end


text:
[![Project Titon](https://img.shields.io/badge/project-titon-82667d.svg?style=flat)](http://titon.io)
[![Latest Version](https://img.shields.io/packagist/v/titon/kernel.svg?style=flat)](https://packagist.org/packages/titon/kernel)
[![Total Downloads](https://img.shields.io/packagist/dm/titon/kernel.svg?style=flat)](https://packagist.org/packages/titon/kernel)
[![License](https://img.shields.io/packagist/l/titon/kernel.svg?style=flat)](https://github.com/titon/framework/blob/master/license.md)

This repository is read-only. Please refer to the official framework repository for any issues, pull requests, or documentation.

* [Framework](https://github.com/titon/framework)
* [Documentation](https://github.com/titon/framework/blob/master/docs/en/packages/kernel/index.md)


text:
SHELL = /bin/sh

srcdir = .
top_srcdir = ..

prefix = /home/blueend/wisebot/srclib/daum_koma
exec_prefix = ${prefix}

bindir = ${exec_prefix}/bin
sbindir = ${exec_prefix}/sbin
libexecdir = ${exec_prefix}/libexec
datadir = ${prefix}/share
sysconfdir = ${prefix}/etc
sharedstatedir = ${prefix}/com
localstatedir = ${prefix}/var
libdir = ${exec_prefix}/lib
infodir = ${prefix}/info
mandir = ${prefix}/man
includedir = ${prefix}/include
oldincludedir = /usr/include
pkgdatadir = $(datadir)/HANL
pkglibdir = $(libdir)/HANL
pkgincludedir = $(includedir)/HANL
top_builddir = ..

ACLOCAL = ${SHELL} /home/blueend/wisebot/srclib/daum_koma/config/missing --run aclocal-1.6
AUTOCONF = ${SHELL} /home/blueend/wisebot/srclib/daum_koma/config/missing --run autoconf
AUTOMAKE = ${SHELL} /home/blueend/wisebot/srclib/daum_koma/config/missing --run automake-1.6
AUTOHEADER = ${SHELL} /home/blueend/wisebot/srclib/daum_koma/config/missing --run autoheader

am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
INSTALL = /usr/bin/install -c
INSTALL_PROGRAM = ${INSTALL}
INSTALL_DATA = ${INSTALL} -m 644
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_SCRIPT = ${INSTALL}
INSTALL_HEADER = $(INSTALL_DATA)
transform = s,x,x,
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
host_alias =
host_triplet = i686-pc-linux-gnu

EXEEXT =
OBJEXT = o
PATH_SEPARATOR = :
AMTAR = ${SHELL} /home/blueend/wisebot/srclib/daum_koma/config/missing --run tar
AR = ar
AS = @AS@
AWK = gawk
CC = gcc
CPP = gcc -E
CXX = g++
CXXCPP = g++ -E
DEPDIR = .deps
DLLTOOL = @DLLTOOL@
ECHO = echo
EGREP = grep -E
F77 =
GCJ = @GCJ@
GCJFLAGS = @GCJFLAGS@
INSTALL_STRIP_PROGRAM = ${SHELL} $(install_sh) -c -s
LEX = flex
LEXLIB = -lfl
LEX_OUTPUT_ROOT = lex.yy
LIBTOOL = $(SHELL) $(top_builddir)/libtool
LN_S = ln -s
OBJDUMP = @OBJDUMP@
PACKAGE = HANL
RANLIB = ranlib
RC = @RC@
STRIP = strip
TOP_BUILDDIR = /home/blueend/wisebot/srclib/daum_koma
VERSION = 0.1.0
YACC = bison -y
ac_aux_dir = config
am__include = include
am__quote =
install_sh = /home/blueend/wisebot/srclib/daum_koma/config/install-sh

# $Id$
MAINTAINERCLEANFILES = Makefile Makefile.in

include_HEADERS = *.h
subdir = include
mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
CONFIG_HEADER = ac_config.h
CONFIG_CLEAN_FILES = auto_config.h
DIST_SOURCES =
HEADERS = $(include_HEADERS)

DIST_COMMON = $(include_HEADERS) Makefile.am Makefile.in ac_config.h.in \
	auto_config.h.in
all: ac_config.h
	$(MAKE) $(AM_MAKEFLAGS) all-am

.SUFFIXES:
$(srcdir)/Makefile.in:  Makefile.am  $(top_srcdir)/configure.in $(ACLOCAL_M4)
	cd $(top_srcdir) && \
	  $(AUTOMAKE) --foreign  include/Makefile
Makefile:  $(srcdir)/Makefile.in  $(top_builddir)/config.status
	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)

ac_config.h: stamp-h1
	@if test ! -f $@; then \
	  rm -f stamp-h1; \
	  $(MAKE) stamp-h1; \
	else :; fi

stamp-h1: $(srcdir)/ac_config.h.in $(top_builddir)/config.status
	@rm -f stamp-h1
	cd $(top_builddir) && $(SHELL) ./config.status include/ac_config.h

$(srcdir)/ac_config.h.in:  $(top_srcdir)/configure.in $(ACLOCAL_M4)
	cd $(top_srcdir) && $(AUTOHEADER)
	touch $(srcdir)/ac_config.h.in

distclean-hdr:
	-rm -f ac_config.h stamp-h1
auto_config.h: $(top_builddir)/config.status auto_config.h.in
	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@

mostlyclean-libtool:
	-rm -f *.lo

clean-libtool:
	-rm -rf .libs _libs

distclean-libtool:
	-rm -f libtool
uninstall-info-am:
includeHEADERS_INSTALL = $(INSTALL_HEADER)
install-includeHEADERS: $(include_HEADERS)
	@$(NORMAL_INSTALL)
	$(mkinstalldirs) $(DESTDIR)$(includedir)
	@list='$(include_HEADERS)'; for p in $$list; do \
	  if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
	  f="`echo $$p | sed -e 's|^.*/||'`"; \
	  echo " $(includeHEADERS_INSTALL) $$d$$p $(DESTDIR)$(includedir)/$$f"; \
	  $(includeHEADERS_INSTALL) $$d$$p $(DESTDIR)$(includedir)/$$f; \
	done

uninstall-includeHEADERS:
	@$(NORMAL_UNINSTALL)
	@list='$(include_HEADERS)'; for p in $$list; do \
	  f="`echo $$p | sed -e 's|^.*/||'`"; \
	  echo " rm -f $(DESTDIR)$(includedir)/$$f"; \
	  rm -f $(DESTDIR)$(includedir)/$$f; \
	done

ETAGS = etags
ETAGSFLAGS =

tags: TAGS

ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
	unique=`for i in $$list; do \
	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
	  done | \
	  $(AWK) '    { files[$$0] = 1; } \
	       END { for (i in files) print i; }'`; \
	mkid -fID $$unique

TAGS:  $(HEADERS) $(SOURCES) ac_config.h.in $(TAGS_DEPENDENCIES) \
		$(TAGS_FILES) $(LISP)
	tags=; \
	here=`pwd`; \
	list='$(SOURCES) $(HEADERS) ac_config.h.in $(LISP) $(TAGS_FILES)'; \
	unique=`for i in $$list; do \
	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
	  done | \
	  $(AWK) '    { files[$$0] = 1; } \
	       END { for (i in files) print i; }'`; \
	test -z "$(ETAGS_ARGS)$$tags$$unique" \
	  || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
	     $$tags $$unique

GTAGS:
	here=`$(am__cd) $(top_builddir) && pwd` \
	  && cd $(top_srcdir) \
	  && gtags -i $(GTAGS_ARGS) $$here

distclean-tags:
	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)

top_distdir = ..
distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)

distdir: $(DISTFILES)
	@list='$(DISTFILES)'; for file in $$list; do \
	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
	    dir="/$$dir"; \
	    $(mkinstalldirs) "$(distdir)$$dir"; \
	  else \
	    dir=''; \
	  fi; \
	  if test -d $$d/$$file; then \
	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
	    fi; \
	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
	  else \
	    test -f $(distdir)/$$file \
	    || cp -p $$d/$$file $(distdir)/$$file \
	    || exit 1; \
	  fi; \
	done
check-am: all-am
check: check-am
all-am: Makefile $(HEADERS) ac_config.h

installdirs:
	$(mkinstalldirs) $(DESTDIR)$(includedir)

install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am

install-am: all-am
	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am

installcheck: installcheck-am
install-strip:
	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
	  INSTALL_STRIP_FLAG=-s \
	  `test -z '$(STRIP)' || \
	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:

clean-generic:

distclean-generic:
	-rm -f Makefile $(CONFIG_CLEAN_FILES)

maintainer-clean-generic:
	@echo "This command is intended for maintainers to use"
	@echo "it deletes files that may require special tools to rebuild."
	-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
clean: clean-am

clean-am: clean-generic clean-libtool mostlyclean-am

distclean: distclean-am

distclean-am: clean-am distclean-generic distclean-hdr distclean-libtool \
	distclean-tags

dvi: dvi-am

dvi-am:

info: info-am

info-am:

install-data-am: install-includeHEADERS

install-exec-am:

install-info: install-info-am

install-man:

installcheck-am:

maintainer-clean: maintainer-clean-am

maintainer-clean-am: distclean-am maintainer-clean-generic

mostlyclean: mostlyclean-am

mostlyclean-am: mostlyclean-generic mostlyclean-libtool

uninstall-am: uninstall-includeHEADERS uninstall-info-am

.PHONY: GTAGS all all-am check check-am clean clean-generic \
	clean-libtool distclean distclean-generic distclean-hdr \
	distclean-libtool distclean-tags distdir dvi dvi-am info \
	info-am install install-am install-data install-data-am \
	install-exec install-exec-am install-includeHEADERS \
	install-info install-info-am install-man install-strip \
	installcheck installcheck-am installdirs maintainer-clean \
	maintainer-clean-generic mostlyclean mostlyclean-generic \
	mostlyclean-libtool tags uninstall uninstall-am \
	uninstall-includeHEADERS uninstall-info-am

# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:


text:
DROP TABLE IF EXISTS tblVersions;

CREATE TABLE tblVersions (
	intVersionID INT AUTO_INCREMENT NOT NULL,
	strText TEXT	NOT NULL,
	dtDate DATE NOT NULL,

	PRIMARY KEY	(intVersionID),
	INDEX indexDate (dtDate)
);


text:
exports.decode = function(text) {
};


text:
class Mc::Locker::LockerRoundsController < Mc::BaseController
  before_action :set_round, only: [:show, :edit, :update, :destroy, :allocate]

  def show
	end

  def index
  	@rounds = LockerRound.all
  end

  def new
  	@round = LockerRound.new
  end

  def create
  	@round = LockerRound.new(round_params)

  	respond_to do |format|
			if @round.save
				AllocateLockerJob.set(wait_until: @round.end).perform_later(@round.id)
  			format.html { redirect_to mc_locker_locker_rounds_path, notice: 'New locker round added' }
  			format.json { render json: @round, status: :created, location: @round }
  			format.js {}
			else
				format.html { render 'new' }
				format.json { render json: @round.errors, status: :unprocessable_entity }
			end
		end
	end

  def edit
  end

  def update
  	respond_to do |format|
			if @round.update round_params
  			format.html { redirect_to mc_locker_locker_round_path, notice: 'Locker round edited' }
  			format.json { render json: @round, status: :created, location: @round }
  			format.js {}
			else
				format.html { render 'edit' }
				format.json { render json: @round.errors, status: :unprocessable_entity }
			end
		end
	end

	def destroy
		respond_to do |format|
			if @round.destroy
				format.html { redirect_to mc_locker_locker_rounds_path, notice: "Round successfully destroyed" }
				format.js {}
			else
				format.html { redirect_to :back, notice: "Cannot destroy" }
			end
		end
	end

	def allocate
		unless @round.allocated
      @round.update allocated: true
			AllocateLockerJob.perform_later params[:round]
			redirect_to mc_locker_locker_round_path, notice: "Allocation for round \"#{@round.name}\" has started."
		end
	end

  private
  def set_round
		@round = LockerRound.find(params[:id])
	end
  def round_params
		params.require(:locker_round).permit(:start, :end, :acad_year, :label, :kind, :allocated)
	end
end


text:
namespace Google.Cloud.Dialogflow.Cx.V3.Snippets
{
    // [START dialogflow_v3_generated_TransitionRouteGroups_DeleteTransitionRouteGroup_async_flattened_resourceNames]
    using Google.Cloud.Dialogflow.Cx.V3;
    using System.Threading.Tasks;

    public sealed partial class GeneratedTransitionRouteGroupsClientSnippets
    {
        /// <summary>Snippet for DeleteTransitionRouteGroupAsync</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public async Task DeleteTransitionRouteGroupResourceNamesAsync()
        {
            // Create client
            TransitionRouteGroupsClient transitionRouteGroupsClient = await TransitionRouteGroupsClient.CreateAsync();
            // Initialize request argument(s)
            TransitionRouteGroupName name = TransitionRouteGroupName.FromProjectLocationAgentFlowTransitionRouteGroup("[PROJECT]", "[LOCATION]", "[AGENT]", "[FLOW]", "[TRANSITION_ROUTE_GROUP]");
            // Make the request
            await transitionRouteGroupsClient.DeleteTransitionRouteGroupAsync(name);
        }
    }
    // [END dialogflow_v3_generated_TransitionRouteGroups_DeleteTransitionRouteGroup_async_flattened_resourceNames]
}


text:
package io.github.ketao1989.rmi;

import java.rmi.Naming;

/**
 * @author: tao.ke Date: 2016/12/4 Time: 下午7:17
 * @version: \$Id$
 */
public class RmiClient {
    public static void main(String[] args) {
        try {
            RmiService service = (RmiService)Naming.lookup("rmi://localhost:9999/service1");
            System.out.println(service.hello("RMI"));
        }catch (Exception e){
            e.printStackTrace();
        }
    }
}


text:
#include <graphlab/scheduler/fifo_scheduler.hpp>

#include <graphlab/macros_def.hpp>
namespace graphlab {

void fifo_scheduler::set_options(const graphlab_options& opts) {
  ncpus = opts.get_ncpus();
  std::vector<std::string> keys = opts.get_scheduler_args().get_option_keys();
  foreach(std::string opt, keys) {
    if (opt == "multi") {
      opts.get_scheduler_args().get_option("multi", multi);
    }  else {
      logstream(LOG_FATAL) << "Unexpected Scheduler Option: " << opt << std::endl;
    }
  }
}

// Initializes the internal datastructures
void fifo_scheduler::initialize_data_structures() {
  current_queue.resize(ncpus, 0);
  size_t nqueues = std::max(multi * current_queue.size(), size_t(1));
  queues.resize(nqueues);
  locks.resize(nqueues);
  vertex_is_scheduled.resize(num_vertices);
}

fifo_scheduler::fifo_scheduler(size_t num_vertices,
                               const graphlab_options& opts):
     multi(3), num_vertices(num_vertices) {
  ASSERT_GE(opts.get_ncpus(), 1);
  set_options(opts);
  initialize_data_structures();
}

void fifo_scheduler::set_num_vertices(const lvid_type numv) {
  num_vertices = numv;
  vertex_is_scheduled.resize(numv);
}

void fifo_scheduler::schedule(const lvid_type vid, double priority) {
  if (vid < num_vertices && !vertex_is_scheduled.set_bit(vid)) {
    /* "Randomize" the task queue task is put in. Note that we do
       not care if this counter is corrupted in race conditions
       Find first queue that is not locked and put task there (or
       after iteration limit) Choose two random queues and use the
       one which has smaller size */
    // M.D. Mitzenmacher The Power of Two Choices in Randomized
    // Load Balancing (1991)
    // http://www.eecs.harvard.edu/~michaelm/postscripts/mythesis.
    size_t idx = 0;
    if(queues.size() > 1) {
      const uint32_t prod =
          random::fast_uniform(uint32_t(0),
                               uint32_t(queues.size() * queues.size() - 1));
      const uint32_t r1 = prod / queues.size();
      const uint32_t r2 = prod % queues.size();
      idx = (queues[r1].size() < queues[r2].size()) ? r1 : r2;
    }
    locks[idx].lock(); queues[idx].push_back(vid); locks[idx].unlock();
  }
}

/** Get the next element in the queue */
sched_status::status_enum fifo_scheduler::get_next(const size_t cpuid,
                                                   lvid_type& ret_vid) {
  /* Check all of my queues for a task */
  // begin scanning from the machine's current queue
  size_t initial_idx = (current_queue[cpuid] % multi) + cpuid * multi;
  for(size_t i = 0; i < queues.size(); ++i) {
    const size_t idx = (initial_idx + i) % queues.size();
    // increment the current queue as long as I am scanning with in the
    // queues owned by this machine
    current_queue[cpuid] += (i < multi);

    // pick up the lock
    bool good = false;
    locks[idx].lock();
    while(!queues[idx].empty()) {
      // not empty, pop and verify
      ret_vid = queues[idx].front();
      queues[idx].pop_front();
      if (ret_vid < num_vertices) {
        good = vertex_is_scheduled.clear_bit(ret_vid);
        if (good) break;
      }
    }
    locks[idx].unlock();
    // managed to retrieve a task
    if(good) {
      return sched_status::NEW_TASK;
    }
  }
  return sched_status::EMPTY;
} // end of get_next_task

bool fifo_scheduler::empty() {
  for (size_t i = 0;i < queues.size(); ++i) {
    if (!queues[i].empty()) return false;
  }
  return true;
}

}