text:
var PageView = function() {
  var mongoose = require('mongoose');
  var Schema = require('mongoose').Schema;
  var UserAgentParser = require('../lib/UserAgentParser');

  var UserAgentSchema = new Schema({
    ua: String,
    browser: {
        name: String,
        version: String,
        major: String
    },
    engine: {
        name: String,
        version: String
    },
    os: {
        name: String,
        version: String
    },
    device: {
        model: String,
        type: String,
        vendor: String
    },
    cpu: {
        architecture: String
    }
  });

  var PageViewSchema = new Schema({
    url: String,
    requestIP: String,
    time: String,
    identifier: String,
    doNotTrack: Boolean,
    userAgents: [UserAgentSchema]
  });

  var _model = mongoose.model('PageView', PageViewSchema);

  var _create = function(url, ip, time, identifier, doNotTrack, uaString, callback) {
    var newPageView = new _model();
    newPageView.url = url;
    newPageView.requestIP = ip;
    newPageView.time = time;
    newPageView.identifier = identifier;
    newPageView.doNotTrack = doNotTrack;
    newPageView.userAgents.push(UserAgentParser.parse(uaString));

    newPageView.save(function(e, doc) {
      if (e) {
        return callback(e);
      }
      else {
        return callback(null, doc);
      }
    });
  };

  var _all = function(callback) {
    _model.find(function(err, doc) {
      if (err) {
        return callback(err);
      }
      return callback(null, doc);
    });
  };

  var _findById = function(id, callback) {
    _model.findById(id, function(err, doc) {
      if (err) {
        return callback(err);
      }
      return callback(null, doc);
    });
  };

  var _find = function(criteria, callback) {
    _model.find(criteria, function(err, docs) {
      if (err) {
        return callback(err);
      }
      else {
        return callback(null, docs);
      }
    });
  };

  return {
    schema: PageViewSchema,
    model: _model,
    create: _create,
    all: _all,
    findById: _findById,
    find: _find
  };

}();

module.exports = PageView;

redpajama_set_name: RedPajamaGithub


text:
module.exports = function(path) {
  if (window.location.pathname.slice(-1) === '/') {
    return window.location.pathname + 'index' === path;
  } else {
    return window.location.pathname === path;
  }
};


text:
namespace sharp.Serene.Administration
{
    using Entities;
    using Repositories;
    using Serenity;
    using Serenity.Abstractions;
    using Serenity.Data;
    using System;

    public class AuthenticationService : IAuthenticationService
    {
        public bool Validate(ref string username, string password)
        {
            if (username.IsTrimmedEmpty() || string.IsNullOrEmpty(password))
                return false;

            username = username.TrimToEmpty();

            var user = Dependency.Resolve<IUserRetrieveService>().ByUsername(username) as UserDefinition;

            if (user != null)
                return ValidateExistingUser(ref username, password, user);

            return ValidateFirstTimeUser(ref username, password);
        }

        private bool ValidateExistingUser(ref string username, string password, UserDefinition user)
        {
            username = user.Username;

            if (user.IsActive != 1)
            {
                if (Log.IsInfoEnabled)
                    Log.Error(String.Format("Inactive user login attempt: {0}", username), this.GetType());

                return false;
            }

            // prevent more than 50 invalid login attempts in 30 minutes
            var throttler = new Throttler("ValidateUser:" + username.ToLowerInvariant(), TimeSpan.FromMinutes(30), 50);
            if (!throttler.Check())
                return false;

            var directoryService = Dependency.TryResolve<IDirectoryService>();

            Func<bool> validatePassword = () => UserRepository.CalculateHash(password, user.PasswordSalt)
                .Equals(user.PasswordHash, StringComparison.OrdinalIgnoreCase);

            if (user.Source == "site" || user.Source == "sign" || directoryService == null)
            {
                if (validatePassword())
                {
                    throttler.Reset();
                    return true;
                }

                return false;
            }

            if (user.Source != "ldap")
                throw new ArgumentOutOfRangeException("userSource");

            if (!string.IsNullOrEmpty(user.PasswordHash) &&
                user.LastDirectoryUpdate != null &&
                user.LastDirectoryUpdate.Value.AddHours(1) >= DateTime.Now)
            {
                if (validatePassword())
                {
                    throttler.Reset();
                    return true;
                }

                return false;
            }

            DirectoryEntry entry;
            try
            {
                entry = directoryService.Validate(username, password);
                if (entry == null)
                    return false;

                throttler.Reset();
            }
            catch (Exception ex)
            {
                Log.Error("Error on directory access", ex, this.GetType());

                // couldn't access directory. allow user to login with cached password
                if (!user.PasswordHash.IsTrimmedEmpty())
                {
                    if (validatePassword())
                    {
                        throttler.Reset();
                        return true;
                    }

                    return false;
                }

                throw;
            }

            try
            {
                string salt = user.PasswordSalt.TrimToNull();
                var hash = UserRepository.GenerateHash(password, ref salt);
                var displayName = entry.FirstName + " " + entry.LastName;
                var email = entry.Email.TrimToNull() ?? user.Email ?? (username + "@yourdefaultdomain.com");

                using (var connection = SqlConnections.NewFor<UserRow>())
                using (var uow = new UnitOfWork(connection))
                {
                    var fld = UserRow.Fields;
                    new SqlUpdate(fld.TableName)
                        .Set(fld.DisplayName, displayName)
                        .Set(fld.PasswordHash, hash)
                        .Set(fld.PasswordSalt, salt)
                        .Set(fld.Email, email)
                        .Set(fld.LastDirectoryUpdate, DateTime.Now)
                        .WhereEqual(fld.UserId, user.UserId)
                        .Execute(connection, ExpectedRows.One);

                    uow.Commit();

                    UserRetrieveService.RemoveCachedUser(user.UserId, username);
                }

                return true;
            }
            catch (Exception ex)
            {
                Log.Error("Error while updating directory user", ex, this.GetType());
                return true;
            }
        }

        private bool ValidateFirstTimeUser(ref string username, string password)
        {
            var throttler = new Throttler("ValidateUser:" + username.ToLowerInvariant(), TimeSpan.FromMinutes(30), 50);
            if (!throttler.Check())
                return false;

            var directoryService = Dependency.TryResolve<IDirectoryService>();
            if (directoryService == null)
                return false;

            DirectoryEntry entry;
            try
            {
                entry = directoryService.Validate(username, password);
                if (entry == null)
                    return false;

                throttler.Reset();
            }
            catch (Exception ex)
            {
                Log.Error("Error on directory first time authentication", ex, this.GetType());
                return false;
            }

            try
            {
                string salt = null;
                var hash = UserRepository.GenerateHash(password, ref salt);
                var displayName = entry.FirstName + " " + entry.LastName;
                var email = entry.Email.TrimToNull() ?? (username + "@yourdefaultdomain.com");
                username = entry.Username.TrimToNull() ?? username;

                using (var connection = SqlConnections.NewFor<UserRow>())
                using (var uow = new UnitOfWork(connection))
                {
                    var userId = (int)connection.InsertAndGetID(new UserRow
                    {
                        Username = username,
                        Source = "ldap",
                        DisplayName = displayName,
                        Email = email,
                        PasswordHash = hash,
                        PasswordSalt = salt,
                        IsActive = 1,
                        InsertDate = DateTime.Now,
                        InsertUserId = 1,
                        LastDirectoryUpdate = DateTime.Now
                    });

                    uow.Commit();

                    UserRetrieveService.RemoveCachedUser(userId, username);
                }

                return true;
            }
            catch (Exception ex)
            {
                Log.Error("Error while importing directory user", ex, this.GetType());
                return false;
            }
        }
    }
}


text:
THIS="$0"
while [ -h "$THIS" ]; do
  ls=`ls -ld "$THIS"`
  link=`expr "$ls" : '.*-> \(.*\)$'`
  if expr "$link" : '.*/.*' > /dev/null; then
    THIS="$link"
  else
    THIS=`dirname "$THIS"`/"$link"
  fi
done

THIS_DIR=`dirname "$THIS"`

CRAWL_HOME=`cd "$THIS_DIR/.." ; pwd`
CRAWL_BIN_DIR=$CRAWL_HOME/bin
CRAWL_CONF=$CRAWL_HOME/conf
CRAWL_DATA=$CRAWL_HOME/data
CRAWL_WORK_DIR=$CRAWL_HOME/work
CRAWL_LOG_DIR=$CRAWL_HOME/log

NUTCH_HOME=$CRAWL_HOME/lib/nutch
NUTCH_BIN=$NUTCH_HOME/bin/nutch
NUTCH_CONF_DIR=$CRAWL_CONF

export NUTCH_CONF_DIR=$NUTCH_CONF_DIR

URLS=$CRAWL_CONF/urls.txt

# Clean up before crawling
rm -rf $CRAWL_WORK_DIR/wicket
rm -rf $CRAWL_LOG_DIR/crawl.log

# Run the crawl
$NUTCH_BIN crawl $URLS -dir $CRAWL_WORK_DIR/wicket -depth 20 >& $CRAWL_LOG_DIR/crawl.log

# Move to the data dir
rm -rf $CRAWL_DATA/wicket.old
mv $CRAWL_DATA/wicket $CRAWL_DATA/wicket.old 2> /dev/null
mv $CRAWL_WORK_DIR/wicket $CRAWL_DATA/wicket

# Restart the app server
$CRAWL_BIN_DIR/shutdown.sh

$CRAWL_BIN_DIR/startup.sh


text:
using System;
using System.Reactive.Linq;
using System.Threading.Tasks;
using devDept.Eyeshot;
using devDept.Eyeshot.Entities;
using devDept.Geometry;
using EyeshotBugs.Utils;
using Xunit;

namespace EyeshotBugs
{
    public class Bug12720
    {

        [Fact]
        public async Task ShouldWork()
        {
            await Eyeshot.RunSTADesktop
                ( async () =>
                {
                    var vpl = Eyeshot.EyeshotTestWindow.Model;

                    var block = new Block("Foo");
                    var blockRef = new BlockReference( new Identity(), "Foo" );

                    var cube = new Bar( 0,0,0,1,0,0,0.5,20);

                    block.Entities.Add(cube);

                    vpl.Blocks.Add( block );
                    vpl.Entities.Add(blockRef  );
                    await Task.Delay( TimeSpan.FromMilliseconds( 100 ) );
                    vpl.ZoomFit();

                    var transform = new Identity();

                    // Comment out the below line and the bar
                    // will be visible.
                    blockRef.Transformation = transform;
                    blockRef.RegenMode = regenType.NotNeeded;

                    //vpl.Entities.Regen(  );
                    await Eyeshot.EyeshotTestWindow.ClosedTask;

                } );
        }

