text:
#ifndef CLIPPER_LIB_DATATYPES_H
#define CLIPPER_LIB_DATATYPES_H

#include <chrono>
#include <memory>
#include <string>
#include <vector>

#include <boost/optional.hpp>

namespace clipper {

using ByteBuffer = std::vector<uint8_t>;
using VersionedModelId = std::pair<std::string, int>;
using QueryId = long;
using FeedbackAck = bool;

enum class InputType {
  Bytes = 0,
  Ints = 1,
  Floats = 2,
  Doubles = 3,
  Strings = 4,
};

enum class RequestType {
  PredictRequest = 0,
  FeedbackRequest = 1,
};

size_t versioned_model_hash(const VersionedModelId &key);
std::string versioned_model_to_str(const VersionedModelId &model);
std::string get_readable_input_type(InputType type);
InputType parse_input_type(std::string type_string);

class Output {
 public:
  Output(const std::string y_hat,
         const std::vector<VersionedModelId> models_used);

  ~Output() = default;

  explicit Output() = default;
  Output(const Output &) = default;
  Output &operator=(const Output &) = default;

  Output(Output &&) = default;
  Output &operator=(Output &&) = default;

  bool operator==(const Output &rhs) const;
  bool operator!=(const Output &rhs) const;

  std::string y_hat_;
  std::vector<VersionedModelId> models_used_;
};

class Input {
 public:
  // TODO: pure virtual or default?
  // virtual ~Input() = default;

  virtual InputType type() const = 0;

  /**
   * Serializes input and writes resulting data to provided buffer.
   *
   * The serialization methods are used for RPC.
   */
  virtual size_t serialize(uint8_t *buf) const = 0;

  virtual size_t hash() const = 0;

  /**
   * @return The number of elements in the input
   */
  virtual size_t size() const = 0;
  /**
   * @return The size of the input data in bytes
   */
  virtual size_t byte_size() const = 0;
};

class ByteVector : public Input {
 public:
  explicit ByteVector(std::vector<uint8_t> data);

  // Disallow copy
  ByteVector(ByteVector &other) = delete;
  ByteVector &operator=(ByteVector &other) = delete;

  // move constructors
  ByteVector(ByteVector &&other) = default;
  ByteVector &operator=(ByteVector &&other) = default;

  InputType type() const override;
  size_t serialize(uint8_t *buf) const override;
  size_t hash() const override;
  size_t size() const override;
  size_t byte_size() const override;
  const std::vector<uint8_t> &get_data() const;

 private:
  std::vector<uint8_t> data_;
};

class IntVector : public Input {
 public:
  explicit IntVector(std::vector<int> data);

  // Disallow copy
  IntVector(IntVector &other) = delete;
  IntVector &operator=(IntVector &other) = delete;

  // move constructors
  IntVector(IntVector &&other) = default;
  IntVector &operator=(IntVector &&other) = default;

  InputType type() const override;
  size_t serialize(uint8_t *buf) const override;
  size_t hash() const override;
  size_t size() const override;
  size_t byte_size() const override;

  const std::vector<int> &get_data() const;

 private:
  std::vector<int> data_;
};

class FloatVector : public Input {
 public:
  explicit FloatVector(std::vector<float> data);

  // Disallow copy
  FloatVector(FloatVector &other) = delete;
  FloatVector &operator=(FloatVector &other) = delete;

  // move constructors
  FloatVector(FloatVector &&other) = default;
  FloatVector &operator=(FloatVector &&other) = default;

  InputType type() const override;
  size_t serialize(uint8_t *buf) const override;
  size_t hash() const override;
  size_t size() const override;
  size_t byte_size() const override;
  const std::vector<float> &get_data() const;

 private:
  std::vector<float> data_;
};

class DoubleVector : public Input {
 public:
  explicit DoubleVector(std::vector<double> data);

  // Disallow copy
  DoubleVector(DoubleVector &other) = delete;
  DoubleVector &operator=(DoubleVector &other) = delete;

  // move constructors
  DoubleVector(DoubleVector &&other) = default;
  DoubleVector &operator=(DoubleVector &&other) = default;

  InputType type() const override;
  size_t serialize(uint8_t *buf) const override;
  size_t hash() const override;
  size_t size() const override;
  size_t byte_size() const override;
  const std::vector<double> &get_data() const;

 private:
  std::vector<double> data_;
};

class SerializableString : public Input {
 public:
  explicit SerializableString(std::string data);

  // Disallow copy
  SerializableString(SerializableString &other) = delete;
  SerializableString &operator=(SerializableString &other) = delete;

  // move constructors
  SerializableString(SerializableString &&other) = default;
  SerializableString &operator=(SerializableString &&other) = default;

  InputType type() const override;
  size_t serialize(uint8_t *buf) const override;
  size_t hash() const override;
  size_t size() const override;
  size_t byte_size() const override;
  const std::string &get_data() const;

 private:
  std::string data_;
};

class Query {
 public:
  ~Query() = default;

  Query(std::string label, long user_id, std::shared_ptr<Input> input,
        long latency_budget_micros, std::string selection_policy,
        std::vector<VersionedModelId> candidate_models);

  // Note that it should be relatively cheap to copy queries because
  // the actual input won't be copied
  // copy constructors
  Query(const Query &) = default;
  Query &operator=(const Query &) = default;

  // move constructors
  Query(Query &&) = default;
  Query &operator=(Query &&) = default;

  // Used to provide a namespace for queries. The expected
  // use is to distinguish queries coming from different
  // REST endpoints.
  std::string label_;
  long user_id_;
  std::shared_ptr<Input> input_;
  // TODO change this to a deadline instead of a duration
  long latency_budget_micros_;
  std::string selection_policy_;
  std::vector<VersionedModelId> candidate_models_;
  std::chrono::time_point<std::chrono::high_resolution_clock> create_time_;
};

class Response {
 public:
  ~Response() = default;

  Response(Query query, QueryId query_id, const long duration_micros,
           Output output, const bool is_default,
           const boost::optional<std::string> default_explanation);

  // default copy constructors
  Response(const Response &) = default;
  Response &operator=(const Response &) = default;

  // default move constructors
  Response(Response &&) = default;
  Response &operator=(Response &&) = default;

  std::string debug_string() const noexcept;

  Query query_;
  QueryId query_id_;
  long duration_micros_;
  Output output_;
  bool output_is_default_;
  boost::optional<std::string> default_explanation_;
};

class Feedback {
 public:
  ~Feedback() = default;
  Feedback(std::shared_ptr<Input> input, double y);

  Feedback(const Feedback &) = default;
  Feedback &operator=(const Feedback &) = default;

  Feedback(Feedback &&) = default;
  Feedback &operator=(Feedback &&) = default;

  double y_;
  std::shared_ptr<Input> input_;
};

class FeedbackQuery {
 public:
  ~FeedbackQuery() = default;
  FeedbackQuery(std::string label, long user_id, Feedback feedback,
                std::string selection_policy,
                std::vector<VersionedModelId> candidate_models);

  FeedbackQuery(const FeedbackQuery &) = default;
  FeedbackQuery &operator=(const FeedbackQuery &) = default;

  FeedbackQuery(FeedbackQuery &&) = default;
  FeedbackQuery &operator=(FeedbackQuery &&) = default;

  // Used to provide a namespace for queries. The expected
  // use is to distinguish queries coming from different
  // REST endpoints.
  std::string label_;
  long user_id_;
  Feedback feedback_;
  std::string selection_policy_;
  std::vector<VersionedModelId> candidate_models_;
};

class PredictTask {
 public:
  ~PredictTask() = default;

  PredictTask(std::shared_ptr<Input> input, VersionedModelId model,
              float utility, QueryId query_id, long latency_slo_micros);

  PredictTask(const PredictTask &other) = default;

  PredictTask &operator=(const PredictTask &other) = default;

  PredictTask(PredictTask &&other) = default;

  PredictTask &operator=(PredictTask &&other) = default;

  std::shared_ptr<Input> input_;
  VersionedModelId model_;
  float utility_;
  QueryId query_id_;
  long latency_slo_micros_;
  std::chrono::time_point<std::chrono::system_clock> recv_time_;
};

/// NOTE: If a feedback task is scheduled, the task scheduler
/// must send it to ALL replicas of the VersionedModelId.
class FeedbackTask {
 public:
  ~FeedbackTask() = default;

  FeedbackTask(Feedback feedback, VersionedModelId model, QueryId query_id,
               long latency_slo_micros);

  FeedbackTask(const FeedbackTask &other) = default;

  FeedbackTask &operator=(const FeedbackTask &other) = default;

  FeedbackTask(FeedbackTask &&other) = default;

  FeedbackTask &operator=(FeedbackTask &&other) = default;

  Feedback feedback_;
  VersionedModelId model_;
  QueryId query_id_;
  long latency_slo_micros_;
};

namespace rpc {

class PredictionRequest {
 public:
  explicit PredictionRequest(InputType input_type);
  explicit PredictionRequest(std::vector<std::shared_ptr<Input>> inputs,
                             InputType input_type);

  // Disallow copy
  PredictionRequest(PredictionRequest &other) = delete;
  PredictionRequest &operator=(PredictionRequest &other) = delete;

  // move constructors
  PredictionRequest(PredictionRequest &&other) = default;
  PredictionRequest &operator=(PredictionRequest &&other) = default;

  void add_input(std::shared_ptr<Input> input);
  std::vector<ByteBuffer> serialize();

 private:
  void validate_input_type(std::shared_ptr<Input> &input) const;

  std::vector<std::shared_ptr<Input>> inputs_;
  InputType input_type_;
  size_t input_data_size_ = 0;
};

class PredictionResponse {
 public:
  PredictionResponse(const std::vector<std::string> outputs);

  // Disallow copy
  PredictionResponse(PredictionResponse &other) = delete;
  PredictionResponse &operator=(PredictionResponse &other) = delete;

  // move constructors
  PredictionResponse(PredictionResponse &&other) = default;
  PredictionResponse &operator=(PredictionResponse &&other) = default;

  static PredictionResponse deserialize_prediction_response(ByteBuffer bytes);

  std::vector<std::string> outputs_;
};

}  // namespace rpc

}  // namespace clipper

#endif  // CLIPPER_LIB_DATATYPES_H


text:
// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: google/firestore/v1/write.proto

package com.google.firestore.v1;

public interface ExistenceFilterOrBuilder
    extends
    // @@protoc_insertion_point(interface_extends:google.firestore.v1.ExistenceFilter)
    com.google.protobuf.MessageOrBuilder {

  /**
   *
   *
   *

   * The target ID to which this filter applies.
   *

   *
   * int32 target_id = 1;
   */
  int getTargetId();

  /**
   *
   *
   *

   * The total count of documents that match
   * [target_id][google.firestore.v1.ExistenceFilter.target_id].
   * If different from the count of documents in the client that match, the
   * client must manually determine which documents no longer match the target.
   *

   *
   * int32 count = 2;
   */
  int getCount();
}

redpajama_set_name: RedPajamaGithub


text:
package org.bitcoins.core.api.wallet.db

import org.bitcoins.core.currency.CurrencyUnit
import org.bitcoins.crypto.{DoubleSha256Digest, DoubleSha256DigestBE}

/** Represents a relevant transaction for the wallet that we should be keeping track of
  *
  * @param txIdBE Transaction ID
  */
case class IncomingTransactionDb(
    txIdBE: DoubleSha256DigestBE,
    incomingAmount: CurrencyUnit)
    extends TxDB {
  lazy val txId: DoubleSha256Digest = txIdBE.flip
}


text:
rostensorflow
=====================

