text:
var assert = require('assert');
var ExpectGlobals = require('../../../lib/globals/expect.js');
var Nocks = require('../../../lib/nocks.js');

module.exports = {
  'expect.value' : {
    beforeEach: function (done) {
      ExpectGlobals.beforeEach.call(this, done);
    },

    afterEach : function() {
      ExpectGlobals.afterEach.call(this);
    },

    'to have value equal to [PASSED]': function (done) {
      Nocks.elementFound().value('hp vasq');
      var expect = this.client.api.expect.element('#weblogin').to.have.value.equal('hp vasq');
      this.client.once('nightwatch:finished', function (results, errors) {
        assert.equal(expect.assertion.waitForMs, null);
        assert.equal(expect.assertion.passed, true);
        assert.equal(expect.assertion.message, 'Expected element <#weblogin> to have value equal to: "hp vasq"');
        done();
      });

      this.client.start();
    },

    'to have value which equals [PASSED]': function (done) {
      Nocks.elementFound().value('hp vasq');
      var expect = this.client.api.expect.element('#weblogin').to.have.value.which.equals('hp vasq');
      this.client.once('nightwatch:finished', function (results, errors) {
        assert.equal(expect.assertion.waitForMs, null);
        assert.equal(expect.assertion.passed, true);
        assert.equal(expect.assertion.message, 'Expected element <#weblogin> to have value which equals: "hp vasq"');
        done();
      });

      this.client.start();
    },

    'to have value equal to [FAILED]': function (done) {
      Nocks.elementFound().value('hp vasq');

      var expect = this.client.api.expect.element('#weblogin').to.have.value.equal('vasq');
      this.client.once('nightwatch:finished', function (results, errors) {
        assert.equal(expect.assertion.expected, 'equal to \'vasq\'');
        assert.equal(expect.assertion.negate, false);
        assert.equal(expect.assertion.actual, 'hp vasq');
        assert.equal(expect.assertion.resultValue, 'hp vasq');
        assert.equal(expect.assertion.passed, false);
        assert.deepEqual(expect.assertion.messageParts, [' equal to', ': "', 'vasq', '"']);
        assert.equal(expect.assertion.message, 'Expected element <#weblogin> to have value equal to: "vasq"');
        done();
      });

      this.client.start();
    },

    'to have value NOT equal to [PASSED]': function (done) {
      Nocks.elementFound().value('hp vasq');

      var expect = this.client.api.expect.element('#weblogin').to.have.value.not.equal('xx');
      this.client.once('nightwatch:finished', function (results, errors) {
        assert.equal(expect.assertion.waitForMs, null);
        assert.equal(expect.assertion.negate, true);
        assert.equal(expect.assertion.passed, true);
        assert.equal(expect.assertion.resultValue, 'hp vasq');
        assert.deepEqual(expect.assertion.messageParts, [' not equal to', ': "', 'xx', '"']);
        assert.equal(expect.assertion.message, 'Expected element <#weblogin> to have value not equal to: "xx"');
        done();
      });

      this.client.start();
    },

    'to have value NOT equal to [FAILED]': function (done) {
      Nocks.elementFound().value('hp vasq');

      var expect = this.client.api.expect.element('#weblogin').to.have.value.not.equal('hp vasq');
      this.client.once('nightwatch:finished', function (results, errors) {
        assert.equal(expect.assertion.expected, 'not equal to \'hp vasq\'');
        assert.equal(expect.assertion.negate, true);
        assert.equal(expect.assertion.actual, 'hp vasq');
        assert.equal(expect.assertion.resultValue, 'hp vasq');
        assert.equal(expect.assertion.passed, false);
        assert.deepEqual(expect.assertion.messageParts, [' not equal to', ': "', 'hp vasq', '"']);
        assert.equal(expect.assertion.message, 'Expected element <#weblogin> to have value not equal to: "hp vasq"');
        done();
      });

      this.client.start();
    },

    'to have value equal with waitFor [PASSED]': function (done) {
      this.client.api.globals.waitForConditionPollInterval = 50;
      Nocks.elementFound();

      var expect = this.client.api.expect.element('#weblogin').to.have.value.equal('hp vasq').before(110);
      Nocks.value(null).value('hp vasq');

      this.client.once('nightwatch:finished', function (results, errors) {
        assert.equal(expect.assertion.waitForMs, 110);
        assert.equal(expect.assertion.passed, true);
        assert.equal(expect.assertion.retries, 1);
        assert.equal(expect.assertion.message, 'Expected element <#weblogin> to have value equal to: "hp vasq" in 110ms - condition was met in ' + expect.assertion.elapsedTime + 'ms');
        done();
      });

      this.client.start();
    },

    'to have value equal and waitFor [FAILED] - value not equal': function (done) {
      this.client.api.globals.waitForConditionPollInterval = 50;

      Nocks.elementFound().value('xx', 3);

      var expect = this.client.api.expect.element('#weblogin').to.have.value.equal('hp vasq').before(110);
      this.client.once('nightwatch:finished', function (results, errors) {
        assert.equal(expect.assertion.waitForMs, 110);
        assert.equal(expect.assertion.passed, false);
        assert.ok(expect.assertion.retries >= 1);
        assert.ok(expect.assertion.elapsedTime >= 110);
        assert.equal(expect.assertion.expected, 'equal to \'hp vasq\'');
        //assert.equal(expect.assertion.actual, 'xx');
        assert.equal(expect.assertion.message, 'Expected element <#weblogin> to have value equal to: "hp vasq" in 110ms');
        done();
      });

      this.client.start();
    },

    'to have value not equal to [PASSED]': function (done) {
      Nocks.elementFound().value('xx');

      var expect = this.client.api.expect.element('#weblogin').to.have.value.not.equal('vasq');
      assert.equal(expect.assertion.message, 'Expected element <%s> to have value');
      this.client.once('nightwatch:finished', function (results, errors) {
        assert.equal(expect.assertion.expected, 'not equal to \'vasq\'');
        assert.equal(expect.assertion.actual, 'xx');
        assert.equal(expect.assertion.negate, true);
        assert.equal(expect.assertion.resultValue, 'xx');
        assert.equal(expect.assertion.passed, true);
        assert.deepEqual(expect.assertion.messageParts, [' not equal to', ': "', 'vasq', '"']);
        assert.equal(expect.assertion.message, 'Expected element <#weblogin> to have value not equal to: "vasq"');
        done();
      });

      this.client.start();
    },

    'to have value not equal to [FAILED]': function (done) {
      Nocks.elementFound().value('xx');

      var expect = this.client.api.expect.element('#weblogin').to.have.value.not.equal('xx');
      assert.equal(expect.assertion.message, 'Expected element <%s> to have value');
      this.client.once('nightwatch:finished', function (results, errors) {
        assert.equal(expect.assertion.expected, 'not equal to \'xx\'');
        assert.equal(expect.assertion.actual, 'xx');
        assert.equal(expect.assertion.negate, true);
        assert.equal(expect.assertion.resultValue, 'xx');
        assert.equal(expect.assertion.passed, false);
        assert.deepEqual(expect.assertion.messageParts, [' not equal to', ': "', 'xx', '"']);
        assert.equal(expect.assertion.message, 'Expected element <#weblogin> to have value not equal to: "xx"');
        done();
      });

      this.client.start();
    },

    'to have value not contains [PASSED]': function (done) {
      Nocks.elementFound().value('xx');

      var expect = this.client.api.expect.element('#weblogin').to.have.value.not.contains('vasq');

      assert.equal(expect.assertion.message, 'Expected element <%s> to have value');
      this.client.once('nightwatch:finished', function (results, errors) {
        assert.equal(expect.assertion.expected, 'not contain \'vasq\'');
        assert.equal(expect.assertion.actual, 'xx');
        assert.equal(expect.assertion.negate, true);
        assert.equal(expect.assertion.resultValue, 'xx');
        assert.equal(expect.assertion.passed, true);
        assert.deepEqual(expect.assertion.messageParts, [' not contain', ': "', 'vasq', '"']);
        assert.equal(expect.assertion.message, 'Expected element <#weblogin> to have value not contain: "vasq"');
        done();
      });

      this.client.start();
    },

    'to have value contains [PASSED]': function (done) {
      Nocks.elementFound().value('vasq');

      var expect = this.client.api.expect.element('#weblogin').to.have.value.which.contains('vasq');

      assert.equal(expect.assertion.message, 'Expected element <%s> to have value');
      this.client.once('nightwatch:finished', function (results, errors) {
        assert.equal(expect.assertion.expected, 'contains \'vasq\'');
        assert.equal(expect.assertion.actual, 'vasq');
        assert.equal(expect.assertion.negate, false);
        assert.equal(expect.assertion.resultValue, 'vasq');
        assert.equal(expect.assertion.passed, true);
        assert.deepEqual(expect.assertion.messageParts, [' which ', 'contains', ': "', 'vasq', '"']);
        assert.equal(expect.assertion.message, 'Expected element <#weblogin> to have value which contains: "vasq"');
        done();
      });

      this.client.start();
    },

    'to have value not contains [FAILED]': function (done) {
      Nocks.elementFound().value('xx');

      var expect = this.client.api.expect.element('#weblogin').to.have.value.not.contains('xx');
      assert.equal(expect.assertion.message, 'Expected element <%s> to have value');
      this.client.once('nightwatch:finished', function (results, errors) {
        assert.equal(expect.assertion.expected, 'not contain \'xx\'');
        assert.equal(expect.assertion.actual, 'xx');
        assert.equal(expect.assertion.negate, true);
        assert.equal(expect.assertion.resultValue, 'xx');
        assert.equal(expect.assertion.passed, false);
        assert.deepEqual(expect.assertion.messageParts, [' not contain', ': "', 'xx', '"']);
        assert.equal(expect.assertion.message, 'Expected element <#weblogin> to have value not contain: "xx"');
        done();
      });

      this.client.start();
    },

    'to have value not match [PASSED]': function (done) {
      Nocks.elementFound().value('xx');

      var expect = this.client.api.expect.element('#weblogin').to.have.value.not.match(/vasq/);

      assert.equal(expect.assertion.message, 'Expected element <%s> to have value');
      this.client.once('nightwatch:finished', function (results, errors) {
        assert.equal(expect.assertion.expected, 'not match \'/vasq/\'');
        assert.equal(expect.assertion.actual, 'xx');
        assert.equal(expect.assertion.negate, true);
        assert.equal(expect.assertion.resultValue, 'xx');
        assert.equal(expect.assertion.passed, true);
        assert.deepEqual(expect.assertion.messageParts, [' not match', ': "', /vasq/, '"']);
        assert.equal(expect.assertion.message, 'Expected element <#weblogin> to have value not match: "/vasq/"');
        done();
      });

      this.client.start();
    },

    'to have value which matches [PASSED]': function (done) {
      Nocks.elementFound().value('vasq');

      var expect = this.client.api.expect.element('#weblogin').to.have.value.which.matches(/vasq/);

      assert.equal(expect.assertion.message, 'Expected element <%s> to have value');
      this.client.once('nightwatch:finished', function (results, errors) {
        assert.equal(expect.assertion.expected, 'matches \'/vasq/\'');
        assert.equal(expect.assertion.actual, 'vasq');
        assert.equal(expect.assertion.negate, false);
        assert.equal(expect.assertion.resultValue, 'vasq');
        assert.equal(expect.assertion.passed, true);
        assert.deepEqual(expect.assertion.messageParts, [' which ', 'matches', ': "', /vasq/, '"']);
        assert.equal(expect.assertion.message, 'Expected element <#weblogin> to have value which matches: "/vasq/"');
        done();
      });

      this.client.start();
    },

    'to have value not match [FAILED]': function (done) {
      Nocks.elementFound().value('xx');

      var expect = this.client.api.expect.element('#weblogin').to.have.value.not.match(/xx/);
      assert.equal(expect.assertion.message, 'Expected element <%s> to have value');
      this.client.once('nightwatch:finished', function (results, errors) {
        assert.equal(expect.assertion.expected, 'not match \'/xx/\'');
        assert.equal(expect.assertion.actual, 'xx');
        assert.equal(expect.assertion.negate, true);
        assert.equal(expect.assertion.resultValue, 'xx');
        assert.equal(expect.assertion.passed, false);
        assert.deepEqual(expect.assertion.messageParts, [' not match', ': "', /xx/, '"']);
        assert.equal(expect.assertion.message, 'Expected element <#weblogin> to have value not match: "/xx/"');
        done();
      });

      this.client.start();
    },

    'to have value equal to - element not found': function (done) {
      Nocks.elementNotFound();

      var expect = this.client.api.expect.element('#weblogin').to.have.value.equal('vasq');
      assert.equal(expect.assertion.message, 'Expected element <%s> to have value');
      this.client.once('nightwatch:finished', function (results, errors) {
        assert.equal(expect.assertion.expected, 'present');
        assert.equal(expect.assertion.actual, 'not present');
        assert.equal(expect.assertion.negate, false);
        assert.equal(expect.assertion.resultValue, null);
        assert.equal(expect.assertion.passed, false);
        assert.deepEqual(expect.assertion.messageParts, [' equal to', ': "', 'vasq', '"', ' - element was not found']);
        assert.equal(expect.assertion.message, 'Expected element <#weblogin> to have value equal to: "vasq" - element was not found');
        done();
      });

      this.client.start();
    },

    'to have value which contains - element not found': function (done) {
      Nocks.elementNotFound();

      var expect = this.client.api.expect.element('#weblogin').to.have.value.which.contains('vasq');

      this.client.once('nightwatch:finished', function (results, errors) {
        assert.equal(expect.assertion.expected, 'present');
        assert.equal(expect.assertion.actual, 'not present');
        assert.equal(expect.assertion.passed, false);
        assert.deepEqual(expect.assertion.messageParts, [' which ', 'contains', ': "', 'vasq', '"', ' - element was not found']);
        assert.equal(expect.assertion.message, 'Expected element <#weblogin> to have value which contains: "vasq" - element was not found');
        done();
      });

      this.client.start();
    },

    'to have value match - element not found': function (done) {
      Nocks.elementNotFound();

      var expect = this.client.api.expect.element('#weblogin').to.have.value.which.matches(/vasq$/);

      this.client.once('nightwatch:finished', function (results, errors) {
        assert.equal(expect.assertion.expected, 'present');
        assert.equal(expect.assertion.actual, 'not present');
        assert.equal(expect.assertion.passed, false);
        assert.deepEqual(expect.assertion.messageParts, [' which ', 'matches', ': "', /vasq$/, '"', ' - element was not found']);
        assert.equal(expect.assertion.message, 'Expected element <#weblogin> to have value which matches: "/vasq$/" - element was not found');
        done();
      });

      this.client.start();
    },

    'to have value equal to with waitFor - element not found': function (done) {
      this.client.api.globals.waitForConditionPollInterval = 50;

      Nocks.elementNotFound().elementNotFound().elementNotFound();

      var expect = this.client.api.expect.element('#weblogin').to.have.value.equal('hp vasq').before(60);
      this.client.once('nightwatch:finished', function (results, errors) {
        assert.equal(expect.assertion.waitForMs, 60);
        assert.equal(expect.assertion.passed, false);
        assert.equal(expect.assertion.message, 'Expected element <#weblogin> to have value equal to: "hp vasq" in 60ms - element was not found');
        done();
      });

      this.client.start();
    },

    'to have value equal with waitFor - element found on retry': function (done) {
      this.client.api.globals.waitForConditionPollInterval = 50;
      Nocks.elementNotFound().elementFound().value('hp vasq');

      var expect = this.client.api.expect.element('#weblogin').to.have.value.equal('hp vasq').before(110);

      this.client.once('nightwatch:finished', function (results, errors) {
        assert.equal(expect.assertion.waitForMs, 110);
        assert.equal(expect.assertion.passed, true);
        assert.equal(expect.assertion.message, 'Expected element <#weblogin> to have value equal to: "hp vasq" in 110ms - condition was met in ' + expect.assertion.elapsedTime + 'ms');
        done();
      });

      this.client.start();
    },

    'to have value match - throws exception on invalid regex': function (done) {
      Nocks.elementFound().value('xx');

      var expect = this.client.api.expect.element('#weblogin').to.have.value;
      assert.throws(function () {
        expect.which.matches('');
      }.bind(this));

      this.client.once('nightwatch:finished', function (results, errors) {
        done();
      });

      this.client.start();
    },

    'to have value equal and waitFor [FAILED] - value not found': function (done) {
      this.client.api.globals.waitForConditionPollInterval = 50;
      Nocks.elementFound();

      var expect = this.client.api.expect.element('#weblogin').to.have.value.equal('hp vasq').before(110);

      Nocks.elementFound().value('xx', 4);

      this.client.once('nightwatch:finished', function (results, errors) {
        assert.equal(expect.assertion.waitForMs, 110);
        assert.equal(expect.assertion.passed, false);
        assert.ok(expect.assertion.retries > 1);
        assert.equal(expect.assertion.message, 'Expected element <#weblogin> to have value equal to: "hp vasq" in 110ms');
        done();
      });

      this.client.start();
    }
  }
};