        [Fact]
        public async Task ShouldWork2()
        {
            await Eyeshot.RunSTADesktop
                ( async () =>
                {
                    var vpl = Eyeshot.EyeshotTestWindow.Model;

                    var block = new Block("Foo");
                    var blockRef = new BlockReference( new Identity(), "Foo" );

                    var cube = new Bar( 0,0,0,1,0,0,0.5,20);

                    block.Entities.Add(cube);

                    vpl.Blocks.Add( block );
                    vpl.Entities.Add(blockRef  );
                    await Task.Delay( TimeSpan.FromMilliseconds( 100 ) );
                    vpl.ZoomFit();

                    var angle = 0;
                    Observable
                       .Interval( TimeSpan.FromMilliseconds( 10 ) )
                       .ObserveOnDispatcher()
                       .Subscribe
                            ( v =>
                            {
                                angle = angle + 5;
                                var transform = new Rotation( angle * Math.PI/180,Vector3D.AxisZ );

                                // Comment out the below line and the bar
                                // will be visible.
                                blockRef.Transformation = transform;
                                blockRef.RegenMode = regenType.NotNeeded;
                                vpl.Invalidate();

                            });

                    //vpl.Entities.Regen(  );
                    await Eyeshot.EyeshotTestWindow.ClosedTask;

                } );
        }

    }
}


text:
<?php

use Illuminate\Http\Request;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

//Route::middleware('auth:api')->get('/user', function (Request $request) {
//    return $request->user();
//});

Route::post('sign','ACMController@store');

Route::group(['middleware' => 'jwt.auth'], function () {
    //用户
    Route::get('get_user_details', 'Api\AuthController@get_user_details');  // 获取用户详情
    Route::post('user/reset','Api\UserController@resetPassword');
    Route::post('user/avatar','Api\UserController@setAvatar');
    //论坛
    Route::post('discussions', 'Api\ForumController@store');
//    Route::post('topics/update','Api\ForumController@update');
    Route::post('comments', 'Api\CommentController@store');
    Route::delete('discussions/{id}', 'Api\ForumController@destroy');
    //书
    Route::post('books', 'Api\BookController@store');
    Route::put('books/{id}', 'Api\BookController@update');
    Route::patch('books/{id}', 'Api\BookController@borrow');
    Route::delete('books/{id}', 'Api\BookController@destroy');
    //活动
    Route::post('activities/{id}/user', 'Api\ActivityController@sign');
    //后台管理
    Route::group(['middleware' => 'admin'], function () {
        Route::post('activities', 'Api\ActivityController@store');
        Route::post('activities/{id}', 'Api\ActivityController@update');
        Route::delete('activities/{id}', 'Api\ActivityController@destroy');
        //获取所有用户
        Route::get('users/all','Api\AuthController@get_all_users');
    });

});
Route::get('discussions', 'Api\ForumController@index');
Route::get('discussions/{id}', 'Api\ForumController@show');

Route::get('books', 'Api\BookController@index');
Route::get('books/{id}', 'Api\BookController@show');

Route::get('activities', 'Api\ActivityController@index');
Route::get('activities/{id}', 'Api\ActivityController@show');
//用户
Route::post('register', 'Api\AuthController@register');     // 注册
Route::post('login', 'Api\AuthController@login');           // 登陆
Route::post('user/code','Api\UserController@sendCode');
Route::post('user/forget','Api\UserController@forget');
Route::post('user/avatar','Api\UserController@setAvatar');
Route::get('user/{id}/discussions','Api\UserController@allDiscussions');
Route::get('user/{id}/comments','Api\UserController@allComments');
Route::get('user/{id}','Api\UserController@user');
Route::post('refresh', 'Api\AuthController@refresh');       //刷新token
Route::group(['middleware' => 'jwt.refresh'], function () {
});


text:
import BaseClient from "./BaseClient";

import {
    Callback,
    ClientOptions,
    DefaultResponse,
    FilteringParameters,
} from "./models/index";

import {
    Bounce,
    BounceActivationResponse,

    BounceCounts,
    BounceDump,
    BounceFilteringParameters,
    Bounces,
    BrowserUsageCounts,

    ClickCounts,
    ClickLocationCounts,
    ClickPlatformUsageCounts,
    CreateInboundRuleRequest,
    CreateMessageStreamRequest,
    CreateSuppressionsRequest,
    CreateTemplateRequest,

    CreateWebhookRequest,
    DeleteSuppressionsRequest,

    DeliveryStatistics,
    EmailClientUsageCounts,
    EmailPlaformUsageCounts,
    EmailReadTimesCounts,
    InboundMessageDetails,
    InboundMessages,
    InboundMessagesFilteringParameters,
    InboundRule,

    InboundRules,
    Message,
    MessageSendingResponse,

    MessageStream,
    MessageStreamArchiveResponse,
    MessageStreams,
    MessageStreamsFilteringParameters,
    MessageStreamUnarchiveResponse,
    OpenCounts,
    OutboundMessageClicks,
    OutboundMessageClicksFilteringParameters,
    OutboundMessageDetails,
    OutboundMessageDump,
    OutboundMessageOpens,

    OutboundMessageOpensFilteringParameters,
    OutboundMessages,
    OutboundMessagesFilteringParameters,
    OutboundStatistics,
    SentCounts,
    Server,

    SpamCounts,
    StatisticsFilteringParameters,

    Suppressions,
    SuppressionStatuses,
    Template,
    TemplatedMessage,
    TemplateFilteringParameters,

    Templates,
    TemplateValidation,
    TemplateValidationOptions,
    TrackedEmailCounts,

    UpdateMessageStreamRequest,
    UpdateServerRequest,
    UpdateTemplateRequest,
    UpdateWebhookRequest,
    Webhook,
    WebhookFilteringParameters,
    Webhooks,
} from "./models/index";

/**
 * Server client class that can be used to interact with an individual Postmark Server.
 */
export default class ServerClient extends BaseClient {

    /**
     * Create a client.
     *
     * @param serverToken - The token for the server that you wish to interact with.
     * @param configOptions - Options to customize the behavior of the this client.
     */
    constructor(serverToken: string, configOptions?: ClientOptions.Configuration) {
        super(serverToken, ClientOptions.AuthHeaderNames.SERVER_TOKEN, configOptions);
    }

    /** Send a single email message.
     *
     * @param email - Email message to send.
     * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
     * @returns A promise that will complete when the API responds (or an error occurs).
     */
    public sendEmail(email: Message, callback?: Callback<MessageSendingResponse>): Promise<MessageSendingResponse> {
        return this.processRequestWithBody<MessageSendingResponse>(ClientOptions.HttpMethod.POST, "/email", email, callback);
    }

    /**
     * Send a batch of email messages.
     *
     * @param emails - An array of messages to send.
     * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
     * @returns A promise that will complete when the API responds (or an error occurs).
     */
    public sendEmailBatch(emails: Message[], callback?: Callback<MessageSendingResponse[]>): Promise<MessageSendingResponse[]> {
        return this.processRequestWithBody(ClientOptions.HttpMethod.POST, "/email/batch", emails, callback);
    }

    /**
     * Send a message using a template.
     *
     * @param template - Message you wish to send.
     * @param callback If the callback is provided, it will be passed to the resulting promise as a continuation.
     * @returns A promise that will complete when the API responds (or an error occurs).
     */
    public sendEmailWithTemplate(template: TemplatedMessage, callback?: Callback<MessageSendingResponse>): Promise<MessageSendingResponse> {
        return this.processRequestWithBody(ClientOptions.HttpMethod.POST, "/email/withTemplate", template, callback);
    }

    /**
     * Send a batch of template email messages.
     *
     * @param templates - An array of templated messages you wish to send using this Client.
     * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
     * @returns A promise that will complete when the API responds (or an error occurs).
     */
    public sendEmailBatchWithTemplates(templates: TemplatedMessage[],
                                       callback?: Callback<MessageSendingResponse[]>): Promise<MessageSendingResponse[]> {
        return this.processRequestWithBody(ClientOptions.HttpMethod.POST, "/email/batchWithTemplates", { Messages: templates }, callback);
    }

    /**
     * Get bounce statistic information for the associated Server.
     *
     * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
     * @returns A promise that will complete when the API responds (or an error occurs).
     */
    public getDeliveryStatistics(callback?: Callback<DeliveryStatistics>): Promise<DeliveryStatistics> {
        return this.processRequestWithoutBody(ClientOptions.HttpMethod.GET, "/deliveryStats", {}, callback);
    }

    /**
     * Get a batch of bounces.
     *
     * @param filter - Optional filtering parameters.
     * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
     * @returns A promise that will complete when the API responds (or an error occurs).
     */
    public getBounces(filter: BounceFilteringParameters = new BounceFilteringParameters(), callback?: Callback<Bounces>): Promise<Bounces> {
        this.setDefaultPaginationValues(filter);
        return this.processRequestWithoutBody(ClientOptions.HttpMethod.GET, "/bounces", filter, callback);
    }

    /**
     * Get details for a specific Bounce.
     *
     * @param id - The ID of the Bounce you wish to retrieve.
     * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
     * @returns A promise that will complete when the API responds (or an error occurs).
     */
    public getBounce(id: number, callback?: Callback<Bounce>): Promise<Bounce> {
        return this.processRequestWithoutBody(ClientOptions.HttpMethod.GET, `/bounces/${id}`, {}, callback);
    }

    /**
     * Get a Bounce Dump for a specific Bounce.
     *
     * @param id - The ID of the Bounce for which you wish to retrieve Bounce Dump.
     * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
     * @returns A promise that will complete when the API responds (or an error occurs).
     */
    public getBounceDump(id: number, callback?: Callback<BounceDump>): Promise<BounceDump> {
        return this.processRequestWithoutBody(ClientOptions.HttpMethod.GET, `/bounces/${id}/dump`, {}, callback);
    }

    /**
     * Activate email address that was deactivated due to a Bounce.
     *
     * @param id - The ID of the Bounce for which you wish to activate the associated email.
     * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
     * @returns A promise that will complete when the API responds (or an error occurs).
     */
    public activateBounce(id: number, callback?: Callback<BounceActivationResponse>): Promise<BounceActivationResponse> {
        return this.processRequestWithBody(ClientOptions.HttpMethod.PUT, `/bounces/${id}/activate`, {}, callback);
    }

    /**
     * Get the list of templates associated with this server.
     *
     * @param filter - Optional filtering options.
     * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
     * @returns A promise that will complete when the API responds (or an error occurs).
     */
    public getTemplates(filter: TemplateFilteringParameters = new TemplateFilteringParameters(),
                        callback?: Callback<Templates>): Promise<Templates> {
        this.setDefaultPaginationValues(filter);
        return this.processRequestWithoutBody(ClientOptions.HttpMethod.GET, "/templates", filter, callback);
    }

    /**
     * Get the a specific template associated with this server.
     *
     * @param idOrAlias - ID or alias for the template you wish to retrieve.
     * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
     * @returns A promise that will complete when the API responds (or an error occurs).
     */
    public getTemplate(idOrAlias: (number | string), callback?: Callback<Template>): Promise<Template> {
        return this.processRequestWithoutBody(ClientOptions.HttpMethod.GET, `/templates/${idOrAlias}`, {}, callback);
    }

    /**
     * Delete a template associated with this server.
     *
     * @param idOrAlias - ID or template alias you wish to delete.
     * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
     * @returns A promise that will complete when the API responds (or an error occurs).
     */
    public deleteTemplate(idOrAlias: (number | string), callback?: Callback<DefaultResponse>): Promise<DefaultResponse> {
        return this.processRequestWithoutBody(ClientOptions.HttpMethod.DELETE, `/templates/${idOrAlias}`, {}, callback);
    }

