text:
:orphan:

.. currentmodule:: discord
.. versionadded:: 1.5
.. _intents_primer:

A Primer to Gateway Intents
=============================

In version 1.5 comes the introduction of :class:`Intents`. This is a radical change in how bots are written. An intent basically allows a bot to subscribe to specific buckets of events. The events that correspond to each intent is documented in the individual attribute of the :class:`Intents` documentation.

These intents are passed to the constructor of :class:`Client` or its subclasses (:class:`AutoShardedClient`, :class:`~.AutoShardedBot`, :class:`~.Bot`) with the ``intents`` argument.

What intents are needed?
--------------------------

The intents that are necessary for your bot can only be dictated by yourself. Each attribute in the :class:`Intents` class documents what :ref:`events <discord-api-events>` it corresponds to and what kind of cache it enables.

For example, if you want a bot that functions without spammy events like presences or typing then we could do the following:

.. code-block:: python3
   :emphasize-lines: 7,9,10

    import discord
    intents = discord.Intents.default()
    intents.typing = False
    intents.presences = False

    # Somewhere else:
    # client = discord.Client(intents=intents)
    # or
    # from discord.ext import commands
    # bot = commands.Bot(command_prefix='!', intents=intents)

Note that this doesn't enable :attr:`Intents.members` since it's a privileged intent.

Another example showing a bot that only deals with messages and guild information:

.. code-block:: python3
   :emphasize-lines: 7,9,10

    import discord
    intents = discord.Intents(messages=True, guilds=True)
    # If you also want reaction events enable the following:
    # intents.reactions = True

    # Somewhere else:
    # client = discord.Client(intents=intents)
    # or
    # from discord.ext import commands
    # bot = commands.Bot(command_prefix='!', intents=intents)

.. _privileged_intents:

Privileged Intents
---------------------

With the API change requiring bot authors to specify intents, some intents were restricted further and require more manual steps. These intents are called **privileged intents**.

A privileged intent is one that requires you to go to the developer portal and manually enable it. To enable privileged intents do the following:

1. Make sure you're logged on to the `Discord website <https://discord.com>`_.
2. Navigate to the `application page <https://discord.com/developers/applications>`_.
3. Click on the bot you want to enable privileged intents for.
4. Navigate to the bot tab on the left side of the screen.

    .. image:: /images/discord_bot_tab.png
        :alt: The bot tab in the application page.

5. Scroll down to the "Privileged Gateway Intents" section and enable the ones you want.

    .. image:: /images/discord_privileged_intents.png
        :alt: The privileged gateway intents selector.

.. warning::

    Enabling privileged intents when your bot is in over 100 guilds requires going through `bot verification <https://support.discord.com/hc/en-us/articles/360040720412>`_. If your bot is already verified and you would like to enable a privileged intent you must go through `Discord support <https://dis.gd/contact>`_ and talk to them about it.

.. note::

    Even if you enable intents through the developer portal, you still have to enable the intents
    through code as well.

Do I need privileged intents?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This is a quick checklist to see if you need specific privileged intents.

.. _need_presence_intent:

Presence Intent
+++++++++++++++++

- Whether you use :attr:`Member.status` at all to track member statuses.
- Whether you use :attr:`Member.activity` or :attr:`Member.activities` to check member's activities.

.. _need_members_intent:

Member Intent
+++++++++++++++

- Whether you track member joins or member leaves, corresponds to :func:`on_member_join` and :func:`on_member_remove` events.
- Whether you want to track member updates such as nickname or role changes.
- Whether you want to track user updates such as usernames, avatars, discriminators, etc.
- Whether you want to request the guild member list through :meth:`Guild.chunk` or :meth:`Guild.fetch_members`.
- Whether you want high accuracy member cache under :attr:`Guild.members`.

.. _need_message_content_intent:

Message Content
+++++++++++++++++

- Whether you use :attr:`Message.content` to check message content.
- Whether you use :attr:`Message.attachments` to check message attachments.
- Whether you use :attr:`Message.embeds` to check message embeds.
- Whether you use :attr:`Message.components` to check message components.
- Whether you use the commands extension with a non-mentioning prefix.

.. _intents_member_cache:

Member Cache
-------------

Along with intents, Discord now further restricts the ability to cache members and expects bot authors to cache as little as is necessary. However, to properly maintain a cache the :attr:`Intents.members` intent is required in order to track the members who left and properly evict them.

To aid with member cache where we don't need members to be cached, the library now has a :class:`MemberCacheFlags` flag to control the member cache. The documentation page for the class goes over the specific policies that are possible.

It should be noted that certain things do not need a member cache since Discord will provide full member information if possible. For example:

- :func:`on_message` will have :attr:`Message.author` be a member even if cache is disabled.
- :func:`on_voice_state_update` will have the ``member`` parameter be a member even if cache is disabled.
- :func:`on_reaction_add` will have the ``user`` parameter be a member when in a guild even if cache is disabled.
- :func:`on_raw_reaction_add` will have :attr:`RawReactionActionEvent.member` be a member when in a guild even if cache is disabled.
- The reaction add events do not contain additional information when in direct messages. This is a Discord limitation.
- The reaction removal events do not have member information. This is a Discord limitation.

Other events that take a :class:`Member` will require the use of the member cache. If absolute accuracy over the member cache is desirable, then it is advisable to have the :attr:`Intents.members` intent enabled.

.. _retrieving_members:

Retrieving Members
--------------------

If the cache is disabled or you disable chunking guilds at startup, we might still need a way to load members. The library offers a few ways to do this:

- :meth:`Guild.query_members`
    - Used to query members by a prefix matching nickname or username.
    - This can also be used to query members by their user ID.
    - This uses the gateway and not the HTTP.
- :meth:`Guild.chunk`
    - This can be used to fetch the entire member list through the gateway.
- :meth:`Guild.fetch_member`
    - Used to fetch a member by ID through the HTTP API.
- :meth:`Guild.fetch_members`
    - used to fetch a large number of members through the HTTP API.

It should be noted that the gateway has a strict rate limit of 120 requests per 60 seconds.

Troubleshooting
------------------

Some common issues relating to the mandatory intent change.

Where'd my members go?
~~~~~~~~~~~~~~~~~~~~~~~~

Due to an :ref:`API change <intents_member_cache>` Discord is now forcing developers who want member caching to explicitly opt-in to it. This is a Discord mandated change and there is no way to bypass it. In order to get members back you have to explicitly enable the :ref:`members privileged intent <privileged_intents>` and change the :attr:`Intents.members` attribute to true.

For example:

.. code-block:: python3
   :emphasize-lines: 3,6,8,9

    import discord
    intents = discord.Intents.default()
    intents.members = True

    # Somewhere else:
    # client = discord.Client(intents=intents)
    # or
    # from discord.ext import commands
    # bot = commands.Bot(command_prefix='!', intents=intents)

Why does ``on_ready`` take so long to fire?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

As part of the API change regarding intents, Discord also changed how members are loaded in the beginning. Originally the library could request 75 guilds at once and only request members from guilds that have the :attr:`Guild.large` attribute set to ``True``. With the new intent changes, Discord mandates that we can only send 1 guild per request. This causes a 75x slowdown which is further compounded by the fact that *all* guilds, not just large guilds are being requested.

There are a few solutions to fix this.

The first solution is to request the privileged presences intent along with the privileged members intent and enable both of them. This allows the initial member list to contain online members just like the old gateway. Note that we're still limited to 1 guild per request but the number of guilds we request is significantly reduced.

The second solution is to disable member chunking by setting ``chunk_guilds_at_startup`` to ``False`` when constructing a client. Then, when chunking for a guild is necessary you can use the various techniques to :ref:`retrieve members <retrieving_members>`.

To illustrate the slowdown caused by the API change, take a bot who is in 840 guilds and 95 of these guilds are "large" (over 250 members).

Under the original system this would result in 2 requests to fetch the member list (75 guilds, 20 guilds) roughly taking 60 seconds. With :attr:`Intents.members` but not :attr:`Intents.presences` this requires 840 requests, with a rate limit of 120 requests per 60 seconds means that due to waiting for the rate limit it totals to around 7 minutes of waiting for the rate limit to fetch all the members. With both :attr:`Intents.members` and :attr:`Intents.presences` we mostly get the old behaviour so we're only required to request for the 95 guilds that are large, this is slightly less than our rate limit so it's close to the original timing to fetch the member list.

Unfortunately due to this change being required from Discord there is nothing that the library can do to mitigate this.

If you truly dislike the direction Discord is going with their API, you can contact them via `support <https://dis.gd/contact>`_.


text:
let path = require('path');

process.env.CODE_TESTS_PATH = path.join(process.cwd(), 'lib');
process.env.CODE_EXTENSIONS_PATH = path.join(process.cwd());

// Run the actual tests
require('vscode/bin/test');

redpajama_set_name: RedPajamaGithub


text:
/**
 * demo file only, not part of bundled ionic client
 */

import { Component } from '@angular/core';
import { ModalController } from 'ionic-angular';
import { BadgeUpClient } from '../../shared/modules/badgeup-client';
import { AchievementsOverviewModalComponent } from '../../components/achievements-overview-modal/achievements-overview-modal';
import { EarnedAchievementsModalComponent } from '../../components/earned-achievements-modal/earned-achievements-modal';

@Component({
    selector: 'page-home',
    templateUrl: 'home.html'
})
export class HomePage {

    constructor(
        private modalCtrl: ModalController,
        public badgeUpClient: BadgeUpClient
    ) {
    }

    public openOverlay() {
        const modalPage = this.modalCtrl.create(AchievementsOverviewModalComponent);
        modalPage.onDidDismiss((data) => {
            if (data && data.kind === 'all-earned') {
                this.openAllEarned();
            }
        });
        modalPage.present();
    }

    public openAllEarned() {
        const modalPage = this.modalCtrl.create(EarnedAchievementsModalComponent);
        modalPage.present();
    }

    public sendEvent() {
        this.badgeUpClient.emit({ key: 'achievement-please' });
    }
}


text:
/* General Format */

	a:link {
		color: #0066CC;
	}

	hr {
		background-color: silver;
		color: silver;
	}

	progress {
		background-color: #FCFFD2;
	}

/* AJAX Content Window */

	#ajaxContentWindow {
		border-bottom-color: #322F30;
		border-top-color: #322F30;
	}

/* Form Error Background */

	.bgFormError {
		background-color: red;
	}

/* Context Menu */

	#contextMenu {
		background-color: #F0F0EE;
		border-color: #CCCCCC;
	}

/* Context Menu Inactive */

	.contextMenuDivInactive {
		color: grey;
	}

/* Context Menu Divider */

	.contextMenuDivider {
		border-top-color: #322F30;
	}

/* Context Menu MouseOver */

	.contextMenuDivMouseOver {
		background-color: blue;
		color: white;
	}

/* Drag & Drop Check */

	#dropFilesCheckDiv {
		background-color: white;
		border-color: black;
	}

	.dropFilesCheckPassColor {
		color: green;
	}

	.dropFilesCheckFailColor {
		color: red;
	}

/* File Edit Window */

	#editContent {
		border-color: black;
	}

/* Footer Div */

	#footerDiv {
		background-color: #0088B2;
	}

/* FTP Action Buttons */

	#ftpActionButtonsDiv {
		background-color: #0088B2;
		border-top-color: #322F30;
	}

/* FTP File Listing Table */

	#ftpTable {
		border-top-color: #322F30;
	}

/* FTP File Listing Header & Rows */

	.ftpTableHeading {
		background-color: #01598B;
		border-left-color: white;
		color: white;
	}

	.trBg0 {
		background-color: #EAEAEA;
	}

	.trBg1 {
		background-color: white;
	}

/* FTP File Listing Header (no formatting) */

	.ftpTableHeadingNf {
		background-color: #01598B;
	}

/* Host/User Info Box */

	#hostInfoDiv {
		background-color: white;
		border-color: black;
		color: green;
	}

		#hostInfoDiv span {
			color: black;
		}

/* Login Form */

	#loginForm {
		border-color: black;
	}

/* Login Form Error */

	#loginFormError {
		background-color: white;
		border-color: red;
		color: red;
	}

/* Login Form Title */

	#loginFormTitle {
		background-color: #0088B2;
		border-bottom-color: black;
		color: white;
	}

/* Login Form Content */

	#loginFormContent {
		background-color: #EAEAEA
	}

/* Pop-up Border */

	#popupFrame {
		border-color: black;
	}

/* Pop-up Body */

	#popupBodyAction {
		background-color: white;
		border-left-color: green;
		border-right-color: green;
	}

	#popupBodyError {
		background-color: white;
		border-left-color: red;
		border-right-color: red;
	}

/* Pop-up Footer */

	#popupFooterAction {
		background-color: white;
		border-left-color: green;
		border-bottom-color: green;
		border-right-color: green;
	}

	#popupFooterError {
		background-color: white;
		border-left-color: red;
		border-bottom-color: red;
		border-right-color: red;
	}

