text:
function hivtrace_cluster_adjacency_list(obj) {

    var nodes = obj.Nodes,
        edges = obj.Edges;

    var adjacency_list = {};

    edges.forEach(function(e, i) {

        function in_nodes(n, id) {
            return n.id == id;
        }

        var seq_ids = e["sequences"];

        var n1 = nodes.filter(function(n) {
                return in_nodes(n, seq_ids[0])
            })[0],
            n2 = nodes.filter(function(n) {
                return in_nodes(n, seq_ids[1])
            })[0];

        adjacency_list[n1.id] ? adjacency_list[n1.id].push(n2) : adjacency_list[n1.id] = [n2];
        adjacency_list[n2.id] ? adjacency_list[n2.id].push(n1) : adjacency_list[n2.id] = [n1];

    });

    return adjacency_list;

}

function hivtrace_new_cluster_adjacency_list(obj) {

    var nodes = obj.Nodes,
        edges = obj.Edges;

    nodes.forEach (function (n) {
        n.neighbors = d3.set();
    });

    edges.forEach (function (e) {
        nodes[e.source].neighbors.add(e.target);
        nodes[e.target].neighbors.add(e.source);
    });

}

// Reconstructs path from floyd-warshall algorithm
function hivtrace_get_path(next, i, j) {

    var all_paths = [];
    var i = parseInt(i);
    var j = parseInt(j);

    for (var c = 0; c < next[i][j].length; c++) {

        var k = next[i][j][c];
        var intermediate = k;

        if (intermediate == null || intermediate == i) {
            return [
                [parseInt(i), parseInt(j)]
            ];
        } else {

            var paths_i_k = hivtrace_get_path(next, i, intermediate);
            var paths_k_j = hivtrace_get_path(next, intermediate, j);

            for (var i_k_index = 0; i_k_index < paths_i_k.length; i_k_index++) {
                var i_k = paths_i_k[i_k_index];
                for (var k_j_index = 0; k_j_index < paths_k_j.length; k_j_index++) {
                    var k_j = paths_k_j[k_j_index];
                    if (i_k.length) {
                        if ((i_k[0] == i) && (i_k[i_k.length - 1] == k) && (k_j[0] == k) && (k_j[k_j.length - 1] == j)) {
                            i_k.pop()
                            all_paths.push(i_k.concat(k_j));
                        }
                    }
                }
            }
        }
    }

    return all_paths;

}

function hivtrace_paths_with_node(node, next, i, j) {

    var paths = hivtrace_get_path(next, i, j);

    // Retrieve intermediary paths
    paths = paths.map(function(sublist) {
        return sublist.slice(1, -1)
    });

    if (!paths) {
        return 0;
    }

    var num_nodes = [];

    for (var i = 0; i < paths.length; i++) {
        sublist = paths[i];
        num_nodes.push(d3.sum(sublist.map(function(n) {
            return n == node;
        })));
    }

    var mean = d3.mean(num_nodes);

    if (mean == undefined) {
        mean = 0;
    }

    return mean;

}

// Same as compute shortest paths, but with an additional next parameter for reconstruction
function hivtrace_compute_shortest_paths_with_reconstruction(obj, subset, use_actual_distances) {

    // Floyd-Warshall implementation
    var distances = [];
    var next = [];
    var nodes = obj.Nodes;
    var edges = obj.Edges;
    var node_ids = [];

    var adjacency_list = datamonkey.hivtrace.cluster_adjacency_list(obj);

    if (!subset) {
        subset = Object.keys(adjacency_list);
    }

    var node_count = subset.length;

    for (var i = 0; i < subset.length; i++) {
        var a_node = subset[i];
        var empty_arr = _.range(node_count).map(function(d) {
            return null
        });
        var zeroes = _.range(node_count).map(function(d) {
            return null
        });
        distances.push(zeroes);
        next.push(empty_arr);
    };

    for (var index = 0; index < subset.length; index++) {
        var a_node = subset[index];
        for (var index2 = 0; index2 < subset.length; index2++) {
            var second_node = subset[index2];
            if (second_node != a_node) {
                if (adjacency_list[a_node].map(function(n) {
                        return n.id
                    }).indexOf(second_node) != -1) {
                    distances[index][index2] = 1;
                    distances[index2][index] = 1;
                }
            }
        }
    }

    for (var index_i = 0; index_i < subset.length; index_i++) {
        var n_i = subset[index_i];
        for (var index_j = 0; index_j < subset.length; index_j++) {
            var n_j = subset[index_j];
            if (index_i == index_j) {
                next[index_i][index_j] = [];
            } else {
                next[index_i][index_j] = [index_i];
            }
        }
    }

    // clone distances
    var distances2 = _.map(distances, _.clone);
    var c = 0;

    for (var index_k = 0; index_k < subset.length; index_k++) {
        var n_k = subset[index_k];
        for (var index_i = 0; index_i < subset.length; index_i++) {
            var n_i = subset[index_i];
            for (var index_j = 0; index_j < subset.length; index_j++) {
                var n_j = subset[index_j];

                if (n_i != n_j) {

                    d_ik = distances[index_k][index_i];
                    d_jk = distances[index_k][index_j];
                    d_ij = distances[index_i][index_j];

                    if (d_ik != null && d_jk != null) {
                        d_ik += d_jk;
                        if (d_ij == null || (d_ij > d_ik)) {
                            distances2[index_i][index_j] = d_ik;
                            distances2[index_j][index_i] = d_ik;
                            next[index_i][index_j] = [];
                            next[index_i][index_j] = next[index_i][index_j].concat(next[index_k][index_j]);
                            continue;
                        } else if (d_ij == d_ik) {
                            next[index_i][index_j] = next[index_i][index_j].concat(next[index_k][index_j]);
                        }
                    }
                    c++;
                    distances2[index_j][index_i] = distances[index_j][index_i];
                    distances2[index_i][index_j] = distances[index_i][index_j];
                }
            }
        }

        var t = distances2;
        distances2 = distances;
        distances = t;

    }

    return {
        'ordering': subset,
        'distances': distances,
        'next': next
    };

}

function hivtrace_filter_to_node_in_cluster(node, obj) {

    var nodes = obj.Nodes,
        edges = obj.Edges,
        cluster_id = null;

    // Retrieve nodes that are part of the cluster
    var node_obj = nodes.filter(function(n) {
        return node == n.id;
    });

    if (node_obj) {
        cluster_id = node_obj[0].cluster;
    } else {
        console.log('could not find node');
        return null;
    }

    // Filter out all edges and nodes that belong to the cluster
    var nodes_in_cluster = nodes.filter(function(n) {
        return cluster_id == n.cluster;
    });
    var node_ids = nodes_in_cluster.map(function(n) {
        return n.id
    });
    var edges_in_cluster = edges.filter(function(e) {
        return node_ids.indexOf(e.sequences[0]) != -1
    });

    var filtered_obj = {};
    filtered_obj["Nodes"] = nodes_in_cluster;
    filtered_obj["Edges"] = edges_in_cluster;
    return filtered_obj;

}

function hivtrace_compute_betweenness_centrality_all_nodes_in_cluster(cluster, obj, cb) {

    var nodes = obj.Nodes,
        edges = obj.Edges;

    var nodes_in_cluster = nodes.filter(function(n) {
        return cluster == n.cluster;
    });
    var node_ids = nodes_in_cluster.map(function(n) {
        return n.id
    });
    var edges_in_cluster = edges.filter(function(e) {
        return node_ids.indexOf(e.sequences[0]) != -1
    });

    var filtered_obj = {};
    filtered_obj["Nodes"] = nodes_in_cluster;
    filtered_obj["Edges"] = edges_in_cluster;

    // get length of cluster
    if (nodes_in_cluster.length > 70) {
        cb('cluster too large', null);
        return;
    }

    // get paths
    var paths = hivtrace_compute_shortest_paths_with_reconstruction(filtered_obj);
    var node_ids = nodes_in_cluster.map(function(n) {
        return n.id
    });

    var betweenness = {}
    nodes_in_cluster.forEach(function(n) {
        betweenness[n.id] = hivtrace_compute_betweenness_centrality(n.id, filtered_obj, paths);
    });

    cb(null, betweenness);
    return;

}

// Returns dictionary of nodes' betweenness centrality
// Utilizes the Floyd-Warshall Algorithm with reconstruction
function hivtrace_compute_betweenness_centrality(node, obj, paths) {

    if (!paths) {
        var filtered_obj = hivtrace_filter_to_node_in_cluster(node, obj)
        paths = hivtrace_compute_shortest_paths_with_reconstruction(filtered_obj);
    }

    // find index of id
    var index = paths['ordering'].indexOf(node);

    if (index == -1) {
        return null;
    }

    var length = paths['distances'].length;

    if (length != 2) {
        scale = 1 / ((length - 1) * (length - 2));
    } else {
        scale = 1;
    }

    // If s->t goes through 1, add to sum
    // Reconstruct each shortest path and check if node is in it
    var paths_with_node = [];
    for (i in _.range(length)) {
        for (j in _.range(length)) {
            paths_with_node.push(hivtrace_paths_with_node(index, paths['next'], i, j));
        }
    }

    return d3.sum(paths_with_node) * scale;

}

function hivtrace_compute_node_degrees(obj) {

    var nodes = obj.Nodes,
        edges = obj.Edges;

    for (var n in nodes) {
        nodes[n].degree = 0;
    }

    for (var e in edges) {
        nodes[edges[e].source].degree++;
        nodes[edges[e].target].degree++;
    }

}

function hivtrace_get_node_by_id(id, obj) {
    return obj.Nodes.filter(function(n) {
        return id == n.id
    })[0] || undefined;
}

function hivtrace_compute_cluster_betweenness(obj, callback) {

    var nodes = obj.Nodes;

    function onlyUnique(value, index, self) {
        return self.indexOf(value) === index;
    }

    // Get all unique clusters
    var clusters = nodes.map(function(n) {
        return n.cluster
    });
    var unique_clusters = clusters.filter(onlyUnique);

    var cb_count = 0;

    function cb(err, results) {

        cb_count++;

        for (node in results) {
            hivtrace_get_node_by_id(node, obj)['betweenness'] = results[node];
        }

        if (cb_count >= unique_clusters.length) {
            callback('done');
        }

    }

    // Compute betweenness in parallel
    unique_clusters.forEach(function(cluster_id) {
        datamonkey.hivtrace.betweenness_centrality_all_nodes_in_cluster(cluster_id, obj, cb);
    });

    // once all settled callback

}

function hivtrace_is_contaminant(node) {
    return node.attributes.indexOf('problematic') != -1;
}

function hivtrace_convert_to_csv(obj, callback) {
    //Translate nodes to rows, and then use d3.format
    hivtrace_compute_node_degrees(obj);

    hivtrace_compute_cluster_betweenness(obj, function(err) {
        var node_array = obj.Nodes.map(function(d) {
            return [d.id, d.cluster, d.degree, d.betweenness, hivtrace_is_contaminant(d), d.attributes.join(';')]
        });
        node_array.unshift(['seqid', 'cluster', 'degree', 'betweenness', 'is_contaminant', 'attributes'])
        node_csv = d3.csv.format(node_array);
        callback(null, node_csv);
    });
}

function hivtrace_export_csv_button(graph, tag) {

    var data = hivtrace_convert_to_csv(graph, function(err, data) {
        if (data != null) {
            var pom = document.createElement('a');
            pom.setAttribute('href', 'data:text/csv;charset=utf-8,' + encodeURIComponent(data));
            pom.setAttribute('download', 'export.csv');
            pom.className = 'btn btn-default btn-sm';
            pom.innerHTML = ' Export Results';
            $(tag).append(pom);
        }
    });

}

function hiv_trace_export_table_to_text(parent_id, table_id, sep) {

    var the_button = d3.select(parent_id).append("a")
        .attr("target", "_blank")
        .on("click", function(data, element) {
            var table_tag = d3.select(this).attr("data-table");
            var table_text = datamonkey.helpers.table_to_text(table_tag);
            datamonkey.helpers.export_handler(table_text, table_tag.substring(1) + ".tsv", "text/tab-separated-values");
        })
        .attr("data-table", table_id);

    the_button.append("i").classed("fa fa-download fa-2x", true);
    return the_button;

}

hivtrace_compute_local_clustering_coefficients = _.once (function (obj) {

  datamonkey.hivtrace.new_cluster_adjacency_list(obj);

  var nodes = obj.Nodes;

  nodes.forEach (function (n) {

    var a_node = n;
    var neighborhood_size = a_node.neighbors.size();

    if (neighborhood_size < 2) {
        a_node.lcc = undefined;
    } else {

        if (neighborhood_size > 500) {
            a_node.lcc = datamonkey.hivtrace.too_large;
        } else {
            // count triangles
            neighborhood = a_node.neighbors.values();
            counter = 0;
            for (n1 = 0; n1 < neighborhood_size; n1 += 1) {
                for (n2 = n1 + 1; n2 < neighborhood_size; n2 += 1) {
                    if (nodes [neighborhood[n1]].neighbors.has (neighborhood[n2])) {
                        counter ++;
                    }
                }
            }
            a_node.lcc = 2 * counter / neighborhood_size / (neighborhood_size - 1);
        }
    }

  });

});

function hivtrace_render_settings(settings, explanations) {
    // TODO:
    //d3.json (explanations, function (error, expl) {
    //    //console.log (settings);
    //});
}