    /**
     * Create a new template on the associated server.
     *
     * @param options - Configuration options to be used to create the Template.
     * @param callback If the callback is provided, it will be passed to the resulting promise as a continuation.
     * @returns A promise that will complete when the API responds (or an error occurs).
     */
    public createTemplate(options: CreateTemplateRequest, callback?: Callback<Template>): Promise<Template> {
        return this.processRequestWithBody(ClientOptions.HttpMethod.POST, "/templates/", options, callback);
    }

    /**
     * Update a template on the associated server.
     *
     * @param idOrAlias - Id or alias of the template you wish to update.
     * @param options - Template options you wish to update.
     * @param callback If the callback is provided, it will be passed to the resulting promise as a continuation.
     * @returns A promise that will complete when the API responds (or an error occurs).
     */
    public editTemplate(idOrAlias: (number | string), options: UpdateTemplateRequest, callback?: Callback<Template>): Promise<Template> {
        return this.processRequestWithBody(ClientOptions.HttpMethod.PUT, `/templates/${idOrAlias}`, options, callback);
    }

    /**
     * Validate template markup to verify that it will be parsed. Also provides a recommended template
     * model to be used when sending using the specified template content.
     *
     * @param options - The template content you wish to validate.
     * @param callback If the callback is provided, it will be passed to the resulting promise as a continuation.
     * @returns A promise that will complete when the API responds (or an error occurs).
     */
    public validateTemplate(options: TemplateValidationOptions, callback?: Callback<TemplateValidation>):
        Promise<TemplateValidation> {
        return this.processRequestWithBody(ClientOptions.HttpMethod.POST, "/templates/validate", options, callback);
    }

    /**
     * Get the information for the Server associated with this Client.
     *
     * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
     * @returns A promise that will complete when the API responds (or an error occurs).
     */
    public getServer(callback?: Callback<Server>): Promise<Server> {
        return this.processRequestWithoutBody(ClientOptions.HttpMethod.GET, "/server", {}, callback);
    }

    /**
     * Modify the Server associated with this Client.
     *
     * @param options - The options you wish to modify.
     * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
     * @returns A promise that will complete when the API responds (or an error occurs).
     */
    public editServer(options: UpdateServerRequest, callback?: Callback<Server>): Promise<Server> {
        return this.processRequestWithBody(ClientOptions.HttpMethod.PUT, "/server", options, callback);
    }

    /**
     * Get a batch of Outbound Messages.
     *
     * @param filter - Optional filtering parameters.
     * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
     * @returns A promise that will complete when the API responds (or an error occurs).
     */
    public getOutboundMessages(filter: OutboundMessagesFilteringParameters = new OutboundMessagesFilteringParameters(),
                               callback?: Callback<OutboundMessages>): Promise<OutboundMessages> {
        this.setDefaultPaginationValues(filter);
        return this.processRequestWithoutBody(ClientOptions.HttpMethod.GET, "/messages/outbound", filter, callback);
    }

    /**
     * Get details for a specific Outbound Message.
     *
     * @param messageId - The ID of the OutboundMessage you wish to retrieve.
     * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
     * @returns A promise that will complete when the API responds (or an error occurs).
     */
    public getOutboundMessageDetails(messageId: string,
                                     callback?: Callback<OutboundMessageDetails>): Promise<OutboundMessageDetails> {
        return this.processRequestWithoutBody(ClientOptions.HttpMethod.GET, `/messages/outbound/${messageId}`, {}, callback);
    }

    /**
     * Get details for a specific Outbound Message.
     *
     * @param messageId - The ID of the OutboundMessage you wish to retrieve.
     * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
     * @returns A promise that will complete when the API responds (or an error occurs).
     */
    public getOutboundMessageDump(messageId: string,
                                  callback?: Callback<OutboundMessageDump>): Promise<OutboundMessageDump> {
        return this.processRequestWithoutBody(ClientOptions.HttpMethod.GET, `/messages/outbound/${messageId}/dump`, {}, callback);
    }

    /**
     * Get a batch of Inbound Messages.
     *
     * @param filter - Optional filtering parameters.
     * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
     * @returns A promise that will complete when the API responds (or an error occurs).
     */
    public getInboundMessages(filter: InboundMessagesFilteringParameters = new InboundMessagesFilteringParameters(),
                              callback?: Callback<InboundMessages>): Promise<InboundMessages> {
        this.setDefaultPaginationValues(filter);
        return this.processRequestWithoutBody(ClientOptions.HttpMethod.GET, "/messages/inbound", filter, callback);
    }

    /**
     * Get details for a specific Inbound Message.
     *
     * @param messageId - The ID of the Inbound Message you wish to retrieve.
     * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
     * @returns A promise that will complete when the API responds (or an error occurs).
     */
    public getInboundMessageDetails(messageId: string, callback?: Callback<InboundMessageDetails>): Promise<InboundMessageDetails> {
        return this.processRequestWithoutBody(ClientOptions.HttpMethod.GET, `/messages/inbound/${messageId}/details`, {}, callback);
    }

    /**
     * Cause an Inbound Message to bypass filtering rules defined on this Client's associated Server.
     *
     * @param messageId - The ID of the Inbound Message for which you wish to bypass the filtering rules.
     * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
     * @returns A promise that will complete when the API responds (or an error occurs).
     */
    public bypassBlockedInboundMessage(messageId: string, callback?: Callback<DefaultResponse>): Promise<DefaultResponse> {
        return this.processRequestWithoutBody(ClientOptions.HttpMethod.PUT, `/messages/inbound/${messageId}/bypass`, {}, callback);
    }

    /**
     * Request that Postmark retry POSTing to the Inbound Hook for the specified message.
     *
     * @param messageId - The ID of the Inbound Message for which you wish to retry the inbound hook.
     * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
     * @returns A promise that will complete when the API responds (or an error occurs).
     */
    public retryInboundHookForMessage(messageId: string, callback?: Callback<DefaultResponse>): Promise<DefaultResponse> {
        return this.processRequestWithoutBody(ClientOptions.HttpMethod.PUT, `/messages/inbound/${messageId}/retry`, {}, callback);
    }

    /**
     * Get the Opens for Outbound Messages.
     *
     * @param filter - Optional filtering parameters.
     * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
     * @returns A promise that will complete when the API responds (or an error occurs).
     */
    public getMessageOpens(filter: OutboundMessageOpensFilteringParameters = new OutboundMessageOpensFilteringParameters(),
                           callback?: Callback<OutboundMessageOpens>): Promise<OutboundMessageOpens> {
        this.setDefaultPaginationValues(filter);
        return this.processRequestWithoutBody(ClientOptions.HttpMethod.GET, "/messages/outbound/opens", filter, callback);
    }

    /**
     * Get details of Opens for specific Outbound Message.
     *
     * @param messageId - Message ID of the message for which you wish to retrieve Opens.
     * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
     * @returns A promise that will complete when the API responds (or an error occurs).
     */
    public getMessageOpensForSingleMessage(messageId: string,
                                           filter: OutboundMessageOpensFilteringParameters = new OutboundMessageOpensFilteringParameters(50, 0),
                                           callback?: Callback<OutboundMessageOpens>): Promise<OutboundMessageOpens> {
        this.setDefaultPaginationValues(filter);
        return this.processRequestWithoutBody(ClientOptions.HttpMethod.GET, `/messages/outbound/opens/${messageId}`, filter, callback);
    }

    /**
     * Get the Clicks for Outbound Messages.
     *
     * @param filter - Optional filtering parameters.
     * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
     * @returns A promise that will complete when the API responds (or an error occurs).
     */
    public getMessageClicks(filter: OutboundMessageClicksFilteringParameters = new OutboundMessageClicksFilteringParameters(),
                            callback?: Callback<OutboundMessageClicks>): Promise<OutboundMessageClicks> {
        this.setDefaultPaginationValues(filter);
        return this.processRequestWithoutBody(ClientOptions.HttpMethod.GET, "/messages/outbound/clicks", filter, callback);
    }

    /**
     * Get Click information for a single Outbound Message.
     *
     * @param messageId - The MessageID for which clicks should be retrieved.
     * @param filter - Optional filtering parameters.
     * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
     * @returns A promise that will complete when the API responds (or an error occurs).
     */
    public getMessageClicksForSingleMessage(messageId: string,
                                            filter: OutboundMessageClicksFilteringParameters = new OutboundMessageClicksFilteringParameters(),
                                            callback?: Callback<OutboundMessageClicks>): Promise<OutboundMessageClicks> {
        this.setDefaultPaginationValues(filter);
        return this.processRequestWithoutBody(ClientOptions.HttpMethod.GET, `/messages/outbound/clicks/${messageId}`, filter, callback);
    }

    /**
     * Get overview statistics on Outbound Messages sent from the Server associated with this Client.
     *
     * @param filter - Optional filtering parameters.
     * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
     * @returns A promise that will complete when the API responds (or an error occurs).
     */
    public getOutboundOverview(filter: StatisticsFilteringParameters = new StatisticsFilteringParameters(),
                               callback?: Callback<OutboundStatistics>): Promise<OutboundStatistics> {
        return this.processRequestWithoutBody(ClientOptions.HttpMethod.GET, "/stats/outbound", filter, callback);
    }

    /**
     * Get statistics on email sent from the Server associated with this Client.
     *
     * @param filter - Optional filtering parameters.
     * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
     * @returns A promise that will complete when the API responds (or an error occurs).
     */
    public getSentCounts(filter: StatisticsFilteringParameters = new StatisticsFilteringParameters(),
                         callback?: Callback<SentCounts>): Promise<SentCounts> {
        return this.processRequestWithoutBody(ClientOptions.HttpMethod.GET, "/stats/outbound/sends", filter, callback);
    }

    /**
     * Get statistiscs on emails that bounced after being sent from the Server associated with this Client.
     *
     * @param filter - Optional filtering parameters.
     * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
     * @returns A promise that will complete when the API responds (or an error occurs).
     */
    public getBounceCounts(filter: StatisticsFilteringParameters = new StatisticsFilteringParameters(),
                           callback?: Callback<BounceCounts>): Promise<BounceCounts> {
        return this.processRequestWithoutBody(ClientOptions.HttpMethod.GET, "/stats/outbound/bounces", filter, callback);
    }

    /**
     * Get SPAM complaint statistics for email sent from the Server associated with this Client.
     *
     * @param filter - Optional filtering parameters.
     * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
     * @returns A promise that will complete when the API responds (or an error occurs).
     */
    public getSpamComplaintsCounts(filter: StatisticsFilteringParameters = new StatisticsFilteringParameters(),
                                   callback?: Callback<SpamCounts>): Promise<SpamCounts> {
        return this.processRequestWithoutBody(ClientOptions.HttpMethod.GET, "/stats/outbound/spam", filter, callback);
    }

