text:
/////////////////////////////////////////////////////////////////////////////
// Name:        dynamicsash.h
// Purpose:     A window which can be dynamically split to an arbitrary depth
//              and later reunified through the user interface
// Author:      Matt Kimball
// Modified by:
// Created:     7/15/2001
// RCS-ID:      $Id: dynamicsash.h,v 1.11 2005/03/24 10:27:23 VZ Exp $
// Copyright:   (c) 2001 Matt Kimball
// Licence:     wxWindows licence
/////////////////////////////////////////////////////////////////////////////

#ifndef _WX_DYNAMICSASH_H_
#define _WX_DYNAMICSASH_H_

#include "wx/gizmos/gizmos.h"

/*

    wxDynamicSashWindow

    wxDynamicSashWindow widgets manages the way other widgets are viewed.
    When a wxDynamicSashWindow is first shown, it will contain one child
    view, a viewport for that child, and a pair of scrollbars to allow the
    user to navigate the child view area.  Next to each scrollbar is a small
    tab.  By clicking on either tab and dragging to the appropriate spot, a
    user can split the view area into two smaller views separated by a
    draggable sash.  Later, when the user wishes to reunify the two subviews,
    the user simply drags the sash to the side of the window.
    wxDynamicSashWindow will automatically reparent the appropriate child
    view back up the window hierarchy, and the wxDynamicSashWindow will have
    only one child view once again.

    As an application developer, you will simply create a wxDynamicSashWindow
    using either the Create() function or the more complex constructor
    provided below, and then create a view window whose parent is the
    wxDynamicSashWindow.  The child should respond to
    wxDynamicSashSplitEvents -- perhaps with an OnSplit() event handler -- by
    constructing a new view window whose parent is also the
    wxDynamicSashWindow.  That's it!  Now your users can dynamically split
    and reunify the view you provided.

    If you wish to handle the scrollbar events for your view, rather than
    allowing wxDynamicSashWindow to do it for you, things are a bit more
    complex.  (You might want to handle scrollbar events yourself, if,
    for instance, you wish to scroll a subwindow of the view you add to
    your wxDynamicSashWindow object, rather than scrolling the whole view.)
    In this case, you will need to construct your wxDynamicSashWindow without
    the wxDS_MANAGE_SCROLLBARS style and  you will need to use the
    GetHScrollBar() and GetVScrollBar() methods to retrieve the scrollbar
    controls and call SetEventHanler() on them to redirect the scrolling
    events whenever your window is reparented by wxDyanmicSashWindow.
    You will need to set the scrollbars' event handler at three times:

        *  When your view is created
        *  When your view receives a wxDynamicSashSplitEvent
        *  When your view receives a wxDynamicSashUnifyEvent

    See the dynsash_switch sample application for an example which does this.

*/

#include "wx/event.h"
#include "wx/window.h"

class WXDLLIMPEXP_CORE wxScrollBar;

// ----------------------------------------------------------------------------
// dynamic sash styles
// ----------------------------------------------------------------------------

/*
    wxDS_MANAGE_SCROLLBARS is a default style of wxDynamicSashWindow which
    will cause it to respond to scrollbar events for your application by
    automatically scrolling the child view.
*/
#define wxDS_MANAGE_SCROLLBARS  0x0010

/*
  wxDS_DRAG_CORNER style indicates that the views can also be resized by
  dragging the corner piece between the scrollbars, and which is reflected up
  to the frame if necessary.
*/
#define wxDS_DRAG_CORNER        0x0020

/*
    Default style for wxDynamicSashWindow.
 */
#define wxDS_DEFAULT            wxDS_MANAGE_SCROLLBARS | wxDS_DRAG_CORNER

// ----------------------------------------------------------------------------
// dynamic sash events
// ----------------------------------------------------------------------------

extern WXDLLIMPEXP_GIZMOS const wxEventType wxEVT_DYNAMIC_SASH_SPLIT;
extern WXDLLIMPEXP_GIZMOS const wxEventType wxEVT_DYNAMIC_SASH_UNIFY;

#define EVT_DYNAMIC_SASH_SPLIT(id, func) \
    wx__DECLARE_EVT1(wxEVT_DYNAMIC_SASH_SPLIT, id, \
                        wxDynamicSashSplitEventHandler(func))

#define EVT_DYNAMIC_SASH_UNIFY(id, func) \
    wx__DECLARE_EVT1(wxEVT_DYNAMIC_SASH_UNIFY, id, \
                        wxDynamicSashUnifyEventHandler(func))

/*
    wxDynamicSashSplitEvents are sent to your view by wxDynamicSashWindow
    whenever your view is being split by the user.  It is your
    responsibility to handle this event by creating a new view window as
    a child of the wxDynamicSashWindow.  wxDynamicSashWindow will
    automatically reparent it to the proper place in its window hierarchy.
*/
class WXDLLIMPEXP_GIZMOS wxDynamicSashSplitEvent : public wxCommandEvent
{
public:
    wxDynamicSashSplitEvent();
    wxDynamicSashSplitEvent(const wxDynamicSashSplitEvent& event)
        : wxCommandEvent(event) { }
    wxDynamicSashSplitEvent(wxObject *target);

    virtual wxEvent* Clone() const { return new wxDynamicSashSplitEvent(*this); }

private:
    DECLARE_DYNAMIC_CLASS(wxDynamicSashSplitEvent)
};

/*
    wxDynamicSashUnifyEvents are sent to your view by wxDynamicSashWindow
    whenever the sash which splits your view and its sibling is being
    reunified such that your view is expanding to replace its sibling.
    You needn't do anything with this event if you are allowing
    wxDynamicSashWindow to manage your view's scrollbars, but it is useful
    if you are managing the scrollbars yourself so that you can keep
    the scrollbars' event handlers connected to your view's event handler
    class.
*/
class WXDLLIMPEXP_GIZMOS wxDynamicSashUnifyEvent : public wxCommandEvent
{
public:
    wxDynamicSashUnifyEvent();
    wxDynamicSashUnifyEvent(const wxDynamicSashUnifyEvent& event): wxCommandEvent(event) {}
    wxDynamicSashUnifyEvent(wxObject *target);

    virtual wxEvent* Clone() const { return new wxDynamicSashUnifyEvent(*this); }

private:
    DECLARE_DYNAMIC_CLASS(wxDynamicSashUnifyEvent)
};

typedef void (wxEvtHandler::*wxDynamicSashSplitEventFunction)(wxDynamicSashSplitEvent&);
typedef void (wxEvtHandler::*wxDynamicSashUnifyEventFunction)(wxDynamicSashUnifyEvent&);

#define wxDynamicSashSplitEventHandler(func) \
    (wxObjectEventFunction)(wxEventFunction) \
        wxStaticCastEvent(wxDynamicSashSplitEventFunction, &func)

#define wxDynamicSashUnifyEventHandler(func) \
    (wxObjectEventFunction)(wxEventFunction) \
        wxStaticCastEvent(wxDynamicSashUnifyEventFunction, &func)

