text:
function hello2(){
		alert('hello 2');
}

redpajama_set_name: RedPajamaGithub


text:
package org.springframework.cloud.dataflow.server.repository;

import org.springframework.cloud.dataflow.core.TaskDefinition;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.keyvalue.repository.KeyValueRepository;
import org.springframework.transaction.annotation.Transactional;

/**
 * Repository to access {@link TaskDefinition}s.
 *
 * @author Michael Minella
 * @author Gunnar Hillert
 */
@Transactional
public interface TaskDefinitionRepository extends KeyValueRepository<TaskDefinition, String> {

	Page<TaskDefinition> findByTaskNameContains(String taskName, Pageable pageable);

	/**
	 * Performs a findByName query and throws an exception if the name is not found.
	 * @param name the name of the task definition
	 * @return The task definition instance or {@link NoSuchTaskDefinitionException} if not found.
	 */
	TaskDefinition findByTaskName(String name);
}


text:
@protocol ROSelectorDelegate <NSObject>

- (void)cancelButtonPressed;
- (void)confirmButtonPressed;
- (void)itemSelectedWithValue:(id)value;

@end

@interface ROSelectorView : UIView

+ (instancetype)newWithDisplayValues:(NSArray *)values andCancelButton:(NSString *) cancelTitle andConfirmButton:(NSString *)confirmTitle;
+ (instancetype)newWithDisplayValues:(NSArray *)values andTitle:(NSString *)title andCancelButton:(NSString *) cancelTitle andConfirmButton:(NSString *)confirmTitle;

@property (strong, nonatomic) id<ROSelectorDelegate> delegate;
@property (strong, nonatomic) UIFont *font;
@property (strong, nonatomic) UIColor *separatorColor;
@property (strong, nonatomic) NSArray *values;
@property (strong, nonatomic) UILabel *titleLabel;

- (void)setModalColor:(UIColor *)color;
- (void)setTableViewColor:(UIColor *)color;

@end


text:
import numpy as np
import os
import sys
import matplotlib.pyplot as plt
import json
from mpl_toolkits.mplot3d import Axes3D

#sys.path.append(os.path.join(os.path.dirname(__file__),"../"))
from crowdsourcing.interfaces.mechanical_turk import *
from crowdsourcing.interfaces.local_webserver import *
from crowdsourcing.util.image_search import *
from crowdsourcing.annotation_types.classification import *
from crowdsourcing.annotation_types.bbox import *
from crowdsourcing.annotation_types.part import *

# directory containing the images we want to annotate
IMAGE_DIR = 'data/classification/imagenet'

OUTPUT_FOLDER = 'ImageNet4'

USE_MTURK = True
ONLINE = True
WORKERS_PER_IMAGE = 0

with open('keys.json') as f: keys = json.load(f)

# Amazon account information for paying for mturk tasks, see
# http://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSGettingStartedGuide/AWSCredentials.htm
AWS_ACCESS_KEY = keys.AWS_ACCESS_KEY
AWS_SECRET_ACCESS_KEY = AWS_SECRET_ACCESS_KEY
SANDBOX = False

# API key for Flickr image search, see https://www.flickr.com/services/api/misc.api_keys.html
FLICKR_API_KEY = keys.FLICKR_API_KEY
FLICKR_API_SECRET_KEY = keys.FLICKR_API_SECRET_KEY
MAX_PHOTOS = 4000

HOST = 'sbranson.no-ip.org'

# The name of the objects we want to collect.  Images will be obtained by crawling flickr
# image search for each object, and we want to use mturk to filter out images that
# don't contain the object of interest
CLASSES = [ { 'object_name' : 'beaker', 'definition' : 'A flatbottomed jar made of glass or plastic; used for chemistry', 'search' : ['beaker', 'beaker chemistry', 'beaker lab'], 'wikipedia_url' : 'https://en.wikipedia.org/wiki/Beaker_(glassware)', 'example_image_urls' : ['http://imagenet.stanford.edu/nodes/12/02815834/99/998d93ef3fdd9a30034cda8f0ce246b7bb13ebc4.thumb', 'http://imagenet.stanford.edu/nodes/12/02815834/51/5171dde0d020b00923d4297d88d427326846efb2.thumb', 'http://imagenet.stanford.edu/nodes/12/02815834/d0/d06ccaf38a410e0b59bfe73819eb7bd0028bb8f1.thumb', 'https://sbranson.no-ip.org/online_crowdsourcing/not_beaker.jpg' ] },
            { 'object_name' : 'scorpion', 'definition' : 'Arachnid of warm dry regions having a long segmented tail ending in a venomous stinger', 'search' : ['scorpion', 'scorpion arachnid'], 'wikipedia_url' : 'https://en.wikipedia.org/wiki/Scorpion', 'example_image_urls' : ['http://imagenet.stanford.edu/nodes/2/01770393/b0/b02dcf2c1d8c7a735b52ab74300c342124e4be5c.thumb', 'http://imagenet.stanford.edu/nodes/2/01770393/31/31af6ea97dd040ec2ddd6ae86fe1f601ecfc8c02.thumb', 'http://imagenet.stanford.edu/nodes/2/01770393/38/382e998365d5667fc333a7c8f5f6e74e3c1fe164.thumb', 'http://imagenet.stanford.edu/nodes/2/01770393/88/88bc0f14c9779fad2bc364f5f4d8269d452e26c2.thumb'] },
            { 'object_name' : 'apiary', 'definition' : 'A shed containing a number of beehives', 'search' : ['apiary'], 'wikipedia_url' : 'https://en.wikipedia.org/wiki/Apiary', 'example_image_urls' : ['http://imagenet.stanford.edu/nodes/10/02727426/1f/1f6f71add82d10edad8b3630ec26490055c70a5d.thumb', 'http://imagenet.stanford.edu/nodes/10/02727426/94/94a3624ff3e639fe2d8ae836e91ca7e8fcdd0ed7.thumb', 'http://imagenet.stanford.edu/nodes/10/02727426/15/15a37da46bddd5010d3f1d1996899b8472c9556b.thumb', 'http://imagenet.stanford.edu/nodes/10/02727426/01/013b499a063b6ea83218c5ed63ea811bce5a9974.thumb'] },
            { 'object_name' : 'cardigan', 'definition' : 'Knitted jacket that is fastened up the front with buttons or a zipper', 'search' : ['cardigan'], 'wikipedia_url' : 'https://en.wikipedia.org/wiki/Cardigan_(sweater)', 'example_image_urls' : ['http://imagenet.stanford.edu/nodes/9/02963159/d7/d7419041a96e8baf9a870c81d549ad0b345c8127.thumb', 'http://imagenet.stanford.edu/nodes/9/02963159/34/34256aaf7b10073ec16dc5ddb0b31305878de875.thumb', 'http://imagenet.stanford.edu/nodes/9/02963159/e8/e8a50045dd40da5299ee8817052edfc090b05355.thumb', 'http://imagenet.stanford.edu/nodes/9/02963159/38/38216bf40fafe4bb526fabb430188c24b968a152.thumb'] }
          ]

for c in CLASSES:
  # directories to store images  and results
  output_folder = os.path.join(OUTPUT_FOLDER, c['object_name'])
  image_folder = os.path.join('output', output_folder, 'flickr')
  if not os.path.exists(image_folder):
    os.makedirs(image_folder)

  # Download images from Flickr
  FlickrImageSearch(c['search'], image_folder, FLICKR_API_KEY, FLICKR_API_SECRET_KEY, max_photos=MAX_PHOTOS)

  # Load an unlabelled dataset by scanning a directory of images
  dataset = CrowdDatasetBinaryClassification(name=c['object_name'])
  dataset.scan_image_directory(os.path.join(image_folder, 'images'))

  if USE_MTURK:
    crowdsource = MTurkCrowdsourcer(dataset, AWS_ACCESS_KEY, AWS_SECRET_ACCESS_KEY, HOST, output_folder, sandbox=SANDBOX,
                                    hit_params = c, online = ONLINE, thumbnail_size = (100,100), initial_assignments_per_image=WORKERS_PER_IMAGE)
  else:
    crowdsource = LocalCrowdsourcer(dataset, HOST, output_folder, hit_params = c, online = ONLINE, thumbnail_size = (100,100), initial_assignments_per_image=WORKERS_PER_IMAGE, port=8080)
  crowdsource.run()


text:
Glance Style Commandments
=========================

- Step 1: Read the OpenStack Style Commandments
  https://docs.openstack.org/hacking/latest/
- Step 2: Read on

Glance Specific Commandments
----------------------------

None so far


text:
#include "getiplist.h"

#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>

static bool InitWindowsSocket()
{
#ifdef _WIN32

	WORD wVersionRequested = MAKEWORD(1, 1);
	WSADATA wsaData = { 0 };
	// WinSock init
	int ret = WSAStartup(wVersionRequested, &wsaData);

	if (ret != 0)
	{
		//WSAStartup() failed!
		return false;
	}

	// Confirm the WinSock DLL version 2.2
	if (LOBYTE(wsaData.wVersion) != 1 || HIBYTE(wsaData.wVersion) != 1)
	{
		WSACleanup();
		//Invalid WinSock version
		return false;
	}

	//WinSock init success!
#endif
	return true;
}

static void ClearWindowsSocket()
{
#ifdef _WIN32
	WSACleanup();
#endif
}

int get_ip_via_hostname(const char *host, char **ips[], int *count_of_ips)
{
	return get_ip_via_hostname_with_alloctor(host, ips, count_of_ips, malloc, free);
}

int get_ip_via_hostname_with_alloctor(const char *host, char **ips[], int *count_of_ips, alloctor alloc, freer fr)
{
	if (host == NULL || ips == NULL || count_of_ips == NULL || alloc == NULL || fr == NULL)
		return ERR_ARGS;

	struct addrinfo *result = NULL;
	char **ip = NULL;
	*ips = ip;
	*count_of_ips = 0;

	int ret = get_ip_address_via_hostname(host, &result);
	if (ret != OK)
		return ret;

	if (result == NULL)
	{
		return OK;
	}

	int count = 0;
	struct addrinfo *paddr;
	for (paddr = result; paddr != NULL; paddr = paddr->ai_next)
		count++;
	ip = (char **)alloc(count * sizeof(*ip));
	if (*ip == NULL)
		return ERR_ALLOCTOR;

	char buff[NI_MAXHOST];
	int i = 0;
	for (paddr = result; paddr != NULL; paddr = paddr->ai_next)
	{
		memset(buff, 0, sizeof(buff));
		ret = getnameinfo(paddr->ai_addr, paddr->ai_addrlen, buff, sizeof(buff), NULL, 0, NI_NUMERICHOST);
		if (ret)
		{
			// for free
			while (--i >= 0)
			{
				fr(ip[i]);
			}
			fr(ip);
			free_ip_address(result);
			return ERR_GET_IP;
		}
		ip[i] = alloc(strlen(buff) + 1);
		if (ip[i] == NULL)
		{
			// for free
			while (--i >= 0)
			{
				fr(ip[i]);
			}
			fr(ip);
			free_ip_address(result);
			return ERR_ALLOCTOR;
		}
		memcpy(ip[i], buff, strlen(buff));
		ip[i][strlen(buff)] = '\0';
		i++;
	}
	*ips = ip;
	*count_of_ips = count;
	free_ip_address(result);
	return OK;
}

int get_ip_address_via_hostname(const char *host, struct addrinfo **presult)
{
	if (host == NULL || presult == NULL)
		return ERR_ARGS;

	InitWindowsSocket();

	struct addrinfo info;
	memset(&info, 0, sizeof(info));
	info.ai_family = AF_UNSPEC; // support ipv4 and ipv6
	info.ai_socktype = SOCK_DGRAM;

	int ret = getaddrinfo(host, NULL, &info, presult);
	if (ret)
	{
		return ERR_PARSE_HOST;
	}

	return OK;
}

void free_ip_address(struct addrinfo *addr)
{
	if (addr != NULL)
		freeaddrinfo(addr);
}


text:
.class public abstract Landroid/support/v4/app/FragmentTransaction;
.super Ljava/lang/Object;
.source "FragmentTransaction.java"

# static fields
.field public static final TRANSIT_ENTER_MASK:I = 0x1000

.field public static final TRANSIT_EXIT_MASK:I = 0x2000

.field public static final TRANSIT_FRAGMENT_CLOSE:I = 0x2002

.field public static final TRANSIT_FRAGMENT_FADE:I = 0x1003

.field public static final TRANSIT_FRAGMENT_OPEN:I = 0x1001

.field public static final TRANSIT_NONE:I = 0x0

.field public static final TRANSIT_UNSET:I = -0x1

# direct methods
.method public constructor <init>()V
    .locals 0

    .prologue
    .line 26
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method

# virtual methods
.method public abstract add(ILandroid/support/v4/app/Fragment;)Landroid/support/v4/app/FragmentTransaction;
.end method

.method public abstract add(ILandroid/support/v4/app/Fragment;Ljava/lang/String;)Landroid/support/v4/app/FragmentTransaction;
.end method

.method public abstract add(Landroid/support/v4/app/Fragment;Ljava/lang/String;)Landroid/support/v4/app/FragmentTransaction;
.end method