    /**
     * Get email tracking statistics for messages sent from the Server associated with this Client.
     *
     * @param filter - Optional filtering parameters.
     * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
     * @returns A promise that will complete when the API responds (or an error occurs).
     */
    public getTrackedEmailCounts(filter: StatisticsFilteringParameters = new StatisticsFilteringParameters(),
                                 callback?: Callback<TrackedEmailCounts>): Promise<TrackedEmailCounts> {
        return this.processRequestWithoutBody(ClientOptions.HttpMethod.GET, "/stats/outbound/tracked", filter, callback);
    }

    /**
     * Get Open statistics for messages sent from the Server associated with this Client.
     *
     * @param filter - Optional filtering parameters.
     * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
     * @returns A promise that will complete when the API responds (or an error occurs).
     */
    public getEmailOpenCounts(filter: StatisticsFilteringParameters = new StatisticsFilteringParameters(),
                              callback?: Callback<OpenCounts>): Promise<OpenCounts> {
        return this.processRequestWithoutBody(ClientOptions.HttpMethod.GET, "/stats/outbound/opens", filter, callback);
    }

    /**
     * Get Email Client Platform statistics for messages sent from the Server associated with this Client.
     *
     * @param filter - Optional filtering parameters.
     * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
     * @returns A promise that will complete when the API responds (or an error occurs).
     */
    public getEmailOpenPlatformUsage(filter: StatisticsFilteringParameters = new StatisticsFilteringParameters(),
                                     callback?: Callback<EmailPlaformUsageCounts>): Promise<EmailPlaformUsageCounts> {
        return this.processRequestWithoutBody(ClientOptions.HttpMethod.GET, "/stats/outbound/opens/platforms", filter, callback);
    }

    /**
     * Get statistics on which Email Clients were used to open messages sent from the Server associated with this Client.
     *
     * @param filter - Optional filtering parameters.
     * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
     * @returns A promise that will complete when the API responds (or an error occurs).
     */
    public getEmailOpenClientUsage(filter: StatisticsFilteringParameters = new StatisticsFilteringParameters(),
                                   callback?: Callback<EmailClientUsageCounts>): Promise<EmailClientUsageCounts> {
        return this.processRequestWithoutBody(ClientOptions.HttpMethod.GET, "/stats/outbound/opens/emailClients", filter, callback);
    }

    /**
     * Get Read Time statistics for messages sent from the Server associated with this Client.
     * @param filter Optional filtering parameters.
     * @param callback If the callback is provided, it will be passed to the resulting promise as a continuation.
     * @returns A promise that will complete when the API responds (or an error occurs).
     */
    public getEmailOpenReadTimes(filter: StatisticsFilteringParameters = new StatisticsFilteringParameters(),
                                 callback?: Callback<EmailReadTimesCounts>): Promise<EmailReadTimesCounts> {
        return this.processRequestWithoutBody(ClientOptions.HttpMethod.GET, "/stats/outbound/opens/readTimes", filter, callback);
    }

    /**
     * Get total clicks statistics for tracked links for messages sent from the Server associated with this Client.
     *
     * @param filter - Optional filtering parameters.
     * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
     * @returns A promise that will complete when the API responds (or an error occurs).
     */
    public getClickCounts(filter: StatisticsFilteringParameters = new StatisticsFilteringParameters(),
                          callback?: Callback<ClickCounts>): Promise<ClickCounts> {
        return this.processRequestWithoutBody(ClientOptions.HttpMethod.GET, "/stats/outbound/clicks", filter, callback);
    }

    /**
     * Get browser family statistics for tracked links for messages sent from the Server associated with this Client.
     * @param filter Optional filtering parameters.
     * @param callback If the callback is provided, it will be passed to the resulting promise as a continuation.
     * @returns A promise that will complete when the API responds (or an error occurs).
     */
    public getClickBrowserUsage(filter: StatisticsFilteringParameters = new StatisticsFilteringParameters(),
                                callback?: Callback<BrowserUsageCounts>): Promise<BrowserUsageCounts> {
        return this.processRequestWithoutBody(ClientOptions.HttpMethod.GET, "/stats/outbound/clicks/browserFamilies", filter, callback);
    }

    /**
     * Get browser platform statistics for tracked links for messages sent from the Server associated with this Client.
     *
     * @param filter - Optional filtering parameters.
     * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
     * @returns A promise that will complete when the API responds (or an error occurs).
     */
    public getClickPlatformUsage(filter: StatisticsFilteringParameters = new StatisticsFilteringParameters(),
                                 callback?: Callback<ClickPlatformUsageCounts>): Promise<ClickPlatformUsageCounts> {
        return this.processRequestWithoutBody(ClientOptions.HttpMethod.GET, "/stats/outbound/clicks/platforms", filter, callback);
    }

    /**
     * Get click location (in HTML or Text body of the email) statistics for tracked links for messages sent
     * from the Server associated with this Client.
     *
     * @param filter - Optional filtering parameters.
     * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
     * @returns A promise that will complete when the API responds (or an error occurs).
     */
    public getClickLocation(filter: StatisticsFilteringParameters = new StatisticsFilteringParameters(),
                            callback?: Callback<ClickLocationCounts>): Promise<ClickLocationCounts> {
        return this.processRequestWithoutBody(ClientOptions.HttpMethod.GET, "/stats/outbound/clicks/location", filter, callback);
    }

    /**
     * Create an Inbound Rule Trigger.
     *
     * @param options - Configuration options to be used when creating this Trigger.
     * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
     * @returns A promise that will complete when the API responds (or an error occurs).
     */
    public createInboundRuleTrigger(options: CreateInboundRuleRequest, callback?: Callback<InboundRule>): Promise<InboundRule> {
        return this.processRequestWithBody(ClientOptions.HttpMethod.POST, "/triggers/inboundRules", options, callback);
    }

    /**
     * Delete an Inbound Rule Trigger.
     *
     * @param id - The ID of the Inbound Rule Trigger you wish to delete.
     * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
     * @returns A promise that will complete when the API responds (or an error occurs).
     */
    public deleteInboundRuleTrigger(id: number, callback?: Callback<DefaultResponse>): Promise<DefaultResponse> {
        return this.processRequestWithoutBody(ClientOptions.HttpMethod.DELETE, `/triggers/inboundRules/${id}`, {}, callback);
    }

    /**
     * Get a list of Inbound Rule Triggers.
     *
     * @param filter - Optional filtering parameters.
     * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
     * @returns A promise that will complete when the API responds (or an error occurs).
     */
    public getInboundRuleTriggers(filter: FilteringParameters = new FilteringParameters(), callback?: Callback<InboundRules>): Promise<InboundRules> {
        this.setDefaultPaginationValues(filter);
        return this.processRequestWithoutBody(ClientOptions.HttpMethod.GET, "/triggers/inboundRules", filter, callback);
    }

    /**
     * Get the list of Webhooks for specific server.
     *
     * @param filter - Optional filtering parameters
     * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
     * @returns A promise that will complete when the API responds (or an error occurs).
     */
    public getWebhooks(filter: WebhookFilteringParameters = {}, callback?: Callback<Webhooks>): Promise<Webhooks> {
        return this.processRequestWithoutBody(ClientOptions.HttpMethod.GET, "/webhooks", filter, callback);
    }

    /**
     * Get details for a specific Webhook.
     *
     * @param id - The ID of the Webhook you wish to retrieve.
     * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
     * @returns A promise that will complete when the API responds (or an error occurs).
     */
    public getWebhook(id: number, callback?: Callback<Webhook>): Promise<Webhook> {
        return this.processRequestWithoutBody(ClientOptions.HttpMethod.GET, `/webhooks/${id}`, {}, callback);
    }

    /**
     * Create a Webhook on the associated server.
     *
     * @param options - Configuration options to be used when creating Webhook trigger.
     * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
     * @returns A promise that will complete when the API responds (or an error occurs).
     */
    public createWebhook(options: CreateWebhookRequest, callback?: Callback<Webhook>): Promise<Webhook> {
        return this.processRequestWithBody(ClientOptions.HttpMethod.POST, "/webhooks", options, callback);
    }

    /**
     * Update Webhook on the associated server.
     *
     * @param id - Id of the webhook you wish to update.
     * @param options - Webhook options you wish to update.
     * @param callback If the callback is provided, it will be passed to the resulting promise as a continuation.
     * @returns A promise that will complete when the API responds (or an error occurs).
     */
    public editWebhook(id: number, options: UpdateWebhookRequest, callback?: Callback<Webhook>): Promise<Webhook> {
        return this.processRequestWithBody(ClientOptions.HttpMethod.PUT, `/webhooks/${id}`, options, callback);
    }

    /**
     * Delete an existing Webhook.
     *
     * @param id - The ID of the Webhook you wish to delete.
     * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
     * @returns A promise that will complete when the API responds (or an error occurs).
     */
    public deleteWebhook(id: number, callback?: Callback<DefaultResponse>): Promise<DefaultResponse> {
        return this.processRequestWithoutBody(ClientOptions.HttpMethod.DELETE, `/webhooks/${id}`, {}, callback);
    }

    /**
     * Get the list of message streams on a server.
     *
     * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
     * @returns A promise that will complete when the API responds (or an error occurs).
     */
    public getMessageStreams(filter: MessageStreamsFilteringParameters = {}, callback?: Callback<MessageStreams>): Promise<MessageStreams> {
        return this.processRequestWithoutBody(ClientOptions.HttpMethod.GET, "/message-streams", filter, callback);
    }

    /**
     * Get details for a specific message stream on a server.
     *
     * @param id - The ID of the message stream you wish to retrieve.
     * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
     * @returns A promise that will complete when the API responds (or an error occurs).
     */
    public getMessageStream(id: string, callback?: Callback<MessageStream>): Promise<MessageStream> {
        return this.processRequestWithoutBody(ClientOptions.HttpMethod.GET, `/message-streams/${id}`, {}, callback);
    }

    /**
     * Update message stream on the associated server.
     *
     * @param id - Id of the webhook you wish to update.
     * @param options - Webhook options you wish to update.
     * @param callback If the callback is provided, it will be passed to the resulting promise as a continuation.
     * @returns A promise that will complete when the API responds (or an error occurs).
     */
    public editMessageStream(id: string, options: UpdateMessageStreamRequest, callback?: Callback<MessageStream>): Promise<MessageStream> {
        return this.processRequestWithBody(ClientOptions.HttpMethod.PATCH, `/message-streams/${id}`, options, callback);
    }

    /**
     * Create a message stream on the associated server.
     *
     * @param options - Configuration options to be used when creating message stream on the server.
     * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
     * @returns A promise that will complete when the API responds (or an error occurs).
     */
    public createMessageStream(options: CreateMessageStreamRequest, callback?: Callback<MessageStream>): Promise<MessageStream> {
        return this.processRequestWithBody(ClientOptions.HttpMethod.POST, "/message-streams", options, callback);
    }

    /**
     * Archive a message stream on the associated server.
     *
     * @param options - Configuration options to be used when creating message stream on the server.
     * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
     * @returns A promise that will complete when the API responds (or an error occurs).
     */
    public archiveMessageStream(id: string , callback?: Callback<MessageStreamArchiveResponse>): Promise<MessageStreamArchiveResponse> {
        return this.processRequestWithBody(ClientOptions.HttpMethod.POST, `/message-streams/${id}/archive`, {}, callback);
    }