/* Pop-up Header */

	#popupHeaderAction {
		background-color: white;
		color: green;
		border-left-color: green;
		border-right-color: green;
	}

	#popupHeaderError {
		background-color: white;
		color: red;
		border-left-color: red;
		border-right-color: red;
	}

/* Progress Close Button */

	.progressClose {
		border-color: gray;
		color: gray;
	}

	.progressClose:hover {
		border-color: black;
		color: black;
	}

/* Size Error Span */

	.sizeErrorSpan {
		color: red;
	}

/* Transferring to FTP */

	.transferringSpan {
		color: green;
	}

/* Upload Progress Window */

	#uploadProgressDiv {
		border-bottom-color: black;
	}


text:
namespace ui {

const char* GetEGLErrorString(uint32_t error) {
  switch (error) {
    case EGL_SUCCESS:
      return "EGL_SUCCESS";
    case EGL_NOT_INITIALIZED:
      return "EGL_NOT_INITIALIZED";
    case EGL_BAD_ACCESS:
      return "EGL_BAD_ACCESS";
    case EGL_BAD_ALLOC:
      return "EGL_BAD_ALLOC";
    case EGL_BAD_ATTRIBUTE:
      return "EGL_BAD_ATTRIBUTE";
    case EGL_BAD_CONFIG:
      return "EGL_BAD_CONFIG";
    case EGL_BAD_CONTEXT:
      return "EGL_BAD_CONTEXT";
    case EGL_BAD_CURRENT_SURFACE:
      return "EGL_BAD_CURRENT_SURFACE";
    case EGL_BAD_DISPLAY:
      return "EGL_BAD_DISPLAY";
    case EGL_BAD_MATCH:
      return "EGL_BAD_MATCH";
    case EGL_BAD_NATIVE_PIXMAP:
      return "EGL_BAD_NATIVE_PIXMAP";
    case EGL_BAD_NATIVE_WINDOW:
      return "EGL_BAD_NATIVE_WINDOW";
    case EGL_BAD_PARAMETER:
      return "EGL_BAD_PARAMETER";
    case EGL_BAD_SURFACE:
      return "EGL_BAD_SURFACE";
    case EGL_CONTEXT_LOST:
      return "EGL_CONTEXT_LOST";
    default:
      return "UNKNOWN";
  }
}

// Returns the last EGL error as a string.
const char* GetLastEGLErrorString() {
  return GetEGLErrorString(eglGetError());
}

}  // namespace ui


text:
/*
    Document   : no-more-tables
    Created on : 28/02/2012, 11:01:54 AM
    Author     : Simon Elvery
    Description:
        Demonstration of the responsive tables method described at by Chris Coyier
		at http://css-tricks.com/responsive-data-tables/
*/

@media only screen and (max-width: 600px) {

	/* Force table to not be like tables anymore */
	#no-more-tables table,
	#no-more-tables thead,
	#no-more-tables tbody,
	#no-more-tables th,
	#no-more-tables td,
	#no-more-tables tr {
		display: block;
	}

	/* Hide table headers (but not display: none;, for accessibility) */
	#no-more-tables thead tr {
		position: absolute;
		top: -9999px;
		left: -9999px;
	}

	#no-more-tables tr { border: 1px solid #ccc; }

	#no-more-tables td {
		/* Behave  like a "row" */
		border: none;
		border-bottom: 1px solid #eee;
		position: relative;
		padding-left: 50%;
		white-space: normal;
		text-align:left;
	}

	#no-more-tables td:before {
		/* Now like a table header */
		position: absolute;
		/* Top/left values mimic padding */
		top: 6px;
		left: 6px;
		width: 45%;
		padding-right: 10px;
		white-space: nowrap;
		text-align:left;
		font-weight: bold;
	}

	/*
	Label the data
	*/
	#no-more-tables td:before { content: attr(data-title); }
}


text:
package ast.expr.binExpr;

import typecheck.SymbolTable;
import ast.expr.Expr;
import ast.types.BoolType;
import ast.types.Type;
import ast.visitors.ExprVisitor;

public class LEq extends BinExpr{

	public LEq(Expr lhs, Expr rhs) {
		super(lhs, rhs);
	}

	@Override
	public <T> T accept(ExprVisitor<T> visitor) {
		return visitor.visit(this);
	}

	@Override
	public Type typeof(SymbolTable symbolTable) {
		return new BoolType();
	}

}


text:
<?xml version="1.0"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
	version="3.0">

	<context-param>
		<param-name>org.ocpsoft.rewrite.config.CONFIG_RELOADING</param-name>
		<param-value>true</param-value>
	</context-param>

</web-app>


text:
Rails.application.routes.draw do
  get  'client',              to: 'api#client'
  get  'client_with_scope',   to: 'api#client_with_scope'
  get  'resource',            to: 'api#resource'
  get  'resource_with_scope', to: 'api#resource_with_scope'
  get  'signin',              to: 'api#signin'
  get  'signout',             to: 'api#signout'
  root to: 'api#public'
end


text:
var jasmine = require('jasmine-node');
var SpecReporter = require('jasmine-spec-reporter');
var path = process.argv[2];

jasmine.executeSpecsInFolder({
  specFolders: [path],
  showColors: true
});

jasmine.getEnv().addReporter(new SpecReporter({displayStacktrace: true}));


text:
<?php

namespace hiqdev\hiart\proxy;

use GuzzleHttp\Exception\BadResponseException;

abstract class Request extends \hiqdev\hiart\AbstractRequest
{
    /**
     * @var object
     */
    protected $worker;

    abstract protected function createWorker();

    public function send($options = [])
    {
        try {
            $responseWorker = $this->getHandler()->send($this->getWorker(), $options);
        } catch (BadResponseException $exception) {
            $responseWorker = $exception->getResponse();
        }

        return new $this->responseClass($this, $responseWorker);
    }

    /**
     * @return object Worker
     */
    public function getWorker()
    {
        if ($this->worker === null) {
            $this->build();
            $this->worker = $this->createWorker();
        }

        return $this->worker;
    }
}


text:
<!DOCTYPE html>

    <title>Son of Excercise1</title>


text:
<!DOCTYPE html>

	<title>Leaderboard - Chicago Food Inspections</title>
	<link href='styles/map.css' media='all' rel='stylesheet' type='text/css' />

Home

About

Leaderboard

Violations

Chicago Food Inspections

Leaderboard

Restaurants that have gone the longest since being inspected.

          #
          Name
          Address
          Date since last inspection
          Last inspection result

A project by Derek Eder


text:
//---------------------------------------------------------------------
// <copyright file="PropertyInstance.cs" company="Microsoft">
//      Copyright (C) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
// </copyright>
//---------------------------------------------------------------------

namespace Microsoft.Test.Taupo.Astoria.Contracts.OData
{
    /// <summary>
    /// Abstract base class for primitive, complex, and navigation properties
    /// </summary>
    public abstract class PropertyInstance : ODataPayloadElement
    {
        /// <summary>
        /// Initializes a new instance of the PropertyInstance class
        /// </summary>
        /// <param name="name">The property's name</param>
        protected PropertyInstance(string name)
            : base()
        {
            this.Name = name;
        }

        /// <summary>
        /// Gets or sets the name of the property
        /// </summary>
        public string Name { get; set; }
    }
}


text:
@interface InterceptingUIWindow : UIWindow
@end

@interface VideoTapeManager : NSObject

+(void)startCapturing;
+(void)stopCapturing;
+(void)recordTouch:(CGPoint)coordinate;
+(NSDictionary *)getLastSegment;
+(float)getLastSegmentScore;

@end


text:
#import <CoreLocation/CoreLocation.h>
#import <UIKit/UIKit.h>

/** @constant AGSGTGeotriggerManager kAGSGTTrackingProfile Do not track location at all. */
static NSString * const kAGSGTTrackingProfileOff = @"off";
/** Adaptive mode intelligently turns GPS monitoring on and off based on many factors and feedback from the server in order to get the best location accuracy to battery usage ratio. This is the mode most apps will want to be in most of the time. */
static NSString * const kAGSGTTrackingProfileAdaptive = @"adaptive";
/** Rough mode will use `CoreLocation`'s `Significant Location Change` mode to track user location. This mode will use the least amount of battery, but at the cost of location accuracy. */
static NSString * const kAGSGTTrackingProfileRough = @"rough";
/** Fine mode receives the most accurate and up to date location information at the cost of battery usage. */
static NSString * const kAGSGTTrackingProfileFine = @"fine";

@class AGSGTGeotriggerManager;

@protocol AGSGTGeotriggerManagerDelegate <NSObject>
@optional

/** Tells the delegate that new location data is available.

  @param manager The `AGSGTGeotriggerManager` object that generated the event.
  @param locations The `NSArray` that the `CLLocationManager` passed to the `AGSGTGeotriggerManager`.
  @param isOnDemand A `BOOL` that indicates whether or not the locations were obtained as a result of calling `requestOnDemandUpdate:`.
 */
- (void)manager:(AGSGTGeotriggerManager *)manager didReceiveLocationUpdates:(NSArray *)locations isOnDemand:(BOOL)isOnDemand;

/** Tells the delegate that locations have been uploaded to the Geotrigger Service servers.

  @param manager The `AGSGTGeotriggerManager` object that generated the event.
  @param count The number of location updates that were sent to the server.
*/
- (void)manager:(AGSGTGeotriggerManager *)manager didUploadLocations:(NSUInteger)count;

/** Tells the delegate that locations have failed to upload to the Geotrigger Service servers.

  @param manager The `AGSGTGeotriggerManager` object that generated the event.
  @param error The error that was encountered when trying to upload the locations.
*/
- (void)manager:(AGSGTGeotriggerManager *)manager didFailToUploadLocations:(NSError *)error;

/** Tells the delegate that the Tracking Profile has been changed.

  @param manager The `AGSGTGeotriggerManager` object that generated the event.
  @param newProfile The new Tracking Profile that the `AGSGTGeotriggerManager` is using.
  @param oldProfile The Tracking Profile that the `AGSGTGeotriggerManager` was using previously.
*/
- (void)manager:(AGSGTGeotriggerManager *)manager didChangeTrackingProfileTo:(NSString *)newProfile from:(NSString *)oldProfile;

@end

/**
* The log levels available in the Geotrigger SDK.
*/
typedef NS_ENUM(int, AGSGTLogLevel) {
    /** Do not log anything. */
    AGSGTLogLevelOff = 0,
    /** Only log errors. */
    AGSGTLogLevelError = 1,
    /** Only log warnings and errors. */
    AGSGTLogLevelWarn = 3,
    /** Include some additional informative logs. */
    AGSGTLogLevelInfo = 7,
    /** Enable debug logging. Be warned, this is very chatty, and should be used for debugging only! */
    AGSGTLogLevelDebug = 15,
    /** Enable all of the logs. Be warned, this is very chatty, and should be used for debugging only! */
    AGSGTLogLevelVerbose = 31
};

/** CLLocationManagerDelegate implementation which handles the receiving and uploading of location updates to the Geotrigger Service.

 This object also provides hooks for you to respond to location updates and locations being sent to the server.
 */
@interface AGSGTGeotriggerManager : NSObject <CLLocationManagerDelegate, UIAlertViewDelegate>

/**
* The `AGSGTGeotriggerManagerDelegate` implementation that will handle all callbacks from the `AGSGTGeotriggerManager`.
*/
@property(nonatomic, weak) id<AGSGTGeotriggerManagerDelegate> delegate;

/** The tracking profile the AGSGTGeotriggerManager is currently using.

 This property is used to tell the AGSGTGeotriggerManager to optimize for accuracy vs battery life, or to turn off location updates completely.
 */
@property(nonatomic, copy) NSString *trackingProfile;

/** The default tag of this device.
*/
@property(nonatomic, strong, readonly) NSString *deviceDefaultTag;

/** The deviceId of this device.
*/
@property(nonatomic, strong, readonly) NSString *deviceId;

/** AutoSetup makes the `AGSGTGeotriggerManager` set itself as the UIApplicationDelegate for your app and forward
* all calls to your application's `UIApplicationDelegate`. This allows the Manager to handle push notifications and
* traversal to and from running in the background automatically.
*/
@property(nonatomic, assign, readwrite, getter=isAutoSetupEnabled) BOOL autoSetupEnabled;

/** Block to be called every time the `CLLocationManager` calls `locationManager:didUpdateLocations:`

 The `NSArray` that it is called with will be the same one that the `CLLocationManager` passes to its delegate.
 */
@property(copy) void(^didReceiveLocationUpdates)(NSArray *locations);

/** Block to be called every time the `CLLocationManager` calls `locationManager:didUpdateLocations:`

 The block will be called with the `CLLocation` object obtained as a result of a call to `requestOnDemandUpdate:`.
 */
@property(copy) void(^didReceiveOnDemandUpdate)(CLLocation *location);

/** Block to be called every time location updates are sent to the server.

 The block will be called with two parameters, the number of locations uploaded
 and an NSError (which will be nil on success).
 */
@property(copy) void(^didUploadLocations)(NSUInteger count, NSError *error);

/** Block to be called every time the tracking profile is changed.

 The block will be called with two parameters, the previous profile and the new current profile.
 */