.method public abstract addToBackStack(Ljava/lang/String;)Landroid/support/v4/app/FragmentTransaction;
.end method

.method public abstract attach(Landroid/support/v4/app/Fragment;)Landroid/support/v4/app/FragmentTransaction;
.end method

.method public abstract commit()I
.end method

.method public abstract commitAllowingStateLoss()I
.end method

.method public abstract detach(Landroid/support/v4/app/Fragment;)Landroid/support/v4/app/FragmentTransaction;
.end method

.method public abstract disallowAddToBackStack()Landroid/support/v4/app/FragmentTransaction;
.end method

.method public abstract hide(Landroid/support/v4/app/Fragment;)Landroid/support/v4/app/FragmentTransaction;
.end method

.method public abstract isAddToBackStackAllowed()Z
.end method

.method public abstract isEmpty()Z
.end method

.method public abstract remove(Landroid/support/v4/app/Fragment;)Landroid/support/v4/app/FragmentTransaction;
.end method

.method public abstract replace(ILandroid/support/v4/app/Fragment;)Landroid/support/v4/app/FragmentTransaction;
.end method

.method public abstract replace(ILandroid/support/v4/app/Fragment;Ljava/lang/String;)Landroid/support/v4/app/FragmentTransaction;
.end method

.method public abstract setBreadCrumbShortTitle(I)Landroid/support/v4/app/FragmentTransaction;
.end method

.method public abstract setBreadCrumbShortTitle(Ljava/lang/CharSequence;)Landroid/support/v4/app/FragmentTransaction;
.end method

.method public abstract setBreadCrumbTitle(I)Landroid/support/v4/app/FragmentTransaction;
.end method

.method public abstract setBreadCrumbTitle(Ljava/lang/CharSequence;)Landroid/support/v4/app/FragmentTransaction;
.end method

.method public abstract setCustomAnimations(II)Landroid/support/v4/app/FragmentTransaction;
.end method

.method public abstract setCustomAnimations(IIII)Landroid/support/v4/app/FragmentTransaction;
.end method

.method public abstract setTransition(I)Landroid/support/v4/app/FragmentTransaction;
.end method

.method public abstract setTransitionStyle(I)Landroid/support/v4/app/FragmentTransaction;
.end method

.method public abstract show(Landroid/support/v4/app/Fragment;)Landroid/support/v4/app/FragmentTransaction;
.end method


text:
A small class that creates a stack view like those seen on Path, Facebook, and more.  Closely follows the UINavigationController pattern with push and pop methods.

---
### Why?
There are a lot of really nice stack view controllers out there, but I wanted to create something that was simple to use and gave me the ability to push and pop controllers on the navigation list with no real effort.

### Using WCStackNavigationController
There are a couple of ways you can use this controller, you can either extend it, so you can design/layout your own navigation list view (which is a tableView, of course).  When extending just make sure to only override UITableView datasource methods, and if you override selectRowAtIndexPath, be sure to call super.  The other way (as a simple demo in the app delegate shows) is to just drop it in and start using it.

There is a category that adds to items to UIViewController based objects, UIViewController+WCStackNavigationController, I would throw this in your prefetch so all your view controllers can have the added attributes.

The attributes added are:

* stackTitle - This is the title you would like to see displayed on the navigation menu.
* stackIcon - The image you would like to use to display with your stackTitle on the navigation list.

#### Delegate Methods (All Optional)

```objectivec
// If Yes, when a controller in navigation is selected, the view will slide closed.
- (BOOL)stackControllerWillCloseNavigationWhenSelected;

// The size of the visible view when slide to the right
- (CGFloat)stackControllerSlideOffset;

// Allow for user to swipe the nav open/close
- (BOOL)stackControllerEnableSwipeForNavigation;

// Called before moving to a new view/view controller.
- (void)stackController:(WCStackNavigationController *)stackController willNavigateToViewController:(UIViewController *)viewController;
- (void)stackController:(WCStackNavigationController *)stackController willNavigateFromViewController:(UIViewController *)viewController;

// Called when navgation to the new controller is complete.
- (void)stackController:(WCStackNavigationController *)stackController didNavigateToViewController:(UIViewController *)viewController;
- (void)stackController:(WCStackNavigationController *)stackController didNavigateFromViewController:(UIViewController *)viewController;
```

#### Public Methods
```objectivec
// Push a controller on to the stack and display as current view
- (void)pushViewController:(UIViewController *)viewController;

// Remove a controller from the stack, if removing current controller, will move to previous controller
- (void)popViewController:(UIViewController *)viewController;

// Hides Navigation bar
- (void)setNavigationBarHidden:(BOOL)shouldHide;

// Hides Navigation bar with some animation
- (void)setNavigationBarHidden:(BOOL)shouldHide animated:(BOOL)animated;
```

#### Customization

If you want to customize the look of your our stack nav controller, you can. If you wish to alter the cells, you just have to extend WCStackNavigationController and simply overwrite:

```objectivec
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
```

---

#### Notes:

* This project uses ARC
* Initial project with many plans to expand.

#### To-Dos
* Ability to not have/not add item to the navigation list
* Optional Right side menu/nav.

---