    /**
     * Unarchive a message stream on the associated server.
     *
     * @param options - Configuration options to be used when creating message stream on the server.
     * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
     * @returns A promise that will complete when the API responds (or an error occurs).
     */
    public unarchiveMessageStream(id: string , callback?: Callback<MessageStreamUnarchiveResponse>): Promise<MessageStreamUnarchiveResponse> {
        return this.processRequestWithBody(ClientOptions.HttpMethod.POST, `/message-streams/${id}/unarchive`, {}, callback);
    }

    /**
     * Get the list of suppressions for a message stream on a server.
     *
     * @param messageStream - Select message stream
     * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
     * @returns A promise that will complete when the API responds (or an error occurs).
     */
    public getSuppressions(messageStream: string, callback?: Callback<Suppressions>): Promise<Suppressions> {
        return this.processRequestWithoutBody(ClientOptions.HttpMethod.GET, `/message-streams/${messageStream}/suppressions/dump`, callback);
    }

    /**
     * Add email addresses to a suppressions list on a message stream on a server.
     *
     * @param messageStream - Select message stream
     * @param options - Suppressions you wish to add.
     * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
     * @returns A promise that will complete when the API responds (or an error occurs).
     */
    public createSuppressions(messageStream: string, options: CreateSuppressionsRequest,
                              callback?: Callback<SuppressionStatuses>): Promise<SuppressionStatuses> {
        return this.processRequestWithBody(ClientOptions.HttpMethod.POST, `/message-streams/${messageStream}/suppressions`, options, callback);
    }

    /**
     * Delete email addresses from a suppressions list on a message stream on a server.
     *
     * @param messageStream - Select message stream
     * @param options - Suppressions you wish to delete.
     * @param callback - If the callback is provided, it will be passed to the resulting promise as a continuation.
     * @returns A promise that will complete when the API responds (or an error occurs).
     */
    public deleteSuppressions(messageStream: string, options: DeleteSuppressionsRequest,
                              callback?: Callback<SuppressionStatuses>): Promise<SuppressionStatuses> {
        return this.processRequestWithBody(ClientOptions.HttpMethod.POST, `/message-streams/${messageStream}/suppressions/delete`, options, callback);
    }
}


text:
namespace arangodb {

// must call Thread::shutdown() in order to properly shutdown
RocksDBShaCalculatorThread::~RocksDBShaCalculatorThread() { shutdown(); }

void RocksDBShaCalculatorThread::run() {
  while (!isStopping()) {
    try {
      {
        MUTEX_LOCKER(mutexLock, _pendingMutex);

        while (!_pendingQueue.empty()) {
          actionNeeded_t next(_pendingQueue.front());
          _pendingQueue.pop();

          mutexLock.unlock();
          switch (next._action) {
            case actionNeeded_t::CALC_SHA:
              shaCalcFile(next._path);
              break;

            case actionNeeded_t::DELETE_ACTION:
              deleteFile(next._path);
              break;

            default:
              LOG_TOPIC("7c75c", ERR, arangodb::Logger::ENGINES)
                  << "RocksDBShaCalculatorThread::run encountered unknown "
                     "action";
              TRI_ASSERT(false);
              break;
          }
          mutexLock.lock();
        }
      }

      // we could find files that subsequently post to _pendingQueue ... no worries.
      checkMissingShaFiles(getRocksDBPath(), 5 * 60);
      // need not to be written to in the past 5 minutes!

      // no need for fast retry, hotbackups do not happen often
      {
        CONDITION_LOCKER(condLock, _loopingCondvar);
        if (!isStopping()) {
          condLock.wait(std::chrono::minutes(5));
        }
      }
    } catch (std::exception const& ex) {
      LOG_TOPIC("a27a1", ERR, arangodb::Logger::ENGINES)
          << "RocksDBShaCalculatorThread::run caught exception: " << ex.what();
    } catch (...) {
      LOG_TOPIC("66a10", ERR, arangodb::Logger::ENGINES)
          << "RocksDBShaCalculatorThread::run caught an exception";
    }
  }
}

void RocksDBShaCalculatorThread::queueShaCalcFile(std::string const& pathName) {
  {
    MUTEX_LOCKER(lock, _pendingMutex);
    _pendingQueue.emplace(actionNeeded_t{actionNeeded_t::CALC_SHA, pathName});
  }
  signalLoop();
}

void RocksDBShaCalculatorThread::queueDeleteFile(std::string const& pathName) {
  {
    MUTEX_LOCKER(lock, _pendingMutex);
    _pendingQueue.emplace(actionNeeded_t{actionNeeded_t::DELETE_ACTION, pathName});
  }

  signalLoop();
}

void RocksDBShaCalculatorThread::signalLoop() {
  {
    CONDITION_LOCKER(lock, _loopingCondvar);
    lock.signal();
  }
}

bool RocksDBShaCalculatorThread::shaCalcFile(std::string const& filename) {
  bool good = false;

  if (4 < filename.size() && 0 == filename.substr(filename.size() - 4).compare(".sst")) {
    TRI_SHA256Functor sha;
    LOG_TOPIC("af088", DEBUG, arangodb::Logger::ENGINES)
        << "shaCalcFile: computing " << filename;
    good = TRI_ProcessFile(filename.c_str(), std::ref(sha));

    if (good) {
      std::string newfile = filename.substr(0, filename.size() - 4);
      newfile += ".sha.";
      newfile += sha.finalize();
      newfile += ".hash";
      LOG_TOPIC("80257", DEBUG, arangodb::Logger::ENGINES)
          << "shaCalcFile: done " << filename << " result: " << newfile;
      auto ret_val = TRI_WriteFile(newfile.c_str(), "", 0);
      if (TRI_ERROR_NO_ERROR != ret_val) {
        good = false;
        LOG_TOPIC("8f7ef", DEBUG, arangodb::Logger::ENGINES)
            << "shaCalcFile: TRI_WriteFile failed with " << ret_val << " for " << newfile;
      }
    } else {
      LOG_TOPIC("7f3fd", DEBUG, arangodb::Logger::ENGINES)
          << "shaCalcFile:  TRI_ProcessFile failed for " << filename;
    }
  }

  return good;
}

bool RocksDBShaCalculatorThread::deleteFile(std::string const& filename) {
  bool good = false, found = false;

  // need filename without ".sst" for matching to ".sha." file
  std::string basename = TRI_Basename(filename.c_str());
  if (4 < basename.size() && 0 == basename.substr(basename.size() - 4).compare(".sst")) {
    basename = basename.substr(0, basename.size() - 4);
  } else {
    // abort looking
    found = true;
  }

  if (!found) {
    std::string dirname = TRI_Dirname(filename);
    std::vector<std::string> filelist = TRI_FilesDirectory(dirname.c_str());

    // future thought: are there faster ways to find matching .sha. file?
    for (auto const& it : filelist) {
      // sha256 is 64 characters long.  ".sha." is added 5.  So 69 characters is minimum length
      if (69 < it.size() && 0 == it.compare(0, basename.size(), basename) &&
          0 == it.substr(basename.size(), 5).compare(".sha.")) {
        std::string deletefile = basics::FileUtils::buildFilename(dirname, it);
        auto ret_val = TRI_UnlinkFile(deletefile.c_str());
        good = (TRI_ERROR_NO_ERROR == ret_val);
        if (!good) {
          LOG_TOPIC("acb34", DEBUG, arangodb::Logger::ENGINES)
              << "deleteCalcFile:  TRI_UnlinkFile failed with " << ret_val
              << " for " << deletefile;
        } else {
          LOG_TOPIC("e0a0d", DEBUG, arangodb::Logger::ENGINES)
              << "deleteCalcFile:  TRI_UnlinkFile succeeded for " << deletefile;
        }
        break;
      }
    }
  }

  return good;
}

/// @brief Wrapper for getFeature<DatabasePathFeature> to simplify
///        unit testing
std::string RocksDBShaCalculatorThread::getRocksDBPath() {
  // get base path from DatabaseServerFeature
  auto& databasePathFeature = _server.getFeature<DatabasePathFeature>();
  return databasePathFeature.subdirectoryName("engine-rocksdb");
}

/// @brief Double check the active directory to see that all .sst files
///        have a matching .sha. (and delete any none matched .sha. files)
///        Will only consider .sst files which have not been written to for
///        `requireAge` seconds.
void RocksDBShaCalculatorThread::checkMissingShaFiles(std::string const& pathname,
                                                      int64_t requireAge) {
  std::vector<std::string> filelist = TRI_FilesDirectory(pathname.c_str());

  // sorting will put xxxxxx.sha.yyy just before xxxxxx.sst
  std::sort(filelist.begin(), filelist.end());

  std::string temppath, tempname;
  for (auto iter = filelist.begin(); filelist.end() != iter; ++iter) {
    // cppcheck-suppress derefInvalidIteratorRedundantCheck
    std::string::size_type shaIdx = iter->find(".sha.");
    if (std::string::npos != shaIdx) {
      // two cases: 1. its .sst follows so skip both, 2. no matching .sst, so delete
      bool match = false;
      // cppcheck-suppress derefInvalidIteratorRedundantCheck
      auto next = iter + 1;
      // cppcheck-suppress derefInvalidIteratorRedundantCheck
      if (filelist.end() != next) {
        tempname = iter->substr(0, shaIdx);
        tempname += ".sst";
        if (0 == next->compare(tempname)) {
          match = true;
          iter = next;
        }
      }

      if (!match) {
        temppath = basics::FileUtils::buildFilename(pathname, *iter);
        LOG_TOPIC("4eac9", DEBUG, arangodb::Logger::ENGINES)
            << "checkMissingShaFiles:"
               " Deleting file "
            << temppath;
        TRI_UnlinkFile(temppath.c_str());
      }
    } else if (0 == iter->substr(iter->size() - 4).compare(".sst")) {
      // reaching this point means no .sha. preceeded, now check the
      // modification time, if younger than 5 mins, just leave it, otherwise,
      // we create a sha file. This is to ensure that sha files are eventually
      // generated if somebody switches on backup after the fact. However,
      // normally, the shas should only be computed when the sst file has
      // been fully written, which can only be guaranteed if we got a
      // creation event.
      temppath = basics::FileUtils::buildFilename(pathname, *iter);
      int64_t now = ::time(nullptr);
      int64_t modTime;
      auto r = TRI_MTimeFile(temppath.c_str(), &modTime);
      if (r == TRI_ERROR_NO_ERROR && (now - modTime) >= requireAge) {
        LOG_TOPIC("d6c86", DEBUG, arangodb::Logger::ENGINES)
            << "checkMissingShaFiles:"
               " Computing checksum for "
            << temppath;
        shaCalcFile(temppath);
      } else {
        LOG_TOPIC("7f70f", DEBUG, arangodb::Logger::ENGINES)
            << "checkMissingShaFiles:"
               " Not computing checksum for "
            << temppath << " since it is too young";
      }
    }
  }
}

/// @brief Setup the object, clearing variables, but do no real work
RocksDBShaCalculator::RocksDBShaCalculator(application_features::ApplicationServer& server)
    : _shaThread(server, "Sha256Thread") {
  _shaThread.start(&_threadDone);
}

/// @brief Shutdown the background thread only if it was ever started
RocksDBShaCalculator::~RocksDBShaCalculator() {
  _shaThread.signalLoop();
  CONDITION_LOCKER(locker, _threadDone);
  if (_shaThread.isRunning()) {
    _threadDone.wait();
  }
}

void RocksDBShaCalculator::OnFlushCompleted(rocksdb::DB* db,
                                            const rocksdb::FlushJobInfo& flush_job_info) {
  _shaThread.queueShaCalcFile(flush_job_info.file_path);
}

void RocksDBShaCalculator::OnTableFileDeleted(const rocksdb::TableFileDeletionInfo& info) {
  _shaThread.queueDeleteFile(info.file_path);
}

void RocksDBShaCalculator::OnCompactionCompleted(rocksdb::DB* db,
                                                 const rocksdb::CompactionJobInfo& ci) {
  for (auto const& filename : ci.output_files) {
    _shaThread.queueShaCalcFile(filename);
  }
}

}  // namespace arangodb