@property(copy) void(^didChangeTrackingProfile)(NSString *old, NSString *new);

/** Setup the manager with the given clientId.

  @param clientId The Client ID to set the manager up with.
  @param isProduction A flag determining whether the application is signed with a Production/Distribution certificate
         or a Sandbox certificate for push notifications.
  @param completion This block will be called once the manager has finished setting itself up and is ready to upload locations. Unless
         there is an error encountered during that process, in which case the error parameter will be non-nil.
 */
+ (void)setupWithClientId:(NSString *)clientId isProduction:(BOOL)isProduction completion:(void (^)(NSError *error))completion;

/** Setup the manager with the given clientId and add the supplied list of tags to the device when it is created.

  @param clientId The Client ID to set the manager up with.
  @param isProduction A flag determining whether the application is signed with a Production/Distribution certificate
         or a Sandbox certificate for push notifications.
  @param tags An optional list of tags to be set on the device after it registers itself.
  @param completion This block will be called once the manager has finished setting itself up and is ready to upload locations. Unless
         there is an error encountered during that process, in which case the error parameter will be non-nil.
 */
+ (void)setupWithClientId:(NSString *)clientId
                  isProduction:(BOOL)isProduction
                          tags:(NSArray *)tags
                    completion:(void (^)(NSError *error))completion;

/** Setup the manager with the given clientId and configure it with the given tracking profile

  Deprecated in version 1.1.0.

  @param clientId The Client ID to set the manager up with.
  @param trackingProfile An optional kAGSGTTrackingProfile to configure the manager with once it is has been initialized.
  @param isProduction A flag determining whether the application is signed with a Production/Distribution certificate
         or a Sandbox certificate for push notifications.
  @param tags An optional list of tags to be set on the device after it registers itself.
  @param completion This block will be called once the manager has finished setting itself up and is ready to upload locations. Unless
         there is an error encountered during that process, in which case the error parameter will be non-nil.
  @deprecated Please use another setupWithClientId method.
 */
+ (void)setupWithClientId:(NSString *)clientId
               trackingProfile:(NSString *)trackingProfile
                  isProduction:(BOOL)isProduction
                          tags:(NSArray *)tags
               completion:(void (^)(NSError *error))completion __deprecated;

/** Setup the manager with the given clientId and configure it with the given tracking profile

  Deprecated in version 1.1.0.

  @param clientId The Client ID to set the manager up with.
  @param trackingProfile An optional kAGSGTTrackingProfile to configure the manager with once it is has been initialized.
  @param notificationTypes An optional type(s) of UIRemoteNotifications to register with Apple for. Set this to UIRemoteNotificationTypeNone to not register for remote notifications.
  @param isProduction A flag determining whether the application is signed with a Production/Distribution certificate
         or a Sandbox certificate for push notifications.
  @param tags An optional list of tags to be set on the device after it registers itself.
  @param completion This block will be called once the manager has finished setting itself up and is ready to upload locations. Unless
         there is an error encountered during that process, in which case the error parameter will be non-nil.
  @deprecated Please use another setupWithClientId method.
 */
+ (void)setupWithClientId:(NSString *)clientId
               trackingProfile:(NSString *)trackingProfile
registerForRemoteNotifications:(UIRemoteNotificationType)notificationTypes
                  isProduction:(BOOL)isProduction
                          tags:(NSArray *)tags
               completion:(void (^)(NSError *error))completion __deprecated;

/** Returns the singleton geotrigger manager instance.
 */
+ (instancetype)sharedManager;

#pragma mark On-Demand Update

/** Requests a single update. Useful for obtaining location information when the app enters the foreground.

  The location update will be sent to the `didReceiveOnDemandUpdate` block or the `manager:didReceiveLocationUpdates:isOnDemand:`
  delegate method, depending on which you have defined.
 */
- (void)requestOnDemandUpdate;

#pragma mark Push Notifications

/** Disable pinning the SSL Certificate to a known valid certificate when communicating with the Geotrigger Service.
*/
- (void)disableSSLCertPinning;

/** Enable pinning the SSL Certificate to a known valid certificate when communicating with the Geotrigger Service.
*/
- (void)enableSSLCertPinning;

/** Register the given token with the Geotrigger Service so that push notifications can be sent to this device.

    @param deviceToken The device token that is sent back to you from Apple in didRegisterForRemoteNotifications: on your app delegate.
    @param completion Block which will be called upon completion of the registration
*/
- (void)registerAPNSDeviceToken:(NSData *)deviceToken completion:(void (^)(NSDictionary *, NSError *))completion;

/** Handle a push notification received from the Geotrigger service.
 @param userInfo The userInfo NSDictionary that is given with the remote notification
 to application:didReceiveRemoteNotification: or application:didFinishLaunchingWithOptions:.
 */
+ (void)handlePushNotification:(NSDictionary *)userInfo;

/** Handle a push notification received from the Geotrigger service.
 @param userInfo The userInfo NSDictionary that is given with the remote notification
 to application:didReceiveRemoteNotification: or application:didFinishLaunchingWithOptions:.
 @param showAlert Flag to tell the SDK whether it should show a UIAlertView displaying the text of the notification. If set to no, and the notification has a URL set, this method will automatically open the URL.
 */
+ (void)handlePushNotification:(NSDictionary *)userInfo showAlert:(BOOL)showAlert;

#pragma mark Logging

/** Sets the log level used by the SDK. This defaults to AGSGTLogLevelWarn

  @param logLevel The AGSGTLogLevel to be used.
*/
+ (void)setLogLevel:(AGSGTLogLevel)logLevel;

/** Enables/Disables logs being written to a file on the device.
*
* @param enable Set to YES if you want the SDK to log to a file. It will log to the Library/Caches/Logs folder on the device.
*/
+ (void)enableFileLogging:(BOOL)enable;

@end


text:
import { iterate, IterateOptions, Result } from "leakage";

let optionalNumber: number | undefined;
let num = 1;
const iterateFn: () => void = () => {};
const promiseIterate: () => Promise<void> = () => Promise.resolve();
const iterateOptions: IterateOptions | undefined = { iterations: optionalNumber, gcollections: optionalNumber };

let result: Result = iterate(iterateFn, iterateOptions);
optionalNumber = 1;

iterate.async(promiseIterate, iterateOptions).then((res: Result) => result = res);

num = result.gcollections;
num = result.iterations;


text:
<!DOCTYPE html>

  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width initial-scale=1" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge">

  <title>Akang Wang | 2022_09_14_talk</title>
  <meta name="description" content="A simple, whitespace theme for academics. Based on [*folio](https://github.com/bogoli/-folio) design.
">

  <link rel="shortcut icon" href="https://akangw.github.io/assets/img/favicon.ico">

  <link rel="stylesheet" href="https://akangw.github.io/assets/css/main.css">
  <link rel="canonical" href="https://akangw.github.io/news/2022_09_14_talk/">

        Akang Wang

        about

        blog

            cv

            publications

2022_09_14_talk

September 14, 2022

I gave an invited talk entitled "An Introduction to Development and Applications of Mixed-Integer Linear Programming Solvers" at weekly seminar series organized by Prof. Chensong Zhang.

    © Copyright 2022 Akang Wang.
    Powered by Jekyll and hosted by GitHub Pages.

<link rel="stylesheet" href="https://akangw.github.io/assets/css/font-awesome.min.css">
<link rel="stylesheet" href="https://akangw.github.io/assets/css/academicons.min.css">


text:
const FormController = require('./form')
const CreateController = require('./create')
const EditController = require('./edit')

module.exports = {
  FormController,
  CreateController,
  EditController,
}


text:
package com.bankonet.dao.compte;

import java.util.List;

import com.bankonet.dto.Compte;
import com.bankonet.exception.CompteException;

public interface CompteDao {
	List<Compte> findAll();
	void save(Compte compte) throws CompteException;

}


text:
package org.apache.streams.util.oauth.tokens.tokenmanager.impl;

import org.apache.streams.util.oauth.tokens.tokenmanager.SimpleTokenManager;

import java.util.ArrayList;
import java.util.Collection;

/**
 * Manages a pool of tokens the most basic possible way.
 * If all tokens are added to the manager before {@link BasicTokenManager#getNextAvailableToken() getNextAvailableToken}
 * is called tokens are issued in the order they were added to the manager, FIFO.  The BasicTokenManager acts as a circular queue
 * of tokens.  Once the manager issues all available tokens it will cycle back to the first token and start issuing tokens again.
 *
 *

 * When adding tokens to the pool of available tokens, the manager will not add tokens that are already in the pool.
 *
 *

 * The manager class is thread safe.
 */
public class BasicTokenManager<T> implements SimpleTokenManager<T> {

  private ArrayList<T> availableTokens;
  private int nextToken;

  public BasicTokenManager() {
    this(null);
  }

  /**
   * BasicTokenManager constructor.
   * @param tokens Collection of tokens
   */
  public BasicTokenManager(Collection<T> tokens) {
    if (tokens != null) {
      this.availableTokens = new ArrayList<>(tokens.size());
      this.addAllTokensToPool(tokens);
    } else {
      this.availableTokens = new ArrayList<>();
    }
    this.nextToken = 0;
  }

  @Override
  public synchronized boolean addTokenToPool(T token) {
    return !(token == null || this.availableTokens.contains(token)) && this.availableTokens.add(token);
  }

  @Override
  public synchronized boolean addAllTokensToPool(Collection<T> tokens) {
    int startSize = this.availableTokens.size();
    for (T token : tokens) {
      this.addTokenToPool(token);
    }
    return startSize < this.availableTokens.size();
  }

  @Override
  public synchronized T getNextAvailableToken() {
    T token;
    if (this.availableTokens.size() == 0) {
      return null;
    } else {
      token = this.availableTokens.get(nextToken++);
      if (nextToken == this.availableTokens.size()) {
        nextToken = 0;
      }
      return token;
    }
  }

  @Override
  public synchronized int numAvailableTokens() {
    return this.availableTokens.size();
  }
}


text:
import React, {Component} from "react";

export default class Loader extends Component {
	render() {
		return (

		);
	}
}


text:
title: Spring使用问题记录
date: 2020-09-15 19:37:38
tags:
- Java
categories:
- Java
---

### Spring使用问题记录
本文章用来记录使用`Spring`过程中遇到的一些问题,包括解决方案

<!-- more -->

#### `AOP`类型转换的问题

在使用`aop`进行事物声明式 切面的时候,遇到下面的报错:
```bash
  java.lang.ClassCastException: com.sun.proxy.$Proxy13 cannot be cast to org.example.spring.dao.AssetCategoryDaoImpl
```
事例代码:
```xml
  <!--  结合AOP实现事务的织入-->
  <aop:config>
    <!--    配置事务切入点-->
    <aop:pointcut id="txPointCut" expression="execution(* org.example.spring.dao.AssetCategoryDaoImpl.select())"/>
    <aop:advisor advice-ref="txAdvice" pointcut-ref="txPointCut"/>
  </aop:config>
```
```java
  @org.junit.Testpublic
  public void test2() {
    ApplicationContext context = new ClassPathXmlApplicationContext("beans.xml");
    AssetCategoryDaoImpl bean = (AssetCategoryDaoImpl) context.getBean("assetCategoryDao"); // 这里报错
    List<AssetCategory> ls = bean.select();
    for (AssetCategory l : ls) {
      System.out.println(l.toString());
    }
  }
```

报错代码:
```java
  AssetCategoryDaoImpl bean = (AssetCategoryDaoImpl) context.getBean("assetCategoryDao");
  // 报错的根源: 不能用接口的实现类(AssetCategoryDaoImpl)来转换Proxy的实现类,它们是同级,应该用共同的接口来转换
```
所以解决方案如下:
```java
  @org.junit.Testpublic
  public void test2() {
    ApplicationContext context = new ClassPathXmlApplicationContext("beans.xml");
    // AssetCategoryMapper Dao 层面的接口
    AssetCategoryMapper bean = (AssetCategoryMapper) context.getBean("assetCategoryDao");
    List<AssetCategory> ls = bean.select();
    for (AssetCategory l : ls) {
      System.out.println(l.toString());
    }
  }
```

#### `GET`请求数组参数的问题

在使用`GET`请求的情况下,如果参数有数组的情况会报错.
```java
  @RequestParam(value = "arrays[]", defaultValue = "") int[] arrays
  // the valid characters are defined in rfc 7230 and rfc 3986 spring boot
```
原因是:**我们在前后台交互的时候往往使用json格式的字段串参数,其中含有"{}""[]"这些特舒符号,在高版本的tomcat中含有这些字符的请求会被拦截**

解决方法一:降低tomcat版本(不推荐),将tomcat版本改到`tomcat8.5`以下,但是我并不推荐这种办法,因为你以后的开发迟早要使用更新的版本,所以怎么修改tomcat版本我就不介绍了

方法二:在`springboot`工程中增加一个`tomcat`配置,或者将`webServerFactory`方法加入到`springboot`启动类中,配置文件代码如下