#### Screenshot:
![ScreenShot](https://github.com/wess/WCStackNavigationController/raw/master/screenshot.png)

---

As usual, if you have any suggestions, contributions, etc.. Feel free to message me here or hit me up on twitter (@wesscope).

Thanks,

Wess


text:
namespace blink {

class WebMemoryPressureListener {
 public:
  // Called when a memory pressure notification is received.
  BLINK_PLATFORM_EXPORT static void OnMemoryPressure(WebMemoryPressureLevel);

  BLINK_PLATFORM_EXPORT static void OnPurgeMemory();
};

}  // namespace blink

#endif  // THIRD_PARTY_BLINK_PUBLIC_PLATFORM_WEB_MEMORY_PRESSURE_LISTENER_H_


text:
All notable changes to this project will be documented in this file. Dates are displayed in UTC.

Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

#### [v0.10.6](https://github.com/metakermit/generator-django-rest/compare/v0.10.5...v0.10.6)

> 30 December 2019

- update CHANGELOG.md [`9cf98e7`](https://github.com/metakermit/generator-django-rest/commit/9cf98e7e1de5d9dfb14a3ccc2b28b461abb551fd)
- we still need psycopg2-binary after all [`fefda66`](https://github.com/metakermit/generator-django-rest/commit/fefda6622c16f53830b99293a47ada1009cbe70b)

#### [v0.10.5](https://github.com/metakermit/generator-django-rest/compare/v0.10.4...v0.10.5)

> 30 December 2019

- update docs [`7c33622`](https://github.com/metakermit/generator-django-rest/commit/7c336229ef3df1680b52d1a6777064c03763058b)
- rearrange dependencies and remove tests for now [`1d9c2e6`](https://github.com/metakermit/generator-django-rest/commit/1d9c2e6643ead6bd95b5190b1afce0af428aea10)
- update CHANGELOG.md [`559f86f`](https://github.com/metakermit/generator-django-rest/commit/559f86fcaea4efc73b594e1d029df37bc1271269)

#### [v0.10.4](https://github.com/metakermit/generator-django-rest/compare/v0.10.3...v0.10.4)

> 28 December 2019

- install.sh & start.sh (instead of setup.sh & dev.sh) [`0eafc1f`](https://github.com/metakermit/generator-django-rest/commit/0eafc1f3182c16c7eddc587ef4004148f56d389d)
- update CHANGELOG.md [`d118a9e`](https://github.com/metakermit/generator-django-rest/commit/d118a9ef2119cefc8532dc3d570b478d847fafca)

#### [v0.10.3](https://github.com/metakermit/generator-django-rest/compare/v0.10.2...v0.10.3)

> 27 December 2019

- update index.html to query the API [`f2254e4`](https://github.com/metakermit/generator-django-rest/commit/f2254e49aa081085eaa88f4614166687b83dfb0a)
- update CHANGELOG.md [`6dcfc58`](https://github.com/metakermit/generator-django-rest/commit/6dcfc5813c735495cd53dfe8b03ddf4bbcd1ce5d)

#### [v0.10.2](https://github.com/metakermit/generator-django-rest/compare/v0.10.1...v0.10.2)

> 24 December 2019

- Bump django from 3.0 to 3.0.1 in /generators/app/templates/django/mysite [`#35`](https://github.com/metakermit/generator-django-rest/pull/35)
- dokku support [`566894b`](https://github.com/metakermit/generator-django-rest/commit/566894b61b40a08a6ddede96b9a5123ad7994a31)
- update CHANGELOG.md [`3daac35`](https://github.com/metakermit/generator-django-rest/commit/3daac3573e13fa34b0df1ea4dc0023c6cc6ad8bf)
- use newer node versions [`577805c`](https://github.com/metakermit/generator-django-rest/commit/577805c71fea9cb05f8e878668757fa92f5a81f5)

#### [v0.10.1](https://github.com/metakermit/generator-django-rest/compare/v0.10.0...v0.10.1)

> 24 December 2019

- disable docker test for now [`3a58461`](https://github.com/metakermit/generator-django-rest/commit/3a58461f7493b64adc7867d053dbf4fed8eeab3f)
- update CHANGELOG.md [`ae40eaa`](https://github.com/metakermit/generator-django-rest/commit/ae40eaaeee08a41ffebee3cc153f1133f91eb190)

#### [v0.10.0](https://github.com/metakermit/generator-django-rest/compare/v0.9.0...v0.10.0)

> 24 December 2019

- update dev dependencies [`0e7388e`](https://github.com/metakermit/generator-django-rest/commit/0e7388efbbc2a1b5eb7656f2537f0650b22dccc1)
- update yeoman dependencies [`47d2b25`](https://github.com/metakermit/generator-django-rest/commit/47d2b2583b021c338c994403a547a38b447a33bc)
- npm audit fix [`b141774`](https://github.com/metakermit/generator-django-rest/commit/b141774546248bb0404014ff06b7f16ef4c4c7f7)

#### [v0.9.0](https://github.com/metakermit/generator-django-rest/compare/v0.8.2...v0.9.0)

> 24 December 2019

- Scheduled monthly dependency update for October [`#14`](https://github.com/metakermit/generator-django-rest/pull/14)
- update dependencies to support Django 3.0 [`7ae31b2`](https://github.com/metakermit/generator-django-rest/commit/7ae31b2288b1d5a810a453da509e9d4d5d6fe136)
- lots of small changes: [`373e285`](https://github.com/metakermit/generator-django-rest/commit/373e2853d75737795a4afa10b7f4c6fc83383fca)
- Update pillow from 5.2.0 to 5.3.0 [`74af8de`](https://github.com/metakermit/generator-django-rest/commit/74af8ded85779f1a5f7df671e34a5dea78a0604d)

#### [v0.8.2](https://github.com/metakermit/generator-django-rest/compare/v0.8.1...v0.8.2)

> 14 September 2018

- add link to HACKING.md file in the repo [`#13`](https://github.com/metakermit/generator-django-rest/pull/13)
- some refactoring and reintroduce Pipfile.lock (problems otherwise) [`9b34c3f`](https://github.com/metakermit/generator-django-rest/commit/9b34c3fb8923e02dfff99fd30ba4afd71e5b415f)
- remove Pipfile.lock, bump to Python 3.7 [`562861e`](https://github.com/metakermit/generator-django-rest/commit/562861e873971d2186516e6b33eff469976fea3c)
- more precisely explain the origin of HACKING.md [`b95bae6`](https://github.com/metakermit/generator-django-rest/commit/b95bae6eecad9b98db38e4f7c58058bfb95e75a0)

#### [v0.8.1](https://github.com/metakermit/generator-django-rest/compare/v0.8.0...v0.8.1)

> 8 August 2018

- Snapshot testing [`#11`](https://github.com/metakermit/generator-django-rest/pull/11)
- add snapshottesting to requirements, have Docker build install dev requirements [`c5019ed`](https://github.com/metakermit/generator-django-rest/commit/c5019ed60393c8f051f39b37c54a5e616f1e8946)
- add test for building application and running app tests [`42e8cd5`](https://github.com/metakermit/generator-django-rest/commit/42e8cd5484552ef25ead71a3c1a972d85f9d8ab3)
- defubar docker routines [`be42661`](https://github.com/metakermit/generator-django-rest/commit/be426612f45f2a08eeebdfa6171a118fed7bd4c3)

#### [v0.8.0](https://github.com/metakermit/generator-django-rest/compare/v0.7.1...v0.8.0)

> 11 July 2018

- Graphql doc [`#10`](https://github.com/metakermit/generator-django-rest/pull/10)
- add docker documentation [`#9`](https://github.com/metakermit/generator-django-rest/pull/9)
- Yank `pipenv run` from docker since deps are installed at system level. [`#8`](https://github.com/metakermit/generator-django-rest/pull/8)
- graphql with batteries [`#7`](https://github.com/metakermit/generator-django-rest/pull/7)
- update for generator-generator 4.0.2 & security fixes [`c3800a4`](https://github.com/metakermit/generator-django-rest/commit/c3800a49da7584916a744e97860e4dddf4cfa9dd)
- regenerate pipfile lock to include graphene [`9f5061e`](https://github.com/metakermit/generator-django-rest/commit/9f5061efc4b00fe2c948bd0ecfcae99887fa0c4f)
- docker: notify failure to install deps at build time [`284d409`](https://github.com/metakermit/generator-django-rest/commit/284d409254ac1519debe7bccd33125c812976044)

#### [v0.7.1](https://github.com/metakermit/generator-django-rest/compare/v0.7.0...v0.7.1)

> 3 April 2018

- sync Pipfile.lock [`64c68c9`](https://github.com/metakermit/generator-django-rest/commit/64c68c9d0342619894a7fba05ef43dfb1bb21286)
- update CHANGELOG.md [`7a05fc6`](https://github.com/metakermit/generator-django-rest/commit/7a05fc6b403d525c43081dcaa4818f6fd4fcae40)

#### [v0.7.0](https://github.com/metakermit/generator-django-rest/compare/v0.6.0...v0.7.0)

> 3 April 2018

- upgrade to Django 2.0 [`7cb56b9`](https://github.com/metakermit/generator-django-rest/commit/7cb56b94a02a35e849aae9cb14f9a2fde0fc0471)
- update the README [`755787f`](https://github.com/metakermit/generator-django-rest/commit/755787ff3a32d51f6d48c467ec1421fca96fed4f)
- Travis auto-deploy tagged versions to npm [`e84274e`](https://github.com/metakermit/generator-django-rest/commit/e84274ed78ff5ceca632510bb10c3556fd0e857a)

#### [v0.6.0](https://github.com/metakermit/generator-django-rest/compare/v0.5.1...v0.6.0)

> 3 April 2018

- Config file for pyup.io [`#4`](https://github.com/metakermit/generator-django-rest/pull/4)
- upe Pipenv instead of just pip [`44e7dc6`](https://github.com/metakermit/generator-django-rest/commit/44e7dc6226e659e316b85ba153dde565b3fe8b44)
- add auto-generated CHANGELOG [`21b37a5`](https://github.com/metakermit/generator-django-rest/commit/21b37a5f2ff1a8be23b02de2451172bc586f5749)
- create pyup.io config file [`268fbe0`](https://github.com/metakermit/generator-django-rest/commit/268fbe017ef1242b393ecec9842154b11c6b87cf)

#### [v0.5.1](https://github.com/metakermit/generator-django-rest/compare/v0.5.0...v0.5.1)

> 15 March 2018

- prepare instead of prepublish [`ddb4645`](https://github.com/metakermit/generator-django-rest/commit/ddb464513ae7a30c5d19bd7e327cbbe0ce6dd3bc)

#### [v0.5.0](https://github.com/metakermit/generator-django-rest/compare/v0.4.3...v0.5.0)

> 15 March 2018

- Docker enhancements [`#3`](https://github.com/metakermit/generator-django-rest/pull/3)
- Fix dockerfile requirements location [`#2`](https://github.com/metakermit/generator-django-rest/pull/2)
- add package-lock.json [`f5eeb1d`](https://github.com/metakermit/generator-django-rest/commit/f5eeb1d1048236deccf0a7acb1f5908f7acc6525)
- fix broken dependency [`4ef37fc`](https://github.com/metakermit/generator-django-rest/commit/4ef37fc3dee8d745e590ea0be4ec71c6dffa4cd0)
- docker-compose should have all the necessary services and environment variables to boot out of the box [`bbb1756`](https://github.com/metakermit/generator-django-rest/commit/bbb175671bbc0b09a1e54f037a34508f8917ce01)

#### [v0.4.3](https://github.com/metakermit/generator-django-rest/compare/v0.4.2...v0.4.3)

> 1 September 2017

- set the Django SPA storage [`7aea410`](https://github.com/metakermit/generator-django-rest/commit/7aea410f3582c1f66e373ebc694bfd8064f27ff1)

#### [v0.4.2](https://github.com/metakermit/generator-django-rest/compare/v0.4.1...v0.4.2)

> 10 August 2017

- fix prod gitignore deploy [`7ee78a9`](https://github.com/metakermit/generator-django-rest/commit/7ee78a9dbbc73476cc8ff8643cc8f4447299c396)

#### [v0.4.1](https://github.com/metakermit/generator-django-rest/compare/v0.4.0...v0.4.1)

> 3 August 2017

- build explanation [`5d9029e`](https://github.com/metakermit/generator-django-rest/commit/5d9029ef8fe9c0e62ce5c744ff2396bfd362b819)
- improving some rough edges [`d225f9a`](https://github.com/metakermit/generator-django-rest/commit/d225f9ad505a0b89dd3e5370d68925433b502161)

#### [v0.4.0](https://github.com/metakermit/generator-django-rest/compare/v0.3.2...v0.4.0)

> 3 August 2017

- git urls & a prod gitignore [`b9d390c`](https://github.com/metakermit/generator-django-rest/commit/b9d390cd63d11b48c40184b8853c56fc2bd7d2ed)
- optional create-react-app frontend [`b6a0f76`](https://github.com/metakermit/generator-django-rest/commit/b6a0f76c26258783933dc15577ef8c544143f354)
- add anymail [`f990dab`](https://github.com/metakermit/generator-django-rest/commit/f990dab9aa297f51539e45a4f3f8a2e88f1ebf2e)

#### [v0.3.2](https://github.com/metakermit/generator-django-rest/compare/v0.3.1...v0.3.2)

> 20 March 2017

- fix package.json metadata [`dcd3784`](https://github.com/metakermit/generator-django-rest/commit/dcd378459be3eedb08a3612b0e537568699a589b)

#### [v0.3.1](https://github.com/metakermit/generator-django-rest/compare/v0.2.1...v0.3.1)

> 20 March 2017

- update settings with django-environ [`155b1f5`](https://github.com/metakermit/generator-django-rest/commit/155b1f5591d73a1956a9aff9745c3cc77e5ac508)
- new devsetup script [`1007188`](https://github.com/metakermit/generator-django-rest/commit/1007188e5d1c765aedbe7f27de06240569af3b2b)
- celery config [`7ca332f`](https://github.com/metakermit/generator-django-rest/commit/7ca332f48b158245f8e9d5877fa429fb766bc117)

#### [v0.2.1](https://github.com/metakermit/generator-django-rest/compare/v0.2.0...v0.2.1)

> 18 February 2016

- update gitignore [`4645e8d`](https://github.com/metakermit/generator-django-rest/commit/4645e8d6484a7b97022afb2ee4f547ca6eb5402e)
- fixes for project file copying [`c0377ca`](https://github.com/metakermit/generator-django-rest/commit/c0377caf56d0ca3e8a6242e266c65f81cb6a4186)
- set requirements as per my other projects [`9dd6dd7`](https://github.com/metakermit/generator-django-rest/commit/9dd6dd79939d6a5b50136e60295ae9596bd9fca5)

#### v0.2.0

> 18 February 2016

- yo generator [`38e9ea2`](https://github.com/metakermit/generator-django-rest/commit/38e9ea2243a6045720ccf3c7c66d039a7ed9e412)
- django-admin startproject mysite; adapt index.js [`fb238c5`](https://github.com/metakermit/generator-django-rest/commit/fb238c515c31764acce5be8bed08420bd9c824cd)
- update to yeoman-generator 0.21.1 [`76e16a8`](https://github.com/metakermit/generator-django-rest/commit/76e16a8dacddfea697184ed2191c3f56a2d30b87)


text:
package de.txtdata.socialradar;

import de.txtdata.socialradar.es.ElasticsearchConnectionManager;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.index.query.BaseQueryBuilder;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.index.query.RangeFilterBuilder;
import org.elasticsearch.search.aggregations.bucket.terms.Terms;

import static org.elasticsearch.search.aggregations.AggregationBuilders.terms;

import java.util.Collection;
import java.util.Date;
import java.util.TreeMap;

/**
 * Class to detect hotspots.
 */
public class HotspotFinder {

    public HotspotFinder(){
        new ElasticsearchConnectionManager();
    }

    public void findHotspots(int timeSpanInMinutes){
        this.findHotspots(timeSpanInMinutes, null);
    }

    public void findHotspots(int timeSpanInMinutes, String queryString){
        long timeCutoff = ((new Date().getTime()/1000) - timeSpanInMinutes * 60);
        long now = (new Date().getTime()/1000) + 60;  // + 60 is just to make sure to not miss anything
        RangeFilterBuilder nrFilter = new RangeFilterBuilder("indexDate")
                .from(timeCutoff)
                .to(now);

        BaseQueryBuilder qb;
        if (queryString!=null) {
            qb = QueryBuilders.queryString(queryString);
        }else{
            qb = QueryBuilders.matchAllQuery();
        }

        SearchResponse response = ElasticsearchConnectionManager.getClient()
                .prepareSearch(ElasticsearchConnectionManager.getInstance().getPostIndexName())
                .setQuery(QueryBuilders.filteredQuery(qb, nrFilter))
                .addAggregation(terms("geohash").field("coordinates.geohash").include(".{7}").size(50))
                .execute()
                .actionGet();

        Terms  terms = response.getAggregations().get("geohash");
        Collection<Terms.Bucket> buckets = terms.getBuckets();

        TreeMap<Double,Hotspot> sortedHotspots = new TreeMap<>();
        for (Terms.Bucket bucket : buckets){
            String hash = bucket.getKey();
            Hotspot hotspot = new Hotspot(hash, timeSpanInMinutes);
            sortedHotspots.put(hotspot.getScore(),hotspot);
        }
        for (Hotspot hotspot  : sortedHotspots.descendingMap().values()){
            if (hotspot.getScore()>0.1) {
                System.out.println(hotspot.toString(true));
            }
        }
    }

    public static void main(String[] args){
        HotspotFinder hf = new HotspotFinder();
        hf.findHotspots(120);
    }

}


text:
<?php

namespace App;

use Baum\Node;

class Category extends Node
{
    protected $table = 'categories';

    protected $fillable = ['name'];

    public function products() {
        return $this->belongsToMany('App\Product', "category_product")->withTimestamps();
    }
}


text:
package com.azure.data.cosmos.rx;

import com.azure.data.cosmos.CosmosClient;
import com.azure.data.cosmos.CosmosClientBuilder;
import com.azure.data.cosmos.CosmosContainer;
import com.azure.data.cosmos.CosmosContainerProperties;
import com.azure.data.cosmos.CosmosDatabase;
import com.azure.data.cosmos.CosmosDatabaseForTest;
import com.azure.data.cosmos.FeedOptions;
import com.azure.data.cosmos.FeedResponse;
import com.azure.data.cosmos.PartitionKeyDefinition;
import com.azure.data.cosmos.internal.FeedResponseListValidator;
import com.azure.data.cosmos.internal.FeedResponseValidator;
import org.apache.commons.lang3.StringUtils;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Factory;
import org.testng.annotations.Test;
import reactor.core.publisher.Flux;

import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import java.util.stream.Collectors;

import static org.assertj.core.api.Assertions.assertThat;

public class CollectionQueryTest extends TestSuiteBase {
    private final static int TIMEOUT = 30000;
    private final String databaseId = CosmosDatabaseForTest.generateId();
    private List<CosmosContainer> createdCollections = new ArrayList<>();
    private CosmosClient client;
    private CosmosDatabase createdDatabase;

   @Factory(dataProvider = "clientBuilders")
    public CollectionQueryTest(CosmosClientBuilder clientBuilder) {
        super(clientBuilder);
        this.subscriberValidationTimeout = TIMEOUT;
    }

    @Test(groups = { "simple" }, timeOut = TIMEOUT)
    public void queryCollectionsWithFilter() throws Exception {

        String filterCollectionId = createdCollections.get(0).id();
        String query = String.format("SELECT * from c where c.id = '%s'", filterCollectionId);

        FeedOptions options = new FeedOptions();
        options.maxItemCount(2);
        Flux<FeedResponse<CosmosContainerProperties>> queryObservable = createdDatabase.queryContainers(query, options);

        List<CosmosContainer> expectedCollections = createdCollections.stream()
                .filter(c -> StringUtils.equals(filterCollectionId, c.id()) ).collect(Collectors.toList());

        assertThat(expectedCollections).isNotEmpty();

        int expectedPageSize = (expectedCollections.size() + options.maxItemCount() - 1) / options.maxItemCount();

        FeedResponseListValidator<CosmosContainerProperties> validator = new FeedResponseListValidator.Builder<CosmosContainerProperties>()
                .totalSize(expectedCollections.size())
                .exactlyContainsInAnyOrder(expectedCollections.stream().map(d -> d.read().block().properties().resourceId()).collect(Collectors.toList()))
                .numberOfPages(expectedPageSize)
                .pageSatisfy(0, new FeedResponseValidator.Builder<CosmosContainerProperties>()
                        .requestChargeGreaterThanOrEqualTo(1.0).build())
                .build();

        validateQuerySuccess(queryObservable, validator, 10000);
    }

    @Test(groups = { "simple" }, timeOut = TIMEOUT)
    public void queryAllCollections() throws Exception {

        String query = "SELECT * from c";

        FeedOptions options = new FeedOptions();
        options.maxItemCount(2);
        Flux<FeedResponse<CosmosContainerProperties>> queryObservable = createdDatabase.queryContainers(query, options);

        List<CosmosContainer> expectedCollections = createdCollections;

        assertThat(expectedCollections).isNotEmpty();

        int expectedPageSize = (expectedCollections.size() + options.maxItemCount() - 1) / options.maxItemCount();

        FeedResponseListValidator<CosmosContainerProperties> validator = new FeedResponseListValidator.Builder<CosmosContainerProperties>()
                .totalSize(expectedCollections.size())
                .exactlyContainsInAnyOrder(expectedCollections.stream().map(d -> d.read().block().properties().resourceId()).collect(Collectors.toList()))
                .numberOfPages(expectedPageSize)
                .pageSatisfy(0, new FeedResponseValidator.Builder<CosmosContainerProperties>()
                        .requestChargeGreaterThanOrEqualTo(1.0).build())
                .build();

        validateQuerySuccess(queryObservable, validator, 10000);
    }

    @Test(groups = { "simple" }, timeOut = TIMEOUT)
    public void queryCollections_NoResults() throws Exception {

        String query = "SELECT * from root r where r.id = '2'";
        FeedOptions options = new FeedOptions();
        options.enableCrossPartitionQuery(true);
        Flux<FeedResponse<CosmosContainerProperties>> queryObservable = createdDatabase.queryContainers(query, options);

        FeedResponseListValidator<CosmosContainerProperties> validator = new FeedResponseListValidator.Builder<CosmosContainerProperties>()
                .containsExactly(new ArrayList<>())
                .numberOfPages(1)
                .pageSatisfy(0, new FeedResponseValidator.Builder<CosmosContainerProperties>()
                        .requestChargeGreaterThanOrEqualTo(1.0).build())
                .build();
        validateQuerySuccess(queryObservable, validator);
    }

    @BeforeClass(groups = { "simple" }, timeOut = SETUP_TIMEOUT)
    public void beforeClass() throws Exception {
        client = clientBuilder().build();
        createdDatabase = createDatabase(client, databaseId);

        PartitionKeyDefinition partitionKeyDef = new PartitionKeyDefinition();
        ArrayList<String> paths = new ArrayList<String>();
        paths.add("/mypk");
        partitionKeyDef.paths(paths);

        CosmosContainerProperties collection = new CosmosContainerProperties(UUID.randomUUID().toString(), partitionKeyDef);
        createdCollections.add(createCollection(client, databaseId, collection));
    }

    @AfterClass(groups = { "simple" }, timeOut = SHUTDOWN_TIMEOUT, alwaysRun = true)
    public void afterClass() {
        safeDeleteDatabase(createdDatabase);
        safeClose(client);
    }
}


text:
import {DeferrableType} from "../../metadata/types/DeferrableType";
import {OnDeleteType} from "../../metadata/types/OnDeleteType";
import {OnUpdateType} from "../../metadata/types/OnUpdateType";

/**
 * Describes all relation's options.
 */
export interface RelationOptions {

    /**
     * Sets cascades options for the given relation.
     * If set to true then it means that related object can be allowed to be inserted or updated in the database.
     * You can separately restrict cascades to insertion or updation using following syntax:
     *
     * cascade: ["insert", "update", "remove", "soft-remove", "recover"] // include or exclude one of them
     */
    cascade?: boolean|("insert"|"update"|"remove"|"soft-remove"|"recover")[];

    /**
     * Indicates if relation column value can be nullable or not.
     */
    nullable?: boolean;

    /**
     * Database cascade action on delete.
     */
    onDelete?: OnDeleteType;

    /**
     * Database cascade action on update.
     */
    onUpdate?: OnUpdateType;

    /**
     * Indicate if foreign key constraints can be deferred.
     */
    deferrable?: DeferrableType;

    /**
     * Indicates if this relation will be a primary key.
     * Can be used only for many-to-one and owner one-to-one relations.
     */
    primary?: boolean;

    /**
     * Set this relation to be lazy. Note: lazy relations are promises. When you call them they return promise
     * which resolve relation result then. If your property's type is Promise then this relation is set to lazy automatically.
     */
    lazy?: boolean;

    /**
     * Set this relation to be eager.
     * Eager relations are always loaded automatically when relation's owner entity is loaded using find* methods.
     * Only using QueryBuilder prevents loading eager relations.
     * Eager flag cannot be set from both sides of relation - you can eager load only one side of the relationship.
     */
    eager?: boolean;

    /**
     * Indicates if persistence is enabled for the relation.
     * By default its enabled, but if you want to avoid any changes in the relation to be reflected in the database you can disable it.
     * If its disabled you can only change a relation from inverse side of a relation or using relation query builder functionality.
     * This is useful for performance optimization since its disabling avoid multiple extra queries during entity save.
     */
    persistence?: boolean;

}


text:
using System;

namespace Quilt4Net.Core.DataTransfer
{
    public class ServiceLogResponse
    {
        public DateTime LogTime { get; set; }
        public string Message { get; set; }
        public string Level { get; set; }
    }
}


text:
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Form2
    Inherits System.Windows.Forms.Form

    'Form overrides dispose to clean up the component list.
    <System.Diagnostics.DebuggerNonUserCode()> _
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        Try
            If disposing AndAlso components IsNot Nothing Then
                components.Dispose()
            End If
        Finally
            MyBase.Dispose(disposing)
        End Try
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.
    'Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()> _
    Private Sub InitializeComponent()
        Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(Form2))
        Me.btn_cancel2 = New System.Windows.Forms.Button()
        Me.btn_agree = New System.Windows.Forms.Button()
        Me.rtb_terms = New System.Windows.Forms.RichTextBox()
        Me.Label1 = New System.Windows.Forms.Label()
        Me.SuspendLayout()
        '
        'btn_cancel2
        '
        Me.btn_cancel2.Cursor = System.Windows.Forms.Cursors.Hand
        Me.btn_cancel2.Location = New System.Drawing.Point(365, 282)
        Me.btn_cancel2.Name = "btn_cancel2"
        Me.btn_cancel2.Size = New System.Drawing.Size(67, 24)
        Me.btn_cancel2.TabIndex = 0
        Me.btn_cancel2.UseVisualStyleBackColor = True
        '
        'btn_agree
        '
        Me.btn_agree.Cursor = System.Windows.Forms.Cursors.Hand
        Me.btn_agree.Location = New System.Drawing.Point(219, 282)
        Me.btn_agree.Name = "btn_agree"
        Me.btn_agree.Size = New System.Drawing.Size(137, 22)
        Me.btn_agree.TabIndex = 1
        Me.btn_agree.UseVisualStyleBackColor = True
        '
        'rtb_terms
        '
        Me.rtb_terms.BackColor = System.Drawing.Color.DarkOliveGreen
        Me.rtb_terms.BorderStyle = System.Windows.Forms.BorderStyle.None
        Me.rtb_terms.ForeColor = System.Drawing.SystemColors.ScrollBar
        Me.rtb_terms.Location = New System.Drawing.Point(135, 104)
        Me.rtb_terms.Name = "rtb_terms"
        Me.rtb_terms.Size = New System.Drawing.Size(294, 137)
        Me.rtb_terms.TabIndex = 2
        Me.rtb_terms.Text = resources.GetString("rtb_terms.Text")
        '
        'Label1
        '
        Me.Label1.AutoSize = True
        Me.Label1.BackColor = System.Drawing.Color.FromArgb(CType(CType(24, Byte), Integer), CType(CType(24, Byte), Integer), CType(CType(24, Byte), Integer))
        Me.Label1.Font = New System.Drawing.Font("AzoSansW01-Medium", 7.999999!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label1.ForeColor = System.Drawing.Color.FromArgb(CType(CType(69, Byte), Integer), CType(CType(116, Byte), Integer), CType(CType(35, Byte), Integer))
        Me.Label1.Location = New System.Drawing.Point(12, 24)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(105, 18)
        Me.Label1.TabIndex = 5
        Me.Label1.Text = "Version 367.55"
        '
        'Form2
        '
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None
        Me.BackgroundImage = Global.Nvidia_Graphics_Driver_Installer.My.Resources.Resources.Screenshot_80
        Me.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch
        Me.ClientSize = New System.Drawing.Size(441, 310)
        Me.Controls.Add(Me.Label1)
        Me.Controls.Add(Me.rtb_terms)
        Me.Controls.Add(Me.btn_agree)
        Me.Controls.Add(Me.btn_cancel2)
        Me.DoubleBuffered = True
        Me.ForeColor = System.Drawing.Color.Transparent
        Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None
        Me.MaximizeBox = False
        Me.MinimizeBox = False
        Me.Name = "Form2"
        Me.ShowIcon = False
        Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub

    Friend WithEvents btn_cancel2 As Button
    Friend WithEvents btn_agree As Button
    Friend WithEvents rtb_terms As RichTextBox
    Friend WithEvents Label1 As Label
End Class


text:
#ifndef __W1_H
#define __W1_H

/**
 * struct w1_reg_num - broken out slave device id
 *
 * @family: identifies the type of device
 * @id: along with family is the unique device id
 * @crc: checksum of the other bytes
 */
struct w1_reg_num
{
#if defined(__LITTLE_ENDIAN_BITFIELD)
	__u64	family:8,
		id:48,
		crc:8;
#elif defined(__BIG_ENDIAN_BITFIELD)
	__u64	crc:8,
		id:48,
		family:8;
#else
#error "Please fix <asm/byteorder.h>"
#endif
};

#ifdef __KERNEL__

#include <linux/completion.h>
#include <linux/device.h>
#include <linux/mutex.h>

#include "w1_family.h"

#define W1_MAXNAMELEN		32

#define W1_SEARCH		0xF0
#define W1_ALARM_SEARCH		0xEC
#define W1_CONVERT_TEMP		0x44
#define W1_SKIP_ROM		0xCC
#define W1_COPY_SCRATCHPAD	0x48
#define W1_WRITE_SCRATCHPAD	0x4E
#define W1_READ_SCRATCHPAD	0xBE
#define W1_READ_ROM		0x33
#define W1_READ_PSUPPLY		0xB4
#define W1_MATCH_ROM		0x55
#define W1_RESUME_CMD		0xA5

#define W1_SLAVE_ACTIVE		0
#define W1_SLAVE_DETACH		1

/**
 * struct w1_slave - holds a single slave device on the bus
 *
 * @owner: Points to the one wire "wire" kernel module.
 * @name: Device id is ascii.
 * @w1_slave_entry: data for the linked list
 * @reg_num: the slave id in binary
 * @refcnt: reference count, delete when 0
 * @flags: bit flags for W1_SLAVE_ACTIVE W1_SLAVE_DETACH
 * @ttl: decrement per search this slave isn't found, deatch at 0
 * @master: bus which this slave is on
 * @family: module for device family type
 * @family_data: pointer for use by the family module
 * @dev: kernel device identifier
 *
 */
struct w1_slave
{
	struct module		*owner;
	unsigned char		name[W1_MAXNAMELEN];
	struct list_head	w1_slave_entry;
	struct w1_reg_num	reg_num;
	atomic_t		refcnt;
	int			ttl;
	unsigned long		flags;

	struct w1_master	*master;
	struct w1_family	*family;
	void			*family_data;
	struct device		dev;
};

typedef void (*w1_slave_found_callback)(struct w1_master *, u64);

/**
 * struct w1_bus_master - operations available on a bus master
 *
 * @data: the first parameter in all the functions below
 *
 * @read_bit: Sample the line level @return the level read (0 or 1)
 *
 * @write_bit: Sets the line level
 *
 * @touch_bit: the lowest-level function for devices that really support the
 * 1-wire protocol.
 * touch_bit(0) = write-0 cycle
 * touch_bit(1) = write-1 / read cycle
 * @return the bit read (0 or 1)
 *
 * @read_byte: Reads a bytes. Same as 8 touch_bit(1) calls.
 * @return the byte read
 *
 * @write_byte: Writes a byte. Same as 8 touch_bit(x) calls.
 *
 * @read_block: Same as a series of read_byte() calls
 * @return the number of bytes read
 *
 * @write_block: Same as a series of write_byte() calls
 *
 * @triplet: Combines two reads and a smart write for ROM searches
 * @return bit0=Id bit1=comp_id bit2=dir_taken
 *
 * @reset_bus: long write-0 with a read for the presence pulse detection
 * @return -1=Error, 0=Device present, 1=No device present
 *
 * @set_pullup: Put out a strong pull-up pulse of the specified duration.
 * @return -1=Error, 0=completed
 *
 * @search: Really nice hardware can handles the different types of ROM search
 * w1_master* is passed to the slave found callback.
 * u8 is search_type, W1_SEARCH or W1_ALARM_SEARCH
 *
 * Note: read_bit and write_bit are very low level functions and should only
 * be used with hardware that doesn't really support 1-wire operations,
 * like a parallel/serial port.
 * Either define read_bit and write_bit OR define, at minimum, touch_bit and
 * reset_bus.
 *
 */
struct w1_bus_master
{
	void		*data;

	u8		(*read_bit)(void *);

	void		(*write_bit)(void *, u8);

	u8		(*touch_bit)(void *, u8);

	u8		(*read_byte)(void *);

	void		(*write_byte)(void *, u8);

	u8		(*read_block)(void *, u8 *, int);

	void		(*write_block)(void *, const u8 *, int);

	u8		(*triplet)(void *, u8);

	u8		(*reset_bus)(void *);

	u8		(*set_pullup)(void *, int);

	void		(*search)(void *, struct w1_master *,
		u8, w1_slave_found_callback);
};

/**
 * enum w1_master_flags - bitfields used in w1_master.flags
 * @W1_ABORT_SEARCH: abort searching early on shutdown
 * @W1_WARN_MAX_COUNT: limit warning when the maximum count is reached
 */
enum w1_master_flags {
	W1_ABORT_SEARCH = 0,
	W1_WARN_MAX_COUNT = 1,
};

/**
 * struct w1_master - one per bus master
 * @w1_master_entry:	master linked list
 * @owner:		module owner
 * @name:		dynamically allocate bus name
 * @list_mutex:		protect slist and async_list
 * @slist:		linked list of slaves
 * @async_list:		linked list of netlink commands to execute
 * @max_slave_count:	maximum number of slaves to search for at a time
 * @slave_count:	current number of slaves known
 * @attempts:		number of searches ran
 * @slave_ttl:		number of searches before a slave is timed out
 * @initialized:	prevent init/removal race conditions
 * @id:			w1 bus number
 * @search_count:	number of automatic searches to run, -1 unlimited
 * @search_id:		allows continuing a search
 * @refcnt:		reference count
 * @priv:		private data storage
 * @enable_pullup:	allows a strong pullup
 * @pullup_duration:	time for the next strong pullup
 * @flags:		one of w1_master_flags
 * @thread:		thread for bus search and netlink commands
 * @mutex:		protect most of w1_master
 * @bus_mutex:		pretect concurrent bus access
 * @driver:		sysfs driver
 * @dev:		sysfs device
 * @bus_master:		io operations available
 * @seq:		sequence number used for netlink broadcasts
 */
struct w1_master
{
	struct list_head	w1_master_entry;
	struct module		*owner;
	unsigned char		name[W1_MAXNAMELEN];
	/* list_mutex protects just slist and async_list so slaves can be
	 * searched for and async commands added while the master has
	 * w1_master.mutex locked and is operating on the bus.
	 * lock order w1_mlock, w1_master.mutex, w1_master.list_mutex
	 */
	struct mutex		list_mutex;
	struct list_head	slist;
	struct list_head	async_list;
	int			max_slave_count, slave_count;
	unsigned long		attempts;
	int			slave_ttl;
	int			initialized;
	u32			id;
	int			search_count;
	/* id to start searching on, to continue a search or 0 to restart */
	u64			search_id;

	atomic_t		refcnt;

	void			*priv;

	/** 5V strong pullup enabled flag, 1 enabled, zero disabled. */
	int			enable_pullup;
	/** 5V strong pullup duration in milliseconds, zero disabled. */
	int			pullup_duration;

	long			flags;

	struct task_struct	*thread;
	struct mutex		mutex;
	struct mutex		bus_mutex;

	struct device_driver	*driver;
	struct device		dev;

	struct w1_bus_master	*bus_master;

	u32			seq;
};

/**
 * struct w1_async_cmd - execute callback from the w1_process kthread
 * @async_entry: link entry
 * @cb: callback function, must list_del and destroy this list before
 * returning
 *
 * When inserted into the w1_master async_list, w1_process will execute
 * the callback.  Embed this into the structure with the command details.
 */
struct w1_async_cmd {
	struct list_head	async_entry;
	void (*cb)(struct w1_master *dev, struct w1_async_cmd *async_cmd);
};

int w1_create_master_attributes(struct w1_master *);
void w1_destroy_master_attributes(struct w1_master *master);
void w1_search(struct w1_master *dev, u8 search_type, w1_slave_found_callback cb);
void w1_search_devices(struct w1_master *dev, u8 search_type, w1_slave_found_callback cb);
/* call w1_unref_slave to release the reference counts w1_search_slave added */
struct w1_slave *w1_search_slave(struct w1_reg_num *id);
/* decrements the reference on sl->master and sl, and cleans up if zero
 * returns the reference count after it has been decremented */
int w1_unref_slave(struct w1_slave *sl);
void w1_slave_found(struct w1_master *dev, u64 rn);
void w1_search_process_cb(struct w1_master *dev, u8 search_type,
	w1_slave_found_callback cb);
struct w1_slave *w1_slave_search_device(struct w1_master *dev,
	struct w1_reg_num *rn);
struct w1_master *w1_search_master_id(u32 id);

/* Disconnect and reconnect devices in the given family.  Used for finding
 * unclaimed devices after a family has been registered or releasing devices
 * after a family has been unregistered.  Set attach to 1 when a new family
 * has just been registered, to 0 when it has been unregistered.
 */
void w1_reconnect_slaves(struct w1_family *f, int attach);
int w1_attach_slave_device(struct w1_master *dev, struct w1_reg_num *rn);
/* 0 success, otherwise EBUSY */
int w1_slave_detach(struct w1_slave *sl);

u8 w1_triplet(struct w1_master *dev, int bdir);
void w1_write_8(struct w1_master *, u8);
u8 w1_read_8(struct w1_master *);
int w1_reset_bus(struct w1_master *);
u8 w1_calc_crc8(u8 *, int);
void w1_write_block(struct w1_master *, const u8 *, int);
void w1_touch_block(struct w1_master *, u8 *, int);
u8 w1_read_block(struct w1_master *, u8 *, int);
int w1_reset_select_slave(struct w1_slave *sl);
int w1_reset_resume_command(struct w1_master *);
void w1_next_pullup(struct w1_master *, int);

static inline struct w1_slave* dev_to_w1_slave(struct device *dev)
{
	return container_of(dev, struct w1_slave, dev);
}

static inline struct w1_slave* kobj_to_w1_slave(struct kobject *kobj)
{
	return dev_to_w1_slave(container_of(kobj, struct device, kobj));
}

static inline struct w1_master* dev_to_w1_master(struct device *dev)
{
	return container_of(dev, struct w1_master, dev);
}

extern struct device_driver w1_master_driver;
extern struct device w1_master_device;
extern int w1_max_slave_count;
extern int w1_max_slave_ttl;
extern struct list_head w1_masters;
extern struct mutex w1_mlock;

extern int w1_process_callbacks(struct w1_master *dev);
extern int w1_process(void *);

#endif /* __KERNEL__ */

#endif /* __W1_H */


text:
using namespace std;
using namespace origin;
using namespace testing;

// A little helper class to help trace initializations and data movements.
struct X
{
  static bool trace;

  X ()
  {
    if (trace)
      cout << "default\n";
  }
  X (X &&)
  {
    if (trace)
      cout << "move\n";
  }
  X (const X &)
  {
    if (trace)
      cout << "copy\n";
  }
};

bool X::trace = false;

void
trace_insert ()
{
  using G = directed_adjacency_list<X>;
  G g;
  X x;

  // Each insertion should require exactly one initialization of X.
  X::trace = true;
  g.add_vertex ();
  g.add_vertex (std::move (x));
  g.add_vertex (x);
  X::trace = false;
}

int
main ()
{
  trace_insert ();

  // TODO: Write tests for adding vertices and edges. Even though those
  // features are thoroughly exercised by the remove edge tests, it might
  // be nice to include them here.

  using G = undirected_adjacency_list<char, int>;
  check_default_init<G> ();
  check_add_vertices<G> ();
  check_add_edges<G> ();
  check_remove_specific_edge<G> ();
  check_remove_first_simple_edge<G> ();
  check_remove_first_multi_edge<G> ();
  check_remove_multi_edge<G> ();
  check_remove_vertex_edges<G> ();
  check_remove_all_edges<G> ();

  using D = directed_adjacency_list<char, int>;
  check_default_init<D> ();
  check_add_vertices<D> ();
  check_add_edges<D> ();
  check_remove_specific_edge<D> ();
  check_remove_first_simple_edge<D> ();
  check_remove_first_multi_edge<D> ();
  check_remove_multi_edge<D> ();
  check_remove_vertex_edges<D> ();
  check_remove_all_edges<G> ();
}


text:
package org.apache.flink.streaming.examples.window.join;

import java.util.Random;

import org.apache.flink.api.java.tuple.Tuple3;
import org.apache.flink.streaming.api.function.source.SourceFunction;
import org.apache.flink.util.Collector;

public class SalarySource implements SourceFunction<Tuple3<String, Integer, Long>> {

	private static final long serialVersionUID = 6670933703432267728L;

	private String[] names = { "tom", "jerry", "alice", "bob", "john", "grace", "sasa", "lawrance",
			"andrew", "jean", "richard", "smith", "gorge", "black", "peter" };
	private Random rand = new Random();
	private Tuple3<String, Integer, Long> outTuple = new Tuple3<String, Integer, Long>();
	private Long progress = 0L;

	@Override
	public void invoke(Collector<Tuple3<String, Integer, Long>> out) throws Exception {
		// Continuously emit tuples with random names and integers (salaries).
		while (true) {
			outTuple.f0 = names[rand.nextInt(names.length)];
			outTuple.f1 = rand.nextInt(10000);
			outTuple.f2 = progress;
			out.collect(outTuple);
			progress += 1;
		}
	}
}


text:
import InfoData = require('../../../infodata');
//
import BaseItem = require('./baseitem');
import BaseEvent = require('./baseevent');
//
class GroupeEvent extends BaseEvent implements InfoData.IGroupeEvent {
  //
  private _profaff: string;
  private _prof: string;
  private _name: string;
  private _location: string;
  private _start: Date;
  private _end: Date;
  private _coef: number;
  //
  constructor(oMap?: any) {
    super(oMap);
    this._profaff = null;
    this._prof = null;
    this._name = null;
    this._location = null;
    this._start = null;
    this._end = null;
    this._coef = null;
    if ((oMap !== undefined) && (oMap !== null)) {
      if (oMap.profaffectationid !== undefined) {
        this.profaffectationid = oMap.profaffectationid;
      }
      if (oMap.enseignantid !== undefined) {
        this.enseignantid = oMap.enseignantid;
      }
      if (oMap.name !== undefined) {
        this.name = oMap.name;
      }
      if (oMap.location !== undefined) {
        this.location = oMap.location;
      }
      if (oMap.startTime !== undefined) {
        this.startTime = oMap.startTime;
      }
      if (oMap.endTime !== undefined) {
        this.endTime = oMap.endTime;
      }
      if (oMap.coefficient !== undefined) {
        this.coefficient = oMap.coefficient;
      }
    }// oMap
  }// constructor
  public get base_prefix():string {
    return 'GVT';
  }
  public create_id():  string{
    var n = Math.floor(10000.0*Math.random());
    var sn = '' + n;
    while (sn.length < 4){
      sn = '0' + sn;
    }
    var s:string = (this.date.toISOString()).substr(0,10);
    return this.base_prefix + '-' + this.profaffectationid + '-' +
     this.genre + '-' + s + '-' + sn;
  }// create_id
  public get type(): string {
    return 'groupeevent';
  }
  public get collection_name(): string {
    return 'groupeevents';
  }
  //
  public get profaffectationid(): string {
    return this._profaff;
  }
  public set profaffectationid(s: string) {
    if ((s !== undefined) && (s !== null) && (s.trim().length > 0)) {
      this._profaff = s;
    } else {
      this._profaff = null;
    }
  }

  public get name(): string {
    return this._name;
  }
  public set name(s: string) {
    if ((s !== undefined) && (s !== null) && (s.trim().length > 0)) {
      this._name = s.trim().toLowerCase();
    } else {
      this._name = null;
    }
  }

  //
  public get location(): string {
    return this._location;
  }
  public set location(s: string) {
    if ((s !== undefined) && (s !== null) && (s.trim().length > 0)) {
      this._location = s.trim().toLowerCase();
    } else {
      this._location = null;
    }
  }

  //
  public get startTime(): Date {
    return this._start;
  }
  public set startTime(d: Date) {
    this._start = BaseItem.check_date(d);
  }

  //
  public get endTime(): Date {
    return this._end;
  }
  public set endTime(d: Date) {
    this._end = BaseItem.check_date(d);
  }

  //
  public get enseignantid(): string {
    return this._prof;
  }
  public set enseignantid(s: string) {
    if ((s !== undefined) && (s !== null) && (s.trim().length > 0)) {
      this._prof = s;
    } else {
      this._prof = null;
    }
  }
  public get has_enseignantid(): boolean {
    return (this.enseignantid !== null);
  }
  //
  public get coefficient(): number {
    return this._coef;
  }
  public set coefficient(s: number) {
    if ((s !== undefined) && (s !== null) && (s > 0)) {
      this._coef = s;
    } else {
      this._coef = null;
    }
  }
  public get has_coefficient(): boolean {
    return (this.coefficient !== null);
  }
  //
  public get is_storeable(): boolean {
    return (this.type !== null) && (this.collection_name !== null) &&
      (this.departementid !== null) && (this.anneeid !== null)
       && (this.semestreid !== null) &&
      (this.uniteid !== null) && (this.matiereid !== null) &&
       (this.groupeid !== null) &&
      (this.genre !== null) && (this.date !== null) &&
      (this.profaffectationid !== null) && (this.enseignantid !== null) &&
      (this.lastname !== null) && (this.firstname !== null) &&
      (this.name !== null);
  }
  public to_insert_map(oMap: any): void {
    super.to_insert_map(oMap);
      oMap.profaffectationid = this.profaffectationid;
      oMap.enseignantid = this.enseignantid;
      oMap.name = this.name;
      oMap.location = this.location;
      oMap.coefficient = this.coefficient;
      oMap.startTime = this.startTime;
      oMap.endTime = this.endTime;
  }// to_insert_map

}// class GroupeEvent
export = GroupeEvent;


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

#include "SegmentTimeline.h"

#include <vlc_common.h>
#include <vlc_arrays.h>

#include <iostream>

using namespace dash::mpd;

SegmentTimeline::SegmentTimeline() :
    timescale( -1 )
{
}

SegmentTimeline::~SegmentTimeline()
{
    vlc_delete_all( this->elements );
}

int dash::mpd::SegmentTimeline::getTimescale() const
{
    return this->timescale;
}

void dash::mpd::SegmentTimeline::setTimescale(int timescale)
{
    this->timescale = timescale;
}

void dash::mpd::SegmentTimeline::addElement(dash::mpd::SegmentTimeline::Element *e)
{
    int64_t         offset = 0;
    for ( int i = 0; i <= e->r; ++i )
    {
        this->elements.push_back( e );
        if ( i < e->r )
        {
            e = new SegmentTimeline::Element( *e );
            offset += e->d;
            e->t += offset;
        }
    }
}

const SegmentTimeline::Element*    SegmentTimeline::getElement( unsigned int index ) const
{
    if ( this->elements.size() <= index )
        return NULL;
    std::list<Element*>::const_iterator     it = this->elements.begin();
    std::list<Element*>::const_iterator     end = this->elements.end();
    unsigned int                            i = 0;
    while ( it != end )
    {
        if ( i == index )
            return *it;
        ++it;
        ++i;
    }
    return NULL;
}

dash::mpd::SegmentTimeline::Element::Element() :
    r( 0 )
{
}

SegmentTimeline::Element::Element(const SegmentTimeline::Element &e) :
    t( e.t ),
    d( e.d ),
    r( 0 )
{
}


text:
/*
 * Contributors:
 * Ryan Johnson - delscovich@users.sourceforge.net
 */
package net.sf.jasperreports.engine.design;

import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import net.sf.jasperreports.engine.DefaultJasperReportsContext;
import net.sf.jasperreports.engine.JRConstants;
import net.sf.jasperreports.engine.JRExpressionChunk;
import net.sf.jasperreports.engine.JRPropertiesUtil;
import net.sf.jasperreports.engine.JRRuntimeException;
import net.sf.jasperreports.engine.base.JRBaseExpression;
import net.sf.jasperreports.engine.design.events.JRChangeEventsSupport;
import net.sf.jasperreports.engine.design.events.JRPropertyChangeSupport;
import net.sf.jasperreports.engine.util.JRCloneUtils;

/**
 * @author Teodor Danciu (teodord@users.sourceforge.net)
 * @version $Id: JRDesignExpression.java 7199 2014-08-27 13:58:10Z teodord $
 */
public class JRDesignExpression extends JRBaseExpression implements JRChangeEventsSupport
{
	/**
	 *
	 */
	private static final long serialVersionUID = JRConstants.SERIAL_VERSION_UID;

	public static final String PROPERTY_LEGACY_PARSER =
			JRPropertiesUtil.PROPERTY_PREFIX + "legacy.expression.parser";

	protected static final boolean LEGACY_PARSER;
	static
	{
		JRPropertiesUtil properties = JRPropertiesUtil.getInstance(DefaultJasperReportsContext.getInstance());
		LEGACY_PARSER = properties.getBooleanProperty(PROPERTY_LEGACY_PARSER, false);
	}

	public static final Pattern PLACEHOLDER_PATTERN =
			Pattern.compile("\\$([RPFV])\\{(.+?)\\}", Pattern.MULTILINE | Pattern.DOTALL);

	protected static final int PLACEHOLDER_TYPE_INDEX = 1;
	protected static final int PLACEHOLDER_TEXT_INDEX = 2;

	public static final String PROPERTY_TEXT = "text";

	/**
	 * @deprecated To be removed.
	 */
	public static final String PROPERTY_VALUE_CLASS_NAME = "valueClassName";

	/**
	 *
	 */
	protected List<JRExpressionChunk> chunks = new ArrayList<JRExpressionChunk>();

	/**
	 *
	 */
	public JRDesignExpression()
	{
		super();

		regenerateId();
	}

	/**
	 *
	 */
	public JRDesignExpression(String text)
	{
		this();

		setText(text);
	}

	/**
	 * @deprecated To be removed.
	 */
	public void setValueClass(Class<?> clazz)
	{
		setValueClassName(clazz.getName());
	}

	/**
	 * @deprecated To be removed.
	 */
	public void setValueClassName(String className)
	{
		Object old = this.valueClassName;
		valueClassName = className;
		valueClass = null;
		valueClassRealName = null;
		getEventSupport().firePropertyChange(PROPERTY_VALUE_CLASS_NAME, old, this.valueClassName);
	}

	/**
	 * FIXMENOW remove me?
	 */
	public void setId(int id)
	{
		this.id = id;
	}

	/**
	 *
	 */
	public JRExpressionChunk[] getChunks()
	{
		JRExpressionChunk[] chunkArray = null;

		if (chunks != null && chunks.size() > 0)
		{
			chunkArray = new JRExpressionChunk[chunks.size()];
			chunks.toArray(chunkArray);
		}

		return chunkArray;
	}

	/**
	 * Clears the current list of chunks and adds the passed list of chunks.  The reference
	 * to the list passed is not kept.
	 */
	public void setChunks(List<JRExpressionChunk> chunks)
	{
		this.chunks.clear();
		this.chunks.addAll(chunks);
	}

	/**
	 *
	 */
	public void addChunk(JRDesignExpressionChunk chunk)
	{
		this.chunks.add(chunk);
	}

	protected void addChunk(byte type, String text)
	{
		JRDesignExpressionChunk chunk = new JRDesignExpressionChunk();
		chunk.setType(type);
		chunk.setText(text);

		this.chunks.add(chunk);
	}

	/**
	 *
	 */
	public void addTextChunk(String text)
	{
		JRDesignExpressionChunk chunk = new JRDesignExpressionChunk();
		chunk.setType(JRExpressionChunk.TYPE_TEXT);
		chunk.setText(text);

		this.chunks.add(chunk);
	}

	/**
	 *
	 */
	public void addParameterChunk(String text)
	{
		JRDesignExpressionChunk chunk = new JRDesignExpressionChunk();
		chunk.setType(JRExpressionChunk.TYPE_PARAMETER);
		chunk.setText(text);

		this.chunks.add(chunk);
	}

	/**
	 *
	 */
	public void addFieldChunk(String text)
	{
		JRDesignExpressionChunk chunk = new JRDesignExpressionChunk();
		chunk.setType(JRExpressionChunk.TYPE_FIELD);
		chunk.setText(text);

		this.chunks.add(chunk);
	}

	/**
	 *
	 */
	public void addVariableChunk(String text)
	{
		JRDesignExpressionChunk chunk = new JRDesignExpressionChunk();
		chunk.setType(JRExpressionChunk.TYPE_VARIABLE);
		chunk.setText(text);

		this.chunks.add(chunk);
	}

	/**
	 *
	 */
	public void addResourceChunk(String text)
	{
		JRDesignExpressionChunk chunk = new JRDesignExpressionChunk();
		chunk.setType(JRExpressionChunk.TYPE_RESOURCE);
		chunk.setText(text);

		this.chunks.add(chunk);
	}

	/**
	 *
	 */
	public void setText(String text)
	{
		Object old = getText();

		chunks.clear();

		if (text != null)
		{
			if (LEGACY_PARSER)
			{
				//FIXME remove this at some point
				legacyParseText(text);
			}
			else
			{
				parseText(text);
			}
		}

		getEventSupport().firePropertyChange(PROPERTY_TEXT, old, text);
	}

	protected void legacyParseText(String text)
	{
		StringBuffer textChunk = new StringBuffer();

		StringTokenizer tkzer = new StringTokenizer(text, "$", true);
		int behindDelims = 0;
		while (tkzer.hasMoreTokens())
		{
			String token = tkzer.nextToken();

			if (token.equals("$"))
			{
				if (behindDelims > 0)
				{
					textChunk.append("$");
				}

				++behindDelims;
			}
			else
			{
				byte chunkType = JRExpressionChunk.TYPE_TEXT;
				if (behindDelims > 0)
				{
					if (token.startsWith("P{"))
					{
						chunkType = JRExpressionChunk.TYPE_PARAMETER;
					}
					else if (token.startsWith("F{"))
					{
						chunkType = JRExpressionChunk.TYPE_FIELD;
					}
					else if (token.startsWith("V{"))
					{
						chunkType = JRExpressionChunk.TYPE_VARIABLE;
					}
					else if (token.startsWith("R{"))
					{
						chunkType = JRExpressionChunk.TYPE_RESOURCE;
					}
				}

				if (chunkType == JRExpressionChunk.TYPE_TEXT)
				{
					if (behindDelims > 0)
					{
						textChunk.append("$");
					}
					textChunk.append(token);
				}
				else
				{
					int end = token.indexOf('}');
					if (end > 0)
					{
						if (behindDelims > 1)
						{
							textChunk.append(token);
						}
						else
						{
							if (textChunk.length() > 0)
							{
								addTextChunk(textChunk.toString());
							}

							addChunk(chunkType, token.substring(2, end));
							textChunk = new StringBuffer(token.substring(end + 1));
						}
					}
					else
					{
						if (behindDelims > 0)
						{
							textChunk.append("$");
						}
						textChunk.append(token);
					}
				}

				behindDelims = 0;
			}
		}

		if (behindDelims > 0)
		{
			textChunk.append("$");
		}

		if (textChunk.length() > 0)
		{
			this.addTextChunk(textChunk.toString());
		}
	}

	protected void parseText(String text)
	{
		Matcher matcher = PLACEHOLDER_PATTERN.matcher(text);

		int textChunkStart = 0;
		StringBuilder textChunk = new StringBuilder(text.length());
		while(matcher.find())
		{
			int matchStart = matcher.start();
			int matchEnd = matcher.end();
			if (matchStart > 0 && text.charAt(matchStart - 1) == '$')
			{
				// we have a $$ escape, append it to the text chunk with a single $
				textChunk.append(text, textChunkStart, matchStart - 1);
				textChunk.append(text, matchStart, matchEnd);
			}
			else
			{
				// we have a proper placeholder
				textChunk.append(text, textChunkStart, matchStart);
				if (textChunk.length() > 0)
				{
					addTextChunk(textChunk.toString());
					textChunk.delete(0, textChunk.length());
				}

				String chunkStringType = matcher.group(PLACEHOLDER_TYPE_INDEX);
				byte chunkType = chunkStringToType(chunkStringType);
				String chunkText = matcher.group(PLACEHOLDER_TEXT_INDEX);
				addChunk(chunkType, chunkText);
			}

			textChunkStart = matchEnd;
		}

		textChunk.append(text, textChunkStart, text.length());
		if (textChunk.length() > 0)
		{
			addTextChunk(textChunk.toString());
		}
	}

	protected static byte chunkStringToType(String chunkStringType)
	{
		byte chunkType;
		//FIXME faster way to do this
		if (chunkStringType.startsWith("P"))
		{
			chunkType = JRExpressionChunk.TYPE_PARAMETER;
		}
		else if (chunkStringType.startsWith("F"))
		{
			chunkType = JRExpressionChunk.TYPE_FIELD;
		}
		else if (chunkStringType.startsWith("V"))
		{
			chunkType = JRExpressionChunk.TYPE_VARIABLE;
		}
		else if (chunkStringType.startsWith("R"))
		{
			chunkType = JRExpressionChunk.TYPE_RESOURCE;
		}
		else
		{
			throw new JRRuntimeException("Unknown expression chunk type \"" + chunkStringType + "\"");
		}
		return chunkType;
	}

	private transient JRPropertyChangeSupport eventSupport;

	public JRPropertyChangeSupport getEventSupport()
	{
		synchronized (this)
		{
			if (eventSupport == null)
			{
				eventSupport = new JRPropertyChangeSupport(this);
			}
		}

		return eventSupport;
	}

	/**
	 *
	 */
	public Object clone()
	{
		JRDesignExpression clone = (JRDesignExpression)super.clone();
		clone.chunks = JRCloneUtils.cloneList(chunks);
		clone.eventSupport = null;
		return clone;
	}

}


text:
<?php

class Execute
{

   // private $file="TestRecord_1.wav";
    private $nexturl="http://192.168.1.195/IVR/end.php";
    private $result="result_1234";
    private $params='{"Params_Test":"test"}';
    private $display="DEFAULT";
    private $application="";
    private $eventlog=false;
    private $data="";

  public function SetNextUrl($targetUrl)
        {

            if( !empty( $targetUrl ) )

               $this->nexturl = $targetUrl;

        }

  public function SetResult($targetResult)
        {

            if( !empty( $targetResult ) )

                $this->result = $targetResult;

        }

   public function SetParams($targetParams)
        {
            if( !empty( $targetParams ) )

               $this->params = $targetParams;
        }

  public function SetDisplay($targetDisplay)
        {

            if( !empty( $targetDisplay ) )

                $this->display = $targetDisplay;

        }

   public function SetApplication($targetApplication)
        {
            if( !empty( $targetApplication ) )

               $this->application = $targetApplication;
        }

   public function SetEventLog($targetEventLog)
        {

            if( !empty( $targetEventLog ) )

                $this->eventlog = $targetEventLog;
        }

  public function SetData($targetData)
        {

            if( !empty( $targetData ) )

                $this->data = $targetData;

        }

  function GetResult()
  {
    try
    {
        $jsonStart='{';
        $jsonAction='"action": "execute",';
        $jsonNextUrl='"nexturl": "'.$this->nexturl.'",';
        $jsonResult='"result": "'.$this->result.'",';
        $jsonParams='"params": '.$this->params.',';
        $jsonDisplay='"display": "'.$this->display.'",';
        $jsonApplication='"application": "'.$this->application.'",';
        $jsonEventLog='"eventlog": "'.$this->eventlog.'",';
        $jsonData='"data": "'.$this->data.'"';
        $jsonEnd='}';

        return $jsonStart.$jsonAction.$jsonNextUrl.$jsonResult.$jsonParams.$jsonDisplay.$jsonApplication.$jsonEventLog.$jsonData.$jsonEnd;
    }
    catch(exception $ex)
    {
        return $ex;
    }
  }

}

?>


text:
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2013 The Android Open Source Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-->

<resources>

    <style name="PrintActivity" parent="@android:style/Theme.DeviceDefault">
        <item name="android:colorPrimary">@*android:color/material_blue_grey_900</item>
        <item name="android:colorPrimaryDark">@*android:color/material_blue_grey_950</item>
        <item name="android:colorAccent">@*android:color/material_deep_teal_500</item>
        <item name="android:windowIsTranslucent">true</item>
        <item name="android:windowBackground">@android:color/transparent</item>
        <item name="android:windowContentOverlay">@null</item>
        <item name="android:windowActionBar">false</item>
        <item name="android:windowNoTitle">true</item>
        <item name="android:backgroundDimEnabled">false</item>
    </style>

</resources>


text:
<?php

namespace Da2e\FiltrationBundle\Tests\Exception\Form\Creator;

use Da2e\FiltrationBundle\Exception\Form\Creator\FormCreatorException;
use Da2e\FiltrationBundle\Tests\TestCase;

/**
 * Class FormCreatorExceptionTest
 *
 * @author Dmitry Abrosimov <abrosimovs@gmail.com>
 */
class FormCreatorExceptionTest extends TestCase
{
    public function testExtends()
    {
        $e = new FormCreatorException();
        $this->assertInstanceOf('\Da2e\FiltrationBundle\Exception\BaseException', $e);
    }
}


text:
#ifdef HAVE_CONFIG_H
#include "../ext_config.h"
#endif

#include <php.h>
#include "../php_ext.h"
#include "../ext.h"

#include <Zend/zend_operators.h>
#include <Zend/zend_exceptions.h>
#include <Zend/zend_interfaces.h>

#include "kernel/main.h"

ZEPHIR_INIT_CLASS(Ice_Log) {

	ZEPHIR_REGISTER_CLASS(Ice, Log, ice, log, NULL, 0);

	zend_declare_class_constant_string(ice_log_ce, SL("EMERGENCY"), "emergency" TSRMLS_CC);

	zend_declare_class_constant_string(ice_log_ce, SL("ALERT"), "alert" TSRMLS_CC);

	zend_declare_class_constant_string(ice_log_ce, SL("CRITICAL"), "critical" TSRMLS_CC);

	zend_declare_class_constant_string(ice_log_ce, SL("ERROR"), "error" TSRMLS_CC);

	zend_declare_class_constant_string(ice_log_ce, SL("WARNING"), "warning" TSRMLS_CC);

	zend_declare_class_constant_string(ice_log_ce, SL("NOTICE"), "notice" TSRMLS_CC);

	zend_declare_class_constant_string(ice_log_ce, SL("INFO"), "info" TSRMLS_CC);

	zend_declare_class_constant_string(ice_log_ce, SL("DEBUG"), "debug" TSRMLS_CC);

	return SUCCESS;

}


text:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<servico xsi:schemaLocation="http://servicos.gov.br/v3/schema.../servico.xsd" xmlns="http://servicos.gov.br/v3/schema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <id>obter-certidao-de-qualificacao-de-supervisor-de-protecao-radiologica-em-instalacao-radiativa</id>
    <dbId>2674</dbId>
    <nome>Obter Certidão de Qualificação de Supervisor de Proteção Radiológica em Instalação Radiativa</nome>
    <sigla></sigla>
    <descricao>Para que uma instalação radiativa possa ser autorizada a operar, é imprescindível a contratação de um ou mais supervisores de proteção radiológica. Estes supervisores têm a sua qualificação certificada pela CNEN, mediante aplicação de prova.</descricao>
    <contato></contato>
    <gratuito>false</gratuito>
    <porcentagem-manual>false</porcentagem-manual>
    <servico-digital>false</servico-digital>
    <link-servico-digital></link-servico-digital>
    <solicitantes>
        <solicitante id="3245">
            <tipo>Profissionais que pretendam trabalhar como Supervisor de Proteção Radiológica em Instalação Radiativa</tipo>
            <requisitos></requisitos>
        </solicitante>
    </solicitantes>
    <tempo-total-estimado>
        <entre min="60" max="90" unidade="dias-corridos"/>
        <descricao></descricao>
    </tempo-total-estimado>
    <validade-documento>
        <descricao></descricao>
    </validade-documento>
    <etapas>
        <etapa id="6284">
            <titulo>Inscrever-se</titulo>
            <descricao>Obtenha acesso à tabela de taxas [aqui](http://appasp.cnen.gov.br/seguranca/lfc/listas/lst-valtlc.asp)</descricao>
            <documentos>
                <default>
                    <item id="7918">Carteira de identidade</item>
                    <item id="7919">Carteira de identidade de estrangeiro</item>
                    <item id="7920">Carteira de trabalho</item>
                    <item id="7921">Certificado de conclusão de curso</item>
                    <item id="7922">Comprovante de endereço/residência</item>
                    <item id="7923">Comprovante de pagamento</item>
                </default>
            </documentos>
            <custos>
                <default>
                    <custo id="342">
                        <descricao>Taxa de Licenciamento e Controle</descricao>
                        <moeda>R$</moeda>
                        <valorVariavel>Variável com base na atuação prevista, de acordo com a complexidade de cada instalação</valorVariavel>
                        <statusCustoVariavel>1</statusCustoVariavel>
                    </custo>
                </default>
            </custos>
            <canais-de-prestacao>
                <default>
                    <canal-de-prestacao id="6318" tipo="postal">
                        <descricao>**Comissão Nacional de Energia Nuclear- Sede** - Rua Gal. Severiano, nº 90 - Botafogo
CEP: 22290-901 - Rio de Janeiro - RJ</descricao>
                    </canal-de-prestacao>
                </default>
            </canais-de-prestacao>
        </etapa>
        <etapa id="6285">
            <titulo>Fazer a prova</titulo>
            <descricao></descricao>
            <documentos>
                <default/>
            </documentos>
            <custos>
                <default/>
            </custos>
            <canais-de-prestacao>
                <default>
                    <canal-de-prestacao id="6319" tipo="presencial">
                        <descricao>**Comissão Nacional de Energia Nuclear- Sede** - Rua Gal. Severiano, nº 90 - Botafogo
CEP: 22290-901 - Rio de Janeiro - RJ</descricao>
                    </canal-de-prestacao>
                </default>
            </canais-de-prestacao>
        </etapa>
    </etapas>
    <orgao id="http://estruturaorganizacional.dados.gov.br/id/unidade-organizacional/223" dbId="7581">
        <nomeOrgao>Comissão Nacional de Energia Nuclear (CNEN)</nomeOrgao>
    </orgao>
    <segmentos-da-sociedade>
        <item idSegmento="1" idServicoSegmento="6215">Cidadãos</item>
    </segmentos-da-sociedade>
    <areas-de-interesse>
        <item>Energia</item>
        <item>Fiscalização do Estado</item>
        <item>Normalização e Qualidade</item>
        <item>Trabalho</item>
        <item>Proteção e Benefícios ao Trabalhador</item>
    </areas-de-interesse>
    <palavras-chave>
        <item id="11788">CNEN</item>
        <item id="11789">supervisão</item>
        <item id="11790">radioatividade</item>
    </palavras-chave>
</servico>


text:
#region Copyright
//
// DotNetNuke® - https://www.dnnsoftware.com
// Copyright (c) 2002-2018
// by DotNetNuke Corporation
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
// documentation files (the "Software"), to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
// to permit persons to whom the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or substantial portions
// of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
// TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
// CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
#endregion

using System;
using System.Collections.Generic;

namespace Dnn.PersonaBar.Library.Controllers
{
    public interface ILocalizationController
    {
        string CultureName { get; }

        long GetResxTimeStamp(string resourceFile, Dto.Localization localization);

        Dictionary<string, string> GetLocalizedDictionary(string resourceFile, string culture, Dto.Localization localization);

        /// <summary>
        /// Returns a dictionary of localized key for a resource file for a given culture
        /// </summary>
        /// <param name="resourceFile">The relative file path of the main resource file, e.g. ~/DesktopModules/SocialLibrary/App_LocalResources/CmxResources.resx</param>
        /// <param name="culture">The culture for which this dictionay is requested</param>
        /// <remarks>This API does not fallback to any other DNN resource files.</remarks>
        Dictionary<string, string> GetLocalizedDictionary(string resourceFile, string culture);
    }
}


text:
<?php get_template_part('templates/head'); ?>
<body <?php body_class(); ?>>

  <?php
    do_action('get_header');
      get_template_part('templates/header');
  ?>

        <?php include kadence_template_path(); ?>

      <?php if (kadence_display_sidebar()) : ?>
      <aside class="<?php echo kadence_sidebar_class(); ?> kad-sidebar" role="complementary">

          <?php include kadence_sidebar_path(); ?>

      <?php endif; ?>

  <?php get_template_part('templates/footer'); ?>


text:
module Util.ConjRetriever where

import qualified CPD.GlobalControl as GC
import qualified CPD.LocalControl as LC
import Data.List.Extra
import qualified Data.Set as Set
import           Descend
import Syntax
import Tree

retrieve :: Tree -> [[G S]]
retrieve tree = map reverse $ Set.toList $ Set.fromList $ go tree [[]] where
  go Fail acc = acc
  go (Success _) acc = acc
  go (Rename _ _ _ _ _) acc = acc
  go (Gen _ _ t _ _) acc = go t acc
  go (Call _ t g _) acc = go t (map (g :) acc)
  go (Or t1 t2 _ _) acc = go t1 acc ++ go t2 acc
  go (Split _ ts _ _) acc = concatMap (\t -> go t acc) ts
  go (Prune gs) acc = acc

globalTreeRetrieve :: GC.GlobalTree -> [[[G S]]]
globalTreeRetrieve tree = map reverse $ filter notNull $ go tree [[]] where
  go (GC.Leaf _ _ _) acc = [[]]
  go (GC.Node d _ _ ch) acc = concatMap (\x -> go x (map (getCurr d : ) acc)) ch
  go (GC.Prune d _) acc = map ((getCurr d) :) acc


text:
<component name="libraryTable">
  <library name="Maven: com.codahale.metrics:metrics-servlets:3.0.1">
    <CLASSES>
      <root url="jar://$MAVEN_REPOSITORY$/com/codahale/metrics/metrics-servlets/3.0.1/metrics-servlets-3.0.1.jar!/" />
    </CLASSES>
    <JAVADOC>
      <root url="jar://$MAVEN_REPOSITORY$/com/codahale/metrics/metrics-servlets/3.0.1/metrics-servlets-3.0.1-javadoc.jar!/" />
    </JAVADOC>
    <SOURCES>
      <root url="jar://$MAVEN_REPOSITORY$/com/codahale/metrics/metrics-servlets/3.0.1/metrics-servlets-3.0.1-sources.jar!/" />
    </SOURCES>
  </library>
</component>


text:
import Immutable from 'immutable';
import { Assertions } from '@ethical-jobs/redux';
import Posts from 'posts';

const { selectors } = Posts;

test('fetching returns correct state slice ', () => {
  expect(
    Assertions.fetchingSelector('posts', selectors.fetching)
  ).toBe(true);
});

test('filters returns correct state slice', () => {
  expect(
    Assertions.filtersSelector('posts', selectors.filters)
  ).toBe(true);
});

test('result selector returns correct state slice', () => {
  expect(
    Assertions.resultSelector('posts', selectors.result)
  ).toBe(true);
});

test('postsSelector selector returns correct state slice', () => {
  expect(
    Assertions.entitiesSelector('posts', 'posts', selectors.postsSelector)
  ).toBe(true);
});

describe('orderedPosts selector', () => {
  const posts = Immutable.fromJS({
    'x8haaw264': {
      id: 51,
      title: 'Alpha',
    },
    '83n927': {
      id: 53,
      title: 'Charlie',
    },
    'ms83bs7': {
      id: 52,
      title: 'Bravo',
    },
  });
  const results = Immutable.fromJS(['ms83bs7','x8haaw264','83n927']);

  test('orderedPosts selector returns OrderedMap', () => {
    const result = selectors.orderedPosts.resultFunc(posts, results);
    expect(Immutable.OrderedMap.isOrderedMap(result)).toBe(true);
  });

  test('orderedPosts selector returns correct order', () => {
    const result = selectors.orderedPosts.resultFunc(posts, results);
    expect(result.toList().get(0).get('id')).toBe(52);
    expect(result.toList().get(1).get('id')).toBe(51);
    expect(result.toList().get(2).get('id')).toBe(53);
  });
});

/*
|--------------------------------------------------------------------------
| Single post selector
|--------------------------------------------------------------------------
*/

test('postByResult selector returns correct state slice', () => {
  const state = Immutable.fromJS({
    entities: {
      posts: {
        entities: {
          posts: {
            554: 'foo-bar-bam',
          },
        },
        result: 554,
      },
    }
  });
  const result = selectors.postByResult(state);
  expect(Immutable.is('foo-bar-bam', result)).toBe(true);
});


text:
#include <zephyr/kernel.h>

#define I2C_ENABLED(idx)  (IS_ENABLED(CONFIG_I2C) && \
			   DT_NODE_HAS_STATUS(DT_NODELABEL(i2c##idx), okay))

#define SPI_ENABLED(idx)  (IS_ENABLED(CONFIG_SPI) && \
			   DT_NODE_HAS_STATUS(DT_NODELABEL(spi##idx), okay))

#define UART_ENABLED(idx) (IS_ENABLED(CONFIG_SERIAL) && \
			   (IS_ENABLED(CONFIG_SOC_SERIES_NRF53X) || \
			    IS_ENABLED(CONFIG_SOC_SERIES_NRF91X)) && \
			   DT_NODE_HAS_STATUS(DT_NODELABEL(uart##idx), okay))

/*
 * In most Nordic SoCs, SPI and TWI peripherals with the same instance number
 * share certain resources and therefore cannot be used at the same time (in
 * nRF53 and nRF91 Series this limitation concerns UART peripherals as well).
 *
 * In some SoCs, like nRF52810, there are only single instances of
 * these peripherals and they are arranged in a different way, so this
 * limitation does not apply.
 *
 * The build assertions below check if conflicting peripheral instances are not
 * enabled simultaneously.
 */

#define CHECK(idx) \
	!(I2C_ENABLED(idx) && SPI_ENABLED(idx)) && \
	!(I2C_ENABLED(idx) && UART_ENABLED(idx)) && \
	!(SPI_ENABLED(idx) && UART_ENABLED(idx))

#define MSG(idx) \
	"Only one of the following peripherals can be enabled: " \
	"SPI"#idx", SPIM"#idx", SPIS"#idx", TWI"#idx", TWIM"#idx", TWIS"#idx \
	IF_ENABLED(CONFIG_SOC_SERIES_NRF53X, (", UARTE"#idx)) \
	IF_ENABLED(CONFIG_SOC_SERIES_NRF91X, (", UARTE"#idx)) \
	". Check nodes with status \"okay\" in zephyr.dts."

#if (!IS_ENABLED(CONFIG_SOC_NRF52810) &&	\
	!IS_ENABLED(CONFIG_SOC_NRF52805) &&	\
	!IS_ENABLED(CONFIG_SOC_NRF52811))
BUILD_ASSERT(CHECK(0), MSG(0));
#endif
BUILD_ASSERT(CHECK(1), MSG(1));
BUILD_ASSERT(CHECK(2), MSG(2));
BUILD_ASSERT(CHECK(3), MSG(3));

#if IS_ENABLED(CONFIG_SOC_NRF52811)
BUILD_ASSERT(!(SPI_ENABLED(1) && I2C_ENABLED(0)),
	     "Only one of the following peripherals can be enabled: "
	     "SPI1, SPIM1, SPIS1, TWI0, TWIM0, TWIS0. "
	     "Check nodes with status \"okay\" in zephyr.dts.");
#endif


text:
// Intel 8253/8254/82C54 Programmable Interval Timer (PIT).
// Only used on uniprocessors;
// SMP machines use the local APIC timer.

#include <krnl/timer.h>
#include <krnl/picirq.h>
#include <traps.h>
#include <x86.h>

#define IO_TIMER1       0x040           // 8253 Timer #1

// Frequency of all three count-down timers;
// (TIMER_FREQ/freq) is the appropriate count
// to generate a frequency of freq Hz.

#define TIMER_FREQ      1193182
#define TIMER_DIV(x)    ((TIMER_FREQ+(x)/2)/(x))

#define TIMER_MODE      (IO_TIMER1 + 3) // timer mode port
#define TIMER_SEL0      0x00    // select counter 0
#define TIMER_RATEGEN   0x04    // mode 2, rate generator
#define TIMER_16BIT     0x30    // r/w counter 16 bits, LSB first

void
timerinit(void)
{
  // Interrupt 100 times/sec.
  outb(TIMER_MODE, TIMER_SEL0 | TIMER_RATEGEN | TIMER_16BIT);
  outb(IO_TIMER1, TIMER_DIV(100) % 256);
  outb(IO_TIMER1, TIMER_DIV(100) / 256);
  picenable(IRQ_TIMER);
}


text:
/*!
 * numeral.js language configuration
 * language : chinese Taiwan (tw)
 * author : Rich Daley : https://github.com/pedantic-git
 */
(function () {
    var language = {
        delimiters: {
            thousands: ',',
            decimal: '.'
        },
        abbreviations: {
            thousand: '千',
            million: '百萬',
            billion: '十億',
            trillion: '兆'
        },
        ordinal: function (number) {
          // Should go before number but numeral.js doesn't currently
          // support this
          return '第';
        },
        currency: {
            symbol: 'NT$'
        }
    };

    // Node
    if (typeof module !== 'undefined' && module.exports) {
        module.exports = language;
    }
    // Browser
    if (typeof window !== 'undefined' && this.numeral && this.numeral.language) {
        this.numeral.language('zh-tw', language);
    }
}());


text:
require File.dirname(__FILE__) + "/helper"

class TestBar < Test::Unit::TestCase
  def test_pass
    assert true
  end

  def test_flunk
    flunk
  end
end


text:
From DTML:

<dtml-call "RESPONSE.setHeader('Cache-Control', 'no-cache')">
<dtml-call "RESPONSE.setHeader('Pragma', 'no-cache')">

From python/python script:

def noCache(self, REQUEST):
    REQUEST.RESPONSE.setHeader('Cache-Control', 'no-cache')
    REQUEST.RESPONSE.setHeader('Pragma', 'no-cache')


text:
using System;
using QuantConnect.Data.Market;

namespace QuantConnect.Data.Consolidators
{
    /// <summary>
    /// Provides an implementation of <see cref="IDataConsolidator"/> that preserve the input
    /// data unmodified. The input data is filtering by the specified predicate function
    /// </summary>
    /// <typeparam name="T">The type of data</typeparam>
    public class FilteredIdentityDataConsolidator<T> : IdentityDataConsolidator<T>
        where T : IBaseData
    {
        private readonly Func<T, bool> _predicate;

        /// <summary>
        /// Initializes a new instance of the <see cref="FilteredIdentityDataConsolidator{T}"/> class
        /// </summary>
        /// <param name="predicate">The predicate function, returning true to accept data and false to reject data</param>
        public FilteredIdentityDataConsolidator(Func<T, bool> predicate)
        {
            this._predicate = predicate;
        }

        /// <summary>
        /// Updates this consolidator with the specified data
        /// </summary>
        /// <param name="data">The new data for the consolidator</param>
        public override void Update(T data)
        {
            // only permit data that passes our predicate function to be passed through
            if (_predicate(data))
            {
                base.Update(data);
            }
        }
    }

    /// <summary>
    /// Provides factory methods for creating instances of <see cref="FilteredIdentityDataConsolidator{T}"/>
    /// </summary>
    public static class FilteredIdentityDataConsolidator
    {
        /// <summary>
        /// Creates a new instance of <see cref="FilteredIdentityDataConsolidator{T}"/> that filters ticks
        /// based on the specified <see cref="TickType"/>
        /// </summary>
        /// <param name="tickType">The tick type of data to accept</param>
        /// <returns>A new <see cref="FilteredIdentityDataConsolidator{T}"/> that filters based on the provided tick type</returns>
        public static FilteredIdentityDataConsolidator<Tick> ForTickType(TickType tickType)
        {
            return new FilteredIdentityDataConsolidator<Tick>(tick => tick.TickType == tickType);
        }
    }
}


text:
package org.spongepowered.common.data.processor.value.tileentity;

import net.minecraft.block.BlockJukebox;
import net.minecraft.block.BlockJukebox.TileEntityJukebox;
import net.minecraft.block.state.IBlockState;
import net.minecraft.item.ItemRecord;
import org.spongepowered.api.block.tileentity.Jukebox;
import org.spongepowered.api.data.DataTransactionResult;
import org.spongepowered.api.data.key.Keys;
import org.spongepowered.api.data.value.ValueContainer;
import org.spongepowered.api.data.value.immutable.ImmutableValue;
import org.spongepowered.api.data.value.mutable.Value;
import org.spongepowered.api.item.inventory.ItemStackSnapshot;
import org.spongepowered.common.SpongeImpl;
import org.spongepowered.common.data.processor.common.AbstractSpongeValueProcessor;
import org.spongepowered.common.data.value.immutable.ImmutableSpongeValue;
import org.spongepowered.common.data.value.mutable.SpongeValue;

import java.util.Optional;

public class JukeboxValueProcessor extends AbstractSpongeValueProcessor<BlockJukebox.TileEntityJukebox, ItemStackSnapshot, Value<ItemStackSnapshot>> {

    public JukeboxValueProcessor() {
        super(BlockJukebox.TileEntityJukebox.class, Keys.REPRESENTED_ITEM);
    }

    @Override
    protected Value<ItemStackSnapshot> constructValue(ItemStackSnapshot value) {
        return new SpongeValue<>(Keys.REPRESENTED_ITEM, ItemStackSnapshot.NONE, value);
    }

    @Override
    protected boolean set(BlockJukebox.TileEntityJukebox jukebox, ItemStackSnapshot value) {
        IBlockState block = jukebox.getWorld().getBlockState(jukebox.getPos());
        if (value == ItemStackSnapshot.NONE) {
            if (jukebox.getRecord() == null) {
                return true;
            }
            ((Jukebox) jukebox).ejectRecord();
            block = jukebox.getWorld().getBlockState(jukebox.getPos());
            return block.getBlock() instanceof BlockJukebox && !(Boolean) block.getValue(BlockJukebox.HAS_RECORD);
        }
        if (!(value.getType() instanceof ItemRecord)) {
            return false;
        }
        ((Jukebox) jukebox).insertRecord(value.createStack());
        block = jukebox.getWorld().getBlockState(jukebox.getPos());
        return block.getBlock() instanceof BlockJukebox && (Boolean) block.getValue(BlockJukebox.HAS_RECORD);
    }

    @Override
    protected Optional<ItemStackSnapshot> getVal(BlockJukebox.TileEntityJukebox jukebox) {
        if (jukebox.getRecord() != null) {
            return Optional.of(((org.spongepowered.api.item.inventory.ItemStack) jukebox.getRecord()).createSnapshot());
        }
        return Optional.empty();
    }

    @Override
    protected ImmutableValue<ItemStackSnapshot> constructImmutableValue(ItemStackSnapshot value) {
        return new ImmutableSpongeValue<>(Keys.REPRESENTED_ITEM, ItemStackSnapshot.NONE, value);
    }

    @Override
    public DataTransactionResult removeFrom(ValueContainer<?> container) {
        if (!(container instanceof BlockJukebox.TileEntityJukebox)) {
            return DataTransactionResult.failNoData();
        }
        Optional<ItemStackSnapshot> oldValue = getVal((TileEntityJukebox) container);
        if (!oldValue.isPresent()) {
            return DataTransactionResult.successNoData();
        }
        try {
            ((Jukebox) container).ejectRecord();
            return DataTransactionResult.successRemove(constructImmutableValue(oldValue.get()));
        } catch (Exception e) {
            SpongeImpl.getLogger().error("There was an issue removing the repesented item from an Jukebox!", e);
            return DataTransactionResult.builder().result(DataTransactionResult.Type.ERROR).build();
        }
    }
}