text:
  <ng-container *ngTemplateOutlet="widget"></ng-container>

<ng-template #widget>
  <ng-container
    *ngFor="let category of categories | async; let firstCat = first">

{{
      category.name }}

      <div #check
        *ngFor="let option of category.options | async; let firstOpt = first; let last = last"
        class="custom-control custom-checkbox d-inline-flex mr-3 align-content-center"
        [ngClass]="{ 'mt-1': !(firstCat &&  !category.name && firstOpt) || horizontal}"
        (click)="toggle(option.value); $event.preventDefault(); $event.stopPropagation()"
        (keydown.space)="$event.preventDefault(); $event.stopPropagation()"
        (keyup.enter)="toggle(option.value); $event.preventDefault(); $event.stopPropagation()">
        <input type="checkbox" [name]="name" class="custom-control-input"
          [id]="id + '_' + option.value" [value]="option.value"
          [checked]="isSelected(option)" [disabled]="option.disabled">

          {{ option.text }}

  </ng-container>
  <field-errors [control]="formControl"></field-errors>
</ng-template>


text:
/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/
#ifndef KLINEAK_LIB_H
#define KLINEAK_LIB_H
/*
#include <ctype.h>
#include <dcopclient.h>
#include <dcopobject.h>
#include <dcopref.h>
#include <iostream>
#include <kapplication.h>
#include <kdatastream.h>
#include <klocale.h>
#include <kurl.h>
#include <qcolor.h>
#include <qstring.h>
#include <qstringlist.h>
#include <qvariant.h>
#include <sstream>
#include <stdio.h>
#include <stdlib.h>
*/
#include <qstring.h>
#include <qstringlist.h>
#include <config.h>
#include <qcolor.h>
#include <qrect.h>
#include <qpoint.h>
#include <qsize.h>
#include <qcolor.h>
#include <lineak/plugin_definitions.h>
QCStringList findObject(DCOPClient* dcop, const char* app, const char* obj, const char* func, QCStringList args, bool bAppIdOnly );
bool launchApp(DCOPClient* dcop, QString app);
void startApp(DCOPClient* dcop, const char *_app, int argc, const char **args);
bool mkBool( const QString& s );
QPoint mkPoint( const QString &str );
QSize mkSize( const QString &str );
QRect mkRect( const QString &str );
QColor mkColor( const QString& s );
QCString demarshal( QDataStream &stream, const QString &type );
void marshall( QDataStream &arg, QCStringList args, uint &i, QString type );

#endif


text:
using System;
using System.Xml.Serialization;
using System.Collections.Generic;

namespace EZOper.NetSiteUtilities.AopApi
{
    /// <summary>
    /// VoucherDetailInfo Data Structure.
    /// </summary>
    [Serializable]
    public class VoucherDetailInfo : AopObject
    {
        /// <summary>
        /// 资产id
        /// </summary>
        [XmlElement("asset_id")]
        public string AssetId { get; set; }

        /// <summary>
        /// 有效期起
        /// </summary>
        [XmlElement("effect_time")]
        public string EffectTime { get; set; }

        /// <summary>
        /// 扩展字段信息,通过map存储的json串
        /// </summary>
        [XmlElement("ext_info")]
        public string ExtInfo { get; set; }

        /// <summary>
        /// 不可用时间段(只支持到天)
        /// </summary>
        [XmlElement("forbbiden_time")]
        public ForbbidenTime ForbbidenTime { get; set; }

        /// <summary>
        /// 券过期时间
        /// </summary>
        [XmlElement("invalid_time")]
        public string InvalidTime { get; set; }

        /// <summary>
        /// 单品id中间用","分隔
        /// </summary>
        [XmlElement("sku_codes")]
        public string SkuCodes { get; set; }

        /// <summary>
        /// 可用时段条款
        /// </summary>
        [XmlArray("time_rules")]
        [XmlArrayItem("use_time")]
        public List<UseTime> TimeRules { get; set; }

        /// <summary>
        /// 券使用条件
        /// </summary>
        [XmlElement("use_condition")]
        public string UseCondition { get; set; }

        /// <summary>
        /// 全资产描述
        /// </summary>
        [XmlElement("voucher_desc")]
        public string VoucherDesc { get; set; }

        /// <summary>
        /// 券类型(ALIPAY_FIX_VOUCHER:全场券;ALIPAY_ITEM_VOUCHER:单品券,KOUBEI_BUY_EXCHANGE_VOUCHER:兑换券)
        /// </summary>
        [XmlElement("voucher_type")]
        public string VoucherType { get; set; }
    }
}


text:
package com.panshen.popupcircleview;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.widget.Toast;

import com.panshen.xps.popupcirclemenu.PopupButton;
import com.panshen.xps.popupcirclemenu.PopupCircleView;

public class MainActivity extends AppCompatActivity {
    PopupCircleView ppView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        ppView = (PopupCircleView) findViewById(R.id.pcv);
        ppView.setmOnMenuEventListener(new PopupCircleView.OnMenuEventListener() {
            @Override
            public void onMenuToggle(PopupButton popupButton) {

                switch(popupButton.getId()){
                    case R.id.pb_favorite:
                        if(popupButton.isChecked()){
                            Toast.makeText(MainActivity.this, "收藏", Toast.LENGTH_SHORT).show();
                        }else {
                            Toast.makeText(MainActivity.this, "取消收藏", Toast.LENGTH_SHORT).show();
                        }
                        break;
                    case R.id.pb_like:
                        if(popupButton.isChecked()){
                            Toast.makeText(MainActivity.this, "赞", Toast.LENGTH_SHORT).show();
                        }else {
                            Toast.makeText(MainActivity.this, "取消赞", Toast.LENGTH_SHORT).show();
                        }
                        break;
                    case R.id.pb_share:
                        Toast.makeText(MainActivity.this, "分享", Toast.LENGTH_SHORT).show();
                        break;
                }
            }
        });
    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="ProjectModuleManager">
    <modules>
      <module fileurl="file://$PROJECT_DIR$/Flax.iml" filepath="$PROJECT_DIR$/Flax.iml" />
      <module fileurl="file://$PROJECT_DIR$/flax/flax.iml" filepath="$PROJECT_DIR$/flax/flax.iml" />
      <module fileurl="file://$PROJECT_DIR$/helloflax/helloflax.iml" filepath="$PROJECT_DIR$/helloflax/helloflax.iml" />
      <module fileurl="file://$PROJECT_DIR$/navigationexample/navigationexample.iml" filepath="$PROJECT_DIR$/navigationexample/navigationexample.iml" />
      <module fileurl="file://$PROJECT_DIR$/simplenetworking/simplenetworking.iml" filepath="$PROJECT_DIR$/simplenetworking/simplenetworking.iml" />
    </modules>
  </component>
</project>


text:
<mv-control-reactive [formControl]="formControl">
  <label [attr.for]="id">{{label}}</label>
  <select [attr.id]="id"
         [attr.autofocus]="autofocus"
         [attr.disabled]="disabled"
         [attr.form]="form"
         [attr.multiple]="multiple"
         [attr.name]="name"
         [attr.required]="required"
         [attr.size]="size"
         (change)="onSelect($event)"
         (blur)="onBlur($event)">
    <ng-content></ng-content>
  </select>
  <mv-control-message>
    <ng-content select="mv-control-errors"></ng-content>
  </mv-control-message>
</mv-control-reactive>


text:
#ifndef _REBitSetTest_H
#define _REBitSetTest_H

#include "TestCase.h"

//---- REBitSetTest ----------------------------------------------------------
//!TestCases description
class REBitSetTest : public testframework::TestCase
{
public:
	//--- constructors

	//!TestCase constructor
	//! \param name name of the test
	REBitSetTest(TString tstrName);

	//!destroys the test case
	~REBitSetTest();

	//--- public api

	//!builds up a suite of testcases for this test
	static Test *suite ();

	//!test all operators
	void ManyTests();
	//!test pathological loop case in REBitSet::Set()
	void SetTo255();
	//!test Set(predicate) method
	void TestPredicateSet();