```java
  @Configuration
  public class TomcatConfig {

    @Bean
    public TomcatServletWebServerFactory webServerFactory() {
      TomcatServletWebServerFactory factory = new TomcatServletWebServerFactory();
      factory.addConnectorCustomizers((Connector connector) -> {
        connector.setProperty("relaxedPathChars", "\"<>[\\]^`{|}");
        connector.setProperty("relaxedQueryChars", "\"<>[\\]^`{|}");
      });
      return factory;
    }
  }
```


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd">

<TITLE>
Xerces2 Implementation: Class  XSAttributeChecker
</TITLE>
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../../stylesheet.css" TITLE="Style">

      Overview
      Package
    Class
      Tree
      Serialized
      Deprecated
      Index
      Help

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  SUMMARY:  INNER | FIELD | CONSTR | METHOD

DETAIL:  FIELD | CONSTR | METHOD

org.apache.xerces.impl.xs.traversers

Class  XSAttributeChecker

java.lang.Object
  |
  +--org.apache.xerces.impl.xs.traversers.XSAttributeChecker

public class XSAttributeChecker
extends java.lang.Object

Class XSAttributeCheck is used to check the validity of attributes
 appearing in the schema document. It
 - reports an error for invalid element (invalid namespace, invalid name)
 - reports an error for invalid attribute (invalid namespace, invalid name)
 - reports an error for invalid attribute value
 - return compiled values for attriute values
 - provide default value for missing optional attributes
 - provide default value for incorrect attribute values

 But it's the caller's responsibility to check whether a required attribute
 is present.

 Things need revisiting:
 - Whether to return non-schema attributes/values
 - Do we need to update NamespaceScope and ErrorReporter when reset()?
 - Should have the datatype validators return compiled value
 - use symbol table instead of many hashtables

INTERNAL:

Usage of this class is not supported. It may be altered or removed at any time.

Version:
$Id: XSAttributeChecker.java 704619 2008-10-14 18:59:35Z mrglavas $

Author:
Sandy Gao, IBM

Field Summary

static int
ATTIDX_ABSTRACT

static int
ATTIDX_AFORMDEFAULT

static int
ATTIDX_BASE

static int
ATTIDX_BLOCK

static int
ATTIDX_BLOCKDEFAULT

static int
ATTIDX_DEFAULT

static int
ATTIDX_EFORMDEFAULT

static int
ATTIDX_ENUMNSDECLS

static int
ATTIDX_FINAL

static int
ATTIDX_FINALDEFAULT

static int
ATTIDX_FIXED

static int
ATTIDX_FORM

static int
ATTIDX_FROMDEFAULT

static int
ATTIDX_ID

static int
ATTIDX_ISRETURNED

static int
ATTIDX_ITEMTYPE

static int
ATTIDX_MAXOCCURS

static int
ATTIDX_MEMBERTYPES

static int
ATTIDX_MINOCCURS

static int
ATTIDX_MIXED

static int
ATTIDX_NAME

static int
ATTIDX_NAMESPACE

static int
ATTIDX_NAMESPACE_LIST

static int
ATTIDX_NILLABLE

static int
ATTIDX_NONSCHEMA

static int
ATTIDX_PROCESSCONTENTS

static int
ATTIDX_PUBLIC

static int
ATTIDX_REF

static int
ATTIDX_REFER

static int
ATTIDX_SCHEMALOCATION

static int
ATTIDX_SOURCE

static int
ATTIDX_SUBSGROUP

static int
ATTIDX_SYSTEM

static int
ATTIDX_TARGETNAMESPACE

static int
ATTIDX_TYPE

static int
ATTIDX_USE

static int
ATTIDX_VALUE

static int
ATTIDX_VERSION

static int
ATTIDX_XML_LANG

static int
ATTIDX_XPATH

protected static int
DT_ANYURI

protected static int
DT_BLOCK

protected static int
DT_BLOCK1

protected static int
DT_BOOLEAN

protected static int
DT_COUNT

protected static int
DT_FINAL

protected static int
DT_FINAL1

protected static int
DT_FINAL2

protected static int
DT_FORM

protected static int
DT_ID

protected static int
DT_LANGUAGE

protected static int
DT_MAXOCCURS

protected static int
DT_MAXOCCURS1

protected static int
DT_MEMBERTYPES

protected static int
DT_MINOCCURS1

protected static int
DT_NAMESPACE

protected static int
DT_NCNAME

protected static int
DT_NONNEGINT

protected static int
DT_POSINT

protected static int
DT_PROCESSCONTENTS

protected static int
DT_QNAME

protected static int
DT_STRING

protected static int
DT_TOKEN

protected static int
DT_USE

protected static int
DT_WHITESPACE

protected static int
DT_XPATH

protected static int
DT_XPATH1

protected  java.util.Vector
fNamespaceList

protected  java.util.Hashtable
fNonSchemaAttrs

protected  XSDHandler
fSchemaHandler

protected  boolean[]
fSeen

protected  SymbolTable
fSymbolTable

Constructor Summary

XSAttributeChecker(XSDHandler schemaHandler)

Method Summary

 java.lang.Object[]
checkAttributes(org.w3c.dom.Element element,
                boolean isGlobal,
                org.apache.xerces.impl.xs.traversers.XSDocumentInfo schemaDoc)

          Check whether the specified element conforms to the attributes restriction
 an array of attribute values is returned.

 java.lang.Object[]
checkAttributes(org.w3c.dom.Element element,
                boolean isGlobal,
                org.apache.xerces.impl.xs.traversers.XSDocumentInfo schemaDoc,
                boolean enumAsQName)

          Check whether the specified element conforms to the attributes restriction
 an array of attribute values is returned.

 void
checkNonSchemaAttributes(XSGrammarBucket grammarBucket)

protected  java.lang.Object[]
getAvailableArray()

static java.lang.String
normalize(java.lang.String content,
          short ws)

 void
reset(SymbolTable symbolTable)

 void
resolveNamespace(org.w3c.dom.Element element,
                 org.w3c.dom.Attr[] attrs,
                 SchemaNamespaceSupport nsSupport)

 void
returnAttrArray(java.lang.Object[] attrArray,
                org.apache.xerces.impl.xs.traversers.XSDocumentInfo schemaDoc)

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Detail

ATTIDX_ABSTRACT

public static final int ATTIDX_ABSTRACT

ATTIDX_AFORMDEFAULT

public static final int ATTIDX_AFORMDEFAULT

ATTIDX_BASE

public static final int ATTIDX_BASE

ATTIDX_BLOCK

public static final int ATTIDX_BLOCK

ATTIDX_BLOCKDEFAULT

public static final int ATTIDX_BLOCKDEFAULT

ATTIDX_DEFAULT

public static final int ATTIDX_DEFAULT

ATTIDX_EFORMDEFAULT

public static final int ATTIDX_EFORMDEFAULT

ATTIDX_FINAL

public static final int ATTIDX_FINAL

ATTIDX_FINALDEFAULT

public static final int ATTIDX_FINALDEFAULT

ATTIDX_FIXED

public static final int ATTIDX_FIXED

ATTIDX_FORM

public static final int ATTIDX_FORM

ATTIDX_ID

public static final int ATTIDX_ID

ATTIDX_ITEMTYPE

public static final int ATTIDX_ITEMTYPE

ATTIDX_MAXOCCURS

public static final int ATTIDX_MAXOCCURS

ATTIDX_MEMBERTYPES

public static final int ATTIDX_MEMBERTYPES

ATTIDX_MINOCCURS

public static final int ATTIDX_MINOCCURS

ATTIDX_MIXED

public static final int ATTIDX_MIXED

ATTIDX_NAME

public static final int ATTIDX_NAME

ATTIDX_NAMESPACE

public static final int ATTIDX_NAMESPACE

ATTIDX_NAMESPACE_LIST

public static final int ATTIDX_NAMESPACE_LIST

ATTIDX_NILLABLE

public static final int ATTIDX_NILLABLE

ATTIDX_NONSCHEMA

public static final int ATTIDX_NONSCHEMA

ATTIDX_PROCESSCONTENTS

public static final int ATTIDX_PROCESSCONTENTS

ATTIDX_PUBLIC

public static final int ATTIDX_PUBLIC

ATTIDX_REF

public static final int ATTIDX_REF

ATTIDX_REFER

public static final int ATTIDX_REFER

ATTIDX_SCHEMALOCATION

public static final int ATTIDX_SCHEMALOCATION

ATTIDX_SOURCE

public static final int ATTIDX_SOURCE

ATTIDX_SUBSGROUP

public static final int ATTIDX_SUBSGROUP

ATTIDX_SYSTEM

public static final int ATTIDX_SYSTEM

ATTIDX_TARGETNAMESPACE

public static final int ATTIDX_TARGETNAMESPACE

ATTIDX_TYPE

public static final int ATTIDX_TYPE

ATTIDX_USE

public static final int ATTIDX_USE

ATTIDX_VALUE

public static final int ATTIDX_VALUE

ATTIDX_ENUMNSDECLS

public static final int ATTIDX_ENUMNSDECLS

ATTIDX_VERSION

public static final int ATTIDX_VERSION

ATTIDX_XML_LANG

public static final int ATTIDX_XML_LANG

ATTIDX_XPATH

public static final int ATTIDX_XPATH

ATTIDX_FROMDEFAULT

public static final int ATTIDX_FROMDEFAULT

ATTIDX_ISRETURNED

public static final int ATTIDX_ISRETURNED

DT_ANYURI

protected static final int DT_ANYURI

DT_ID

protected static final int DT_ID

DT_QNAME

protected static final int DT_QNAME

DT_STRING

protected static final int DT_STRING

DT_TOKEN

protected static final int DT_TOKEN

DT_NCNAME

protected static final int DT_NCNAME

DT_XPATH

protected static final int DT_XPATH

DT_XPATH1

protected static final int DT_XPATH1

DT_LANGUAGE

protected static final int DT_LANGUAGE

DT_COUNT

protected static final int DT_COUNT

DT_BLOCK

protected static final int DT_BLOCK

DT_BLOCK1

protected static final int DT_BLOCK1

DT_FINAL

protected static final int DT_FINAL

DT_FINAL1

protected static final int DT_FINAL1

DT_FINAL2

protected static final int DT_FINAL2

DT_FORM

protected static final int DT_FORM

DT_MAXOCCURS

protected static final int DT_MAXOCCURS

DT_MAXOCCURS1

protected static final int DT_MAXOCCURS1

DT_MEMBERTYPES

protected static final int DT_MEMBERTYPES

DT_MINOCCURS1

protected static final int DT_MINOCCURS1

DT_NAMESPACE

protected static final int DT_NAMESPACE

DT_PROCESSCONTENTS

protected static final int DT_PROCESSCONTENTS

DT_USE

protected static final int DT_USE

DT_WHITESPACE

protected static final int DT_WHITESPACE

DT_BOOLEAN

protected static final int DT_BOOLEAN

DT_NONNEGINT

protected static final int DT_NONNEGINT

DT_POSINT

protected static final int DT_POSINT

fSchemaHandler

protected XSDHandler fSchemaHandler

fSymbolTable

protected SymbolTable fSymbolTable

fNonSchemaAttrs

protected java.util.Hashtable fNonSchemaAttrs

fNamespaceList

protected java.util.Vector fNamespaceList

fSeen

protected boolean[] fSeen

Constructor Detail

XSAttributeChecker

public XSAttributeChecker(XSDHandler schemaHandler)

Method Detail

reset

public void reset(SymbolTable symbolTable)

checkAttributes

public java.lang.Object[] checkAttributes(org.w3c.dom.Element element,
                                          boolean isGlobal,
                                          org.apache.xerces.impl.xs.traversers.XSDocumentInfo schemaDoc)

Check whether the specified element conforms to the attributes restriction
 an array of attribute values is returned. the caller must call
 returnAttrArray to return that array.

Parameters:
element - which element to check
isGlobal - whether a child of <schema> or <redefine>
schemaDoc - the document where the element lives in
Returns:
an array containing attribute values

checkAttributes

public java.lang.Object[] checkAttributes(org.w3c.dom.Element element,
                                          boolean isGlobal,
                                          org.apache.xerces.impl.xs.traversers.XSDocumentInfo schemaDoc,
                                          boolean enumAsQName)

Check whether the specified element conforms to the attributes restriction
 an array of attribute values is returned. the caller must call
 returnAttrArray to return that array. This method also takes
 an extra parameter: if the element is "enumeration", whether to make a
 copy of the namespace context, so that the value can be resolved as a
 QName later.

Parameters:
element - which element to check
isGlobal - whether a child of <schema> or <redefine>
schemaDoc - the document where the element lives in
enumAsQName - whether to tread enumeration value as QName
Returns:
an array containing attribute values

checkNonSchemaAttributes

public void checkNonSchemaAttributes(XSGrammarBucket grammarBucket)

normalize

public static java.lang.String normalize(java.lang.String content,
                                         short ws)

getAvailableArray

protected java.lang.Object[] getAvailableArray()

returnAttrArray

public void returnAttrArray(java.lang.Object[] attrArray,
                            org.apache.xerces.impl.xs.traversers.XSDocumentInfo schemaDoc)

resolveNamespace

public void resolveNamespace(org.w3c.dom.Element element,
                             org.w3c.dom.Attr[] attrs,
                             SchemaNamespaceSupport nsSupport)

      Overview
      Package
    Class
      Tree
      Serialized
      Deprecated
      Index
      Help

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  SUMMARY:  INNER | FIELD | CONSTR | METHOD

DETAIL:  FIELD | CONSTR | METHOD

Copyright © 1999-2010 The Apache Software Foundation. All Rights Reserved.


text:
class afApplicationTreeItemData;

/// -----------------------------------------------------------------------------------------------
/// \class Name: AF_API afTreeDataExtension
/// \brief Description:  Is used for extending the tree item data
/// -----------------------------------------------------------------------------------------------
class AF_API afTreeDataExtension : public QObject
{
    Q_OBJECT

public:
    afTreeDataExtension() { m_pParentData = nullptr;}
    virtual bool isSameObject(afTreeDataExtension* pOtherItemData) const = 0;
    virtual void copyID(afTreeDataExtension*& pOtherItemData) const = 0;

    afApplicationTreeItemData* m_pParentData;
};

/// -----------------------------------------------------------------------------------------------
/// \class Name: AF_API afApplicationTreeItemData
/// \brief Description:  This class is a base class for an item data to the application tree
///                      When the tree is expanded, this data should be used as base for each item
//                       data set to tree widget items
/// -----------------------------------------------------------------------------------------------
class AF_API afApplicationTreeItemData
{
public:
    afApplicationTreeItemData(bool handleExtendedDataMemory = false);
    virtual ~afApplicationTreeItemData();

    virtual bool isSameObject(const afApplicationTreeItemData* pOtherItemData) const;

    /// Item load & display status:
    static bool itemTypeAsString(afTreeItemType itemType, gtString& itemTypeStr);
    bool getItemStatusAsString(afTreeItemType itemType, gtString& statusTitle, gtString& statusStr);
    void setItemLoadStatus(afItemLoadStatusType itemLoadStatus, afItemLoadFailureDescription loadDescription = AF_ITEM_ERROR_UNKNOWN);
    bool isItemDisplayed();

    /// Item type queries:
    static afTreeItemType itemTypeToParent(afTreeItemType itemType) ;
    static bool isItemTypeRoot(afTreeItemType itemType) ;
    static bool isItemImageOrBuffer(afTreeItemType itemType);
    static bool isItemImage(afTreeItemType itemType);
    static bool isItemSource(afTreeItemType itemType);
    static bool isItemThumbnail(afTreeItemType itemType);
    static bool isItemBuffer(afTreeItemType itemType);

    /// Extended data:
    void setExtendedData(afTreeDataExtension* pExtensionData);
    afTreeDataExtension* extendedItemData() const {return m_pExtendedItemData;};

    virtual void copyID(afApplicationTreeItemData& other) const;

    /// Object type:
    afTreeItemType m_itemType;

    /// Contain true if the item should be removed:
    bool m_isItemRemovable;

    /// Tree item ID:
    QTreeWidgetItem* m_pTreeWidgetItem;

    /// The tree item ID for the original item (used for shortcut items):
    QTreeWidgetItem* m_pOriginalItemTreeItem;

    /// The item index within other children on the tree:
    int m_itemTreeIndex;

    /// Is this the tree root data?
    bool m_isRoot;

    /// Objects amount (under this item):
    int m_objectCount;

    /// Object size (In KB):
    gtSize_t m_objectMemorySize;

    /// Item load status:
    afItemLoadStatus _itemLoadStatus;

    /// True iff the extended memory should be handled:
    bool m_handleExtendedDataMemory;

    /// Contain the file that is representing the element. If not empty, will be opened in object activation. Can be empty:
    osFilePath m_filePath;

    /// Contain the line number the view that is supposed to be opened for m_filePath:
    int m_filePathLineNumber;

protected:
    /// Contain an extended data:
    afTreeDataExtension* m_pExtendedItemData;
};

/// -----------------------------------------------------------------------------------------------
/// \class Name: AF_API afApplicationTreeMessageItemData
/// \brief Description:  Tree item data extension for AF_TREE_ITEM_MESSAGE.
/// -----------------------------------------------------------------------------------------------
class AF_API afApplicationTreeMessageItemData : public afTreeDataExtension
{
    Q_OBJECT

public:
    virtual bool isSameObject(afTreeDataExtension* pOtherItemData) const;
    virtual void copyID(afTreeDataExtension*& pOtherItemData) const;

public:
    gtString m_messageTitle;
    gtString m_messageText;
};

AF_API afApplicationTreeItemData* afCreateMessageTreeItemData(const gtString& messageTitle, const gtString& messageText);

#endif //__AFAPPLICATIONTREEITEMDATA_H


text:
a {
  color: #006666;
}
.bg-red {
  background-color: #d92f00;
  color: white;
}
.bg-grey {
  background-color: #f6f6f6;
}
.wp-pagenavi {
  margin: 40px 0;
  color: white;
  font-size: 1em;
}
.wp-pagenavi span {
  background: #999;
  border: none;
}
.wp-pagenavi a {
  background: #006666;
  border-color: #004d4d;
  color: white;
}
.wp-pagenavi a:hover {
  background: #003333;
  text-decoration: none;
}
.wp-pagenavi span,
.wp-pagenavi a {
  padding: 7px 10px;
  margin-right: 4px;
  display: inline-block;
  margin-bottom: 5px;
}
.navbar {
  margin-bottom: 0;
  background: #005c5c;
  border-radius: 0;
}
.navbar ul.navbar-nav {
  padding: 0;
}
.navbar ul.navbar-nav li {
  padding: 0;
  margin: 0;
}
.navbar ul.navbar-nav li a {
  color: white;
  font-weight: 600;
}
@media (max-width: 991px) {
  .navbar ul.navbar-nav li a {
    padding: 15px 10px;
  }
}
@media (max-width: 767px) {
  .navbar ul.navbar-nav li a {
    padding: 10px;
  }
}
.navbar ul.navbar-nav li a:hover,
.navbar ul.navbar-nav li a:active,
.navbar ul.navbar-nav li a:focus,
.navbar ul.navbar-nav li.current-menu-item a {
  background-color: #005252;
}
@media (max-width: 991px) {
  .navbar ul.navbar-nav {
    font-size: 0.85em;
  }
}
.navbar ul.navbar-nav .dropdown-menu {
  background: #005252;
  border-radius: 0;
  padding: 5px;
}
.navbar ul.navbar-nav .dropdown-menu li a {
  padding: 8px;
}
.navbar .navbar-toggle {
  padding: 9px 0;
}
.navbar .navbar-toggle .icon-bar {
  background-color: white;
}
.navbar ul {
  padding: 0;
}
.navbar ul li {
  padding-bottom: 0;
}
.navbar .navbar-header a.navbar-brand {
  color: white;
}
@media (max-width: 500px) {
  .navbar .navbar-header a.navbar-brand {
    height: auto;
    max-width: 85%;
  }
}
.navbar .nav-search .form-group {
  position: relative;
  width: 200px;
}
.navbar .nav-search .form-group input {
  width: 100%;
}
.navbar .nav-search .form-group button {
  background: none;
  border: 0;
  position: absolute;
  right: 2px;
  top: 4px;
}
.breadcrumb {
  margin-top: 30px;
  margin-bottom: 10px;
  background: none;
}
.header {
  background-color: #006666;
  color: white;
  padding: 30px 0 100px 0;
  position: relative;
}
.header .row {
  display: table;
  margin: 0;
  padding: 0;
  width: 100%;
  display: flex;
  align-items: center;
}
@media (max-width: 991px) {
  .header .row {
    display: table;
  }
}
.header .row .col {
  display: inline-block;
  float: none;
  vertical-align: middle;
}
@media (max-width: 991px) {
  .header .row .col {
    width: 100%;
    display: block;
  }
}
.header p {
  margin: 0;
}
.header .rectangles {
  background-image: url('../img/rectangles-header.png');
  position: absolute;
  width: 100%;
  left: 0;
  height: 186px;
  bottom: -74px;
}
.logo-group {
  display: flex !important;
  justify-content: flex-start;
  align-items: center;
}
@media (max-width: 767px) {
  .logo-group {
    align-items: flex-start;
  }
}
.logo-group img {
  width: 90px;
  height: auto;
  margin-right: 15px;
  padding-bottom: 20px;
}
@media (max-width: 767px) {
  .logo-group img {
    width: 50px;
  }
}
.logo-group h1 {
  text-transform: uppercase;
  font-weight: 300;
  font-size: 1.8em;
  margin-bottom: 2px;
  margin-top: 0;
}
@media (max-width: 767px) {
  .logo-group h1 {
    font-size: 1.3em;
  }
}
.logo-group h1 .network-country,
.logo-group h1 .network-area {
  display: block;
}
.logo-group h1 .network-country {
  font-weight: 600;
}
.logo-group h1 .network-area {
  font-weight: 200;
  font-size: .8125em;
}
.margin-0 {
  margin: 0 !important;
}
.margin-top-0 {
  margin-top: 0 !important;
}
.margin-top-5 {
  margin-top: 5px !important;
}
.margin-top-10 {
  margin-top: 10px !important;
}
.margin-top-15 {
  margin-top: 15px !important;
}
.margin-top-20 {
  margin-top: 20px !important;
}
.margin-top-30 {
  margin-top: 30px !important;
}
.margin-top-40 {
  margin-top: 40px !important;
}
.margin-bottom-0 {
  margin-bottom: 0 !important;
}
.margin-bottom-10 {
  margin-bottom: 10px !important;
}
.margin-bottom-15 {
  margin-bottom: 15px !important;
}
.margin-bottom-20 {
  margin-bottom: 20px !important;
}
.margin-bottom-30 {
  margin-bottom: 30px !important;
}
.margin-bottom-40 {
  margin-bottom: 40px !important;
}
.padding-top-0 {
  padding-top: 0 !important;
}
.padding-top-5 {
  padding-top: 5px !important;
}
.padding-top-10 {
  padding-top: 10px !important;
}
.padding-top-15 {
  padding-top: 15px !important;
}
.padding-top-20 {
  padding-top: 20px !important;
}
.padding-top-30 {
  padding-top: 30px !important;
}
.padding-top-40 {
  padding-top: 40px !important;
}
.padding-bottom-0 {
  padding-bottom: 0 !important;
}
.padding-bottom-5 {
  padding-bottom: 5px !important;
}
.padding-bottom-10 {
  padding-bottom: 10px !important;
}
.padding-bottom-15 {
  padding-bottom: 15px !important;
}
.padding-bottom-60 {
  padding-bottom: 50px !important;
}
.wide-gutter-row {
  margin-left: -25px;
  margin-right: -25px;
}
@media (max-width: 991px) {
  .wide-gutter-row {
    margin-left: -15px;
    margin-right: -15px;
  }
}
.wide-gutter-col {
  padding-left: 25px !important;
  padding-right: 25px !important;
}
@media (max-width: 991px) {
  .wide-gutter-col {
    padding-left: 15px !important;
    padding-right: 15px !important;
  }
}
.footer {
  background-color: #005180;
  padding: 130px 0 40px 0;
  color: rgba(255, 255, 255, 0.8);
  position: relative;
}
.footer a {
  color: white;
}
.footer a:hover,
.footer a:active,
.footer a:focus {
  color: white;
  text-decoration: underline;
}
.footer .rectangles {
  background-image: url('../img/rectangles-footer.png');
  position: absolute;
  width: 100%;
  left: 0;
  height: 186px;
  top: -74px;
}
.social-icon {
  display: block;
  background-image: url(../img/opengov-socialicons.png);
  width: 50px;
  height: 50px;
  margin-right: 8px;
  margin-bottom: 15px;
  float: left;
}
.social-icon.twitter {
  background-position: 166px 0;
}
.social-icon.email {
  background-position: 50px 0;
}
.social-icon.forum {
  background-position: 108px 0;
}
.social-icon.rss {
  background-position: 0 0;
}
.media {
  padding: 10px 0;
}
.media img {
  margin-right: 20px;
}
.media p {
  margin: 0;
}
.media .meta {
  font-weight: 600;
  margin: 5px 0;
}
ul {
  padding-left: 17px;
}
ul li {
  margin-bottom: 8px;
}
.btn {
  border-radius: 0;
  font-weight: 600;
  font-size: 17px;
}
.btn.btn-primary {
  background-color: #ED6F28;
  border: 1px solid #ED6F28;
}
.btn.btn-primary:hover,
.btn.btn-primary:active,
.btn.btn-primary:focus {
  background-color: #e86013;
}
.btn.btn-default {
  color: #fff;
  background-color: rgba(0, 102, 102, 0.5);
  border: 1px solid rgba(0, 102, 102, 0.3);
  text-shadow: 1px 1px 0 rgba(0, 102, 102, 0.9);
}
.btn.btn-default:hover,
.btn.btn-default:active,
.btn.btn-default:focus {
  background: #006666;
}
.form-control {
  border-radius: 0;
}
@media (max-width: 767px) {
  .media-left {
    display: none;
  }
}
.nav-tabs li a {
  background-color: rgba(0, 102, 102, 0.5);
  color: white;
  margin-left: 5px;
  font-weight: bold;
  padding: 7px 12px;
  border-radius: 0;
}
.nav-tabs li a:hover,
.nav-tabs li a:active,
.nav-tabs li a:focus,
.nav-tabs li.active a,
.nav-tabs li.active a:hover,
.nav-tabs li.active a:active,
.nav-tabs li.active a:focus {
  background: #006666;
  color: white;
}
.tab-content .tab-pane {
  padding: 30px 30px 15px 30px;
  border-left: 1px solid;
  border-bottom: 1px solid;
  border-right: 1px solid;
  border-color: #ddd;
}
.tab-content .tab-pane h3 {
  margin-top: 0;
}
.tab-content .tab-pane .btn {
  margin-top: 7px;
}
.home h2 {
  margin-bottom: 35px;
}
.lead-summary-section h2 {
  margin-bottom: 10px;
}
.lead-summary-section p {
  font-size: 21px;
}
@media (max-width: 500px) {
  .lead-summary-section p {
    font-size: 18px;
  }
}
.lead-summary-link {
  margin: 10px 0 25px;
}
.pm-letter-section {
  margin-top: .4em;
}
.pm-letter-section img {
  float: right;
  margin: 0 0 1em 1em;
  border: #bbb 1px solid;
}
.home-features {
  padding: 25px;
}
.home-features img {
  width: 70px;
  height: auto;
  margin: 10px auto 15px auto;
}
.event-list .media .date {
  background-color: #d92f00;
  color: white;
  display: block;
  padding: 12px 10px;
  text-align: center;
  line-height: 1.3em;
  margin-right: 10px;
}
.event-list .media .date span {
  display: block;
  font-size: 1.5em;
  padding: 0;
  margin: 0;
}
.event-list .media .media-heading {
  padding-top: 7px;
}
.alignleft {
  display: inline;
  float: left;
  margin-right: 1.5em;
  margin-bottom: 15px;
  margin-top: 5px;
}
.alignright {
  display: inline;
  float: right;
  margin-left: 1.5em;
  margin-bottom: 15px;
  margin-top: 5px;
}
.aligncenter {
  clear: both;
  display: block;
  margin-left: auto;
  margin-right: auto;
  max-width: 100%;
  height: auto;
  margin-bottom: 15px;
}
@media (max-width: 767px) {
  .alignleft,
  .alignright {
    float: none;
    margin: 15px auto;
    display: block;
    max-width: 100%;
    height: auto;
  }
}
.hentry ul li {
  margin-bottom: 10px;
}
.wp-caption {
  margin-bottom: 1.5em;
  max-width: 100%;
}
.wp-caption img[class*="wp-image-"] {
  display: block;
  margin: 0 auto;
}
.wp-caption-text {
  text-align: center;
}
.wp-caption .wp-caption-text {
  margin: 0.8075em 0;
}
.gallery {
  margin-bottom: 1.5em;
  margin-top: 1.25em;
}
.gallery-item {
  display: inline-block;
  text-align: center;
  vertical-align: top;
  width: 100%;
  margin-bottom: 1em;
}
.gallery-columns-2 .gallery-item {
  max-width: 50%;
}
.gallery-columns-3 .gallery-item {
  max-width: 33.33%;
}
.gallery-columns-4 .gallery-item {
  max-width: 25%;
}
.gallery-columns-5 .gallery-item {
  max-width: 20%;
}
.gallery-columns-6 .gallery-item {
  max-width: 16.66%;
}
.gallery-columns-7 .gallery-item {
  max-width: 14.28%;
}
.gallery-columns-8 .gallery-item {
  max-width: 12.5%;
}
.gallery-columns-9 .gallery-item {
  max-width: 11.11%;
}
.gallery-caption {
  display: none;
}
@media only screen and (max-width: 768px) {
  .gallery-size-thumbnail .gallery-item {
    max-width: 50% !important;
    width: 50% !important;
  }
}
.comments-area .comment-list {
  list-style: none;
  padding: 0;
}
.comments-area .comment-list .comment,
.comments-area .comment-list .pingback {
  padding: 20px 0;
  border-bottom: 1px solid #ddd;
}
.comments-area .comment-list .comment .comment-author,
.comments-area .comment-list .pingback .comment-author {
  padding-top: 15px;
}
.comments-area .comment-list .comment .comment-author .avatar,
.comments-area .comment-list .pingback .comment-author .avatar {
  float: left;
  margin-right: 15px;
  margin-bottom: 10px;
  margin-top: -5px;
}
.comments-area .comment-list .comment .comment-author .fn,
.comments-area .comment-list .pingback .comment-author .fn {
  padding-top: 5px;
}
.comments-area .comment-list .comment p,
.comments-area .comment-list .pingback p {
  clear: both;
}
.comments-area .comment-list .comment .children,
.comments-area .comment-list .pingback .children {
  list-style: none;
}
.comments-area .comment-list .comment .children .comment,
.comments-area .comment-list .pingback .children .comment {
  border-bottom: 0;
  border-top: 1px solid #ddd;
  margin-top: 20px;
}
.comments-area .comment-list .comment .comment-reply-link,
.comments-area .comment-list .pingback .comment-reply-link {
  background-color: #ED6F28;
  border: 1px solid #ED6F28;
  font-weight: 600;
  font-size: 15px;
  color: white;
  padding: 3px 8px;
  margin-top: 5px;
  display: inline-block;
}
.comments-area .comment-list .comment .comment-reply-link:hover,
.comments-area .comment-list .pingback .comment-reply-link:hover,
.comments-area .comment-list .comment .comment-reply-link:active,
.comments-area .comment-list .pingback .comment-reply-link:active,
.comments-area .comment-list .comment .comment-reply-link:focus,
.comments-area .comment-list .pingback .comment-reply-link:focus {
  background-color: #e86013;
  text-decoration: none;
}
.comments-area .comment-respond .comment-form-comment textarea {
  width: 100%;
  display: block;
}
.comments-area .comment-respond .submit {
  background-color: #ED6F28;
  border: 1px solid #ED6F28;
  font-weight: 600;
  font-size: 17px;
  color: white;
  padding: 6px 12px;
  margin-top: 10px;
}
.comments-area .comment-respond .submit:hover,
.comments-area .comment-respond .submit:active,
.comments-area .comment-respond .submit:focus {
  background-color: #e86013;
}
h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 600;
}
.medium-heavy {
  font-weight: 600;
}
.page-heading {
  font-size: 2.5em;
  margin-bottom: 20px;
  margin-top: 20px;
}
body {
  font-size: 17px;
  background: #005180;
  font-family: 'Source Sans Pro', sans-serif;
}
.postcontent a,
.lead-summary-section a,
.breadcrumb a,
.link-list a,
.media-heading a,
.footer a {
  text-decoration: underline;
}
.btn.btn {
  text-decoration: none;
}
.wrapper {
  background: white;
  padding: 60px 0 130px;
}
.grey-box {
  padding: 20px;
  background: rgba(0, 102, 102, 0.1);
}
.band {
  padding: 25px 0;
}
hr.band-divider {
  margin: 0;
}
.search-page-search {
  height: 38px;
}
.filter-box {
  background-color: #f8f8f8;
  padding: 25px 25px 20px;
}
.filter-box h3 {
  padding-top: 0;
  margin-top: 0;
}
.filter-box a {
  color: #009999;
}
.filter-box a:hover,
.filter-box a.active {
  color: #007a7a;
  text-decoration: underline;
}
.single-meta {
  font-weight: 600;
  margin-top: 20px;
  margin-bottom: -10px;
  color: #006666;
}
.single-meta a.boxed {
  background: #006666;
  color: white;
  display: inline-block;
  padding: 1px 7px;
  margin-right: 3px;
  text-decoration: none;
}
.single-meta a.boxed:hover,
.single-meta a.boxed:focus,
.single-meta a.boxed:active {
  background: #005757;
  text-decoration: none;
}


text:
using System;
using Xunit;
using Xunit.Extensions;

namespace Humanizer.Tests.Localisation.nl
{
    public class DateHumanizeTests : AmbientCulture
    {
        public DateHumanizeTests() : base("nl-NL") { }

        [Theory]
        [InlineData(-10, "10 dagen geleden")]
        [InlineData(-3, "3 dagen geleden")]
        [InlineData(-2, "2 dagen geleden")]
        [InlineData(-1, "gisteren")]
        public void DaysAgo(int days, string expected)
        {
            Assert.Equal(expected, DateTime.UtcNow.AddDays(days).Humanize());
        }

        [Theory]
        [InlineData(-10, "10 uur geleden")]
        [InlineData(-3, "3 uur geleden")]
        [InlineData(-2, "2 uur geleden")]
        [InlineData(-1, "één uur geleden")]
        public void HoursAgo(int hours, string expected)
        {
            Assert.Equal(expected, DateTime.UtcNow.AddHours(hours).Humanize());
        }

        [Theory]
        [InlineData(-10, "10 minuten geleden")]
        [InlineData(-3, "3 minuten geleden")]
        [InlineData(-2, "2 minuten geleden")]
        [InlineData(-1, "één minuut geleden")]
        public void MinutesAgo(int minutes, string expected)
        {
            Assert.Equal(expected, DateTime.UtcNow.AddMinutes(minutes).Humanize());
        }

        [Theory]
        [InlineData(-10, "10 maanden geleden")]
        [InlineData(-3, "3 maanden geleden")]
        [InlineData(-2, "2 maanden geleden")]
        [InlineData(-1, "één maand geleden")]
        public void MonthsAgo(int months, string expected)
        {
            Assert.Equal(expected, DateTime.UtcNow.AddMonths(months).Humanize());
        }

        [Theory]
        [InlineData(-10, "10 seconden geleden")]
        [InlineData(-3, "3 seconden geleden")]
        [InlineData(-2, "2 seconden geleden")]
        [InlineData(-1, "één seconde geleden")]
        public void SecondsAgo(int seconds, string expected)
        {
            Assert.Equal(expected, DateTime.UtcNow.AddSeconds(seconds).Humanize());
        }

        [Theory]
        [InlineData(-10, "10 jaar geleden")]
        [InlineData(-3, "3 jaar geleden")]
        [InlineData(-2, "2 jaar geleden")]
        [InlineData(-1, "één jaar geleden")]
        public void YearsAgo(int years, string expected)
        {
            Assert.Equal(expected, DateTime.UtcNow.AddYears(years).Humanize());
        }
    }
}


text:
package com.opengamma.sesame;

import com.opengamma.financial.currency.CurrencyPair;
import com.opengamma.timeseries.date.localdate.LocalDateDoubleTimeSeries;
import com.opengamma.util.result.Result;
import com.opengamma.util.time.LocalDateRange;

/**
 * Function capable of providing an FX return series for currency pairs.
 */
public interface FXReturnSeriesFn {

  /**
   * Get the return series for the supplied currency pair.
   *
   * @param dateRange  the date range of the series, not null
   * @param currencyPair  the pair to get the return series for, not null
   * @return the return series for the currency pair, a failure result if not found
   */
  Result<LocalDateDoubleTimeSeries> calculateReturnSeries(Environment env, LocalDateRange dateRange, CurrencyPair currencyPair);

  /**
   * Calculates the return series based on another time-series.
   *
   * @param timeSeries  the input time-series, not null
   * @return the return series, a failure result if not found
   */
  LocalDateDoubleTimeSeries calculateReturnSeries(Environment env, LocalDateDoubleTimeSeries timeSeries);

}


text:
using UnityEngine;
using System.Collections;

public static class Helpers {

	/// <summary>
	/// Gets the left screen bound.
	/// </summary>
	/// <returns>The left screen bound.</returns>
	/// <param name="zPosition">Z position of current object.</param>
	public static float GetLeftScreenBound(float zPosition){
		float zDistance = zPosition - Camera.main.transform.position.z;
		Vector3 leftBound = Camera.main.ViewportToWorldPoint(new Vector3(0,0,zDistance));
		return leftBound.x;
	}

	/// <summary>
	/// Gets the right screen bound.
	/// </summary>
	/// <returns>The right screen bound.</returns>
	/// <param name="zPosition">Z position of current object.</param>
	public static float GetRightScreenBound(float zPosition){
		float zDistance = zPosition - Camera.main.transform.position.z;
		Vector3 rightBound = Camera.main.ViewportToWorldPoint(new Vector3(1,0,zDistance));
		return rightBound.x;
	}

}


text:
'use strict';

var config = require('../../config/' + (process.env.MALACHITE_ENV || 'development') + '.json');
var helper = require('../helper.js');
var log = require('bunyan').createLogger(config.loggerOptions);

var knexConfig = require('./knexfile.js');
var knex = require('knex')(knexConfig[(process.env.MALACHITE_ENV || 'development')]);

function create(model, data, next) {

    model
        .forge(data)
        .save()
        .then(function(model) {
            log.trace(model.toJSON());
            next(null, model.toJSON());
        }, function(err) {
            log.error(err);
            next(err);
        })
        .catch(function(err) {
            log.error(err);
            next(err);
        });
}

// This function is now obsolete. Please use "superGet".
function get(model, where, whereNot, next) {

    var query = {
        where: {},
        whereNot: {}
    };

    query.where = where;
    query.whereNot = whereNot;

    log.trace('Criteria: %j', query);

    model
        .query(query)
        .fetchAll()
        .then(function(model) {
            log.trace(model.toJSON());
            next(null, model.toJSON());
        }, function(err) {
            log.error(err);
            next(err);
        })
        .catch(function(err) {
            log.error(err);
            next(err);
        });
}

function getWithDependents(model, where, dependentArray, next) {

    var query = {
        where: {},
        whereNot: {}
    };

    query.where = where;

    log.trace('Criteria: %j', query);

    model
        .query(query)
        .fetchAll({withRelated: dependentArray, require: true})
        .then(function(model) {
            log.trace(model.toJSON());
            next(null, model.toJSON());
        }, function(err) {
            log.error(err);
            next(err);
        })
        .catch(function(err) {
            log.error(err);
            next(err);
        });
}

function raw(query, next) {

    log.trace('Raw query: %s', query);

    knex.raw(query).then(function(resp) {
        log.trace(resp);
        next(null, resp);
    });
}

function remove(model, where, whereNot, destroy, next) {

    if (destroy) {
        var query = {
            where: {},
            whereNot: {},
            del: {}
        };

        query.where = where;
        query.whereNot = whereNot;

        model
            .query(query)
            .fetch()
            .then(function() {
                next();
            }, function(err) {
                log.error(err);
                next(err);
            })
            .catch(function(err) {
                log.error(err);
                next(err);
            });
    } else {
        var data = {
            dateRemoved: helper.currentDatestamp()
        };

        update(model, where, whereNot, data, options, next);
    }
}

/**
 * The superman of gets.
 *
 * Options model:
 *     var options = {
 *            'where': { 'userId': req.query.__userId },
 *            'related': ['tags'],
 *            'join': {
 *                'tableName': 'bookmarks_meta',
 *                'on': ['bookmarks.id', '=', 'bookmarks_meta.bookmarkId'],
 *                'andOn': [
 *                    ['bookmarks_meta.attr', '=', 'key1'],
 *                    ['bookmarks_meta.value', '=', 'value15']]
 *            },
 *            'orderBy': [['dateCreated', 'desc']],
 *            'limit': 10
 *        };
 *
 * @param model
 * @param options
 * @param next
 */
function superGet(model, options, next) {

    log.trace('Options: %j', options);

    var withRelated;

    if (options.related) {
        withRelated = {
            withRelated: options.related,
            require: false
        };
    }

    model
        .query(function(db) {

            db.where(options.where);

            if (options.orWhere) {
                db.orWhere(options.orWhere);
            }

            if (options.like && options.like.length > 0) {
                options.like.forEach(function(item) {
                    db.andWhere(item.column, 'like', '%' + item.value + '%')
                });
            }

            if (options.join) {
                db.join(options.join.tableName, function() {
                    var joinThing = this;

                    this
                        .on(options.join.on[0], options.join.on[1], options.join.on[2]);

                    if (options.join.andOn && options.join.andOn.length > 0) {
                        options.join.andOn.forEach(function(item) {
                            joinThing.andOn(item[0], item[1], item[2]);
                        });
                    }
                });
            }

            if (options.orderBy && options.orderBy.length > 0) {
                options.orderBy.forEach(function(orderByItem) {
                    db.orderBy(orderByItem[0], (orderByItem.length > 0 ? orderByItem[1] : undefined));
                });
            }

            if (options.limit) {
                db.limit(options.limit);
            }
        })
        .fetchAll(withRelated)
        .then(function(model) {
            log.trace(model.toJSON());
            next(null, model.toJSON());
        }, function(err) {
            log.error(err);
            next(err);
        })
        .catch(function(err) {
            log.error(err);
            next(err);
        });
}

function update(model, where, whereNot, data, next) {

    var query = {
        where: {},
        whereNot: {},
        update: {}
    };

    query.where = where;
    query.whereNot = whereNot;
    query.update = data;

    model
        .query(query)
        .fetchAll()
        .then(function(model) {
            log.trace(model.toJSON());
            next(null, model.toJSON());
        }, function(err) {
            log.error(err);
            next(err);
        })
        .catch(function(err) {
            log.error(err);
            next(err);
        });
}

// -----------------------------------------------------------------------------
// Exports
// -----------------------------------------------------------------------------

module.exports = {
    create: create,
    get: get,
    getWithDependents: getWithDependents,
    raw: raw,
    remove: remove,
    superGet: superGet,
    update: update
};


text:
package service

import (
	"context"
	"sync"
	"testing"
	"time"

	. "github.com/smartystreets/goconvey/convey"
	"go-common/app/service/live/wallet/conf"
	"go-common/app/service/live/wallet/model"
	"go-common/library/ecode"
	"math/rand"
	"os"
	"strconv"
)

var (
	once              sync.Once
	s                 *Service
	ctx               = context.Background()
	r                 *rand.Rand
	testValidPlatform = []string{"pc", "android", "ios", "h5"}
)

func initConf() {
	if err := conf.Init(); err != nil {
		panic(err)
	}
}

func TestMain(m *testing.M) {
	conf.ConfPath = "../cmd/live-wallet-test.toml"
	once.Do(startService)
	os.Exit(m.Run())
}

func startService() {
	initConf()
	s = New(conf.Conf)
	time.Sleep(time.Millisecond * 100)
	r = rand.New(rand.NewSource(time.Now().UnixNano()))
}

func getTestRandUid() int64 {
	return r.Int63n(10000000)
}

func testWith(f func()) func() {
	once.Do(startService)
	return f
}

func getTestBasicParam(tid string, area int64, bizCode string, source string, bizSource string, metaData string) *model.BasicParam {
	return &model.BasicParam{
		TransactionId: tid,
		Area:          area,
		BizCode:       bizCode,
		Source:        source,
		BizSource:     bizSource,
		MetaData:      metaData,
	}
}

func getTestDefaultBasicParam(tid string) *model.BasicParam {
	return getTestBasicParam(tid, 0, "", "", "", "")
}

func atoiForTest(s string) int {
	v, _ := strconv.Atoi(s)
	return v
}

func getTestWallet(t *testing.T, uid int64, platform string) *model.MelonseedResp {
	v, err := s.Get(ctx, getTestDefaultBasicParam(""), uid, platform, 0)
	if err != nil {
		t.FailNow()
	}
	return v.(*model.MelonseedResp)

}

func getTestAll(t *testing.T, uid int64, platform string) *model.DetailResp {
	v, err := s.GetAll(ctx, getTestDefaultBasicParam(""), uid, platform, 0)
	if err != nil {
		t.FailNow()
	}
	return v.(*model.DetailResp)

}

func TestService_Get(t *testing.T) {
	Convey("normal get without metal", t, testWith(func() {
		Convey("basic", func() {
			for _, platform := range testValidPlatform {
				uid := getTestRandUid()
				v, err := s.Get(ctx, getTestDefaultBasicParam(""), uid, platform, 0)
				resp := v.(*model.MelonseedResp)
				So(resp, ShouldNotBeNil)
				So(err, ShouldBeNil)
				So(atoiForTest(resp.Gold), ShouldBeGreaterThanOrEqualTo, 0)
				So(atoiForTest(resp.Silver), ShouldBeGreaterThanOrEqualTo, 0)
			}
		})
	}))

	Convey("params", t, testWith(func() {
		Convey("invalid platform", func() {
			platform := "unknown"
			uid := getTestRandUid()
			v, err := s.Get(ctx, getTestDefaultBasicParam(""), uid, platform, 0)
			So(v, ShouldBeNil)
			So(err, ShouldEqual, ecode.RequestErr)
		})
		Convey("invalid uid", func() {
			platform := testValidPlatform[0]
			var uid int64 = 0
			v, err := s.Get(ctx, getTestDefaultBasicParam(""), uid, platform, 0)
			So(v, ShouldBeNil)
			So(err, ShouldEqual, ecode.RequestErr)
		})
	}))

	Convey("metal", t, testWith(func() {
		uid := getTestRandUid()
		platform := testValidPlatform[0]
		v, err := s.Get(ctx, getTestDefaultBasicParam(""), uid, platform, 1)
		resp := v.(*model.MelonseedWithMetalResp)
		So(resp, ShouldNotBeNil)
		So(err, ShouldBeNil)
		So(atoiForTest(resp.Gold), ShouldBeGreaterThanOrEqualTo, 0)
		So(atoiForTest(resp.Silver), ShouldBeGreaterThanOrEqualTo, 0)
		So(atoiForTest(resp.Metal), ShouldBeGreaterThanOrEqualTo, 0)

	}))
}

func TestService_GetAll(t *testing.T) {
	Convey("normal getAll without metal", t, testWith(func() {
		Convey("basic", func() {
			for _, platform := range testValidPlatform {
				uid := getTestRandUid()
				resp := getTestAll(t, uid, platform)
				So(resp, ShouldNotBeNil)
				So(atoiForTest(resp.Gold), ShouldBeGreaterThanOrEqualTo, 0)
				So(atoiForTest(resp.Silver), ShouldBeGreaterThanOrEqualTo, 0)
				So(atoiForTest(resp.SilverPayCnt), ShouldBeGreaterThanOrEqualTo, 0)
				So(atoiForTest(resp.GoldRechargeCnt), ShouldBeGreaterThanOrEqualTo, 0)
				So(atoiForTest(resp.GoldPayCnt), ShouldBeGreaterThanOrEqualTo, 0)
			}
		})
	}))

	Convey("advanced", t, testWithTestUser(func(u *TestUser) {

		resp := getTestAll(t, u.uid, "pc")
		So(resp.CostBase, ShouldEqual, 1000)

		resp = getTestAll(t, u.uid, "pc")
		So(resp.CostBase, ShouldEqual, 1000)

		v, err := s.GetAll(ctx, getTestDefaultBasicParam(""), u.uid, "pc", 1)
		if err != nil {
			t.FailNow()
		}
		respWithMetal := v.(*model.DetailWithMetalResp)
		So(respWithMetal, ShouldNotBeNil)

		So(respWithMetal.CostBase, ShouldEqual, 1000)
	}))
}


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

namespace MeteoSharp.Codes
{
    public enum ElevationAccuracy : byte
    {
        Excellent,
        Good,
        Fair,
        Poor
    }
}


text:
#if NETFX_CORE

using Windows.UI.Xaml;
// ReSharper disable CheckNamespace
namespace FeatureToggle.Shared.Tests
// ReSharper restore CheckNamespace
{
    /// <summary>
    /// Used to set resources in XAML/UWP app so that tests can configure resource values
    /// </summary>
    public static class ApplicationResourcesSetter
    {
        public static void Set(string key, object value)
        {
            Application.Current.Resources[key] = value;
        }
    }
}
#endif


text:
use strict;
use Getopt::Long;

my $PROG = "measure_options.pl"; # TODO: use cwd? basename etc.

# calculate boot time and log it
#
# disable/enable node manager
#
# run drtop every boot every 30s
#   sum all cols from -showmem o/p
# if cpu utilization hits <= 2%
#   write all sums to log file
#
# for each boot do
#   set up registry keys for each app with
#     appropriate options for this run
#   do the run
#
# different runs
#   reset from 1 to nth thread
#   set -hotp_nudge_is_reset
#   -C
#   -E
#   -F
#   shared bbs
#   shared traces
#   private traces with diff cache sizes
#   different set of services loaded
#     default set
#     medium set
#     all set
#
# move all logfiles to \\fileserver\g_shares\desktop_nightly\results
#
# enable node manager
#   some other script installs latest core

my $ROOT      = qq(C:\\desktop-nightly);
my $SCRIPTDIR = qq($ROOT\\boot_data_scripts);
my $OUTDIR    = qq($ROOT\\boot_data);

# get the boot time before doing anything else
my ($boot_time, @ignore) = grep s/uptime in seconds: //i,
                                `cscript -nologo $SCRIPTDIR\\uptime.vbs`;

my %opt;
&GetOptions(\%opt,
    "debug",
    "default",
    "help",
    "usage",
);
#TODO: print usage, verify options

my $DRVER = &get_build();

system("net use m: \\\\10.1.5.85\\g_shares\\desktop-benchmarks \"\" /USER:guest") unless (-e "m:");

my $date = &datestamp();
my $RESULTS_DIR = qq(m:\\results\\boot_data\\qatest_$DRVER).qq(_mem_$date);
mkdir $RESULTS_DIR unless -e $RESULTS_DIR;

my $SUMMARY_FILE = qq(qatest_$DRVER).qq(_mem_$date.txt);

# List of options for each run.
# Just enable/put the options you want run here.
my @dropts = (
     "",   # dont change this, let this be boot 0

#    "",                      # default
#    "",                      # default
#    "",                      # default
#    "-no_enable_reset",
#    "-no_enable_reset",
#    "-no_enable_reset",
#    "-hotp_nudge_is_reset",
#    "-hotp_nudge_is_reset",
#    "-hotp_nudge_is_reset",
#    "-C -hotp_nudge_is_reset",
#    "-C -hotp_nudge_is_reset",
#    "-C -hotp_nudge_is_reset",
#    "-E -hotp_nudge_is_reset",
#    "-E -hotp_nudge_is_reset",
#    "-E -hotp_nudge_is_reset",
#    "-F -hotp_nudge_is_reset",
#    "-F -hotp_nudge_is_reset",
#    "-F -hotp_nudge_is_reset",
#    "-C -E -F -hotp_nudge_is_reset",
#    "-C -E -F -hotp_nudge_is_reset",
#    "-C -E -F -hotp_nudge_is_reset",
    # -reset_at_nth_thread is added to this list in a loop (see below)

#    # see memory impact of two new features I added:
#    "-no_remove_shared_trace_heads",
#    "-remove_trace_components",
#
#    # shared ibt tables experimental
#    "-shared_ibt_tables",
#
#    # shared bbs, no traces
#    "-shared_bbs_only",
#    "-shared_bbs_only",
#    "-shared_bbs_only",
#
#    # shared bbs, private traces
#    "-no_shared_traces",
#    "-no_shared_traces -cache_trace_regen 20",
#    "-no_shared_traces -cache_trace_regen 30",
#    "-no_shared_traces -cache_trace_regen 40",
#    "-no_shared_traces -no_finite_trace_cache",
#
#    # private bbs, no traces
#    "-disable_traces -no_shared_bbs",
#    "-disable_traces -no_shared_bbs -cache_bb_regen 20",
#    "-disable_traces -no_shared_bbs -cache_bb_regen 30",
#    "-disable_traces -no_shared_bbs -cache_bb_regen 40",
#    "-disable_traces -no_shared_bbs -no_finite_bb_cache",
#
#    # private bbs, shared traces
#    "-no_shared_bbs",
#    "-no_shared_bbs -cache_bb_regen 20",
#    "-no_shared_bbs -cache_bb_regen 30",
#    "-no_shared_bbs -cache_bb_regen 40",
#    "-no_shared_bbs -no_finite_bb_cache",
#
#    # all private
#    # bb regen 10 (default), vary trace regen 10,20,30,40,infinite
#    "-no_shared_traces -no_shared_bbs",
#    "-no_shared_traces -no_shared_bbs -cache_trace_regen 20",
#    "-no_shared_traces -no_shared_bbs -cache_trace_regen 30",
#    "-no_shared_traces -no_shared_bbs -cache_trace_regen 40",
#    "-no_shared_traces -no_shared_bbs -no_finite_trace_cache",
#    # bb regen 20, vary trace regen 10,20,30,40,infinite
#    "-no_shared_traces -no_shared_bbs -cache_bb_regen 20",
#    "-no_shared_traces -no_shared_bbs -cache_bb_regen 20 -cache_trace_regen 20",
#    "-no_shared_traces -no_shared_bbs -cache_bb_regen 20 -cache_trace_regen 30",
#    "-no_shared_traces -no_shared_bbs -cache_bb_regen 20 -cache_trace_regen 40",
#    "-no_shared_traces -no_shared_bbs -cache_bb_regen 20 -no_finite_trace_cache",
#    # bb regen 30, vary trace regen 10,20,30,40,infinite
#    "-no_shared_traces -no_shared_bbs -cache_bb_regen 30",
#    "-no_shared_traces -no_shared_bbs -cache_bb_regen 30 -cache_trace_regen 20",
#    "-no_shared_traces -no_shared_bbs -cache_bb_regen 30 -cache_trace_regen 30",
#    "-no_shared_traces -no_shared_bbs -cache_bb_regen 30 -cache_trace_regen 40l",
#    "-no_shared_traces -no_shared_bbs -cache_bb_regen 30 -no_finite_trace_cache",
#    # bb regen 40, vary trace regen 10,20,30,40,infinite
#    "-no_shared_traces -no_shared_bbs -cache_bb_regen 40",
#    "-no_shared_traces -no_shared_bbs -cache_bb_regen 40 -cache_trace_regen 20",
#    "-no_shared_traces -no_shared_bbs -cache_bb_regen 40 -cache_trace_regen 30",
#    "-no_shared_traces -no_shared_bbs -cache_bb_regen 40 -cache_trace_regen 40",
#    "-no_shared_traces -no_shared_bbs -cache_bb_regen 40 -no_finite_trace_cache",
#    # bb infinite, vary trace regen 10,20,30,40,infinite
#    "-no_shared_traces -no_shared_bbs -no_finite_bb_cache",
#    "-no_shared_traces -no_shared_bbs -no_finite_bb_cache -cache_trace_regen 20",
#    "-no_shared_traces -no_shared_bbs -no_finite_bb_cache -cache_trace_regen 30",
#    "-no_shared_traces -no_shared_bbs -no_finite_bb_cache -cache_trace_regen 40",
#    "-no_shared_traces -no_shared_bbs -no_finite_bb_cache -no_finite_trace_cache",

);

# enable to run reset_at_nth_thread 1..20
#for (my $thr = 1; $thr < 21; $thr++) {
#    push @dropts, "reset_at_nth_thread $thr";
#}

# run with just the default set of options
@dropts = ( "" ) if defined $opt{'default'};

# file to save registry settings
my $SAVE_CFG = qq($SCRIPTDIR\\qatest_determina_keys.cfg);

# file that holds the boot number
my $BOOTNUM_FILE = qq($SCRIPTDIR\\bootnum);
my $bootnum = &get_bootnum();
print "$PROG: Boot number: $bootnum\n";

# at each boot, pick a set of options to run with

&disable_node_manager();

# writes 0 to BOOTNUM_FILE
&cleanup_and_exit() if ($bootnum >= scalar @dropts);

print "$PROG: running options: $dropts[$bootnum+1]\n";

# save the registry settings the first time
system("drcontrol -save $SAVE_CFG") if ($bootnum == 0);
system("drcontrol -dump > $RESULTS_DIR\\drcontrol-dump.$bootnum");

my $MEASURE_MEM_CMD = qq($SCRIPTDIR\\measure_mem.pl -tillidle --name "$DRVER-$bootnum" --nightly $RESULTS_DIR --summary $SUMMARY_FILE --b $boot_time);

print "$PROG: $MEASURE_MEM_CMD\n";
system("perl $MEASURE_MEM_CMD");

&do_hotp_nudge() if ($dropts[$bootnum] =~ m/hotp_nudge_is_reset/i);

# now set up registry keys for next measurement
# restore the registry settings for our agent
system("drcontrol -detachall");
system("drcontrol -load $SAVE_CFG");
&resetreg($dropts[$bootnum+1]);

print "$PROG: rebooting..\n";

reboot($bootnum);

#-----------------------------------------------------------------------------

sub resetreg {
    my $append_dropt = shift;

    #TODO: use %PROGRAM FILES% ?
    my $DETERMINA = qq("$ENV{'PROGRAMFILES'}\\Determina\\Determina Agent");
    my $DRHOME = $DETERMINA;
    #my $DRHOME = qq("C:\\Program Files\\Determina\\Determina Agent");
    my $LIBDIR = "lib";
    my $LOGDIR = "logs";

    my $prev_dropt = "";
    my $dropt = "";

    my @ignore;

    # disable node manager if needed
    &disable_node_manager() unless
        scalar grep m/scnodemgr.*disabled/i, `svccntrl scnodemgr -show`;

    my $drdll = qq($DRHOME\\$LIBDIR\\$DRVER\\dynamorio.dll);

    # may as well set global key though we're setting every app key below
    system("drcontrol -drlib $drdll");
    system("drcontrol -logdir $DRHOME\\$LOGDIR");

    ($prev_dropt, @ignore) =
            grep s/\s*DYNAMORIO_OPTIONS=\s*//, `drcontrol -dump`;
    chomp($prev_dropt);
    print "$PROG: global dropt: $prev_dropt\n";

    $dropt = qq("$prev_dropt $append_dropt");
    system("drcontrol -options $dropt");

    # drcontrol -load not implemented, and no way to remove a string value,
    # so our only options are to reproduce the slist parsing and get the
    # right rununder values, or set the values we want for each app, which
    # is a pain to edit manually later but oh well:
    my @apps = grep s/\s*Config\s*Group\s*: \s*//, `drcontrol -dump`;
    my $app;
    foreach $app (@apps) {
        system("drcontrol -app $app -drlib $drdll");
        system("drcontrol -app $app -logdir $DRHOME\\$LOGDIR");
        ($prev_dropt, @ignore) =
            grep s/\s*DYNAMORIO_OPTIONS=\s*//, `drcontrol -appdump $app`;
        next unless $prev_dropt;
        chomp($prev_dropt);
        $dropt = qq("$prev_dropt $append_dropt");
        system("drcontrol -app $app -options $dropt");
    }

    ### if ignore RUNUNDER this will re-make reg keys from scc file:
    ###    # now re-build reg setup
    ###    drcontrol -reset;
    ###    for i in `grep -i exe /c/Program\ Files/Determina/SecureCore/config/default.scc`; do
    ###        # pull exe name out of [HKEY_LOCAL_MACHINE\<...>\inetinfo.exe]
    ###        j=${i##*\\};
    ###        drcontrol -add ${j/]/};
    ###    done;
    system("drcontrol -preinject ON");
}

sub do_hotp_nudge {
    # should be idle now, so nudge
    system("drcontrol -hot_patch_nudge_all");
    # sleep for 10 more minutes to see what happens to memory
    sleep 600;
}

sub cleanup_and_exit {
    # clean up after all runs
    system("drcontrol -load $SAVE_CFG");
    system("echo 0 > $BOOTNUM_FILE");

    &enable_node_manager();

    exit 0;
}

sub disable_node_manager {
    #TODO: manual is fine or do we need to disable
    system("svccntrl scnodemgr -disabled");
    system("net stop scnodemgr");
}

sub enable_node_manager {
    system("svccntrl scnodemgr -auto");
    system("net start scnodemgr");
}

sub get_bootnum {
    open FD, "<$BOOTNUM_FILE" or die "Cannot open $BOOTNUM_FILE: $!";
    chomp(my $num = <FD>);
    close FD;
    return $num;
}

sub reboot {
    my $bootnum = shift;
    $bootnum++;
    system("echo $bootnum > $BOOTNUM_FILE");
    system("shutdown -r -t 0 -f");
}

#--------------------------------------------------------------------------
sub get_build() {
    my @dump = `drcontrol -dump 2> $OUTDIR\\drcontrol_err.txt`;

    # drcontrol -dump prints
    #   error message, if core is not installed
    #   data for SC config, if disabled from DMC
    # if we have any app instrumented, then we care about under DR
    my ($ignore_sc, $build, @ignore_rest) =
        grep s/DYNAMORIO_AUTOINJECT.*Agent.lib.//i, @dump;

    chomp($build);

    $build = "native" unless ($build);
    $build =~ s/\s*([0-9]+[a-z]).dynamorio.dll/$1/i;

    return $build;
}

sub datestamp() {
    # ignore wday - day of the week, $yday - day of the year, and
    # $is_dst - is daylight savings time
    my ($sec,  $min,  $hour,
        $mday, $mon,  $year,
        $wday, $yday, $is_dst) = localtime(time);

    # last 2 digits of year
    $year = ($year + 1900) % 100;
    my $stamp = sprintf("%02d%02d%02d",
                            $year,$mon+1,$mday);
    return $stamp;
}


text:
import os
import SplashView
import EditorView

#SplashView.show()
editorView = EditorView.EditorView()
editorView.show()


text:
module RetailCalendar
  VERSION = "1.2.0"
end


text:
<?php
// MediaWiki settings for ConfirmEdit.
// This file is managed by Puppet.
// This file is managed by Puppet
// See puppet/modules/mediawiki/templates/extension.php.erb

// Load extension unless explictly disabled
if ( !isset( $wmvExtensions['ConfirmEdit'] ) ||
	$wmvExtensions['ConfirmEdit'] === true
) {
	if ( class_exists( 'ExtensionRegistry' ) &&
		file_exists( "$IP/extensions/ConfirmEdit/extension.json" )
	) {
		wfLoadExtension( 'ConfirmEdit' );
	} elseif ( file_exists( "$IP/extensions/ConfirmEdit/ConfirmEdit.php" ) ) {
		include_once "$IP/extensions/ConfirmEdit/ConfirmEdit.php";
	}

	// Keep track of what extensions are loaded to make `wikihasextension` work
	// Why in the hell doesn't MediaWiki already do this for us?
	$wmvActiveExtensions[] = 'ConfirmEdit';

}


text:
'use strict';

/**
 * @ngdoc function
 * @name angularShowcaseApp.controller:OnemenuCtrl
 * @description
 * # OnemenuCtrl
 * Controller of the angularShowcaseApp
 */
angular.module('angularShowcaseApp')
  .controller('OnemenuCtrl', function ($scope) {
    $scope.items = [
     { id: 1, name: 'foo' },
     { id: 2, name: 'bar' },
     { id: 3, name: 'blah' }
   ];
  });