text:
<?xml version="1.0" encoding="utf-8"?>
<!--
  Copyright (C) 2015 Emanuel Moecklin

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

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

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

<menu xmlns:android="http://schemas.android.com/apk/res/android">

    <item
		android:id="@+id/rotate_left"
		android:icon="?attr/rte_icMenuRotateLeft"
        android:showAsAction="always"
        android:orderInCategory="1"
        android:alphabeticShortcut="l"/>

    <item
		android:id="@+id/rotate_right"
		android:icon="?attr/rte_icMenuRotateRight"
        android:showAsAction="always"
        android:orderInCategory="2"
        android:alphabeticShortcut="r"/>

    <item
		android:id="@+id/save"
		android:icon="?attr/rte_icMenuSave"
        android:showAsAction="always"
        android:orderInCategory="3"
        android:alphabeticShortcut="s"/>

    <item
		android:id="@+id/cancel"
		android:icon="?attr/rte_icMenuCloseClearCancel"
        android:showAsAction="always"
        android:orderInCategory="4"
        android:alphabeticShortcut="q"/>

</menu>

redpajama_set_name: RedPajamaGithub


text:
using Xamarin.Forms;

namespace XFPrismNavigationSample.Views
{
    public partial class SecondPage : ContentPage
    {
        public SecondPage()
        {
            InitializeComponent();
        }
    }
}


text:
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Configuring Downstream Caches</title>
    <link rel="stylesheet" href="doc.css">

Configuring Downstream Caches

Standard Configuration

Note: This feature is currently experimental.
     Options and configuration described here are subject to change in future
     releases. Please subscribe to the announcements mailing list to keep yourself informed of updates to
     this feature.

     By default PageSpeed serves HTML files with Cache-Control: no-cache,
     max-age=0 so that changes to the HTML and its resources are sent
     fresh on each request.  The HTML can be cached, however, if you:

 Set up a PURGE handler in your cache.

 Tell PageSpeed the url for the PURGE handler.

 Have the cache set the PS-CapabilityList header
            so PageSpeed will emit HTML that can be sent to any browser.

 Have the cache occasionally pass through requests to the origin with
            the PS-ShouldBeacon header set.

     For example, if you're running a cache on port 80 that reverse proxies to
     your site on port 8080, then you'd need to tell PageSpeed to send
     its PURGE requests to port 80:

Apache:

ModPagespeedDownstreamCachePurgeLocationPrefix http://localhost:80

Nginx:

pagespeed DownstreamCachePurgeLocationPrefix http://localhost:80;

     You also need to give PageSpeed a key so it can allow the cache to request
     rebeaconing without allowing external entities to do so:

Apache:

ModPagespeedDownstreamCacheRebeaconingKey "<your-secret-key>"

Nginx:

pagespeed DownstreamCacheRebeaconingKey "<your-secret-key>";

     These are the only changes you need to make to the PageSpeed configuration
     file, but before you restart you also need to make some changes to your
     cache configuration.  These vary by cache; below are configurations for
     Varnish 3.x, Varnish 4.x, and Nginx's proxy_cache:

Varnish 3.x:

acl purge {
  # If PageSpeed isn't running on the same server as your cache, list the IP(s)
  # of the PageSpeed machine(s) here.
  "127.0.0.1";
}
sub vcl_recv {
  # Tell PageSpeed not to use optimizations specific to this request.
  set req.http.PS-CapabilityList = "fully general optimizations only";

  # Don't allow external entities to force beaconing.
  remove req.http.PS-ShouldBeacon;

  # Authenticate the purge request by IP.
  if (req.request == "PURGE") {
    if (!client.ip ~ purge) {
      error 405 "Not allowed.";
    }
    return (lookup);
  }
}

# Mark HTML as uncacheable.  If we can't send them purge requests they can't
# cache our html.
sub vcl_fetch {
   if (beresp.http.Content-Type ~ "text/html") {
     remove beresp.http.Cache-Control;
     set beresp.http.Cache-Control = "no-cache, max-age=0";
   }
   return (deliver);
}

sub vcl_hit {
  # Make purging happen in response to a PURGE request.  This happens
  # automatically in Varnish 4.x so we don't need it there.
  if (req.request == "PURGE") {
    purge;
    error 200 "Purged.";
  }

  # 5% of the time ignore that we got a cache hit and send the request to the
  # backend anyway for instrumentation.
  if (std.random(0, 100) < 5) {
    set req.http.PS-ShouldBeacon = "<your-secret-key>";
    return (pass);
  }
}

sub vcl_miss {
  # Make purging happen in response to a PURGE request.  This happens
  # automatically in Varnish 4.x so we don't need it there.
  if (req.request == "PURGE") {
    purge;
    error 200 "Purged.";
  }

  # Instrument 25% of cache misses.
  if (std.random(0, 100) < 25) {
    set req.http.PS-ShouldBeacon = "<your-secret-key>";
    return (pass);
  }
}

Varnish 4.x:

acl purge {
  # If PageSpeed isn't running on the same server as your cache, list the IP(s)
  # of the PageSpeed machine(s) here.
  "127.0.0.1";
}

sub vcl_recv {
  # Tell PageSpeed not to use optimizations specific to this request.
  set req.http.PS-CapabilityList = "fully general optimizations only";

  # Don't allow external entities to force beaconing.
  unset req.http.PS-ShouldBeacon;

  # Authenticate the purge request by IP.
  if (req.method == "PURGE") {
    if (!client.ip ~ purge) {
      return (synth(405,"Not allowed."));
    }
    return (purge);
  }
}

# Mark HTML as uncacheable.  If we can't send them purge requests they can't
# cache our html.
sub vcl_backend_response {
   if (beresp.http.Content-Type ~ "text/html") {
     unset beresp.http.Cache-Control;
     set beresp.http.Cache-Control = "no-cache, max-age=0";
   }
   return (deliver);
}

sub vcl_hit {
  # 5% of the time ignore that we got a cache hit and send the request to the
  # backend anyway for instrumentation.
  if (std.random(0, 100) < 5) {
    set req.http.PS-ShouldBeacon = "<your-secret-key>";
    return (pass);
  }
}
sub vcl_miss {
  # Instrument 25% of cache misses.
  if (std.random(0, 100) < 25) {
    set req.http.PS-ShouldBeacon = "<your-secret-key>";
    return (pass);
  }
}

Nginx proxy_cache:

http {
  # Define a mapping used to mark HTML as uncacheable.
  map $upstream_http_content_type $new_cache_control_header_val {
    default $upstream_http_cache_control;
    "~*text/html" "no-cache, max-age=0";
  }

  server {
    # PageSpeed's beacon dependent filters need the cache to let some requests
    # through to the backend.  This code below depends on the ngx_set_misc
    # module and randomly passes 5% of traffic to the backend for rebeaconing.
    set $should_beacon_header_val "";
    set_random $rand 0 100;
    if ($rand ~* "^[0-4]$") {
      set $should_beacon_header_val "<your-secret-key>";
      set $bypass_cache 1;
    }

    location / {
      # existing proxy_pass
      # existing proxy_cache
      # existing proxy_cache_key

      # What servers should we accept PURGE requests from?  If PageSpeed isn't
      # running on the same server as your cache, list the IP(s) of the
      # PageSpeed machine(s) here.
      #
      # This requires rebuilding with the ngx_cache_purge module:
      #   https://github.com/FRiCKLE/ngx_cache_purge
      proxy_cache_purge PURGE from 127.0.0.1;

      # Mark HTML as uncacheable.  If we can't send them purge requests they
      # can't cache our html.  Uses the map defined above.
      proxy_hide_header Cache-Control;
      add_header Cache-Control $new_cache_control_header_val;

      # Tell PageSpeed not to use optimizations specific to this request.
      proxy_set_header PS-CapabilityList "fully general optimizations only";

      # See discussion of rebeaconing above.
      proxy_cache_bypass $bypass_cache;
      proxy_hide_header PS-ShouldBeacon;
      proxy_set_header PS-ShouldBeacon $should_beacon_header_val;
    }
  }
}

  When running with downstream caching all resources referenced from the HTML
  will be cache-extended as usual, so if you have resources that need to be
  cached for a short time then they can be stale.  If so,
  either Disallow those resources, so PageSpeed doesn't inline or
  cache-extend them, or decrease the cache lifetime on your HTML.