	//!test pathological loop case in REBitSet::Set()
	void GeneratePosixSet(std::ostream &cppfile, const char *name, REBitSet::Predicate predicate);
	void GeneratePosixSets();
};

#endif


text:
对其中的接触到的一些术语进行了解,并实践

##mtcars
Motor Trend Car Road Tests

###Description

The data was extracted from the 1974 Motor Trend US magazine, and comprises fuel consumption and 10 aspects of automobile design and performance for 32 automobiles (1973–74 models).

###Usage

mtcars
###Format

A data frame with 32 observations on 11 variables.

[, 1]	mpg	Miles/(US) gallon

[, 2]	cyl	Number of cylinders

[, 3]	disp	Displacement (cu.in.)

[, 4]	hp	Gross horsepower

[, 5]	drat	Rear axle ratio

[, 6]	wt	Weight (lb/1000)

[, 7]	qsec	1/4 mile time

[, 8]	vs	V/S

[, 9]	am	Transmission (0 = automatic, 1 = manual)

[,10]	gear	Number of forward gears

[,11]	carb	Number of carburetors

##attach
Attach Set of R Objects to Search Path

###Description

The database is attached to the R search path. This means that the database is searched by R when evaluating a variable, so objects in the database can be accessed by simply giving their names.

###Usage

attach(what, pos = 2L, name = deparse(substitute(what)),
       warn.conflicts = TRUE)

##plot
Generic X-Y Plotting

###Description

Generic function for plotting of R objects. For more details about the graphical parameter arguments, see par.

For simple scatter plots, plot.default will be used. However, there are plot methods for many R objects, including functions, data.frames, density objects, etc. Use methods(plot) and the documentation for these.

###Usage

plot(x, y, ...)

###type
what type of plot should be drawn. Possible types are

"p" for points,

"l" for lines,

"b" for both,

"c" for the lines part alone of "b",

"o" for both 'overplotted',

"h" for 'histogram' like (or 'high-density') vertical lines,

"s" for stair steps,

"S" for other steps, see 'Details' below,

"n" for no plotting.

##abline
Add Straight Lines to a Plot

###Description

This function adds one or more straight lines through the current plot.

###Usage

abline(a = NULL, b = NULL, h = NULL, v = NULL, reg = NULL,
       coef = NULL, untf = FALSE, ...)
###Arguments

a, b

the intercept and slope, single values.

untf
logical asking whether to untransform. See 'Details'.

h
the y-value(s) for horizontal line(s).

v
the x-value(s) for vertical line(s).

coef
a vector of length two giving the intercept and slope.

reg
an object with a coef method. See 'Details'.

...

graphical parameters such as col, lty and lwd (possibly as vectors: see 'Details') and xpd and the line characteristics lend, ljoin and lmitre.

##detach

Detach Objects from the Search Path

###Description

Detach a database, i.e., remove it from the search() path of available R objects. Usually this is either a data.frame which has been attached or a package which was attached by library.

###Usage

detach(name, pos = 2L, unload = FALSE, character.only = FALSE,
       force = FALSE)
###Arguments

name
The object to detach. Defaults to search()[pos]. This can be an unquoted name or a character string but not a character vector. If a number is supplied this is taken as pos.

pos
Index position in search() of the database to detach. When name is a number, pos = name is used.

unload
A logical value indicating whether or not to attempt to unload the namespace when a package is being detached. If the package has a namespace and unload is TRUE, then detach will attempt to unload the namespace via unloadNamespace: if the namespace is imported by another namespace or unload is FALSE, no unloading will occur.

character.only
a logical indicating whether name can be assumed to be a character string.

force
logical: should a package be detached even though other attached packages depend on it?

##lm
Fitting Linear Models

###Description

lm is used to fit linear models. It can be used to carry out regression, single stratum analysis of variance and analysis of covariance (although aov may provide a more convenient interface for these).

###Usage

lm(formula, data, subset, weights, na.action,
   method = "qr", model = TRUE, x = FALSE, y = FALSE, qr = TRUE,
   singular.ok = TRUE, contrasts = NULL, offset, ...)

#3.2一个简单例子

重点:

plot(x,y,type = "b") ###根据上面的plot资料,type="b",表示点加线。

#3.3图形参数

应用函数:
##par
Set or Query Graphical Parameters

###Description

par can be used to set or query graphical parameters. Parameters can be set by specifying them as arguments to par in tag = value form, or by passing them as a list of tagged values.

###Usage

par(..., no.readonly = FALSE)

<highlevel plot> (\dots, <tag> = <value>)
###Arguments

...
arguments in tag = value form, or a list of tagged values. The tags must come from the names of graphical parameters described in the 'Graphical Parameters' section.

no.readonly
logical; if TRUE and there are no other arguments, only parameters are returned which can be set by a subsequent par() call on the same device.

#3.1使用图形

对其中的接触到的一些术语进行了解,并实践

##mtcars
Motor Trend Car Road Tests

###Description

The data was extracted from the 1974 Motor Trend US magazine, and comprises fuel consumption and 10 aspects of automobile design and performance for 32 automobiles (1973–74 models).

###Usage

mtcars
###Format

A data frame with 32 observations on 11 variables.

[, 1]	mpg	Miles/(US) gallon

[, 2]	cyl	Number of cylinders

[, 3]	disp	Displacement (cu.in.)

[, 4]	hp	Gross horsepower

[, 5]	drat	Rear axle ratio

[, 6]	wt	Weight (lb/1000)

[, 7]	qsec	1/4 mile time

[, 8]	vs	V/S

[, 9]	am	Transmission (0 = automatic, 1 = manual)

[,10]	gear	Number of forward gears

[,11]	carb	Number of carburetors

##attach
Attach Set of R Objects to Search Path

###Description

The database is attached to the R search path. This means that the database is searched by R when evaluating a variable, so objects in the database can be accessed by simply giving their names.

###Usage

attach(what, pos = 2L, name = deparse(substitute(what)),
       warn.conflicts = TRUE)

##plot
Generic X-Y Plotting

###Description

Generic function for plotting of R objects. For more details about the graphical parameter arguments, see par.

For simple scatter plots, plot.default will be used. However, there are plot methods for many R objects, including functions, data.frames, density objects, etc. Use methods(plot) and the documentation for these.

###Usage

plot(x, y, ...)

###type
what type of plot should be drawn. Possible types are

"p" for points,

"l" for lines,

"b" for both,

"c" for the lines part alone of "b",

"o" for both 'overplotted',

"h" for 'histogram' like (or 'high-density') vertical lines,

"s" for stair steps,

"S" for other steps, see 'Details' below,

"n" for no plotting.

##abline
Add Straight Lines to a Plot

###Description

This function adds one or more straight lines through the current plot.

###Usage

abline(a = NULL, b = NULL, h = NULL, v = NULL, reg = NULL,
       coef = NULL, untf = FALSE, ...)
###Arguments

a, b

the intercept and slope, single values.

untf
logical asking whether to untransform. See 'Details'.

h
the y-value(s) for horizontal line(s).

v
the x-value(s) for vertical line(s).

coef
a vector of length two giving the intercept and slope.

reg
an object with a coef method. See 'Details'.

...

graphical parameters such as col, lty and lwd (possibly as vectors: see 'Details') and xpd and the line characteristics lend, ljoin and lmitre.

##detach

Detach Objects from the Search Path

###Description

Detach a database, i.e., remove it from the search() path of available R objects. Usually this is either a data.frame which has been attached or a package which was attached by library.

###Usage

detach(name, pos = 2L, unload = FALSE, character.only = FALSE,
       force = FALSE)
###Arguments

name
The object to detach. Defaults to search()[pos]. This can be an unquoted name or a character string but not a character vector. If a number is supplied this is taken as pos.

pos
Index position in search() of the database to detach. When name is a number, pos = name is used.

unload
A logical value indicating whether or not to attempt to unload the namespace when a package is being detached. If the package has a namespace and unload is TRUE, then detach will attempt to unload the namespace via unloadNamespace: if the namespace is imported by another namespace or unload is FALSE, no unloading will occur.

character.only
a logical indicating whether name can be assumed to be a character string.

force
logical: should a package be detached even though other attached packages depend on it?

##lm
Fitting Linear Models

###Description

lm is used to fit linear models. It can be used to carry out regression, single stratum analysis of variance and analysis of covariance (although aov may provide a more convenient interface for these).

###Usage

lm(formula, data, subset, weights, na.action,
   method = "qr", model = TRUE, x = FALSE, y = FALSE, qr = TRUE,
   singular.ok = TRUE, contrasts = NULL, offset, ...)

#3.2一个简单例子

重点:

plot(x,y,type = "b") ###根据上面的plot资料,type="b",表示点加线。

#3.3图形参数

应用函数:
##par
Set or Query Graphical Parameters

###Description

par can be used to set or query graphical parameters. Parameters can be set by specifying them as arguments to par in tag = value form, or by passing them as a list of tagged values.

###Usage

par(..., no.readonly = FALSE)

<highlevel plot> (\dots, <tag> = <value>)
###Arguments

...
arguments in tag = value form, or a list of tagged values. The tags must come from the names of graphical parameters described in the 'Graphical Parameters' section.

no.readonly
logical; if TRUE and there are no other arguments, only parameters are returned which can be set by a subsequent par() call on the same device.


text:
require 'spec_helper'
require_relative '../lib/actionkit_connector'

describe 'Connector' do
  let(:client) { ActionKitConnector::Connector.new('username', 'password', 'http://api.example.com') }

  before :each do
    @connector = ActionKitConnector::Connector.new 'username', 'password', 'url'
  end

  it 'should create auth' do
    expect(@connector.auth).to eql({username: 'username', password: 'password'})
  end

  it 'should change auth' do
    @connector.password = 'new_password'
    expect(@connector.auth).to eql({username: 'username', password: 'new_password'})
  end

  it 'should create base url' do
    expect(@connector.base_url).to eql 'url'
  end

  it 'parses action options for inclusion into AK' do
    expect(@connector.parse_action_options({ip_address: '1010', bad_result: 'foo'})).to eq({ip_address: '1010'})
  end

  it 'converts action_ fields to be included with AK' do
    expect(@connector.parse_action_options({'action_foo' => 'test', not_an_action: 'bad'})).to eq({action_foo: 'test'})
  end

  describe '#find_petition_pages' do
    before do
       stub_request(:get, "http://username:password@api.example.com/petitionpage/?_limit=10&_offset=0&name=foo-bar")
    end

    it "finds petition pages matching a given name" do
      client.find_petition_pages("foo-bar")

      expect(WebMock).to have_requested(:get, "http://username:password@api.example.com/petitionpage/?_limit=10&_offset=0&name=foo-bar")
    end
  end

  describe '#user' do
    before do
      stub_request(:get, 'http://username:password@api.example.com/user/100/')
    end

    it 'finds a user based on a given ID' do
      client.user(100)
      expect(WebMock).to have_requested(:get, 'http://username:password@api.example.com/user/100/')
    end
  end

  describe '#list_users' do
    before do
      stub_request(:get, 'http://username:password@api.example.com/user/?_limit=20&_offset=0')
      stub_request(:get, 'http://username:password@api.example.com/user/?_limit=50&_offset=100')
    end

    it 'finds a list of pages with default params' do
      client.list_users
      expect(WebMock).to have_requested(:get, 'http://username:password@api.example.com/user/?_limit=20&_offset=0')
    end

    it 'correctly changes params' do
      client.list_users 100, 50
      expect(WebMock).to have_requested(:get, 'http://username:password@api.example.com/user/?_limit=50&_offset=100')
    end
  end

  describe '#petition_page' do
    before do
      stub_request(:get, 'http://username:password@api.example.com/petitionpage/100/')
    end

    it 'finds a page based on a given ID' do
      client.petition_page(100)
      expect(WebMock).to have_requested(:get, 'http://username:password@api.example.com/petitionpage/100/')
    end
  end

  describe "#create_petition_page" do

    let(:request_body) do
      { type: 'petitionpage',
        hidden: false,
        name: 'foo-bar',
        title: 'foo bar',
        language: '/language/en',
        canonical_url: 'http://example.com/foo-bar' }.to_json
    end

    before do
       stub_request(:post, "http://username:password@api.example.com/petitionpage/").
         with(body: request_body)
    end

    it "creates a petition page" do
      client.create_petition_page("foo-bar", "foo bar", "/language/en", "http://example.com/foo-bar")
      expect(WebMock).to have_requested(:post, "http://username:password@api.example.com/petitionpage/").
        with(body: request_body)
    end
  end

  # Used for the donation validations below.
  let(:full_donation_options) {
    {
        donationpage: {
            name: 'donation',
            payment_account: 'Default Import Stub'
        },
        order: {
            amount: '1',
            card_num: '4111111111111111',
            card_code: '007',
            exp_date_month: '01',
            exp_date_year: '2016'
        },
        user: {
            email: 'eric@sumofus.org',
            country: 'United States',
        }
    }
  }

  describe '#create_donation_action' do
    let(:request_body) {
      full_donation_options.to_json
    }