function hivtrace_format_value(value, formatter) {

    if (typeof value === 'undefined') {
        return "Not computed";
    }
    if (value === datamonkey.hivtrace.undefined) {
        return "Undefined";
    }
    if (value === datamonkey.hivtrace.too_large) {
        return "Size limit";
    }

    if (value === datamonkey.hivtrace.processing) {
        return '';
    }

    return formatter ? formatter(value) : value;

}

if (typeof datamonkey == 'undefined') {
    datamonkey = function() {};
}

if (typeof datamonkey.hivtrace == 'undefined') {
    datamonkey.hivtrace = function() {};
}

datamonkey.hivtrace.compute_node_degrees = hivtrace_compute_node_degrees;
datamonkey.hivtrace.export_csv_button = hivtrace_export_csv_button;
datamonkey.hivtrace.convert_to_csv = hivtrace_convert_to_csv;
datamonkey.hivtrace.betweenness_centrality = hivtrace_compute_betweenness_centrality;
datamonkey.hivtrace.betweenness_centrality_all_nodes_in_cluster = hivtrace_compute_betweenness_centrality_all_nodes_in_cluster;
datamonkey.hivtrace.cluster_adjacency_list = hivtrace_cluster_adjacency_list;
datamonkey.hivtrace.new_cluster_adjacency_list = hivtrace_new_cluster_adjacency_list;
datamonkey.hivtrace.analysis_settings = hivtrace_render_settings;
datamonkey.hivtrace.export_table_to_text = hiv_trace_export_table_to_text;
datamonkey.hivtrace.compute_local_clustering = hivtrace_compute_local_clustering_coefficients;
datamonkey.hivtrace.undefined = new Object();
datamonkey.hivtrace.too_large = new Object();
datamonkey.hivtrace.processing = new Object();
datamonkey.hivtrace.format_value = hivtrace_format_value;


text:
require 'rltk/ast'

module Tempo
  module Nodes
    class Node < RLTK::ASTNode
    end

    class TemplateNode < Node
      child :statements, [Node]

      def to_s
        statements.map(&:to_s).join(' ')
      end
    end

    class IdNode < Node
    end

    class CallNode < IdNode
      value :ids, [String]

      def to_s
        if ids.size == 1
          "ID(#{ids.first})"
        else
          "PATH(#{ids.join(' ')})"
        end
      end
    end

    class DataNode < IdNode
      value :id, String

      def to_s
        "DATA(#{id})"
      end
    end

    class ContentNode < Node
      value :value, String

      def to_s
        "CONTENT(#{value.inspect})"
      end
    end

    class HashNode < Node
      value :pairs, Array

      def to_s
        contents = pairs.map do |(key, value)|
          "#{key}=#{value}"
        end.join(' ')

        "{#{contents}}"
      end
    end

    class PartialNode < Node
      value :name, String
      child :context_id, IdNode

      def to_s
        "PARTIAL(#{name} #{context_id})"
      end
    end

    class StringNode < Node
      value :value, String

      def to_s
        "STRING(#{value.inspect})"
      end
    end

    class NumberNode < Node
      value :value, String

      def to_s
        "NUMBER(#{value})"
      end
    end

    class BooleanNode < Node
      value :value, String

      def to_s
        "BOOLEAN(#{value})"
      end
    end

    class CommentNode < Node
      value :comment, String

      def to_s
        "COMMENT(#{comment.inspect})"
      end
    end

    class ExpressionNode < Node
      child :path, IdNode
      child :params, [Node]
      child :hash, HashNode

      def to_s
        "EXPRESSION(#{path} [#{params.map(&:to_s).join(' ')}] #{hash})"
      end
    end

    class BlockExpressionNode < ExpressionNode
      child :template, TemplateNode
      child :inverse, TemplateNode

      def to_s
        "BLOCK(#{path} [#{params.map(&:to_s).join(' ')}] #{hash} TEMPLATE(#{template}) INVERSE(#{inverse}))"
      end
    end

    class UnescapedExpressionNode < ExpressionNode
      def to_s
        'UNESCAPED_' + super
      end
    end
  end
end

redpajama_set_name: RedPajamaGithub


text:
<!DOCTYPE html>

    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width initial-scale=1 user-scalable=no" />
    <title>SSR via Node.js by Sergey Bekrin</title>
    <meta property="og:locale" content="en_US" />
    <meta property="og:type" content="website" />
    <meta property="og:title" content="Server-side Rendering via Node.js" />
    <meta property="og:description" content="Presentation for Server-side Rendering via Node.js Tech Talk" />
    <meta property="og:url" content="https://sergeybekrin.github.io/talk-nodejs-ssr" />
    <meta property="og:site_name" content="Sergey Bekrin" />
    <meta name="twitter:card" content="summary" />
    <meta name="twitter:site" content="@sergeybekrin" />
    <meta name="twitter:title" content="Server-side Rendering via Node.js" />
    <meta name="twitter:description" content="Presentation for Server-side Rendering via Node.js Tech Talk">
    <link href="https://fonts.googleapis.com/css?family=Open+Sans+Condensed:300,700" rel="stylesheet" type="text/css">
    <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/prism/1.3.0/themes/prism-tomorrow.css">


text:
package me.kerker.ch3_5e;

import android.app.Activity;
import android.os.Bundle;

/**
 * Created by lololol on 18/Dec/14.
 */
public class main extends Activity{
    @Override
    protected void onCreate(Bundle saveInstanceState)
    {
        super.onCreate(saveInstanceState);
        setContentView(new myDraw(this));
    }
}


text:
const { run } = require("../../../utils/test-utils");

describe("Zero Config tests", () => {
  it("runs when no config is supplied but entry is present", async () => {
    const { exitCode, stderr, stdout } = await run(__dirname, []);

    expect(exitCode).toBe(0);
    expect(stderr).toBeFalsy();
    // Should be able to find the entry file
    expect(stdout).toContain("./src/index.js");
    // Should output at the default output dir and filename
    expect(stdout).toContain("main.js");
  });
});


text:
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Kuo-Hao Zeng</title>
    <link>https://kuohaozeng.github.io/</link>
    <description>Recent content on Kuo-Hao Zeng</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-us</language>

	<atom:link href="https://kuohaozeng.github.io/index.xml" rel="self" type="application/rss+xml" />

  </channel>
</rss>


text:
<?php

namespace Sitpac\FrontendBundle\Form;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;

class ServicioPaqVuelcType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder

            ->add('fechaVuelo', 'date', array('widget' => 'single_text', ));
    }

    public function setDefaultOptions(OptionsResolverInterface $resolver)
    {
        $resolver->setDefaults(array(
            'data_class' => 'Sitpac\FrontendBundle\Entity\ServicioPaqVuel'
        ));
    }

    public function getName()
    {
        return 'sitpac_frontendbundle_serviciopaqvuelctype';
    }
}


text:
#include <assert.h>
#include <stdlib.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdint.h>
#include <inttypes.h>
#include <errno.h>
#include <unistd.h>
#include <string.h>

#include "config.h"
#include "benchmark.h"

/* The ratio of the largest known output to input
 * e.g.: p_conv_f32 -> nr+nh-1 -> ratio 2
 */
static const size_t max_output = 3;

/* ifdef posix
 * this prototype is posix specific
 */

#if defined(HAVE_TIME_H)
#include <time.h>
#endif

#if defined(HAVE_E_LIB_H)
#include <e-lib.h>
#endif

/* Arrays */
#define MAX_OUTPUTS 1 /* Points to same memory */
#define MAX_INPUTS 3
#define MAX_PARAMS (MAX_OUTPUTS + MAX_INPUTS)

/* Output args point to same mem, input args point to same mem */
#ifdef __epiphany__
struct status {
    uint32_t done;
    uint32_t _pad1;
    uint32_t nbench;
    uint32_t _pad2;
};

struct result {
    char name[64];
    uint64_t ns;
    uint64_t size;
};

volatile struct status *epiphany_status = (struct status *) 0x8f200000;
struct result *epiphany_results = (struct result *) 0x8f300000;
#define MAX_ELEMS 512
int8_t RAW_MEM[MAX_PARAMS * MAX_ELEMS * sizeof(uintmax_t)];
#define bench_printf(...)
#else

#define bench_printf printf
/* We don't want to be memory bound. So fit inside last-level cache (assume
 * 512kb). This might need tweaking, e.g., for x86_64 data will likely fit in
 * L1$ whereas on ARM (Cortex A9) probably not. */
#define MAX_ELEMS 16384
#endif

#if defined(HAVE_CLOCK_GETTIME)
static uint64_t platform_clock(void)
{
    struct timespec ts;
    uint64_t nanosec;

    clock_gettime(CLOCK_THREAD_CPUTIME_ID, &ts);
    nanosec = (uint64_t) ts.tv_sec * 1000000000UL + (uint64_t) ts.tv_nsec;

    return nanosec;
}
#elif defined(HAVE_MACH_TIME)
#include <mach/mach_time.h>
static uint64_t platform_clock(void)
{
    static mach_timebase_info_data_t tb_info = {
        .numer = 0,
        .denom = 0,
    };
    uint64_t abs_time, nanosec;

    abs_time = mach_absolute_time();
    if (tb_info.denom == 0) {
        (void) mach_timebase_info(&tb_info);
    }
    nanosec = abs_time;
    nanosec /= tb_info.denom;
    nanosec *= tb_info.numer;

    return nanosec;
}
#elif defined(HAVE_E_LIB_H)
static uint64_t platform_clock(void)
{
    // Assuming 600MHz clock 10^9 / (600 * 10^6)
    const float factor = 1.6666666666666666666f;

    static uint64_t clock = 0;
    uint64_t diff, nanosec;

    static bool initialized = false;

    if (!initialized) {
        e_ctimer_stop(E_CTIMER_0);
        e_ctimer_set(E_CTIMER_0, E_CTIMER_MAX);
        e_ctimer_start(E_CTIMER_0, E_CTIMER_CLK);
        initialized = true;
        return 0;
    }

    /* Clock will drift here */
    diff = E_CTIMER_MAX - e_ctimer_get(E_CTIMER_0);

    e_ctimer_stop(E_CTIMER_0);
    e_ctimer_set(E_CTIMER_0, E_CTIMER_MAX);
    e_ctimer_start(E_CTIMER_0, E_CTIMER_CLK);

    clock += diff;

    nanosec = (uint64_t) ((float) clock * factor);

    return nanosec;
}
#else
#error "No timing function"
#endif

static void platform_print_duration(uint64_t start,
                                    uint64_t end)
{
    if (end < start)
        bench_printf("%" PRIu64, 0xffffffffffffffffUL);
    else
        bench_printf("%" PRIu64, end - start);
}

/* end of platform specific section */

struct item_data
{
    uint64_t start;
    uint64_t end;
};

static void item_preface(struct item_data *, const struct p_bench_item *);
static void item_done(struct item_data *, const struct p_bench_specification *,
                      const char *);
static void setup_memory(struct p_bench_raw_memory *, char **raw, size_t);

#ifndef __epiphany__

struct item_data item_bench(const struct p_bench_item *item,
                            struct p_bench_specification *spec)
{
    struct item_data data, best = { .end = ~(0ULL) };
    uint64_t item_start_time = platform_clock();

    /* Warm up caches, branch predictors etc. */
    /* Calculate inner loop. */
    int inner_loop;
    data.start = platform_clock();
    for (int i = 0; i < 50; i++)
        item->benchmark(spec);
    data.end = platform_clock();

    {
        float tmp = data.end - data.start;
        tmp /= 50.0f;
        /* 50k us seems to work */
        tmp = 50000.0f / tmp;
        inner_loop = ceilf(tmp);
    }

    /* Repeat tests to get more stable results between runs */
    while (true) {
        /* Measure 10 iterations so the clocksource's resolution doesn't
         * play tricks on us */
        data.start = platform_clock();
        for (int j = 0; j < inner_loop; j++)
            item->benchmark(spec);
        data.end = platform_clock();

        /* Use best measurement */
        if (best.end - best.start > data.end - data.start)
            best = data;

        /* Test each function for 1/2 second */
        if (data.end - item_start_time >= 500000000ULL)
            break;
    }
    {
        /* Adjust for iterations in inner loop above */
        float tmp = best.end - best.start;
        tmp /= (float) inner_loop;
        best.end = best.start + tmp;
    }
    return best;
}

int main(void)
{
    struct p_bench_specification spec = { 0 };
    char *raw_mem = NULL;
    spec.current_size = MAX_ELEMS;

    setup_memory(&spec.mem, &raw_mem, spec.current_size);
    bench_printf(";name, size, duration (ns)\n");
    for (const struct p_bench_item *item = benchmark_items; item->name != NULL;
         ++item) {
        struct item_data best;
        bool consistent = false;

        best = item_bench(item, &spec);
        for (int tries = 0; tries < 50; tries++) {
            struct item_data snd;
            float fst_time, snd_time;

            /* Benchmark again ... */
            snd = item_bench(item, &spec);

            fst_time = best.end - best.start;
            snd_time = snd.end - snd.start;

            /* ... and start over if results deviate too much */
            if (fst_time / snd_time < 0.995 || snd_time / fst_time < 0.995) {
                /* Take average so abnormally low results converge over time */
                best.end += (snd_time - fst_time) / 2.0f;
                usleep(100000);

                continue;
            }

            if (fst_time > snd_time)
                best = snd;

            consistent = true;
            break;
        }
        if (!consistent) {
            fprintf(stderr, ";WARNING: %s not consistent\n", item->name);
            fflush(stderr);
        }
        item_done(&best, &spec, item->name);
    }
    return EXIT_SUCCESS;
}
#else /* __epiphany__ */
int main(void)
{
    struct p_bench_specification spec = { 0 };
    char *raw_mem = NULL;
    spec.current_size = MAX_ELEMS;
    uint32_t nbench = 0;

    setup_memory(&spec.mem, &raw_mem, spec.current_size);
    bench_printf(";name, size, duration (ns)\n");
    for (const struct p_bench_item *item = benchmark_items; item->name != NULL;
         ++item) {
        struct item_data data;

        data.start = platform_clock();
        item->benchmark(&spec);
        data.end = platform_clock();

        strcpy(epiphany_results[nbench].name, item->name);
        epiphany_results[nbench].ns = data.end - data.start;
        epiphany_results[nbench].size = (uint64_t) spec.current_size;
        nbench++;
        epiphany_status->nbench = nbench;
    }
    epiphany_status->done = 1;
    return EXIT_SUCCESS;
}
#endif