Additional Options

The configuration above should be a good fit for most sites, but PageSpeed's
downstream caching is highly configurable with many options that allow you to
tweak it for your particular setup.

Beaconing

  Several filters such as
  inline_images,
  inline_preview_images,
  lazyload_images and
  prioritize_critical_css
  depend extensively on client beacons to determine critical images and
  CSS. When such filters are enabled, pages periodically have beaconing
  JavaScript inserted as part of the rewriting process.
  The standard configuration passes through 5% of cache
  hits to the backend with a PS-ShouldBeacon header set, so that
  these filters can continue to receive the beacons they need.

  If you have a high traffic site, 5% is probably a larger share than you need
  for PageSpeed to receive sufficient beacons.  In that case you can decrease
  the percentage of traffic to pass through.  For example, here's how you'd
  decrease it to 2%:

Varnish 3.x or 4.x:

-  if (std.random(0, 100) < 5) {
+  if (std.random(0, 100) < 2) {

Nginx proxy_cache

-  if ($rand ~* "^[0-4]$") {
+  if ($rand ~* "^[01]$") {

  Alternatively, you may be willing to give up the benefit of the
  beaconing-dependent filters in exchange for never intentionally bypassing the
  cache.  If so, you should turn off
  beaconing and beacon-dependent filters in PageSpeed:

Apache:

ModPagespeedCriticalImagesBeaconEnabled false
ModPagespeedDisableFilters prioritize_critical_css

Nginx:

pagespeed CriticalImagesBeaconEnabled false;
pagespeed DisableFilters prioritize_critical_css;

  Additionally you should remove the proxy config that handles beaconing:

Varnish 3.x:

-  remove req.http.PS-ShouldBeacon;
...
-  if (std.random(0, 100) < 5) {
-    set req.http.PS-ShouldBeacon = "<your-secret-key>";
-    return (pass);
-  }
...
-  if (std.random(0, 100) < 25) {
-    set req.http.PS-ShouldBeacon = "<your-secret-key>";
-    return (pass);
-  }

Varnish 4.x:

-  unset req.http.PS-ShouldBeacon;
...
-  sub vcl_hit {
-    if (std.random(0, 100) < 5) {
-      set req.http.PS-ShouldBeacon = "<your-secret-key>";
-      return (pass);
-    }
-  }
-  sub vcl_miss {
-    if (std.random(0, 100) < 25) {
-      set req.http.PS-ShouldBeacon = "<your-secret-key>";
-      return (pass);
-    }
-  }

Nginx proxy_cache

-  set $should_beacon_header_val "";
-  set_random $rand 0 100;
-  if ($rand ~* "^[0-4]$") {
-    set $should_beacon_header_val "<your-secret-key>";
-    set $bypass_cache 1;
-  }
...
-  proxy_cache_bypass $bypass_cache;
-  proxy_hide_header PS-ShouldBeacon;
-  proxy_set_header PS-ShouldBeacon $should_beacon_header_val;

PageSpeed Resources

  Because PageSpeed already caches its optimized resources, you may want to
  exclude them caching by the downstream cache.  If so, you can set:

Varnish 3.x and 4.x:

+  if (req.url ~ "\.pagespeed\.([a-z]\.)?[a-z]{2}\.[^.]{10}\.[^.]+") {
+    return (pass);
+  }

Nginx proxy_cache

+  if ($uri ~ "\.pagespeed\.([a-z]\.)?[a-z]{2}\.[^.]{10}\.[^.]+") {
+    set $bypass_cache "1";
+  }

  If you have enabled URL signing,
  change the 10 in the regexp to 20 to account for the
  additional characters in the hash.

PS-CapabilityList

  Typically PageSpeed will produce different HTML for different browsers.  For
  example, when responding to a request that has Accept:
  image/webp, PageSpeed knows the requesting browser supports WebP and so
  it can send these images, while if the Accept header doesn't
  mention WebP then it will send JPEG or PNG.  To suppress this behavior,
  the standard configuration above sets a header:

  PS-CapabilityList: fully general optimizations only

  This header can also be used to tell PageSpeed to make specific optimizations.
  There are five capabilities PageSpeed can take advantage of that aren't
  supported in all browsers, and it gives them each a code:

CapabilityCode

Inline Imagesii

Lazyload Imagesll

WebP Imagesjw

Lossless WebP Imagesws

Animated WebP Imageswa

Defer Javascriptdj

  For example, you could include whether the Accept header
  includes image/webp in your cache key, and then for the
  fraction of traffic that claimed webp support send:

  PS-CapabilityList: jw:

  Every page would go through to your origin twice and be cached twice, once
  processed with WebP support and once without.

  You can combine multiple capabilities together with a comma.  For example, if
  you decided to make a cache fragment for Chrome 30+, which supports all of
  these, for that fragment you would send:

  PS-CapabilityList: ll,ii,dj,jw,ws:

  For Firefox 4+, which supports all of these but WebP, you would send:

  PS-CapabilityList: ll,ii,dj:

  To use this header properly, however, you have to know which capabilities are
  supported by which browsers in the version of PageSpeed you're using and craft
  regular expressions to match exactly those ones.  This is very difficult to do
  in general because it involves duplicating the code in
  user_agent_matcher.cc
  as regexes, but a simple division is:

Chrome 32+: ll,ii,dj,jw,wa,ws

Firefox 4+, Safari, IE10 (but not IE11): ll,ii,dj

Everything else: fully general optimizations only

Purging with GET

  If you're integrating PageSpeed with a cache that doesn't
  support PURGE requests but does support purging in response to a
  prefixed GET request, PageSpeed can support that.  You would
  configure your cache to treat a GET to
  /purge/foo/bar as a request to purge /foo/bar and
  configure PageSpeed as:

Apache:

ModPagespeedDownstreamCachePurgeLocationPrefix http://CACHE-HOST:PORT/purge
ModPagespeedDownstreamCachePurgeMethod GET

Nginx:

pagespeed DownstreamCachePurgeLocationPrefix http://CACHE-HOST:PORT/purge;
pagespeed DownstreamCachePurgeMethod GET;

Purge Threshold

  Whenever PageSpeed serves an HTML response that is not fully optimized it
  continues rewriting in the background.  When it finishes, if the HTML it
  served was less than 95% optimized, it sends a purge request to the downstream
  cache.  The next request to come in will bypass the cache and come back to
  PageSpeed where it can serve out the now more highly optimized page.  If you
  want to change what point PageSpeed considers the page done and stops
  optimizing, you can set a different value for this threshold.  For example, to
  lower it to 80%, so that PageSpeed is satisfied with a page that is only 80%
  optimized, you would set:

Apache:

ModPagespeedDownstreamCacheRewrittenPercentageThreshold 80

Nginx:

pagespeed DownstreamCacheRewrittenPercentageThreshold 80;

Script Variables

Note: Nginx-only

Note: New feature as of 1.10.33.0

  In ngx_pagespeed DownstreamCachePurgeLocationPrefix,
  DownstreamCachePurgeMethod, and
  DownstreamCacheRewrittenPercentageThreshold support script
  variables, so it's possible to set them on a per-request basis.  Turn this on
  with:

http {
  pagespeed ProcessScriptVariables on;
  ...
}

  You can then use script variables in arguments for these commands:

  pagespeed DownstreamCachePurgeLocationPrefix "$purge_location";
  pagespeed DownstreamCachePurgeMethod "$cache_purge_method";
  pagespeed DownstreamCacheRewrittenPercentageThreshold "$rewrite_threshold";

  For more details on script variables, including how to handle dollar signs,
  see Script Variable Support.

Implementation Details

  To support downstream caching PageSpeed sends a purge request to the caching
  layer whenever it identifies an opportunity for more rewriting to be done on
  content that was just served. Such opportunities could arise because of, say,
  the resources now becoming available in the PageSpeed cache or an image
  compression operation completing. The cache purge forces the next request for
  the HTML file to come all the way to the backend PageSpeed server and obtain
  better rewritten content, which is then stored in the cache. This interaction
  between the PageSpeed server and the downstream caching layer is depicted in
  the diagram given below.

  In the interaction depicted above, note that the partially optimized HTML will
  be served from the cache until a purge request gets sent by the PageSpeed
  server.  It is recommended to set up PageSpeed and the downstream caching
  layer servers on a one to one basis so that the purges can be sent to the
  correct downstream server.


text:
<?php

/**
 * This file is part of TbbcCacheBundle
 *
 * (c) TheBigBrainsCompany <contact@thebigbrainscompany.com>
 *
 */

namespace Tbbc\CacheBundle\Aop\Pointcut;

use CG\Core\ClassUtils;
use Metadata\MetadataFactoryInterface;
use JMS\AopBundle\Aop\PointcutInterface;

/**
 * Class CachePointcut
 *
 * @author Benjamin Dulau <benjamin.dulau@gmail.com>
 */
class CachePointcut implements PointcutInterface
{
    private $metadataFactory;
    private $eligibleClasses = array();

    public function __construct(MetadataFactoryInterface $metadataFactory)
    {
        $this->metadataFactory = $metadataFactory;
    }

    /**
     * {@inheritDoc}
     */
    public function matchesMethod(\ReflectionMethod $method)
    {
        $userClass = ClassUtils::getUserClass($method->class);
        $metadata = $this->metadataFactory->getMetadataForClass($userClass);

        if (null === $metadata) {
            return false;
        }

        return isset($metadata->methodMetadata[$method->name]);
    }

    /**
     * {@inheritDoc}
     */
    public function matchesClass(\ReflectionClass $class)
    {
        foreach ($this->eligibleClasses as $eligibleClass) {
            if ($class->name === $eligibleClass || $class->isSubclassOf($eligibleClass)) {
                return true;
            }
        }

        return false;
    }

    public function setEligibleClasses(array $eligibleClasses)
    {
        $this->eligibleClasses = $eligibleClasses;
    }
}


text:
<component name="libraryTable">
  <library name="Gradle: backport-util-concurrent:backport-util-concurrent:3.1">
    <CLASSES>
      <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/backport-util-concurrent/backport-util-concurrent/3.1/682f7ac17fed79e92f8e87d8455192b63376347b/backport-util-concurrent-3.1.jar!/" />
    </CLASSES>
    <JAVADOC />
    <SOURCES>
      <root url="jar://$USER_HOME$/.gradle/caches/modules-2/files-2.1/backport-util-concurrent/backport-util-concurrent/3.1/eff8366924cf1a666dd20aa632febf1c2c05b8cb/backport-util-concurrent-3.1-sources.jar!/" />
    </SOURCES>
  </library>
</component>


text:
module.exports = function (server) {

  function get() {
    return server.inject({"url": "/"})
      .then(response => {
        const indexPayload = JSON.parse(response.payload);
        indexPayload.greetings = require("./apiGreetings")(server, indexPayload);
        indexPayload.statusCode = response.statusCode;
        indexPayload.get = get;
        return indexPayload;
      });
  }

  const indexResource = {
    "get": get
  };

  return indexResource;
};


text:
use super::prime;
use super::factor;

/// Constant string of the uppercase Phi symbol,
/// often used to represent the totient function.
pub const PHI_SYMBOL: &'static str = "Φ";

// helper function to do the totient calculation
fn totient_calc(n: u64, factors: Vec<u64>) -> u64 {
    let mut totient = n as f64;
    for factor in factors {
        totient *= 1.0 - (1.0 / factor as f64);
    }

    totient as u64
}

/// Calculate the value of Euler's totient function for `n`.
///
/// This function uses Euler's product formula to compute the
/// totient function. This involves factoring `n`, meaning that
/// the computation of the totient function can take a long time
/// if `n` is a large prime or has a large prime factor.
///
/// # Examples
///
/// ```
/// use reikna::totient::totient;
/// assert_eq!(totient(17), 16);
/// assert_eq!(totient(36), 12);
/// ```
pub fn totient(n: u64) -> u64 {
    if n <= 2 {
        return 1;
    }

    if prime::is_prime(n) {
        return n - 1;
    }

    let mut factors = factor::quick_factorize(n);
    factors.dedup();

    totient_calc(n, factors)
}

/// Calculate the value of Euler's totient function for each
/// value in `data`, and return a new `Vec<u64>` of the results.
///
/// The resulting vector has the same size as the input vector.
///
/// The computation of the totient function itself is done
/// through `totient()`, see the documentation for that function
/// for more information.
///
/// # Examples
///
/// ```
/// use reikna::totient::totient_all;
/// assert_eq!(totient_all(vec![1, 2, 3]), vec![1, 1, 2]);
/// assert_eq!(totient_all(vec![81]), vec![54]);
/// ```
pub fn totient_all(data: Vec<u64>) -> Vec<u64> {
    if data.is_empty() {
        return Vec::new();
    }

    let sprimes = prime::prime_sieve(factor::MAX_SMALL_NUM);

    let mut totients: Vec<u64> = Vec::new();

    for n in data {
        if n <= 2 {
            totients.push(1);
        } else if prime::is_prime(n) {
            totients.push(n - 1);
        } else {
            let mut factors = factor::quick_factorize_wsp(n, &sprimes);
            factors.dedup();
            totients.push(totient_calc(n, factors));
        }
    }

    totients
}

#[cfg(test)]
mod tests {
    use super::*;

#[test]
    fn t_totient() {
        assert_eq!(totient(0), 1);
        assert_eq!(totient(1), 1);
        assert_eq!(totient(2), 1);
        assert_eq!(totient(3), 2);
        assert_eq!(totient(4), 2);
        assert_eq!(totient(5), 4);
        assert_eq!(totient(6), 2);
        assert_eq!(totient(7), 6);
        assert_eq!(totient(8), 4);
        assert_eq!(totient(9), 6);
        assert_eq!(totient(99), 60);
        assert_eq!(totient(10_809_483_705_896), 5_404_726_850_224);
    }

#[test]
    fn t_totient_all() {
        assert_eq!(totient_all(vec![]), vec![]);
        assert_eq!(totient_all(vec![45])[0], totient(45));
        assert_eq!(totient_all(vec![134]).len(), 1);
        assert_eq!(totient_all(vec![1, 2, 3, 4]).len(), 4);
        assert_eq!(totient_all(vec![10, 20, 30, 40]), vec![4, 8, 8, 16]);
    }

}


text:
/* $OpenBSD: ocsp.h,v 1.12 2018/03/17 14:44:34 jsing Exp $ */
/* Written by Tom Titchener <Tom_Titchener@groove.net> for the OpenSSL
 * project. */

/* History:
   This file was transfered to Richard Levitte from CertCo by Kathy
   Weinhold in mid-spring 2000 to be included in OpenSSL or released
   as a patch kit. */

/* ====================================================================
 * Copyright (c) 1998-2000 The OpenSSL Project.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.
 *
 * 3. All advertising materials mentioning features or use of this
 *    software must display the following acknowledgment:
 *    "This product includes software developed by the OpenSSL Project
 *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
 *
 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
 *    endorse or promote products derived from this software without
 *    prior written permission. For written permission, please contact
 *    openssl-core@openssl.org.
 *
 * 5. Products derived from this software may not be called "OpenSSL"
 *    nor may "OpenSSL" appear in their names without prior written
 *    permission of the OpenSSL Project.
 *
 * 6. Redistributions of any form whatsoever must retain the following
 *    acknowledgment:
 *    "This product includes software developed by the OpenSSL Project
 *    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
 *
 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
 * OF THE POSSIBILITY OF SUCH DAMAGE.
 * ====================================================================
 *
 * This product includes cryptographic software written by Eric Young
 * (eay@cryptsoft.com).  This product includes software written by Tim
 * Hudson (tjh@cryptsoft.com).
 *
 */

#ifndef HEADER_OCSP_H
#define HEADER_OCSP_H

#include <openssl/ossl_typ.h>
#include <openssl/x509.h>
#include <openssl/x509v3.h>
#include <openssl/safestack.h>

#ifdef  __cplusplus
extern "C" {
#endif

/* Various flags and values */

#define OCSP_DEFAULT_NONCE_LENGTH	16

#define OCSP_NOCERTS			0x1
#define OCSP_NOINTERN			0x2
#define OCSP_NOSIGS			0x4
#define OCSP_NOCHAIN			0x8
#define OCSP_NOVERIFY			0x10
#define OCSP_NOEXPLICIT			0x20
#define OCSP_NOCASIGN			0x40
#define OCSP_NODELEGATED		0x80
#define OCSP_NOCHECKS			0x100
#define OCSP_TRUSTOTHER			0x200
#define OCSP_RESPID_KEY			0x400
#define OCSP_NOTIME			0x800

/*   CertID ::= SEQUENCE {
 *       hashAlgorithm            AlgorithmIdentifier,
 *       issuerNameHash     OCTET STRING, -- Hash of Issuer's DN
 *       issuerKeyHash      OCTET STRING, -- Hash of Issuers public key (excluding the tag & length fields)
 *       serialNumber       CertificateSerialNumber }
 */
typedef struct ocsp_cert_id_st {
	X509_ALGOR *hashAlgorithm;
	ASN1_OCTET_STRING *issuerNameHash;
	ASN1_OCTET_STRING *issuerKeyHash;
	ASN1_INTEGER *serialNumber;
} OCSP_CERTID;

DECLARE_STACK_OF(OCSP_CERTID)

/*   Request ::=     SEQUENCE {
 *       reqCert                    CertID,
 *       singleRequestExtensions    [0] EXPLICIT Extensions OPTIONAL }
 */
typedef struct ocsp_one_request_st {
	OCSP_CERTID *reqCert;
	STACK_OF(X509_EXTENSION) *singleRequestExtensions;
} OCSP_ONEREQ;

DECLARE_STACK_OF(OCSP_ONEREQ)

/*   TBSRequest      ::=     SEQUENCE {
 *       version             [0] EXPLICIT Version DEFAULT v1,
 *       requestorName       [1] EXPLICIT GeneralName OPTIONAL,
 *       requestList             SEQUENCE OF Request,
 *       requestExtensions   [2] EXPLICIT Extensions OPTIONAL }
 */
typedef struct ocsp_req_info_st {
	ASN1_INTEGER *version;
	GENERAL_NAME *requestorName;
	STACK_OF(OCSP_ONEREQ) *requestList;
	STACK_OF(X509_EXTENSION) *requestExtensions;
} OCSP_REQINFO;

/*   Signature       ::=     SEQUENCE {
 *       signatureAlgorithm   AlgorithmIdentifier,
 *       signature            BIT STRING,
 *       certs                [0] EXPLICIT SEQUENCE OF Certificate OPTIONAL }
 */
typedef struct ocsp_signature_st {
	X509_ALGOR *signatureAlgorithm;
	ASN1_BIT_STRING *signature;
	STACK_OF(X509) *certs;
} OCSP_SIGNATURE;

/*   OCSPRequest     ::=     SEQUENCE {
 *       tbsRequest                  TBSRequest,
 *       optionalSignature   [0]     EXPLICIT Signature OPTIONAL }
 */
typedef struct ocsp_request_st {
	OCSP_REQINFO *tbsRequest;
	OCSP_SIGNATURE *optionalSignature; /* OPTIONAL */
} OCSP_REQUEST;

/*   OCSPResponseStatus ::= ENUMERATED {
 *       successful            (0),      --Response has valid confirmations
 *       malformedRequest      (1),      --Illegal confirmation request
 *       internalError         (2),      --Internal error in issuer
 *       tryLater              (3),      --Try again later
 *                                       --(4) is not used
 *       sigRequired           (5),      --Must sign the request
 *       unauthorized          (6)       --Request unauthorized
 *   }
 */
#define OCSP_RESPONSE_STATUS_SUCCESSFUL		0
#define OCSP_RESPONSE_STATUS_MALFORMEDREQUEST	1
#define OCSP_RESPONSE_STATUS_INTERNALERROR	2
#define OCSP_RESPONSE_STATUS_TRYLATER		3
#define OCSP_RESPONSE_STATUS_SIGREQUIRED	5
#define OCSP_RESPONSE_STATUS_UNAUTHORIZED	6

/*   ResponseBytes ::=       SEQUENCE {
 *       responseType   OBJECT IDENTIFIER,
 *       response       OCTET STRING }
 */
typedef struct ocsp_resp_bytes_st {
	ASN1_OBJECT *responseType;
	ASN1_OCTET_STRING *response;
} OCSP_RESPBYTES;

/*   OCSPResponse ::= SEQUENCE {
 *      responseStatus         OCSPResponseStatus,
 *      responseBytes          [0] EXPLICIT ResponseBytes OPTIONAL }
 */
struct ocsp_response_st {
	ASN1_ENUMERATED *responseStatus;
	OCSP_RESPBYTES  *responseBytes;
};

/*   ResponderID ::= CHOICE {
 *      byName   [1] Name,
 *      byKey    [2] KeyHash }
 */
#define V_OCSP_RESPID_NAME 0
#define V_OCSP_RESPID_KEY  1
struct ocsp_responder_id_st {
	int type;
	union {
		X509_NAME* byName;
		ASN1_OCTET_STRING *byKey;
	} value;
};

DECLARE_STACK_OF(OCSP_RESPID)
OCSP_RESPID *OCSP_RESPID_new(void);
void OCSP_RESPID_free(OCSP_RESPID *a);
OCSP_RESPID *d2i_OCSP_RESPID(OCSP_RESPID **a, const unsigned char **in, long len);
int i2d_OCSP_RESPID(OCSP_RESPID *a, unsigned char **out);
extern const ASN1_ITEM OCSP_RESPID_it;

/*   KeyHash ::= OCTET STRING --SHA-1 hash of responder's public key
 *                            --(excluding the tag and length fields)
 */

/*   RevokedInfo ::= SEQUENCE {
 *       revocationTime              GeneralizedTime,
 *       revocationReason    [0]     EXPLICIT CRLReason OPTIONAL }
 */
typedef struct ocsp_revoked_info_st {
	ASN1_GENERALIZEDTIME *revocationTime;
	ASN1_ENUMERATED *revocationReason;
} OCSP_REVOKEDINFO;

/*   CertStatus ::= CHOICE {
 *       good                [0]     IMPLICIT NULL,
 *       revoked             [1]     IMPLICIT RevokedInfo,
 *       unknown             [2]     IMPLICIT UnknownInfo }
 */
#define V_OCSP_CERTSTATUS_GOOD    0
#define V_OCSP_CERTSTATUS_REVOKED 1
#define V_OCSP_CERTSTATUS_UNKNOWN 2
typedef struct ocsp_cert_status_st {
	int type;
	union {
		ASN1_NULL *good;
		OCSP_REVOKEDINFO *revoked;
		ASN1_NULL *unknown;
	} value;
} OCSP_CERTSTATUS;

/*   SingleResponse ::= SEQUENCE {
 *      certID                       CertID,
 *      certStatus                   CertStatus,
 *      thisUpdate                   GeneralizedTime,
 *      nextUpdate           [0]     EXPLICIT GeneralizedTime OPTIONAL,
 *      singleExtensions     [1]     EXPLICIT Extensions OPTIONAL }
 */
typedef struct ocsp_single_response_st {
	OCSP_CERTID *certId;
	OCSP_CERTSTATUS *certStatus;
	ASN1_GENERALIZEDTIME *thisUpdate;
	ASN1_GENERALIZEDTIME *nextUpdate;
	STACK_OF(X509_EXTENSION) *singleExtensions;
} OCSP_SINGLERESP;

DECLARE_STACK_OF(OCSP_SINGLERESP)

/*   ResponseData ::= SEQUENCE {
 *      version              [0] EXPLICIT Version DEFAULT v1,
 *      responderID              ResponderID,
 *      producedAt               GeneralizedTime,
 *      responses                SEQUENCE OF SingleResponse,
 *      responseExtensions   [1] EXPLICIT Extensions OPTIONAL }
 */
typedef struct ocsp_response_data_st {
	ASN1_INTEGER *version;
	OCSP_RESPID  *responderId;
	ASN1_GENERALIZEDTIME *producedAt;
	STACK_OF(OCSP_SINGLERESP) *responses;
	STACK_OF(X509_EXTENSION) *responseExtensions;
} OCSP_RESPDATA;

/*   BasicOCSPResponse       ::= SEQUENCE {
 *      tbsResponseData      ResponseData,
 *      signatureAlgorithm   AlgorithmIdentifier,
 *      signature            BIT STRING,
 *      certs                [0] EXPLICIT SEQUENCE OF Certificate OPTIONAL }
 */
  /* Note 1:
     The value for "signature" is specified in the OCSP rfc2560 as follows:
     "The value for the signature SHALL be computed on the hash of the DER
     encoding ResponseData."  This means that you must hash the DER-encoded
     tbsResponseData, and then run it through a crypto-signing function, which
     will (at least w/RSA) do a hash-'n'-private-encrypt operation.  This seems
     a bit odd, but that's the spec.  Also note that the data structures do not
     leave anywhere to independently specify the algorithm used for the initial
     hash. So, we look at the signature-specification algorithm, and try to do
     something intelligent.	-- Kathy Weinhold, CertCo */
  /* Note 2:
     It seems that the mentioned passage from RFC 2560 (section 4.2.1) is open
     for interpretation.  I've done tests against another responder, and found
     that it doesn't do the double hashing that the RFC seems to say one
     should.  Therefore, all relevant functions take a flag saying which
     variant should be used.	-- Richard Levitte, OpenSSL team and CeloCom */
typedef struct ocsp_basic_response_st {
	OCSP_RESPDATA *tbsResponseData;
	X509_ALGOR *signatureAlgorithm;
	ASN1_BIT_STRING *signature;
	STACK_OF(X509) *certs;
} OCSP_BASICRESP;

/*
 *   CRLReason ::= ENUMERATED {
 *        unspecified             (0),
 *        keyCompromise           (1),
 *        cACompromise            (2),
 *        affiliationChanged      (3),
 *        superseded              (4),
 *        cessationOfOperation    (5),
 *        certificateHold         (6),
 *        removeFromCRL           (8) }
 */
#define OCSP_REVOKED_STATUS_NOSTATUS			-1
#define OCSP_REVOKED_STATUS_UNSPECIFIED			0
#define OCSP_REVOKED_STATUS_KEYCOMPROMISE		1
#define OCSP_REVOKED_STATUS_CACOMPROMISE		2
#define OCSP_REVOKED_STATUS_AFFILIATIONCHANGED		3
#define OCSP_REVOKED_STATUS_SUPERSEDED			4
#define OCSP_REVOKED_STATUS_CESSATIONOFOPERATION	5
#define OCSP_REVOKED_STATUS_CERTIFICATEHOLD		6
#define OCSP_REVOKED_STATUS_REMOVEFROMCRL		8

/* CrlID ::= SEQUENCE {
 *     crlUrl               [0]     EXPLICIT IA5String OPTIONAL,
 *     crlNum               [1]     EXPLICIT INTEGER OPTIONAL,
 *     crlTime              [2]     EXPLICIT GeneralizedTime OPTIONAL }
 */
typedef struct ocsp_crl_id_st {
	ASN1_IA5STRING *crlUrl;
	ASN1_INTEGER *crlNum;
	ASN1_GENERALIZEDTIME *crlTime;
} OCSP_CRLID;

/* ServiceLocator ::= SEQUENCE {
 *      issuer    Name,
 *      locator   AuthorityInfoAccessSyntax OPTIONAL }
 */
typedef struct ocsp_service_locator_st {
	X509_NAME* issuer;
	STACK_OF(ACCESS_DESCRIPTION) *locator;
} OCSP_SERVICELOC;

#define PEM_STRING_OCSP_REQUEST	"OCSP REQUEST"
#define PEM_STRING_OCSP_RESPONSE "OCSP RESPONSE"

#define	PEM_read_bio_OCSP_REQUEST(bp,x,cb) \
    (OCSP_REQUEST *)PEM_ASN1_read_bio((char *(*)())d2i_OCSP_REQUEST, \
	PEM_STRING_OCSP_REQUEST,bp,(char **)x,cb,NULL)

#define	PEM_read_bio_OCSP_RESPONSE(bp,x,cb) \
    (OCSP_RESPONSE *)PEM_ASN1_read_bio((char *(*)())d2i_OCSP_RESPONSE, \
	PEM_STRING_OCSP_RESPONSE,bp,(char **)x,cb,NULL)

#define PEM_write_bio_OCSP_REQUEST(bp,o) \
    PEM_ASN1_write_bio((int (*)())i2d_OCSP_REQUEST,PEM_STRING_OCSP_REQUEST,\
	bp,(char *)o, NULL,NULL,0,NULL,NULL)

#define PEM_write_bio_OCSP_RESPONSE(bp,o) \
    PEM_ASN1_write_bio((int (*)())i2d_OCSP_RESPONSE,PEM_STRING_OCSP_RESPONSE,\
	bp,(char *)o, NULL,NULL,0,NULL,NULL)

#define OCSP_REQUEST_sign(o,pkey,md) \
    ASN1_item_sign(&OCSP_REQINFO_it, \
	o->optionalSignature->signatureAlgorithm,NULL, \
	o->optionalSignature->signature,o->tbsRequest,pkey,md)

#define OCSP_BASICRESP_sign(o,pkey,md,d) \
    ASN1_item_sign(&OCSP_RESPDATA_it,o->signatureAlgorithm,NULL, \
	o->signature,o->tbsResponseData,pkey,md)

#define OCSP_REQUEST_verify(a,r) \
    ASN1_item_verify(&OCSP_REQINFO_it, \
	a->optionalSignature->signatureAlgorithm, \
	a->optionalSignature->signature,a->tbsRequest,r)

#define OCSP_BASICRESP_verify(a,r,d) \
    ASN1_item_verify(&OCSP_RESPDATA_it, \
	a->signatureAlgorithm,a->signature,a->tbsResponseData,r)

#define ASN1_BIT_STRING_digest(data,type,md,len) \
    ASN1_item_digest(&ASN1_BIT_STRING_it,type,data,md,len)

#define OCSP_CERTSTATUS_dup(cs) \
	ASN1_item_dup(&OCSP_CERTSTATUS_it, cs)

OCSP_CERTID *OCSP_CERTID_dup(OCSP_CERTID *id);

OCSP_RESPONSE *OCSP_sendreq_bio(BIO *b, char *path, OCSP_REQUEST *req);
OCSP_REQ_CTX *OCSP_sendreq_new(BIO *io, char *path, OCSP_REQUEST *req,
	    int maxline);
int	OCSP_sendreq_nbio(OCSP_RESPONSE **presp, OCSP_REQ_CTX *rctx);
void	OCSP_REQ_CTX_free(OCSP_REQ_CTX *rctx);
int	OCSP_REQ_CTX_set1_req(OCSP_REQ_CTX *rctx, OCSP_REQUEST *req);
int	OCSP_REQ_CTX_add1_header(OCSP_REQ_CTX *rctx, const char *name,
	    const char *value);

OCSP_CERTID *OCSP_cert_to_id(const EVP_MD *dgst, X509 *subject, X509 *issuer);

OCSP_CERTID *OCSP_cert_id_new(const EVP_MD *dgst, X509_NAME *issuerName,
	    ASN1_BIT_STRING* issuerKey, ASN1_INTEGER *serialNumber);

OCSP_ONEREQ *OCSP_request_add0_id(OCSP_REQUEST *req, OCSP_CERTID *cid);

int	OCSP_request_add1_nonce(OCSP_REQUEST *req, unsigned char *val, int len);
int	OCSP_basic_add1_nonce(OCSP_BASICRESP *resp, unsigned char *val, int len);
int	OCSP_check_nonce(OCSP_REQUEST *req, OCSP_BASICRESP *bs);
int	OCSP_copy_nonce(OCSP_BASICRESP *resp, OCSP_REQUEST *req);

int	OCSP_request_set1_name(OCSP_REQUEST *req, X509_NAME *nm);
int	OCSP_request_add1_cert(OCSP_REQUEST *req, X509 *cert);

int	OCSP_request_sign(OCSP_REQUEST *req, X509 *signer, EVP_PKEY *key,
	    const EVP_MD *dgst, STACK_OF(X509) *certs, unsigned long flags);

int	OCSP_response_status(OCSP_RESPONSE *resp);
OCSP_BASICRESP *OCSP_response_get1_basic(OCSP_RESPONSE *resp);

int	OCSP_resp_count(OCSP_BASICRESP *bs);
OCSP_SINGLERESP *OCSP_resp_get0(OCSP_BASICRESP *bs, int idx);
int	OCSP_resp_find(OCSP_BASICRESP *bs, OCSP_CERTID *id, int last);
int	OCSP_single_get0_status(OCSP_SINGLERESP *single, int *reason,
	    ASN1_GENERALIZEDTIME **revtime, ASN1_GENERALIZEDTIME **thisupd,
	    ASN1_GENERALIZEDTIME **nextupd);
int	OCSP_resp_find_status(OCSP_BASICRESP *bs, OCSP_CERTID *id, int *status,
	    int *reason, ASN1_GENERALIZEDTIME **revtime,
	    ASN1_GENERALIZEDTIME **thisupd, ASN1_GENERALIZEDTIME **nextupd);
int	OCSP_check_validity(ASN1_GENERALIZEDTIME *thisupd,
	    ASN1_GENERALIZEDTIME *nextupd, long sec, long maxsec);

int	OCSP_request_verify(OCSP_REQUEST *req, STACK_OF(X509) *certs,
	    X509_STORE *store, unsigned long flags);

int	OCSP_parse_url(char *url, char **phost, char **pport, char **ppath,
	    int *pssl);

int	OCSP_id_issuer_cmp(OCSP_CERTID *a, OCSP_CERTID *b);
int	OCSP_id_cmp(OCSP_CERTID *a, OCSP_CERTID *b);

int	OCSP_request_onereq_count(OCSP_REQUEST *req);
OCSP_ONEREQ *OCSP_request_onereq_get0(OCSP_REQUEST *req, int i);
OCSP_CERTID *OCSP_onereq_get0_id(OCSP_ONEREQ *one);
int	OCSP_id_get0_info(ASN1_OCTET_STRING **piNameHash, ASN1_OBJECT **pmd,
	    ASN1_OCTET_STRING **pikeyHash, ASN1_INTEGER **pserial,
	    OCSP_CERTID *cid);
int	OCSP_request_is_signed(OCSP_REQUEST *req);
OCSP_RESPONSE *OCSP_response_create(int status, OCSP_BASICRESP *bs);
OCSP_SINGLERESP *OCSP_basic_add1_status(OCSP_BASICRESP *rsp, OCSP_CERTID *cid,
	    int status, int reason, ASN1_TIME *revtime, ASN1_TIME *thisupd,
	    ASN1_TIME *nextupd);
int	OCSP_basic_add1_cert(OCSP_BASICRESP *resp, X509 *cert);
int	OCSP_basic_sign(OCSP_BASICRESP *brsp, X509 *signer, EVP_PKEY *key,
	    const EVP_MD *dgst, STACK_OF(X509) *certs, unsigned long flags);

X509_EXTENSION *OCSP_crlID_new(char *url, long *n, char *tim);

X509_EXTENSION *OCSP_accept_responses_new(char **oids);

X509_EXTENSION *OCSP_archive_cutoff_new(char* tim);

X509_EXTENSION *OCSP_url_svcloc_new(X509_NAME* issuer, char **urls);

int	OCSP_REQUEST_get_ext_count(OCSP_REQUEST *x);
int	OCSP_REQUEST_get_ext_by_NID(OCSP_REQUEST *x, int nid, int lastpos);
int	OCSP_REQUEST_get_ext_by_OBJ(OCSP_REQUEST *x, ASN1_OBJECT *obj,
	    int lastpos);
int	OCSP_REQUEST_get_ext_by_critical(OCSP_REQUEST *x, int crit,
	    int lastpos);
X509_EXTENSION *OCSP_REQUEST_get_ext(OCSP_REQUEST *x, int loc);
X509_EXTENSION *OCSP_REQUEST_delete_ext(OCSP_REQUEST *x, int loc);
void *OCSP_REQUEST_get1_ext_d2i(OCSP_REQUEST *x, int nid, int *crit, int *idx);
int	OCSP_REQUEST_add1_ext_i2d(OCSP_REQUEST *x, int nid, void *value,
	    int crit, unsigned long flags);
int	OCSP_REQUEST_add_ext(OCSP_REQUEST *x, X509_EXTENSION *ex, int loc);

int	OCSP_ONEREQ_get_ext_count(OCSP_ONEREQ *x);
int	OCSP_ONEREQ_get_ext_by_NID(OCSP_ONEREQ *x, int nid, int lastpos);
int	OCSP_ONEREQ_get_ext_by_OBJ(OCSP_ONEREQ *x, ASN1_OBJECT *obj,
	    int lastpos);
int	OCSP_ONEREQ_get_ext_by_critical(OCSP_ONEREQ *x, int crit, int lastpos);
X509_EXTENSION *OCSP_ONEREQ_get_ext(OCSP_ONEREQ *x, int loc);
X509_EXTENSION *OCSP_ONEREQ_delete_ext(OCSP_ONEREQ *x, int loc);
void *OCSP_ONEREQ_get1_ext_d2i(OCSP_ONEREQ *x, int nid, int *crit, int *idx);
int	OCSP_ONEREQ_add1_ext_i2d(OCSP_ONEREQ *x, int nid, void *value, int crit,
	    unsigned long flags);
int	OCSP_ONEREQ_add_ext(OCSP_ONEREQ *x, X509_EXTENSION *ex, int loc);

int	OCSP_BASICRESP_get_ext_count(OCSP_BASICRESP *x);
int	OCSP_BASICRESP_get_ext_by_NID(OCSP_BASICRESP *x, int nid, int lastpos);
int	OCSP_BASICRESP_get_ext_by_OBJ(OCSP_BASICRESP *x, ASN1_OBJECT *obj,
	    int lastpos);
int	OCSP_BASICRESP_get_ext_by_critical(OCSP_BASICRESP *x, int crit,
	    int lastpos);
X509_EXTENSION *OCSP_BASICRESP_get_ext(OCSP_BASICRESP *x, int loc);
X509_EXTENSION *OCSP_BASICRESP_delete_ext(OCSP_BASICRESP *x, int loc);
void *OCSP_BASICRESP_get1_ext_d2i(OCSP_BASICRESP *x, int nid, int *crit,
	    int *idx);
int	OCSP_BASICRESP_add1_ext_i2d(OCSP_BASICRESP *x, int nid, void *value,
	    int crit, unsigned long flags);
int	OCSP_BASICRESP_add_ext(OCSP_BASICRESP *x, X509_EXTENSION *ex, int loc);

int	OCSP_SINGLERESP_get_ext_count(OCSP_SINGLERESP *x);
int	OCSP_SINGLERESP_get_ext_by_NID(OCSP_SINGLERESP *x, int nid,
	    int lastpos);
int	OCSP_SINGLERESP_get_ext_by_OBJ(OCSP_SINGLERESP *x, ASN1_OBJECT *obj,
	    int lastpos);
int	OCSP_SINGLERESP_get_ext_by_critical(OCSP_SINGLERESP *x, int crit,
	    int lastpos);
X509_EXTENSION *OCSP_SINGLERESP_get_ext(OCSP_SINGLERESP *x, int loc);
X509_EXTENSION *OCSP_SINGLERESP_delete_ext(OCSP_SINGLERESP *x, int loc);
void *OCSP_SINGLERESP_get1_ext_d2i(OCSP_SINGLERESP *x, int nid, int *crit,
	    int *idx);
int	OCSP_SINGLERESP_add1_ext_i2d(OCSP_SINGLERESP *x, int nid, void *value,
	    int crit, unsigned long flags);
int	OCSP_SINGLERESP_add_ext(OCSP_SINGLERESP *x, X509_EXTENSION *ex,
	    int loc);
const OCSP_CERTID *OCSP_SINGLERESP_get0_id(const OCSP_SINGLERESP *x);

OCSP_SINGLERESP *OCSP_SINGLERESP_new(void);
void OCSP_SINGLERESP_free(OCSP_SINGLERESP *a);
OCSP_SINGLERESP *d2i_OCSP_SINGLERESP(OCSP_SINGLERESP **a, const unsigned char **in, long len);
int i2d_OCSP_SINGLERESP(OCSP_SINGLERESP *a, unsigned char **out);
extern const ASN1_ITEM OCSP_SINGLERESP_it;
OCSP_CERTSTATUS *OCSP_CERTSTATUS_new(void);
void OCSP_CERTSTATUS_free(OCSP_CERTSTATUS *a);
OCSP_CERTSTATUS *d2i_OCSP_CERTSTATUS(OCSP_CERTSTATUS **a, const unsigned char **in, long len);
int i2d_OCSP_CERTSTATUS(OCSP_CERTSTATUS *a, unsigned char **out);
extern const ASN1_ITEM OCSP_CERTSTATUS_it;
OCSP_REVOKEDINFO *OCSP_REVOKEDINFO_new(void);
void OCSP_REVOKEDINFO_free(OCSP_REVOKEDINFO *a);
OCSP_REVOKEDINFO *d2i_OCSP_REVOKEDINFO(OCSP_REVOKEDINFO **a, const unsigned char **in, long len);
int i2d_OCSP_REVOKEDINFO(OCSP_REVOKEDINFO *a, unsigned char **out);
extern const ASN1_ITEM OCSP_REVOKEDINFO_it;
OCSP_BASICRESP *OCSP_BASICRESP_new(void);
void OCSP_BASICRESP_free(OCSP_BASICRESP *a);
OCSP_BASICRESP *d2i_OCSP_BASICRESP(OCSP_BASICRESP **a, const unsigned char **in, long len);
int i2d_OCSP_BASICRESP(OCSP_BASICRESP *a, unsigned char **out);
extern const ASN1_ITEM OCSP_BASICRESP_it;
OCSP_RESPDATA *OCSP_RESPDATA_new(void);
void OCSP_RESPDATA_free(OCSP_RESPDATA *a);
OCSP_RESPDATA *d2i_OCSP_RESPDATA(OCSP_RESPDATA **a, const unsigned char **in, long len);
int i2d_OCSP_RESPDATA(OCSP_RESPDATA *a, unsigned char **out);
extern const ASN1_ITEM OCSP_RESPDATA_it;
OCSP_RESPID *OCSP_RESPID_new(void);
void OCSP_RESPID_free(OCSP_RESPID *a);
OCSP_RESPID *d2i_OCSP_RESPID(OCSP_RESPID **a, const unsigned char **in, long len);
int i2d_OCSP_RESPID(OCSP_RESPID *a, unsigned char **out);
extern const ASN1_ITEM OCSP_RESPID_it;
OCSP_RESPONSE *OCSP_RESPONSE_new(void);
void OCSP_RESPONSE_free(OCSP_RESPONSE *a);
OCSP_RESPONSE *d2i_OCSP_RESPONSE(OCSP_RESPONSE **a, const unsigned char **in, long len);
int i2d_OCSP_RESPONSE(OCSP_RESPONSE *a, unsigned char **out);
OCSP_RESPONSE *d2i_OCSP_RESPONSE_bio(BIO *bp, OCSP_RESPONSE **a);
int i2d_OCSP_RESPONSE_bio(BIO *bp, OCSP_RESPONSE *a);
extern const ASN1_ITEM OCSP_RESPONSE_it;
OCSP_RESPBYTES *OCSP_RESPBYTES_new(void);
void OCSP_RESPBYTES_free(OCSP_RESPBYTES *a);
OCSP_RESPBYTES *d2i_OCSP_RESPBYTES(OCSP_RESPBYTES **a, const unsigned char **in, long len);
int i2d_OCSP_RESPBYTES(OCSP_RESPBYTES *a, unsigned char **out);
extern const ASN1_ITEM OCSP_RESPBYTES_it;
OCSP_ONEREQ *OCSP_ONEREQ_new(void);
void OCSP_ONEREQ_free(OCSP_ONEREQ *a);
OCSP_ONEREQ *d2i_OCSP_ONEREQ(OCSP_ONEREQ **a, const unsigned char **in, long len);
int i2d_OCSP_ONEREQ(OCSP_ONEREQ *a, unsigned char **out);
extern const ASN1_ITEM OCSP_ONEREQ_it;
OCSP_CERTID *OCSP_CERTID_new(void);
void OCSP_CERTID_free(OCSP_CERTID *a);
OCSP_CERTID *d2i_OCSP_CERTID(OCSP_CERTID **a, const unsigned char **in, long len);
int i2d_OCSP_CERTID(OCSP_CERTID *a, unsigned char **out);
extern const ASN1_ITEM OCSP_CERTID_it;
OCSP_REQUEST *OCSP_REQUEST_new(void);
void OCSP_REQUEST_free(OCSP_REQUEST *a);
OCSP_REQUEST *d2i_OCSP_REQUEST(OCSP_REQUEST **a, const unsigned char **in, long len);
int i2d_OCSP_REQUEST(OCSP_REQUEST *a, unsigned char **out);
OCSP_REQUEST *d2i_OCSP_REQUEST_bio(BIO *bp, OCSP_REQUEST **a);
int i2d_OCSP_REQUEST_bio(BIO *bp, OCSP_REQUEST *a);
extern const ASN1_ITEM OCSP_REQUEST_it;
OCSP_SIGNATURE *OCSP_SIGNATURE_new(void);
void OCSP_SIGNATURE_free(OCSP_SIGNATURE *a);
OCSP_SIGNATURE *d2i_OCSP_SIGNATURE(OCSP_SIGNATURE **a, const unsigned char **in, long len);
int i2d_OCSP_SIGNATURE(OCSP_SIGNATURE *a, unsigned char **out);
extern const ASN1_ITEM OCSP_SIGNATURE_it;
OCSP_REQINFO *OCSP_REQINFO_new(void);
void OCSP_REQINFO_free(OCSP_REQINFO *a);
OCSP_REQINFO *d2i_OCSP_REQINFO(OCSP_REQINFO **a, const unsigned char **in, long len);
int i2d_OCSP_REQINFO(OCSP_REQINFO *a, unsigned char **out);
extern const ASN1_ITEM OCSP_REQINFO_it;
OCSP_CRLID *OCSP_CRLID_new(void);
void OCSP_CRLID_free(OCSP_CRLID *a);
OCSP_CRLID *d2i_OCSP_CRLID(OCSP_CRLID **a, const unsigned char **in, long len);
int i2d_OCSP_CRLID(OCSP_CRLID *a, unsigned char **out);
extern const ASN1_ITEM OCSP_CRLID_it;
OCSP_SERVICELOC *OCSP_SERVICELOC_new(void);
void OCSP_SERVICELOC_free(OCSP_SERVICELOC *a);
OCSP_SERVICELOC *d2i_OCSP_SERVICELOC(OCSP_SERVICELOC **a, const unsigned char **in, long len);
int i2d_OCSP_SERVICELOC(OCSP_SERVICELOC *a, unsigned char **out);
extern const ASN1_ITEM OCSP_SERVICELOC_it;

const char *OCSP_response_status_str(long s);
const char *OCSP_cert_status_str(long s);
const char *OCSP_crl_reason_str(long s);

int	OCSP_REQUEST_print(BIO *bp, OCSP_REQUEST* a, unsigned long flags);
int	OCSP_RESPONSE_print(BIO *bp, OCSP_RESPONSE* o, unsigned long flags);

int	OCSP_basic_verify(OCSP_BASICRESP *bs, STACK_OF(X509) *certs,
	    X509_STORE *st, unsigned long flags);

/* BEGIN ERROR CODES */
/* The following lines are auto generated by the script mkerr.pl. Any changes
 * made after this point may be overwritten when the script is next run.
 */
void ERR_load_OCSP_strings(void);

/* Error codes for the OCSP functions. */

/* Function codes. */
#define OCSP_F_ASN1_STRING_ENCODE			 100
#define OCSP_F_D2I_OCSP_NONCE				 102
#define OCSP_F_OCSP_BASIC_ADD1_STATUS			 103
#define OCSP_F_OCSP_BASIC_SIGN				 104
#define OCSP_F_OCSP_BASIC_VERIFY			 105
#define OCSP_F_OCSP_CERT_ID_NEW				 101
#define OCSP_F_OCSP_CHECK_DELEGATED			 106
#define OCSP_F_OCSP_CHECK_IDS				 107
#define OCSP_F_OCSP_CHECK_ISSUER			 108
#define OCSP_F_OCSP_CHECK_VALIDITY			 115
#define OCSP_F_OCSP_MATCH_ISSUERID			 109
#define OCSP_F_OCSP_PARSE_URL				 114
#define OCSP_F_OCSP_REQUEST_SIGN			 110
#define OCSP_F_OCSP_REQUEST_VERIFY			 116
#define OCSP_F_OCSP_RESPONSE_GET1_BASIC			 111
#define OCSP_F_OCSP_SENDREQ_BIO				 112
#define OCSP_F_OCSP_SENDREQ_NBIO			 117
#define OCSP_F_PARSE_HTTP_LINE1				 118
#define OCSP_F_REQUEST_VERIFY				 113

/* Reason codes. */
#define OCSP_R_BAD_DATA					 100
#define OCSP_R_CERTIFICATE_VERIFY_ERROR			 101
#define OCSP_R_DIGEST_ERR				 102
#define OCSP_R_ERROR_IN_NEXTUPDATE_FIELD		 122
#define OCSP_R_ERROR_IN_THISUPDATE_FIELD		 123
#define OCSP_R_ERROR_PARSING_URL			 121
#define OCSP_R_MISSING_OCSPSIGNING_USAGE		 103
#define OCSP_R_NEXTUPDATE_BEFORE_THISUPDATE		 124
#define OCSP_R_NOT_BASIC_RESPONSE			 104
#define OCSP_R_NO_CERTIFICATES_IN_CHAIN			 105
#define OCSP_R_NO_CONTENT				 106
#define OCSP_R_NO_PUBLIC_KEY				 107
#define OCSP_R_NO_RESPONSE_DATA				 108
#define OCSP_R_NO_REVOKED_TIME				 109
#define OCSP_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE	 110
#define OCSP_R_REQUEST_NOT_SIGNED			 128
#define OCSP_R_RESPONSE_CONTAINS_NO_REVOCATION_DATA	 111
#define OCSP_R_ROOT_CA_NOT_TRUSTED			 112
#define OCSP_R_SERVER_READ_ERROR			 113
#define OCSP_R_SERVER_RESPONSE_ERROR			 114
#define OCSP_R_SERVER_RESPONSE_PARSE_ERROR		 115
#define OCSP_R_SERVER_WRITE_ERROR			 116
#define OCSP_R_SIGNATURE_FAILURE			 117
#define OCSP_R_SIGNER_CERTIFICATE_NOT_FOUND		 118
#define OCSP_R_STATUS_EXPIRED				 125
#define OCSP_R_STATUS_NOT_YET_VALID			 126
#define OCSP_R_STATUS_TOO_OLD				 127
#define OCSP_R_UNKNOWN_MESSAGE_DIGEST			 119
#define OCSP_R_UNKNOWN_NID				 120
#define OCSP_R_UNSUPPORTED_REQUESTORNAME_TYPE		 129

#ifdef  __cplusplus
}
#endif
#endif


text:
Please
======

Please is a simple assertion library for [Wren](https://wren.io/). It works with Wren 0.3.0 as of now.

Basic usage
-----------

```dart
import "please" for Please

Please.equal(123, 123)
Please.notEqual(456, 789)

Please.deepEqual([1, [2, 3]], [1, [2, 3]])

Please.succeed { "Hello" + "nation" }
Please.fail { 123.badMethod }

Please.beNull(null)
Please.exist(anythingOtherThanNull)

Please.beTruthy(true)
Please.beTruthy(123)
Please.beFalsy(false)
Please.beFalsy(null)
```

Hacking on this
---------------

To run tests, run this:

```sh
wren_cli test.wren
```


text:
"""Classes and functions for accessing Helsinki area traffic data for more info
 see http://developer.reittiopas.fi/pages/en/http-get-interface.php"""
# -*- coding: utf-8 -*-
from collections import defaultdict
from datetime import datetime
from pytz import timezone
from requests import get, exceptions

class HslUrls(object):
    """Helper class for building up HSL urls"""

    def __init__(self, user, password):
        """
        Initializer
        :param user: username registered for HSL API
        :param password: associated password
        """
        self.user = user
        self.password = password
        self.baseurl = "http://api.reittiopas.fi/hsl/prod/?request="

    def nearby_stops(self, longitude, latitude):
        """Get an URL to request nearby bus stops
        :param longitude: longitude of the location
        :param latitude: latitude of the location
        :return: URL
        """
        url = "%sstops_area&epsg_in=4326&" \
              "center_coordinate=%s,%s&user=%s&pass=%s" % \
              (self.baseurl, latitude, longitude, self.user, self.password)
        return url

    def stop_info(self, stop_code):
        """
        Get an URL to fetch information about a bus stop
        :param stop_code: code of the stop
        :return: URL
        """
        url = "%sstop&epsg_out=4326&code=%s&user=%s&pass=%s" % (
            self.baseurl, stop_code, self.user, self.password)
        return url

    def multiple_stop_info(self, stop_codes):
        """
        Get an URL to fetch information about a bus stop
        :param stop_code: code of the stop
        :return: URL
        """
        code_str = "&code=".join([str(x) for x in stop_codes])
        url = "%sstop&epsg_out=4326&code=%s&user=%s&pass=%s" % (
            self.baseurl, code_str, self.user, self.password)
        return url

    def lines_info(self, lines):
        """
        Builds up URL to query line info
        :param lines: array of stop codes
        :return: URL
        """
        lines_str = "|".join(lines)
        url = "%slines&epsg_out=4326&query=%s&user=%s&pass=%s" % (
            self.baseurl, lines_str, self.user, self.password)
        return url

    def geocode_address(self, query):
        """
        Builds up URL to search for stops around a search term
        (API recognizes places, addresses etc.
        api.reittiopas.fi/hsl/prod/?request=geocode&key=
        :param query: search term
        """
        url = "%sgeocode&key=%s&user=%s&pass=%s" % (self.baseurl,
                                                    query, self.user,
                                                    self.password)
        return url

def hsl_time_to_time(hsltime):
    """
    Converts HSL API timestamp to hh:dd format
    :param hsltime: HSL API timestamp (hour maybe bigger than 24!)
    :return: timestamp in hh:dd format
    """
    return "%02d.%02d" % (hsltime / 100 % 24, hsltime % 100)

# 1 = Helsinki internal bus lines
# 2 = trams
# 3 = Espoo internal bus lines
# 4 = Vantaa internal bus lines
# 5 = regional bus lines
# 6 = metro
# 7 = ferry
# 8 = U-lines
# 12 = commuter trains
# 21 = Helsinki service lines
# 22 = Helsinki night buses
# 23 = Espoo service lines
# 24 = Vantaa service lines
# 25 = region night buses
# 36 = Kirkkonummi internal bus lines
# 39 = Kerava internal bus lines
def vehicle_emoji(veh):
    """Maps a vehicle type id to an emoji
    :param veh: vehicle type id
    :return: vehicle type emoji
    """
    if veh == 2:
        return u"\U0001F68B"
    elif veh == 6:
        return u"\U0001f687"
    elif veh == 7:
        return u"\U000026F4"
    elif veh == 12:
        return u"\U0001F686"
    else:
        return u"\U0001F68C"

# 1 = Helsinki internal bus lines
# 2 = trams
# 3 = Espoo internal bus lines
# 4 = Vantaa internal bus lines
# 5 = regional bus lines
# 6 = metro
# 7 = ferry
# 8 = U-lines
# 12 = commuter trains
# 21 = Helsinki service lines
# 22 = Helsinki night buses
# 23 = Espoo service lines
# 24 = Vantaa service lines
# 25 = region night buses
# 36 = Kirkkonummi internal bus lines
# 39 = Kerava internal bus lines
def vehicle_map(veh):
    """Maps a vehicle type id to a name
    :param veh: vehicle type id
    :return: vehicle type name
    """
    if veh == 2:
        return "Tram"
    elif veh == 6:
        return "Metro"
    elif veh == 7:
        return "Ferry"
    elif veh == 12:
        return "Train"
    else:
        return "Bus"

def relative_minutes(stoptime, comparison_time=None):
    """
    Change timestamp of HSL API to relative time
    :param stoptime: API timestamp for a vehicle passing a stop
     (note that hour can be more than 24!)
    :param comparison_time: datetime to compare the departure time to
    if None use current timestamp
    :return:
    """
    if comparison_time:
        usertime = comparison_time
    else:
        usertime = datetime.now(tz=timezone("Europe/Helsinki"))
    sth = stoptime / 100
    if sth >= 24 and usertime.hour < 12:
        nowagg = (usertime.hour + 24) * 60 + usertime.minute
    else:
        nowagg = usertime.hour * 60 + usertime.minute
    stm = stoptime % 100
    stoptimeagg = sth * 60 + stm
    delta = stoptimeagg - nowagg
    if delta == 0:
        return "Right now"
    else:
        return "in %d minutes" % (delta)

class HslRequests(object):
    """Class for making requests to HSL API"""

    def __init__(self, user, password):
        """
        Initializer
        :param user: HSL API username
        :param password: HSL API password
        """
        self.urls = HslUrls(user, password)
        self.last_error = None

    def stop_summary(self, stop_code, buses=3):
        """
        Provides an summary of bus stop information including departures
        :param stop_code: HSL API stop code
        :return: String containing bus and departures info
        """
        (stop_info, line_data) = self._stop_info_lines_info(stop_code)
        stop = stop_info[0]
        if line_data:
            lines = dict(
                [(x["code"], "%s %s" % (x["code_short"], x["line_end"])) for x
                 in line_data])
        else:
            return ("Helsinki area has no such stop.",
                    "Helsinki area has no such stop.")

        stop_line = stop["code_short"] + " " + stop["name_fi"] + " " \
                    + stop["address_fi"]

        if stop["departures"]:
            departure_line = "\n".join(
                ["%s %s" % (hsl_time_to_time(x["time"]), lines[x["code"]]) for x
                 in stop["departures"][:buses]])
        else:
            departure_line = ""

        return "\n".join([stop_line, departure_line])

    def relative_time(self, stop_code, buses=3, end_line=""):
        """
        Provides an summary of bus stop information including departures
        used by the Alexa skill and Telegram bot
        :param buses: how many buses(or trams, ferries) to return
        :param stop_code: HSL API stop code
        :return: String containing bus and departures info
        """
        (stop_info, linfo) = self._stop_info_lines_info(stop_code)
        sinfo = stop_info[0]
        if linfo:
            lines = dict([(x["code"], "%s %s" % (
                vehicle_map(x["transport_type_id"]), x["code_short"])) for x in
                          linfo])
            summary_lines = dict(
                [(x["code"], "%s %s %s" % (
                    x["code_short"], vehicle_emoji(x["transport_type_id"]),
                    x["line_end"])) for x
                 in linfo])
        else:
            return ("Helsinki area has no such stop.",
                    "Helsinki area has no such stop.",
                    None)

        actual_code = sinfo["code_short"]
        stop_line = u"For stop {0:s}".format(actual_code)
        card_stop_line = sinfo["name_fi"] + " " \
                         + sinfo["address_fi"]

        all_departures = sorted(
            reduce(lambda x, y: x + y, [x["departures"] for x in stop_info]),
            key=lambda x: x['time'])

        if all_departures and len(all_departures) > 0:
            departure_line = (
                ["%s %s" % (lines[x["code"]], relative_minutes(x["time"])) for x
                 in
                 all_departures[:buses]])
            summary_line = "\n".join(
                ["%s %s" % (
                    hsl_time_to_time(x["time"]), summary_lines[x["code"]]) for x
                 in
                 all_departures[:buses]])
        else:
            departure_line = ["No departures within next 60 minutes"]
            summary_line = "No departures within next 60 minutes"

        if len(departure_line) == 1:
            speech = "%s: %s" % (stop_line, departure_line[0])
        elif len(departure_line) == 2:
            speech = "%s: Next departures are %s and %s" % (
                stop_line, departure_line[0], departure_line[1])
        elif len(departure_line) == 3:
            speech = "%s: Next departures are %s, %s, and %s" % (
                stop_line, departure_line[0], departure_line[1],
                departure_line[2])
        else:
            speech = "%s: Next departures are %s" % (
                stop_line, ",".join(departure_line))
        card = "\n".join([card_stop_line + end_line, summary_line])

        return (speech, card, actual_code)

    def _stop_info_lines_info(self, stop_code):
        """
        Helper function
        :param stop_code: HSL API bus stop code
        """
        try:
            stop_info = self._stop_info_json(stop_code)
        except:
            stop_info = "Error"
        if stop_info == "Error":
            return "Error", None
        lines_info = self._lines_info(_stop_buses(stop_info))
        return (stop_info, lines_info)

    def _stop_info_json(self, stop_code):
        """
        Helper function
        :param stop_code: HSL API bus stop code
        """
        url = self.urls.stop_info(stop_code)
        try:
            response = get(url)
        except exceptions.RequestException:
            return "Error"
        return response.json()

    def _lines_info(self, lines):
        """
        Helper function to fetch line information of listed lines
        :param lines: list of HSL API line codes
        """
        url = self.urls.lines_info(lines)
        try:
            response = get(url)
        except exceptions.RequestException:
            return "Error"
        return response.json()

    def stop_lines_summary(self, stop_code):
        """Return bus code, name, address, and lines going from this stop
        :param stop_code: HSL API stop code
        :return: comma separated string of stop info
        """
        (stop_info, linfo) = self._stop_info_lines_info(stop_code)
        sinfo = stop_info[0]

        if linfo:
            linecodes = dict([(x["code"], x["code_short"]) for x in linfo])
        else:
            return "Helsinki area has no bus stop " + stop_code

        dld = dict([x.split(":") for x in sinfo["lines"]])

        stop_line = sinfo["code_short"] + " " + sinfo["name_fi"] + " " + sinfo[
            "address_fi"]
        ends_lines = [(dld[k].split(",")[0], linecodes[k]) for k in dld.keys()]

        ddl = defaultdict(list)

        for last, code in ends_lines:
            ddl[last].append(code)

        sumsum = ", ".join(
            ["%s %s" % (", ".join(sorted(ddl[k])), k) for k in
             sorted(ddl.keys())])

        return "\n".join([stop_line, sumsum])

    def _location_stops(self, longitude, latitude):
        """
        Fetch stops at location using HSL API
        :param longitude: longitude of the location
        :param latitude: latitude of the location
        :return: new line separted list of close by stops
        """
        url = self.urls.nearby_stops(longitude, latitude)
        try:
            response = get(url)
        except exceptions.RequestException:
            return "Error"
        return response.json()

    def _search_result_stops(self, query):
        """
        Fetch stops by search term
        :param query:
        :return: JSON returned from HSL API
        """
        url = self.urls.geocode_address(query)
        try:
            response = get(url)
        except exceptions.RequestException:
            return "Error"
        return response.json()

    def stops_for_query(self, query):
        """
        Return
        :param query:
        """
        stops = self._search_result_stops(query)

        if stops == "Error":
            return "No stops nearby this location"

        return ("\n".join(
            ["%s %s %s" % (
                x["details"]["shortCode"], x["name"], x["details"]["address"])
             for x
             in
             stops if x["locType"] == "stop"]),
                ["%s" % x["details"]["shortCode"] for x in stops if
                 x["locType"] == "stop"])

    def stops_for_location(self, longitude, latitude):
        """
        Get stops at location
        :param longitude: longitude of the location
        :param latitude: latitude of the location
        :return: new line separted list of close by stops
        """
        stops = self._location_stops(longitude, latitude)

        if stops == "Error":
            return "No stops nearby this location"

        return ("\n".join(
            ["%s %s %s %dm" % (x["codeShort"], x["name"], x["address"], x["dist"]) for x in
             stops]), ["%s" % x["codeShort"] for x in stops])

def city_code(city):
    """
    :param city: city is a custom slot type in the alexa skill configuration
    possible values are:
    Helsinki
    Helsingfors
    Espoo
    Esbo
    Vantaa
    Vanda
    Kauniainen
    Grankulla
    :return: a short code is in HSL bus stops. "" for Helsinki, "E" for Espoo
    "V" for Vantaa and "Ka" for Kauniainen
    """
    lc_city = city.lower()
    if lc_city == "helsinki" or lc_city == "helsingfors":
        return ""
    elif lc_city == "espoo" or lc_city == "esbo":
        return "E"
    elif lc_city == "vantaa" or lc_city == "vanda":
        return "V"
    elif lc_city == "kauniainen" or lc_city == "grankulla":
        return "Ka"
    else:  # silently default to Helsinki
        return ""

def normalize_stopcode(code):
    """
    Make stopcode a four digit, zero padded string
    :param code: raw cod
    :return: normalized code
    """
    return format(int(code), '04')

def _stop_buses(json):
    """
    Helper function for enumerating buses going through the stop
    :param json: HSL API bus stop code
    """
    # lines = json[0]["lines"]
    lines = reduce(lambda x, y: x + y, [x["lines"] for x in json])
    return [x.split(":")[0] for x in lines]


text:
body{
	background: url("https://static.planetminecraft.com/files/resource_media/screenshot/1316/ricks_minecraft_tales_derp_face_by_rickkmurray-d4h8yw3-1_5281985_lrg.jpg");
	background-position: center;
	padding-left: 45px;
	padding-right: 45px;
	font-size: 100%;
}
.title{
	margin: 10px;
	border:solid 3px #e6eeff;
	display: block center;
	text-align: center;
	font-family: 'Lemonada', cursive;
}
.info{
	margin: auto;
    width: 50%;
    border: 3px solid black;
    padding: 45px;
    text-align: center;
    background-color: transparent;
    font-family: 'Hind', sans-serif;

}
button {
  display: inline-block;
  padding: 15px 25px;
  font-size: 24px;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  outline: none;
  color: black;
  background-color: white;
  border: none;
  border-radius: 15px;
  box-shadow: 0 9px #999;
}

button:hover {background-color: #f2f2f2}

button:active {
  background-color: #f2f2f2;
  box-shadow: 0 5px #666;
  transform: translateY(4px);
}
h2{
  color:white;
}


text:
namespace TamTam.Models.YouTube.Result
{
    public class PageInfo
    {
        public int totalResults { get; set; }
        public int resultsPerPage { get; set; }
    }
}


text:
package edu.uci.ics.hyracks.algebricks.rewriter.rules;

import java.util.List;

import edu.uci.ics.hyracks.algebricks.core.algebra.base.IOptimizationContext;
import edu.uci.ics.hyracks.algebricks.core.algebra.base.LogicalVariable;
import edu.uci.ics.hyracks.algebricks.core.algebra.operators.logical.GroupByOperator;

public class IntroduceGroupByCombinerRule extends AbstractIntroduceGroupByCombinerRule {

    @Override
    protected void processNullTest(IOptimizationContext context, GroupByOperator nestedGby,
            List<LogicalVariable> aggregateVarsProducedByCombiner) {
        /** The default introduce group-by combiner rule ignores null test, however a language implementor can decide their own semantics. */
    }

}


text:
set -o xtrace  # Print command traces before executing command

SOURCE_BRANCH="master"
TARGET_BRANCH="gh-pages"
HTML_DIRECTORY="doc/_build/html"
DOC_REPO_DIRECTORY="gh-pages"

# When HEAD is tagged and the tag indicates a releasable
# version (eg v1.2.3), then VERSION is that tag. Otherwise,
# it is an empty string.
VERSION=$(git describe --always | grep '^v[0-9]\+\.[0-9]\+\.[0-9]\+$')

# Pull requests and commits to other branches should not deploy
# Deploy when master is tagged with a releasable version tag
if [[ -z $VERSION ]] || \
   [[ "$TRAVIS_PULL_REQUEST" != "false" ]] || \
   [[ "$TRAVIS_BRANCH" != "$SOURCE_BRANCH" ]]; then
    echo "Not deploying documentation"
    exit 0
fi

set -e # Exit with nonzero exit code if anything fails
# Save some useful information
REPO=`git config remote.origin.url`
SSH_REPO=${REPO/https:\/\/github.com\//git@github.com:}
SHA=`git rev-parse --verify HEAD`

# Clone the existing gh-pages for this repo into out/
# Create a new empty branch if gh-pages doesn't exist
# yet (should only happen on first deply)
git clone --depth=3 --branch=$TARGET_BRANCH $SSH_REPO $DOC_REPO_DIRECTORY
if [[ -d $DOC_REPO_DIRECTORY ]]; then
   cd $DOC_REPO_DIRECTORY
else
   git clone -l -s -n . $DOC_REPO_DIRECTORY
   cd $DOC_REPO_DIRECTORY
   git checkout $TARGET_BRANCH || git checkout --orphan $TARGET_BRANCH
   git reset --hard
fi

cp -a "../$HTML_DIRECTORY/." ./

# Now let's go have some fun with the cloned repo
git config user.name "Travis CI"
git config user.email "$COMMIT_AUTHOR_EMAIL"

# If there are no changes to the compiled out (e.g. this is a README update) then just bail.
if [ -z `git diff --exit-code` ]; then
    echo "No changes to the output on this push; exiting."
    exit 0
fi

# Commit the "changes", i.e. the new version.
# The delta will show diffs between new and old versions.
git add .
git commit -m "Documentation: ${VERSION}"

# Get the deploy key by using Travis's stored variables to decrypt deploy_key.enc
ENCRYPTED_KEY_VAR="encrypted_${ENCRYPTION_LABEL}_key"
ENCRYPTED_IV_VAR="encrypted_${ENCRYPTION_LABEL}_iv"
ENCRYPTED_KEY=${!ENCRYPTED_KEY_VAR}
ENCRYPTED_IV=${!ENCRYPTED_IV_VAR}
openssl aes-256-cbc -K $ENCRYPTED_KEY -iv $ENCRYPTED_IV -in deploy_key.enc -out deploy_key -d
chmod 600 deploy_key
eval `ssh-agent -s`
ssh-add deploy_key

# Now that we're all set up, we can push.
git push $SSH_REPO $TARGET_BRANCH

cd ..
rm -rf $DOC_REPO_DIRECTORY


text:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:util="http://www.springframework.org/schema/util" xmlns:task="http://www.springframework.org/schema/task" xsi:schemaLocation="
		http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd" >

	<description>DataSource Configuration</description>

	<!-- 数据源配置, 使用数据库连接池 -->
	<bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource" init-method="init" destroy-method="close">
		<!-- Druid默认会自动根据URL识别DriverClass -->
		<!-- 基本属性 url、user、password -->
		<property name="url" value="${jdbc.url}" />
		<property name="username" value="${jdbc.username}" />
		<property name="password" value="${jdbc.password}" />

		<!-- 配置初始化大小、最小、最大 -->
		<property name="initialSize" value="${jdbc.pool.init}" />
		<property name="minIdle" value="${jdbc.pool.minIdle}" />
		<property name="maxActive" value="${jdbc.pool.maxActive}" />

		<!-- 配置获取连接等待超时的时间 -->
		<property name="maxWait" value="60000" />

		<!-- 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 -->
		<property name="timeBetweenEvictionRunsMillis" value="60000" />

		<!-- 配置一个连接在池中最小生存的时间,单位是毫秒 -->
		<property name="minEvictableIdleTimeMillis" value="300000" />

		<property name="validationQuery" value="${jdbc.testSql}" />
		<property name="testWhileIdle" value="true" />
		<property name="testOnBorrow" value="false" />
		<property name="testOnReturn" value="false" />

		<!-- 打开PSCache,并且指定每个连接上PSCache的大小(Oracle使用)
		<property name="poolPreparedStatements" value="true" />
		<property name="maxPoolPreparedStatementPerConnectionSize" value="20" /> -->

		<!-- 配置监控统计拦截的filters -->
	    <property name="filters" value="stat" />
	</bean>

	<!-- 数据源配置, 使用应用服务器的数据库连接池
	<jee:jndi-lookup id="dataSource" jndi-name="java:comp/env/jdbc/web-demo" />-->

</beans>


text:
package com.hotfixs.thinkinginjava.typeinfo.toys;

import static com.hotfixs.thinkinginjava.common.Print.print;

/**
 * @author Junwei Wang (i.junwei.wang@gmail.com)
 */
interface HasBatteries {
}

interface Waterproof {
}

interface Shoes {
}

class Toy {
    Toy() {
    }

    Toy(int i) {
    }
}

class FancyToy extends Toy implements HasBatteries, Waterproof, Shoes {
    FancyToy(int i) {
        super(i);
    }
}

public class ToyTest {
    static void printInfo(Class cc) {
        print("====");
        print("Class name: " + cc.getName() + " is interface? " + cc.isInterface());
        print("Simple name: " + cc.getSimpleName());
        print("Canonical name: " + cc.getCanonicalName());
    }

    public static void main(String[] args) {
        Class c = null;
        try {
            c = Class.forName("com.hotfixs.thinkinginjava.typeinfo.toys.FancyToy");
        } catch (ClassNotFoundException e) {
            print("Cannot find FancyToy");
            System.exit(1);
        }
        printInfo(c);

        for (Class face : c.getInterfaces()) {
            printInfo(face);
        }

        Class up = c.getSuperclass();
        Object obj = null;

        try {
            obj = up.newInstance();
        } catch (InstantiationException e) {
            print("Cannot instantiate");
            System.exit(1);
        } catch (IllegalAccessException e) {
            print("Cannot access");
            System.exit(1);
        }
        printInfo(obj.getClass());
    }

}