    before do
      stub_request(:post, "http://username:password@api.example.com/donationpush/").
          with(body: request_body)
    end

    it 'creates a donationpush action' do
      client.create_donation_action(full_donation_options)
      expect(WebMock).to have_requested(:post, 'http://username:password@api.example.com/donationpush/').
        with(body: request_body, headers: {'Content-Type' => 'application/json; charset=UTF-8'})
    end
  end

  describe 'donation validation methods' do
    let(:expected_donationpage) {
      full_donation_options[:donationpage]
    }
    let(:expected_order) {
      full_donation_options[:order]
    }
    let(:expected_user) {
      full_donation_options[:user]
    }
    describe '#validate_donation_options' do
      it 'sends back the correct options when provided a valid hash' do
        expect(client.validate_donation_options(full_donation_options)).to eq(full_donation_options)
      end

      it 'raises when provided an incorrect set of base hash values' do
        expect { client.validate_donation_options({}) }.to raise_error(RuntimeError)
      end
    end

    describe '#validate_donationpage_options' do
      it 'sends back the correct options when provided a valid hash' do
        expect(client.validate_donationpage_options(expected_donationpage)).to eq(expected_donationpage)
      end

      it 'raises when provided an incorrect set of hash values' do
        expect { client.validate_donationpage_options({}) }.to raise_error(RuntimeError)
      end
    end

    describe '#validate_donation_user_options' do
      it 'sends back the correct options when provided a valid hash' do
        expect(client.validate_donation_user_options(expected_user)).to eq(expected_user)
      end

      it 'raises when provided an incorrect set of hash values' do
        expect { client.validate_donation_user_options({}) }.to raise_error(RuntimeError)
      end
    end

    describe '#validate_donation_order_options' do
      it 'sends back the correct options when provided a correct hash' do
        expect(client.validate_donation_order_options(expected_order)).to eq(expected_order)
      end

      it 'raises when provided an incorrect set of hash values' do
        expect { client.validate_donation_order_options({}) }.to raise_error(RuntimeError)
      end

      it 'fills in default values if they are not provided' do
        sent_values = expected_order.tap { |hash|
          hash.delete(:card_num)
          hash.delete(:card_code)
        }
        expect(client.validate_donation_order_options(sent_values)).to eq(expected_order)
      end
    end

  end

end


text:
DimensionsGroupBox::DimensionsGroupBox(QWidget *parent)
    : QGroupBox(tr("Dimensions"), parent)
{

    QGridLayout *layout = new QGridLayout;
    // Write labels and values
    QLabel *label = new QLabel("Min");
    label->setAlignment(Qt::AlignHCenter);
    layout->addWidget(label, 0, 1);
    label = new QLabel("Max");
    label->setAlignment(Qt::AlignHCenter);
    layout->addWidget(label, 0, 2);
    label = new QLabel("Delta");
    label->setAlignment(Qt::AlignHCenter);
    layout->addWidget(label, 0, 3);
    layout->addWidget(new QLabel("X"), 1, 0);
    xMin = new QLabel("");
    xMin->setAlignment(Qt::AlignRight);
    layout->addWidget(xMin, 1, 1);
    xMax = new QLabel("");
    xMax->setAlignment(Qt::AlignRight);
    layout->addWidget(xMax, 1, 2);
    xDelta = new QLabel("");
    xDelta->setAlignment(Qt::AlignRight);
    layout->addWidget(xDelta, 1, 3);
    layout->addWidget(new QLabel("Y"), 2, 0);
    yMin = new QLabel("");
    yMin->setAlignment(Qt::AlignRight);
    layout->addWidget(yMin, 2, 1);
    yMax = new QLabel("");
    yMax->setAlignment(Qt::AlignRight);
    layout->addWidget(yMax, 2, 2);
    yDelta = new QLabel("");
    yDelta->setAlignment(Qt::AlignRight);
    layout->addWidget(yDelta, 2, 3);
    layout->addWidget(new QLabel("Z"), 3, 0);
    zMin = new QLabel("");
    zMin->setAlignment(Qt::AlignRight);
    layout->addWidget(zMin, 3, 1);
    zMax = new QLabel("");
    zMax->setAlignment(Qt::AlignRight);
    layout->addWidget(zMax, 3, 2);
    zDelta = new QLabel("");
    zDelta->setAlignment(Qt::AlignRight);
    layout->addWidget(zDelta, 3, 3);
    // Write units of length
    layout->addWidget(new QLabel("mm"), 1, 4);
    layout->addWidget(new QLabel("mm"), 2, 4);
    layout->addWidget(new QLabel("mm"), 3, 4);
    layout->setColumnMinimumWidth(0, 20);
    layout->setColumnMinimumWidth(1, 50);
    layout->setColumnMinimumWidth(2, 50);
    layout->setColumnMinimumWidth(3, 50);
    setLayout(layout);
}

DimensionsGroupBox::~DimensionsGroupBox() {}

void DimensionsGroupBox::reset()
{
    // Reset x fields
    xMax->setText("");
    xMin->setText("");
    xDelta->setText("");
    // Reset y fields
    yMax->setText("");
    yMin->setText("");
    yDelta->setText("");
    // Reset z fields
    zMax->setText("");
    zMin->setText("");
    zDelta->setText("");
}

void DimensionsGroupBox::setValues(const StlFile::Stats stats)
{
    QString data;
    // Write x values contained in stats
    data.setNum(stats.max.x, 'f', 3);
    xMax->setText(data);
    data.setNum(stats.min.x, 'f', 3);
    xMin->setText(data);
    data.setNum(stats.max.x-stats.min.x, 'f', 3);
    xDelta->setText(data);
    // Write y values contained in stats
    data.setNum(stats.max.y, 'f', 3);
    yMax->setText(data);
    data.setNum(stats.min.y, 'f', 3);
    yMin->setText(data);
    data.setNum(stats.max.y-stats.min.y, 'f', 3);
    yDelta->setText(data);
    // Write z values contained in stats
    data.setNum(stats.max.z, 'f', 3);
    zMax->setText(data);
    data.setNum(stats.min.z, 'f', 3);
    zMin->setText(data);
    data.setNum(stats.max.z-stats.min.z, 'f', 3);
    zDelta->setText(data);
}


text:
var express = require('express');
var router = express.Router();
var request = require('request');
var slackBot = require('slack-bot')(process.env.URL);

router.get('/', function(req, res) {
  // Cheap security
  if (req.query.secret !== process.env.SECRET) {
    res.sendStatus(404).end();
  } else {
    res.send(204).end()
    request({
      url: 'https://status.heroku.com/api/v3/current-status',
      method: 'GET'
    }, function(error, response, body) {
      var result = JSON.parse(body);
      var color;
      var issues = [];

      if (result.status.Production === 'green' && result.status.Development === 'green') {
        color = 'good';
      } else {
        color = 'danger';

        result.issues.forEach(function(issue) {
          issues.push(issue.title);
        });
      }

      slackBot.send({
        channel: '#alerts_providers',
        username: 'Heroku',
        icon_emoji: ':heroku:',
        attachments: [{
          fallback: 'Heroku Status',
          color: color,
          title: 'Heroku Status',
          title_link: 'https://status.heroku.com/',
          fields: [{
            title: 'Production',
            value: result.status.Production === 'green' ? 'Operational' : 'Experiencing issues',
            short: 'true'
          }, {
            title: 'Issues',
            value: issues && issues.length ? issues.join(', ') : 'No issues',
            short: 'true'
          }, {
            title: 'Development',
            value: result.status.Development === 'green' ? 'Operational' : 'Experiencing issues',
            short: 'true'
          }]
        }]
      });
    });
  }
});

module.exports = router;


text:
package org.wso2.siddhi.core.executor.function;

import org.wso2.siddhi.core.config.ExecutionPlanContext;
import org.wso2.siddhi.core.event.ComplexEvent;
import org.wso2.siddhi.core.exception.ExecutionPlanCreationException;
import org.wso2.siddhi.core.executor.ConstantExpressionExecutor;
import org.wso2.siddhi.core.executor.ExpressionExecutor;
import org.wso2.siddhi.query.api.definition.Attribute;

import java.util.Arrays;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class IsMatchFunctionExecutor extends FunctionExecutor {

    private Pattern pattern;
    private ExpressionExecutor expressionExecutor;

    @Override
    public void init(ExpressionExecutor[] attributeExpressionExecutors, ExecutionPlanContext executionPlanContext) {
        if (attributeExpressionExecutors.length != 2) {
            throw new ExecutionPlanCreationException("IsMatch has to have 2 expressions regex and the attribute, " +
                    "currently " + attributeExpressionExecutors.length + " expressions provided");
        }
        ExpressionExecutor regexExecutor = attributeExpressionExecutors[0];
        if (regexExecutor.getReturnType() != Attribute.Type.STRING &&
                regexExecutor instanceof ConstantExpressionExecutor) {
            throw new ExecutionPlanCreationException("IsMatch expects regex string input expression but found " +
                    regexExecutor.getReturnType());
        }
        expressionExecutor = attributeExpressionExecutors[1];
        pattern = Pattern.compile((String) regexExecutor.execute(null));

    }

    @Override
    public Attribute.Type getReturnType() {
        return Attribute.Type.BOOL;
    }

    /**
     * The main executions method which will be called upon event arrival
     *
     * @param data the runtime values of the attributeExpressionExecutors
     * @return
     */
    @Override
    protected Object execute(Object[] data) {
        throw new IllegalStateException("isMatch cannot execute two data " + Arrays.deepToString(data));
    }

    @Override
    protected Object execute(Object data) {
        Matcher matcher = pattern.matcher(data.toString());
        return matcher.matches();
    }

    @Override
    public Object execute(ComplexEvent event) {
        return execute(expressionExecutor.execute(event));
    }

    @Override
    public void start() {
        //Nothing to start
    }

    @Override
    public void stop() {
        //nothing to stop
    }

    @Override
    public Object[] currentState() {
        //No states
        return null;
    }

    @Override
    public void restoreState(Object[] state) {
        //Nothing to be done
    }
}


text:
package org.jboss.pnc.rest.provider;

import org.jboss.pnc.dto.response.ErrorResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.ejb.EJBAccessException;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.ext.ExceptionMapper;
import javax.ws.rs.ext.Provider;

import static javax.ws.rs.core.Response.Status.FORBIDDEN;

@Provider
public class UnauthorizedExceptionMapper implements ExceptionMapper<EJBAccessException> {
    private static final Logger log = LoggerFactory.getLogger(UnauthorizedExceptionMapper.class);

    @Override
    public Response toResponse(EJBAccessException exception) {
        log.info("A user is trying to access restricted resource", exception);

        Response.ResponseBuilder builder = Response.status(FORBIDDEN);
        builder.entity(new ErrorResponse(exception)).type(MediaType.APPLICATION_JSON);

        return builder.build();
    }
}


text:
interface ISettings {
    navigatorEnabled?: boolean;
    pagingEnabled?: boolean;
    leftPanelOpen?: boolean;
    rightPanelOpen?: boolean;
    preserveViewport?: boolean;
    clickToZoomEnabled?: boolean;
}