- Install tensorflow (see https://www.tensorflow.org/versions/r0.9/get_started/os_setup.html)
- Install ROS (see http://wiki.ros.org)
- Install cv-bridge, and camera driver (for example, cv_camera)

```bash
$ sudo apt-get install ros-indigo-cv-bridge ros-indigo-cv-camera
```

image_recognition.py
--------------------------------

* publish: /result (std_msgs/String)
* subscribe: /image (sensor_msgs/Image)

How to try

```bash
$ roscore
$ rosrun cv_camera cv_camera_node
$ python image_recognition.py image:=/cv_camera/image_raw
$ rostopic echo /result
```


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

namespace CSharpGL
{
    /// <summary>
    ///
    /// </summary>
    public class LeveledData
    {
        /// <summary>
        ///
        /// </summary>
        public readonly int level;

        /// <summary>
        ///
        /// </summary>
        public LeveledData() : this(0) { }

        /// <summary>
        ///
        /// </summary>
        /// <param name="level"></param>
        public LeveledData(int level)
        {
            this.level = level;
        }

        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public virtual IntPtr LockData()
        {
            return IntPtr.Zero;
        }

        /// <summary>
        ///
        /// </summary>
        public virtual void FreeData() { }
    }
}


text:
from collections import OrderedDict
from typing import Dict, Optional

from torch import nn

class IntermediateLayerGetter(nn.ModuleDict):
    """
    Module wrapper that returns intermediate layers from a model

    It has a strong assumption that the modules have been registered
    into the model in the same order as they are used.
    This means that one should **not** reuse the same nn.Module
    twice in the forward if you want this to work.

    Additionally, it is only able to query submodules that are directly
    assigned to the model. So if `model` is passed, `model.feature1` can
    be returned, but not `model.feature1.layer2`.

    Args:
        model (nn.Module): model on which we will extract the features
        return_layers (Dict[name, new_name]): a dict containing the names
            of the modules for which the activations will be returned as
            the key of the dict, and the value of the dict is the name
            of the returned activation (which the user can specify).

    Examples::

        >>> m = torchvision.models.resnet18(pretrained=True)
        >>> # extract layer1 and layer3, giving as names `feat1` and feat2`
        >>> new_m = torchvision.models._utils.IntermediateLayerGetter(m,
        >>>     {'layer1': 'feat1', 'layer3': 'feat2'})
        >>> out = new_m(torch.rand(1, 3, 224, 224))
        >>> print([(k, v.shape) for k, v in out.items()])
        >>>     [('feat1', torch.Size([1, 64, 56, 56])),
        >>>      ('feat2', torch.Size([1, 256, 14, 14]))]
    """

    _version = 2
    __annotations__ = {"return_layers": Dict[str, str], }

    def __init__(self, model: nn.Module,
                 return_layers: Dict[str, str]) -> None:
        if not set(return_layers).issubset(
            [name for name, _ in model.named_children()]):
            raise ValueError("return_layers are not present in model")
        orig_return_layers = return_layers
        return_layers = {str(k): str(v) for k, v in return_layers.items()}
        layers = OrderedDict()
        for name, module in model.named_children():
            layers[name] = module
            if name in return_layers:
                del return_layers[name]
            if not return_layers:
                break

        super().__init__(layers)
        self.return_layers = orig_return_layers

    def forward(self, x):
        out = OrderedDict()
        for name, module in self.items():
            x = module(x)
            if name in self.return_layers:
                out_name = self.return_layers[name]
                out[out_name] = x
        return out

def _make_divisible(v: float, divisor: int,
                    min_value: Optional[int]=None) -> int:
    """
    This function is taken from the original tf repo.
    It ensures that all layers have a channel number that is divisible by 8
    It can be seen here:
    https://github.com/tensorflow/models/blob/master/research/slim/nets/mobilenet/mobilenet.py
    """
    if min_value is None:
        min_value = divisor
    new_v = max(min_value, int(v + divisor / 2) // divisor * divisor)
    # Make sure that round down does not go down by more than 10%.
    if new_v < 0.9 * v:
        new_v += divisor
    return new_v


text:
from django.core.management.base import BaseCommand
from django.utils.six.moves import input
from instagram.client import InstagramAPI
from mezzanine.conf import settings

def get_auth_tokens(stdout):
    stdout.write('Please enter the following Instagram client details\n\n')
    print('lol' + settings.INSTAGRAM_CLIENT_ID)
    if settings.INSTAGRAM_CLIENT_ID == '':
        settings.INSTAGRAM_CLIENT_ID = input('Client ID: ').strip()
    if settings.INSTAGRAM_CLIENT_SECRET == '':
        settings.INSTAGRAM_CLIENT_SECRET = input('Client Secret: ').strip()
    if settings.INSTAGRAM_REDIRECT_URI == '':
        settings.INSTAGRAM_REDIRECT_URI = input('Redirect URI: ').strip()

    scope = ['basic', 'public_content', 'likes']

    api = InstagramAPI(client_id=settings.INSTAGRAM_CLIENT_ID, client_secret=settings.INSTAGRAM_CLIENT_SECRET, redirect_uri=settings.INSTAGRAM_REDIRECT_URI)
    redirect_uri = api.get_authorize_login_url(scope=scope)

    stdout.write('\nVisit this page and authorize access in your browser:\n\n%s\n\n' % redirect_uri)

    code = input('Paste in code in query string after redirect: ').strip()

    access_token = api.exchange_code_for_access_token(code)
    stdout.write('Access token:\n\n%s\n\n' % (access_token,))

class Command(BaseCommand):
    help = 'Generate access token needed for Instagram'

    def handle(self, **options):
        get_auth_tokens(self.stdout)


text:
import socket
import sys
import pickle
import pdb
import imp

sys.path.append("../bin/logiccommon")
imp.reload(sys)

import datapack

def make_server_sock():
    """ make a server sock, bind and listen """
    sock = socket.socket()
    sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
    sock.bind(("127.0.0.1", 9001))
    sock.listen(8)

    return  sock

def make_client_sock(addr):
    sock = socket.socket()
    sock.connect(addr)

    return  sock

def main(argv = sys.argv):
    """ main function """
    sock = make_server_sock()

    while True:
        recv, addr = sock.accept()
        pack = datapack.DataPack(recv)
        connector = pack.precv()

        print(connector)

        if connector:
            s = make_client_sock(connector)
            urls = ["money.163.com", "duowan.com", "www.baidu.com"]
            datapack.DataPack(s).senddata(pickle.dumps(urls))

    sock.close()

if __name__ == "__main__":
    main()


text:
package org.ecg.refdata.query.model.impl;

import org.ecg.refdata.query.model.CountryHoliday;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

/**
 * Class stores an information about country holiday.
 *
 */
public class CountryHolidayImpl implements CountryHoliday {

    public static class HolidayImpl implements Holiday {

        private static final long serialVersionUID = -1540355694218465937L;

        private String day;
        private String month;
        private Integer year;
        private Boolean variable;
        private String name;

        public String getDay() {
            return day;
        }

        public String getMonth() {
            return month;
        }

        public Integer getYear() {
            return year;
        }

        public Boolean getVariable() {
            return variable;
        }

        public String getName() {
            return name;
        }

        public String getCode() {
            return getName();
        }

        public String getDescription() {
            return null;
        }

        public HolidayImpl(String day, String month, Integer year, Boolean variable, String name) {
            this.day = day;
            this.month = month;
            this.year = year;
            this.variable = variable;
            this.name = name;
        }

    }

    private static final long serialVersionUID = -1540355694218465937L;
    /**
     * @serial Country code
     */
    private String countryCode;

    /**
     * Basic constructor takes one parameter
     *
     * @param countryCode the country code
     */
    public CountryHolidayImpl(String countryCode, Collection<Holiday> holidays) {

        this.countryCode = countryCode;
        this.holidays.addAll(holidays);
    }

    /**
     * @see org.ecg.refdata.query.model.CountryHoliday#getCountryCode()
     */
    public String getCountryCode() {
        return countryCode;
    }

    List<Holiday> holidays = new ArrayList<Holiday>();

    public List<Holiday> getHolidays() {
        return holidays;
    }

    public String getCode() {
        return null;
    }

    public String getDescription() {
        return null;
    }
}


text:
UPDATE organization SET description = 'Teens Give Organization' WHERE id = 1;
UPDATE organization SET description = 'African Film Festival' WHERE id = 2;
UPDATE organization SET description = 'National Association of School Nurses' WHERE id = 3;
UPDATE organization SET description = 'Rubicon Programs Inc' WHERE id = 4;
UPDATE organization SET description = 'Conversations For Good' WHERE id = 5;


text:
layout: project
title:  Farmer's Spot App
categories: [brand identity, app]
images:
  - url: images/farmers-spot/farmers-spot-1--medium.png
    large_url:
    alt: Farmer's Spot App Logo
    border: false
    srcset:
      - images/farmers-spot/farmers-spot-1--mini.png 160w
      - images/farmers-spot/farmers-spot-1--tiny.png 240w
      - images/farmers-spot/farmers-spot-1--small.png 320w
      - images/farmers-spot/farmers-spot-1--medium.png 480w

  - url: images/farmers-spot/farmers-spot-2--small.jpg
    large_url: images/farmers-spot/farmers-spot-walkthrough.mp4
    alt: Farmer's Spot Video
    border: true
    video: true
    srcset:
      - images/farmers-spot/farmers-spot-2--mini.jpg 160w
      - images/farmers-spot/farmers-spot-2--tiny.jpg 240w
      - images/farmers-spot/farmers-spot-2--small.jpg 320w
      - images/farmers-spot/farmers-spot-2--medium.jpg 480w

  - url: images/farmers-spot/farmers-spot-3--small.jpg
    large_url: images/farmers-spot/farmers-spot-3--large.jpg
    alt: Farmer's Spot Market View
    border: true
    srcset:
      - images/farmers-spot/farmers-spot-3--mini.jpg 160w
      - images/farmers-spot/farmers-spot-3--tiny.jpg 240w
      - images/farmers-spot/farmers-spot-3--small.jpg 320w
      - images/farmers-spot/farmers-spot-3--medium.jpg 480w

  - url: images/farmers-spot/farmers-spot-5--small.jpg
    large_url: images/farmers-spot/farmers-spot-5--large.jpg
    alt: Farmer's Spot Map View
    border: true
    srcset:
      - images/farmers-spot/farmers-spot-5--mini.jpg 160w
      - images/farmers-spot/farmers-spot-5--tiny.jpg 240w
      - images/farmers-spot/farmers-spot-5--small.jpg 320w
      - images/farmers-spot/farmers-spot-5--medium.jpg 480w

  - url: images/farmers-spot/farmers-spot-4--small.jpg
    large_url: images/farmers-spot/farmers-spot-4--large.jpg
    alt: Farmer's Spot List Map View
    border: true
    srcset:
      - images/farmers-spot/farmers-spot-4--mini.jpg 160w
      - images/farmers-spot/farmers-spot-4--tiny.jpg 240w
      - images/farmers-spot/farmers-spot-4--small.jpg 320w
      - images/farmers-spot/farmers-spot-4--medium.jpg 480w

---

UI design for _Farmer's Spot_ app. _Farmer's Spot_ makes finding farmers markets a breeze. No matter where you are _Farmer's Spot_ will find the nearest market and give you detailed information on where it is, when its open, and what products are offered. The app integrates directly with your GPS app of choice to give you door to market directions. Everything is just a tap away. Profiles of vendor's share their story and make it easy to learn exactly where your food is coming from.


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

<config xmlns="http://thelia.net/schema/dic/config"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://thelia.net/schema/dic/config http://thelia.net/schema/dic/config/thelia-1.0.xsd">

    <loops>
        <loop name="fix" class="Fix\Loop\FixLoop" />
        <loop name="fixlog" class="Fix\Loop\FixLogLoop" />
    </loops>

    <forms>
        <form name="fix.check" class="Fix\Form\Admin\FixCheckForm" />
        <form name="fix.apply" class="Fix\Form\Admin\FixApplyForm" />
    </forms>

    <commands>
        <command class="Fix\Command\FixGenerateCommand" />
        <command class="Fix\Command\FixApplyCommand" />
        <command class="Fix\Command\FixCheckCommand" />
    </commands>

    <services>
        <service id="fix.generate" class="Fix\EventListener\FixGenerateEventListener">
            <tag name="kernel.event_subscriber" />
        </service>
        <service id="fix.check" class="Fix\EventListener\FixCheckEventListener">
            <tag name="kernel.event_subscriber" />
        </service>
        <service id="fix.apply" class="Fix\EventListener\FixApplyEventListener">
            <tag name="kernel.event_subscriber" />
        </service>
    </services>

</config>


text:
<!DOCTYPE html>

  <meta charset="utf-8">
  <base data-ice="baseUrl" href="../../../">
  <title data-ice="title">App/Store/Store.js | Jenkins: React-Native API Document</title>
  <link type="text/css" rel="stylesheet" href="css/style.css">
  <link type="text/css" rel="stylesheet" href="css/prettify-tomorrow.css">

  Home
  Manual
  Reference
  Source

    <input class="search-input">

CRoot

Components
VAlertMessageComponent

VButton

Config
VSETTINGS

VREDUX_PERSIST

Containers
CDeviceInfoScreen

Containers/Styles
VRootStyle

Navigation
CNavigationRouter

Reducers
VINITIAL_STATE

VINITIAL_STATE

VINITIAL_STATE

VpersistentStoreBlacklist

Sagas
FwatchStartup

Froot

Themes
VApplicationStyles

Vcolors

Vimages

Vmetrics

Vtransitions

App/Store/Store.js

import { createStore, applyMiddleware, compose } from 'redux';
import { autoRehydrate } from 'redux-persist';
import createLogger from 'redux-logger';
import rootReducer from '../Reducers/';
import Config from '../Config/DebugSettings';
import createSagaMiddleware from 'redux-saga';
import sagas from '../Sagas/';
import R from 'ramda';
import RehydrationServices from '../Services/RehydrationServices';
import ReduxPersist from '../Config/ReduxPersist';

// the logger master switch
const USE_LOGGING = Config.reduxLogging;
// silence these saga-based messages
const SAGA_LOGGING_BLACKLIST = ['EFFECT_TRIGGERED', 'EFFECT_RESOLVED', 'EFFECT_REJECTED', 'persist/REHYDRATE'];
// create the logger
const logger = createLogger({
  predicate: (getState, { type }) => USE_LOGGING && R.not(R.contains(type, SAGA_LOGGING_BLACKLIST))
});

let middleware = [];
const sagaMiddleware = createSagaMiddleware();
middleware.push(sagaMiddleware);

// Don't ship these
if (__DEV__) {
  middleware.push(logger);
}

// a function which can create our store and auto-persist the data
export default () => {
  let store = {};

  // Add rehydrate enhancer if ReduxPersist is active
  if (ReduxPersist.active) {
    const enhancers = compose(
      applyMiddleware(...middleware),
      autoRehydrate()
    );

    store = createStore(
      rootReducer,
      enhancers
    );

    // configure persistStore and check reducer version number
    RehydrationServices.updateReducers(store);
  } else {
    const enhancers = compose(
      applyMiddleware(...middleware)
    );

    store = createStore(
      rootReducer,
      enhancers
    );
  }

  // run sagas
  sagaMiddleware.run(sagas);

  return store;
};

  Generated by ESDoc(0.4.8)


text:
__author__    = "Andre Merzky, Ole Weidner"
__copyright__ = "Copyright 2012-2013, The SAGA Project"
__license__   = "MIT"

''' Provides a parser class for the file transfer specification as it is
    defined in GFD.90, sction 4.1.3.
'''

import saga.exceptions as se

# 4.1.3 File Transfer Specifications (GFD90 p 176-177)
#
# The syntax of a file transfer directive for the job description is modeled on
# the LSF syntax (LSF stands for Load Sharing Facility, a commercial job
# scheduler by Platform Computing), and has the general syntax:
# local_file operator remote_file
# Both the local_file and the remote_file can be URLs. If they are not URLs,
# but full or relative pathnames, then the local_file is relative to the host
# where the submission is executed, and the remote_file is evaluated on the
# execution host of the job. The operator is one of the following four:
#
# '>'  copies the local file to the remote file before the job starts.
#      Overwrites the remote file if it exists.
# '>>' copies the local file to the remote file before the job starts.
#      Appends to the remote file if it exists.
# '<'  copies the remote file to the local file after the job finishes.
#      Overwrites the local file if it exists.
# '<<' copies the remote file to the local file after the job finishes.
#      Appends to the local file if it exists.

# ------------------------------------------------------------------------------
#
class TransferDirectives(object):

    # --------------------------------------------------------------------------
    #
    def __init__(self, directives=None):

        self._in_overwrite  = list()
        self._in_append     = list()
        self._out_overwrite = list()
        self._out_append    = list()

        if not directives:
            directives = {}

        for d in directives:

            if (d.count('>') > 2) or (d.count('<') > 2):
                msg = "'%s' is not a valid transfer d string."
                raise se.BadParameter(msg)

            elif '>>' in d:
                (loc, rem) = d.split('>>')
                self._in_append.append([loc.strip(), rem.strip()])

            elif '>' in d:
                (loc, rem) = d.split('>')
                self._in_overwrite.append([loc.strip(), rem.strip()])

            elif '<<' in d:
                (loc, rem) = d.split('<<')
                self._out_append.append([loc.strip(), rem.strip()])

            elif '<' in d:
                (loc, rem) = d.split('<')
                self._out_overwrite.append([loc.strip(), rem.strip()])

            else:
                msg = "'%s' is not a valid transfer directive string." % d
                raise se.BadParameter(msg)

    # --------------------------------------------------------------------------
    #
    def _to_string_list(self):

        slist = list()

        for (loc, rem) in self._in_overwrite:
            slist.append('%s > %s' % (loc, rem))

        for (loc, rem) in self._in_append:
            slist.append('%s >> %s' % (loc, rem))

        for (loc, rem) in self._out_overwrite:
            slist.append('%s < %s' % (loc, rem))

        for (loc, rem) in self._out_append:
            slist.append('%s << %s' % (loc, rem))

        return slist

    # --------------------------------------------------------------------------
    #
    def __str__(self):

        return str(self._to_string_list())

    # --------------------------------------------------------------------------
    #
    @property
    def in_overwrite(self):

        return self._in_overwrite

    # --------------------------------------------------------------------------
    #
    @property
    def in_append(self):

        return self._in_append

    # --------------------------------------------------------------------------
    #
    @property
    def out_overwrite(self):

        return self._out_overwrite

    # --------------------------------------------------------------------------
    #
    @property
    def out_append(self):

        return self._out_append

    # --------------------------------------------------------------------------
    #
    @property
    def string_list(self):

        return self._to_string_list()

# ------------------------------------------------------------------------------
#
def _test_():

    tdp = TransferDirectives(["ab","a>c", "c>>d","f<a","g<<h"])

    print tdp.in_append
    print tdp.in_overwrite
    print tdp.out_append
    print tdp.out_overwrite

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


text:
<?php

$sql = array();

$sql[] = 'CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.'prestashopcarriertester` (
    `id_prestashopcarriertester` int(11) NOT NULL AUTO_INCREMENT,
    PRIMARY KEY  (`id_prestashopcarriertester`)
) ENGINE='._MYSQL_ENGINE_.' DEFAULT CHARSET=utf8;';

foreach ($sql as $query) {
    if (Db::getInstance()->execute($query) == false) {
        return false;
    }
}


text:
TSelectionHandle::TSelectionHandle() { m_selectionStack.push_back(0); }

//-----------------------------------------------------------------------------

TSelectionHandle::~TSelectionHandle() {}

//-----------------------------------------------------------------------------

TSelection *TSelectionHandle::getSelection() const {
  return m_selectionStack.back();
}

//-----------------------------------------------------------------------------

void TSelectionHandle::setSelection(TSelection *selection) {
  if (getSelection() == selection) return;
  TSelection *oldSelection = getSelection();
  if (oldSelection) {
    oldSelection->selectNone();
    // disable selection related commands
    CommandManager *commandManager = CommandManager::instance();
    int i;
    for (i = 0; i < (int)m_enabledCommandIds.size(); i++)
      commandManager->setHandler(m_enabledCommandIds[i].c_str(), 0);
    m_enabledCommandIds.clear();
  }
  m_selectionStack.back() = selection;
  if (selection) selection->enableCommands();
  emit selectionSwitched(oldSelection, selection);
}

//-----------------------------------------------------------------------------

void TSelectionHandle::pushSelection() {
  // NOTE
  //  We push 0, and NOT a copy of the last item. I think this is done on
  //  purpose,
  //  as having it copied and then selecting a different one invokes
  //  selectNone()
  //  on the former.
  m_selectionStack.push_back(0);
}

//-----------------------------------------------------------------------------

void TSelectionHandle::popSelection() {
  if (m_selectionStack.size() > 1) m_selectionStack.pop_back();
  TSelection *selection = getSelection();
  if (selection) selection->enableCommands();
}

//-----------------------------------------------------------------------------

void TSelectionHandle::enableCommand(std::string cmdId,
                                     CommandHandlerInterface *handler) {
  CommandManager::instance()->setHandler(cmdId.c_str(), handler);
  m_enabledCommandIds.push_back(cmdId);
}

//-----------------------------------------------------------------------------

void TSelectionHandle::notifySelectionChanged() {
  emit selectionChanged(m_selectionStack.back());
}

//-----------------------------------------------------------------------------

TSelectionHandle *TSelectionHandle::getCurrent() {
  static TSelectionHandle _currentSelection;
  return &_currentSelection;
}


text:
import unittest
from ...compatibility import StringIO
from ..helperfunctions import _xml_to_list
from ...worksheet import Worksheet

class TestAssembleWorksheet(unittest.TestCase):
    """
    Test assembling a complete Worksheet file.

    """
    def test_assemble_xml_file(self):
        """Test writing a worksheet with conditional formatting."""
        self.maxDiff = None

        fh = StringIO()
        worksheet = Worksheet()
        worksheet._set_filehandle(fh)
        worksheet.select()

        worksheet.write('A1', 10)
        worksheet.write('A2', 20)
        worksheet.write('A3', 30)
        worksheet.write('A4', 40)

        worksheet.conditional_format('A1', {'type': 'cell',
                                            'criteria': 'greater than',
                                            'value': 5,
                                            'format': None})

        worksheet._assemble_xml_file()

        exp = _xml_to_list("""
                <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
                <worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships">
                  <dimension ref="A1:A4"/>
                  <sheetViews>
                    <sheetView tabSelected="1" workbookViewId="0"/>
                  </sheetViews>
                  <sheetFormatPr defaultRowHeight="15"/>
                  <sheetData>
                    <row r="1" spans="1:1">
                      <c r="A1">
                        <v>10</v>
                      </c>
                    </row>
                    <row r="2" spans="1:1">
                      <c r="A2">
                        <v>20</v>
                      </c>
                    </row>
                    <row r="3" spans="1:1">
                      <c r="A3">
                        <v>30</v>
                      </c>
                    </row>
                    <row r="4" spans="1:1">
                      <c r="A4">
                        <v>40</v>
                      </c>
                    </row>
                  </sheetData>
                  <conditionalFormatting sqref="A1">
                    <cfRule type="cellIs" priority="1" operator="greaterThan">
                      <formula>5</formula>
                    </cfRule>
                  </conditionalFormatting>
                  <pageMargins left="0.7" right="0.7" top="0.75" bottom="0.75" header="0.3" footer="0.3"/>
                </worksheet>
                """)

        got = _xml_to_list(fh.getvalue())

        self.assertEqual(got, exp)


text:
package org.apache.spark.sql.execution.aggregate

import org.apache.spark.internal.Logging
import org.apache.spark.sql.Row
import org.apache.spark.sql.catalyst.{CatalystTypeConverters, InternalRow}
import org.apache.spark.sql.catalyst.encoders.ExpressionEncoder
import org.apache.spark.sql.catalyst.expressions.{AttributeReference, Expression, _}
import org.apache.spark.sql.catalyst.expressions.aggregate.{ImperativeAggregate, TypedImperativeAggregate}
import org.apache.spark.sql.catalyst.plans.logical.LogicalPlan
import org.apache.spark.sql.catalyst.rules.Rule
import org.apache.spark.sql.expressions.{Aggregator, MutableAggregationBuffer, UserDefinedAggregateFunction}
import org.apache.spark.sql.types._

/**
 * A helper trait used to create specialized setter and getter for types supported by
 * [[org.apache.spark.sql.execution.UnsafeFixedWidthAggregationMap]]'s buffer.
 * (see UnsafeFixedWidthAggregationMap.supportsAggregationBufferSchema).
 */
sealed trait BufferSetterGetterUtils {

  def createGetters(schema: StructType): Array[(InternalRow, Int) => Any] = {
    val dataTypes = schema.fields.map(_.dataType)
    val getters = new Array[(InternalRow, Int) => Any](dataTypes.length)

    var i = 0
    while (i < getters.length) {
      getters(i) = dataTypes(i) match {
        case NullType =>
          (row: InternalRow, ordinal: Int) => null

        case BooleanType =>
          (row: InternalRow, ordinal: Int) =>
            if (row.isNullAt(ordinal)) null else row.getBoolean(ordinal)

        case ByteType =>
          (row: InternalRow, ordinal: Int) =>
            if (row.isNullAt(ordinal)) null else row.getByte(ordinal)

        case ShortType =>
          (row: InternalRow, ordinal: Int) =>
            if (row.isNullAt(ordinal)) null else row.getShort(ordinal)

        case IntegerType =>
          (row: InternalRow, ordinal: Int) =>
            if (row.isNullAt(ordinal)) null else row.getInt(ordinal)

        case LongType =>
          (row: InternalRow, ordinal: Int) =>
            if (row.isNullAt(ordinal)) null else row.getLong(ordinal)

        case FloatType =>
          (row: InternalRow, ordinal: Int) =>
            if (row.isNullAt(ordinal)) null else row.getFloat(ordinal)

        case DoubleType =>
          (row: InternalRow, ordinal: Int) =>
            if (row.isNullAt(ordinal)) null else row.getDouble(ordinal)

        case dt: DecimalType =>
          val precision = dt.precision
          val scale = dt.scale
          (row: InternalRow, ordinal: Int) =>
            if (row.isNullAt(ordinal)) null else row.getDecimal(ordinal, precision, scale)

        case DateType =>
          (row: InternalRow, ordinal: Int) =>
            if (row.isNullAt(ordinal)) null else row.getInt(ordinal)

        case TimestampType =>
          (row: InternalRow, ordinal: Int) =>
            if (row.isNullAt(ordinal)) null else row.getLong(ordinal)

        case YearMonthIntervalType =>
          (row: InternalRow, ordinal: Int) =>
            if (row.isNullAt(ordinal)) null else row.getInt(ordinal)

        case DayTimeIntervalType =>
          (row: InternalRow, ordinal: Int) =>
            if (row.isNullAt(ordinal)) null else row.getLong(ordinal)

        case other =>
          (row: InternalRow, ordinal: Int) =>
            if (row.isNullAt(ordinal)) null else row.get(ordinal, other)
      }

      i += 1
    }

    getters
  }

  def createSetters(schema: StructType): Array[((InternalRow, Int, Any) => Unit)] = {
    val dataTypes = schema.fields.map(_.dataType)
    val setters = new Array[(InternalRow, Int, Any) => Unit](dataTypes.length)

    var i = 0
    while (i < setters.length) {
      setters(i) = dataTypes(i) match {
        case NullType =>
          (row: InternalRow, ordinal: Int, value: Any) => row.setNullAt(ordinal)

        case b: BooleanType =>
          (row: InternalRow, ordinal: Int, value: Any) =>
            if (value != null) {
              row.setBoolean(ordinal, value.asInstanceOf[Boolean])
            } else {
              row.setNullAt(ordinal)
            }

        case ByteType =>
          (row: InternalRow, ordinal: Int, value: Any) =>
            if (value != null) {
              row.setByte(ordinal, value.asInstanceOf[Byte])
            } else {
              row.setNullAt(ordinal)
            }

        case ShortType =>
          (row: InternalRow, ordinal: Int, value: Any) =>
            if (value != null) {
              row.setShort(ordinal, value.asInstanceOf[Short])
            } else {
              row.setNullAt(ordinal)
            }

        case IntegerType =>
          (row: InternalRow, ordinal: Int, value: Any) =>
            if (value != null) {
              row.setInt(ordinal, value.asInstanceOf[Int])
            } else {
              row.setNullAt(ordinal)
            }

        case LongType =>
          (row: InternalRow, ordinal: Int, value: Any) =>
            if (value != null) {
              row.setLong(ordinal, value.asInstanceOf[Long])
            } else {
              row.setNullAt(ordinal)
            }

        case FloatType =>
          (row: InternalRow, ordinal: Int, value: Any) =>
            if (value != null) {
              row.setFloat(ordinal, value.asInstanceOf[Float])
            } else {
              row.setNullAt(ordinal)
            }

        case DoubleType =>
          (row: InternalRow, ordinal: Int, value: Any) =>
            if (value != null) {
              row.setDouble(ordinal, value.asInstanceOf[Double])
            } else {
              row.setNullAt(ordinal)
            }

        case dt: DecimalType =>
          val precision = dt.precision
          (row: InternalRow, ordinal: Int, value: Any) =>
            // To make it work with UnsafeRow, we cannot use setNullAt.
            // Please see the comment of UnsafeRow's setDecimal.
            row.setDecimal(ordinal, value.asInstanceOf[Decimal], precision)

        case DateType =>
          (row: InternalRow, ordinal: Int, value: Any) =>
            if (value != null) {
              row.setInt(ordinal, value.asInstanceOf[Int])
            } else {
              row.setNullAt(ordinal)
            }

        case TimestampType =>
          (row: InternalRow, ordinal: Int, value: Any) =>
            if (value != null) {
              row.setLong(ordinal, value.asInstanceOf[Long])
            } else {
              row.setNullAt(ordinal)
            }

        case YearMonthIntervalType =>
          (row: InternalRow, ordinal: Int, value: Any) =>
            if (value != null) {
              row.setInt(ordinal, value.asInstanceOf[Int])
            } else {
              row.setNullAt(ordinal)
            }

        case DayTimeIntervalType =>
          (row: InternalRow, ordinal: Int, value: Any) =>
            if (value != null) {
              row.setLong(ordinal, value.asInstanceOf[Long])
            } else {
              row.setNullAt(ordinal)
            }

        case other =>
          (row: InternalRow, ordinal: Int, value: Any) =>
            if (value != null) {
              row.update(ordinal, value)
            } else {
              row.setNullAt(ordinal)
            }
      }

      i += 1
    }

    setters
  }
}

/**
 * A Mutable [[Row]] representing a mutable aggregation buffer.
 */
private[aggregate] class MutableAggregationBufferImpl(
    schema: StructType,
    toCatalystConverters: Array[Any => Any],
    toScalaConverters: Array[Any => Any],
    bufferOffset: Int,
    var underlyingBuffer: InternalRow)
  extends MutableAggregationBuffer with BufferSetterGetterUtils {

  private[this] val offsets: Array[Int] = {
    val newOffsets = new Array[Int](length)
    var i = 0
    while (i < newOffsets.length) {
      newOffsets(i) = bufferOffset + i
      i += 1
    }
    newOffsets
  }

  private[this] val bufferValueGetters = createGetters(schema)

  private[this] val bufferValueSetters = createSetters(schema)

  override def length: Int = toCatalystConverters.length

  override def get(i: Int): Any = {
    if (i >= length || i < 0) {
      throw new IllegalArgumentException(
        s"Could not access ${i}th value in this buffer because it only has $length values.")
    }

    toScalaConverters(i)(bufferValueGetters(i)(underlyingBuffer, offsets(i)))
  }

  def update(i: Int, value: Any): Unit = {
    if (i >= length || i < 0) {
      throw new IllegalArgumentException(
        s"Could not update ${i}th value in this buffer because it only has $length values.")
    }

    bufferValueSetters(i)(underlyingBuffer, offsets(i), toCatalystConverters(i)(value))
  }

  // Because get method call specialized getter based on the schema, we cannot use the
  // default implementation of the isNullAt (which is get(i) == null).
  // We have to override it to call isNullAt of the underlyingBuffer.
  override def isNullAt(i: Int): Boolean = {
    underlyingBuffer.isNullAt(offsets(i))
  }

  override def copy(): MutableAggregationBufferImpl = {
    new MutableAggregationBufferImpl(
      schema,
      toCatalystConverters,
      toScalaConverters,
      bufferOffset,
      underlyingBuffer)
  }
}

/**
 * A [[Row]] representing an immutable aggregation buffer.
 */
private[aggregate] class InputAggregationBuffer(
    schema: StructType,
    toCatalystConverters: Array[Any => Any],
    toScalaConverters: Array[Any => Any],
    bufferOffset: Int,
    var underlyingInputBuffer: InternalRow)
  extends Row with BufferSetterGetterUtils {

  private[this] val offsets: Array[Int] = {
    val newOffsets = new Array[Int](length)
    var i = 0
    while (i < newOffsets.length) {
      newOffsets(i) = bufferOffset + i
      i += 1
    }
    newOffsets
  }

  private[this] val bufferValueGetters = createGetters(schema)

  def getBufferOffset: Int = bufferOffset

  override def length: Int = toCatalystConverters.length

  override def get(i: Int): Any = {
    if (i >= length || i < 0) {
      throw new IllegalArgumentException(
        s"Could not access ${i}th value in this buffer because it only has $length values.")
    }
    toScalaConverters(i)(bufferValueGetters(i)(underlyingInputBuffer, offsets(i)))
  }

  // Because get method call specialized getter based on the schema, we cannot use the
  // default implementation of the isNullAt (which is get(i) == null).
  // We have to override it to call isNullAt of the underlyingInputBuffer.
  override def isNullAt(i: Int): Boolean = {
    underlyingInputBuffer.isNullAt(offsets(i))
  }

  override def copy(): InputAggregationBuffer = {
    new InputAggregationBuffer(
      schema,
      toCatalystConverters,
      toScalaConverters,
      bufferOffset,
      underlyingInputBuffer)
  }
}

/**
 * The internal wrapper used to hook a [[UserDefinedAggregateFunction]] `udaf` in the
 * internal aggregation code path.
 */
case class ScalaUDAF(
    children: Seq[Expression],
    udaf: UserDefinedAggregateFunction,
    mutableAggBufferOffset: Int = 0,
    inputAggBufferOffset: Int = 0,
    udafName: Option[String] = None)
  extends ImperativeAggregate
  with NonSQLExpression
  with Logging
  with ImplicitCastInputTypes
  with UserDefinedExpression {

  override def withNewMutableAggBufferOffset(newMutableAggBufferOffset: Int): ImperativeAggregate =
    copy(mutableAggBufferOffset = newMutableAggBufferOffset)

  override def withNewInputAggBufferOffset(newInputAggBufferOffset: Int): ImperativeAggregate =
    copy(inputAggBufferOffset = newInputAggBufferOffset)

  override def nullable: Boolean = true

  override def dataType: DataType = udaf.dataType

  override lazy val deterministic: Boolean = udaf.deterministic

  override val inputTypes: Seq[DataType] = udaf.inputSchema.map(_.dataType)

  override val aggBufferSchema: StructType = udaf.bufferSchema

  override val aggBufferAttributes: Seq[AttributeReference] = aggBufferSchema.toAttributes

  // Note: although this simply copies aggBufferAttributes, this common code can not be placed
  // in the superclass because that will lead to initialization ordering issues.
  override val inputAggBufferAttributes: Seq[AttributeReference] =
    aggBufferAttributes.map(_.newInstance())

  private[this] lazy val childrenSchema: StructType = {
    val inputFields = children.zipWithIndex.map {
      case (child, index) =>
        StructField(s"input$index", child.dataType, child.nullable, Metadata.empty)
    }
    StructType(inputFields)
  }

  private lazy val inputProjection = {
    val inputAttributes = childrenSchema.toAttributes
    log.debug(
      s"Creating MutableProj: $children, inputSchema: $inputAttributes.")
    MutableProjection.create(children, inputAttributes)
  }

  private[this] lazy val inputToScalaConverters: Any => Any =
    CatalystTypeConverters.createToScalaConverter(childrenSchema)

  private[this] lazy val bufferValuesToCatalystConverters: Array[Any => Any] = {
    aggBufferSchema.fields.map { field =>
      CatalystTypeConverters.createToCatalystConverter(field.dataType)
    }
  }

  private[this] lazy val bufferValuesToScalaConverters: Array[Any => Any] = {
    aggBufferSchema.fields.map { field =>
      CatalystTypeConverters.createToScalaConverter(field.dataType)
    }
  }

  private[this] lazy val outputToCatalystConverter: Any => Any = {
    CatalystTypeConverters.createToCatalystConverter(dataType)
  }

  // This buffer is only used at executor side.
  private[this] lazy val inputAggregateBuffer: InputAggregationBuffer = {
    new InputAggregationBuffer(
      aggBufferSchema,
      bufferValuesToCatalystConverters,
      bufferValuesToScalaConverters,
      inputAggBufferOffset,
      null)
  }

  // This buffer is only used at executor side.
  private[this] lazy val mutableAggregateBuffer: MutableAggregationBufferImpl = {
    new MutableAggregationBufferImpl(
      aggBufferSchema,
      bufferValuesToCatalystConverters,
      bufferValuesToScalaConverters,
      mutableAggBufferOffset,
      null)
  }

  // This buffer is only used at executor side.
  private[this] lazy val evalAggregateBuffer: InputAggregationBuffer = {
    new InputAggregationBuffer(
      aggBufferSchema,
      bufferValuesToCatalystConverters,
      bufferValuesToScalaConverters,
      mutableAggBufferOffset,
      null)
  }

  override def initialize(buffer: InternalRow): Unit = {
    mutableAggregateBuffer.underlyingBuffer = buffer

    udaf.initialize(mutableAggregateBuffer)
  }

  override def update(buffer: InternalRow, input: InternalRow): Unit = {
    mutableAggregateBuffer.underlyingBuffer = buffer

    udaf.update(
      mutableAggregateBuffer,
      inputToScalaConverters(inputProjection(input)).asInstanceOf[Row])
  }

  override def merge(buffer1: InternalRow, buffer2: InternalRow): Unit = {
    mutableAggregateBuffer.underlyingBuffer = buffer1
    inputAggregateBuffer.underlyingInputBuffer = buffer2

    udaf.merge(mutableAggregateBuffer, inputAggregateBuffer)
  }

  override def eval(buffer: InternalRow): Any = {
    evalAggregateBuffer.underlyingInputBuffer = buffer

    outputToCatalystConverter(udaf.evaluate(evalAggregateBuffer))
  }

  override def toString: String = {
    s"""$nodeName(${children.mkString(",")})"""
  }

  override def nodeName: String = name

  override def name: String = udafName.getOrElse(udaf.getClass.getSimpleName)

  override protected def withNewChildrenInternal(newChildren: IndexedSeq[Expression]): ScalaUDAF =
    copy(children = newChildren)
}

case class ScalaAggregator[IN, BUF, OUT](
    children: Seq[Expression],
    agg: Aggregator[IN, BUF, OUT],
    inputEncoder: ExpressionEncoder[IN],
    bufferEncoder: ExpressionEncoder[BUF],
    nullable: Boolean = true,
    isDeterministic: Boolean = true,
    mutableAggBufferOffset: Int = 0,
    inputAggBufferOffset: Int = 0,
    aggregatorName: Option[String] = None)
  extends TypedImperativeAggregate[BUF]
  with NonSQLExpression
  with UserDefinedExpression
  with ImplicitCastInputTypes
  with Logging {

  // input and buffer encoders are resolved by ResolveEncodersInScalaAgg
  private[this] lazy val inputDeserializer = inputEncoder.createDeserializer()
  private[this] lazy val bufferSerializer = bufferEncoder.createSerializer()
  private[this] lazy val bufferDeserializer = bufferEncoder.createDeserializer()
  private[this] lazy val outputEncoder = agg.outputEncoder.asInstanceOf[ExpressionEncoder[OUT]]
  private[this] lazy val outputSerializer = outputEncoder.createSerializer()

  def dataType: DataType = outputEncoder.objSerializer.dataType

  def inputTypes: Seq[DataType] = inputEncoder.schema.map(_.dataType)

  override lazy val deterministic: Boolean = isDeterministic

  def withNewMutableAggBufferOffset(newMutableAggBufferOffset: Int): ScalaAggregator[IN, BUF, OUT] =
    copy(mutableAggBufferOffset = newMutableAggBufferOffset)

  def withNewInputAggBufferOffset(newInputAggBufferOffset: Int): ScalaAggregator[IN, BUF, OUT] =
    copy(inputAggBufferOffset = newInputAggBufferOffset)

  private[this] lazy val inputProjection = UnsafeProjection.create(children)

  def createAggregationBuffer(): BUF = agg.zero

  def update(buffer: BUF, input: InternalRow): BUF =
    agg.reduce(buffer, inputDeserializer(inputProjection(input)))

  def merge(buffer: BUF, input: BUF): BUF = agg.merge(buffer, input)

  def eval(buffer: BUF): Any = {
    val row = outputSerializer(agg.finish(buffer))
    if (outputEncoder.isSerializedAsStruct) row else row.get(0, dataType)
  }

  private[this] lazy val bufferRow = new UnsafeRow(bufferEncoder.namedExpressions.length)

  def serialize(agg: BUF): Array[Byte] =
    bufferSerializer(agg).asInstanceOf[UnsafeRow].getBytes()

  def deserialize(storageFormat: Array[Byte]): BUF = {
    bufferRow.pointTo(storageFormat, storageFormat.length)
    bufferDeserializer(bufferRow)
  }

  override def toString: String = s"""${nodeName}(${children.mkString(",")})"""

  override def nodeName: String = name

  override def name: String = aggregatorName.getOrElse(agg.getClass.getSimpleName)

  override protected def withNewChildrenInternal(
      newChildren: IndexedSeq[Expression]): ScalaAggregator[IN, BUF, OUT] =
    copy(children = newChildren)
}

/**
 * An extension rule to resolve encoder expressions from a [[ScalaAggregator]]
 */
object ResolveEncodersInScalaAgg extends Rule[LogicalPlan] {
  override def apply(plan: LogicalPlan): LogicalPlan = plan.resolveOperatorsUp {
    case p if !p.resolved => p
    case p => p.transformExpressionsUp {
      case agg: ScalaAggregator[_, _, _] =>
        agg.copy(
          inputEncoder = agg.inputEncoder.resolveAndBind(),
          bufferEncoder = agg.bufferEncoder.resolveAndBind())
    }
  }
}


text:
<!DOCTYPE html>
<meta http-equiv="Content-Security-Policy" content="connect-src 'none';">
<title>Page With CSP</title>


text:
autoload -U edit-command-line
zle -N edit-command-line
bindkey '\C-x\C-e' edit-command-line


text:
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
		<title>AB test</title>


text:
package debugging

import (
	"testing"

	appsv1 "k8s.io/api/apps/v1"
	batchv1 "k8s.io/api/batch/v1"
	v1 "k8s.io/api/core/v1"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/apimachinery/pkg/runtime"

	"github.com/GoogleContainerTools/skaffold/pkg/skaffold/debug"
	"github.com/GoogleContainerTools/skaffold/pkg/skaffold/debug/types"
	"github.com/GoogleContainerTools/skaffold/pkg/skaffold/kubernetes/debugging/adapter"
	"github.com/GoogleContainerTools/skaffold/testutil"
)

func TestDlvTransformerApply(t *testing.T) {
	tests := []struct {
		description   string
		containerSpec v1.Container
		configuration debug.ImageConfiguration
		shouldErr     bool
		result        v1.Container
		debugConfig   types.ContainerDebugConfiguration
		image         string
	}{
		{
			description:   "empty",
			containerSpec: v1.Container{},
			configuration: debug.ImageConfiguration{},
			shouldErr:     true,
		},
		{
			description:   "basic",
			containerSpec: v1.Container{},
			configuration: debug.ImageConfiguration{Entrypoint: []string{"app", "arg"}},
			result: v1.Container{
				Command: []string{"/dbg/go/bin/dlv", "exec", "--headless", "--continue", "--accept-multiclient", "--listen=:56268", "--api-version=2", "app", "--", "arg"},
				Ports:   []v1.ContainerPort{{Name: "dlv", ContainerPort: 56268}},
			},
			debugConfig: types.ContainerDebugConfiguration{Runtime: "go", Ports: map[string]uint32{"dlv": 56268}},
			image:       "go",
		},
		{
			description: "existing port",
			containerSpec: v1.Container{
				Ports: []v1.ContainerPort{{Name: "http-server", ContainerPort: 8080}},
			},
			configuration: debug.ImageConfiguration{Entrypoint: []string{"app", "arg"}},
			result: v1.Container{
				Command: []string{"/dbg/go/bin/dlv", "exec", "--headless", "--continue", "--accept-multiclient", "--listen=:56268", "--api-version=2", "app", "--", "arg"},
				Ports:   []v1.ContainerPort{{Name: "http-server", ContainerPort: 8080}, {Name: "dlv", ContainerPort: 56268}},
			},
			debugConfig: types.ContainerDebugConfiguration{Runtime: "go", Ports: map[string]uint32{"dlv": 56268}},
			image:       "go",
		},
		{
			description: "existing dlv port",
			containerSpec: v1.Container{
				Ports: []v1.ContainerPort{{Name: "dlv", ContainerPort: 7896}},
			},
			configuration: debug.ImageConfiguration{Entrypoint: []string{"app", "arg"}},
			result: v1.Container{
				Command: []string{"/dbg/go/bin/dlv", "exec", "--headless", "--continue", "--accept-multiclient", "--listen=:56268", "--api-version=2", "app", "--", "arg"},
				Ports:   []v1.ContainerPort{{Name: "dlv", ContainerPort: 56268}},
			},
			debugConfig: types.ContainerDebugConfiguration{Runtime: "go", Ports: map[string]uint32{"dlv": 56268}},
			image:       "go",
		},
		{
			description:   "command not entrypoint",
			containerSpec: v1.Container{},
			configuration: debug.ImageConfiguration{Arguments: []string{"app", "arg"}},
			result: v1.Container{
				Args:  []string{"/dbg/go/bin/dlv", "exec", "--headless", "--continue", "--accept-multiclient", "--listen=:56268", "--api-version=2", "app", "--", "arg"},
				Ports: []v1.ContainerPort{{Name: "dlv", ContainerPort: 56268}},
			},
			debugConfig: types.ContainerDebugConfiguration{Runtime: "go", Ports: map[string]uint32{"dlv": 56268}},
			image:       "go",
		},
		{
			description: "entrypoint with args in container spec",
			containerSpec: v1.Container{
				Args: []string{"arg1", "arg2"},
			},
			configuration: debug.ImageConfiguration{Entrypoint: []string{"app"}},
			result: v1.Container{
				Command: []string{"/dbg/go/bin/dlv", "exec", "--headless", "--continue", "--accept-multiclient", "--listen=:56268", "--api-version=2", "app", "--"},
				Args:    []string{"arg1", "arg2"},
				Ports:   []v1.ContainerPort{{Name: "dlv", ContainerPort: 56268}},
			},
			debugConfig: types.ContainerDebugConfiguration{Runtime: "go", Ports: map[string]uint32{"dlv": 56268}},
			image:       "go",
		},
	}
	var identity debug.PortAllocator = func(port int32) int32 {
		return port
	}
	for _, test := range tests {
		testutil.Run(t, test.description, func(t *testutil.T) {
			adapter := adapter.NewAdapter(&test.containerSpec)
			config, image, err := debug.NewDlvTransformer().Apply(adapter, test.configuration, identity, nil)
			adapter.Apply()

			t.CheckError(test.shouldErr, err)
			t.CheckDeepEqual(test.result, test.containerSpec)
			t.CheckDeepEqual(test.debugConfig, config)
			t.CheckDeepEqual(test.image, image)
		})
	}
}

func TestTransformManifestDelve(t *testing.T) {
	int32p := func(x int32) *int32 { return &x }
	tests := []struct {
		description string
		in          runtime.Object
		transformed bool
		out         runtime.Object
	}{
		{
			"Pod with no transformable container",
			&v1.Pod{
				Spec: v1.PodSpec{Containers: []v1.Container{
					{
						Name:    "test",
						Command: []string{"echo", "Hello World"},
					},
				}}},
			false,
			&v1.Pod{
				Spec: v1.PodSpec{Containers: []v1.Container{
					{
						Name:    "test",
						Command: []string{"echo", "Hello World"},
					},
				}}},
		},
		{
			"Pod with Go container with GOMAXPROCS",
			&v1.Pod{
				Spec: v1.PodSpec{
					Containers: []v1.Container{{
						Name:    "test",
						Command: []string{"app", "arg"},
						Env:     []v1.EnvVar{{Name: "GOMAXPROCS", Value: "1"}},
					}},
				}},
			true,
			&v1.Pod{
				ObjectMeta: metav1.ObjectMeta{
					Annotations: map[string]string{"debug.cloud.google.com/config": `{"test":{"runtime":"go","ports":{"dlv":56268}}}`},
				},
				Spec: v1.PodSpec{
					Containers: []v1.Container{{
						Name:         "test",
						Command:      []string{"/dbg/go/bin/dlv", "exec", "--headless", "--continue", "--accept-multiclient", "--listen=:56268", "--api-version=2", "app", "--", "arg"},
						Ports:        []v1.ContainerPort{{Name: "dlv", ContainerPort: 56268}},
						Env:          []v1.EnvVar{{Name: "GOMAXPROCS", Value: "1"}},
						VolumeMounts: []v1.VolumeMount{{Name: "debugging-support-files", MountPath: "/dbg"}},
					}},
					InitContainers: []v1.Container{{
						Name:         "install-go-debug-support",
						Image:        "HELPERS/go",
						VolumeMounts: []v1.VolumeMount{{Name: "debugging-support-files", MountPath: "/dbg"}},
					}},
					Volumes: []v1.Volume{{
						Name:         "debugging-support-files",
						VolumeSource: v1.VolumeSource{EmptyDir: &v1.EmptyDirVolumeSource{}},
					}},
				}},
		},
		{
			"Deployment with Go container",
			&appsv1.Deployment{
				Spec: appsv1.DeploymentSpec{
					Replicas: int32p(2),
					Template: v1.PodTemplateSpec{
						Spec: v1.PodSpec{
							Containers: []v1.Container{{
								Name:    "test",
								Command: []string{"app", "arg"},
								Env:     []v1.EnvVar{{Name: "GOMAXPROCS", Value: "1"}},
							}},
						}}}},
			true,
			&appsv1.Deployment{
				// ObjectMeta: metav1.ObjectMeta{
				//  Labels: map[string]string{"debug.cloud.google.com/enabled": `yes`},
				// },
				Spec: appsv1.DeploymentSpec{
					Replicas: int32p(1),
					Template: v1.PodTemplateSpec{
						ObjectMeta: metav1.ObjectMeta{
							Annotations: map[string]string{"debug.cloud.google.com/config": `{"test":{"runtime":"go","ports":{"dlv":56268}}}`},
						},
						Spec: v1.PodSpec{
							Containers: []v1.Container{{
								Name:         "test",
								Command:      []string{"/dbg/go/bin/dlv", "exec", "--headless", "--continue", "--accept-multiclient", "--listen=:56268", "--api-version=2", "app", "--", "arg"},
								Ports:        []v1.ContainerPort{{Name: "dlv", ContainerPort: 56268}},
								Env:          []v1.EnvVar{{Name: "GOMAXPROCS", Value: "1"}},
								VolumeMounts: []v1.VolumeMount{{Name: "debugging-support-files", MountPath: "/dbg"}},
							}},
							InitContainers: []v1.Container{{
								Name:         "install-go-debug-support",
								Image:        "HELPERS/go",
								VolumeMounts: []v1.VolumeMount{{Name: "debugging-support-files", MountPath: "/dbg"}},
							}},
							Volumes: []v1.Volume{{
								Name:         "debugging-support-files",
								VolumeSource: v1.VolumeSource{EmptyDir: &v1.EmptyDirVolumeSource{}},
							}},
						}}}},
		},
		{
			"ReplicaSet with Go container",
			&appsv1.ReplicaSet{
				Spec: appsv1.ReplicaSetSpec{
					Replicas: int32p(2),
					Template: v1.PodTemplateSpec{
						Spec: v1.PodSpec{
							Containers: []v1.Container{{
								Name:    "test",
								Command: []string{"app", "arg"},
								Env:     []v1.EnvVar{{Name: "GOMAXPROCS", Value: "1"}},
							}},
						}}}},
			true,
			&appsv1.ReplicaSet{
				// ObjectMeta: metav1.ObjectMeta{
				//	Labels: map[string]string{"debug.cloud.google.com/enabled": `yes`},
				// },
				Spec: appsv1.ReplicaSetSpec{
					Replicas: int32p(1),
					Template: v1.PodTemplateSpec{
						ObjectMeta: metav1.ObjectMeta{
							Annotations: map[string]string{"debug.cloud.google.com/config": `{"test":{"runtime":"go","ports":{"dlv":56268}}}`},
						},
						Spec: v1.PodSpec{
							Containers: []v1.Container{{
								Name:         "test",
								Command:      []string{"/dbg/go/bin/dlv", "exec", "--headless", "--continue", "--accept-multiclient", "--listen=:56268", "--api-version=2", "app", "--", "arg"},
								Ports:        []v1.ContainerPort{{Name: "dlv", ContainerPort: 56268}},
								Env:          []v1.EnvVar{{Name: "GOMAXPROCS", Value: "1"}},
								VolumeMounts: []v1.VolumeMount{{Name: "debugging-support-files", MountPath: "/dbg"}},
							}},
							InitContainers: []v1.Container{{
								Name:         "install-go-debug-support",
								Image:        "HELPERS/go",
								VolumeMounts: []v1.VolumeMount{{Name: "debugging-support-files", MountPath: "/dbg"}},
							}},
							Volumes: []v1.Volume{{
								Name:         "debugging-support-files",
								VolumeSource: v1.VolumeSource{EmptyDir: &v1.EmptyDirVolumeSource{}},
							}},
						}}}},
		},
		{
			"StatefulSet with Go container",
			&appsv1.StatefulSet{
				Spec: appsv1.StatefulSetSpec{
					Replicas: int32p(2),
					Template: v1.PodTemplateSpec{
						Spec: v1.PodSpec{
							Containers: []v1.Container{{
								Name:    "test",
								Command: []string{"app", "arg"},
								Env:     []v1.EnvVar{{Name: "GOMAXPROCS", Value: "1"}},
							}},
						}}}},
			true,
			&appsv1.StatefulSet{
				// ObjectMeta: metav1.ObjectMeta{
				//	Labels: map[string]string{"debug.cloud.google.com/enabled": `yes`},
				// },
				Spec: appsv1.StatefulSetSpec{
					Replicas: int32p(1),
					Template: v1.PodTemplateSpec{
						ObjectMeta: metav1.ObjectMeta{
							Annotations: map[string]string{"debug.cloud.google.com/config": `{"test":{"runtime":"go","ports":{"dlv":56268}}}`},
						},
						Spec: v1.PodSpec{
							Containers: []v1.Container{{
								Name:         "test",
								Command:      []string{"/dbg/go/bin/dlv", "exec", "--headless", "--continue", "--accept-multiclient", "--listen=:56268", "--api-version=2", "app", "--", "arg"},
								Ports:        []v1.ContainerPort{{Name: "dlv", ContainerPort: 56268}},
								Env:          []v1.EnvVar{{Name: "GOMAXPROCS", Value: "1"}},
								VolumeMounts: []v1.VolumeMount{{Name: "debugging-support-files", MountPath: "/dbg"}},
							}},
							InitContainers: []v1.Container{{
								Name:         "install-go-debug-support",
								Image:        "HELPERS/go",
								VolumeMounts: []v1.VolumeMount{{Name: "debugging-support-files", MountPath: "/dbg"}},
							}},
							Volumes: []v1.Volume{{
								Name:         "debugging-support-files",
								VolumeSource: v1.VolumeSource{EmptyDir: &v1.EmptyDirVolumeSource{}},
							}},
						}}}},
		},
		{
			"DaemonSet with Go container",
			&appsv1.DaemonSet{
				Spec: appsv1.DaemonSetSpec{
					Template: v1.PodTemplateSpec{
						Spec: v1.PodSpec{
							Containers: []v1.Container{{
								Name:    "test",
								Command: []string{"app", "arg"},
								Env:     []v1.EnvVar{{Name: "GOMAXPROCS", Value: "1"}},
							}},
						}}}},
			true,
			&appsv1.DaemonSet{
				// ObjectMeta: metav1.ObjectMeta{
				//	Labels: map[string]string{"debug.cloud.google.com/enabled": `yes`},
				// },
				Spec: appsv1.DaemonSetSpec{
					Template: v1.PodTemplateSpec{
						ObjectMeta: metav1.ObjectMeta{
							Annotations: map[string]string{"debug.cloud.google.com/config": `{"test":{"runtime":"go","ports":{"dlv":56268}}}`},
						},
						Spec: v1.PodSpec{
							Containers: []v1.Container{{
								Name:         "test",
								Command:      []string{"/dbg/go/bin/dlv", "exec", "--headless", "--continue", "--accept-multiclient", "--listen=:56268", "--api-version=2", "app", "--", "arg"},
								Ports:        []v1.ContainerPort{{Name: "dlv", ContainerPort: 56268}},
								Env:          []v1.EnvVar{{Name: "GOMAXPROCS", Value: "1"}},
								VolumeMounts: []v1.VolumeMount{{Name: "debugging-support-files", MountPath: "/dbg"}},
							}},
							InitContainers: []v1.Container{{
								Name:         "install-go-debug-support",
								Image:        "HELPERS/go",
								VolumeMounts: []v1.VolumeMount{{Name: "debugging-support-files", MountPath: "/dbg"}},
							}},
							Volumes: []v1.Volume{{
								Name:         "debugging-support-files",
								VolumeSource: v1.VolumeSource{EmptyDir: &v1.EmptyDirVolumeSource{}},
							}},
						}}}},
		},
		{
			"Job with Go container",
			&batchv1.Job{
				Spec: batchv1.JobSpec{
					Template: v1.PodTemplateSpec{
						Spec: v1.PodSpec{
							Containers: []v1.Container{{
								Name:    "test",
								Command: []string{"app", "arg"},
								Env:     []v1.EnvVar{{Name: "GOMAXPROCS", Value: "1"}},
							}},
						}}}},
			true,
			&batchv1.Job{
				// ObjectMeta: metav1.ObjectMeta{
				//	Labels: map[string]string{"debug.cloud.google.com/enabled": `yes`},
				// },
				Spec: batchv1.JobSpec{
					Template: v1.PodTemplateSpec{
						ObjectMeta: metav1.ObjectMeta{
							Annotations: map[string]string{"debug.cloud.google.com/config": `{"test":{"runtime":"go","ports":{"dlv":56268}}}`},
						},
						Spec: v1.PodSpec{
							Containers: []v1.Container{{
								Name:         "test",
								Command:      []string{"/dbg/go/bin/dlv", "exec", "--headless", "--continue", "--accept-multiclient", "--listen=:56268", "--api-version=2", "app", "--", "arg"},
								Ports:        []v1.ContainerPort{{Name: "dlv", ContainerPort: 56268}},
								Env:          []v1.EnvVar{{Name: "GOMAXPROCS", Value: "1"}},
								VolumeMounts: []v1.VolumeMount{{Name: "debugging-support-files", MountPath: "/dbg"}},
							}},
							InitContainers: []v1.Container{{
								Name:         "install-go-debug-support",
								Image:        "HELPERS/go",
								VolumeMounts: []v1.VolumeMount{{Name: "debugging-support-files", MountPath: "/dbg"}},
							}},
							Volumes: []v1.Volume{{
								Name:         "debugging-support-files",
								VolumeSource: v1.VolumeSource{EmptyDir: &v1.EmptyDirVolumeSource{}},
							}},
						}}}},
		},
		{
			"ReplicationController with Go container",
			&v1.ReplicationController{
				Spec: v1.ReplicationControllerSpec{
					Replicas: int32p(2),
					Template: &v1.PodTemplateSpec{
						Spec: v1.PodSpec{
							Containers: []v1.Container{{
								Name:    "test",
								Command: []string{"app", "arg"},
								Env:     []v1.EnvVar{{Name: "GOMAXPROCS", Value: "1"}},
							}},
						}}}},
			true,
			&v1.ReplicationController{
				// ObjectMeta: metav1.ObjectMeta{
				//	Labels: map[string]string{"debug.cloud.google.com/enabled": `yes`},
				// },
				Spec: v1.ReplicationControllerSpec{
					Replicas: int32p(1),
					Template: &v1.PodTemplateSpec{
						ObjectMeta: metav1.ObjectMeta{
							Annotations: map[string]string{"debug.cloud.google.com/config": `{"test":{"runtime":"go","ports":{"dlv":56268}}}`},
						},
						Spec: v1.PodSpec{
							Containers: []v1.Container{{
								Name:         "test",
								Command:      []string{"/dbg/go/bin/dlv", "exec", "--headless", "--continue", "--accept-multiclient", "--listen=:56268", "--api-version=2", "app", "--", "arg"},
								Ports:        []v1.ContainerPort{{Name: "dlv", ContainerPort: 56268}},
								Env:          []v1.EnvVar{{Name: "GOMAXPROCS", Value: "1"}},
								VolumeMounts: []v1.VolumeMount{{Name: "debugging-support-files", MountPath: "/dbg"}},
							}},
							InitContainers: []v1.Container{{
								Name:         "install-go-debug-support",
								Image:        "HELPERS/go",
								VolumeMounts: []v1.VolumeMount{{Name: "debugging-support-files", MountPath: "/dbg"}},
							}},
							Volumes: []v1.Volume{{
								Name:         "debugging-support-files",
								VolumeSource: v1.VolumeSource{EmptyDir: &v1.EmptyDirVolumeSource{}},
							}},
						}}}},
		},
		{
			"PodList with Go and non-Go container",
			&v1.PodList{
				Items: []v1.Pod{
					{
						Spec: v1.PodSpec{
							Containers: []v1.Container{{
								Name:    "echo",
								Command: []string{"echo", "Hello World"},
							}},
						}},
					{
						Spec: v1.PodSpec{
							Containers: []v1.Container{{
								Name:    "test",
								Command: []string{"app", "arg"},
								Env:     []v1.EnvVar{{Name: "GOMAXPROCS", Value: "1"}},
							}},
						}},
				}},
			true,
			&v1.PodList{
				Items: []v1.Pod{
					{
						Spec: v1.PodSpec{
							Containers: []v1.Container{{
								Name:    "echo",
								Command: []string{"echo", "Hello World"},
							}},
						}},
					{
						ObjectMeta: metav1.ObjectMeta{
							Annotations: map[string]string{"debug.cloud.google.com/config": `{"test":{"runtime":"go","ports":{"dlv":56268}}}`},
						},
						Spec: v1.PodSpec{
							Containers: []v1.Container{{
								Name:         "test",
								Command:      []string{"/dbg/go/bin/dlv", "exec", "--headless", "--continue", "--accept-multiclient", "--listen=:56268", "--api-version=2", "app", "--", "arg"},
								Ports:        []v1.ContainerPort{{Name: "dlv", ContainerPort: 56268}},
								Env:          []v1.EnvVar{{Name: "GOMAXPROCS", Value: "1"}},
								VolumeMounts: []v1.VolumeMount{{Name: "debugging-support-files", MountPath: "/dbg"}},
							}},
							InitContainers: []v1.Container{{
								Name:         "install-go-debug-support",
								Image:        "HELPERS/go",
								VolumeMounts: []v1.VolumeMount{{Name: "debugging-support-files", MountPath: "/dbg"}},
							}},
							Volumes: []v1.Volume{{
								Name:         "debugging-support-files",
								VolumeSource: v1.VolumeSource{EmptyDir: &v1.EmptyDirVolumeSource{}},
							}},
						}},
				}},
		},
	}
	for _, test := range tests {
		testutil.Run(t, test.description, func(t *testutil.T) {
			value := test.in.DeepCopyObject()

			retriever := func(image string) (debug.ImageConfiguration, error) {
				return debug.ImageConfiguration{}, nil
			}
			result := transformManifest(value, retriever, "HELPERS")

			t.CheckDeepEqual(test.transformed, result)
			t.CheckDeepEqual(test.out, value)
		})
	}
}


text:
/*
 * 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.
 */

package com.facebook.presto.orc;

import com.facebook.presto.common.Page;
import com.facebook.presto.common.block.Block;
import com.facebook.presto.common.block.BlockBuilder;
import com.facebook.presto.common.block.RowBlock;
import com.facebook.presto.common.io.OutputStreamDataSink;
import com.facebook.presto.common.type.NamedTypeSignature;
import com.facebook.presto.common.type.RowFieldName;
import com.facebook.presto.common.type.StandardTypes;
import com.facebook.presto.common.type.Type;
import com.facebook.presto.common.type.TypeSignatureParameter;
import com.facebook.presto.metadata.FunctionAndTypeManager;
import com.facebook.presto.orc.cache.StorageOrcFileTailSource;
import com.facebook.presto.spi.ConnectorSession;
import com.facebook.presto.testing.TestingConnectorSession;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import io.airlift.slice.Slices;
import io.airlift.units.DataSize;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;

import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;

import static com.facebook.presto.common.type.VarcharType.VARCHAR;
import static com.facebook.presto.metadata.FunctionAndTypeManager.createTestFunctionAndTypeManager;
import static com.facebook.presto.orc.DwrfEncryptionProvider.NO_ENCRYPTION;
import static com.facebook.presto.orc.NoopOrcAggregatedMemoryContext.NOOP_ORC_AGGREGATED_MEMORY_CONTEXT;
import static com.facebook.presto.orc.OrcEncoding.ORC;
import static com.facebook.presto.orc.OrcTester.HIVE_STORAGE_TIME_ZONE;
import static com.facebook.presto.orc.OrcWriteValidation.OrcWriteValidationMode.BOTH;
import static com.facebook.presto.orc.TestingOrcPredicate.ORC_ROW_GROUP_SIZE;
import static com.facebook.presto.orc.TestingOrcPredicate.ORC_STRIPE_SIZE;
import static com.facebook.presto.orc.metadata.CompressionKind.NONE;
import static io.airlift.units.DataSize.Unit.MEGABYTE;
import static org.joda.time.DateTimeZone.UTC;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNull;

@Test(singleThreaded = true)
public class TestStructBatchStreamReader
{
    private static final FunctionAndTypeManager FUNCTION_AND_TYPE_MANAGER = createTestFunctionAndTypeManager();

    private static final Type TEST_DATA_TYPE = VARCHAR;

    private static final String STRUCT_COL_NAME = "struct_col";

    public static final ConnectorSession SESSION = new TestingConnectorSession(ImmutableList.of());

    private TempFile tempFile;

    @BeforeMethod
    public void setUp()
    {
        tempFile = new TempFile();
    }

    @AfterMethod
    public void tearDown()
            throws IOException
    {
        tempFile.close();
    }

    /**
     * Reader and writer have the same fields. Checks that fields are read in correctly
     */
    @Test
    public void testValuesAreReadInCorrectly()
            throws IOException
    {
        List<String> readerFields = new ArrayList<>(Arrays.asList("field_a", "field_b", "field_c"));
        List<String> writerFields = new ArrayList<>(Arrays.asList("field_a", "field_b", "field_c"));
        List<String> writerData = new ArrayList<>(Arrays.asList("field_a_value", "field_b_value", "field_c_value"));
        Type readerType = getType(readerFields);
        Type writerType = getType(writerFields);

        write(tempFile, writerType, writerData);
        RowBlock readBlock = read(tempFile, readerType);
        List actual = (List) readerType.getObjectValue(SESSION.getSqlFunctionProperties(), readBlock, 0);

        assertEquals(actual.size(), readerFields.size());
        assertEquals(actual.get(0), "field_a_value");
        assertEquals(actual.get(1), "field_b_value");
        assertEquals(actual.get(2), "field_c_value");
    }

    /**
     * The writer has fields with upper case characters, reader has same names downcased.
     */
    @Test
    public void testReaderLowerCasesFieldNamesFromStream()
            throws IOException
    {
        List<String> readerFields = new ArrayList<>(Arrays.asList("field_a", "field_b", "field_c"));
        List<String> writerFields = new ArrayList<>(Arrays.asList("field_A", "field_B", "field_C"));
        List<String> writerData = new ArrayList<>(Arrays.asList("fieldAValue", "fieldBValue", "fieldCValue"));
        Type readerType = getType(readerFields);
        Type writerType = getType(writerFields);

        write(tempFile, writerType, writerData);
        RowBlock readBlock = read(tempFile, readerType);
        List actual = (List) readerType.getObjectValue(SESSION.getSqlFunctionProperties(), readBlock, 0);

        assertEquals(actual.size(), readerFields.size());
        assertEquals(actual.get(0), "fieldAValue");
        assertEquals(actual.get(1), "fieldBValue");
        assertEquals(actual.get(2), "fieldCValue");
    }

    /**
     * Reader has fields with upper case characters, writer has same names downcased.
     */
    @Test
    public void testReaderLowerCasesFieldNamesFromType()
            throws IOException
    {
        List<String> readerFields = new ArrayList<>(Arrays.asList("field_A", "field_B", "field_C"));
        List<String> writerFields = new ArrayList<>(Arrays.asList("field_a", "field_b", "field_c"));
        List<String> writerData = new ArrayList<>(Arrays.asList("fieldAValue", "fieldBValue", "fieldCValue"));
        Type readerType = getType(readerFields);
        Type writerType = getType(writerFields);

        write(tempFile, writerType, writerData);
        RowBlock readBlock = read(tempFile, readerType);
        List actual = (List) readerType.getObjectValue(SESSION.getSqlFunctionProperties(), readBlock, 0);

        assertEquals(actual.size(), readerFields.size());
        assertEquals(actual.get(0), "fieldAValue");
        assertEquals(actual.get(1), "fieldBValue");
        assertEquals(actual.get(2), "fieldCValue");
    }

    @Test(expectedExceptions = IllegalArgumentException.class, expectedExceptionsMessageRegExp =
            "ROW type does not have field names declared: row\\(varchar,varchar,varchar\\)")
    public void testThrowsExceptionWhenFieldNameMissing()
            throws IOException
    {
        List<String> readerFields = new ArrayList<>(Arrays.asList("field_a", "field_b", "field_c"));
        List<String> writerFields = new ArrayList<>(Arrays.asList("field_a", "field_b", "field_c"));
        List<String> writerData = new ArrayList<>(Arrays.asList("field_a_value", "field_b_value", "field_c_value"));
        Type readerType = getTypeNullName(readerFields.size());
        Type writerType = getType(writerFields);

        write(tempFile, writerType, writerData);
        read(tempFile, readerType);
    }

    /**
     * The reader has a field that is missing from the ORC file
     */
    @Test
    public void testExtraFieldsInReader()
            throws IOException
    {
        List<String> readerFields = new ArrayList<>(Arrays.asList("field_a", "field_b", "field_c"));

        // field_b is missing
        List<String> writerFields = new ArrayList<>(Arrays.asList("field_a", "field_c"));
        List<String> writerData = new ArrayList<>(Arrays.asList("field_a_value", "field_c_value"));
        Type readerType = getType(readerFields);
        Type writerType = getType(writerFields);

        write(tempFile, writerType, writerData);
        RowBlock readBlock = read(tempFile, readerType);
        List actual = (List) readerType.getObjectValue(SESSION.getSqlFunctionProperties(), readBlock, 0);

        assertEquals(actual.size(), readerFields.size());
        assertEquals(actual.get(0), "field_a_value");
        assertNull(actual.get(1));
        assertEquals(actual.get(2), "field_c_value");
    }

    /**
     * The ORC file has a field that is missing from the reader
     */
    @Test
    public void testExtraFieldsInWriter()
            throws IOException
    {
        // field_b is missing
        List<String> readerFields = new ArrayList<>(Arrays.asList("field_a", "field_c"));
        List<String> writerFields = new ArrayList<>(Arrays.asList("field_a", "field_b", "field_c"));
        List<String> writerData = new ArrayList<>(Arrays.asList("field_a_value", "field_b_value", "field_c_value"));
        Type readerType = getType(readerFields);
        Type writerType = getType(writerFields);

        write(tempFile, writerType, writerData);
        RowBlock readBlock = read(tempFile, readerType);
        List actual = (List) readerType.getObjectValue(SESSION.getSqlFunctionProperties(), readBlock, 0);

        assertEquals(actual.size(), readerFields.size());
        assertEquals(actual.get(0), "field_a_value");
        assertEquals(actual.get(1), "field_c_value");
    }

    private void write(TempFile tempFile, Type writerType, List<String> data)
            throws IOException
    {
        OrcWriter writer = new OrcWriter(
                new OutputStreamDataSink(new FileOutputStream(tempFile.getFile())),
                ImmutableList.of(STRUCT_COL_NAME),
                ImmutableList.of(writerType),
                ORC,
                NONE,
                Optional.empty(),
                NO_ENCRYPTION,
                new OrcWriterOptions()
                        .withStripeMinSize(new DataSize(0, MEGABYTE))
                        .withStripeMaxSize(new DataSize(32, MEGABYTE))
                        .withStripeMaxRowCount(ORC_STRIPE_SIZE)
                        .withRowGroupMaxRowCount(ORC_ROW_GROUP_SIZE)
                        .withDictionaryMaxMemory(new DataSize(32, MEGABYTE)),
                ImmutableMap.of(),
                HIVE_STORAGE_TIME_ZONE,
                true,
                BOTH,
                new OrcWriterStats());

        // write down some data with unsorted streams
        Block[] fieldBlocks = new Block[data.size()];

        int entries = 10;
        boolean[] rowIsNull = new boolean[entries];
        Arrays.fill(rowIsNull, false);

        BlockBuilder blockBuilder = TEST_DATA_TYPE.createBlockBuilder(null, entries);
        for (int i = 0; i < data.size(); i++) {
            byte[] bytes = data.get(i).getBytes();
            for (int j = 0; j < entries; j++) {
                blockBuilder.writeBytes(Slices.wrappedBuffer(bytes), 0, bytes.length);
                blockBuilder.closeEntry();
            }
            fieldBlocks[i] = blockBuilder.build();
            blockBuilder = blockBuilder.newBlockBuilderLike(null);
        }
        Block rowBlock = RowBlock.fromFieldBlocks(rowIsNull.length, Optional.of(rowIsNull), fieldBlocks);
        writer.write(new Page(rowBlock));
        writer.close();
    }

    private RowBlock read(TempFile tempFile, Type readerType)
            throws IOException
    {
        DataSize dataSize = new DataSize(1, MEGABYTE);
        OrcDataSource orcDataSource = new FileOrcDataSource(tempFile.getFile(), dataSize, dataSize, dataSize, true);
        OrcReader orcReader = new OrcReader(
                orcDataSource,
                ORC,
                new StorageOrcFileTailSource(),
                new StorageStripeMetadataSource(),
                NOOP_ORC_AGGREGATED_MEMORY_CONTEXT,
                new OrcReaderOptions(
                        dataSize,
                        dataSize,
                        dataSize,
                        false),
                false,
                NO_ENCRYPTION,
                DwrfKeyProvider.EMPTY);

        Map<Integer, Type> includedColumns = new HashMap<>();
        includedColumns.put(0, readerType);

        OrcBatchRecordReader recordReader = orcReader.createBatchRecordReader(
                includedColumns,
                OrcPredicate.TRUE,
                UTC,
                new TestingHiveOrcAggregatedMemoryContext(),
                OrcReader.INITIAL_BATCH_SIZE);

        recordReader.nextBatch();
        RowBlock block = (RowBlock) recordReader.readBlock(0);
        recordReader.close();
        return block;
    }

    private Type getType(List<String> fieldNames)
    {
        ImmutableList.Builder<TypeSignatureParameter> typeSignatureParameters = ImmutableList.builder();
        for (String fieldName : fieldNames) {
            typeSignatureParameters.add(TypeSignatureParameter.of(new NamedTypeSignature(Optional.of(new RowFieldName(fieldName, false)), TEST_DATA_TYPE.getTypeSignature())));
        }
        return FUNCTION_AND_TYPE_MANAGER.getParameterizedType(StandardTypes.ROW, typeSignatureParameters.build());
    }

    private Type getTypeNullName(int numFields)
    {
        ImmutableList.Builder<TypeSignatureParameter> typeSignatureParameters = ImmutableList.builder();

        for (int i = 0; i < numFields; i++) {
            typeSignatureParameters.add(TypeSignatureParameter.of(new NamedTypeSignature(Optional.empty(), TEST_DATA_TYPE.getTypeSignature())));
        }
        return FUNCTION_AND_TYPE_MANAGER.getParameterizedType(StandardTypes.ROW, typeSignatureParameters.build());
    }
}


text:
<?php

namespace Digbang\Security\Permissions;

interface Permission
{
    /**
     * @return string
     */
    public function getName();

    /**
     * @return bool
     */
    public function isAllowed();

    /**
     * Allow this permission.
     */
    public function allow();

    /**
     * Deny this permission.
     */
    public function deny();

    /**
     * Compares two permissions and returns TRUE if they are equal.
     *
     * @param Permission $permission
     *
     * @return bool
     */
    public function equals(Permission $permission);
}


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

// Delegate
#import "QBImagePickerAssetViewDelegate.h"

@interface QBImagePickerAssetView : UIView

@property (nonatomic, assign) id<QBImagePickerAssetViewDelegate> delegate;
@property (nonatomic, retain) ALAsset *asset;
@property (nonatomic, assign) BOOL selected;
@property (nonatomic, assign) BOOL allowsMultipleSelection;

@end


text:
/*!
 * \file    SimulationNBody.h
 * \brief   Higher abstraction for all n-body simulation classes.
 * \author  A. Cassagne
 * \date    2014
 *
 * \section LICENSE
 * This file is under MIT license (https://opensource.org/licenses/MIT).
 */
#ifndef SIMULATION_N_BODY_H_
#define SIMULATION_N_BODY_H_

#include <string>

#include "../../common/core/Bodies.h"

/*!
 * \class  SimulationNBody
 * \brief  This is the main simulation class, it describes the main methods to implement in extended classes.
 *
 * \tparam T : Type.
 */
template <typename T = double>
class SimulationNBody
{
protected:
	const T     G = 6.67384e-11;     /*!< The gravitational constant in m^3.kg^-1.s^-2. */
	Bodies<T>  *bodies;              /*!< Bodies object, represent all the bodies available in space. */
	vector3<T>  accelerations;       /*!< 3D array of bodies acceleration calculated in simulation classes. */
	T          *closestNeighborDist; /*!< Vector of distance between the closest neighbor body (for each body). */
	bool        dtConstant;          /*!< Are we using constant time step? */
	T           dt;                  /*!< Time step value. */
	T           minDt;               /*!< Minimum time step value (useful with variable time step). */
	// stats
	float       flopsPerIte;         /*!< Number of floating-point operations per iteration. */
	float       allocatedBytes;      /*!< Number of allocated bytes. */
	unsigned    nMaxThreads;         /*!< Maximum number of OMP threads available. */

protected:
	/*!
	 *  \brief Constructor.
	 *
	 *  SimulationNBody constructor.
	 *
	 *  \param bodies : Bodies class.
	 */
	SimulationNBody(Bodies<T> *bodies);

public:
	/*!
	 *  \brief Destructor.
	 *
	 *  SimulationNBody destructor.
	 */
	virtual ~SimulationNBody();

	/*!
	 *  \brief Bodies getter.
	 *
	 *  \return Bodies class.
	 */
	const Bodies<T>* getBodies() const;

	/*!
	 *  \brief DtConstant setter.
	 *
	 *  \param dtVal : Constant time step value.
	 */
	void setDtConstant(T dtVal);

	/*!
	 *  \brief DtVariable setter.
	 *
	 *  \param minDt : Minimum time step value.
	 */
	void setDtVariable(T minDt);

	/*!
	 *  \brief Time step getter.
	 *
	 *  \return Time step value.
	 */
	const T& getDt() const;

	/*!
	 *  \brief Flops per iteration getter.
	 *
	 *  \return Flops per iteration.
	 */
	const float& getFlopsPerIte() const;

	/*!
	 *  \brief Allocated bytes getter.
	 *
	 *  \return Number of allocated bytes.
	 */
	const float& getAllocatedBytes() const;

	/*!
	 *  \brief Main compute method.
	 *
	 *  Compute one iteration of the simulation.
	 */
	virtual void computeOneIteration() = 0;

protected:
	/*!
	 *  \brief Initialized data in order to compute an iteration.
	 */
	virtual void initIteration() = 0;

	/*!
	 *  \brief Look for the new time step if dtConstant = false, else do nothing.
	 */
	virtual void findTimeStep() = 0;

	/*!
	 *  \brief Compute the time step for one given body (considering the closest neighbor body).
	 *
	 *  \param iBody : id of the body.
	 *
	 *  \return Computed time step for iBody.
	 */
	T computeTimeStep(const unsigned long iBody);

private:
	/*!
	 *  \brief Allocation of required buffers.
	 */
	void allocateBuffers();
};

#endif /* SIMULATION_N_BODY_H_ */


text:
from .direct_q8 import Direct8BitOp, QDQDirect8BitOp

class QMaxPool(Direct8BitOp):
    def __init__(self, onnx_quantizer, onnx_node):
        super().__init__(onnx_quantizer, onnx_node)

    def quantize(self):
        node = self.node
        assert (node.op_type == "MaxPool")

        # if version is less than 12, go to normal quantize.
        if self.quantizer.opset_version < 12:
            super(Direct8BitOp, self).quantize()
            return

        # Direct 8bits op
        return super().quantize()

class QDQMaxPool(QDQDirect8BitOp):
    def __init__(self, onnx_quantizer, onnx_node):
        super().__init__(onnx_quantizer, onnx_node)

    def quantize(self):
        node = self.node
        assert (node.op_type == "MaxPool")

        # if version is less than 12, just no change
        if self.quantizer.opset_version < 12:
            return

        # Direct 8bits op
        return super().quantize()


text:
// Copyright 2014 PDFium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com

#ifndef _FPDF_EXT_H_
#define _FPDF_EXT_H_

#ifndef _FPDFVIEW_H_
#include "fpdfview.h"
#endif

#ifdef __cplusplus
extern "C" {
#endif

//flags for type of unsupport object.
#define FPDF_UNSP_DOC_XFAFORM				1
#define FPDF_UNSP_DOC_PORTABLECOLLECTION	2
#define FPDF_UNSP_DOC_ATTACHMENT			3
#define FPDF_UNSP_DOC_SECURITY				4
#define FPDF_UNSP_DOC_SHAREDREVIEW			5
#define FPDF_UNSP_DOC_SHAREDFORM_ACROBAT	6
#define FPDF_UNSP_DOC_SHAREDFORM_FILESYSTEM	7
#define FPDF_UNSP_DOC_SHAREDFORM_EMAIL		8
#define FPDF_UNSP_ANNOT_3DANNOT				11
#define FPDF_UNSP_ANNOT_MOVIE				12
#define FPDF_UNSP_ANNOT_SOUND				13
#define FPDF_UNSP_ANNOT_SCREEN_MEDIA		14
#define FPDF_UNSP_ANNOT_SCREEN_RICHMEDIA	15
#define FPDF_UNSP_ANNOT_ATTACHMENT			16
#define FPDF_UNSP_ANNOT_SIG					17

typedef	struct _UNSUPPORT_INFO
{
	/**
	* Version number of the interface. Currently must be 1.
	**/
	int version;

	/**
	* Method: FSDK_UnSupport_Handler
	*			 UnSupport Object process handling function.
	* Interface Version:
	*			1
	* Implementation Required:
	*			Yes
	* Parameters:
	*		pThis		-	Pointer to the interface structure itself.
	*		nType		-	The type of unsupportObject
	* 	Return value:
	* 		None.
	* */

	void(*FSDK_UnSupport_Handler)(_UNSUPPORT_INFO* pThis,int nType);
}UNSUPPORT_INFO;

/**
 * Function: FSDK_SetUnSpObjProcessHandler
 *			 Setup A UnSupport Object process handler for foxit sdk.
 * Parameters:
 *			unsp_info		-	Pointer to a UNSUPPORT_INFO structure.
 * Return Value:
 *			TRUE means successful. FALSE means fails.
 **/

DLLEXPORT FPDF_BOOL STDCALL FSDK_SetUnSpObjProcessHandler(UNSUPPORT_INFO* unsp_info);

//flags for page mode.

//Unknown value
#define PAGEMODE_UNKONOWN		-1

//Neither document outline nor thumbnail images visible
#define PAGEMODE_USENONE		0

//Document outline visible
#define PAGEMODE_USEOUTLINES	1

//Thumbnial images visible
#define PAGEMODE_USETHUMBS		2

//Full-screen mode, with no menu bar, window controls, or any other window visible
#define PAGEMODE_FULLSCREEN		3

//Optional content group panel visible
#define PAGEMODE_USEOC			4

//Attachments panel visible
#define PAGEMODE_USEATTACHMENTS	5

/**
 * Function: FPDFDoc_GetPageMode
 *			 Get the document's PageMode(How the document should be displayed when opened)
 * Parameters:
 *			doc		-	Handle to document. Returned by FPDF_LoadDocument function.
 * Return Value:
 *			The flags for page mode.
 **/
DLLEXPORT int FPDFDoc_GetPageMode(FPDF_DOCUMENT document);

#ifdef __cplusplus
};
#endif
#endif