text:
layout: page
title: Introduction to Mapping
subtitle: "Alaska Press Club"
category: intermediate
date: 2015-01-08 12:00:00
author: 'Andy Eschbacher'
length: 3
---

# CartoDB Workshop -- Alaska Press Club

### Andy Eschbacher, Map Scientist, CartoDB

### January 8, 2015

Find this document here: http://bit.ly/alaskaCartoDB

## Outline

1. Introduction to CartoDB (30 minutes) -- 1:00 - 1:30 p.m.
    + Brief history
	+ Broad range of use cases
	+ Intro to the interface
2. Hands-on mapping workshop (45 minutes) -- 1:30 - 2:15 p.m.
	+ Setting up accounts
    + Data import
	+ Choropleth, Category, Intensity Maps
	+ Basic map styling
	+ Column data types
	+ Torque -- temporal maps
	+ Sharing visualizations
3. Break! (10 minutes) -- 2:15 - 2:25 p.m.
4. Working with Data (35 minutes) -- 2:25 - 3:00 p.m.
    + Data is messy
	+ What is geospatial data?
    + Data representation in CartoDB (SQL schema)
	+ Geocoding
	+ SQL/PostGIS
	+ Joining tables
5. Break! (10 minutes) -- 3:00 - 3:10 p.m.
6. CartoDB with JavaScript briefly (15 minutes) -- 3:10 - 3:25 p.m.
    + What it looks like (HTML/CSS/JS)
	+ Extensibility
	+ Epic examples
7. Odyssey.js (30 minutes) -- 3:25 - 3:55 p.m.
   + Brief Intro on authoring narratives with maps
   + Hands-on
8. Wrap Up (5 minutes) -- 3:55 - 4:00 p.m.
   + Resources
   + Seeking help

## Goals for today
+ Quickly and easily make meaningful maps from data in minutes
+ Show the breadth of data analysis available to you through CartoDB
+ Prepare data for use in mapping