static void setup_output_pointers(struct p_bench_raw_memory *mem, void *p)
{
    /* Assume largest type is 64 bits */

    /* TODO: All pointers point to same memory region so output will be bogus */
    mem->o1.p_u64 = p;
    mem->o2.p_u64 = p;
    mem->o3.p_u64 = p;
    mem->o4.p_u64 = p;
}

static void setup_prandom_chars(char *p, size_t size, unsigned r,
                                bool skip_zero)
{
    /* It is probably not necessary, but this way the same prandom values
     * are used everytime, everywhere
     */

    while (size > 0) {
        r = 7559 * r + 5;
        /* not the best prng method in the universe, but good enough */

        if (skip_zero && ((char)r) == 0) {
            continue;
        }
        *p = (char)r;
        ++p;
        --size;
    }
}

static void setup_input_pointers(struct p_bench_raw_memory *mem, char *p,
                                 size_t size)
{
    unsigned seed = 0;

    /* Assume uint64_t is largest type */

    setup_prandom_chars(p, size * sizeof(uint64_t), seed, false);
    mem->i1_w.p_void = p;
    p += size * sizeof(uint64_t);

    setup_prandom_chars(p, size * sizeof(uint64_t), seed, false);
    mem->i2_w.p_void = p;
    p += size * sizeof(uint64_t);

    setup_prandom_chars(p, size * sizeof(uint64_t), seed, false);
    mem->i3_w.p_void = p;
    p += size * sizeof(uint64_t);

#if 0
    /* TODO: Do we really need 4 inputs? */
    setup_prandom_chars(p, size * sizeof(uint64_t), seed, false);
    mem->i4_w.p_void = p;
    p += size * sizeof(uint64_t);
#endif
}

static void setup_memory(struct p_bench_raw_memory *mem, char **raw,
                         size_t size)
{
    assert(mem != NULL);
    assert(size > 0);
    assert(raw != NULL);

    size_t raw_output_size = MAX_OUTPUTS * MAX_ELEMS * sizeof(uintmax_t);
    size_t raw_size =
        raw_output_size + MAX_INPUTS * MAX_ELEMS * (sizeof(uintmax_t));

#ifdef __epiphany__
    *raw = RAW_MEM;
#else
    if (*raw == NULL) {
        *raw = malloc(raw_size);
    } else {
        *raw = realloc(*raw, raw_size);
    }
    if (*raw == NULL) {
        (void)fprintf(stderr, "Unable to allocate memory: %zu\n", size);
        exit(EXIT_FAILURE);
    }
#endif

    setup_output_pointers(mem, *raw);
    setup_input_pointers(mem, *raw + raw_output_size, size);
}

static void item_preface(struct item_data *data,
                         const struct p_bench_item *item)
{
    data->start = platform_clock();
}

static void item_done(struct item_data *data,
                      const struct p_bench_specification *spec,
                      const char *name)
{
    assert(name != NULL);
    assert(name[0] != 0);

    bench_printf("%s, %" PRIu64 ", ", name, (uint64_t) spec->current_size);
    platform_print_duration(data->start, data->end);
    bench_printf("\n");
}


text:
<?php

namespace mageekguy\atoum;

interface observable
{
	public function callObservers($event);
}


text:
from swgpy.object import *

def create(kernel):
	result = Tangible()

	result.template = "object/tangible/medicine/crafted/shared_medpack_enhance_poison_a.iff"
	result.attribute_template_id = 7
	result.stfName("medicine_name","medpack_enhance_poison_a")

	#### BEGIN MODIFICATIONS ####
	####  END MODIFICATIONS  ####

	return result


text:
using Aspose.Email.Mapi;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

/* This project uses Automatic Package Restore feature of NuGet to resolve Aspose.Email for .NET
   API reference when the project is build. Please check https://Docs.nuget.org/consume/nuget-faq
   for more information. If you do not wish to use NuGet, you can manually download
   Aspose.Email for .NET API from https://www.nuget.org/packages/Aspose.Email/,
   install it and then add its reference to this project. For any issues, questions or suggestions
   please feel free to contact us using https://forum.aspose.com/c/email
*/

namespace Aspose.Email.Examples.CSharp.Email.Outlook
{
    class SetDailyOccurrenceCount
    {
        public static void Run()
        {
            string dataDir = RunExamples.GetDataDir_Outlook();

            DateTime StartDate = new DateTime(2015, 7, 16);
            DateTime endByDate = new DateTime(2015, 8, 1);
            DateTime DueDate = new DateTime(2015, 7, 16);
            MapiTask task = new MapiTask("This is test task", "Sample Body", StartDate, DueDate);
            task.State = MapiTaskState.NotAssigned;

            // ExStart:SetDailyOccurrenceCount
            // Set the Daily recurrence
            var record = new MapiCalendarDailyRecurrencePattern
            {
                PatternType = MapiCalendarRecurrencePatternType.Day,
                Period = 1,
                WeekStartDay = DayOfWeek.Sunday,
                EndType = MapiCalendarRecurrenceEndType.EndAfterNOccurrences,
                OccurrenceCount = 5,
            };
            task.Recurrence = record;
            // ExEnd:SetDailyOccurrenceCount

            task.Save(dataDir + "SetDailyOccurrenceCount_out.msg", TaskSaveFormat.Msg);
        }
    }
}


text:
Vagrant setup
=============

Requirements
------------

- `Vagrant <http://www.vagrantup.com/>`_ 1.9 or higher has to be installed
- a supported hypervisor:
    - kvm/qemu (libvirt required, vagrant-libvirt plugin required)
    - `Virtualbox <https://www.virtualbox.org/>`_

Vagrant setup
-------------

.. code-block:: console

    (venv)$ export VM_ENV=dev
    (venv)$ export VM_ENV=allinone_dev
    (venv)$ export VM_ENV=prod
    (venv)$ export VM_ENV=allinone_prod  # (default)

Simply run in the `Vagrantfile` directory:

.. code-block:: console

    (venv)$ vagrant up (--provider=libvirt)

Vagrant will launch one/many VM(s).

.. note:: The basebox used in this project is provided by Quarkslab. The code source to build it is `here <https://github.com/quarkslab/debian>`_.