#define wx__DECLARE_TREEEVT(evt, id, fn) \
    wx__DECLARE_EVT1(wxEVT_COMMAND_TREE_ ## evt, id, wxTreeEventHandler(fn))

// ----------------------------------------------------------------------------
// wxDynamicSashWindow itself
// ----------------------------------------------------------------------------

WXDLLIMPEXP_GIZMOS extern const wxChar* wxDynamicSashWindowNameStr;

class WXDLLIMPEXP_GIZMOS wxDynamicSashWindow : public wxWindow
{
public:
    wxDynamicSashWindow();
    wxDynamicSashWindow(wxWindow *parent, wxWindowID id,
                        const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
                        long style = wxDS_DEFAULT,
                        const wxString& name = wxDynamicSashWindowNameStr);
    virtual ~wxDynamicSashWindow();

    virtual bool Create(wxWindow *parent, wxWindowID id,
                        const wxPoint& pos = wxDefaultPosition,
                        const wxSize& size = wxDefaultSize,
                        long style = wxDS_DEFAULT,
                        const wxString& name = wxDynamicSashWindowNameStr);
    virtual wxScrollBar *GetHScrollBar(const wxWindow *child) const;
    virtual wxScrollBar *GetVScrollBar(const wxWindow *child) const;

    /*  This is overloaded from wxWindowBase.  It's not here for you to
        call directly.  */
    virtual void AddChild(wxWindowBase *child);

private:
    class wxDynamicSashWindowImpl *m_impl;

    DECLARE_DYNAMIC_CLASS(wxDynamicSashWindow)
};

#endif // _WX_DYNAMICSASH_H_


text:
<template name="tastingItem">

{{bottle}}, {{spirit}}

{{teaserContent}}

Hosted by {{host}} on {{whenFormatted}} at {{where}}

      {{#if ratingsNum}}

        Average rating

      {{/if}}

{{commentsText}}, {{ratingsText}}

      {{#if isOwner}}

Edit Tasting

      {{/if}}

</template>

redpajama_set_name: RedPajamaGithub


text:
package org.apache.coyote.http2;

import java.nio.ByteBuffer;

import org.junit.Assert;
import org.junit.Test;

/*
 * Implement here rather than jakarta.servlet.http.TestHttpServlet because it
 * needs access to package private classes.
 */
public class TestHttpServlet extends Http2TestBase {

    @Test
    public void testUnimplementedMethodHttp2() throws Exception {
        http2Connect();

        // Build a POST request for a Servlet that does not implement POST
        byte[] headersFrameHeader = new byte[9];
        ByteBuffer headersPayload = ByteBuffer.allocate(128);
        byte[] dataFrameHeader = new byte[9];
        ByteBuffer dataPayload = ByteBuffer.allocate(0);

        buildPostRequest(headersFrameHeader, headersPayload, false, null, -1, "/empty", dataFrameHeader, dataPayload,
                null, null, null, 3);

        // Write the headers
        writeFrame(headersFrameHeader, headersPayload);
        // Body
        writeFrame(dataFrameHeader, dataPayload);

        parser.readFrame();
        parser.readFrame();

        String trace = output.getTrace();
        String[] lines = trace.split("\n");

        // Check the response code
        Assert.assertEquals("3-HeadersStart", lines[0]);
        Assert.assertEquals("3-Header-[:status]-[405]", lines[1]);
    }

}


text:
//Write a program that prints an isosceles triangle of 9 copyright symbols ©, something like this:
  //   ©

 //   © ©

//   ©   ©

//  © © © ©
//Note: The © symbol may be displayed incorrectly at the console so you may need to change the console character encoding to UTF-8 and
//assign a Unicode-friendly font in the console.
//Note: Under old versions of Windows the © symbol may still be displayed incorrectly, regardless of how much effort you put to fix it.

using System;

class Program
{
    static void Main()
    {
        char ch = '©';
        int length = 3;

        Console.OutputEncoding = System.Text.Encoding.Unicode;

        Console.Write(new string(' ',length));
        Console.WriteLine(ch);
        for (int i = 1; i <= 3; i++)
        {
            if (i == 3)
            {
                Console.WriteLine("{0} {0} {0} {0}", ch);
            }
            else
                       Console.WriteLine(new string(' ',length-i) + ch + new string(' ',i+(i-1)) + ch);
        }
        Console.WriteLine();

    }
}


text:
class SparkEffect : public EffectParticleType
{
public:
    SparkEffect();
    virtual ~SparkEffect();

    virtual void	CreateEffect(const Vec2& createPos);
    virtual void	ExtinctEffect();

};


text:
(function () {
    'use strict';

    angular.module('home.page.module').factory('homeService', HomeService)

    HomeService.$inject = [];

    function HomeService() {

    }

})();


text:
package org.apache.solr.prometheus.exporter;

import io.prometheus.client.Collector;
import java.util.List;
import org.apache.solr.prometheus.collector.SchedulerMetricsCollector;

public class CachedPrometheusCollector extends Collector
    implements SchedulerMetricsCollector.Observer {

  private volatile List<MetricFamilySamples> samples;

  @Override
  public List<MetricFamilySamples> collect() {
    return samples;
  }

  @Override
  public void metricsUpdated(List<MetricFamilySamples> samples) {
    this.samples = samples;
  }
}


text:
<component name="ProjectRunConfigurationManager">
  <configuration default="false" name="Sphinx" type="docs" factoryName="Sphinx task">
    <option name="INTERPRETER_OPTIONS" value="" />
    <option name="PARENT_ENVS" value="true" />
    <envs />
    <option name="SDK_HOME" value="$USER_HOME$/anaconda/bin/python" />
    <option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/scrapenhl2" />
    <option name="IS_MODULE_SDK" value="false" />
    <option name="ADD_CONTENT_ROOTS" value="true" />
    <option name="ADD_SOURCE_ROOTS" value="true" />
    <module name="scrapenhl2" />
    <option name="docutils_input_file" value="$PROJECT_DIR$/docs/source/" />
    <option name="docutils_output_file" value="$PROJECT_DIR$/docs/build/" />
    <option name="docutils_params" value="" />
    <option name="docutils_task" value="html" />
    <option name="docutils_open_in_browser" value="false" />
    <method />
  </configuration>
</component>


text:
from .mathematicaYacc import mathematicaParser
from .mathematicaLex import mathematicaLexer
from .calchasPreprocessing import calchasToSympy, getStdTree
from .latexPreprocessing import isLatex
from .latexYacc import latexToCalchas
from .sympyTreeBuilder import SympyTreeBuilder
from .calchasTreeLambdafier import CalchasTreeLambdafier
from .calchasTreeLambdaHoister import CalchasTreeLambdaHoister

class Parser:
    def __init__(self, expr):
        self.expr = expr

    def fromCalchas(self):
        result = calchasToSympy('(%s)' % self.expr)
        if result:
            self.expr = result

    def fromMathematica(self):
        result = mathematicaParser.parse('(%s)' % self.expr, lexer=mathematicaLexer)
        if result:
            self.expr = result.toCalchas()

    def fromLatex(self):
        if isLatex(self.expr):
            result = latexToCalchas('(%s)' % self.expr)
            if result:
                self.expr = result

    def normalize(self, debug=False):
        #debug=True
        if debug:
            print("init              : ", end="")
            print(self.expr)
        self.fromLatex()
        if debug:
            print("after Latex       : ", end="")
            print(self.expr)
        self.fromMathematica()
        if debug:
            print("after Mathematica : ", end="")
            print(self.expr)
        #self.fromCalchas()
        tree = getStdTree(self.expr)
        if debug:
            print("final > type      : ", end="")
            print(type(tree))
            print("      > content   : ", end="")
            print(tree)
            print("")
        if tree is None:
            return 'simplify(%s,2)' % self.expr
        lambdafier = CalchasTreeLambdafier()
        tree = lambdafier.visitCalchasTree(tree, debug=debug)
        if debug:
            print("~diff > type      : ", end="")
            print(type(tree))
            print("      > content   : ", end="")
            print(tree)
            print("")
        transformer = CalchasTreeLambdaHoister()
        tree = transformer.replaceImplicitDiff(tree, debug=debug)
        if debug:
            print("~diff > type      : ", end="")
            print(type(tree))
            print("      > content   : ", end="")
            print(tree)
            print("")
        builder = SympyTreeBuilder()
        c = builder.toSympyTree(tree, debug=debug)
        return c


text:
test git usage
you can do anything inside!
then you're free to go!
finally you're on top of the world!
surprisingly I add the line!


text: var hi = function arguments() { };


text:
# express-winston-2
[![Build Status](https://secure.travis-ci.org/nballaney/express-winston-2.png)](http://travis-ci.org/nballaney/express-winston-2)

> [winston](https://github.com/flatiron/winston) middleware for express.js

## Installation

    npm install express-winston-2

## Usage

express-winston-2 provides middleware for request and error logging of your express.js application.  It uses 'whitelists' to select properties from the request and (new in 0.2.x) response objects.

To make use of express-winston-2, you need to add the following to your application:

In `server.js` (or wherever you need it):

```
var winston = require('winston'),
    expressWinston = require('express-winston-2');
```

### Logging errors to a file

- Logs all responses to the console
- Logs errors to 'errors.log'. In this case, we classify any response with a status code greater than 400 as an error.

``` js
function getWinstonConfig() {
    return expressWinston.logger({
        transports: [
            new (winston.transports.Console)(),
            new (winston.transports.File)({
                filename: './errors.log',
                // File will only record errors
                level: 'error'
            })
        ],
        getLogLevel: function(statusCode) {
            if(statusCode >= 400) {
                return "error"
            }
            return "info";
        }
    });
}

```

The logger needs to be added AFTER the express router(`app.router)`) and BEFORE any of your custom error handlers(`express.handler`). Since express-winston-2 will just log the errors and not __handle__ them, you can still use your custom error handler like `express.handler`, just be sure to put the logger before any of your handlers.

### Options

``` js
    transports: [<WinstonTransport>], // list of all winston transports instances to use.
    winstonInstance: <WinstonLogger>, // a winston logger instance. If this is provided the transports option is ignored
    level: String, // log level to use (info/warn/error). The default is "info".
    getLogLevel: Function // Takes in the response status code as its only parameter and returns (info/warn/error) which then becomes the new 'level'.
    skip: function(req, res) // function to determine if logging is skipped, defaults to false
```

To use winston's existing transports, set `transports` to the values (as in key-value) of the `winston.default.transports` object. This may be done, for example, by using underscorejs: `transports: _.values(winston.default.transports)`.

Alternatively, if you're using a winston logger instance elsewhere and have already set up levels and transports, pass the instance into expressWinston with the `winstonInstance` option. The `transports` option is then ignored.

### Request Logging

Use `expressWinston.logger(options)` to create a middleware to log your HTTP requests.

``` js
    var router = require('./my-express-router');

    app.use(expressWinston.logger({
      transports: [
        new winston.transports.Console({
          json: true,
          colorize: true
        })
      ],
      meta: true, // optional: control whether you want to log the meta data about the request (default to true)
      msg: "HTTP {{req.method}} {{req.url}}", // optional: customize the default logging message. E.g. "{{res.statusCode}} {{req.method}} {{res.responseTime}}ms {{req.url}}"
      expressFormat: true, // Use the default Express/morgan request formatting, with the same colors. Enabling this will override any msg and colorStatus if true. Will only output colors on transports with colorize set to true
      colorStatus: true, // Color the status code, using the Express/morgan color palette (default green, 3XX cyan, 4XX yellow, 5XX red). Will not be recognized if expressFormat is true
      ignoreRoute: function (req, res) { return false; } // optional: allows to skip some log messages based on request and/or response
    }));

    app.use(router); // notice how the router goes after the logger.
```

## Examples

``` js
    var express = require('express');
    var expressWinston = require('express-winston-2');
    var winston = require('winston'); // for transports.Console
    var app = module.exports = express();

    app.use(express.bodyParser());
    app.use(express.methodOverride());

    // Let's make our express `Router` first.
    var router = express.Router();
    router.get('/error', function(req, res, next) {
      // here we cause an error in the pipeline so we see express-winston-2 in action.
      return next(new Error("This is an error and it should be logged to the console"));
    });

    app.get('/', function(req, res, next) {
      res.write('This is a normal request, it should be logged to the console too');
      res.end();
    });

    // express-winston-2 logger makes sense BEFORE the router.
    app.use(expressWinston.logger({
      transports: [
        new winston.transports.Console({
          json: true,
          colorize: true
        })
      ]
    }));

    // Now we can tell the app to use our routing code:
    app.use(router);

    // express-winston-2 errorLogger makes sense AFTER the router.
    app.use(expressWinston.errorLogger({
      transports: [
        new winston.transports.Console({
          json: true,
          colorize: true
        })
      ]
    }));

    // Optionally you can include your custom error handler after the logging.
    app.use(express.errorLogger({
      dumpExceptions: true,
      showStack: true
    }));

    app.listen(3000, function(){
      console.log("express-winston-2 demo listening on port %d in %s mode", this.address().port, app.settings.env);
    });
```

Browse `/` to see a regular HTTP logging like this:

    {
      "req": {
        "httpVersion": "1.1",
        "headers": {
          "host": "localhost:3000",
          "connection": "keep-alive",
          "accept": "*/*",
          "user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/536.11 (KHTML, like Gecko) Chrome/20.0.1132.57 Safari/536.11",
          "accept-encoding": "gzip,deflate,sdch",
          "accept-language": "en-US,en;q=0.8,es-419;q=0.6,es;q=0.4",
          "accept-charset": "ISO-8859-1,utf-8;q=0.7,*;q=0.3",
          "cookie": "connect.sid=nGspCCSzH1qxwNTWYAoexI23.seE%2B6Whmcwd"
        },
        "url": "/",
        "method": "GET",
        "originalUrl": "/",
        "query": {}
      },
      "res": {
        "statusCode": 200
      },
      "responseTime" : 12,
      "level": "info",
      "message": "HTTP GET /favicon.ico"
    }

Browse `/error` will show you how express-winston-2 handles and logs the errors in the express pipeline like this:

    {
      "date": "Thu Jul 19 2012 23:39:44 GMT-0500 (COT)",
      "process": {
        "pid": 35719,
        "uid": 501,
        "gid": 20,
        "cwd": "/Users/thepumpkin/Projects/testExpressWinston",
        "execPath": "/usr/local/bin/node",
        "version": "v0.6.18",
        "argv": [
          "node",
          "/Users/thepumpkin/Projects/testExpressWinston/app.js"
        ],
        "memoryUsage": {
          "rss": 14749696,
          "heapTotal": 7033664,
          "heapUsed": 5213280
        }
      },
      "os": {
        "loadavg": [
          1.95068359375,
          1.5166015625,
          1.38671875
        ],
        "uptime": 498086
      },
      "trace": [
        ...,
        {
          "column": 3,
          "file": "Object].log (/Users/thepumpkin/Projects/testExpressWinston/node_modules/winston/lib/winston/transports/console.js",
          "function": "[object",
          "line": 87,
          "method": null,
          "native": false
        }
      ],
      "stack": [
        "Error: This is an error and it should be logged to the console",
        "    at /Users/thepumpkin/Projects/testExpressWinston/app.js:39:15",
        "    at callbacks (/Users/thepumpkin/Projects/testExpressWinston/node_modules/express/lib/router/index.js:272:11)",
        "    at param (/Users/thepumpkin/Projects/testExpressWinston/node_modules/express/lib/router/index.js:246:11)",
        "    at pass (/Users/thepumpkin/Projects/testExpressWinston/node_modules/express/lib/router/index.js:253:5)",
        "    at Router._dispatch (/Users/thepumpkin/Projects/testExpressWinston/node_modules/express/lib/router/index.js:280:4)",
        "    at Object.handle (/Users/thepumpkin/Projects/testExpressWinston/node_modules/express/lib/router/index.js:45:10)",
        "    at next (/Users/thepumpkin/Projects/testExpressWinston/node_modules/express/node_modules/connect/lib/http.js:204:15)",
        "    at done (/Users/thepumpkin/Dropbox/Projects/express-winston-2/index.js:91:14)",
        "    at /Users/thepumpkin/Dropbox/Projects/express-winston-2/node_modules/async/lib/async.js:94:25",
        "    at [object Object].log (/Users/thepumpkin/Projects/testExpressWinston/node_modules/winston/lib/winston/transports/console.js:87:3)"
      ],
      "req": {
        "httpVersion": "1.1",
        "headers": {
          "host": "localhost:3000",
          "connection": "keep-alive",
          "cache-control": "max-age=0",
          "user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/536.11 (KHTML, like Gecko) Chrome/20.0.1132.57 Safari/536.11",
          "accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
          "accept-encoding": "gzip,deflate,sdch",
          "accept-language": "en-US,en;q=0.8,es-419;q=0.6,es;q=0.4",
          "accept-charset": "ISO-8859-1,utf-8;q=0.7,*;q=0.3",
          "cookie": "connect.sid=nGspCCSzH1qxwNTWYAoexI23.seE%2B6WhmcwdzFEjqhMDuIIl3mAUY7dT4vn%2BkWvRPhZc"
        },
        "url": "/error",
        "method": "GET",
        "originalUrl": "/error",
        "query": {}
      },
      "level": "error",
      "message": "middlewareError"
    }

## Global Whitelists and Blacklists

Express-winston exposes three whitelists that control which properties of the `request`, `body`, and `response` are logged:

* `requestWhitelist`
* `bodyWhitelist`, `bodyBlacklist`
* `responseWhitelist`

For example, `requestWhitelist` defaults to:

    ['url', 'headers', 'method', 'httpVersion', 'originalUrl', 'query'];

Only those properties of the request object will be logged. Set or modify the whitelist as necessary.

For example, to include the session property (the session data), add the following during logger setup:

    expressWinston.requestWhitelist.push('session');

The blacklisting excludes certain properties and keeps all others. If both `bodyWhitelist` and `bodyBlacklist` are set
the properties excluded by the blacklist are not included even if they are listed in the whitelist!

Example:

    expressWinston.bodyBlacklist.push('secretid', 'secretproperty');

Note that you can log the whole request and/or response body:

    expressWinston.requestWhitelist.push('body');
    expressWinston.responseWhitelist.push('body');

## Route-Specific Whitelists and Blacklists

New in version 0.2.x is the ability to add whitelist elements in a route.  express-winston-2 adds a `_routeWhitelists` object to the `req`uest, containing `.body`, `.req` and .res` properties, to which you can set an array of 'whitelist' parameters to include in the log, specific to the route in question:

``` js
    router.post('/user/register', function(req, res, next) {
      req._routeWhitelists.body = ['username', 'email', 'age']; // But not 'password' or 'confirm-password' or 'top-secret'
      req._routeWhitelists.res = ['_headers'];
    });
```

Post to `/user/register` would give you something like the following:

    {
      "req": {
        "httpVersion": "1.1",
        "headers": {
          "host": "localhost:3000",
          "connection": "keep-alive",
          "accept": "*/*",
          "user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/536.11 (KHTML, like Gecko) Chrome/20.0.1132.57 Safari/536.11",
          "accept-encoding": "gzip,deflate,sdch",
          "accept-language": "en-US,en;q=0.8,es-419;q=0.6,es;q=0.4",
          "accept-charset": "ISO-8859-1,utf-8;q=0.7,*;q=0.3",
          "cookie": "connect.sid=nGspCCSzH1qxwNTWYAoexI23.seE%2B6Whmcwd"
        },
        "url": "/",
        "method": "GET",
        "originalUrl": "/",
        "query": {},
        "body": {
          "username": "foo",
          "email": "foo@bar.com",
          "age": "72"
        }
      },
      "res": {
        "statusCode": 200
      },
      "responseTime" : 12,
      "level": "info",
      "message": "HTTP GET /favicon.ico"
    }

Blacklisting supports only the `body` property.

``` js
    router.post('/user/register', function(req, res, next) {
      req._routeWhitelists.body = ['username', 'email', 'age']; // But not 'password' or 'confirm-password' or 'top-secret'
      req._routeBlacklists.body = ['username', 'password', 'confirm-password', 'top-secret'];
      req._routeWhitelists.res = ['_headers'];
    });
```

If both `req._bodyWhitelist.body` and `req._bodyBlacklist.body` are set the result will be the white listed properties
excluding any black listed ones. In the above example, only 'email' and 'age' would be included.

## Tests

Run the basic Mocha tests:

    npm test

Run the Travis-CI tests (which will fail with < 100% coverage):

    npm test-travis

Generate the `coverage.html` coverage report:

    npm test-coverage

## Issues and Collaboration

If you ran into any problems, please use the project [Issues section](https://github.com/nballaney/express-winston-2/issues) to search or post any bug.

## Contributors

* [Johan Hernandez](https://github.com/bithavoc) (https://github.com/bithavoc)
* [Lars Jacob](https://github.com/jaclar) (https://github.com/jaclar)
* [Jonathan Lomas](https://github.com/floatingLomas) (https://github.com/floatingLomas)

Also see AUTHORS file, add yourself if you are missing.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.


text:
<?php
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly

/**
 * WooDojo Widget Preview Mode Class
 *
 * All functionality pertaining to the widget preview mode downloadable component.
 *
 * @package WordPress
 * @subpackage WooDojo
 * @category Downloadables
 * @author Matty
 * @since 1.0.0
 *
 * TABLE OF CONTENTS
 *
 * var $capability
 *
 * - __construct()
 * - control_widget_access()
 * - save_widget_form()
 * - widget_form_html()
 */
class WooDojo_Widget_Preview {
	var $capability;

	/**
	 * Constructor.
	 * @since 1.0.0
	 * @return void
	 */
 	public function __construct () {
 		$this->capability = 'manage_options';
 		if ( is_admin() ) {
	 		add_filter( 'widget_update_callback', array( &$this, 'save_widget_form' ), 10, 2 );
	 		add_action( 'in_widget_form', array( &$this, 'widget_form_html' ), 10, 3 );
 		} else {
 			add_filter( 'widget_display_callback', array( &$this, 'control_widget_access' ), 10, 3 );
 		}
 	} // End __construct()

 	/**
 	 * Control the display of a widget.
 	 * @param  {array} $instance the settings for the widget
 	 * @param  {object} $obj    the widget instance object
 	 * @param  {array} $args     arguments
 	 * @since 1.0.0
 	 * @return {array}           the instance
 	 */
 	public function control_widget_access ( $instance, $obj, $args ) {
 		if ( isset( $instance['widget_preview_mode'] ) && ( $instance['widget_preview_mode'] == true ) && ( ! current_user_can( $this->capability ) ) ) {
 			return false;
 		}

 		return $instance;
 	} // End control_widget_access()

 	/**
 	 * Save the data from our custom form fields.
 	 * @param  array $instance array of settings for this widget
 	 * @param  array $new_instance array of settings for this widget
 	 * @param  array $old_instance array of settings for this widget
 	 * @param  object $obj      the instance of the widget
 	 * @since 1.0.0
 	 * @return array           array of settings for this widget
 	 */
 	public function save_widget_form ( $instance, $new_instance, $old_instance, $obj ) {
 		if ( isset( $new_instance['widget_preview_mode'] ) ) {
 			$instance['widget_preview_mode'] = $new_instance['widget_preview_mode'];
 		} else {
 			$instance['widget_preview_mode'] = false;
 		}
 		return $instance;
 	} // End save_widget_form()

 	/**
 	 * Output a checkbox on the widget control form.
 	 * @param  object $obj      the instance of the widget
 	 * @param  boolean $return   the return for the widget
 	 * @param  array $instance an array of settings for this widget
 	 * @since 1.0.0
 	 * @return void
 	 */
 	public function widget_form_html ( $obj, $return, $instance ) {
 		global $return;

 		if ( ! isset( $instance['widget_preview_mode'] ) ) {
 			$instance['widget_preview_mode'] = false;
 		}
?>

	<input id="<?php echo $obj->get_field_id( 'widget_preview_mode' ); ?>" name="<?php echo $obj->get_field_name( 'widget_preview_mode' ); ?>" type="checkbox"<?php checked( $instance['widget_preview_mode'], 1 ); ?> value="1" />
	<label for="<?php echo $obj->get_field_id( 'widget_preview_mode' ); ?>"><?php _e( 'Preview Mode', 'woodojo' ); ?>

<?php
 		$return = null;
 	} // End widget_form_html()
 } // End Class
?>


text:
module Admin::Resources::DataTypes::BelongsToHelper

  def typus_belongs_to_field(attribute, form)
    association = @resource.reflect_on_association(attribute.to_sym)

    related = if defined?(set_belongs_to_context)
      set_belongs_to_context.send(attribute.pluralize.to_sym)
    else
      association.class_name.constantize
    end

    related_fk = association.foreign_key
    label_text = @resource.human_attribute_name(attribute)

    values = if related.respond_to?(:roots) && related.respond_to?(:ancestry_column)
      expand_tree_into_select_field(related.roots, related_fk)
    else
      related.order(related.typus_order_by).map { |p| [p.to_label, p.id] }
    end

    attribute_id = "#{@resource.name.underscore}_#{attribute}_id".gsub('/', '_')

    locals = {
      attribute: attribute,
      attribute_id: attribute_id,
      form: form,
      related_fk: related_fk,
      related: related,
      label_text: label_text.html_safe,
      values: values,
      html_options: { class: 'form-control' },
      options: { include_blank: true, attribute: "#{@resource.name.underscore}_#{related_fk}" }
    }

    render 'admin/templates/belongs_to', locals
  end

  def table_belongs_to_field(attribute, item)
    if att_value = item.send(attribute)
      action = item.send(attribute).class.typus_options_for(:default_action_on_item)
      message = att_value.to_label
      if !params[:_popup] && admin_user.can?(action, att_value.class.name)
        message = link_to(message, controller: "/admin/#{att_value.class.to_resource}", action: action, id: att_value.id)
      end
    end

    message || mdash
  end

  def display_belongs_to(item, attribute)
    data = item.send(attribute)

    options = {
      controller: data.class.to_resource,
      action: params[:action],
      id: data.id,
    }

    params[:_popup] ? data.to_label : link_to(data.to_label, options)
  end

  def belongs_to_filter(filter)
    att_assoc = @resource.reflect_on_association(filter.to_sym)
    class_name = att_assoc.options[:class_name] || filter.capitalize.camelize
    resource = class_name.constantize

    attribute = @resource.human_attribute_name(filter)

    items = [[attribute, '']]
    array = resource.order(resource.typus_order_by).map { |v| ["#{attribute}:#{v.to_label}", v.id] }

    items + array
  end

  def build_label_text_for_belongs_to(klass, html_options, options)
    if html_options[:disabled] == true
      t('typus.labels.read_only')
    elsif admin_user.can?('create', klass) && !headless_mode?
      build_add_new_for_belongs_to(klass, options)
    end
  end

  def build_add_new_for_belongs_to(klass, options)
    html_options = set_modal_options_for(klass)
    html_options['data-controls-modal'] = "modal-from-dom-#{options[:attribute]}"
    html_options['url'] = "/admin/#{klass.to_resource}/new?_popup=true"

    link_to t('typus.buttons.add'), { anchor: html_options['data-controls-modal'] }, html_options
  end

end


text:
package com.baidubce.util;

import static com.google.common.base.Preconditions.checkNotNull;

import java.io.UnsupportedEncodingException;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.BitSet;
import java.util.Collections;
import java.util.List;
import java.util.Map;

import org.apache.http.Header;
import org.apache.http.StatusLine;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpRequestBase;

import com.baidubce.Protocol;
import com.baidubce.http.Headers;
import com.google.common.base.Joiner;
import com.google.common.collect.Lists;

public class HttpUtils {

    private static final String DEFAULT_ENCODING = "UTF-8";

    private static BitSet URI_UNRESERVED_CHARACTERS = new BitSet();
    private static String[] PERCENT_ENCODED_STRINGS = new String[256];

    private static final Joiner queryStringJoiner = Joiner.on('&');
    private static boolean HTTP_VERBOSE = Boolean.parseBoolean(System.getProperty("bce.sdk.http", "false"));
//    private static boolean HTTP_VERBOSE = true;

    /**
     * Regex which matches any of the sequences that we need to fix up after URLEncoder.encode().
     */
    // private static final Pattern ENCODED_CHARACTERS_PATTERN;
    static {
        /*
         * StringBuilder pattern = new StringBuilder();
         *
         * pattern .append(Pattern.quote("+")) .append("|") .append(Pattern.quote("*")) .append("|")
         * .append(Pattern.quote("%7E")) .append("|") .append(Pattern.quote("%2F"));
         *
         * ENCODED_CHARACTERS_PATTERN = Pattern.compile(pattern.toString());
         */
        for (int i = 'a'; i <= 'z'; i++) {
            URI_UNRESERVED_CHARACTERS.set(i);
        }
        for (int i = 'A'; i <= 'Z'; i++) {
            URI_UNRESERVED_CHARACTERS.set(i);
        }
        for (int i = '0'; i <= '9'; i++) {
            URI_UNRESERVED_CHARACTERS.set(i);
        }
        URI_UNRESERVED_CHARACTERS.set('-');
        URI_UNRESERVED_CHARACTERS.set('.');
        URI_UNRESERVED_CHARACTERS.set('_');
        URI_UNRESERVED_CHARACTERS.set('~');

        for (int i = 0; i < PERCENT_ENCODED_STRINGS.length; ++i) {
            PERCENT_ENCODED_STRINGS[i] = String.format("%%%02X", i);
        }
    }

    /**
     * Normalize a string for use in url path. The algorithm is:
     *

     *
     *

     *
Normalize the string

     *
replace all "%2F" with "/"

     *
replace all "//" with "/%2F"

     *

     *
     *

     * Bos object key can contain arbitrary characters, which may result double slash in the url path. Apache http
     * client will replace "//" in the path with a single '/', which makes the object key incorrect. Thus we replace
     * "//" with "/%2F" here.
     *
     * @param path the path string to normalize.
     * @return the normalized path string.
     * @see #normalize(String)
     */
    public static String normalizePath(String path) {
        return normalize(path).replace("%2F", "/");
    }

    /**
     * Normalize a string for use in BCE web service APIs. The normalization algorithm is:
     *

     *

     *
Convert the string into a UTF-8 byte array.

     *
Encode all octets into percent-encoding, except all URI unreserved characters per the RFC 3986.

     *

     *
     *

     * All letters used in the percent-encoding are in uppercase.
     *
     * @param value the string to normalize.
     * @return the normalized string.
     */
    public static String normalize(String value) {
        try {
            StringBuilder builder = new StringBuilder();
            for (byte b : value.getBytes(DEFAULT_ENCODING)) {
                if (URI_UNRESERVED_CHARACTERS.get(b & 0xFF)) {
                    builder.append((char) b);
                } else {
                    builder.append(PERCENT_ENCODED_STRINGS[b & 0xFF]);
                }
            }
            return builder.toString();
        } catch (UnsupportedEncodingException e) {
            throw new RuntimeException(e);
        }
    }

    /**
     * Encode a string for use in the path of a URL; uses URLEncoder.encode, (which encodes a string for use in the
     * query portion of a URL), then applies some postfilters to fix things up per the RFC. Can optionally handle
     * strings which are meant to encode a path (ie include '/'es which should NOT be escaped).
     *
     * @param value the value to encode
     * @param path true if the value is intended to represent a path
     * @return the encoded value
     */
    /*
     * public static String urlEncode(String value) { if (value == null) { return ""; }
     *
     * try { String encoded = URLEncoder.encode(value, DEFAULT_ENCODING);
     *
     * Matcher matcher = ENCODED_CHARACTERS_PATTERN.matcher(encoded); StringBuffer buffer = new
     * StringBuffer(encoded.length());
     *
     * while (matcher.find()) { String replacement = matcher.group(0);
     *
     * if ("+".equals(replacement)) { replacement = "%20"; } else if ("*".equals(replacement)) { replacement = "%2A"; }
     * else if ("%7E".equals(replacement)) { replacement = "~"; } else if (path && "%2F".equals(replacement)) {
     * replacement = "/"; }
     *
     * matcher.appendReplacement(buffer, replacement); }
     *
     * matcher.appendTail(buffer); return buffer.toString();
     *
     * } catch (UnsupportedEncodingException ex) { throw new RuntimeException(ex); } }
     */

    /**
     * Returns a host header according to the specified URI. The host header is generated with the same logic used by
     * apache http client, that is, append the port to hostname only if it is not the default port.
     *
     * @param uri the URI
     * @return a host header according to the specified URI.
     */
    public static String generateHostHeader(URI uri) {
        String host = uri.getHost();
        if (isUsingNonDefaultPort(uri)) {
            host += ":" + uri.getPort();
        }
        return host;
    }

    /**
     * Returns true if the specified URI is using a non-standard port (i.e. any port other than 80 for HTTP URIs or any
     * port other than 443 for HTTPS URIs).
     *
     * @param uri the URI
     * @return True if the specified URI is using a non-standard port, otherwise false.
     */
    public static boolean isUsingNonDefaultPort(URI uri) {
        String scheme = uri.getScheme().toLowerCase();
        int port = uri.getPort();
        if (port <= 0) {
            return false;
        }
        if (scheme.equals(Protocol.HTTP.toString())) {
            return port != Protocol.HTTP.getDefaultPort();
        }
        if (scheme.equals(Protocol.HTTPS.toString())) {
            return port != Protocol.HTTPS.getDefaultPort();
        }
        return false;
    }

    public static String getCanonicalQueryString(Map<String, String> parameters, boolean forSignature) {
        if (parameters.isEmpty()) {
            return "";
        }

        List<String> parameterStrings = Lists.newArrayList();
        for (Map.Entry<String, String> entry : parameters.entrySet()) {
            if (forSignature && Headers.AUTHORIZATION.equalsIgnoreCase(entry.getKey())) {
                continue;
            }
            String key = entry.getKey();
            checkNotNull(key, "parameter key should not be null");
            String value = entry.getValue();
            if (value == null) {
                if (forSignature) {
                    parameterStrings.add(normalize(key) + '=');
                } else {
                    parameterStrings.add(normalize(key));
                }
            } else {
                parameterStrings.add(normalize(key) + '=' + normalize(value));
            }
        }
        Collections.sort(parameterStrings);

        return queryStringJoiner.join(parameterStrings);
    }

    /**
     * Append the given path to the given baseUri.
     *
     *

     * This method will encode the given path but not the given baseUri.
     *
     * @param baseUri
     * @param pathComponents
     */
    public static URI appendUri(URI baseUri, String... pathComponents) {
        StringBuilder builder = new StringBuilder(baseUri.toASCIIString());
        for (String path : pathComponents) {
            if (path != null && path.length() > 0) {
                path = normalizePath(path);
                if (path.startsWith("/")) {
                    if (builder.charAt(builder.length() - 1) == '/') {
                        builder.setLength(builder.length() - 1);
                    }
                } else {
                    if (builder.charAt(builder.length() - 1) != '/') {
                        builder.append('/');
                    }
                }
                builder.append(path);
            }
        }
        try {
            return new URI(builder.toString());
        } catch (URISyntaxException e) {
            throw new RuntimeException("Unexpected error", e);
        }
    }

    public static void printRequest(HttpRequestBase request) {
        if (!HTTP_VERBOSE) {
            return;
        }
        System.out.println("\n-------------> ");
        System.out.println(request.getRequestLine());
        for (Header h : request.getAllHeaders()) {
            System.out.println(h.getName() + " : " + h.getValue());
        }
        RequestConfig config = request.getConfig();
        if (config != null) {
            System.out.println("getConnectionRequestTimeout: "
                    + config.getConnectionRequestTimeout());
            System.out.println("getConnectTimeout: "
                    + config.getConnectTimeout());
            System.out.println("getCookieSpec: " + config.getCookieSpec());
            System.out.println("getLocalAddress: " + config.getLocalAddress());

        }
    }

    public static void printResponse(CloseableHttpResponse response) {
        if (!HTTP_VERBOSE) {
            return;
        }
        System.out.println("\n<------------- ");
        StatusLine status = response.getStatusLine();
        System.out.println(status.getStatusCode() + " - "
                + status.getReasonPhrase());
        Header[] heads = response.getAllHeaders();
        for (Header h : heads) {
            System.out.println(h.getName() + " : " + h.getValue());
        }
    }

}


text:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>

	<groupId>de.codecentric</groupId>
	<artifactId>acceptance-tests</artifactId>
	<version>3.0.0</version>

	<properties>
		<selenium.version>2.45.0</selenium.version>
	</properties>

	<dependencies>
		<dependency>
			<groupId>org.seleniumhq.selenium</groupId>
			<artifactId>selenium-java</artifactId>
			<version>${selenium.version}</version>
		</dependency>
		<dependency>
			<groupId>org.seleniumhq.selenium</groupId>
			<artifactId>selenium-firefox-driver</artifactId>
			<version>${selenium.version}</version>
		</dependency>
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<version>4.11</version>
		</dependency>
	</dependencies>

	<build>
		<finalName>conference-app-acceptance-tests</finalName>
		<defaultGoal>install</defaultGoal>

		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>2.5.1</version>
				<configuration>
					<compilerVersion>1.7</compilerVersion>
					<source>1.7</source>
					<target>1.7</target>
				</configuration>
			</plugin>
		</plugins>
	</build>

</project>


text:
Function Generate-Config ($sourcePath, $packageId) {
    @{
        'siteName' = "$packageId"
        'physicalPath' = "$sourcePath"
        'appPoolName' = "$packageId"
    }
}

Function Generate-PackageConfig ($packageInfo) {
    $packageId = $packageInfo.packageId
    $sourcePath = $packageInfo.sourcePath
    @{
        'siteName' = "$packageId"
        'physicalPath' = "$sourcePath"
        'appPoolName' = "$packageId"
    }
}


text:
RSYNC=rsync -a --delete
# Copy from backup to target
sudo enter-chroot -n trusty $RSYNC /home/tgoldie/Dropbox/janie/brewtarget /home/tgoldie/Downloads/
sudo enter-chroot -n xt $RSYNC /home/tgoldie/Downloads/brewtarget /home/tgoldie/.config/

# Run it
sudo enter-chroot -n xt xiwi brewtarget

# Copy from target back to backup
sudo enter-chroot -n xt $RSYNC /home/tgoldie/.config/brewtarget /home/tgoldie/Downloads/
sudo enter-chroot -n trusty $RSYNC /home/tgoldie/Downloads/brewtarget /home/tgoldie/Dropbox/janie/


text:
'''
@author: sheng
@contact: sinotradition@gmail.com
@copyright: License according to the project license.
'''

NAME='wu3'
SPELL='wǔ'
CN='午'
SEQ='7'

if __name__=='__main__':
	pass


text:
<?xml version="1.0" encoding="utf-8"?>

<TextView


text:
from CodernityDB.database import Database
from CodernityDB.hash_index import HashIndex

class SettingsIndex(HashIndex):
    def __init__(self, *args, **kwargs):
        kwargs['key_format'] = '32s'
        super(SettingsIndex, self).__init__(*args, **kwargs)

    def make_key(self, key):
        return md5(key).hexdigest()

    def make_key_value(self, data):
        a_val = data.get('name')
        if a_val is not None:
            return md5(a_val).hexdigest(), None

db = Database('settings')
if db.exists():
    db.open()
    db.reindex()
else:
    db.create()
    index = SettingsIndex(db.path, 'settingsidx')
    db.add_index(index)

class Entry():
    def __init__(self, name, value):
        self.name = name
        self.value = value

class Settings():
    def __init__(self):

        self._db = db

    def get(self):
        records = self._db.all("settingsidx", with_doc=True)
        return [Entry(r["doc"]["name"], r["doc"]["value"]) for r in records]

    def getItem(self, name):
        record = self._db.get("settingsidx", name, with_doc=True)
        return record["doc"]["value"]

    def add(self, name, value):
        packedName = name.encode('utf-8')
        packedValue = value.encode('utf-8')
        updated = 0
        for curr in self._db.get_many("settingsidx", name, with_doc=True):
            updated = 1
            exist = curr["doc"]["value"]
            exist.append(value)
            self._db.update(curr["doc"])
        if not updated:
            self._db.insert(dict(name=packedName, value = [value]))

    def delete(self, name):
        for curr in self._db.get_many("settingsidx", name, with_doc=True):
            doc = curr['doc']
            self._db.delete(doc)


text:
package androidx.media3.exoplayer.source.chunk;

import androidx.annotation.Nullable;
import androidx.media3.common.C;
import androidx.media3.common.Format;
import androidx.media3.common.util.UnstableApi;
import androidx.media3.datasource.DataSource;
import androidx.media3.datasource.DataSourceUtil;
import androidx.media3.datasource.DataSpec;
import androidx.media3.exoplayer.source.chunk.ChunkExtractor.TrackOutputProvider;
import androidx.media3.extractor.DefaultExtractorInput;
import androidx.media3.extractor.Extractor;
import androidx.media3.extractor.ExtractorInput;
import java.io.IOException;

/** A {@link BaseMediaChunk} that uses an {@link Extractor} to decode sample data. */
@UnstableApi
public class ContainerMediaChunk extends BaseMediaChunk {

  private final int chunkCount;
  private final long sampleOffsetUs;
  private final ChunkExtractor chunkExtractor;

  private long nextLoadPosition;
  private volatile boolean loadCanceled;
  private boolean loadCompleted;

  /**
   * @param dataSource The source from which the data should be loaded.
   * @param dataSpec Defines the data to be loaded.
   * @param trackFormat See {@link #trackFormat}.
   * @param trackSelectionReason See {@link #trackSelectionReason}.
   * @param trackSelectionData See {@link #trackSelectionData}.
   * @param startTimeUs The start time of the media contained by the chunk, in microseconds.
   * @param endTimeUs The end time of the media contained by the chunk, in microseconds.
   * @param clippedStartTimeUs The time in the chunk from which output will begin, or {@link
   *     C#TIME_UNSET} to output from the start of the chunk.
   * @param clippedEndTimeUs The time in the chunk from which output will end, or {@link
   *     C#TIME_UNSET} to output to the end of the chunk.
   * @param chunkIndex The index of the chunk, or {@link C#INDEX_UNSET} if it is not known.
   * @param chunkCount The number of chunks in the underlying media that are spanned by this
   *     instance. Normally equal to one, but may be larger if multiple chunks as defined by the
   *     underlying media are being merged into a single load.
   * @param sampleOffsetUs An offset to add to the sample timestamps parsed by the extractor.
   * @param chunkExtractor A wrapped extractor to use for parsing the data.
   */
  public ContainerMediaChunk(
      DataSource dataSource,
      DataSpec dataSpec,
      Format trackFormat,
      @C.SelectionReason int trackSelectionReason,
      @Nullable Object trackSelectionData,
      long startTimeUs,
      long endTimeUs,
      long clippedStartTimeUs,
      long clippedEndTimeUs,
      long chunkIndex,
      int chunkCount,
      long sampleOffsetUs,
      ChunkExtractor chunkExtractor) {
    super(
        dataSource,
        dataSpec,
        trackFormat,
        trackSelectionReason,
        trackSelectionData,
        startTimeUs,
        endTimeUs,
        clippedStartTimeUs,
        clippedEndTimeUs,
        chunkIndex);
    this.chunkCount = chunkCount;
    this.sampleOffsetUs = sampleOffsetUs;
    this.chunkExtractor = chunkExtractor;
  }

  @Override
  public long getNextChunkIndex() {
    return chunkIndex + chunkCount;
  }

  @Override
  public boolean isLoadCompleted() {
    return loadCompleted;
  }

  // Loadable implementation.

  @Override
  public final void cancelLoad() {
    loadCanceled = true;
  }

  @SuppressWarnings("NonAtomicVolatileUpdate")
  @Override
  public final void load() throws IOException {
    if (nextLoadPosition == 0) {
      // Configure the output and set it as the target for the extractor wrapper.
      BaseMediaChunkOutput output = getOutput();
      output.setSampleOffsetUs(sampleOffsetUs);
      chunkExtractor.init(
          getTrackOutputProvider(output),
          clippedStartTimeUs == C.TIME_UNSET ? C.TIME_UNSET : (clippedStartTimeUs - sampleOffsetUs),
          clippedEndTimeUs == C.TIME_UNSET ? C.TIME_UNSET : (clippedEndTimeUs - sampleOffsetUs));
    }
    try {
      // Create and open the input.
      DataSpec loadDataSpec = dataSpec.subrange(nextLoadPosition);
      ExtractorInput input =
          new DefaultExtractorInput(
              dataSource, loadDataSpec.position, dataSource.open(loadDataSpec));
      // Load and decode the sample data.
      try {
        while (!loadCanceled && chunkExtractor.read(input)) {}
      } finally {
        nextLoadPosition = input.getPosition() - dataSpec.position;
      }
    } finally {
      DataSourceUtil.closeQuietly(dataSource);
    }
    loadCompleted = !loadCanceled;
  }

  /**
   * Returns the {@link TrackOutputProvider} to be used by the wrapped extractor.
   *
   * @param baseMediaChunkOutput The {@link BaseMediaChunkOutput} most recently passed to {@link
   *     #init(BaseMediaChunkOutput)}.
   * @return A {@link TrackOutputProvider} to be used by the wrapped extractor.
   */
  protected TrackOutputProvider getTrackOutputProvider(BaseMediaChunkOutput baseMediaChunkOutput) {
    return baseMediaChunkOutput;
  }
}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Uses of Class com.github.thorbenkuck.netcom2.exceptions.DeSerializationFailedException (NetCom2 1.1-SNAPSHOT API)</title>
<meta name="date" content="2018-05-29">
<link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes

Uses of Class
com.github.thorbenkuck.netcom2.exceptions.DeSerializationFailedException

Packages that use DeSerializationFailedException

Package
Description

com.github.thorbenkuck.netcom2.network.shared.clients

This is the core package for Communication.

Uses of DeSerializationFailedException in com.github.thorbenkuck.netcom2.network.shared.clients

Methods in com.github.thorbenkuck.netcom2.network.shared.clients that throw DeSerializationFailedException

Modifier and Type
Method and Description

T
DeSerializationAdapter.get(F f)

DeSerializes a f into a T.

Object
JavaDeSerializationAdapter.get(String s)

DeSerializes a f into a T.

Object
PingDeSerializationAdapter.get(String s)

DeSerializes a f into a T.

Skip navigation links

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes

Copyright © 2018. All rights reserved.


text:
<!DOCTYPE html>

    <title>Login</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <link href="../Content/login.css" rel="stylesheet" />
    <link href="../Content/bootstrap.min.css" rel="stylesheet" />
    <link href="../Content/font-awesome.min.css" rel="stylesheet" />
    <link href="../Content/animate.css" rel="stylesheet" />

                <form>

Sign in to DSS

                            <input type="text" required="required" class="form-control" placeholder="Username" />

                            <input type="password" required="required" class="form-control " placeholder="Password" />

                                <input type="checkbox" checked="checked" name="iCheck" />

                             Remember Me

                        Sign in

                </form>

        Forgot your password?  Next


text:
using namespace std;
using namespace Rice;

Data_Type<Halffacet> define_Halffacet(Rice::Module rb_mCGAL);

#endif


text:
/*global DocumentTouch, FB */

function ShareBar(options) {
    'use strict';
    return this.init(options);
}

(function (window, document) {
    'use strict';

    var FACEBOOK = 'facebook',
        TWITTER = 'twitter',
        WHATSAPP = 'whatsapp',
        TELEGRAM = 'telegram',
        GOOGLE = 'google',
        LINKEDIN = 'linkedin',
        PINTEREST = 'pinterest',
        EMAIL = 'email',
        BUTTON_WIDTH = 34,
        BUTTON_FULL_WIDTH = 110,
        BUTTON_PADDING = 4,
        MAX_SOCIAL_BUTTONS = 6,
        SHARE_BUTTON = 'share-button',
        SVG_CONTAINER = 'sharebar-svg-container';

    function preventDefault(e) {
        if (e && e.preventDefault) {
            e.preventDefault();
        }
    }

    function supportPassiveEvents() {
        if (window === undefined && typeof window.addEventListener === 'function') {
            var support = false,
                noop = Function,
                options = Object.defineProperty({}, 'passive', {
                    get: function () { support = true; }
                });

            window.addEventListener('testPassiveEventSupport', noop, options);
            window.removeEventListener('testPassiveEventSupport', noop, options);
            return support;
        }
    }

    function addEventListener(element, event, handler) {
        var useCapture = supportPassiveEvents() ? { passive: true } : false;
        return element.addEventListener(event, handler, useCapture);
    }

    ShareBar.prototype = {
        init: function init(options) {
            this.activeNetworks = [];
            this.eventName = this.getActionName();
            this.verifyTouch();
            this.createSVG();
            this.mergeOptions(options);
            this.containers = document.querySelectorAll(this.selector);
            this.createBars();
        },

        destroy: function destroy() {
            this.containers.forEach(function (container) {
                var i = 0, item;

                container.classList.remove('share-bar-container');

                for (i; i < container.classList.length; i++) {
                    item = container.classList.item(i);

                    if (item.indexOf('share-theme') !== -1) {
                        container.setAttribute('data-theme', item.split('-')[2]);
                        container.classList.remove(item);
                    }
                }
                while (container.firstChild) {
                    container.removeChild(container.firstChild);
                }
            });
        },

        getActionName: function getActionName() {
            return this.isTouch() ? 'mouseup' : 'click';
        },

        // https://github.com/Modernizr/Modernizr/blob/master/feature-detects/touchevents.js
        verifyTouch: function verifyTouch() {
            var html = document.querySelector('html'),
                isTouch = this.isTouch(),
                touch = ' touch',
                noTouch = ' no-touch';

            if (isTouch && html.className.indexOf(touch) === -1) {
                html.className += touch;

            } else if (!isTouch && html.className.indexOf(noTouch) === -1) {
                html.className += noTouch;
            }
        },

        isTouch: function isTouch() {
            var bool = false;

            if (window.ontouchstart !== undefined || (window.DocumentTouch && document instanceof DocumentTouch)) {
                bool = true;
            }
            return bool;
        },

        createSVG: function createSVG() {
            var hasSvg = document.querySelector('.sharebar-svg-container'),
                svg;

            if (!hasSvg) {
                svg = document.createElement('div');
                svg.innerHTML = '[[X_SVG_X]]';
                svg.classList.add(SVG_CONTAINER);
                svg.style.display = 'none';

                document.body.appendChild(svg);
            }
        },

        mergeOptions: function mergeOptions(options) {
            var option,
                defaultOptions = {
                    // Selector to open lightbox
                    selector: '.share-bar',
                    campaign: 'share-bar',
                    classPopup: 'share-popup',
                    facebookAppId: '',
                    networks: [
                        FACEBOOK, TWITTER, WHATSAPP, TELEGRAM, GOOGLE, LINKEDIN, PINTEREST, EMAIL
                    ],
                    theme: 'natural',
                    buttonWidth: BUTTON_WIDTH,
                    buttonFullWidth: BUTTON_FULL_WIDTH,
                    buttonPadding: BUTTON_PADDING,
                    maxSocialButtons: MAX_SOCIAL_BUTTONS,
                    context: 'desktop',
                    onCreateBar: function (bar) { return false; },
                    onCreateButton: function (button) { return false; },
                    onShare: function (button) { return false; }
                };

            if (!options) {
                options = {};
            }

            for (option in defaultOptions) {
                if (defaultOptions.hasOwnProperty(option)) {
                    this[option] = options[option] || defaultOptions[option];
                }
            }
        },

        validateNetworks: function validateNetworks(networks) {
            var msg = 'The list of networks passed on initialization is wrong',
                i = 0,
                networkName = '',
                method = '';

            if (Object.prototype.toString.call(networks) !== '[object Array]') {
                throw new Error(msg + ' [Should be an Array]');
            }

            for (i; i < networks.length; i++) {
                if (typeof networks[i] === 'string') {
                    networkName = networks[i];
                    networkName = networkName.substr(0, 1).toUpperCase() + networkName.substr(1);
                    method = ShareBar.prototype['create' + networkName + 'Button'];

                    if (method) {
                        if (this.activeNetworks.indexOf(networks[i]) === -1) {
                            this.activeNetworks.push(networks[i]);
                        }

                        networks[i] = method;
                    } else {
                        throw new Error(msg + ' [Network name "' + networks[i] + '" is wrong, should be ' + FACEBOOK + ' or ' + TWITTER + ' or ' + WHATSAPP + ' or ' + GOOGLE + ' or ' + LINKEDIN + ' or ' + PINTEREST + ' or ' + EMAIL + ']');
                    }

                } else if (typeof networks[i] !== 'function') {
                    throw new Error(msg + ' [Should be string or function]');
                }
            }

            return networks;
        },

        createBars: function createBars() {
            var items = this.containers,
                element = 0;

            for (element = 0; element < items.length; element++) {
                this.createBar(items[element]);
            }

        },

        createBar: function createBar(element, networks) {
            var theme = ' share-theme-',
                i = 0,
                count = 0,
                buttonClasses = [];

            networks = this.validateNetworks(networks || this.networks);
            networks = networks.slice(0, this.maxSocialButtons);

            count = networks.length;
            buttonClasses = this.getButtonsSize(element.offsetWidth, count);

            for (i; i < count; i++) {
                networks[i].call(this, element, buttonClasses[i]);
            }

            theme += element.getAttribute('data-theme') || this.theme;
            element.className += ' share-bar-container' + theme;
            this.bindOpenPopup(element);
            this.bindShare(element);
            this.onCreateBar(element);
        },

        getButtonsSize: function getButtonsSize(containerWidth, numberOfButtons) {
            var fullButtonWidth = this.buttonFullWidth + this.buttonPadding,
                smallButtonWidth = this.buttonWidth + this.buttonPadding,
                isSmallScreen = this.isSmallScreen();

            if ((numberOfButtons * smallButtonWidth) > containerWidth) {
                return this.getButtonsSmall(
                    numberOfButtons,
                    smallButtonWidth,
                    containerWidth
                );
            }

            if (isSmallScreen) {
                return ['', '', '', '', '', ''];
            }

            return this.getButtonsFull(
                numberOfButtons,
                fullButtonWidth,
                smallButtonWidth,
                containerWidth
            );
        },

        getButtonsSmall: function getButtonsSmall(numberOfButtons, smallButtonWidth, containerWidth) {
            var result = [],
                i = 1,
                totalOfSmallButtons = 0,
                isSmallScreen = this.isSmallScreen();

            for (i; i <= numberOfButtons; i++) {
                totalOfSmallButtons = i * smallButtonWidth;

                if (totalOfSmallButtons <= containerWidth) {
                    result[i - 1] = isSmallScreen ? '' : ' share-small';
                } else {
                    result[i - 1] = ' share-hidden';
                }
            }

            return result;
        },

        getButtonsFull: function getButtonsFull(numberOfButtons, fullButtonWidth, smallButtonWidth, containerWidth) {
            var result = [],
                i = 1,
                totalOfFullButtons = 0,
                totalOfSmallButtons = 0;

            for (i; i <= numberOfButtons; i++) {
                totalOfFullButtons = i * fullButtonWidth;
                totalOfSmallButtons = (numberOfButtons - i) * smallButtonWidth;

                if ((totalOfSmallButtons + totalOfFullButtons) <= containerWidth) {
                    result[i - 1] = ' share-full';
                } else {
                    result[i - 1] = ' share-small';
                }
            }

            return result;
        },

        bindOpenPopup: function bindOpenPopup(element) {
            var linksPopup = element.querySelectorAll('.' + this.classPopup),
                i = 0,
                self = this,
                onShareClick = function (e) {
                    self.openPopup.call(this, e);
                };

            for (i; i < linksPopup.length; i++) {
                addEventListener(linksPopup[i], this.eventName, onShareClick);
                addEventListener(linksPopup[i], 'click', preventDefault);
            }
        },

        bindShare: function bindShare(element) {
            var shareButtons = element.querySelectorAll('.' + SHARE_BUTTON),
                i = 0,
                self = this,
                onShareClick = function (e) {
                    self.onShare(this);
                };

            for (i; i < shareButtons.length; i++) {
                addEventListener(shareButtons[i], this.eventName, onShareClick);
            }
        },

        openPopup: function openPopup(e) {
            var win = window.open(
                this.getAttribute('href'),
                'popup',
                'height=400,width=500,left=10,top=10,resizable=yes,scrollbars=no,toolbar=no,menubar=no,location=no,directories=no,status=no'
            );

            win.focus();
        },

        getMetadataFromElement: function getMetadataFromElement(element) {
            var encode = window.encodeURIComponent,
                url = element.getAttribute('data-url') || '',
                urlToShare,
                splitUrl = url.split('#'),
                queryString = '?utm_source=#source#&utm_medium=share-bar-' + this.context + '&utm_campaign=' + this.campaign;

            if (splitUrl.length > 1) {
                urlToShare = splitUrl[0] + queryString + '&#' + splitUrl[1];
            } else {
                urlToShare = url + queryString;
            }

            return {
                'url': encode(urlToShare),
                'title': encode(element.getAttribute('data-title') || ''),
                'imageUrl': encode(element.getAttribute('data-image-url') || ''),
                'hashtags': encode(element.getAttribute('data-hashtags') || '')
            };
        },

        isSmallScreen: function isSmallScreen() {
            var desktopMinWidth = 768,
                width = window.innerWidth || screen.width;
            return width < desktopMinWidth;
        },

        createButton: function createButton(container, socialNetworkClass, className, url, socialNetworkTitle, openInPage) {
            var shareContainer = document.createElement('div'),
                classPopup = '';
            socialNetworkTitle = socialNetworkTitle || socialNetworkClass;
            className = className || '';
            shareContainer.className = SHARE_BUTTON + ' share-' + socialNetworkClass + className;
            socialNetworkTitle = socialNetworkTitle[0].toUpperCase() + socialNetworkTitle.slice(1);
            url = url.replace('%23source%23', socialNetworkClass);

            if (!openInPage) {
                classPopup = this.classPopup;
            }

            shareContainer.innerHTML = [
                '',
                this.createContentButton(socialNetworkClass, socialNetworkTitle),
                ''
            ].join('');

            container.appendChild(shareContainer);
            this.onCreateButton(shareContainer);

            return shareContainer;
        },

        createContentButton: function createContentButton(name, title) {
            var iconElement;
            title = title || name;

            iconElement = [
                '
',
                '      <svg viewBox="0 0 100 100" class="share-icon">',
                '           <use xlink:href="#icon-' + name + '"></use>',
                '       </svg>',
                '
',
                '' + title + ''
            ].join('');

            return iconElement;
        },

        createFacebookButton: function createFacebookButton(container, buttonClass) {
            var onShare = '',
                button = '',
                data = this.getMetadataFromElement(container),
                url = data.url.replace('%23source%23', FACEBOOK);

            button = this.createButton(
                container,
                FACEBOOK,
                buttonClass,
                'http://www.facebook.com/',
                '',
                true
            );

            this.getFacebookUi();

            onShare = function () {
                var decode = window.decodeURIComponent;

                FB.ui({
                    method: 'feed',
                    display: 'popup',
                    link: decode(url),
                    name: decode(data.title),
                    picture: decode(data.imageUrl)
                });
            };

            addEventListener(button, this.eventName, onShare);
            addEventListener(button, 'click', preventDefault);
        },

        getFacebookUi: function getFacebookUi() {
            var facebookAppId = this.facebookAppId || this.getOgFbAppId();

            if (window.FB) {
                return false;
            }

            if (facebookAppId) {
                window.fbAsyncInit = function () {
                    FB.init({
                        appId: facebookAppId,
                        xfbml: true,
                        version: 'v2.8'
                    });
                };
                (function (d, s, id) {
                    var js, fjs = d.getElementsByTagName(s)[0];
                    if (d.getElementById(id)) { return; }
                    js = d.createElement(s);
                    js.id = id;
                    js.src = "//connect.facebook.net/en_US/sdk.js";
                    fjs.parentNode.insertBefore(js, fjs);
                }(document, 'script', 'facebook-jssdk'));
            }

        },

        getOgFbAppId: function () {
            var el = document.querySelector("meta[property='fb:app_id']");

            if (el !== null) {
                return el.getAttribute('content');
            }
            return;
        },

        createTwitterButton: function createTwitterButton(container, buttonClass) {
            var data = this.getMetadataFromElement(container);

            this.createButton(
                container,
                TWITTER,
                buttonClass,
                'https://twitter.com/share?url=' + data.url + '&text=' + data.title + ' ' + data.hashtags
            );
        },

        createGoogleButton: function createGoogleButton(container, buttonClass) {
            var data = this.getMetadataFromElement(container);

            this.createButton(
                container,
                GOOGLE + 'plus',
                buttonClass,
                'https://plus.google.com/share?url=' + data.url,
                GOOGLE + '+'
            );
        },

        createLinkedinButton: function createLinkedinButton(container, buttonClass) {
            var data = this.getMetadataFromElement(container);

            this.createButton(
                container,
                LINKEDIN,
                buttonClass,
                'http://www.linkedin.com/shareArticle?mini=true&url=' + data.url
            );
        },

        createPinterestButton: function createPinterestButton(container, buttonClass) {
            var data = this.getMetadataFromElement(container);

            this.createButton(
                container,
                PINTEREST,
                buttonClass,
                'http://br.pinterest.com/pin/create/button/?url=' + data.url + '&media=' + data.imageUrl + '&description=' + data.title
            );
        },

        createWhatsappButton: function createWhatsappButton(container, buttonClass) {
            var data = this.getMetadataFromElement(container);

            if (!this.isSmallScreen() || !this.isTouch()) {
                return false;
            }

            this.createButton(
                container,
                WHATSAPP,
                buttonClass,
                'whatsapp://send?text=' + data.title + '%20' + data.url,
                '',
                true
            );
        },

        createTelegramButton: function createTelegramButton(container, buttonClass) {
            var data = this.getMetadataFromElement(container);

            this.createButton(
                container,
                TELEGRAM,
                buttonClass,
                'https://telegram.me/share/url?url=' + data.url + '&text=' + data.title,
                '',
                true
            );
        },

        createEmailButton: function createEmailButton(container, buttonClass) {
            var data = this.getMetadataFromElement(container);

            if (!this.isTouch()) {
                return false;
            }

            this.createButton(
                container,
                EMAIL,
                buttonClass,
                'mailto:?subject=' + data.title + '&body=' + data.url,
                'e-mail',
                true
            );
        }
    };

}(window, document));


text:
package tests

import (
	"fmt"
	"github.com/applariat/go-apl/pkg/apl"
	"testing"
)

var (
	testProjectRoleId     string
	testProjectRoleFilter string
)

func TestProjectRoleService_List(t *testing.T) {

	out, _, err := aplClient.ProjectRoles.List(nil)

	if err != nil {
		t.Fatal(err)
	}

	rowCount := len(out)
	if rowCount > 0 {
		testProjectRoleId = out[0].ID
		testProjectRoleFilter = out[0].ProjectID
	} else {
		t.Fatal("No audit rows found")
	}

	fmt.Printf("ProjectRole found %d rows\n", rowCount)

}

func TestProjectRoleService_ListByType(t *testing.T) {
	aplSvc := apl.NewClient()

	params := &apl.ProjectRoleParams{
		ProjectID: testProjectRoleFilter,
	}
	out, _, err := aplSvc.ProjectRoles.List(params)

	if err != nil {
		t.Fatal(err)
	}

	rowCount := len(out)
	if rowCount == 0 {
		t.Fatal("No ProjectRole rows found for filter", testProjectRoleFilter)
	}

	fmt.Printf("ProjectRole filtered found %d rows for filter \"%s\"\n", rowCount, testProjectRoleFilter)

}

func TestProjectRoleService_Get(t *testing.T) {
	aplSvc := apl.NewClient()

	out, _, err := aplSvc.ProjectRoles.Get(testProjectRoleId)

	if err != nil {
		t.Fatal(err)
	}

	if out == (apl.ProjectRole{}) {
		t.Fatal("No ProjectRole found for ID", testProjectRoleId)
	}

	fmt.Println("ProjectRole found for ID", testProjectRoleId)

}