### Later reference
You can find this document in [my GitHub Account](https://gist.github.com/ohasselblad/b2ea61019634ee6b3fe0).

## 1. Intro to CartoDB (30 mins) -- 1 pm - 1:30 pm

### 1.1 History
I'll show you some slides

### 1.2a Use cases

1. [Illustreets](http://www.illustreets.co.uk/)
2. [Tweets about Beyonce Album Release](https://srogers.cartodb.com/viz/337d9194-6458-11e3-85b5-e5e70547d141/embed_map)
3. [Starwars Galaxy Map](http://www.swgalaxymap.com/)

### 1.2b Journalistic Use Cases
1. [Demonstrations in Brazil](http://blog.cartodb.com/mapping-the-world-ongoing-demonstrations-in-brazil/)
2. [LA Sheriff Election Results](http://graphics.latimes.com/2014-la-sheriff-primary-map/)
3. [Alcatraz Escape revisited](http://www.washingtonpost.com/news/morning-mix/wp/2014/12/15/the-alcatraz-escapees-could-have-survived-and-this-interactive-model-proves-it/)

## 1.3 Tour of the interface

### Data Import
Basic Data Import
![Data import dialog](../img/alaska/data_import_dialog.png)
Most major formats for storing data: Excel Spreadsheets, CSV files, Shapefiles, KML (Google Earth), etc. [See complete list here.](http://docs.cartodb.com/cartodb-editor.html#supported-data-formats)

1. Import by URL! Super handy when in a workshop and you don't want to overwhelm the bandwidth
2. Select file from your HD
3. [Common Data](http://docs.cartodb.com/cartodb-editor.html#common-data) contains useful datasets for everyday use (admin regions, USGS earthquake data, ports and their locations, and many more)

Integration with **Google Drive** and **Dropbox**.

**Twitter** firehose access for [Enterprise](http://cartodb.com/enterprise) accounts.

<iframe src="https://srogers.cartodb.com/viz/337d9194-6458-11e3-85b5-e5e70547d141/embed_map" width="600px" height="400px"></iframe>

### Data tables in CartoDB
Schema or column names
![Column names](../img/alaska/column_names.png)

Filters & SQL
![Filters](../img/alaska/filters.png)
Filters are a great way to explore your data. Besides filtering your data, they allow you to see histograms of the distributions, the number of unique entries, or a search box for columns that have a large number of text entries.

#### Types of visualizations

+ Simple -- most basic visualization
+ Cluster -- counts number of points within a certain binned region
+ Choropleth -- makes a histogram of your data and gives bins different colors depending on the color ramp chosen
+ Category -- color data based on unique category (works best for a handful of unique types)
+ Bubble -- size markers based on column values
+ Intensity -- colors by density
+ Density -- data aggregated by number of points within a hexagon
+ Torque -- temporal visualization of data

Check out [visualization documentation](http://docs.cartodb.com/cartodb-editor.html#wizards) for more.

### _Simple_ Map
The visualization style _simple_ is the default visualization for all maps.

![Simple visualization](../img/alaska/simple_visualization.png)

Styles available in the wizard

![Styling options](../img/alaska/styling_options.png)

+ **Marker Fill:** change the size, color, and opacity of all markers
+ **Marker Stroke:** change the width, color, and opacity of every marker's border
+ **Composite Operation:** change the color of markers when they overlap
+ **Label Text:** Text appearing by a marker (can be from columns)

#### Infowindows/hovers

![Infowindow options](../img/alaska/infowindow_options.png)

+ Select which column data appear in infowindow by toggling column on
+ Customize further by selecting

#### Change basemap

Select basemaps from different providers, use custom color, NASA data, MapBox tiles, etc.

![Basemap options](../img/alaska/basemap_options.png)

### Choropleth

Choropleth maps show map elements colored according to where a value associated with the map element falls in a range. It's like a histogram where each bin is colored differently according to a color scale you pick. Notice the CartoCSS screenshot above.

_Quantification_ is an option to pay attention to since it controls how the data is binned into different colors. _Equal interval_ gives bins of equal size across the range,  which means that outliers stand out. _Quantile_ bins so that each quantile has approximately the same number of values.

#### CartoCSS basics

[CartoCSS](https://github.com/mapbox/carto/blob/master/docs/latest.md) is the styling language for our maps. ice presentation

![CartoCSS screenshot](../img/alaska/cartocss.png)

#### Legends

Can be easily customized

![Legend](../img/alaska/legend.png)

You have the option of giving it a title, and changing the text for the colors. You can also change the colors manually, or, even better, change the color ramp back in the wizard. If you want to explore other color ramps, check out [Color Brewer](http://colorbrewer2.org/) for some very well thought out color schemes.

### Torque maps

CartoDB created a fully zoomable map that changes in time.

Some examples

1. World Cup tweets saturate [this map](http://cartodb.com/v/worldcup/match/?TC=x&vis=30acae6a-0a51-11e4-8918-0e73339ffa50&h=t&t=Germany,B40903%7CArgentina,5CA2D1&m=7%2F13%2F2014%2016:00:00%20GMT,7%2F12%2F2014%2018:35:00GMT&g=147%7C#/2/7.7/56.8/0)
2. Tweets that mention [sunrise map](http://cartodb.s3.amazonaws.com/static_vizz/sunrise.html)
3. [Animal migration patterns](http://robbykraft.github.io/AnimalTrack/)

### Last few things

#### Navigating back to your tables or visualization

Click on the 90-degree arrow to get back to view your tables/visualizations

![go back to tables](../img/alaska/back_to_tables_arrow.png)

#### Navigating in general

![Navigation bar](../img/alaska/navigation_bar.png)

## 2. Hands-on Mapping Workshop -- 1:30 - 2:15 p.m.

**Let's make maps.**

Make sure you already have an account setup: https://cartodb.com/signup?plan=academy

### Data Import

Import a new dataset by copying the link (not downloading) and pasting it into the import window in your CartoDB account:

**USGS reported seismic activity (earthquakes)**
http://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_month.csv

### 2.1 _Simple_ Map

#### Challenge #1

Using the styles in simple, try to recreate the visualization below. It's similar to an intensity map that shows where earthquakes are occurring in largest numbers.

![Styling options](../img/alaska/styling_options_challenge1.png)

### 2.2 Choropleth Map

More on quantification [here](http://blog.cartographica.com/blog/2010/8/16/gis-data-classifications-in-cartographica.html).

#### Challenge #2

__Make a choropleth map__

Next select _choropleth_ from the Vizualization wizard. By default it will select `depth`. Select the `mag` column (which means magnitude or power of the earthquake).

Notice that there are lots of US-based earthquakes that are fairly weak -- so perhaps filtering for earthquakes above 3.0 will give a better visualization of our data.

_hint_: notice that a filter was used
![Choropleth map](../img/alaska/choropleth_map_challenge2.png)

### 2.3 Category Map

#### Challenge #3

Try to recreate this map using *category*. `net` is the column to categorize by...

![Category challenge](../img/alaska/category_map_challenge3.png)

### 2.4 Multilayer map

Three basic types of data appear on a map.

+ Point data -- like we saw for the earthquakes
+ Line data -- like flight paths, can be seen in [this example](http://andye.cartodb.com/viz/93141b9a-784e-11e4-9f55-0e853d047bba/public_map)
+ Polygon data -- like the shapes of states

#### Challenge #4 -- Create a multilayer visualization

Go back to your dashboard and click on _Common Data_. Find _Administrative Regions_, then click on _USA States_.

After the data imports into your account, click on the large **+** on the panel on the right side of the page.

![multilayer visualization](../img/alaska/multilayer_visualization.png)

Select the earthquake dataset. It's default name on import is `all_month`. Then hit **Add layer**.

![Add additional layer](../img/alaska/add_additional_layer.png)

Name your visualization something like "First multilayer visualization."

You can customize each layer just as you would customize a single layer.

Try to create a map that looks like this:

![Multilayer map](../img/alaska/multilayer_map.png)

####  Challenge #5 -- Create a basic torque map

Create a torque map and select the time column of the earthquake data

#### Multilayer example

Multilayer tool developed by The Daily Beast on [Abortion Clinic Access](http://www.thedailybeast.com/articles/2013/01/22/interactive-map-america-s-abortion-clinics.html).

![Abortion clinic access](../img/alaska/multilayer_map_abortion_clinics.png)

## 3. Break -- 2:15 - 2:25 p.m.

## 4. Working with Data Workshop -- 2:25 - 3:00 p.m.

### Data is messy

+ Comes in multiple formats
+ Sources uncertain
+ Contains errors
+ etc.

### Recreating the Pop vs. Soda Map

#### Step 1
1. Copy this link: http://popvssoda.com/d3/pvscounty_fips.tsv
2. Paste it into the import dialog box as we've done before
3. Notice the name of this new data table: `pvscounty_fips` -- we'll use this in a minute to create a new table from it with new information
4. Look at `the_geom` column to see if it is mappable
5. Inspect the table to look for information that can be useful to turn it into a map

#### Step 2
1. Go back to your tables view (by clicking on the little arrow in the upper lefthand corner of your browser window)
2. import a new table called `usa_counties` into your account by pasting the following link into the import box: `http://andye.cartodb.com/api/v2/sql?q=SELECT%20*%20FROM%20usa_counties&filename=usa_counties&format=csv`
3. Rename the table to `usa_counties` by clicking on table name in the upper left-hand corner of your browser window, like the image below.
![Change table name](../img/alaska/change_table_name.png)

_Pro tip_: this is a call using our SQL API and is a great way to access your data. More at our [SQL API page](http://docs.cartodb.com/cartodb-platform/sql-api.html).

#### Step 3
Copy the following text (which is a SQL statement) and replace the text in the SQL text box.

```sql
SELECT
  uc.the_geom,
  uc.the_geom_webmercator AS the_geom_webmercator,
  pf.pctcoke,
  pf.pctsoda,
  pf.pctpop,
  pf.pctother,
  pf.name_cou,
  pf.name_st
FROM
  usa_counties AS uc,
  pvscounty_fips AS pf
WHERE
  uc.admin_fips = pf.fips_combo
```

#### Step 4
Once the query is successful, click on "create table from query" in the green field below the column names.

![create table](../img/alaska/create_table.png)

Give a meaningful name, such as `popvssoda_data`.

### Challenge #6
Recreate some of the choropleths shown on http://popvssoda.com/ using the CartoDB editor.

![Coke choropleth](../img/alaska/coke_choropleth.png)

## 5. Break! (10 minutes) -- 3 - 3:10 p.m.

## 6. CartoDB.js -- 3:10 - 3:25 p.m.

[CartoDB.js](http://docs.cartodb.com/cartodb-platform/cartodb-js.html) is our JavaScript API -- a way to make maps using JavaScript.

### 6.1 What it looks like
![Three pieces to JavaScript maps](../img/alaska/three_pieces_to_js_map.png)

The [example above](http://jsfiddle.net/gh/get/library/pure/CartoDB/academy/tree/master/t/03-cartodbjs-ground-up/lesson-3/jsfiddle_demo_cartocss) use HTML, CSS, and JavaScript to make a map appear on a webpage.

Check out our [Map Academy course on CartoDB.js](http://academy.cartodb.com/courses/03-cartodbjs-ground-up.html) if you want to learn more.

### 6.2 Extensibility

Use CartoDB.js with other JavaScript libraries to make powerful web map apps.

Check out [Urban Reviewer](http://www.urbanreviewer.org/).

If you take a look at the source code, there are a dozen libraries linked:
![Urban Reviewer source code](../img/alaska/urban_reviewer_code_example.png)

### 6.3 Epic Example
[Illustreets](http://illustreets.co.uk/) shows standard of living information across England to amazing detail. There are millions of data points, each can be interacted with to give graphs, summaries, etc.

## Odyssey -- 2:25 - 3 p.m.

### Tell narratives with maps
http://cartodb.github.io/odyssey.js/

### Examples
+ *NY Daily News*: [48 Hours of Gun Violence](http://www.nydailynews.com/new-york/nyc-crime/bloody-weekend-19-injured-bullets-cops-arrest-2-article-1.1846552)
+ *Cadena Ser (Spanish radio)*: [The Sounds of 11M](http://www.cadenaser.com/sonidos-11m/)
+ *Al Jazeera*: [Israeli-Palestinian Conflict by Tweets](http://stream.aljazeera.com/projects/socialmediaconversation/)

### Getting started!
Go to:
http://cartodb.github.io/odyssey.js/sandbox/sandbox.html

Brief tour of the interface.

Replace the header in the box on the right with this:

```
- baseurl: "http://a.basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png"
- title: "Percent of people that say Coke"
- author: "Your name"
- cartodb_filter: ""
- vizjson: "http://andye.cartodb.com/api/v2/viz/944f113c-95d5-11e4-a3a2-0e4fddd5de28/viz.json"
```

If you want to add your own `vizjson` file for another visualization, go to the visualization you want to use in the CartoDB Editor, click on _Share_ in the upper right hand corner, and copy the link under _CartoDB.js_. You can now paste that link in place of the vizjson link given in the above example.

I'm using a different base map (`baseurl`), changing the title and author, and adding a data layer by adding the `vizjson` and `cartodb_filter` portions.

If you want to add images use the following format:

```
![Image title](image link)
```

Example:
```
![David Bowie](https://theartchiveproject.files.wordpress.com/2013/06/db_lom.jpg)
```

### Challenge #7
Create a story of the Pop vs. Soda data focused on _Percent Coke_ using Odyssey.js.

## 7. Wrap Up
More resources

1. [Map Academy](http://academy.cartodb.com)
2. [CartoDB Tutorials](http://docs.cartodb.com/tutorials.html)
3. [CartoDB Editor Documentation](http://docs.cartodb.com/cartodb-editor.html)
4. [CartoDB APIs](http://docs.cartodb.com/cartodb-platform.html)
5. [Gallery of nice maps](http://cartodb.com/gallery/)

My contact: [eschbacher@cartodb.com](mailto:eschbacher@cartodb.com)

If you make a map you're proud of or just want to say hello, connect with me [@MrEPhysics](https://twitter.com/MrEPhysics)


text:
<?php

if ( ! class_exists( 'Timber' ) ) {
	add_action( 'admin_notices', function() {
		echo '

Timber not activated. Make sure you activate the plugin in ' . esc_url( admin_url( 'plugins.php') ) . '

';
	});

	add_filter('template_include', function($template) {
		return get_stylesheet_directory() . '/static/no-timber.html';
	});
	return;
}

Timber::$dirname = array('templates', 'views');

class StarterSite extends TimberSite {

	function __construct() {
		add_theme_support( 'post-formats' );
		add_theme_support( 'post-thumbnails' );
		add_theme_support( 'menus' );
		add_theme_support( 'html5', array( 'comment-list', 'comment-form', 'search-form', 'gallery', 'caption' ) );
		add_filter( 'timber_context', array( $this, 'add_to_context' ) );
		add_filter( 'get_twig', array( $this, 'add_to_twig' ) );
		add_action( 'init', array( $this, 'register_post_types' ) );
		add_action( 'init', array( $this, 'register_taxonomies' ) );

		// Remove default Wordpress scripts
		add_action( 'wp_footer', 'deregister_footer_scripts' );
		remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
		remove_action( 'wp_print_styles', 'print_emoji_styles' );
		parent::__construct();
	}

	function register_post_types() {
		//this is where you can register custom post types
	}

	function register_taxonomies() {
		//this is where you can register custom taxonomies
	}

	function add_to_context( $context ) {
		$context['foo'] = 'bar';
		$context['stuff'] = 'I am a value set in your functions.php file';
		$context['notes'] = 'These values are available everytime you call Timber::get_context();';
		$context['menu'] = new TimberMenu();
		$context['site'] = $this;
		return $context;
	}

	function myfoo( $text ) {
		$text .= ' bar!';
		return $text;
	}

	function add_to_twig( $twig ) {
		/* this is where you can add your own functions to twig */
		$twig->addExtension( new Twig_Extension_StringLoader() );
		$twig->addFilter('myfoo', new Twig_SimpleFilter('myfoo', array($this, 'myfoo')));
		return $twig;
	}

}

// Dequeue Wordpress scripts
function deregister_footer_scripts(){
	wp_dequeue_script( 'wp-embed' );
}

new StarterSite();

redpajama_set_name: RedPajamaGithub


text:
it("should have [file] replaced with chunk filename in append", function() {
	var fs = require("fs"),
			path = require("path");
	var source = fs.readFileSync(path.join(__dirname, "some-test.js"), "utf-8");
	expect(source).toMatch("//# sourceMappingURL=http://localhost:50505/some-test.js.map");
});


text:
title: '`Object.fromEntries`'
author: 'Mathias Bynens ([@mathias](https://twitter.com/mathias)), JavaScript whisperer'
avatars:
  - 'mathias-bynens'
date: 2019-06-18
tags:
  - ECMAScript
  - ES2019
  - io19
description: 'Object.fromEntries is a useful addition to the built-in JavaScript library that complements Object.entries.'
tweet: '1140993821897121796'
---
`Object.fromEntries` is a useful addition to the built-in JavaScript library. Before explaining what it does, it helps to understand the pre-existing `Object.entries` API.

## `Object.entries`

The `Object.entries` API has been around for a while.

<feature-support chrome="54"
                 firefox="47"
                 safari="10.1"
                 nodejs="7"
                 babel="yes https://github.com/zloirock/core-js#ecmascript-object"></feature-support>

For each key-value pair in an object, `Object.entries` gives you an array where the first element is the key, and the second element is the value.

`Object.entries` is especially useful in combination with `for`-`of`, as it enables you to very elegantly iterate over all key-value pairs in an object:

```js
const object = { x: 42, y: 50 };
const entries = Object.entries(object);
// → [['x', 42], ['y', 50]]

for (const [key, value] of entries) {
  console.log(`The value of ${key} is ${value}.`);
}
// Logs:
// The value of x is 42.
// The value of y is 50.
```

Unfortunately, there's no easy way to go from the entries result back to an equivalent object… until now!

## `Object.fromEntries`

The new `Object.fromEntries` API performs the inverse of `Object.entries`. This makes it easy to reconstruct an object based on its entries:

```js
const object = { x: 42, y: 50 };
const entries = Object.entries(object);
// → [['x', 42], ['y', 50]]

const result = Object.fromEntries(entries);
// → { x: 42, y: 50 }
```

One common use case is transforming objects. You can now do this by iterating over its entries, and then using array methods you might already be familiar with:

```js
const object = { x: 42, y: 50, abc: 9001 };
const result = Object.fromEntries(
  Object.entries(object)
    .filter(([ key, value ]) => key.length === 1)
    .map(([ key, value ]) => [ key, value * 2 ])
);
// → { x: 84, y: 100 }
```

In this example, we're `filter`ing the object to only get keys of length `1`, that is, only the keys `x` and `y`, but not the key `abc`. We then `map` over the remaining entries and return an updated key-value pair for each. In this example, we double each value by multiplying it by `2`. The end result is a new object, with only properties `x` and `y`, and the new values.

## Objects vs. maps

JavaScript also supports `Map`s, which are often a more suitable data structure than regular objects. So in code that you have full control over, you might be using maps instead of objects. However, as a developer, you do not always get to choose the representation. Sometimes the data you're operating on comes from an external API or from some library function that gives you an object instead of a map.

`Object.entries` made it easy to convert objects into maps:

```js
const object = { language: 'JavaScript', coolness: 9001 };

// Convert the object into a map:
const map = new Map(Object.entries(object));
```

The inverse is equally useful: even if your code is using maps, you might need to serialize your data at some point, for example to turn it into JSON to send an API request. Or maybe you need to pass the data to another library that expects an object instead of a map. In these cases, you need to create an object based on the map data. `Object.fromEntries` makes this trivial:

```js
// Convert the map back into an object:
const objectCopy = Object.fromEntries(map);
// → { language: 'JavaScript', coolness: 9001 }
```

With both `Object.entries` and `Object.fromEntries` in the language, you can now easily convert between maps and objects.

### Warning: beware of data loss { #data-loss }

When converting maps into plain objects like in the above example, there's a implicit assumption that each key stringifies uniquely. If this assumption does not hold, data loss occurs:

```js
const map = new Map([
  [{}, 'a'],
  [{}, 'b'],
]);
Object.fromEntries(map);
// → { '[object Object]': 'b' }
// Note: the value 'a' is nowhere to be found, since both keys
// stringify to the same value of '[object Object]'.
```

Before using `Object.fromEntries` or any other technique to convert a map into a object, make sure the map's keys produce unique `toString` results.

## `Object.fromEntries` support { #support }

<feature-support chrome="73 /blog/v8-release-73#object.fromentries"
                 firefox="63"
                 safari="12.1"
                 nodejs="12 https://twitter.com/mathias/status/1120700101637353473"
                 babel="yes https://github.com/zloirock/core-js#ecmascript-object"></feature-support>


text:
.. _thedatamodel:

The Data Model
--------------

The FIB data model comprises two parts; the control-plane (CP) and the data-plane
(DP). The CP data model represents the data that is programmed into VPP by the
upper layers. The DP model represents how VPP derives actions to be performed on
packets as they are switched.

.. toctree::

   controlplane
   dataplane


text:
"""This module contains an object that represents a Telegram Audio."""

from telegram import TelegramObject

class Audio(TelegramObject):
    """This object represents an audio file to be treated as music by the Telegram clients.

    Attributes:
        file_id (:obj:`str`): Unique identifier for this file.
        duration (:obj:`int`): Duration of the audio in seconds.
        performer (:obj:`str`): Optional. Performer of the audio as defined by sender or by audio
            tags.
        title (:obj:`str`): Optional. Title of the audio as defined by sender or by audio tags.
        mime_type (:obj:`str`): Optional. MIME type of the file as defined by sender.
        file_size (:obj:`int`): Optional. File size.

    Args:
        file_id (:obj:`str`): Unique identifier for this file.
        duration (:obj:`int`): Duration of the audio in seconds as defined by sender.
        performer (:obj:`str`, optional): Performer of the audio as defined by sender or by audio
            tags.
        title (:obj:`str`, optional): Title of the audio as defined by sender or by audio tags.
        mime_type (:obj:`str`, optional): MIME type of the file as defined by sender.
        file_size (:obj:`int`, optional): File size.
        **kwargs (:obj:`dict`): Arbitrary keyword arguments.

    """

    def __init__(self,
                 file_id,
                 duration,
                 performer=None,
                 title=None,
                 mime_type=None,
                 file_size=None,
                 **kwargs):
        # Required
        self.file_id = str(file_id)
        self.duration = int(duration)
        # Optionals
        self.performer = performer
        self.title = title
        self.mime_type = mime_type
        self.file_size = file_size

        self._id_attrs = (self.file_id,)

    @classmethod
    def de_json(cls, data, bot):
        if not data:
            return None

        return cls(**data)


text:
package me.Aron.Heinecke.VocableTrainer.lib;

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

import javax.swing.table.AbstractTableModel;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

/**
 * Custom TableModel for the list choose table
 * @author "Aron Heinecke"
 */
@SuppressWarnings("serial")
public class TableChooseModel extends AbstractTableModel {

	private final Logger logger = LogManager.getLogger();
	private boolean multi_select = false;
    /**
     * Update multi select
	 * @param multi_select the multi_select to set
	 */
	public synchronized void setMulti_select(boolean multi_select) {
		this.multi_select = multi_select;
		super.fireTableDataChanged();
	}

	protected static final String[] COLUMN_NAMES = {
    	"Use",
        "Name",
        "Used",
        "Rows",
        "Col A",
        "Col B"
    };
    private List<TDTableInfoElement> rowData;

    /**
     * Retrieve a copy of the internal data
	 * @return the rowData
	 */
	public List<TDTableInfoElement> getRowData() {
		return new ArrayList<TDTableInfoElement>(rowData);
	}

	public TableChooseModel() {
    	rowData = new ArrayList<TDTableInfoElement>(25);
    }

    public void add(TDTableInfoElement tdl) {
    	add(Arrays.asList(tdl));
    }

    public void remove(int row){
    	logger.debug(row);
    	rowData.remove(row);
    	super.fireTableRowsDeleted(row,row);
    }

    public void add(List<TDTableInfoElement> tdl){
    	rowData.addAll(tdl);
    	fireTableDataChanged();
    }

    @Override
    public boolean isCellEditable(int row, int col)
    { return false; }

    /**
     * Delete all rows
     * @author "Aron Heinecke"
     */
    public void clearElements(){
    	if(rowData.size() != 0){
    		int i = rowData.size()-1;
        	rowData.clear();
        	super.fireTableRowsDeleted(0, i);
    	}
    }

    @Override
    public int getRowCount() {
    	return rowData.size();
    }

    @Override
    public int getColumnCount() {
    	return COLUMN_NAMES.length;
    }

    @Override
    public String getColumnName(int column) {
        return COLUMN_NAMES[column];
    }

    public TDTableInfoElement getTDLEAt(int row){
    	if(row >= rowData.size())
    		return null;
    	else
    		return rowData.get(row);
    }

    @Override
    public Class<?> getColumnClass(int columnIndex) {
        if (columnIndex == 0 && multi_select)
            return Boolean.class;
        return super.getColumnClass(columnIndex);
    }

    /**
     * Return the values according to the headers, from the TDTableInfoElement
     */
	@Override
    public Object getValueAt(int rowIndex, int columnIndex){
		TDTableInfoElement tdl = getTDLEAt(rowIndex);
    	Object value = null;
		switch(columnIndex) {
    	case 0:
			if(multi_select)
    			value = tdl.isPicked();
			else
				value = null;
    		break;
    	case 1:
    		value = tdl.getAlias();
    		break;
    	case 2:
    		value = tdl.getLast_used();
    		break;
    	case 3:
    		value = tdl.getAmount_rows();
    		break;
    	case 4:
    		value = tdl.getColumn_a();
    		break;
    	case 5:
    		value = tdl.getColumn_b();
    		break;
    	}
    	return value;
    }
}


text:
'use strict';

import View from 'brindille-view';
import classes from 'dom-classes';
import defaults from 'defaults';
import template from './points-indicator.html';

export default class PointsIndicator extends View {
  constructor(model) {
    super({
      template: template,
      model: defaults(model, {
        number: 5
      })
    });

    this.current = 0;
    this.$points = this.$el.querySelectorAll('.point');
    this.toggleSeventhPoint();
    classes.add(this.$points[this.current], 'active');
  }

  toggleSeventhPoint() {
    for (let i = 0; i < this.$points.length; i++) {
      if (i < this.model.number) {
        classes.remove(this.$points[i], 'hidden');
      } else {
        classes.add(this.$points[i], 'hidden');
      }
    }

    if (this.model.number === 7) {
      classes.add(this.$el, 'seven-points');
    }
  }

  update(id) {
    this.current = id;
    classes.remove(this.$el.querySelector('.point.active'), 'active');
    classes.add(this.$points[this.current], 'active');
  }

  show() {
    this.toggleSeventhPoint();
    TweenMax.to(this.$el, 0.4, {alpha: 1, ease: Expo.easeInOut});
  }

  hide() {
    TweenMax.to(this.$el, 0.4, {alpha: 0, ease: Expo.easeInOut});
  }
}


text:
using System;
using System.Linq;
using Premotion.Mansion.Core;
using Premotion.Mansion.Core.Collections;
using Premotion.Mansion.Core.Data;
using Premotion.Mansion.Core.Data.Facets;
using Premotion.Mansion.Core.Scripting.TagScript;

namespace Premotion.Mansion.Web.Portal.ScriptTags
{
	/// <summary>
	/// Group the taxonomy facets for a givens <see cref="Nodeset"/>.
	/// </summary>
	[ScriptTag(Constants.TagNamespaceUri, "groupTaxonomyFacets")]
	public class GroupTaxonomyFacetsTag : ScriptTag
	{
		#region Overrides of ScriptTag
		/// <summary>
		/// Executes this tag.
		/// </summary>
		/// <param name="context">The <see cref="IMansionContext"/>.</param>
		protected override void DoExecute(IMansionContext context)
		{
			// retrieve the nodeset
			var nodeset = GetRequiredAttribute<Nodeset>(context, "source");

			// get the taxonomy facet
			var facet = nodeset.Facets.FirstOrDefault(candidate => "taxonomyGuids".Equals(candidate.PropertyName, StringComparison.OrdinalIgnoreCase));
			if (facet == null)
				return;

			// remove the facet
			nodeset.RemoveFacet(facet);

			// retrieve the taxonomy node
			var taxonomyNode = context.Stack.Peek<Node>("TaxonomyNode");

			// retrieve all the taxonomy values
			var taxonomyItemsLookupTable = context.Repository.RetrieveNodeset(context, new PropertyBag
			                                                                    {
			                                                                    	{"parentSource", taxonomyNode},
			                                                                    	{"depth", "any"},
			                                                                    	{"status", "published"},
			                                                                    	{"baseType", "TaxonomyItem"}
			                                                                    }).Nodes.ToDictionary(node => node.PermanentId, node => node);

			// combine the facet counts with the taxonomy items
			var combined = taxonomyItemsLookupTable.Join(facet.Values, entry => entry.Key.ToString(), value => value.Value.ToString(), (node, value) => new
			                                                                             {
			                                                                             GroupName = node.Value.Pointer.Path[taxonomyNode.Pointer.Depth],
			                                                                             Value = new FacetValue(value.Value, value.Count)
			                                                                             {
			                                                                             DisplayValue = node.Value.Pointer.Name
			                                                                             }
			                                                                             }, StringComparer.OrdinalIgnoreCase);

			// group the taxonomy items by their group
			var grouped = combined.GroupBy(value => value.GroupName, StringComparer.OrdinalIgnoreCase);

			// transform the grouped items into facet results
			var results = grouped.Select(group => FacetResult.Create(context, new FacetDefinition(facet.PropertyName, group.Key), group.Select(x => x.Value)));

			// add the facets
			foreach (var result in results)
				nodeset.AddFacet(result);
		}
		#endregion
	}
}


text:
using System;
using System.Collections.Generic;
using System.Linq;

namespace Curae.Models
{
    public class Tenant
    {
        public string Id { get; set; }
    }

    public class SignupToken
    {
        public string Id { get; set; }

        public DateTimeOffset ExpirationDate { get; set; }
    }

    public class IssuingAuthorityKey
    {
        public string Id { get; set; }
    }
}


text:
package com.wecan.xhin.studio.fragment;

import com.wecan.xhin.baselib.fragment.BaseFragment;

/**
 * Created by xhinliang on 15-11-24.
 * xhinliang@gmail.com
 */
public class BooksFragment extends BaseFragment {
}


text:
<?php
namespace Erestar\TwitchesBundle\Handler;

use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\JsonResponse;

use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Bundle\FrameworkBundle\Routing\Router;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\Security\Http\Authentication\AuthenticationSuccessHandlerInterface;
use Symfony\Component\Security\Http\Authentication\AuthenticationFailureHandlerInterface;

use OAuth2\OAuth2;
use FOS\OAuthServerBundle\Model\ClientManagerInterface;

use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Security\Core\Exception\AuthenticationException;

use Symfony\Component\DependencyInjection\ContainerAware;

class AuthenticationHandler
implements AuthenticationSuccessHandlerInterface,
AuthenticationFailureHandlerInterface
{
    private $router;
    private $oauth2;
    private $clientManager;

    public function __construct(Router $router, Oauth2 $oauth2, ClientManagerInterface $clientManager, $clientId)
    {
        $this->router = $router;
        $this->oauth2 = $oauth2;
        $this->clientManager = $clientManager;
        //TODO move this to a configuration file
        $this->clientId = $clientId;
    }

    public function onAuthenticationSuccess(Request $request, TokenInterface $token)
    {
        if ($request->isXmlHttpRequest()) {

            $user = $token->getUser();

            $client = $this->clientManager->findClientByPublicId($this->clientId);

            if (!$client)
            {
                throw new \Exception('No client registered');
            }

            // $fake_request = new Request();
            // $params = array(
            //     'client_id'=> $this->clientId,
            //     'client_secret'=> $this->clientSecret,
            //     'grant_type'=>'client_credentials',
            //     'response_type'=>'token',
            //     'redirect_uri'=>'http://twitches.local/api'
            //     );

            // $fake_request->initialize($params)  ;

            // $response = $this->oauth2->finishClientAuthorization(true, $user, $fake_request, null);

            $token = $this->oauth2->createAccessToken($client, $user);

            $response = new Response();
            $response->setStatusCode(200);

            $response->setContent(json_encode($token));

            $response->headers->set('Content-Type', 'application/json');

            return $response;
        } else {
            // If the user tried to access a protected resource and was forces to login
            // redirect him back to that resource
            if ($targetPath = $request->getSession()->get('_security.target_path')) {
                $url = $targetPath;
            } else {
                $url = $this->router->generate('client_index');
            }

            return new RedirectResponse($url);
        }
    }

    public function onAuthenticationFailure(Request $request,
        AuthenticationException $exception)
    {
        if ($request->isXmlHttpRequest()) {
            // Handle XHR here
            $errors = array();
            $errors[] = $exception->getMessage();

            $response = new Response();
            $response->setStatusCode(401);
            $response->setContent(json_encode($errors));
            $response->headers->set('Content-Type', 'application/json');

            return $response;

        } else {
            // Create a flash message with the authentication error message
            $request->getSession()->setFlash('error', $exception->getMessage());
            $url = $this->router->generate('user_login');

            return new RedirectResponse($url);
        }
    }
}


text:
package 四法

trait Result
case class ResultS(tail: Result) extends Result
case object ResultT              extends Result


text:
header: Download
tagline: Get FunScript today
---

## From inside Visual Studio 2012/2013

FunScript is available via a project template in Visual Studio.

1. Open the "New Project" dialog.
2. Open the "Online" tab.
3. Search for "FunScript".
4. Select the [FunScript - Not Hosted](http://visualstudiogallery.msdn.microsoft.com/4688fe33-a41a-4c62-8322-4a7dccffa97c) template.
5. Name your project and click "OK".

## Using NuGet

FunScript is available [on NuGet](http://www.nuget.org/packages/FunScript). To reference
FunScript library in Visual Studio project, just run the following command in the
[Package Manager Console](http://docs.nuget.org/docs/start-here/using-the-package-manager-console):

PM> Install-Package FunScript

## Direct download

Alternatively, you can download the FunScript libraries in a single ZIP file.
Before extracting the file, make sure to [Unblock it](http://blogs.msdn.com/b/brada/archive/2009/12/11/visual-studio-project-sample-loading-error-assembly-could-not-be-loaded-and-will-be-ignored-could-not-load-file-or-assembly-or-one-of-its-dependencies-operation-is-not-supported-exception-from-hresult-0x80131515.aspx)
to avoid loading errors.

Download ZIP file

## Build from source

If you want to get the latest version or if you're considering contributing to FunScript, then
you can get the [source code from GitHub](https://github.com/ZachBray/FunScript). For more information,
see also [our contributor guide](contribute.html)!


text:
"use strict";

var through2 = require("through2"),
    i18nLint = require("./lib/i18n-lint"),
    i18nLintReporter = require("./lib/reporters/default"),
    i18nLintPlugin = function (options) {
        options = options || {};

        return through2.obj(function (file, enc, cb) {
            var errors = i18nLint.scan(file.contents.toString(),
                options.rules
            );

            // send status down-stream
            if (errors && errors.length > 0) {
                file.i18nlint = [];
                errors.forEach(function (error) {
                    file.i18nlint.push({file: file.path, error: error});
                });
            }

            cb(null, file);
        });
    };

i18nLintPlugin.reporter = function () {
    return through2.obj(function (file, enc, cb) {
        if (file.i18nlint && file.i18nlint.length > 0) {
            i18nLintReporter(file.i18nlint);
        }

        cb(null, file);
    });
};

module.exports = i18nLintPlugin;


text:
```cpp
static bool init ( ) ;
```
> init plugin, must be first invoke

```cpp
SDKBOX_DEPRECATED ( "setAppVersion" ) static void setAppVersion ( const std::string & version ) ;
```
> Explicitly specifies the App Version that Flurry will use to group Analytics data.

This is an optional method that overrides the App Version Flurry uses for reporting. Flurry will
use the CFBundleVersion in your info.plist file when this method is not invoked.
@note There is a maximum of 605 versions allowed for a single app. \n
This method must be called prior to invoking #startSession:.
@related function
 Android:   setVersionName(String version)
 iOS:       setAppVersion(NString version)
@deprecated flurry will read veersion number from app itself, if it was not set

```cpp
static std::string getFlurryAgentVersion ( ) ;
```
> Retrieves the Flurry Agent Build Version.

This is an optional method that retrieves the Flurry Agent Version the app is running under.
It is most often used if reporting an unexpected behavior of the SDK to
Flurry Support
@note This method must be called prior to invoking #startSession:. \n
FAQ for the iPhone SDK is located at
Support Center - iPhone FAQ.
@see #setLogLevel: for information on how to view debugging information on your console.
@return The agent version of the Flurry SDK.
@related function
 Android:   getReleaseVersion()
 iOS:       getFlurryAgentVersion()

```cpp
static void setShowErrorInLogEnabled ( bool value ) ;
```
> Displays an exception in the debug log if thrown during a Session.

This is an optional method that augments the debug logs with exceptions that occur during the session.
You must both capture exceptions to Flurry and set debug logging to enabled for this method to
display information to the console. The default setting for this method is  NO.
@note This method must be called prior to invoking #startSession:.
@see #setLogLevel: for information on how to view debugging information on your console. \n
#logError:message:exception: for details on logging exceptions. \n
#logError:message:error: for details on logging errors.
@related function
 iOS:       setShowErrorInLogEnabled()

```cpp
static void setDebugLogEnabled ( bool value ) ;
```
> Generates debug logs to console.

This is an optional method that displays debug information related to the Flurry SDK.
display information to the console. The default setting for this method is  NO
which sets the log level to  FlurryLogLevelCriticalOnly.
When set to  YES the debug log level is set to  FlurryLogLevelDebug
@note This method must be called prior to invoking #startSession:. If the method, setLogLevel is called later in the code, debug logging will be automatically enabled.
@related function
 Android:   setLogEnabled
 iOS:       setDebugLogEnabled()

```cpp
static void setLogLevel ( FA_FlurryLogLevel value ) ;
```
> Generates debug logs to console.

This is an optional method that displays debug information related to the Flurry SDK.
display information to the console. The default setting for this method is  FlurryLogLevelCritycalOnly.
@note Its good practice to call this method prior to invoking #startSession:. If debug logging is disabled earlier, this method will enable it.
@related function
 Android:   setLogLevel
 iOS:       setLogLevel

```cpp
static void setSessionContinueSeconds ( float seconds ) ;
```
> Set the timeout for expiring a Flurry session.

This is an optional method that sets the time the app may be in the background before
starting a new session upon resume.  The default value for the session timeout is 10
seconds in the background.
@note This method must be called prior to invoking #startSession:.
@related function
 Android:   setContinueSessionMillis
 iOS:       setSessionContinueSeconds

```cpp
static void setCrashReportingEnabled ( bool value ) ;
```
> Enable automatic collection of crash reports.

This is an optional method that collects crash reports when enabled. The
default value is  NO.
@note This method must be called prior to invoking #startSession:.
@related function
 Android:   setCaptureUncaughtExceptions
 iOS:       setCrashReportingEnabled

```cpp
static void startSession ( ) ;
```
> Start a Flurry session for the project denoted by  apiKey.

This method serves as the entry point to Flurry Analytics collection.  It must be
called in the scope of  applicationDidFinishLaunching.  The session will continue
for the period the app is in the foreground until your app is backgrounded for the
time specified in #setSessionContinueSeconds:. If the app is resumed in that period
the session will continue, otherwise a new session will begin.
Crash reporting will not be enabled. See #setCrashReportingEnabled: for
more information.
@note If testing on a simulator, please be sure to send App to background via home
button. Flurry depends on the iOS lifecycle to be complete for full reporting.
@see #setSessionContinueSeconds: for details on setting a custom session timeout.
 @related function
  Android:   onStartSession
  iOS:       startSession

```cpp
static void endSession ( ) ;
```
> end session, just valid on Android

@related function
 Android:    onEndSession()

```cpp
static bool activeSessionExists ( ) ;
```
> Start a Flurry session for the project denoted by  apiKey.

@related function
 Android:    isSessionActive
 iOS:        activeSessionExists

```cpp
static std::string getSessionID ( ) ;
```
> Start a Flurry session for the project denoted by  apiKey.

@related function
Android: getSessionId()
iOS:     getSessionID()

```cpp
static void pauseBackgroundSession ( ) ;
```
> Pauses a Flurry session left running in background. on valid on iOS

This method should be used in case of #setBackgroundSessionEnabled: set to YES. It can be
called when application finished all background tasks (such as playing music) to pause session.
@see #setBackgroundSessionEnabled: for details on setting a custom behaviour on resigning activity.
@related function
iOS:     pauseBackgroundSession()

```cpp
static void addOrigin ( const std::string & originName ,
                        const std::string & originVersion ) ;
```
> Adds an SDK origin specified by  originName and  originVersion.

This method allows you to specify origin within your Flurry SDK wrapper. As a general rule
you should capture all the origin info related to your wrapper for Flurry SDK after every session start.
@see #addOrigin:withVersion:withParameters: for details on reporting origin info with parameters. \n
@related function
Android: addOrigin (String originName, String originVersion)
iOS:     addOrigin: (NSString >) originName withVersion: (NSString >) originVersion

```cpp
static void addOrigin ( const std::string & originName ,
                        const std::string & originVersion ,
                        std::map <std::string ,
                        std::string> & parameters ) ;
```
> Adds a custom parameterized origin specified by  originName with  originVersion and  parameters.

This method overrides #addOrigin to allow you to associate parameters with an origin attribute. Parameters
are valuable as they allow you to store characteristics of an origin.
@note You should not pass private or confidential information about your origin info in a
custom origin. \n
A maximum of 9 parameter names may be associated with any origin. Sending
over 10 parameter names with a single origin will result in no parameters being logged
for that origin.
@related function
Android: addOrigin (String originName, String originVersion, Map< String, String > originParameters)
iOS:     addOrigin: (NSString >) originName withVersion: (NSString >) originVersion withParameters: (NSDictionary >) parameters

```cpp
static void addOrigin ( const std::string & originName ,
                        const std::string & originVersion ,
                        const std::string & parameters ) ;
```
> just for lua, js binding, have the same function with addOrigin(string, string, map)

```cpp
static int logEvent ( const std::string & eventName ) ;
```
> Records a custom event specified by  eventName.

This method allows you to specify custom events within your app.  As a general rule
you should capture events related to user navigation within your app, any action
around monetization, and other events as they are applicable to tracking progress
towards your business goals.
@note You should not pass private or confidential information about your users in a
custom event. \n
Where applicable, you should make a concerted effort to use timed events with
parameters (#logEvent:withParameters:timed:) or events with parameters
(#logEvent:withParameters:). This provides valuable information around the time the user
spends within an action (e.g. - time spent on a level or viewing a page) or characteristics
of an action (e.g. - Buy Event that has a Parameter of Widget with Value Golden Sword).
@see #logEvent:withParameters: for details on storing events with parameters. \n
#logEvent:timed: for details on storing timed events. \n
#logEvent:withParameters:timed: for details on storing timed events with parameters. \n
#endTimedEvent:withParameters: for details on stopping a timed event and (optionally) updating
parameters.
that can be easily understood by non-technical people in your business domain.
@return enum FA_FlurryEventRecordStatus for the recording status of the logged event.
@related function
Android: logEvent (String eventId)
iOS:     logEvent:(NSString >)eventName

```cpp
static int logEvent ( const std::string & eventName ,
                      std::map <std::string ,
                      std::string> & parameters ) ;
```
> Records a custom parameterized event specified by  eventName with  parameters.

This method overrides #logEvent to allow you to associate parameters with an event. Parameters
are extremely valuable as they allow you to store characteristics of an action. For example,
if a user purchased an item it may be helpful to know what level that user was on.
By setting this parameter you will be able to view a distribution of levels for the purcahsed
event on the Flurrly Dev Portal.
@note You should not pass private or confidential information about your users in a
custom event. \n
A maximum of 10 parameter names may be associated with any event. Sending
over 10 parameter names with a single event will result in no parameters being logged
for that event. You may specify an infinite number of Parameter values. For example,
a Search Box would have 1 parameter name (e.g. - Search Box) and many values, which would
allow you to see what values users look for the most in your app. \n
Where applicable, you should make a concerted effort to use timed events with
parameters (#logEvent:withParameters:timed:). This provides valuable information
around the time the user spends within an action (e.g. - time spent on a level or
viewing a page).
@see #logEvent:withParameters:timed: for details on storing timed events with parameters. \n
#endTimedEvent:withParameters: for details on stopping a timed event and (optionally) updating
parameters.
that can be easily understood by non-technical people in your business domain.
@return enum FA_FlurryEventRecordStatus for the recording status of the logged event.
@related function
Android: logEvent (String eventId, Map< String, String > parameters)
iOS:     logEvent:(NSString >)eventName withParameters:(NSDictionary >)parameters;

```cpp
static int logEvent ( const std::string & eventName ,
                      const std::string & parameters ) ;
```
> just for lua, js binding, have same function with logEvent(string, map)

```cpp
static int logEvent ( const std::string & eventName , bool timed ) ;
```
> Records a timed event specified by  eventName.

This method overrides #logEvent to allow you to capture the length of an event. This can
be extremely valuable to understand the level of engagement with a particular action. For
example, you can capture how long a user spends on a level or reading an article.
@note You should not pass private or confidential information about your users in a
custom event. \n
Where applicable, you should make a concerted effort to use parameters with your timed
events (#logEvent:withParameters:timed:). This provides valuable information
around the characteristics of an action (e.g. - Buy Event that has a Parameter of Widget with
Value Golden Sword).
@see #logEvent:withParameters:timed: for details on storing timed events with parameters. \n
#endTimedEvent:withParameters: for details on stopping a timed event and (optionally) updating
parameters.
that can be easily understood by non-technical people in your business domain.
@return enum FA_FlurryEventRecordStatus for the recording status of the logged event.
@related function
Android: logEvent (String eventId, boolean timed)
iOS:     logEvent:(NSString >)eventName timed:(BOOL)timed;

```cpp
static int logEvent ( const std::string & eventName ,
                      std::map <std::string ,
                      std::string> & parameters ,
                      bool timed ) ;
```
> Records a custom parameterized timed event specified by  eventName with  parameters.

This method overrides #logEvent to allow you to capture the length of an event with parameters.
This can be extremely valuable to understand the level of engagement with a particular action
and the characteristics associated with that action. For example, you can capture how long a user
spends on a level or reading an article. Parameters can be used to capture, for example, the
author of an article or if something was purchased while on the level.
@note You should not pass private or confidential information about your users in a
custom event.
@see #endTimedEvent:withParameters: for details on stopping a timed event and (optionally) updating
parameters.
that can be easily understood by non-technical people in your business domain.
@return enum FA_FlurryEventRecordStatus for the recording status of the logged event.
@related function
Android: logEvent (String eventId, Map< String, String > parameters, boolean timed)
iOS:     logEvent:(NSString >)eventName withParameters:(NSDictionary >)parameters timed:(BOOL)timed;

```cpp
static int logEvent ( const std::string & eventName ,
                      const std::string & parameters ,
                      bool timed ) ;
```
> just for lua, js binding, have the same function with logEvent(string, map, bool)

```cpp
static void endTimedEvent ( const std::string & eventId ) ;
```
> End a timed event

@related function
Android: endTimedEvent (String eventId)

```cpp
static void endTimedEvent ( const std::string & eventName ,
                            std::map <std::string ,
                            std::string> & parameters ) ;
```
> Ends a timed event specified by  eventName and optionally updates parameters with  parameters.

This method ends an existing timed event.  If parameters are provided, this will overwrite existing
parameters with the same name or create new parameters if the name does not exist in the parameter
map set by #logEvent:withParameters:timed:.
@note You should not pass private or confidential information about your users in a
custom event. \n
If the app is backgrounded prior to ending a timed event, the Flurry SDK will automatically
end the timer on the event. \n
#endTimedEvent:withParameters: is ignored if called on a previously
terminated event.
@see #logEvent:withParameters:timed: for details on starting a timed event with parameters.
that can be easily understood by non-technical people in your business domain.
@related function
Android: endTimedEvent (String eventId, Map< String, String > parameters)
iOS:     endTimedEvent:(NSString >)eventName withParameters:(NSDictionary >)parameters;

```cpp
static void endTimedEvent ( const std::string & eventName ,
                            const std::string & parameters ) ;
```
> just for lua, js binding, have same function with endTimeEvent(string, map)

```cpp
static void logError ( const std::string & errorID ,
                       const std::string & message ,
                       const std::string & info ) ;
```
> Records an app exception. Commonly used to catch unhandled exceptions.

This method captures an exception for reporting to Flurry. We recommend adding an uncaught
exception listener to capture any exceptions that occur during usage that is not
anticipated by your app.
@see #logError:message:error: for details on capturing errors.
@related function
Android: onError (String errorId, String message, String errorClass)
iOS:     logError:(NSString >)errorID message:(NSString >)message error:nullptr;

```cpp
static void logPageView ( ) ;
```
> Explicitly track a page view during a session.

This method increments the page view count for a session when invoked. It does not associate a name
with the page count. To associate a name with a count of occurences see #logEvent:.
@see #logAllPageViews for details on automatically incrementing page view count based on user
traversing navigation or tab bar controller.
@related function
Android: onPageView
iOS:     logPageView

```cpp
static void setUserID ( const std::string & userID ) ;
```
> Assign a unique id for a user in your app.

@note Please be sure not to use this method to pass any private or confidential information
about the user.
@related function
Android: setUserId (String userId)
iOS:     setUserID:(NSString >)userID

```cpp
static void setAge ( int age ) ;
```
> Set your user's age in years.

Use this method to capture the age of your user. Only use this method if you collect this
information explictly from your user (i.e. - there is no need to set a default value).
@note The age is aggregated across all users of your app and not available on a per user
basis.
@related function
Android: setAge (int age)
iOS:     setAge:(int)age;

```cpp
static void setGender ( const std::string & gender ) ;
```
> Set your user's gender.

Use this method to capture the gender of your user. Only use this method if you collect this
information explictly from your user (i.e. - there is no need to set a default value). Allowable
values are  @"m" or  @"f"
@note The gender is aggregated across all users of your app and not available on a per user
basis.
                 "u" -1 unknow
                 "m" 1 male
                 "f" 0 female
@related function
Android: setGender (byte gender)
iOS:     setGender:(NSString >)gender;

```cpp
	 static void setReportLocation ( bool reportLocation ) ;
```
> Set whether Flurry should record location via GPS. Defaults to true. valid on Android

@related function
Android: setReportLocation (boolean reportLocation)

```cpp
static void setLatitude ( double latitude ,
                          double longitude ,
                          float horizontalAccuracy ,
                          float verticalAccuracy ) ;
```
> Set the location of the session.

Use information from the CLLocationManager to specify the location of the session. Flurry does not
automatically track this information or include the CLLocation framework.
@note Only the last location entered is captured per session. \n
Regardless of accuracy specified, the Flurry SDK will only report location at city level or higher. \n
Location is aggregated across all users of your app and not available on a per user basis. \n
This information should only be captured if it is germaine to the use of your app.
After starting the location manager, you can set the location with Flurry. You can implement
CLLocationManagerDelegate to be aware of when the location is updated. Below is an example
of how to use this method, after you have recieved a location update from the locationManager.
        no use on Android
        no use on Android
@related function
Android: setLocation (float lat, float lon)
iOS:     setLatitude:(double)latitude longitude:(double)longitude horizontalAccuracy:(float)horizontalAccuracy verticalAccuracy:(float)verticalAccuracy;

```cpp
static void clearLocation ( ) ;
```
> clear the default location.valid on Android

@related function
Android: clearLocation ()

```cpp
static void setSessionReportsOnCloseEnabled ( bool sendSessionReportsOnClose ) ;
```
> Set session to report when app closes.valid on iOS

Use this method report session data when the app is closed. The default value is  YES.
@note This method is rarely invoked in iOS >= 3.2 due to the updated iOS lifecycle.
@see #setSessionReportsOnPauseEnabled:
@related function
iOS: setSessionReportsOnCloseEnabled:(bool) sendSessionReportsOnClose

```cpp
static void setSessionReportsOnPauseEnabled ( bool setSessionReportsOnPauseEnabled ) ;
```
> Set session to report when app is sent to the background.valid on iOS

Use this method report session data when the app is paused. The default value is  YES.
@related function
iOS: setSessionReportsOnPauseEnabled:(bool) setSessionReportsOnPauseEnabled

```cpp
static void setBackgroundSessionEnabled ( bool setBackgroundSessionEnabled ) ;
```
> Set session to support background execution.valid on iOS

Use this method to enable reporting of errors and events when application is
running in backgorund (such applications have  UIBackgroundModes in Info.plist).
You should call #pauseBackgroundSession when appropriate in background mode to
pause the session (for example when played song completed in background)
Default value is  NO
@see #pauseBackgroundSession for details
continue log events and errors for running session.
@related function
iOS:         setBackgroundSessionEnabled:(bool) setBackgroundSessionEnabled
@

```cpp
static void setEventLoggingEnabled ( bool value ) ;
```
> Enable custom event logging.

Use this method to allow the capture of custom events. The default value is  YES.
@related function
Android:     setLogEvents (boolean logEvents)
iOS:         setEventLoggingEnabled:(bool) value

```cpp
static void setPulseEnabled ( bool value ) ;
```
> Enables Flurry Pulse

@note: Please see https://developer.yahoo.com/flurry-pulse/ for more details
@related function
Android:     setPulseEnabled (boolean isEnabled)
iOS:         setPulseEnabled:(BOOL)value;

```cpp
static void setListener ( FlurryAnalyticsListener * listener ) ;
```
> set listener for session callback

```cpp
static FlurryAnalyticsListener * getListener ( ) ;
```
> get listener

```cpp
static void removeListener ( ) ;
```
> remove listener, just set null, will not delete it
        the user should delete listener self

### Listeners
```cpp
void flurrySessionDidCreateWithInfo ( std::map <std::string ,
                                      std::string> & info );
```
> Invoked when analytics session is created,

This method informs the app that an analytics session is created.
@see Flurry#startSession for details on session.


text:
<resources>
    <string name="app_name">GServicesTest</string>
</resources>


text:
from restroom.core import API
from expense.models import Expense

api = API()

class ExpenseResource(APIResource):
    model = Expense
    results_per_page = 50

    def serialize(self, expense):
        return {
            "shit": expense.shit,
            "id": expense.id,
            "amount": expense.amount,
            "status": expense.special_property,
        }

api.register(ExpenseResource)

class MyAPIResource(APIResource):
   def authorize(self, request):
       if request.user.is_authenticated():
           return request.user
       key = request.GET.get('apikey')
       try:
           return APIKey.objects.get(key=key).user
       except APIKey.DoesNotExist:
           return

class ExpenseResource(MyAPIResource):
    model = Expense
    results_per_page = 20
    needs_authorization = True
    filter_by_user = 'user'

    def serialize(self, expense):
        return {
            "shit": expense.shit,
            "id": expense.id,
            "amount": expense.amount,
            "status": expense.special_property,
        }

   def get_queryset(self):
       return Expense.objects.filter(status__gte=9, is_active=True)

   def search(self, params):
       filter_dict = {}
       if params.get("city"):
           filter_dict["city__slug"] = params["city"]

       if params.get("reimbursed"):
           filter_dict["status"] = 10
       qs = self.get_queryset().filter(**filter_dict)
       if params.get("order"):
          qs = qs.order_by(params["order"])
       return qs

api.register(Expense)


text:
{% extends "templates/partials/base.html" %}

{% set item = cms.movingtoprovidenceindex %}
{% set itemSubpages = cms.movingtoprovidencepages %}

{% block title %}{% parent %} - {{ item.name }}{% endblock %}

{% block content %}

{{ item.name }}

    {{ item.main_description|safe }}
    {% for section in item.narrative_sections %}

{{ section.title }}

        {{ section.description|safe }}

    {% endfor %}

    {% for page in itemSubpages %}
      {{ page.name }}
    {% endfor %}

  {% include "templates/partials/getInTouchBox.html" %}

{% endblock %}


text:
package com.esri.arcgisruntime.sample.featurelayerrenderingmodescene;

import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
import android.view.MotionEvent;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import com.esri.arcgisruntime.concurrent.ListenableFuture;
import com.esri.arcgisruntime.data.ServiceFeatureTable;
import com.esri.arcgisruntime.geometry.Point;
import com.esri.arcgisruntime.geometry.SpatialReferences;
import com.esri.arcgisruntime.layers.FeatureLayer;
import com.esri.arcgisruntime.mapping.ArcGISScene;
import com.esri.arcgisruntime.mapping.view.Camera;
import com.esri.arcgisruntime.mapping.view.DefaultSceneViewOnTouchListener;
import com.esri.arcgisruntime.mapping.view.SceneView;

public class MainActivity extends AppCompatActivity {

  private SceneView mSceneViewTop;
  private SceneView mSceneViewBottom;
  private Camera mZoomedIn;
  private Camera mZoomedOut;
  private Button mZoomButton;
  private TextView mNavigatingTextView;

  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    Point zoomedOutPoint = new Point(-118.37, 34.46, SpatialReferences.getWgs84());
    Point zoomedInPoint = new Point(-118.45, 34.395, SpatialReferences.getWgs84());

    // define viewpoints
    mZoomedOut = new Camera(zoomedOutPoint, 42000, 0, 0, 0);
    mZoomedIn = new Camera(zoomedInPoint, 2500, 90, 75, 0);

    // inflate the zoom button
    mZoomButton = findViewById(R.id.zoomButton);

    // inflate SceneViews from layout
    mSceneViewTop = findViewById(R.id.sceneViewTop);
    mSceneViewBottom = findViewById(R.id.sceneViewBottom);

    // inflate navigating text view
    mNavigatingTextView = findViewById(R.id.isNavigatingTextView);
    mNavigatingTextView.setVisibility(View.INVISIBLE);

    // create a scene (top) and set it to render all features in static rendering mode
    ArcGISScene sceneTop = new ArcGISScene();
    sceneTop.getLoadSettings().setPreferredPointFeatureRenderingMode(FeatureLayer.RenderingMode.STATIC);
    sceneTop.getLoadSettings().setPreferredPolylineFeatureRenderingMode(FeatureLayer.RenderingMode.STATIC);
    sceneTop.getLoadSettings().setPreferredPolygonFeatureRenderingMode(FeatureLayer.RenderingMode.STATIC);

    // create a scene (bottom) and set it to render all features in dynamic rendering mode
    ArcGISScene sceneBottom = new ArcGISScene();
    sceneBottom.getLoadSettings().setPreferredPointFeatureRenderingMode(FeatureLayer.RenderingMode.DYNAMIC);
    sceneBottom.getLoadSettings().setPreferredPolylineFeatureRenderingMode(FeatureLayer.RenderingMode.DYNAMIC);
    sceneBottom.getLoadSettings().setPreferredPolygonFeatureRenderingMode(FeatureLayer.RenderingMode.DYNAMIC);

    // create the service feature table
    ServiceFeatureTable faultServiceFeatureTable = new ServiceFeatureTable(
        getResources().getString(R.string.energy_geology_feature_service) + "0");
    ServiceFeatureTable contactsServiceFeatureTable = new ServiceFeatureTable(
        getResources().getString(R.string.energy_geology_feature_service) + "8");
    ServiceFeatureTable outcropServiceFeatureTable = new ServiceFeatureTable(
        getResources().getString(R.string.energy_geology_feature_service) + "9");

    // create the feature layer using the service feature table
    FeatureLayer faultFeatureLayer = new FeatureLayer(faultServiceFeatureTable);
    FeatureLayer contactsFeatureLayer = new FeatureLayer(contactsServiceFeatureTable);
    FeatureLayer outcropFeatureLayer = new FeatureLayer(outcropServiceFeatureTable);

    // add the feature layers to the scenes
    sceneTop.getOperationalLayers().add(faultFeatureLayer);
    sceneTop.getOperationalLayers().add(contactsFeatureLayer);
    sceneTop.getOperationalLayers().add(outcropFeatureLayer);
    sceneBottom.getOperationalLayers().add(faultFeatureLayer.copy());
    sceneBottom.getOperationalLayers().add(contactsFeatureLayer.copy());
    sceneBottom.getOperationalLayers().add(outcropFeatureLayer.copy());

    mSceneViewTop.setScene(sceneTop);
    mSceneViewBottom.setScene(sceneBottom);

    mSceneViewTop.setViewpointCamera(mZoomedOut);
    mSceneViewBottom.setViewpointCamera(mZoomedOut);

    mZoomButton.setOnClickListener(new View.OnClickListener() {
      @Override public void onClick(View v) {
        animatedZoom();
      }
    });

    // disable the top scene view on touch listener
    mSceneViewTop.setOnTouchListener(new DefaultSceneViewOnTouchListener(mSceneViewTop) {
      @Override public boolean onTouch(View v, MotionEvent event) {
        return false;
      }
    });

    // disable the bottom scene view on touch listener
    mSceneViewBottom.setOnTouchListener(new DefaultSceneViewOnTouchListener(mSceneViewBottom) {
      @Override public boolean onTouch(View v, MotionEvent event) {
        return false;
      }
    });
  }

  /**
   * Controls animated zoom and updates the 'navigating' text view.
   */
  private void animatedZoom() {
    mZoomButton.setClickable(false);
    mNavigatingTextView.setVisibility(View.VISIBLE);
    zoomTo(mZoomedIn, 5).addDoneListener(new Runnable() {
      @Override public void run() {
        mNavigatingTextView.setVisibility(View.INVISIBLE);
        zoomTo(mZoomedIn, 3).addDoneListener(new Runnable() {
          @Override public void run() {
            mNavigatingTextView.setVisibility(View.VISIBLE);
            zoomTo(mZoomedOut, 5).addDoneListener(new Runnable() {
              @Override public void run() {
                mZoomButton.setClickable(true);
                mNavigatingTextView.setVisibility(View.INVISIBLE);
              }
            });
          }
        });
      }
    });
  }

  /**
   * Sets both SceneViews to a ViewpointCamera over a number of seconds.
   *
   * @param camera to which both SceneViews should be set.
   * @param seconds over which the Viewpoint is asynchronously set.
   *
   * @return a ListenableFuture representing the result of the Viewpoint change.
   */
  private ListenableFuture<Boolean> zoomTo(Camera camera, int seconds) {
    ListenableFuture<Boolean> setViewpointFuture = mSceneViewTop.setViewpointCameraAsync(camera, seconds);
    mSceneViewBottom.setViewpointCameraAsync(camera, seconds);
    return setViewpointFuture;
  }

  @Override
  protected void onPause() {
    super.onPause();
    mSceneViewTop.pause();
    mSceneViewBottom.pause();
  }

  @Override
  protected void onResume() {
    super.onResume();
    mSceneViewTop.resume();
    mSceneViewBottom.resume();
  }

  @Override
  protected void onDestroy() {
    super.onDestroy();
    mSceneViewTop.dispose();
    mSceneViewBottom.dispose();
  }
}


text:
#pragma once
#include <memory>
#include <vector>
#include "vec.h"
#include "objload.h"
#include "Angel.h"

using std::shared_ptr;
using std::weak_ptr;
using std::vector;
using Angel::vec3;

class GLSLAttributeBinder;

class GeometryAbstractFactory{
public:
	virtual ~GeometryAbstractFactory(){};
	virtual shared_ptr<vector<vec3<GLfloat>>> get_vertices()=0;
	virtual shared_ptr<vector<vec3<GLfloat>>> get_normals()=0;
	virtual shared_ptr<vector<vec3<GLfloat>>> get_tex_coord()=0;
	virtual shared_ptr<vector<unsigned>> get_indices()=0;
};

class OBJFactory: public GeometryAbstractFactory {
public:
	OBJFactory(const char* fn);
	virtual shared_ptr<vector<vec3<GLfloat>>> get_vertices();
	virtual shared_ptr<vector<vec3<GLfloat>>> get_normals();
	virtual shared_ptr<vector<vec3<GLfloat>>> get_tex_coord();
	virtual shared_ptr<vector<unsigned>> get_indices();
private:
	void initVertices();
	void initNormals();
	void initTexCoords();
	void initIndices();
	obj::ObjModel _model;
	shared_ptr<vector<vec3<GLfloat>>> vertices;
	shared_ptr<vector<vec3<GLfloat>>> normals;
	shared_ptr<vector<vec3<GLfloat>>> texCoords;
	shared_ptr<vector<unsigned>> indices;
};

class CubeGeometryFactory : public GeometryAbstractFactory {
public:
	CubeGeometryFactory(const float radius = 1.0) : _radius(radius) {};

	virtual shared_ptr<vector<vec3<GLfloat>>> get_vertices();
	virtual shared_ptr<vector<vec3<GLfloat>>> get_normals();
	virtual shared_ptr<vector<vec3<GLfloat>>> get_tex_coord();
	virtual shared_ptr<vector<unsigned>> get_indices();
private:
	const float _radius;
};

class PlaneGeometryFactory : public GeometryAbstractFactory {
public:
	PlaneGeometryFactory(const float radius = 1.0) : _radius(radius) {};

	virtual shared_ptr<vector<vec3<GLfloat>>> get_vertices();
	virtual shared_ptr<vector<vec3<GLfloat>>> get_normals();
	virtual shared_ptr<vector<vec3<GLfloat>>> get_tex_coord();
	virtual shared_ptr<vector<unsigned>> get_indices();
private:
	const float _radius;
};

class GeometryDelegatee {
public:
	virtual ~GeometryDelegatee() {};
protected:
	GeometryDelegatee(const shared_ptr<GeometryAbstractFactory>& factory):
		_factory(factory) {};
	shared_ptr<GeometryAbstractFactory> _factory;
public:
	virtual void send_to_gpu()=0;
	virtual void pre_render()=0;
	virtual void post_render()=0;
	virtual void render()=0;
};

class VAODelegatee : public GeometryDelegatee {
public:
	VAODelegatee(const shared_ptr<GeometryAbstractFactory>& factory,
		const weak_ptr<GLSLAttributeBinder>& glslBinder);
	virtual void send_to_gpu();
	virtual void pre_render();
	virtual void post_render();
	virtual void render();
private:
	weak_ptr<GLSLAttributeBinder> _glslBinder;
	unsigned int _vao;
	unsigned _num_indices;
};

class VAOFreeableDelegatee : public VAODelegatee {
public:
	VAOFreeableDelegatee(const shared_ptr<GeometryAbstractFactory>& factory,
		const shared_ptr<GLSLAttributeBinder>& glslBinder) :
		VAODelegatee(factory, glslBinder) {};
	/**
	 * When push comes to shove, free the host-side memory by releasing
	 * ownership of the current geometry factory.
	 */
	virtual void freeCPUMemory();
};

class VirModel {
public:
	virtual ~VirModel() {};
	VirModel(const shared_ptr<GeometryDelegatee>& delegatee) :
		_delegatee(delegatee) {_delegatee->send_to_gpu();};
	shared_ptr<GeometryDelegatee> _delegatee;
public:
	virtual void render() {
		_delegatee->pre_render();
		_delegatee->render();
		_delegatee->post_render();
	}
};


text:
<?php

namespace Cartalyst\Stripe\Api;

class FileUploads extends Files
{
    // This class exist to maintain backward compatibility
}


text:
package br.com.objectos.way.xls;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * @author marcio.endo@objectos.com.br (Marcio Endo)
 */
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.SOURCE)
public @interface Style {

  Alignment alignment() default Alignment.LEFT;

  boolean bold() default false;

  boolean italic() default false;

  boolean strike() default false;

  boolean underline() default false;

}


text:
package com.coding4people.mosquitoreport.api.exceptionmappers;

import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
import javax.ws.rs.ext.ExceptionMapper;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;

public class InternalServerErrorExceptionMapper implements ExceptionMapper<Throwable> {
    @Override
    public Response toResponse(Throwable exception) {
        exception.printStackTrace();

        ObjectNode error = new ObjectMapper().createObjectNode();
        error.put("status", "error");
        error.put("message", "Internal server error");

        return Response.status(Status.INTERNAL_SERVER_ERROR).entity(error).type("application/json;charset=UTF-8")
                .build();
    }
}


text:
package org.openhubframework.openhub.modules;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Profile;
import org.springframework.stereotype.Component;

import org.openhubframework.openhub.api.entity.ErrorsCatalog;

/**
 * Module "example" properties.
 *
 * @author Petr Juza
 * @since 2.0
 */
@Component
@ConfigurationProperties(prefix = "module.example")
@Profile(ExampleProperties.EXAMPLE_PROFILE)
public class ExampleProperties {

    /**
     * Spring profile for module "example".
     */
    public static final String EXAMPLE_PROFILE = "example-module";

    /**
     * Register {@link ErrorEnum} as {@link ErrorsCatalog}.
     *
     * @return error catalog
     */
    @Bean
    public ErrorsCatalog exampleErrorCatalog() {
        return new ErrorsCatalog(ErrorEnum.class, ErrorEnum.values());
    }

}


text:
package cli

import (
	"context"
	"crypto/tls"
	"fmt"
	"net/http"

	"github.com/ory/hydra/config"
	"github.com/ory/hydra/oauth2"
	"github.com/ory/hydra/pkg"
	"github.com/spf13/cobra"
	"golang.org/x/oauth2/clientcredentials"
)

type RevocationHandler struct {
	Config *config.Config
	M      *oauth2.HTTPRecovator
}

func newRevocationHandler(c *config.Config) *RevocationHandler {
	return &RevocationHandler{
		Config: c,
		M:      &oauth2.HTTPRecovator{},
	}
}

func (h *RevocationHandler) RevokeToken(cmd *cobra.Command, args []string) {
	if ok, _ := cmd.Flags().GetBool("skip-tls-verify"); ok {
		fmt.Println("Warning: Skipping TLS Certificate Verification.")
		h.M.Client = &http.Client{Transport: &http.Transport{
			TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
		}}
	}

	h.M.Endpoint = h.Config.Resolve("/oauth2/revoke")
	h.M.Config = &clientcredentials.Config{
		ClientID:     h.Config.ClientID,
		ClientSecret: h.Config.ClientSecret,
	}

	if len(args) != 1 {
		fmt.Print(cmd.UsageString())
		return
	}

	token := args[0]
	err := h.M.RevokeToken(context.Background(), args[0])
	pkg.Must(err, "Could not revoke token: %s", err)
	fmt.Printf("Revoked token %s", token)
}


text:
import { AbstractPokerCommand } from "../../core/commands/AbstractPokerCommand";
import { SrvPlayerSecondsLeftToActData } from "../data/SrvPlayerSecondsLeftToActData";

export class SrvPlayerSecondsLeftToActCommand extends AbstractPokerCommand {
	public static NAME = "SrvPlayerSecondsLeftToAct";
	public static UID = 4150;

		public data: SrvPlayerSecondsLeftToActData;

	constructor() {
		super();
		this.init(1, 54, SrvPlayerSecondsLeftToActCommand.NAME);
	}
}


text:
#pragma once
#include <aws/quicksight/QuickSight_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <aws/core/utils/memory/stl/AWSVector.h>
#include <aws/core/utils/DateTime.h>
#include <utility>

namespace Aws
{
namespace Utils
{
namespace Json
{
  class JsonValue;
  class JsonView;
} // namespace Json
} // namespace Utils
namespace QuickSight
{
namespace Model
{

  /**
   *
A date-time parameter.

See Also:
   AWS
   * API Reference

   */
  class AWS_QUICKSIGHT_API DateTimeParameter
  {
  public:
    DateTimeParameter();
    DateTimeParameter(Aws::Utils::Json::JsonView jsonValue);
    DateTimeParameter& operator=(Aws::Utils::Json::JsonView jsonValue);
    Aws::Utils::Json::JsonValue Jsonize() const;

    /**
     *
A display name for the date-time parameter.

     */
    inline const Aws::String& GetName() const{ return m_name; }

    /**
     *
A display name for the date-time parameter.

     */
    inline bool NameHasBeenSet() const { return m_nameHasBeenSet; }

    /**
     *
A display name for the date-time parameter.

     */
    inline void SetName(const Aws::String& value) { m_nameHasBeenSet = true; m_name = value; }

    /**
     *
A display name for the date-time parameter.

     */
    inline void SetName(Aws::String&& value) { m_nameHasBeenSet = true; m_name = std::move(value); }

    /**
     *
A display name for the date-time parameter.

     */
    inline void SetName(const char* value) { m_nameHasBeenSet = true; m_name.assign(value); }

    /**
     *
A display name for the date-time parameter.

     */
    inline DateTimeParameter& WithName(const Aws::String& value) { SetName(value); return *this;}

    /**
     *
A display name for the date-time parameter.

     */
    inline DateTimeParameter& WithName(Aws::String&& value) { SetName(std::move(value)); return *this;}

    /**
     *
A display name for the date-time parameter.

     */
    inline DateTimeParameter& WithName(const char* value) { SetName(value); return *this;}

    /**
     *
The values for the date-time parameter.

     */
    inline const Aws::Vector<Aws::Utils::DateTime>& GetValues() const{ return m_values; }

    /**
     *
The values for the date-time parameter.

     */
    inline bool ValuesHasBeenSet() const { return m_valuesHasBeenSet; }

    /**
     *
The values for the date-time parameter.

     */
    inline void SetValues(const Aws::Vector<Aws::Utils::DateTime>& value) { m_valuesHasBeenSet = true; m_values = value; }

    /**
     *
The values for the date-time parameter.

     */
    inline void SetValues(Aws::Vector<Aws::Utils::DateTime>&& value) { m_valuesHasBeenSet = true; m_values = std::move(value); }

    /**
     *
The values for the date-time parameter.

     */
    inline DateTimeParameter& WithValues(const Aws::Vector<Aws::Utils::DateTime>& value) { SetValues(value); return *this;}

    /**
     *
The values for the date-time parameter.

     */
    inline DateTimeParameter& WithValues(Aws::Vector<Aws::Utils::DateTime>&& value) { SetValues(std::move(value)); return *this;}

    /**
     *
The values for the date-time parameter.

     */
    inline DateTimeParameter& AddValues(const Aws::Utils::DateTime& value) { m_valuesHasBeenSet = true; m_values.push_back(value); return *this; }

    /**
     *
The values for the date-time parameter.

     */
    inline DateTimeParameter& AddValues(Aws::Utils::DateTime&& value) { m_valuesHasBeenSet = true; m_values.push_back(std::move(value)); return *this; }

  private:

    Aws::String m_name;
    bool m_nameHasBeenSet = false;

    Aws::Vector<Aws::Utils::DateTime> m_values;
    bool m_valuesHasBeenSet = false;
  };

} // namespace Model
} // namespace QuickSight
} // namespace Aws


text:
package org.datavaultplatform.common.model.dao;

import java.util.List;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.Criteria;
import org.hibernate.criterion.Restrictions;

import org.datavaultplatform.common.model.ArchiveStore;

public class ArchiveStoreDAOImpl implements ArchiveStoreDAO {

    private SessionFactory sessionFactory;

    public void setSessionFactory(SessionFactory sessionFactory) {
        this.sessionFactory = sessionFactory;
    }

    @Override
    public void save(ArchiveStore archiveStore) {
        Session session = this.sessionFactory.openSession();
        Transaction tx = session.beginTransaction();
        session.persist(archiveStore);
        tx.commit();
        session.close();
    }

    @Override
    public void update(ArchiveStore archiveStore) {
        Session session = this.sessionFactory.openSession();
        Transaction tx = session.beginTransaction();
        session.update(archiveStore);
        tx.commit();
        session.close();
    }

    @SuppressWarnings("unchecked")
    @Override
    public List<ArchiveStore> list() {
        Session session = this.sessionFactory.openSession();
        Criteria criteria = session.createCriteria(ArchiveStore.class);
        List<ArchiveStore> archiveStores = criteria.list();
        session.close();
        return archiveStores;
    }

    @Override
    public ArchiveStore findById(String Id) {
        Session session = this.sessionFactory.openSession();
        Criteria criteria = session.createCriteria(ArchiveStore.class);
        criteria.add(Restrictions.eq("id",Id));
        ArchiveStore archiveStore = (ArchiveStore)criteria.uniqueResult();
        session.close();
        return archiveStore;
    }
}


text:
app.controller('TwitterController', function($scope,$q, twitterService) {

    //create array of tweets
    $scope.tweets=[];

    //start the twitter service
    twitterService.initialize();

    //using the OAuth authorization result get the latest 20 tweets from twitter for the user
    $scope.refreshTimeline = function(maxId) {
        //use a promise
        twitterService.getLatestTweets(maxId).then(function(data) {
            $scope.tweets = $scope.tweets.concat(data);
        },function(){
            //there is a rate limit to twitter requests
            $scope.rateLimitError = true;
        });
    }

    //when the user clicks the connect twitter button, the popup authorization window opens
    $scope.connectButton = function() {
        twitterService.connectTwitter().then(function() {
            if (twitterService.isReady()) {
                //if the authorization is successful, hide the connect button and display the tweets
                $('#connectButton').fadeOut(function(){
                    $('#getTimelineButton, #signOut').fadeIn();
                    $scope.refreshTimeline();
					          $scope.connectedTwitter = true;
                });
            } else {

			         }
        });
    }

    //sign out clears the OAuth cache, the user will have to reauthenticate when returning
    $scope.signOut = function() {
        twitterService.clearCache();
        $scope.tweets.length = 0;
        $('#getTimelineButton, #signOut').fadeOut(function(){
            $('#connectButton').fadeIn();
			$scope.$apply(function(){$scope.connectedTwitter=false})
        });
        $scope.rateLimitError = false;
    }

    //if the user is a returning user, hide the sign in button and display the tweets
    if (twitterService.isReady()) {
        $('#connectButton').hide();
        $('#getTimelineButton, #signOut').show();
     	$scope.connectedTwitter = true;
        $scope.refreshTimeline();
    }

});


text:
export const merge = (...methods) => {
	return function (/*...arguments*/) {
		return methods.reduce((merged, method) => {
			return reduceBody(merged, method, this, arguments);
		}, {});
	};
};

export const mergeRight = (...methods) => {
	return function (/*...arguments*/) {
		return methods.reduceRight((merged, method) => {
			return reduceBody(merged, method, this, arguments);
		}, {});
	};
};

function reduceBody(merged, method, context, args) {
	if (typeof method !== 'function') return merged;
	const partial = Reflect.apply(method, context, args);
	return Object.assign(merged, partial);
}


text:
  Good is filial devotion to one's mother in the world, and devotion to
  one's father is good. It is good to be a sanyasi in the world and to be
  a brahmin too. 332


text:
package ensemble.samples.animation.timelines;

import ensemble.Sample;
import ensemble.controls.SimplePropertySheet;
import java.sql.Time;
import javafx.animation.*;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.event.EventHandler;
import javafx.scene.Node;
import javafx.scene.control.Control;
import javafx.scene.control.Slider;
import javafx.scene.effect.Lighting;
import javafx.scene.input.MouseEvent;
import javafx.scene.paint.Color;
import javafx.scene.shape.Circle;
import javafx.util.Duration;

/**
 * A sample that shows various types of  interpolation  between key frames in a
 * timeline. There are five circles, each animated with a different
 * interpolation method.  The Linear interpolator is the default. Use the
 * controls to reduce opacity to zero for some circles to compare with others,
 * or change circle color to distinguish between individual interpolators.
 *
 * @see javafx.animation.Interpolator
 * @see javafx.animation.KeyFrame
 * @see javafx.animation.KeyValue
 * @see javafx.animation.Timeline
 * @see javafx.util.Duration
 */
public class InterpolatorSample extends Sample {
    private Timeline timeline = new Timeline();
    private Double x1Val, y1Val, x2Val, y2Val;
    private Circle circle1;
    private Circle circle2;
    private Circle circle3;
    private Circle circle4;
    private Circle circle5;
    public InterpolatorSample() {
        super(200,200);
        setMinHeight(Control.USE_PREF_SIZE);
        x1Val = 0.5; y1Val = 0.1; x2Val = 0.5; y2Val = 0.1;

        //create circles by method createMovingCircle listed below
        circle1 = createMovingCircle(Interpolator.LINEAR, Color.RED); //default interpolator
        circle1.setOpacity(0.7);

        circle2 = createMovingCircle(Interpolator.EASE_BOTH, Color.VIOLET); //circle slows down when reached both ends of trajectory
        circle2.setOpacity(0.45);
        circle2.setCenterY(60);

        circle3 = createMovingCircle(Interpolator.EASE_IN, Color.BLUE);
        circle3.setOpacity(0.20);
        circle3.setCenterY(95);

        circle4 = createMovingCircle(Interpolator.EASE_OUT, Color.YELLOW);
        circle4.setOpacity(0.35);
        circle4.setCenterY(130);

        circle5 = createMovingCircle(Interpolator.SPLINE(x1Val, y1Val, x2Val, y2Val), Color.GREEN); //one can define own behaviour of interpolator by spline method
        circle5.setOpacity(0.7);
        circle5.setCenterY(165);

        getChildren().addAll(
                circle1,
                circle2,
                circle3,
                circle4,
                circle5
        );

        //Slider for SPLINE//
        Slider x1 = new Slider(0.0, 1.0, 0.5);
        x1.setValue(x1Val);
        x1.valueProperty().addListener(new ChangeListener(){
            @Override public void changed(ObservableValue o, Object oldVal, Object newVal){
                x1Val = (Double) newVal;
                changeInterpolator(Interpolator.SPLINE(x1Val, y1Val, x2Val, y2Val));

            }

        });
        Slider y1 = new Slider(0.0, 1.0, 0.5);
        y1.setValue(y1Val);
        y1.valueProperty().addListener(new ChangeListener(){
            @Override public void changed(ObservableValue o, Object oldVal, Object newVal){
                y1Val = (Double) newVal;
                changeInterpolator(Interpolator.SPLINE(x1Val, y1Val, x2Val, y2Val));

            }

        });Slider x2 = new Slider(0.0, 1.0, 0.5);
        x2.setValue(x2Val);
        x2.valueProperty().addListener(new ChangeListener(){
            @Override public void changed(ObservableValue o, Object oldVal, Object newVal){
                x2Val = (Double) newVal;
                changeInterpolator(Interpolator.SPLINE(x1Val, y1Val, x2Val, y2Val));

            }

        });
        Slider y2 = new Slider(0.0, 1.0, 0.5);
        y2.setValue(y2Val);

        y2.valueProperty().addListener(new ChangeListener(){
            @Override public void changed(ObservableValue o, Object oldVal, Object newVal){
                y2Val = (Double) newVal;
                changeInterpolator(Interpolator.SPLINE(x1Val, y1Val, x2Val, y2Val));

            }

        });

        // REMOVE ME
        setControls(
                new SimplePropertySheet.PropDesc("LINEAR, Opacity", circle1.opacityProperty(), 0d, 1d),
                new SimplePropertySheet.PropDesc("LINEAR, Color", circle1.fillProperty()),
                new SimplePropertySheet.PropDesc("EASE BOTH, Opacity", circle2.opacityProperty(), 0d, 1d),
                new SimplePropertySheet.PropDesc("EASE BOTH, Color", circle2.fillProperty()),
                new SimplePropertySheet.PropDesc("EASE IN, Opacity", circle3.opacityProperty(), 0d, 1d),
                new SimplePropertySheet.PropDesc("EASE IN, Color", circle3.fillProperty()),
                new SimplePropertySheet.PropDesc("EASE OUT, Opacity", circle4.opacityProperty(), 0d, 1d),
                new SimplePropertySheet.PropDesc("EASE OUT, Color", circle4.fillProperty()),
                new SimplePropertySheet.PropDesc("SPLINE, Opacity", circle5.opacityProperty(), 0d, 1d),
                new SimplePropertySheet.PropDesc("SPLINE, Color", circle5.fillProperty()),
                new SimplePropertySheet.PropDesc("SPLINE, Control x1", x1.valueProperty(), 0d, 1d),
                new SimplePropertySheet.PropDesc("SPLINE, Control y1", y1.valueProperty(), 0d, 1d),
                new SimplePropertySheet.PropDesc("SPLINE, Control x2", x2.valueProperty(), 0d, 1d),
                new SimplePropertySheet.PropDesc("SPLINE, Control y2", y2.valueProperty(), 0d, 1d)
        );
        // END REMOVE ME
    }

        private Circle createMovingCircle(Interpolator interpolator, Color color){
            Circle circle = new Circle(25,25,35,color);
            circle.setOpacity(0.0);
            //add effect
            circle.setEffect(new Lighting());

            //create a timeline for moving the circle

            timeline.setCycleCount(Timeline.INDEFINITE);
            timeline.setAutoReverse(true);

            //create a keyValue for horizontal translation of circle to the position 155px with given interpolator
            KeyValue keyValue = new KeyValue(circle.translateXProperty(), 155, interpolator);

            //create a keyFrame with duration 4s
            KeyFrame keyFrame = new KeyFrame(Duration.seconds(4), keyValue);

            //add the keyframe to the timeline
            timeline.getKeyFrames().add(keyFrame);

            return circle;
        }

        public void changeInterpolator(Interpolator newinterpolator){
            Duration currenttime = Duration.ZERO;
            if (timeline!=null){
                currenttime = timeline.getCurrentTime();

                timeline.stop();
            }
            timeline = TimelineBuilder.create()
                    .cycleCount(Timeline.INDEFINITE)
                    .autoReverse(true)
                    .keyFrames(
                        new KeyFrame(
                            Duration.ZERO,
                            new KeyValue(circle1.translateXProperty(), 0, Interpolator.LINEAR),
                            new KeyValue(circle2.translateXProperty(), 0, Interpolator.EASE_BOTH),
                            new KeyValue(circle3.translateXProperty(), 0, Interpolator.EASE_IN),
                            new KeyValue(circle4.translateXProperty(), 0, Interpolator.EASE_OUT),
                            new KeyValue(circle5.translateXProperty(), 0, newinterpolator)
                    ),
                        new KeyFrame(
                            Duration.seconds(4),
                            new KeyValue(circle1.translateXProperty(), 155, Interpolator.LINEAR),
                            new KeyValue(circle2.translateXProperty(), 155, Interpolator.EASE_BOTH),
                            new KeyValue(circle3.translateXProperty(), 155, Interpolator.EASE_IN),
                            new KeyValue(circle4.translateXProperty(), 155, Interpolator.EASE_OUT),
                            new KeyValue(circle5.translateXProperty(), 155, newinterpolator)
                    )
                            )
                    .build();

            timeline.playFrom(currenttime);

        }

    @Override public void play() {
        timeline.play();
    }

    @Override public void stop() {
        timeline.stop();
    }

    // REMOVE ME
    public static Node createIconContent() {
        Circle circle1 = new Circle(30, 40, 10, Color.web("#1c89f4", 0.95));
        Circle circle2 = new Circle(74, 40, 10, Color.web("#1c89f4", 0.55));

        Circle circle4 = new Circle(30, 74, 10, Color.web("#1c89f4", 0.95));
        Circle circle5 = new Circle(79, 74, 10, Color.web("#1c89f4", 0.55));

        final Timeline tl = new Timeline();
        tl.setCycleCount(Timeline.INDEFINITE);
        tl.setAutoReverse(true);

        tl.getKeyFrames().addAll
            (new KeyFrame(Duration.ZERO,
                          new KeyValue(circle1.translateXProperty(), 0),
                          new KeyValue(circle4.translateXProperty(), 0, Interpolator.EASE_BOTH)),
             new KeyFrame(Duration.seconds(1.3),
                          new KeyValue(circle1.translateXProperty(), 54),
                          new KeyValue(circle4.translateXProperty(), 54, Interpolator.EASE_BOTH)));

        javafx.scene.shape.Rectangle mouseRect = new javafx.scene.shape.Rectangle (0, 0, 114,114);
        mouseRect.setFill(Color.TRANSPARENT);

        javafx.scene.Group g =
                new javafx.scene.Group(mouseRect,
                                       circle1, circle2, circle4, circle5);
        g.setEffect(new Lighting());

        g.setOnMouseEntered(new EventHandler<MouseEvent>() {
            public void handle(MouseEvent t) { tl.play(); }
        });

        g.setOnMouseExited(new EventHandler<MouseEvent>() {
            public void handle(MouseEvent t) { tl.pause(); }
        });
        return g;
    }
    // END REMOVE ME
}