Useful commands
```````````````

Some useful commands with vagrant:

.. code-block:: console

    $ vagrant ssh <server_name>       # login through ssh
    $ vagrant halt <server_name>      # shutdown the machine
    $ vagrant reload <server_name>    # restart the machine
    $ vagrant up <server_name>        # start the machine
    $ vagrant destroy <server_name>   # delete the machine


text:
package com.amee.platform.search;

import org.apache.lucene.index.Term;
import org.apache.lucene.search.TermQuery;

import java.beans.PropertyEditorSupport;

public class TermQueryEditor extends PropertyEditorSupport {

    private String field;

    public TermQueryEditor(String field) {
        this.setField(field);
    }

    @Override
    public void setAsText(String text) {
        if (text != null) {
            setValue(new TermQuery(new Term(getField(), text)));
        } else {
            setValue(null);
        }
    }

    public String getField() {
        return field;
    }

    public void setField(String field) {
        this.field = field;
    }
}


text:
/**
 * SECTION:gstplayer-mediainfo
 * @title: GstPlayerMediaInfo
 * @short_description: Player Media Information
 *
 */

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include "gstplayer-media-info.h"
#include "gstplayer-media-info-private.h"

/* Per-stream information */
G_DEFINE_ABSTRACT_TYPE (GstPlayerStreamInfo, gst_player_stream_info,
    G_TYPE_OBJECT);

static void
gst_player_stream_info_init (GstPlayerStreamInfo * sinfo)
{
  sinfo->stream_index = -1;
}

static void
gst_player_stream_info_finalize (GObject * object)
{
  GstPlayerStreamInfo *sinfo = GST_PLAYER_STREAM_INFO (object);

  g_free (sinfo->codec);
  g_free (sinfo->stream_id);

  if (sinfo->caps)
    gst_caps_unref (sinfo->caps);

  if (sinfo->tags)
    gst_tag_list_unref (sinfo->tags);

  G_OBJECT_CLASS (gst_player_stream_info_parent_class)->finalize (object);
}

static void
gst_player_stream_info_class_init (GstPlayerStreamInfoClass * klass)
{
  GObjectClass *gobject_class = (GObjectClass *) klass;

  gobject_class->finalize = gst_player_stream_info_finalize;
}

/**
 * gst_player_stream_info_get_index:
 * @info: a #GstPlayerStreamInfo
 *
 * Function to get stream index from #GstPlayerStreamInfo instance.
 *
 * Returns: the stream index of this stream.
 */
gint
gst_player_stream_info_get_index (const GstPlayerStreamInfo * info)
{
  g_return_val_if_fail (GST_IS_PLAYER_STREAM_INFO (info), -1);

  return info->stream_index;
}

/**
 * gst_player_stream_info_get_stream_type:
 * @info: a #GstPlayerStreamInfo
 *
 * Function to return human readable name for the stream type
 * of the given @info (ex: "audio", "video", "subtitle")
 *
 * Returns: a human readable name
 */
const gchar *
gst_player_stream_info_get_stream_type (const GstPlayerStreamInfo * info)
{
  g_return_val_if_fail (GST_IS_PLAYER_STREAM_INFO (info), NULL);

  if (GST_IS_PLAYER_VIDEO_INFO (info))
    return "video";
  else if (GST_IS_PLAYER_AUDIO_INFO (info))
    return "audio";
  else
    return "subtitle";
}

/**
 * gst_player_stream_info_get_tags:
 * @info: a #GstPlayerStreamInfo
 *
 * Returns: (transfer none): the tags contained in this stream.
 */
GstTagList *
gst_player_stream_info_get_tags (const GstPlayerStreamInfo * info)
{
  g_return_val_if_fail (GST_IS_PLAYER_STREAM_INFO (info), NULL);

  return info->tags;
}

/**
 * gst_player_stream_info_get_codec:
 * @info: a #GstPlayerStreamInfo
 *
 * A string describing codec used in #GstPlayerStreamInfo.
 *
 * Returns: codec string or NULL on unknown.
 */
const gchar *
gst_player_stream_info_get_codec (const GstPlayerStreamInfo * info)
{
  g_return_val_if_fail (GST_IS_PLAYER_STREAM_INFO (info), NULL);

  return info->codec;
}

/**
 * gst_player_stream_info_get_caps:
 * @info: a #GstPlayerStreamInfo
 *
 * Returns: (transfer none): the #GstCaps of the stream.
 */
GstCaps *
gst_player_stream_info_get_caps (const GstPlayerStreamInfo * info)
{
  g_return_val_if_fail (GST_IS_PLAYER_STREAM_INFO (info), NULL);

  return info->caps;
}

/* Video information */
G_DEFINE_TYPE (GstPlayerVideoInfo, gst_player_video_info,
    GST_TYPE_PLAYER_STREAM_INFO);

static void
gst_player_video_info_init (GstPlayerVideoInfo * info)
{
  info->width = -1;
  info->height = -1;
  info->framerate_num = 0;
  info->framerate_denom = 1;
  info->par_num = 1;
  info->par_denom = 1;
}

static void
gst_player_video_info_class_init (G_GNUC_UNUSED GstPlayerVideoInfoClass * klass)
{
  /* nothing to do here */
}

/**
 * gst_player_video_info_get_width:
 * @info: a #GstPlayerVideoInfo
 *
 * Returns: the width of video in #GstPlayerVideoInfo.
 */
gint
gst_player_video_info_get_width (const GstPlayerVideoInfo * info)
{
  g_return_val_if_fail (GST_IS_PLAYER_VIDEO_INFO (info), -1);

  return info->width;
}

/**
 * gst_player_video_info_get_height:
 * @info: a #GstPlayerVideoInfo
 *
 * Returns: the height of video in #GstPlayerVideoInfo.
 */
gint
gst_player_video_info_get_height (const GstPlayerVideoInfo * info)
{
  g_return_val_if_fail (GST_IS_PLAYER_VIDEO_INFO (info), -1);

  return info->height;
}

/**
 * gst_player_video_info_get_framerate:
 * @info: a #GstPlayerVideoInfo
 * @fps_n: (out): Numerator of frame rate
 * @fps_d: (out): Denominator of frame rate
 *
 */
void
gst_player_video_info_get_framerate (const GstPlayerVideoInfo * info,
    gint * fps_n, gint * fps_d)
{
  g_return_if_fail (GST_IS_PLAYER_VIDEO_INFO (info));

  *fps_n = info->framerate_num;
  *fps_d = info->framerate_denom;
}

/**
 * gst_player_video_info_get_pixel_aspect_ratio:
 * @info: a #GstPlayerVideoInfo
 * @par_n: (out): numerator
 * @par_d: (out): denominator
 *
 * Returns the pixel aspect ratio in @par_n and @par_d
 *
 */
void
gst_player_video_info_get_pixel_aspect_ratio (const GstPlayerVideoInfo * info,
    guint * par_n, guint * par_d)
{
  g_return_if_fail (GST_IS_PLAYER_VIDEO_INFO (info));

  *par_n = info->par_num;
  *par_d = info->par_denom;
}

/**
 * gst_player_video_info_get_bitrate:
 * @info: a #GstPlayerVideoInfo
 *
 * Returns: the current bitrate of video in #GstPlayerVideoInfo.
 */
gint
gst_player_video_info_get_bitrate (const GstPlayerVideoInfo * info)
{
  g_return_val_if_fail (GST_IS_PLAYER_VIDEO_INFO (info), -1);

  return info->bitrate;
}

/**
 * gst_player_video_info_get_max_bitrate:
 * @info: a #GstPlayerVideoInfo
 *
 * Returns: the maximum bitrate of video in #GstPlayerVideoInfo.
 */
gint
gst_player_video_info_get_max_bitrate (const GstPlayerVideoInfo * info)
{
  g_return_val_if_fail (GST_IS_PLAYER_VIDEO_INFO (info), -1);

  return info->max_bitrate;
}

/* Audio information */
G_DEFINE_TYPE (GstPlayerAudioInfo, gst_player_audio_info,
    GST_TYPE_PLAYER_STREAM_INFO);

static void
gst_player_audio_info_init (GstPlayerAudioInfo * info)
{
  info->channels = 0;
  info->sample_rate = 0;
  info->bitrate = -1;
  info->max_bitrate = -1;
}

static void
gst_player_audio_info_finalize (GObject * object)
{
  GstPlayerAudioInfo *info = GST_PLAYER_AUDIO_INFO (object);

  g_free (info->language);

  G_OBJECT_CLASS (gst_player_audio_info_parent_class)->finalize (object);
}

static void
gst_player_audio_info_class_init (GstPlayerAudioInfoClass * klass)
{
  GObjectClass *gobject_class = (GObjectClass *) klass;

  gobject_class->finalize = gst_player_audio_info_finalize;
}

/**
 * gst_player_audio_info_get_language:
 * @info: a #GstPlayerAudioInfo
 *
 * Returns: the language of the stream, or NULL if unknown.
 */
const gchar *
gst_player_audio_info_get_language (const GstPlayerAudioInfo * info)
{
  g_return_val_if_fail (GST_IS_PLAYER_AUDIO_INFO (info), NULL);

  return info->language;
}

/**
 * gst_player_audio_info_get_channels:
 * @info: a #GstPlayerAudioInfo
 *
 * Returns: the number of audio channels in #GstPlayerAudioInfo.
 */
gint
gst_player_audio_info_get_channels (const GstPlayerAudioInfo * info)
{
  g_return_val_if_fail (GST_IS_PLAYER_AUDIO_INFO (info), 0);

  return info->channels;
}

/**
 * gst_player_audio_info_get_sample_rate:
 * @info: a #GstPlayerAudioInfo
 *
 * Returns: the audio sample rate in #GstPlayerAudioInfo.
 */
gint
gst_player_audio_info_get_sample_rate (const GstPlayerAudioInfo * info)
{
  g_return_val_if_fail (GST_IS_PLAYER_AUDIO_INFO (info), 0);

  return info->sample_rate;
}

/**
 * gst_player_audio_info_get_bitrate:
 * @info: a #GstPlayerAudioInfo
 *
 * Returns: the audio bitrate in #GstPlayerAudioInfo.
 */
gint
gst_player_audio_info_get_bitrate (const GstPlayerAudioInfo * info)
{
  g_return_val_if_fail (GST_IS_PLAYER_AUDIO_INFO (info), -1);

  return info->bitrate;
}

/**
 * gst_player_audio_info_get_max_bitrate:
 * @info: a #GstPlayerAudioInfo
 *
 * Returns: the audio maximum bitrate in #GstPlayerAudioInfo.
 */
gint
gst_player_audio_info_get_max_bitrate (const GstPlayerAudioInfo * info)
{
  g_return_val_if_fail (GST_IS_PLAYER_AUDIO_INFO (info), -1);

  return info->max_bitrate;
}

/* Subtitle information */
G_DEFINE_TYPE (GstPlayerSubtitleInfo, gst_player_subtitle_info,
    GST_TYPE_PLAYER_STREAM_INFO);

static void
gst_player_subtitle_info_init (G_GNUC_UNUSED GstPlayerSubtitleInfo * info)
{
  /* nothing to do */
}

static void
gst_player_subtitle_info_finalize (GObject * object)
{
  GstPlayerSubtitleInfo *info = GST_PLAYER_SUBTITLE_INFO (object);

  g_free (info->language);

  G_OBJECT_CLASS (gst_player_subtitle_info_parent_class)->finalize (object);
}

static void
gst_player_subtitle_info_class_init (GstPlayerSubtitleInfoClass * klass)
{
  GObjectClass *gobject_class = (GObjectClass *) klass;

  gobject_class->finalize = gst_player_subtitle_info_finalize;
}

/**
 * gst_player_subtitle_info_get_language:
 * @info: a #GstPlayerSubtitleInfo
 *
 * Returns: the language of the stream, or NULL if unknown.
 */
const gchar *
gst_player_subtitle_info_get_language (const GstPlayerSubtitleInfo * info)
{
  g_return_val_if_fail (GST_IS_PLAYER_SUBTITLE_INFO (info), NULL);

  return info->language;
}

/* Global media information */
G_DEFINE_TYPE (GstPlayerMediaInfo, gst_player_media_info, G_TYPE_OBJECT);

static void
gst_player_media_info_init (GstPlayerMediaInfo * info)
{
  info->duration = -1;
  info->is_live = FALSE;
  info->seekable = FALSE;
}

static void
gst_player_media_info_finalize (GObject * object)
{
  GstPlayerMediaInfo *info = GST_PLAYER_MEDIA_INFO (object);

  g_free (info->uri);

  if (info->tags)
    gst_tag_list_unref (info->tags);

  g_free (info->title);

  g_free (info->container);

  if (info->image_sample)
    gst_sample_unref (info->image_sample);

  if (info->audio_stream_list)
    g_list_free (info->audio_stream_list);

  if (info->video_stream_list)
    g_list_free (info->video_stream_list);

  if (info->subtitle_stream_list)
    g_list_free (info->subtitle_stream_list);

  if (info->stream_list)
    g_list_free_full (info->stream_list, g_object_unref);

  G_OBJECT_CLASS (gst_player_media_info_parent_class)->finalize (object);
}

static void
gst_player_media_info_class_init (GstPlayerMediaInfoClass * klass)
{
  GObjectClass *oclass = (GObjectClass *) klass;

  oclass->finalize = gst_player_media_info_finalize;
}

static GstPlayerVideoInfo *
gst_player_video_info_new (void)
{
  return g_object_new (GST_TYPE_PLAYER_VIDEO_INFO, NULL);
}

static GstPlayerAudioInfo *
gst_player_audio_info_new (void)
{
  return g_object_new (GST_TYPE_PLAYER_AUDIO_INFO, NULL);
}

static GstPlayerSubtitleInfo *
gst_player_subtitle_info_new (void)
{
  return g_object_new (GST_TYPE_PLAYER_SUBTITLE_INFO, NULL);
}

static GstPlayerStreamInfo *
gst_player_video_info_copy (GstPlayerVideoInfo * ref)
{
  GstPlayerVideoInfo *ret;

  ret = gst_player_video_info_new ();

  ret->width = ref->width;
  ret->height = ref->height;
  ret->framerate_num = ref->framerate_num;
  ret->framerate_denom = ref->framerate_denom;
  ret->par_num = ref->par_num;
  ret->par_denom = ref->par_denom;
  ret->bitrate = ref->bitrate;
  ret->max_bitrate = ref->max_bitrate;

  return (GstPlayerStreamInfo *) ret;
}

static GstPlayerStreamInfo *
gst_player_audio_info_copy (GstPlayerAudioInfo * ref)
{
  GstPlayerAudioInfo *ret;

  ret = gst_player_audio_info_new ();

  ret->sample_rate = ref->sample_rate;
  ret->channels = ref->channels;
  ret->bitrate = ref->bitrate;
  ret->max_bitrate = ref->max_bitrate;

  if (ref->language)
    ret->language = g_strdup (ref->language);

  return (GstPlayerStreamInfo *) ret;
}

static GstPlayerStreamInfo *
gst_player_subtitle_info_copy (GstPlayerSubtitleInfo * ref)
{
  GstPlayerSubtitleInfo *ret;

  ret = gst_player_subtitle_info_new ();
  if (ref->language)
    ret->language = g_strdup (ref->language);

  return (GstPlayerStreamInfo *) ret;
}

GstPlayerStreamInfo *
gst_player_stream_info_copy (GstPlayerStreamInfo * ref)
{
  GstPlayerStreamInfo *info = NULL;

  if (!ref)
    return NULL;

  if (GST_IS_PLAYER_VIDEO_INFO (ref))
    info = gst_player_video_info_copy ((GstPlayerVideoInfo *) ref);
  else if (GST_IS_PLAYER_AUDIO_INFO (ref))
    info = gst_player_audio_info_copy ((GstPlayerAudioInfo *) ref);
  else
    info = gst_player_subtitle_info_copy ((GstPlayerSubtitleInfo *) ref);

  info->stream_index = ref->stream_index;
  if (ref->tags)
    info->tags = gst_tag_list_ref (ref->tags);
  if (ref->caps)
    info->caps = gst_caps_copy (ref->caps);
  if (ref->codec)
    info->codec = g_strdup (ref->codec);
  if (ref->stream_id)
    info->stream_id = g_strdup (ref->stream_id);

  return info;
}

GstPlayerMediaInfo *
gst_player_media_info_copy (GstPlayerMediaInfo * ref)
{
  GList *l;
  GstPlayerMediaInfo *info;

  if (!ref)
    return NULL;

  info = gst_player_media_info_new (ref->uri);
  info->duration = ref->duration;
  info->seekable = ref->seekable;
  info->is_live = ref->is_live;
  if (ref->tags)
    info->tags = gst_tag_list_ref (ref->tags);
  if (ref->title)
    info->title = g_strdup (ref->title);
  if (ref->container)
    info->container = g_strdup (ref->container);
  if (ref->image_sample)
    info->image_sample = gst_sample_ref (ref->image_sample);

  for (l = ref->stream_list; l != NULL; l = l->next) {
    GstPlayerStreamInfo *s;

    s = gst_player_stream_info_copy ((GstPlayerStreamInfo *) l->data);
    info->stream_list = g_list_append (info->stream_list, s);

    if (GST_IS_PLAYER_AUDIO_INFO (s))
      info->audio_stream_list = g_list_append (info->audio_stream_list, s);
    else if (GST_IS_PLAYER_VIDEO_INFO (s))
      info->video_stream_list = g_list_append (info->video_stream_list, s);
    else
      info->subtitle_stream_list =
          g_list_append (info->subtitle_stream_list, s);
  }

  return info;
}

GstPlayerStreamInfo *
gst_player_stream_info_new (gint stream_index, GType type)
{
  GstPlayerStreamInfo *info = NULL;

  if (type == GST_TYPE_PLAYER_AUDIO_INFO)
    info = (GstPlayerStreamInfo *) gst_player_audio_info_new ();
  else if (type == GST_TYPE_PLAYER_VIDEO_INFO)
    info = (GstPlayerStreamInfo *) gst_player_video_info_new ();
  else
    info = (GstPlayerStreamInfo *) gst_player_subtitle_info_new ();

  info->stream_index = stream_index;

  return info;
}

GstPlayerMediaInfo *
gst_player_media_info_new (const gchar * uri)
{
  GstPlayerMediaInfo *info;

  g_return_val_if_fail (uri != NULL, NULL);

  info = g_object_new (GST_TYPE_PLAYER_MEDIA_INFO, NULL);
  info->uri = g_strdup (uri);

  return info;
}

/**
 * gst_player_media_info_get_uri:
 * @info: a #GstPlayerMediaInfo
 *
 * Returns: the URI associated with #GstPlayerMediaInfo.
 */
const gchar *
gst_player_media_info_get_uri (const GstPlayerMediaInfo * info)
{
  g_return_val_if_fail (GST_IS_PLAYER_MEDIA_INFO (info), NULL);

  return info->uri;
}

/**
 * gst_player_media_info_is_seekable:
 * @info: a #GstPlayerMediaInfo
 *
 * Returns: %TRUE if the media is seekable.
 */
gboolean
gst_player_media_info_is_seekable (const GstPlayerMediaInfo * info)
{
  g_return_val_if_fail (GST_IS_PLAYER_MEDIA_INFO (info), FALSE);

  return info->seekable;
}

/**
 * gst_player_media_info_is_live:
 * @info: a #GstPlayerMediaInfo
 *
 * Returns: %TRUE if the media is live.
 */
gboolean
gst_player_media_info_is_live (const GstPlayerMediaInfo * info)
{
  g_return_val_if_fail (GST_IS_PLAYER_MEDIA_INFO (info), FALSE);

  return info->is_live;
}

/**
 * gst_player_media_info_get_stream_list:
 * @info: a #GstPlayerMediaInfo
 *
 * Returns: (transfer none) (element-type GstPlayerStreamInfo): A #GList of
 * matching #GstPlayerStreamInfo.
 */
GList *
gst_player_media_info_get_stream_list (const GstPlayerMediaInfo * info)
{
  g_return_val_if_fail (GST_IS_PLAYER_MEDIA_INFO (info), NULL);

  return info->stream_list;
}

/**
 * gst_player_media_info_get_video_streams:
 * @info: a #GstPlayerMediaInfo
 *
 * Returns: (transfer none) (element-type GstPlayerVideoInfo): A #GList of
 * matching #GstPlayerVideoInfo.
 */
GList *
gst_player_media_info_get_video_streams (const GstPlayerMediaInfo * info)
{
  g_return_val_if_fail (GST_IS_PLAYER_MEDIA_INFO (info), NULL);

  return info->video_stream_list;
}

/**
 * gst_player_media_info_get_subtitle_streams:
 * @info: a #GstPlayerMediaInfo
 *
 * Returns: (transfer none) (element-type GstPlayerSubtitleInfo): A #GList of
 * matching #GstPlayerSubtitleInfo.
 */
GList *
gst_player_media_info_get_subtitle_streams (const GstPlayerMediaInfo * info)
{
  g_return_val_if_fail (GST_IS_PLAYER_MEDIA_INFO (info), NULL);

  return info->subtitle_stream_list;
}

/**
 * gst_player_media_info_get_audio_streams:
 * @info: a #GstPlayerMediaInfo
 *
 * Returns: (transfer none) (element-type GstPlayerAudioInfo): A #GList of
 * matching #GstPlayerAudioInfo.
 */
GList *
gst_player_media_info_get_audio_streams (const GstPlayerMediaInfo * info)
{
  g_return_val_if_fail (GST_IS_PLAYER_MEDIA_INFO (info), NULL);

  return info->audio_stream_list;
}

/**
 * gst_player_media_info_get_duration:
 * @info: a #GstPlayerMediaInfo
 *
 * Returns: duration of the media.
 */
GstClockTime
gst_player_media_info_get_duration (const GstPlayerMediaInfo * info)
{
  g_return_val_if_fail (GST_IS_PLAYER_MEDIA_INFO (info), -1);

  return info->duration;
}

/**
 * gst_player_media_info_get_tags:
 * @info: a #GstPlayerMediaInfo
 *
 * Returns: (transfer none): the tags contained in media info.
 */
GstTagList *
gst_player_media_info_get_tags (const GstPlayerMediaInfo * info)
{
  g_return_val_if_fail (GST_IS_PLAYER_MEDIA_INFO (info), NULL);

  return info->tags;
}

/**
 * gst_player_media_info_get_title:
 * @info: a #GstPlayerMediaInfo
 *
 * Returns: the media title.
 */
const gchar *
gst_player_media_info_get_title (const GstPlayerMediaInfo * info)
{
  g_return_val_if_fail (GST_IS_PLAYER_MEDIA_INFO (info), NULL);

  return info->title;
}

/**
 * gst_player_media_info_get_container_format:
 * @info: a #GstPlayerMediaInfo
 *
 * Returns: the container format.
 */
const gchar *
gst_player_media_info_get_container_format (const GstPlayerMediaInfo * info)
{
  g_return_val_if_fail (GST_IS_PLAYER_MEDIA_INFO (info), NULL);

  return info->container;
}

/**
 * gst_player_media_info_get_image_sample:
 * @info: a #GstPlayerMediaInfo
 *
 * Function to get the image (or preview-image) stored in taglist.
 * Application can use gst_sample_*_() API's to get caps, buffer etc.
 *
 * Returns: (transfer none): GstSample or NULL.
 */
GstSample *
gst_player_media_info_get_image_sample (const GstPlayerMediaInfo * info)
{
  g_return_val_if_fail (GST_IS_PLAYER_MEDIA_INFO (info), NULL);

  return info->image_sample;
}

/**
 * gst_player_media_info_get_number_of_streams:
 * @info: a #GstPlayerMediaInfo
 *
 * Returns: number of total streams.
 * Since: 1.12
 */
guint
gst_player_media_info_get_number_of_streams (const GstPlayerMediaInfo * info)
{
  g_return_val_if_fail (GST_IS_PLAYER_MEDIA_INFO (info), 0);

  return g_list_length (info->stream_list);
}

/**
 * gst_player_media_info_get_number_of_video_streams:
 * @info: a #GstPlayerMediaInfo
 *
 * Returns: number of video streams.
 * Since: 1.12
 */
guint
gst_player_media_info_get_number_of_video_streams (const GstPlayerMediaInfo *
    info)
{
  g_return_val_if_fail (GST_IS_PLAYER_MEDIA_INFO (info), 0);

  return g_list_length (info->video_stream_list);
}

/**
 * gst_player_media_info_get_number_of_audio_streams:
 * @info: a #GstPlayerMediaInfo
 *
 * Returns: number of audio streams.
 * Since: 1.12
 */
guint
gst_player_media_info_get_number_of_audio_streams (const GstPlayerMediaInfo *
    info)
{
  g_return_val_if_fail (GST_IS_PLAYER_MEDIA_INFO (info), 0);

  return g_list_length (info->audio_stream_list);
}

/**
 * gst_player_media_info_get_number_of_subtitle_streams:
 * @info: a #GstPlayerMediaInfo
 *
 * Returns: number of subtitle streams.
 * Since: 1.12
 */
guint gst_player_media_info_get_number_of_subtitle_streams
    (const GstPlayerMediaInfo * info)
{
  g_return_val_if_fail (GST_IS_PLAYER_MEDIA_INFO (info), 0);

  return g_list_length (info->subtitle_stream_list);
}

/**
 * gst_player_get_video_streams:
 * @info: a #GstPlayerMediaInfo
 *
 * Returns: (transfer none) (element-type GstPlayerVideoInfo): A #GList of
 * matching #GstPlayerVideoInfo.
 */
#ifndef GST_REMOVE_DEPRECATED
GList *
gst_player_get_video_streams (const GstPlayerMediaInfo * info)
{
  return gst_player_media_info_get_video_streams (info);
}
#endif

/**
 * gst_player_get_audio_streams:
 * @info: a #GstPlayerMediaInfo
 *
 * Returns: (transfer none) (element-type GstPlayerAudioInfo): A #GList of
 * matching #GstPlayerAudioInfo.
 */
#ifndef GST_REMOVE_DEPRECATED
GList *
gst_player_get_audio_streams (const GstPlayerMediaInfo * info)
{
  return gst_player_media_info_get_audio_streams (info);
}
#endif

/**
 * gst_player_get_subtitle_streams:
 * @info: a #GstPlayerMediaInfo
 *
 * Returns: (transfer none) (element-type GstPlayerSubtitleInfo): A #GList of
 * matching #GstPlayerSubtitleInfo.
 */
#ifndef GST_REMOVE_DEPRECATED
GList *
gst_player_get_subtitle_streams (const GstPlayerMediaInfo * info)
{
  return gst_player_media_info_get_subtitle_streams (info);
}
#endif


text:
package ca.barelabs.bareconnection;

import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;

public class MultiMap<K,V> {

	private Map<K, List<V>> mMap = new HashMap<K, List<V>>();
	private int mTotalItems;

	public Set<K> keySet() {
		return mMap.keySet();
	}

	public List<V> get(K key) {
		return mMap.containsKey(key) ? mMap.get(key) : new ArrayList<V>();
	}

	public boolean containsKey(Object key) {
		return mMap.containsKey(key);
	}

	public boolean containsValue(Object value) {
		for (Entry<K, List<V>> entry : mMap.entrySet()) {
			if (entry.getValue().contains(value)) {
				return true;
			}
		}
		return false;
	}

	public boolean containsEntry(Object key, Object value) {
		if (mMap.containsKey(key)) {
			List<V> values = mMap.get(key);
			return values.contains(value);
		}
		return false;
	}

	public boolean put(K key, V value) {
		List<V> values = mMap.get(key);
		if (values == null) {
			values = new ArrayList<V>();
			mMap.put(key, values);
		}
		mTotalItems++;
		return values.add(value);
	}

	public boolean putAll(K key, Collection<? extends V> valuesToAdd) {
		if (valuesToAdd == null) {
			return false;
		}
		List<V> values = mMap.get(key);
		if (values == null) {
			values = new ArrayList<V>();
			mMap.put(key, values);
		}
		mTotalItems += valuesToAdd.size();
		return values.addAll(valuesToAdd);
	}

	public boolean remove(Object key, Object value) {
		if (mMap.containsKey(key) && mMap.get(key).remove(value)) {
			mTotalItems--;
			return true;
		}
		return false;
	}

	public List<V> removeAll(Object key) {
		if (mMap.containsKey(key)) {
			List<V> values = mMap.remove(key);
			mTotalItems -= values.size();
			return values;
		}
		return new ArrayList<V>();
	}

	public List<V> replaceValues(K key, Collection<? extends V> valuesToAdd) {
		List<V> values = mMap.containsKey(key) ? mMap.remove(key) : new ArrayList<V>();
		mTotalItems -= values.size();
		putAll(key, valuesToAdd);
		return values;
	}

	public boolean isEmpty() {
		return size() == 0;
	}

	public int size() {
		return mTotalItems;
	}

	public void clear() {
		mMap.clear();
		mTotalItems = 0;
	}
}


text:
Event_Channel *
Connection_Handler::event_channel (void) const
{
  return this->event_channel_;
}

void
Connection_Handler::event_channel (Event_Channel *ec)
{
  this->event_channel_ = ec;
}

void
Connection_Handler::connection_id (CONNECTION_ID id)
{
  this->connection_id_ = id;
}

CONNECTION_ID
Connection_Handler::connection_id (void) const
{
  return this->connection_id_;
}

// The total number of bytes sent/received on this Proxy.

size_t
Connection_Handler::total_bytes (void) const
{
  return this->total_bytes_;
}

void
Connection_Handler::total_bytes (size_t bytes)
{
  this->total_bytes_ += bytes;
}

Connection_Handler::Connection_Handler (void)
{
}

Connection_Handler::Connection_Handler (const Connection_Config_Info &pci)
  : local_addr_ (pci.local_port_),
    connection_id_ (pci.connection_id_),
    total_bytes_ (0),
    state_ (Connection_Handler::IDLE),
    timeout_ (1),
    max_timeout_ (pci.max_retry_timeout_),
    event_channel_ (pci.event_channel_)
{
  if (ACE_OS::strlen (pci.host_) > 0)
    this->remote_addr_.set (pci.remote_port_, pci.host_);
  else
    this->remote_addr_.set (pci.remote_port_, ACE_DEFAULT_SERVER_HOST);
  // Set the priority of the Proxy.
  this->priority (int (pci.priority_));
}

// Set the connection_role.

void
Connection_Handler::connection_role (char d)
{
  this->connection_role_ = d;
}

// Get the connection_role.

char
Connection_Handler::connection_role (void) const
{
  return this->connection_role_;
}

// Sets the timeout delay.

void
Connection_Handler::timeout (long to)
{
  if (to > this->max_timeout_)
    to = this->max_timeout_;

  this->timeout_ = to;
}

// Re-calculate the current retry timeout delay using exponential
// backoff.  Returns the original timeout (i.e., before the
// re-calculation).

long
Connection_Handler::timeout (void)
{
  long old_timeout = this->timeout_;
  this->timeout_ *= 2;

  if (this->timeout_ > this->max_timeout_)
    this->timeout_ = this->max_timeout_;

  return old_timeout;
}

// Sets the max timeout delay.

void
Connection_Handler::max_timeout (long mto)
{
  this->max_timeout_ = mto;
}

// Gets the max timeout delay.

long
Connection_Handler::max_timeout (void) const
{
  return this->max_timeout_;
}

// Restart connection asynchronously when timeout occurs.

int
Connection_Handler::handle_timeout (const ACE_Time_Value &,
                                    const void *)
{
  ACE_DEBUG ((LM_DEBUG,
              "(%t) attempting to reconnect Connection_Handler %d with timeout = %d\n",
              this->connection_id (),
              this->timeout_));

  // Delegate the re-connection attempt to the Event Channel.
  this->event_channel_->initiate_connection_connection (this);

  return 0;
}

// Handle shutdown of the Connection_Handler object.

int
Connection_Handler::handle_close (ACE_HANDLE, ACE_Reactor_Mask)
{
  ACE_DEBUG ((LM_DEBUG,
              "(%t) shutting down %s Connection_Handler %d on handle %d\n",
              this->connection_role () == 'C' ? "Consumer" : "Supplier",
              this->connection_id (),
              this->get_handle ()));

  // Restart the connection, if possible.
  return this->event_channel_->reinitiate_connection_connection (this);
}

// Set the state of the Proxy.

void
Connection_Handler::state (Connection_Handler::State s)
{
  this->state_ = s;
}

// Return the current state of the Proxy.

Connection_Handler::State
Connection_Handler::state (void) const
{
  return this->state_;
}

// Upcall from the <ACE_Acceptor> or <ACE_Connector> that delegates
// control to our Connection_Handler.

int
Connection_Handler::open (void *)
{
  ACE_DEBUG ((LM_DEBUG, "(%t) %s Connection_Handler's handle = %d\n",
              this->connection_role () == 'C' ? "Consumer" : "Supplier",
              this->peer ().get_handle ()));

  // Call back to the <Event_Channel> to complete our initialization.
  if (this->event_channel_->complete_connection_connection (this) == -1)
    ACE_ERROR_RETURN ((LM_ERROR, "(%t) %p\n", "complete_connection_connection"), -1);

  // Turn on non-blocking I/O.
  else if (this->peer ().enable (ACE_NONBLOCK) == -1)
    ACE_ERROR_RETURN ((LM_ERROR, "(%t) %p\n", "enable"), -1);

  // Register ourselves to receive input events.
  else if (ACE_Reactor::instance ()->register_handler
      (this, ACE_Event_Handler::READ_MASK) == -1)
    ACE_ERROR_RETURN ((LM_ERROR, "(%t) %p\n", "register_handler"), -1);
  else
    return 0;
}

const ACE_INET_Addr &
Connection_Handler::remote_addr (void) const
{
  return this->remote_addr_;
}

void
Connection_Handler::remote_addr (ACE_INET_Addr &ra)
{
  this->remote_addr_ = ra;
}

const ACE_INET_Addr &
Connection_Handler::local_addr (void) const
{
  return this->local_addr_;
}

void
Connection_Handler::local_addr (ACE_INET_Addr &la)
{
  this->local_addr_ = la;
}

// Make the appropriate type of <Connection_Handler> (i.e.,
// <Consumer_Handler>, <Supplier_Handler>, <Thr_Consumer_Handler>, or
// <Thr_Supplier_Handler>).

Connection_Handler *
Connection_Handler_Factory::make_connection_handler (const Connection_Config_Info &pci)
{
  Connection_Handler *connection_handler = 0;

  // The next few lines of code are dependent on whether we are making
  // a threaded/reactive Supplier_Handler/Consumer_Handler.

  if (pci.connection_role_ == 'C') // Configure a Consumer_Handler.
    {
      // Create a threaded Consumer_Handler.
      if (ACE_BIT_ENABLED (Options::instance ()->threading_strategy (),
                           Options::OUTPUT_MT))
        ACE_NEW_RETURN (connection_handler,
                        Thr_Consumer_Handler (pci),
                        0);

      // Create a reactive Consumer_Handler.
      else
        ACE_NEW_RETURN (connection_handler,
                        Consumer_Handler (pci),
                        0);
    }
  else // connection_role == 'S', so configure a Supplier_Handler.
    {
      // Create a threaded Supplier_Handler.
      if (ACE_BIT_ENABLED (Options::instance ()->threading_strategy (),
                           Options::INPUT_MT))
        ACE_NEW_RETURN (connection_handler,
                        Thr_Supplier_Handler (pci),
                        0);

      // Create a reactive Supplier_Handler.
      else
        ACE_NEW_RETURN (connection_handler,
                        Supplier_Handler (pci),
                        0);
    }

  return connection_handler;
}


text:
package com.github.mjdev.libaums.fs;

import android.support.annotation.NonNull;

import java.io.IOException;
import java.io.OutputStream;
import java.nio.ByteBuffer;

/**
 * UsbFileOutputStream provides common OutputStream access to a UsbFile.
 */
public class UsbFileOutputStream extends OutputStream {

    private UsbFile file;
    private int currentByteOffset = 0;

    public UsbFileOutputStream(@NonNull UsbFile file) {

        if(file.isDirectory()) {
            throw new RuntimeException("UsbFileOutputStream cannot be created on directory!");
        }

        this.file = file;
    }

    @Override
    public void write(int oneByte) throws IOException {
        ByteBuffer byteBuffer = ByteBuffer.wrap(new byte[] {(byte) oneByte});
        file.write(currentByteOffset, byteBuffer);

        currentByteOffset++;
    }

    @Override
    public void close() throws IOException {
        file.close();
    }

    @Override
    public void flush() throws IOException {
        file.flush();
    }

    @Override
    public void write(byte[] buffer) throws IOException {
        ByteBuffer byteBuffer = ByteBuffer.wrap(buffer);
        file.write(currentByteOffset, byteBuffer);

        currentByteOffset += buffer.length;
    }

    @Override
    public void write(byte[] buffer, int offset, int count) throws IOException {
        ByteBuffer byteBuffer = ByteBuffer.wrap(buffer);

        byteBuffer.position(offset);
        byteBuffer.limit(count + offset);

        file.write(currentByteOffset, byteBuffer);

        currentByteOffset += count;
    }
}


text:
<?php

namespace AppBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;

class CategoryController extends Controller
{
    /**
     * @Route("/list")
     */
    public function listAction()
    {
        $qb = $this
            ->getDoctrine()
            ->getManager()
            ->createQueryBuilder();

        $qb
            ->select('c, p')
            ->from('AppBundle:Category', 'c')
            ->leftJoin('c.products', 'p');

        $categories = $qb
            ->getQuery()
            ->getResult();

        return $this->render('Category/list.html.twig', [
            'categories' => $categories,
        ]);
    }

}


text:
enum Races {Human = 0, Dwarf, Elf, Gnome, HalfElf, Halfling, MaxRaces};

class Race : public QObject
{
    Q_OBJECT
public:
    explicit Race(QObject *parent = 0);
    ~Race();

    Races race() const;
    void setRace(const Races &race);

signals:

public slots:

private:
    Races _race;
};

#endif // RACE_H


text:
'use strict';

// user-model.js - A sequelize model
//
// See http://docs.sequelizejs.com/en/latest/docs/models-definition/
// for more of what you can do here.

const Sequelize = require('sequelize');

module.exports = function(sequelize)
{
	let app = this;
	const user = sequelize.define('users',
	{	//Attributes
		/*id:
		{
			type: Sequelize.INTEGER.UNSIGNED,
			allowNull: false,
			autoIncrement: true,
			primaryKey: true
		},*/
	login:
		{
			type: Sequelize.STRING,
			allowNull: false,
			unique: true
		},
	email:
		{
			type: Sequelize.STRING,
			allowNull: false,
			unique: true
		},
	password:
		{
			type: Sequelize.STRING,
			allowNull: false
		}
	},
	{	//OptionsOrtello, 27.05, CC -> Entweder Oder explodiert

		freezeTableName: true
	});

	/*Nelor: Neither app.configure() nor setup() worked to make connections between models possible. the user service is calling this model with the feathers app as its context using the prototype.call() method,making other services and their models available. izs then reassigned to const app.
	Just call app.services([name of the service you rely on]).Model to connect with the model, creating the necessary tables. Hoepfully its not a problem that the first table here is already synced.
	This means the creation of the second table will always have to trigger all setting of indexes on all tables. I believe that for no constructions access to other tables is actually necessary, but I might e wrong on that now... check later.
	The constraints cant be applied in setup(), because sync() is called on the end of the models creation, meaning when feathers is setting up the service and calling setup, sync() already ran. So it has to be done here, lates point before sync.*/

	const profiles = app.service('profiles').Model; //Nelor Don't forget to make sure the service already exists when you establish this one.

	user.belongsTo(profiles);

	app.set('_servicePromise',
	app.get('_servicePromise')
	.then(() =>
	{
		return user.sync({ force:true })
		.then(() => { console.log("Model 'user': synchronized."); });
	}));
	//.then(() => { console.log("Model 'user': sync scheduled.");}));

	return user;
};


text:
<?php

namespace App\Http\Controllers;
use Input;
use Validator;
use Redirect;
use Illuminate\Http\Request;
use DB;
use Auth;
use App\DiscussionModel;
use Carbon\Carbon;
class DiscussionController extends Controller
{
    //
    public function getview(){
       $downloads=DB::table('discussion')->get();
       if(Auth::user()->role ==1)
          $enrol=DB::table('teacher_enrolment')->where('user_name',Auth::user()->name)->get();
      else
        $enrol=DB::table('enrollment')->where('user_name',Auth::user()->name)->get();

       $entry=DB::table('discussion_entry')->get();
        $ct=0;
        $current_view= "discussion";
        return view('discussion',compact('downloads','entry','ct','current_view','enrol'));
    }
    public function insertFile($course_code,$taking_dept,$offered_dept,$sesson){

        $filetitle=Input::get('file_title');

 		$filetype=Input::get('file_type');

        //  Session::flash('success', 'Upload successfully');

            $data2=array(
                    'discussion_title' => $filetitle,
                    'discussion_type' => $filetype,
                     'username' => Auth::user()->name,
                     'taking_dept' => $taking_dept,
                     'offered_dept' => $offered_dept,
                     'session' => $sesson,
                     'course_code' => $course_code,
                     'status'=> 'OK',
                     'uploaded_time' => Carbon::now()
                    );

                 DiscussionModel::insert($data2);
       $downloads=DB::table('discussion')->get();
       if(Auth::user()->role ==1)
          $enrol=DB::table('teacher_enrolment')->where('user_name',Auth::user()->name)->get();
      else
        $enrol=DB::table('enrollment')->where('user_name',Auth::user()->name)->get();

       $entry=DB::table('discussion_entry')->get();
        $ct=0;
        $current_view= "discussion";
        return view('discussion_single',compact('downloads','entry','ct','current_view','enrol','course_code','taking_dept','offered_dept','sesson'));

    }

    public function update3($d_id)
    {

       {
         DB::table('discussion')
            ->where('id', $d_id)
            ->update(['status' => 'suspended']);
       }

        return Redirect::to('discussion');
    }
     public function update2($d_id)
    {

         {
         DB::table('discussion')
            ->where('id', $d_id)
            ->update(['status' => 'OK']);
        }

        return  Redirect::to('discussion');
    }

    public function single($course_code,$taking_dept,$offered_dept,$sesson)
    {

        $downloads=DB::table('discussion')->get();
       if(Auth::user()->role ==1)
          $enrol=DB::table('teacher_enrolment')->where('user_name',Auth::user()->name)->get();
      else
        $enrol=DB::table('enrollment')->where('user_name',Auth::user()->name)->get();

       $entry=DB::table('discussion_entry')->get();
        $ct=0;
        $current_view= "discussion";
        return view('discussion_single',compact('downloads','entry','ct','current_view','enrol','course_code','taking_dept','offered_dept','sesson'));
    }

     public function tag()
    {

         $current_view= "discussion";
        return view('tag',compact('current_view'));
    }

}


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">
    <Button
        android:id="@+id/get_data_btn"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="retrofit+okhttp异步请求数据"/>
    <Button
        android:id="@+id/sync_get_data_btn"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="retrofit+okhttp同步请求数据"/>
    <Button
        android:id="@+id/rxjava_retrofit_btn"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="retrofit+okhttp+rxjava请求数据"/>
    <Button
        android:id="@+id/rxjava_retrofit_err_btn"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="retrofit+okhttp+rxjava请求数据错误测试"/>
</LinearLayout>


text:
#include <set>
#include <string>

#include "config/config.h"

namespace heron {
namespace api {
namespace config {

// NOLINTNEXTLINE
const std::string Config::TOPOLOGY_TICK_TUPLE_FREQ_SECS = "topology.tick.tuple.freq.secs";
// NOLINTNEXTLINE
const std::string Config::TOPOLOGY_ENABLE_MESSAGE_TIMEOUTS = "topology.enable.message.timeouts";
// NOLINTNEXTLINE
const std::string Config::TOPOLOGY_DEBUG = "topology.debug";
// NOLINTNEXTLINE
const std::string Config::TOPOLOGY_STMGRS = "topology.stmgrs";
// NOLINTNEXTLINE
const std::string Config::TOPOLOGY_MESSAGE_TIMEOUT_SECS = "topology.message.timeout.secs";
// NOLINTNEXTLINE
const std::string Config::TOPOLOGY_COMPONENT_PARALLELISM = "topology.component.parallelism";
// NOLINTNEXTLINE
const std::string Config::TOPOLOGY_MAX_SPOUT_PENDING = "topology.max.spout.pending";
// NOLINTNEXTLINE
const std::string Config::TOPOLOGY_RELIABILITY_MODE = "topology.reliability.mode";
// NOLINTNEXTLINE
const std::string Config::TOPOLOGY_CONTAINER_CPU_REQUESTED = "topology.container.cpu";
// NOLINTNEXTLINE
const std::string Config::TOPOLOGY_CONTAINER_RAM_REQUESTED = "topology.container.ram";
// NOLINTNEXTLINE
const std::string Config::TOPOLOGY_CONTAINER_DISK_REQUESTED = "topology.container.disk";
// NOLINTNEXTLINE
const std::string Config::TOPOLOGY_CONTAINER_MAX_CPU_HINT = "topology.container.max.cpu.hint";
// NOLINTNEXTLINE
const std::string Config::TOPOLOGY_CONTAINER_MAX_RAM_HINT = "topology.container.max.ram.hint";
// NOLINTNEXTLINE
const std::string Config::TOPOLOGY_CONTAINER_MAX_DISK_HINT = "topology.container.max.disk.hint";
// NOLINTNEXTLINE
const std::string Config::TOPOLOGY_CONTAINER_PADDING_PERCENTAGE =
                                                    "topology.container.padding.percentage";
// NOLINTNEXTLINE
const std::string Config::TOPOLOGY_CONTAINER_RAM_PADDING = "topology.container.ram.padding";
// NOLINTNEXTLINE
const std::string Config::TOPOLOGY_COMPONENT_CPUMAP = "topology.component.cpumap";
// NOLINTNEXTLINE
const std::string Config::TOPOLOGY_COMPONENT_RAMMAP = "topology.component.rammap";
// NOLINTNEXTLINE
const std::string Config::TOPOLOGY_COMPONENT_DISKMAP = "topology.component.diskmap";

// NOLINTNEXTLINE
const std::string Config::TOPOLOGY_SERIALIZER_CLASSNAME = "topology.serializer.classname";
// NOLINTNEXTLINE
const std::string Config::TOPOLOGY_NAME = "topology.name";

const std::set<std::string> Config::apiVars_ = {
  Config::TOPOLOGY_TICK_TUPLE_FREQ_SECS,
  Config::TOPOLOGY_ENABLE_MESSAGE_TIMEOUTS,
  Config::TOPOLOGY_DEBUG,
  Config::TOPOLOGY_STMGRS,
  Config::TOPOLOGY_MESSAGE_TIMEOUT_SECS,
  Config::TOPOLOGY_COMPONENT_PARALLELISM,
  Config::TOPOLOGY_MAX_SPOUT_PENDING,
  Config::TOPOLOGY_RELIABILITY_MODE,
  Config::TOPOLOGY_CONTAINER_CPU_REQUESTED,
  Config::TOPOLOGY_CONTAINER_RAM_REQUESTED,
  Config::TOPOLOGY_CONTAINER_DISK_REQUESTED,
  Config::TOPOLOGY_CONTAINER_MAX_CPU_HINT,
  Config::TOPOLOGY_CONTAINER_MAX_RAM_HINT,
  Config::TOPOLOGY_CONTAINER_MAX_DISK_HINT,
  Config::TOPOLOGY_CONTAINER_PADDING_PERCENTAGE,
  Config::TOPOLOGY_CONTAINER_RAM_PADDING,
  Config::TOPOLOGY_COMPONENT_CPUMAP,
  Config::TOPOLOGY_COMPONENT_RAMMAP,
  Config::TOPOLOGY_COMPONENT_DISKMAP,
  Config::TOPOLOGY_NAME
};

void Config::setTopologyReliabilityMode(Config::TopologyReliabilityMode mode) {
  switch (mode) {
    case Config::TopologyReliabilityMode::ATMOST_ONCE:
      config_[Config::TOPOLOGY_RELIABILITY_MODE] = "ATMOST_ONCE";
      break;
    case Config::TopologyReliabilityMode::ATLEAST_ONCE:
      config_[Config::TOPOLOGY_RELIABILITY_MODE] = "ATLEAST_ONCE";
      break;
    case Config::TopologyReliabilityMode::EFFECTIVELY_ONCE:
      config_[Config::TOPOLOGY_RELIABILITY_MODE] = "EFFECTIVELY_ONCE";
      break;
    default:
      config_[Config::TOPOLOGY_RELIABILITY_MODE] = "ATMOST_ONCE";
      break;
  }
}

}  // namespace config
}  // namespace api
}  // namespace heron


text:
package com.myproject.user.model;

import lombok.Getter;
import lombok.Setter;

/**
 * This object used for authentication purposes.
 *
 * @author xnuter
 * @since 0.1
 */
@Getter
@Setter
public class AuthenticationInfoDTO {
    private String email;
    private String password;
    private String twoStepCode;
    private String twoStepQRurl;
    private boolean needTwoStepCode;
    private boolean saveDevice; // in cookies for 30 days
    private UserDTO user; // in case the user was authenticated, this field is populated
    private String jwtToken;
}


text:
namespace wasp {

template <typename T>
struct At : std::pair<Location, T> {
  using value_type = T;

  At() = default;
  At(T v) : std::pair<Location, T>{{}, std::move(v)} {}
  explicit At(Location loc, T v) : std::pair<Location, T>{loc, std::move(v)} {}

  At& operator=(T v) {
    this->first = Location{};
    this->second = v;
    return *this;
  }

  operator const T&() const { return this->second; }

  Location loc() const { return this->first; }

  const T& value() const { return this->second; }
  T& value() { return this->second; }

  const T* operator->() const { return &this->second; }
  T* operator->() { return &this->second; }
  const T& operator*() const { return this->second; }
  T& operator*() { return this->second; }
};

// Deduction guides.
template <typename T>
At(T v) -> At<T>;

template <typename T>
At(Location loc, T v) -> At<T>;

template <typename T>
using OptAt = optional<At<T>>;

template <typename T>
bool operator==(const At<T>& lhs, const T& rhs) { return lhs.value() == rhs; }
template <typename T>
bool operator==(const T& lhs, const At<T>& rhs) { return lhs == rhs.value(); }

template <typename T>
bool operator!=(const At<T>& lhs, const T& rhs) { return lhs.value() != rhs; }
template <typename T>
bool operator!=(const T& lhs, const At<T>& rhs) { return lhs != rhs.value(); }

}  // namespace wasp

namespace std {

template <typename T>
struct hash<::wasp::At<T>> {
  size_t operator()(const ::wasp::At<T>& v) const {
    return std::hash<T>{}(*v);
  }
};

}

#endif // WASP_BASE_AT_H_


text:
import * as Podium from "podium";
import {PeekListener} from "hapi";

/**
 * 'peek' - emitted for each chunk of payload data read from the client connection. The event method signature is function(chunk, encoding).
 * 'finish' - emitted when the request payload finished reading. The event method signature is function ().
 * 'disconnect' - emitted when a request errors or aborts unexpectedly.
 * For context [See docs](https://github.com/hapijs/hapi/blob/master/API.md#-requestevents)
 */
export type RequestEventType = "peek" | "finish" | "disconnect";

/**
 * Access: read only and the public podium interface.
 * The request.events supports the following events:
 * * 'peek' - emitted for each chunk of payload data read from the client connection. The event method signature is function(chunk, encoding).
 * * 'finish' - emitted when the request payload finished reading. The event method signature is function ().
 * * 'disconnect' - emitted when a request errors or aborts unexpectedly.
 * [See docs](https://github.com/hapijs/hapi/blob/master/API.md#-requestevents)
 */
export interface RequestEvents extends Podium {

    /**
     * Access: read only and the public podium interface.
     * The request.events supports the following events:
     * * 'peek' - emitted for each chunk of payload data read from the client connection. The event method signature is function(chunk, encoding).
     * * 'finish' - emitted when the request payload finished reading. The event method signature is function ().
     * * 'disconnect' - emitted when a request errors or aborts unexpectedly.
     * [See docs](https://github.com/hapijs/hapi/blob/master/API.md#-requestevents)
     */
    on(criteria: "peek", listener: PeekListener): void;
    on(criteria: "finish" | "disconnect", listener: () => void): void;
    on(criteria: RequestEventType, listener: Function): void;

    /**
     * Access: read only and the public podium interface.
     * The request.events supports the following events:
     * * 'peek' - emitted for each chunk of payload data read from the client connection. The event method signature is function(chunk, encoding).
     * * 'finish' - emitted when the request payload finished reading. The event method signature is function ().
     * * 'disconnect' - emitted when a request errors or aborts unexpectedly.
     * [See docs](https://github.com/hapijs/hapi/blob/master/API.md#-requestevents)
     */
    once(criteria: "peek", listener: PeekListener): void;
    once(criteria: "finish" | "disconnect", listener: () => void): void;
    once(criteria: RequestEventType, listener: Function): void;
}


text:
using System.Collections.Generic;
using Android.App;
using Android.Content;
using Android.OS;
using Android.Views;
using Android.Util;
using Android.Widget;
using System;
using Java.Util;
using System.Xml.Serialization;
using System.IO;
using System.Linq;

namespace Com.Tapjoy.TapjoySampleApp
{
	using TapjoyConnect = Com.Tapjoy.TapjoyConnect;
	using TapjoyConnectFlag = Com.Tapjoy.TapjoyConnectFlag;
	using TapjoyConnectNotifier = Com.Tapjoy.ITapjoyConnectNotifier;
	using TapjoyLog = Com.Tapjoy.TapjoyLog;

	[Activity (Label = "TapjoySampleApp", MainLauncher = true, Icon = "@drawable/icon")]
	public class MainActivity : BaseActivity, View.IOnClickListener, ITapjoyConnectNotifier
	{
		private Dictionary<string, Dictionary<string, object>> appInfoMap;

		private TextView appIdField;
		private TextView secretKeyField;
		private TextView currencyIdField;
		private CheckBox managedCheckbox;
		private List<string> appIdList;
		private List<string> currencyIdList;

		private Button connect;
		private Button selectAppButton;
		private Button selectCurrencyButton;
		private Button createAppButton;

		private string appId;
		private string secretKey;

		private Button buttonToReenable;

		private TapjoyConnectNotifier connectNotifier;

		private const string TAG = "MainActivity";

		public MainActivity ()
		{
			connectNotifier = this;
			appInfoMap = new Dictionary<string, Dictionary<string, object>> ();
		}

		protected override void OnCreate (Bundle savedInstanceState)
		{
			base.OnCreate (savedInstanceState);
			SetContentView (Resource.Layout.activity_main);

			debugTextView = (EditText)FindViewById (Resource.Id.debug_output_field);

			// Try to load previously saved apps
			loadAppInfo ();
			if (appInfoMap.Count == 0) {
				// If no saved apps found, initialize default available apps
				appInfoMap = new Dictionary<string, Dictionary<string, object>> ();
				Dictionary<string, object> managedAppMap = new Dictionary<string, object> ();
				managedAppMap [TapjoySampleConstants.SECRET_KEY] = TapjoySampleConstants.SECRET_KEY_MANAGED;
				managedAppMap [TapjoySampleConstants.MANAGED] = bool.TrueString;
				managedAppMap [TapjoySampleConstants.CURRENCY_IDS] = new List<string> (TapjoySampleConstants.CURRENCY_IDS_MANAGED);

				Dictionary<string, object> nonmanagedAppMap = new Dictionary<string, object> ();
				nonmanagedAppMap [TapjoySampleConstants.SECRET_KEY] = TapjoySampleConstants.SECRET_KEY_NONMANAGED;
				nonmanagedAppMap [TapjoySampleConstants.MANAGED] = bool.FalseString;
				nonmanagedAppMap [TapjoySampleConstants.CURRENCY_IDS] = new List<string> (TapjoySampleConstants.CURRENCY_IDS_NONMANAGED);

				appInfoMap [TapjoySampleConstants.APP_ID_NONMANAGED] = nonmanagedAppMap;
				appInfoMap [TapjoySampleConstants.APP_ID_MANAGED] = managedAppMap;
			}

			appIdList = new List<string> (appInfoMap.Keys.ToList ());

			// Set up default example
			appId = appIdList [0];
			appIdField = (TextView)FindViewById (Resource.Id.app_id_field);
			appIdField.Text = appId;

			Dictionary<string, object> defaultAppInfo = (Dictionary<string, object>)appInfoMap [appId];
			secretKey = (string)defaultAppInfo [TapjoySampleConstants.SECRET_KEY];

			secretKeyField = (TextView)FindViewById (Resource.Id.secret_key_field);
			secretKeyField.Text = secretKey;

			managedCheckbox = (CheckBox)FindViewById (Resource.Id.managed_currency_checkbox);
			managedCheckbox.Checked = bool.Parse ((string)defaultAppInfo [TapjoySampleConstants.MANAGED]);

			currencyIdField = (TextView)FindViewById (Resource.Id.currency_id_field);
			currencyIdList = new List<string> ((List<string>)defaultAppInfo [TapjoySampleConstants.CURRENCY_IDS]); //copy currencyIds to new list
			currencyIdField.Text = currencyIdList [0];

			// Set up buttons
			connect = (Button)FindViewById (Resource.Id.ConnectButton);
			connect.SetOnClickListener (this);

			selectAppButton = (Button)FindViewById (Resource.Id.SelectAppButton);
			selectAppButton.SetOnClickListener (this);

			selectCurrencyButton = (Button)FindViewById (Resource.Id.SelectCurrencyButton);
			selectCurrencyButton.SetOnClickListener (this);
			// if managed currency, disable option to select currency id
			if (isAppManaged ()) {
				selectCurrencyButton.Enabled = false;
			}

			createAppButton = (Button)FindViewById (Resource.Id.CreateAppButton);
			createAppButton.SetOnClickListener (this);

		}

		public virtual void OnClick (View v)
		{
			if (v is Button) {
				Button button = ((Button)v);
				int id = button.Id;

				if (id == Resource.Id.ConnectButton) {
					DisableButton (button);

					// OPTIONAL: For custom startup flags.
					Hashtable connectFlags = new Hashtable ();
					connectFlags.Put (TapjoyConnectFlag.EnableLogging, "true");

					// If you are not using Tapjoy Managed currency, you would set your own user ID here.
					//	connectFlags.put(TapjoyConnectFlag.USER_ID, "A_UNIQUE_USER_ID");

					// You can also set your event segmentation parameters here.
					//  Hashtable<String, String> segmentationParams = new Hashtable<String, String>();
					//  segmentationParams.put("iap", "true");
					//  connectFlags.put(TapjoyConnectFlag.SEGMENTATION_PARAMS, segmentationParams);

					TapjoyConnect.RequestTapjoyConnect (ApplicationContext, appId, secretKey, connectFlags, connectNotifier);
				} else if (id == Resource.Id.SelectAppButton) {
					AlertDialog.Builder builder = new AlertDialog.Builder (this);
					builder.SetTitle ("Select App ID");

					EventHandler<DialogClickEventArgs> handler = (s, e) => {
						appId = appIdList [e.Which];
						appIdField.Text = appId;
						Dictionary<string, object> selectedAppMap = appInfoMap [appId];
						secretKey = (string)selectedAppMap [TapjoySampleConstants.SECRET_KEY];
						secretKeyField.Text = secretKey;

						managedCheckbox.Checked = bool.Parse ((string)selectedAppMap [TapjoySampleConstants.MANAGED]);
						// if managed currency, disable option to select currency id
						selectCurrencyButton.Enabled = !isAppManaged ();

						currencyIdList.Clear ();
						currencyIdList.AddRange ((List<string>)selectedAppMap [TapjoySampleConstants.CURRENCY_IDS]);
						currencyIdField.Text = currencyIdList [0];
					};
					builder.SetItems (appIdList.ToArray (), handler);
					builder.Show ();
				} else if (id == Resource.Id.SelectCurrencyButton) {
					AlertDialog.Builder builder = new AlertDialog.Builder (this);
					builder.SetTitle ("Select Currency ID");
					EventHandler<DialogClickEventArgs> handler = (s, e) => {
						currencyIdField.Text = currencyIdList [e.Which];
					};
					builder.SetItems (currencyIdList.ToArray (), handler);
					builder.Show ();
				} else if (id == Resource.Id.CreateAppButton) {
					AlertDialog.Builder builder = new AlertDialog.Builder (this);
					builder.SetTitle ("Create New App");
					LayoutInflater inflater = this.LayoutInflater;
					View dialogView = inflater.Inflate (Resource.Layout.setup_layout, null);

					EventHandler<DialogClickEventArgs> positiveHandler = (s, e) => {
						// get new app info
						EditText addAppIdField = (EditText)dialogView.FindViewById (Resource.Id.add_app_id_field);
						EditText addSecretKeyField = (EditText)dialogView.FindViewById (Resource.Id.add_secret_key_field);

						CheckBox addManaged = (CheckBox)dialogView.FindViewById (Resource.Id.add_managed_currency_checkbox);
						appId = addAppIdField.Text.ToString ();
						secretKey = addSecretKeyField.Text.ToString ();

						// Check for non-empty appID.
						if (appId.Length == 0) {
							Toast.MakeText (this, "Could not add app -- App ID is empty", ToastLength.Long).Show ();
							return;
						}

						// Check for non-empty secretKey.
						if (secretKey.Length == 0) {
							Toast.MakeText (this, "Could not add app -- Secret Key is empty", ToastLength.Long).Show ();
							return;
						}

						// add new app to available apps list
						appIdList.Add (appId);
						Dictionary<string, object> newAppMap = new Dictionary<string, object> ();
						newAppMap [TapjoySampleConstants.SECRET_KEY] = secretKey;
						newAppMap [TapjoySampleConstants.MANAGED] = addManaged.Checked;

						// if non-managed, get the list of entered currency ids
						List<string> currencyIds = new List<string> ();
						if (addManaged.Checked) {
							currencyIds.Add (appId);
						} else {
							EditText addCurrencyIdField = (EditText)dialogView.FindViewById (Resource.Id.add_currency_id_field);
							string currencyIdText = addCurrencyIdField.Text.ToString ();
							currencyIds.AddRange (currencyIdText.ToString ().Split (new string[] { "\\s*,\\s*" }, StringSplitOptions.None));
						}
						newAppMap [TapjoySampleConstants.CURRENCY_IDS] = currencyIds;

						appInfoMap [appId] = newAppMap;

						saveAppInfo ();

						// update main page UI with new app info
						appIdField.Text = appId;
						secretKeyField.Text = secretKey;
						managedCheckbox.Checked = addManaged.Checked;
						selectCurrencyButton.Enabled = !addManaged.Checked;
						currencyIdList.Clear ();
						currencyIdList.AddRange (currencyIds);
						currencyIdField.Text = currencyIdList [0];

						mHandler.Post (mUpdateResults);
					};

					EventHandler<DialogClickEventArgs> negativeHandler = (s, e) => {
						return;
					};
					builder.SetView (dialogView)
						.SetPositiveButton ("Done", positiveHandler)
						.SetNegativeButton ("Cancel", negativeHandler);
					builder.Show ();
				} else {
					log (((Button)v).Text);
				}
			}
		}

		private void DisableButton (Button button)
		{
			this.buttonToReenable = button;
			button.Enabled = false;
		}

		protected internal virtual void UpdateResultsInUi ()
		{
			// Back in the UI thread -- update our UI elements based on the data in mResults
			if (debugTextView != null) {
				// Update the display text.
				if (update_text) {
					log (displayText);
					update_text = false;
				}
			}

			if (buttonToReenable != null) {
				buttonToReenable.Enabled = true;
				buttonToReenable = null;
			}
		}

		// Callback Methods

		public void ConnectFail ()
		{
			update_text = true;
			displayText = "Connect Failed";
			mHandler.Post (mUpdateResults);
		}

		public void ConnectSuccess ()
		{
			// Pass info about selected app to the next Activity
			Intent intent = new Intent (ApplicationContext, typeof(FeaturesActivity));
			intent.PutExtra (TapjoySampleConstants.APP_ID, appId);
			intent.PutExtra (TapjoySampleConstants.MANAGED, isAppManaged ());
			intent.PutExtra (TapjoySampleConstants.ACTIVE_CURRENCY_ID, getActiveCurrency ());
			StartActivity (intent);
			mHandler.Post (mUpdateResults);
		}

		public override bool OnOptionsItemSelected (IMenuItem item)
		{
			log (item.TitleFormatted.ToString ());
			Intent intent = new Intent (ApplicationContext, typeof(DeviceActivity));
			StartActivity (intent);
			return true;
		}

		// helper function to determine if active app has managed/non-managed currency
		public virtual bool isAppManaged ()
		{
			return managedCheckbox.Checked;
		}

		// helper function to retrieve active currency id
		public virtual string getActiveCurrency ()
		{
			return currencyIdField.Text.ToString ();
		}

		// Save all the app info to SharedPreferences
		public virtual void saveAppInfo ()
		{
			var prefs = GetSharedPreferences (TapjoySampleConstants.TAPJOY_SAMPLE_PREFS, 0);
			var editor = prefs.Edit ();

			try {
				editor.PutString (TapjoySampleConstants.TAPJOY_PREFS_KEY, SerializeObject (appInfoMap));
				editor.Commit ();
			} catch (Exception e) {
				Log.Error (TAG, "e: " + e.ToString ());
			}

		}

		// Load saved app info from SharedPreferences
		public virtual void loadAppInfo ()
		{
			var prefs = GetSharedPreferences (TapjoySampleConstants.TAPJOY_SAMPLE_PREFS, 0);

			try {
				string settings = prefs.GetString (TapjoySampleConstants.TAPJOY_PREFS_KEY, SerializeObject (new Dictionary<string, Dictionary<string, object>> ()));
				appInfoMap = (Dictionary<string, Dictionary<string, object>>)DeserializeObject<Dictionary<string, Dictionary<string, object>>> (settings);
			} catch (Exception e) {
				Log.Error (TAG, "e: " + e.ToString ());
			}
		}

		//		public virtual string Serialize (ISerializable obj)
		//		{
		//			if (obj == null) {
		//				return "";
		//			}
		//
		//			try {
		//				ByteArrayOutputStream serialObj = new ByteArrayOutputStream ();
		//				using (ObjectOutputStream objStream = new ObjectOutputStream ((Java.IO.BufferedOutputStream)serialObj)) {
		//					objStream.WriteObject ((Java.Lang.Object)obj);
		//					objStream.Close ();
		//				}
		//				return Base64.EncodeToString (serialObj.ToByteArray (), 0);
		//
		//			} catch (Exception e) {
		//				Log.Error (TAG, "e: " + e.ToString ());
		//			}
		//
		//			return "";
		//		}
		//
		//		public virtual object Deserialize (string str)
		//		{
		//			if (string.IsNullOrEmpty (str))
		//				return null;
		//
		//			try {
		//				ByteArrayInputStream serialObj = new ByteArrayInputStream (Base64.Decode (str, 0));
		//				using (ObjectInputStream objStream = new ObjectInputStream (serialObj)) {
		//					return objStream.ReadObject ();
		//				}
		//			} catch (Exception e) {
		//				Log.Error (TAG, "e: " + e.ToString ());
		//			}
		//
		//			return null;
		//		}

		public static object DeserializeObject<T> (string toDeserialize)
		{
			//var xs = new System.Runtime.Serialization (typeof (T));
			XmlSerializer xmlSerializer = new XmlSerializer (typeof(T));
			StringReader textReader = new StringReader (toDeserialize);
			var des =  xmlSerializer.Deserialize (textReader);
			return des;
		}

		public static string SerializeObject<T> (T toSerialize)
		{
			XmlSerializer xmlSerializer = new XmlSerializer (typeof(T));
			StringWriter textWriter = new System.IO.StringWriter ();
			xmlSerializer.Serialize (textWriter, toSerialize);
			var text = textWriter.ToString ();
			return text;
		}
	}
}


text:
package kaseannot.identity.klass

import pkg._

@kase class CPreToplevelNocomp[T](x: T, y: Int = 2)(z: Boolean, w: String = "")
@identity object CPreToplevelPrecomp
@kase class CPreToplevelPrecomp[T](x: T, y: Int = 2)(z: Boolean, w: String = "")
@kase class CPreToplevelPostcomp[T](x: T, y: Int = 2)(z: Boolean, w: String = "")
@identity object CPreToplevelPostcomp

class KaseIdentityClass {
  def assertEquals(a: Any, b: Any): Unit = { assert(a == b, s"$a != $b") }

  val objects = scala.collection.mutable.ListBuffer[Any]()
  objects += CPreToplevelNocomp(42)(true)
  objects += CPreToplevelPrecomp(42)(true)
  objects += CPreToplevelPostcomp(42)(true)
  objects += CPostToplevelNocomp(42)(true)
  objects += CPostToplevelPrecomp(42)(true)
  objects += CPostToplevelPostcomp(42)(true)

  @kase class CPreMemberNocomp[T](x: T, y: Int = 2)(z: Boolean, w: String = "")
  @identity object CPreMemberPrecomp
  @kase class CPreMemberPrecomp[T](x: T, y: Int = 2)(z: Boolean, w: String = "")
  @kase class CPreMemberPostcomp[T](x: T, y: Int = 2)(z: Boolean, w: String = "")
  @identity object CPreMemberPostcomp
  objects += CPreMemberNocomp(42)(true)
  objects += CPreMemberPrecomp(42)(true)
  objects += CPreMemberPostcomp(42)(true)
  objects += CPostMemberNocomp(42)(true)
  objects += CPostMemberPrecomp(42)(true)
  objects += CPostMemberPostcomp(42)(true)
  @kase class CPostMemberNocomp[T](x: T, y: Int = 2)(z: Boolean, w: String = "")
  @identity object CPostMemberPrecomp
  @kase class CPostMemberPrecomp[T](x: T, y: Int = 2)(z: Boolean, w: String = "")
  @kase class CPostMemberPostcomp[T](x: T, y: Int = 2)(z: Boolean, w: String = "")
  @identity object CPostMemberPostcomp

  // @Test
  def combo: Unit = {
    @kase class CPreLocalNocomp[T](x: T, y: Int = 2)(z: Boolean, w: String = "")
    @identity object CPreLocalPrecomp
    @kase class CPreLocalPrecomp[T](x: T, y: Int = 2)(z: Boolean, w: String = "")
    @kase class CPreLocalPostcomp[T](x: T, y: Int = 2)(z: Boolean, w: String = "")
    @identity object CPreLocalPostcomp
    objects += CPreLocalNocomp(42)(true)
    objects += CPreLocalPrecomp(42)(true)
    objects += CPreLocalPostcomp(42)(true)
    objects += CPostLocalNocomp(42)(true)
    objects += CPostLocalPrecomp(42)(true)
    objects += CPostLocalPostcomp(42)(true)
    @kase class CPostLocalNocomp[T](x: T, y: Int = 2)(z: Boolean, w: String = "")
    @identity object CPostLocalPrecomp
    @kase class CPostLocalPrecomp[T](x: T, y: Int = 2)(z: Boolean, w: String = "")
    @kase class CPostLocalPostcomp[T](x: T, y: Int = 2)(z: Boolean, w: String = "")
    @identity object CPostLocalPostcomp

    assertEquals(objects.mkString("\n"), """
      |CPreToplevelNocomp(42,2)
      |CPreToplevelPrecomp(42,2)
      |CPreToplevelPostcomp(42,2)
      |CPostToplevelNocomp(42,2)
      |CPostToplevelPrecomp(42,2)
      |CPostToplevelPostcomp(42,2)
      |CPreMemberNocomp(42,2)
      |CPreMemberPrecomp(42,2)
      |CPreMemberPostcomp(42,2)
      |CPostMemberNocomp(42,2)
      |CPostMemberPrecomp(42,2)
      |CPostMemberPostcomp(42,2)
      |CPreLocalNocomp(42,2)
      |CPreLocalPrecomp(42,2)
      |CPreLocalPostcomp(42,2)
      |CPostLocalNocomp(42,2)
      |CPostLocalPrecomp(42,2)
      |CPostLocalPostcomp(42,2)
    """.trim.stripMargin)
  }
}

@kase class CPostToplevelNocomp[T](x: T, y: Int = 2)(z: Boolean, w: String = "")
@identity object CPostToplevelPrecomp
@kase class CPostToplevelPrecomp[T](x: T, y: Int = 2)(z: Boolean, w: String = "")
@kase class CPostToplevelPostcomp[T](x: T, y: Int = 2)(z: Boolean, w: String = "")
@identity object CPostToplevelPostcomp