text:
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * EDACCSolverBinaryDlg.java
 *
 * Created on 09.05.2011, 19:26:38
 */

package edacc;

import edacc.manageDB.ManageDBSolvers;
import edacc.manageDB.SolverBinariesListModel;
import edacc.model.SolverBinaries;
import java.awt.Frame;
import javax.swing.JOptionPane;

/**
 *
 * @author dgall
 */
public class EDACCSolverBinaryDlg extends javax.swing.JDialog {

    public enum DialogMode { CREATE_MODE, EDIT_MODE };

    private SolverBinaries solverBin;
    private SolverBinaries workingCopy;
    private ManageDBSolvers controller;
    private DialogMode mode;

    /** Creates new form EDACCSolverBinaryDlg */
    public EDACCSolverBinaryDlg(Frame parent, SolverBinaries solverBin, ManageDBSolvers controller, DialogMode mode) {
        super(parent, true);
        this.solverBin = solverBin;
        this.workingCopy = new SolverBinaries(solverBin);
        this.controller = controller;
        this.mode = mode;
        setLocationRelativeTo(parent);
        initComponents();
        lbRunPath.setSelectedIndex(0);
        showSolverBin();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        lBinaryName = new javax.swing.JLabel();
        lRunCommand = new javax.swing.JLabel();
        lRunPath = new javax.swing.JLabel();
        tfBinaryName = new javax.swing.JTextField();
        tfRunCommand = new javax.swing.JTextField();
        lCommand = new javax.swing.JLabel();
        lCommandPreview = new javax.swing.JLabel();
        bAddBinary = new javax.swing.JButton();
        bCancel = new javax.swing.JButton();
        lCaption = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        lbRunPath = new javax.swing.JList();
        lVersion = new javax.swing.JLabel();
        tfVersion = new javax.swing.JTextField();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(edacc.EDACCApp.class).getContext().getResourceMap(EDACCSolverBinaryDlg.class);
        setTitle(resourceMap.getString("Form.title")); // NOI18N
        setModal(true);
        setName("Form"); // NOI18N

        lBinaryName.setText(resourceMap.getString("lBinaryName.text")); // NOI18N
        lBinaryName.setName("lBinaryName"); // NOI18N

        lRunCommand.setText(resourceMap.getString("lRunCommand.text")); // NOI18N
        lRunCommand.setName("lRunCommand"); // NOI18N

        lRunPath.setText(resourceMap.getString("lRunPath.text")); // NOI18N
        lRunPath.setName("lRunPath"); // NOI18N

        tfBinaryName.setText(resourceMap.getString("tfBinaryName.text")); // NOI18N
        tfBinaryName.setName("tfBinaryName"); // NOI18N

        tfRunCommand.setText(resourceMap.getString("tfRunCommand.text")); // NOI18N
        tfRunCommand.setName("tfRunCommand"); // NOI18N
        tfRunCommand.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                tfRunCommandChanged(evt);
            }
        });

        lCommand.setText(resourceMap.getString("lCommand.text")); // NOI18N
        lCommand.setName("lCommand"); // NOI18N

        lCommandPreview.setText(resourceMap.getString("lCommandPreview.text")); // NOI18N
        lCommandPreview.setName("lCommandPreview"); // NOI18N

        bAddBinary.setText(resourceMap.getString("bAddBinary.text")); // NOI18N
        bAddBinary.setName("bAddBinary"); // NOI18N
        bAddBinary.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                addBinary(evt);
            }
        });

        bCancel.setText(resourceMap.getString("bCancel.text")); // NOI18N
        bCancel.setName("bCancel"); // NOI18N
        bCancel.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                bCancelActionPerformed(evt);
            }
        });

        lCaption.setFont(resourceMap.getFont("lCaption.font")); // NOI18N
        lCaption.setText(resourceMap.getString("lCaption.text")); // NOI18N
        lCaption.setName("lCaption"); // NOI18N

        jScrollPane1.setName("jScrollPane1"); // NOI18N

        lbRunPath.setModel(new SolverBinariesListModel(solverBin));
        lbRunPath.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        lbRunPath.setName("lbRunPath"); // NOI18N
        lbRunPath.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
            public void valueChanged(javax.swing.event.ListSelectionEvent evt) {
                lbRuntPathChanged(evt);
            }
        });
        jScrollPane1.setViewportView(lbRunPath);

        lVersion.setText(resourceMap.getString("lVersion.text")); // NOI18N
        lVersion.setName("lVersion"); // NOI18N

        tfVersion.setText(resourceMap.getString("tfVersion.text")); // NOI18N
        tfVersion.setName("tfVersion"); // NOI18N

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lCaption)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(bCancel)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 395, Short.MAX_VALUE)
                        .addComponent(bAddBinary))
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(lRunCommand)
                            .addComponent(lBinaryName)
                            .addComponent(lRunPath)
                            .addComponent(lCommand)
                            .addComponent(lVersion))
                        .addGap(29, 29, 29)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(tfVersion, javax.swing.GroupLayout.DEFAULT_SIZE, 343, Short.MAX_VALUE)
                            .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 343, Short.MAX_VALUE)
                            .addComponent(tfBinaryName, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 343, Short.MAX_VALUE)
                            .addComponent(lCommandPreview, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 343, Short.MAX_VALUE)
                            .addComponent(tfRunCommand, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 343, Short.MAX_VALUE))))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(lCaption)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(tfBinaryName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lBinaryName))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lRunPath)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 151, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(tfRunCommand, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lRunCommand))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lCommandPreview)
                    .addComponent(lCommand, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lVersion)
                    .addComponent(tfVersion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(28, 28, 28)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(bCancel)
                    .addComponent(bAddBinary))
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void addBinary(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addBinary
        solverBin.setBinaryName(tfBinaryName.getText());
        if (tfRunCommand.getText().equals(""))
            solverBin.setRunCommand(null);
        else
            solverBin.setRunCommand(tfRunCommand.getText());
        solverBin.setRunPath((String) lbRunPath.getModel().getElementAt(lbRunPath.getSelectedIndex()));
        solverBin.setVersion(tfVersion.getText());
        try {
            if (mode == DialogMode.CREATE_MODE) {
                // in create mode: add the binary to the solver, in edit mode, do nothing
                controller.addSolverBinary(solverBin);
            }
            this.dispose();
        } catch (Exception ex) {
            JOptionPane.showMessageDialog(this, "An error occured while adding Solver Binary: \n" + ex.getMessage(), "Error!", JOptionPane.ERROR_MESSAGE);
        }
    }//GEN-LAST:event_addBinary

    private void tfRunCommandChanged(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_tfRunCommandChanged
        updateRunCommandLine();
    }//GEN-LAST:event_tfRunCommandChanged

    private void lbRuntPathChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_lbRuntPathChanged
        updateRunCommandLine();
    }//GEN-LAST:event_lbRuntPathChanged

    private void bCancelActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bCancelActionPerformed
        if (mode == DialogMode.EDIT_MODE) {
            // reset object to working copy (status before editing)
            solverBin.setAll(workingCopy);
        }
        this.dispose();
    }//GEN-LAST:event_bCancelActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton bAddBinary;
    private javax.swing.JButton bCancel;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JLabel lBinaryName;
    private javax.swing.JLabel lCaption;
    private javax.swing.JLabel lCommand;
    private javax.swing.JLabel lCommandPreview;
    private javax.swing.JLabel lRunCommand;
    private javax.swing.JLabel lRunPath;
    private javax.swing.JLabel lVersion;
    private javax.swing.JList lbRunPath;
    private javax.swing.JTextField tfBinaryName;
    private javax.swing.JTextField tfRunCommand;
    private javax.swing.JTextField tfVersion;
    // End of variables declaration//GEN-END:variables

    private void updateRunCommandLine() {
        String runCommand = tfRunCommand.getText();
        String runPath = (String) lbRunPath.getModel().getElementAt(lbRunPath.getSelectedIndex());
        if (runCommand != null)
            lCommandPreview.setText(runCommand + " ." + runPath);
        else
            lCommandPreview.setText(runPath);
    }

    private void showSolverBin() {
        if (solverBin == null)
            return;
        tfBinaryName.setText(solverBin.getBinaryName());
        tfRunCommand.setText(solverBin.getRunCommand());
        tfVersion.setText(solverBin.getVersion());
        int selectedIndex = ((SolverBinariesListModel) lbRunPath.getModel()).getIndexOf(solverBin.getRunPath());
        // if an error occured select first index
        if (selectedIndex < 0)
            selectedIndex = 0;
        lbRunPath.setSelectedIndex(selectedIndex);
        if (mode == DialogMode.CREATE_MODE) {
            this.setTitle("Add Solver Binary");
            bAddBinary.setText("Add Binary");
        } else if (mode == DialogMode.EDIT_MODE) {
            this.setTitle("Edit Solver Binary");
            bAddBinary.setText("Edit Binary");
        }
    }

}


text:
{{::$ctrl.text}}

  {{::$ctrl.placeholder}}
<input ng-if="::!$ctrl.placeholder.length"
       type="password"
       readonly
       flex="nogrow"
       class="kd-toggle-hidden-text-input"
       value="{{::$ctrl.text}}">

redpajama_set_name: RedPajamaGithub


text:
Get Zulip notifications from {{ integration_display_name }} via Hubot!

1.  {!create-stream.md!}

1.  Next, [install Hubot](hubot), and test it to make sure it is working.

1.  Finally, [follow these instructions]({{ hubot_docs_url }}) to set up
the integration with {{ integration_display_name }}!


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

namespace M2SA.AppGenome.Threading
{
    /// <summary>
    ///
    /// </summary>
    /// <typeparam name="T"></typeparam>
    public class TaskActionGroup<T> : ITaskActionGroup<T>
    {
        static readonly object syncRoot = new object();
        readonly IWorkItemsGroup threadPool = null;

        #region Properties

        /// <summary>
        /// 是否可以被取消
        /// </summary>
        public bool CanCancel
        {
            get;
            private set;
        }

        /// <summary>
        ///
        /// </summary>
        public int Concurrency
        {
            get;
            private set;
        }

        /// <summary>
        ///
        /// </summary>
        public string Name
        {
            get;
            set;
        }

        /// <summary>
        ///
        /// </summary>
        public Action<T> Action
        {
            get;
            set;
        }

        /// <summary>
        ///
        /// </summary>
        public Queue<T> Items
        {
            get;
            private set;
        }

        /// <summary>
        ///
        /// </summary>
        public TimeSpan PocessInterval
        {
            get;
            set;
        }

        #endregion

        /// <summary>
        ///
        /// </summary>
        /// <param name="name"></param>
        /// <param name="pocessInterval"></param>
        /// <param name="action"></param>
        /// <param name="canCancel"></param>
        public TaskActionGroup(string name, TimeSpan pocessInterval, Action<T> action, bool canCancel)
            : this(name, pocessInterval, action, canCancel,1)
        {
        }

        /// <summary>
        ///
        /// </summary>
        /// <param name="name"></param>
        /// <param name="pocessInterval"></param>
        /// <param name="action"></param>
        /// <param name="canCancel"></param>
        /// <param name="concurrency"></param>
        public TaskActionGroup(string name, TimeSpan pocessInterval, Action<T> action, bool canCancel, int concurrency)
        {
            this.CanCancel = canCancel;
            this.Name = name;
            this.PocessInterval = pocessInterval;
            this.Action = action;

            this.Items = new Queue<T>(32);

            this.Concurrency = concurrency;
            this.threadPool = AppInstance.GetThreadPool().CreateWorkItemsGroup(this.Concurrency);
        }

        /// <summary>
        ///
        /// </summary>
        /// <param name="item"></param>
        public void Enqueue(T item)
        {
            lock (syncRoot)
            {
                this.Items.Enqueue((T)item);
            }
        }

        /// <summary>
        ///
        /// </summary>
        public void Invoke()
        {
            T[] items = null;

            lock (syncRoot)
            {
                if (this.Items.Count > 0)
                {
                    items = this.Items.ToArray();
                    this.Items.Clear();
                }
            }

            if (items != null && items.Length > 0)
            {
                for (var i = 0; i < items.Length; i++)
                {
                    this.Invoke(items[i]);
                }
            }

        }

        /// <summary>
        ///
        /// </summary>
        /// <param name="waitInterval"></param>
        /// <returns></returns>
        public bool Trigger(TimeSpan waitInterval)
        {
            return waitInterval >= this.PocessInterval;
        }

        void Invoke(T item)
        {
            this.threadPool.QueueWorkItem<T>(this.Action, item);
        }
    }
}


text:
@extends('pulsar::layouts.default')

@section('head')
    @parent
    <link rel="stylesheet" href="{{ asset('packages/syscover/pulsar/vendor/jquery.select2/css/select2.css') }}">
    <link rel="stylesheet" href="{{ asset('packages/syscover/pulsar/vendor/jquery.select2.custom/css/select2.css') }}">

    @include('pulsar::includes.js.header_list')
    @include('pulsar::includes.js.messages')
    @include('pulsar::includes.js.datatable_config')

@stop

@section('mainContent')

 {{ trans_choice($objectTrans, 2) }} - {{ trans_choice('pulsar::pulsar.profile', 1) }}: {{ $profile->name_006 }}

                            ID.
                            {{ trans_choice('pulsar::pulsar.package', 1) }}
                            {{ trans('pulsar::pulsar.name') }}
                            {{ trans_choice('pulsar::pulsar.permission', 1) }}

                    <input type="hidden" name="nElementsDataTable">

@stop


text:
package azkaban.trigger.builtin;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import azkaban.trigger.TriggerAction;
import azkaban.utils.AbstractMailer;
import azkaban.utils.EmailMessage;
import azkaban.utils.Props;

public class SendEmailAction implements TriggerAction {

  private String actionId;
  private static AbstractMailer mailer;
  private String message;
  public static final String type = "SendEmailAction";
  private String mimetype = "text/html";
  private List<String> emailList;
  private String subject;

  public static void init(Props props) {
    mailer = new AbstractMailer(props);
  }

  public SendEmailAction(String actionId, String subject, String message,
      List<String> emailList) {
    this.actionId = actionId;
    this.message = message;
    this.subject = subject;
    this.emailList = emailList;
  }

  @Override
  public String getId() {
    return actionId;
  }

  @Override
  public String getType() {
    return type;
  }

  @SuppressWarnings("unchecked")
  public static SendEmailAction createFromJson(Object obj) throws Exception {
    Map<String, Object> jsonObj = (HashMap<String, Object>) obj;
    if (!jsonObj.get("type").equals(type)) {
      throw new Exception("Cannot create action of " + type + " from "
          + jsonObj.get("type"));
    }
    String actionId = (String) jsonObj.get("actionId");
    String subject = (String) jsonObj.get("subject");
    String message = (String) jsonObj.get("message");
    List<String> emailList = (List<String>) jsonObj.get("emailList");
    return new SendEmailAction(actionId, subject, message, emailList);
  }

  @Override
  public TriggerAction fromJson(Object obj) throws Exception {
    return createFromJson(obj);
  }

  @Override
  public Object toJson() {
    Map<String, Object> jsonObj = new HashMap<String, Object>();
    jsonObj.put("actionId", actionId);
    jsonObj.put("type", type);
    jsonObj.put("subject", subject);
    jsonObj.put("message", message);
    jsonObj.put("emailList", emailList);

    return jsonObj;
  }

  @Override
  public void doAction() throws Exception {
    EmailMessage email =
        mailer.prepareEmailMessage(subject, mimetype, emailList);
    email.setBody(message);
    email.sendEmail();
  }

  @Override
  public void setContext(Map<String, Object> context) {

  }

  @Override
  public String getDescription() {
    return type;
  }

}


text:
namespace Slic3r {

class MotionPlannerGraph;

class MotionPlanner
{
    public:
    MotionPlanner(const ExPolygons &islands);
    ~MotionPlanner();
    Polyline shortest_path(const Point &from, const Point &to);
    size_t islands_count() const;

    private:
    ExPolygons islands;
    bool initialized;
    ExPolygon outer;
    ExPolygonCollections inner;
    std::vector<MotionPlannerGraph*> graphs;

    void initialize();
    MotionPlannerGraph* init_graph(int island_idx);
    ExPolygonCollection get_env(size_t island_idx) const;
    Point nearest_env_point(const ExPolygonCollection &env, const Point &from, const Point &to) const;
};

class MotionPlannerGraph
{
    friend class MotionPlanner;

    private:
    typedef size_t node_t;
    typedef double weight_t;
    struct neighbor {
        node_t target;
        weight_t weight;
        neighbor(node_t arg_target, weight_t arg_weight)
            : target(arg_target), weight(arg_weight) { }
    };
    typedef std::vector< std::vector<neighbor> > adjacency_list_t;
    adjacency_list_t adjacency_list;

    public:
    Points nodes;
    //std::map<std::pair<size_t,size_t>, double> edges;
    void add_edge(size_t from, size_t to, double weight);
    size_t find_node(const Point &point) const;
    Polyline shortest_path(size_t from, size_t to);
};

}

#endif


text:
tags:
title: Catalano-Fiore Vector Commitments
tags: accumulators aggregation cryptography vector-commitments vc rsa hidden-order-groups
#published: false
sidebar:
    nav: cryptomat
---

A _vector commitment (VC)_ scheme allows a **prover** with access to a vector $\mathbf{v} = [ v_1, \dots, v_n ]$ to convince any **verifier** that position $i$ in $\mathbf{v}$ stores $v_i$ for any index $i\in[n]$.
Importantly, verifers only store a succinct **digest** of the vector (e.g., a 32-byte hash) rather than the full vector $\mathbf{v}$.

$$
\def\Adv{\mathcal{A}}
\def\Badv{\mathcal{B}}
\def\GenGho{\mathsf{GenGroup}_?}
\def\Ghosz{|\Gho|}
\def\Ghoid{1_{\Gho}}
\def\multirootexp{\mathsf{MultiRootExp}}
\def\primes{\mathsf{Primes}}
\def\QRn{\mathsf{QR}_N}
\def\rootfactor{\mathsf{RootFactor}}
\def\shamirtrick{\mathsf{ShamirTrick}}
\def\vect#1{\mathbf{#1}}
$$

Below, we review _Catalano and Fiore's_ elegant VC scheme[^CF13e] built from hidden-order groups, extended with the enhancements proposed by Lai and Malavolta[^LM18] and by Campanelli et al.[^CFGplus20e]
We also make one new, small observation: [proof disaggregation](#disaggregating-proofs) in this VC is faster than originally thought, which helps precompute all proofs slightly faster.

## Preliminaries

Let $[n] = \\{1,2,\dots, n\\}$ and $[a,b] = \\{a, a+1,\dots, b-1, b\\}$.

We assume the reader is familiar with [RSA accumulators](/2020/11/24/RSA-accumulators.html), which Catalano-Fiore (CF) VCs rely heavily upon.
Also, we assume familiarity with the [$\rootfactor$ algorithm](/2020/11/24/RSA-accumulators.html#precomputing-all-membership-witnesses-fast) for computing **all** $e_j$th roots of $g^{\prod_{i\in[n]} e_i}, j\in [n]$.

### Shamir's trick

Given $z^{1/a}$ and $z^{1/b}$ where $z\in\Gho$ and $a,b\in\Z$ with $\gcd(a,b) = 1$, one can compute $z^{1/ab} = (z^{1/a})^y (z^{1/b})^x$ where $x,y$ are the Bezout coefficients for $a,b$ such that $ax+by=1$.

This is because:

$$(z^{1/a})^y (z^{1/b})^x = z^\frac{by}{ab} z^\frac{ax}{ab} = z^\frac{ax+by}{ab} = z^\frac{1}{ab}$$

We often use $z^\frac{1}{ab}\leftarrow \shamirtrick(z^{1/a}, z^{1/b}, a, b)$ to denote performing a Shamir's trick..

Computing $z^{1/(ab)}$ takes $$O(\max(\vert x\vert,\vert y\vert))\ \Gho$$ operations since the Bezout coefficients $(a,b)$ are as big as $(x,y)$.
(Some extra time is needed to compute the Bezout coefficients, but we ignore it here.)

## Public parameters

To set up the VC scheme, a hidden-order group $\Gho$ with generator $g$ must be picked such that nobody knows the order of the group.
Importantly, the RSA problem needs to be hard in this group.

Typically, $\Gho = \ZNs$ where $N=pq$ is picked via a secure _multi-party computation (MPC) ceremony_ such that nobody knows the factorization of $N$ (and thus nobody knows the order of $\Gho$; i.e., $\vert\Gho\vert = \phi(N)= (p-1)(q-1)$).

Then, a collision-resistant hash function $H : [n] \rightarrow \primes^{\ell+1}$ must be fixe.
$H$ will map each vector index $i\in [n]$ to a prime $e_i = H(i)$ such that $2^\ell < e_i < 2^{\ell+1}$ where $\ell$ is the maximum size in bits of a vector element $v_i$.
We often use $e_K = \prod_{k\in K} e_k$ to denote a product of a subset of such primes, where $K\subseteq[n]$.

## Digest (or commitments)

Instead of commitments, we'll stick to the _digest_ terminology.

The digest of a vector $\vect{v} = [ v_1, \dots, v_n ]$ consists of two parts.
First, an [RSA accumulator](/2020/11/24/RSA-accumulators.html) over all positions in the vector:
\begin{align}
    S &= g^{\prod_{i\in[n]} e_i}
\end{align}

Second, a multi-exponentiation of each [RSA membership witness](/2020/11/24/RSA-accumulators.html#membership-witnesses) (w.r.t. $S$) for position $i$ to the value $v_i$:
\begin{align}
    \Lambda &= \prod_{i\in [n]} (S^{1/e_i})^{v_i}
\end{align}

We often use $d(\vect{v}) = (S, \Lambda)$ to denote the digest of a vector.

{: .info}
Computing the digest requires computing all $S^{1/e_i}, \forall i\in[n]$.
As described [before](/2020/11/24/RSA-accumulators.html#precomputing-all-membership-witnesses-fast), this can be done in $O(n\log{n})$ group exponentiations via $$(S^{1/e_i})_{i\in[n]} \leftarrow \rootfactor(g, (e_i)_{i\in[n]})$$.
Since each exponentiation is by an $(\ell+1)$-bit prime $e_i$, this takes $O(\ell n\log{n})\ \Gho$ operations.
Then, $\Lambda$ can be computed with an additional $O(\ell n)\ \Gho$ operations.

The beauty of CF VCs is that, once you understand what a digest looks like, everything follows very naturally.

## Proofs are just digests

At minimum, in any VC scheme, a verifier can be convinced of the value $v_i$ of any position $i$ in the vector using a **proof** $\pi_i$.
To convince the verifier of multiple values $(\vect{v}\_i)\_{i\in I}$, this would require individual proofs for each position $i\in I$.
However, in VCs like CF, a single $I$-subvector proof $\pi\_I$ can be constructed for all $(v\_i)\_{i\in I}$.
Importantly, the size of $\pi_I$ is always constant, independent of $\vert I\vert$.

In CF, an $I$-subvector proof $\pi_I$ is just the digest of the vector $\vect{v}$ but _"without"_ positions $I$ in it.
We abuse notation and denote this by $$\vect{v} \setminus I = (v_i)_{i\in[n] \setminus I}$$.
Thus, $\pi_I = d(\vect{v}\setminus I)$.

Let $e_I = \prod_{i\in I} e_i$.
Then, the proof $\pi_I$ is just:
\begin{align}
    S_I &= S^{1/e_I} = g^{\prod_{i\in[n]\setminus I} e_i}\\\\\
    \Lambda_I &= \prod_{i\in [n]\setminus I} (S_I^{1/e_i})^{v_i}
\end{align}

Observe that the accumulator $S_I$ is over all positions $i$ except the ones in $I$.
Also, observe that the membership witnesses in $\Lambda_I$ are w.r.t. to $S_I$ (not $S$) and that $\Lambda_I$ does not contain witnesses for $i\in I$.
This is what it means to commit to a vector $\vect{v}$ "without" positions $I$ in it.

{: .info}
Computing $\pi_I$ takes $O(\ell(n-\vert I \vert)\log(n-\vert I\vert))\ \Gho$ operations, dominated by the cost to compute $$(S_I^{1/e_i})_{i\in I}$$ via $$\rootfactor(g, (e_i)_{i\in[n]\setminus I})$$.

To verify the proof, one simply "adds back" $$\vect{v}_I$$ to $$d(\vect{v}\setminus I) = \pi_I$$ and checks it obtains the digest $d(\vect{v}) = (S, \Lambda)$ of the vector:
\begin{align}
    S &\stackrel{?}{=} S_I^{e_I}\\\\\
    \Lambda &\stackrel{?}{=} \Lambda_I^{e_I} \prod_{i\in I} (S^{1/e_i})^{v_i}
\end{align}

{: .warning}
One problem is that all $$(S^{1/e_i})_{i\in I}$$ must be computed via $$\rootfactor(S_I, (e_i)_{i\in I})$$, which would take $O(\ell \vert I\vert \log\vert I\vert)\ \Gho$ operations.
We explain [next](#updating-digest) how this can be done in $O(\ell \vert I \vert)\ \Gho$ operations by adding each $v_i, i\in I$ back into $\pi_I$ _sequentially_!

## Updating digest

It is possible to update the digest $d(\vect{v})=(S,\Lambda)$ after an element $v_i$ changes to $v_i + \delta_i$.
For this, the RSA membership witness $S^{1/e_i}$ is needed as helper information, which we refer to as an **update key**.

Since $S$ does not contain any information about $v_i$ (just about $i$), $S$ stays the same.
However, $\Lambda$ must change into $\Lambda'$ as follows:
\begin{align}
    \Lambda' = \Lambda \cdot (S^{1/e_i})^{\delta_i}
\end{align}

{: .info}
This technique can be generalized to work with many positions $i\in I$ changing by $\delta_i$.
This either requires all the $S^{1/e_i}$ update keys or an **aggregated update key** $$S_I = S^{1/e_I} = S^{\prod_{i\in I} 1/e_i}$$ as auxiliary information.
In this last case, all the $$(S^{1/e_i})_{i\in I} \leftarrow \rootfactor(S_I, (e_i)_{i\in I})$$ can be computed in $O(\ell \vert I \vert \log \vert I \vert)\ \Gho$ operations from the aggregated update key.
Then the update can be performed as $$\Lambda' = \Lambda \cdot \prod_{i\in I} (S^{1/e_i})^{\delta_i}$$

### Adding new positions to the vector

It is also possible to "extend" the vector $\vect{v}$ of size $n$ to size $n+1$ by adding an extra element $v_{n+1}$.
For this, the digest can be updated as:
\begin{align}
S' &= S^{e_{n+1}}\\\\\
\Lambda' &= \Lambda^{e_{n+1}} S^{v_{n+1}} = \dots = \prod_{i\in [n+1]} (S'^{1/e_i})^{v_i}
\end{align}

{: .info}
This can be generalized to adding $\Delta$ new positions, and would take $O(\ell \Delta)\ \Gho$ operations by applying each extension sequentially.
In fact, this how one would verify a subvector proof fast: by adding back the elements being verified to the proof (which can be viewed as a digest) and checking the actual digest is obtained!

## Updating proofs

Since proofs are just digests they are, in principle, updatable in the same fashion, with a few extra details.

Suppose we have a proof $\pi_I$ for a subvector $$\vect{v}_I$$:
\begin{align}
    S_I &= S^{1/e_I} = S^{1/\prod_{i\in I} e_i} = g^{\prod_{i\in[n]\setminus I} e_i}\\\\\
    \Lambda_I &= \prod_{i\in [n]\setminus I} (S_I^{1/e_i})^{v_i}
\end{align}

### Case 1: $i\in I$ changed

First, suppose a position $i\in I$ changes from $$v_i$$ to $$v_i + \delta_i$$.
Then, the proof $\pi_I$ remains the same!
This is because the proof contains no information about $$v_i$$, since the proof is the digest of $\vect{v}$ without any positions $i\in I$.

### Case 2: $j\notin I$ changed

Second, suppose a position $j\notin I$ changes from $$v_j$$ to $$v_j+\delta_j$$.
In this case, we only need to change $\Lambda_I$ into a $\Lambda_I'$ such that:
\begin{align}
    \Lambda_I' = \Lambda_I \cdot (S_I^{1/e_j})^{\delta_j}
\end{align}

The difficult part is computing $S_I^{1/e_j}$.
We could do it from scratch but that would take $O(\ell (n - \vert I \vert))\ \Gho$ operations.
Instead, as with the [digest update](#updating-digest), we assume we are given the $S^{1/e_j}$ update key associated with the changed position $j$.
Fortunately, we know that we can compute $S_I^{1/e_j} = S^{1/(e_I e_j)}$ using [Shamir's trick](#shamirs-trick) on $S_I = S^{1/e_I}$ and $S^{1/e_j}$!
(This takes $O(\ell \vert I \vert)\ \Gho$ operations which is faster when $|I|$ is much smaller than $n$.)

{: .info}
This technique can also be generalized to updating $\pi_I$ after many positions $j\in J$ changed by $\delta_j$.
(Assume without loss of generality that $J\cap I =\varnothing$ or let $J \leftarrow J \setminus I$ otherwise.)
This either requires all $S_I^{1/e_j}$ update keys or the _aggregated update key_ $$S_{I\cup J} = S^{1/(e_I e_J)} = S^{\prod_{k\in I\cup J} 1/e_k}$$ as auxiliary information.
In this last case, all the $$(S_I^{1/e_j})_{j\in J} \leftarrow \rootfactor(S_{I\cup J}, (e_j)_{j\in J})$$ can be computed in $O(\ell \vert J \vert \log \vert J \vert)\ \Gho$ operations from the aggregated update key.
Then, $$\Lambda_I' = \Lambda_I \cdot \prod_{j\in J} (S_I^{1/e_j})^{\delta_j}$$.

### Case 3: Adding new positions

Third, suppose a new position $v_{n+1}$ was added to the vector.
Then the proof update proceeds similar to the [digest update](#adding-new-positions-to-the-vector) for adding new positions:
\begin{align}
S_I' &= S_I^{e_{n+1}}\\\\\
\Lambda_I' &= \Lambda_I^{e_{n+1}} S_I^{v_{n+1}} = \dots = \prod_{i\in [n+1] \setminus I} (S_I'^{1/e_i})^{v_i}
\end{align}

## Disaggregating proofs

Suppose we want to **disaggregate** a proof $\pi_I=(S_I,\Lambda_I)$ for $\vect{v}_I$ into a proof $\pi_K=(S_K,\Lambda_K)$ for $\vect{v}_K$, where $K\subset I$.

In other words, we want to go from $d(\vect{v}\setminus I)$ to $d(\vect{v}\setminus K)$.
Since $K\subset I$ we can write $K = I\setminus \Delta$ for some set $\Delta$ of indices.

Thus, all we need to do is add back the elements from $\Delta$ to $\pi_I$.

So, for each $i\in \Delta$, we simply add back $$(i,v_i)$$ to $$\pi_I$$ (as explained [here](#updating-digest)) and obtain $$\pi_K$$.
This takes $O(\ell\vert\Delta\vert)$ $\Gho$ operations.

## Aggregating proofs

To aggregate two subvector proofs for $$\vect{v}_I$$ and $$\vect{v}_J$$, things are bit more involved.
Let $$\pi_I = (S_I,\Lambda_I)$$ and $$\pi_J = (S_J,\Lambda_J)$$ denote the two proofs.
Assume that $$I\cap J = \varnothing$$ and if not, just set $$J = J\setminus I$$ and disaggregate $$\pi_J$$ into $$\pi_{J\setminus I}$$.
(Can also set $$I=I\setminus J$$ and disaggregate $$\pi_I$$ instead.)

Denote the aggregated proof by $$\pi_{I\cup J} = (S_{I \cup J}, \Lambda_{I \cup J})$$.
We can easily compute the first part of the proof as:

$$S_{I\cup J} = \shamirtrick(S_I, S_J, e_I, e_J) = S^{1/(e_I e_J)}$$

For the second part, focusing on $\Lambda_I$, recall that:
\begin{align}
    \Lambda_I &= \prod_{i\in [n]\setminus I} (S_I^{1/e_i})^{v_i}
\end{align}
We will tweak it as $$\Lambda_I^*$$ by removing all elements $v_j, j\in J$ from $$\Lambda_I$$:
\begin{align}
    \Lambda_I^* &= \Lambda_I / \prod_{j\in J} (S_I^{1/e_j})^{v_j}\\\\\
        &= \prod_{i\in [n]\setminus (I\cup J)} (S_I^{1/e_i})^{v_i}
\end{align}
But for this, we need to compute $$S_I^{1/e_j},\forall j\in J$$ via $\rootfactor$:
\begin{align}
    (S\_I^{1/e\_j})\_{j\in J} \leftarrow \rootfactor(S\_{I\cup J}, (e\_j)\_{j\in J})
\end{align}
In a similar, fashion, we can compute
\begin{align}
    \Lambda_J^* &= \prod_{i\in [n]\setminus (I\cup J)} (S_J^{1/e_i})^{v_i}
\end{align}
Next, observe that $$\Lambda_I^*$$ and $$\Lambda_J^*$$ can be rewritten as:
\begin{align}
    \Lambda_I^* &= \left(\prod_{i\in [n]\setminus (I\cup J)} (S^{1/e_i})^{v_i}\right)^{1/e_I}\\\\\
    \Lambda_J^* &= \left(\prod_{i\in [n]\setminus (I\cup J)} (S^{1/e_i})^{v_i}\right)^{1/e_J}
\end{align}
Thus, if we apply a Shamir trick on them, we can obtain $\Lambda\_{I\cup J}$:
\begin{align}
    \Lambda_{I\cup J} &= \shamirtrick(\Lambda_I^\*, \Lambda_J^\*, e_I, e_J)\\\\\
        &= \left(\prod_{i\in [n]\setminus (I\cup J)} (S^{1/e_i})^{v_i}\right)^{1/(e_I e_J)}\\\\\
        &= \prod_{i\in [n]\setminus (I\cup J)} (S_{I\cup J}^{1/e_i})^{v_i}
\end{align}

{: .info}
Overall, if $b=\max(\vert I\vert, \vert J \vert)$, this requires Shamir tricks of size $b$ and $\rootfactor$'s of size $b$, so it takes $O(\ell b\log{b})\ \Gho$ operations.

## Precomputing all proofs via disaggregation

Campanelli et al.[^CFGplus20e] explain how to compute all proofs fast via disaggregation.
The idea is to start with a proof for the whole vector $\vect{v}$ and then disaggregate it into a proof for the left half of the vector and the right half.
Then, one repeats recursively on these two halves.
This determines a tree of subvector proofs, where the leaves store the proofs for the individual vector and each internal node stores an aggregation of its children's proofs (with the root storing the proof for the full vector).

Here's an example for $n=8$:

Looked at it differently, clearly one can compute this tree via proof aggregation, which we discuss [next](#aggregating-proofs), by starting with the leaves storing individual proofs for each position $i$ and aggregating up the tree.
The key observation is that one can also compute this tree by starting with the root, which stores the proof for the full vector (i.e., the empty digest), _disaggregating_ this proof into two halves, and recursing on these two halves.

{: .info}
This very much resembles the recursion tree used to implement $\rootfactor$ efficiently (see [here](/2020/11/24/RSA-accumulators.html#precomputing-all-membership-witnesses-fast)).
Indeed, if you think about it, this tree implicitly computes the $\rootfactor$ tree too, since each CF proof for $v_i$ has an RSA membership witness for $i$ in it.

Note that Campanelli et al.[^CFGplus20e] claim $O(\ell n\log^2{n})\ \Gho$ operations for this algorithm, but the faster disaggregation explained above actually gives $O(\ell n\log{n})$.

[^CF13e]: **Vector Commitments and their Applications**, by Dario Catalano and Dario Fiore, *in Cryptology ePrint Archive, Report 2011/495*, 2011, [[URL]](https://eprint.iacr.org/2011/495)
[^CFGplus20e]: **Vector Commitment Techniques and Applications to Verifiable Decentralized Storage**, by Matteo Campanelli and  Dario Fiore and Nicola Greco and  Dimitris Kolonelos and  Luca Nizzardo, 2020, [[URL]](https://eprint.iacr.org/2020/149)
[^LM18]: **Subvector Commitments with Application to Succinct Arguments**, by Russell W.F. Lai and Giulio Malavolta, *in Cryptology ePrint Archive, Report 2018/705*, 2018, [[URL]](https://eprint.iacr.org/2018/705)


text:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<feed><tipo>Rua</tipo><logradouro>Operário</logradouro><bairro>Umbu</bairro><cidade>Alvorada</cidade><uf>RS</uf><cep>94834142</cep></feed>


text:
import tensorflow as tf

def conv2d(x, in_channels, output_channels, name, reuse = False):
	'''Convolutional Layer'''
	with tf.variable_scope(name, reuse = reuse):
		w = tf.get_variable('w', [5, 5, in_channels, output_channels], initializer = tf.truncated_normal_initializer(stddev = 0.1))
		b = tf.get_variable('b', [output_channels], initializer = tf.constant_initializer(0.1))

		conv = tf.nn.conv2d(x, w, strides = [1,2,2,1], padding = 'SAME') + b
		return conv

def deconv2d(x, output_shape, name, reuse = False):
	'''Deconvolutional Layer'''
	with tf.variable_scope(name, reuse = reuse):
		w = tf.get_variable('w', [5, 5, output_shape[-1], int(x.get_shape()[-1])], initializer = tf.truncated_normal_initializer(stddev = 0.1))
		b = tf.get_variable('b', [output_shape[-1]], initializer = tf.constant_initializer(0.1))

		deconv = tf.nn.conv2d_transpose(x, w, output_shape = output_shape, strides = [1,2,2,1]) + b
		return deconv

def dense(x, input_dim, output_dim, name, reuse = False):
	'''Fully-connected Layer'''
	with tf.variable_scope(name, reuse = reuse):
		w = tf.get_variable('w', [input_dim, output_dim], initializer = tf.truncated_normal_initializer(stddev = 0.1))
		b = tf.get_variable('b', [output_dim], initializer = tf.constant_initializer(0.1))

		return tf.matmul(x, w) + b


text:
package gitlab

import (
	"net/http"
	"testing"

	triggersv1 "github.com/tektoncd/triggers/pkg/apis/triggers/v1beta1"
	"github.com/tektoncd/triggers/pkg/interceptors"
	"github.com/tektoncd/triggers/test"
	corev1 "k8s.io/api/core/v1"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	fakekubeclient "knative.dev/pkg/client/injection/kube/client/fake"
)

func TestInterceptor_ExecuteTrigger_ShouldContinue(t *testing.T) {
	tests := []struct {
		name              string
		interceptorParams *triggersv1.GitLabInterceptor
		payload           []byte
		secret            *corev1.Secret
		token             string
		eventType         string
	}{{
		name:              "no secret",
		interceptorParams: &triggersv1.GitLabInterceptor{},

		payload: []byte("somepayload"),
		token:   "foo",
	}, {
		name: "valid header for secret",
		interceptorParams: &triggersv1.GitLabInterceptor{
			SecretRef: &triggersv1.SecretRef{
				SecretName: "mysecret",
				SecretKey:  "token",
			},
		},

		token: "secret",
		secret: &corev1.Secret{
			ObjectMeta: metav1.ObjectMeta{
				Name: "mysecret",
			},
			Data: map[string][]byte{
				"token": []byte("secret"),
			},
		},
		payload: []byte("somepayload"),
	}, {
		name: "valid event",
		interceptorParams: &triggersv1.GitLabInterceptor{
			EventTypes: []string{"foo", "bar"},
		},

		eventType: "foo",
		payload:   []byte("somepayload"),
	}, {
		name: "valid event, valid secret",
		interceptorParams: &triggersv1.GitLabInterceptor{
			EventTypes: []string{"foo", "bar"},
			SecretRef: &triggersv1.SecretRef{
				SecretName: "mysecret",
				SecretKey:  "token",
			},
		},
		eventType: "bar",
		payload:   []byte("somepayload"),
		token:     "secrettoken",
		secret: &corev1.Secret{
			ObjectMeta: metav1.ObjectMeta{
				Name: "mysecret",
			},
			Data: map[string][]byte{
				"token": []byte("secrettoken"),
			},
		},
	}}
	for _, tt := range tests {
		t.Run(tt.name, func(t *testing.T) {
			ctx, _ := test.SetupFakeContext(t)
			req := &triggersv1.InterceptorRequest{
				Body: string(tt.payload),
				Header: http.Header{
					"Content-Type": []string{"application/json"},
				},
				InterceptorParams: map[string]interface{}{
					"eventTypes": tt.interceptorParams.EventTypes,
					"secretRef":  tt.interceptorParams.SecretRef,
				},
				Context: &triggersv1.TriggerContext{
					EventURL:  "https://testing.example.com",
					EventID:   "abcde",
					TriggerID: "namespaces/default/triggers/example-trigger",
				},
			}
			if tt.token != "" {
				req.Header["X-GitLab-Token"] = []string{tt.token}
			}
			if tt.eventType != "" {
				req.Header["X-GitLab-Event"] = []string{tt.eventType}
			}
			clientset := fakekubeclient.Get(ctx)
			if tt.secret != nil {
				tt.secret.Namespace = metav1.NamespaceDefault
				ctx, clientset = fakekubeclient.With(ctx, tt.secret)
			}
			w := &Interceptor{
				SecretGetter: interceptors.DefaultSecretGetter(clientset.CoreV1()),
			}
			res := w.Process(ctx, req)
			if !res.Continue {
				t.Fatalf("Interceptor.Process() expected res.Continue to be : true but got %t. \nStatus.Err(): %v", res.Continue, res.Status.Err())
			}

		})
	}
}

func TestInterceptor_ExecuteTrigger_ShouldNotContinue(t *testing.T) {
	tests := []struct {
		name              string
		interceptorParams *triggersv1.GitLabInterceptor
		payload           []byte
		secret            *corev1.Secret
		token             string
		eventType         string
	}{{
		name: "invalid header for secret",
		interceptorParams: &triggersv1.GitLabInterceptor{
			SecretRef: &triggersv1.SecretRef{
				SecretName: "mysecret",
				SecretKey:  "token",
			},
		},

		token: "foo",
		secret: &corev1.Secret{
			ObjectMeta: metav1.ObjectMeta{
				Name: "mysecret",
			},
			Data: map[string][]byte{
				"token": []byte("secrettoken"),
			},
		},
		payload: []byte("somepayload"),
	}, {
		name: "missing header for secret",
		interceptorParams: &triggersv1.GitLabInterceptor{
			SecretRef: &triggersv1.SecretRef{
				SecretName: "mysecret",
				SecretKey:  "token",
			},
		},
		secret: &corev1.Secret{
			ObjectMeta: metav1.ObjectMeta{
				Name: "mysecret",
			},
			Data: map[string][]byte{
				"token": []byte("secrettoken"),
			},
		},
		payload: []byte("somepayload"),
	}, {
		name: "invalid event",
		interceptorParams: &triggersv1.GitLabInterceptor{
			EventTypes: []string{"foo", "bar"},
		},

		eventType: "baz",
		payload:   []byte("somepayload"),
	}, {
		name: "valid event, invalid secret",
		interceptorParams: &triggersv1.GitLabInterceptor{
			EventTypes: []string{"foo", "bar"},
			SecretRef: &triggersv1.SecretRef{
				SecretName: "mysecret",
				SecretKey:  "token",
			},
		},

		eventType: "bar",
		payload:   []byte("somepayload"),
		token:     "foo",
		secret: &corev1.Secret{
			ObjectMeta: metav1.ObjectMeta{
				Name: "mysecret",
			},
			Data: map[string][]byte{
				"token": []byte("secrettoken"),
			},
		},
	}, {
		name: "invalid event, valid secret",
		interceptorParams: &triggersv1.GitLabInterceptor{
			EventTypes: []string{"foo", "bar"},
			SecretRef: &triggersv1.SecretRef{
				SecretName: "mysecret",
				SecretKey:  "token",
			},
		},

		eventType: "baz",
		payload:   []byte("somepayload"),
		token:     "secrettoken",
		secret: &corev1.Secret{
			ObjectMeta: metav1.ObjectMeta{
				Name: "mysecret",
			},
			Data: map[string][]byte{
				"token": []byte("secrettoken"),
			},
		},
	}, {
		name: "empty secret",
		interceptorParams: &triggersv1.GitLabInterceptor{
			SecretRef: &triggersv1.SecretRef{
				SecretName: "mysecret",
			},
		},
		secret: &corev1.Secret{
			ObjectMeta: metav1.ObjectMeta{
				Name: "mysecret",
			},
			Data: map[string][]byte{
				"token": []byte("secrettoken"),
			},
		},
	}}
	for _, tt := range tests {
		t.Run(tt.name, func(t *testing.T) {
			ctx, _ := test.SetupFakeContext(t)
			req := &triggersv1.InterceptorRequest{
				Body: string(tt.payload),
				Header: http.Header{
					"Content-Type": []string{"application/json"},
				},
				InterceptorParams: map[string]interface{}{
					"eventTypes": tt.interceptorParams.EventTypes,
					"secretRef":  tt.interceptorParams.SecretRef,
				},
				Context: &triggersv1.TriggerContext{
					EventURL:  "https://testing.example.com",
					EventID:   "abcde",
					TriggerID: "namespaces/default/triggers/example-trigger",
				},
			}
			if tt.token != "" {
				req.Header["X-GitLab-Token"] = []string{tt.token}
			}
			if tt.eventType != "" {
				req.Header["X-interceptorParams-Event"] = []string{tt.eventType}
			}
			clientset := fakekubeclient.Get(ctx)
			if tt.secret != nil {
				tt.secret.Namespace = metav1.NamespaceDefault
				ctx, clientset = fakekubeclient.With(ctx, tt.secret)
			}
			w := &Interceptor{
				SecretGetter: interceptors.DefaultSecretGetter(clientset.CoreV1()),
			}
			res := w.Process(ctx, req)
			if res.Continue {
				t.Fatalf("Interceptor.Process() expected res.Continue to be false but got %t. \nStatus.Err(): %v", res.Continue, res.Status.Err())
			}
		})
	}
}

func TestInterceptor_Process_InvalidParams(t *testing.T) {
	ctx, _ := test.SetupFakeContext(t)

	w := &Interceptor{
		SecretGetter: interceptors.DefaultSecretGetter(fakekubeclient.Get(ctx).CoreV1()),
	}

	req := &triggersv1.InterceptorRequest{
		Body: `{}`,
		Header: http.Header{
			"Content-Type": []string{"application/json"},
		},
		InterceptorParams: map[string]interface{}{
			"blah": func() {},
		},
		Context: &triggersv1.TriggerContext{
			EventURL:  "https://testing.example.com",
			EventID:   "abcde",
			TriggerID: "namespaces/default/triggers/example-trigger",
		},
	}

	res := w.Process(ctx, req)
	if res.Continue {
		t.Fatalf("Interceptor.Process() expected res.Continue to be false but got %t. \nStatus.Err(): %v", res.Continue, res.Status.Err())
	}
}


text:
namespace TwitterBackup.Services
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using TwitterBackup.Data;
    using TwitterBackup.Models;
    using TwitterBackup.Services.Contracts;
    using TwitterBackup.Services.Exceptions;

    public class TweetService : ITweetService
    {
        private readonly IRepository<Tweet> tweetRepo;

        public TweetService(IRepository<Tweet> tweetRepo)
        {
            this.tweetRepo = tweetRepo;
        }

        public Tweet Save(Tweet tweet)
        {
            if (tweet == null)
            {
                throw new ArgumentException("Tweet is not valid");
            }

            var hasAlreadySavedTweet = tweetRepo
                .All()
                .Any(tweetDTO => tweetDTO.TweetTwitterId == tweet.TweetTwitterId && tweetDTO.CreatedByScreenName == tweet.CreatedByScreenName);

            if (hasAlreadySavedTweet)
            {
                throw new TweetException(TweetExceptionType.IsAlreadySaved);
            }

            var dbTweet = tweetRepo.Add(tweet);

            return dbTweet;
        }

        public int GetTotalTweetsCount()
        {
            var tweetsCount = tweetRepo
                .All()
                .Count();

            return tweetsCount;
        }

        public ICollection<Tweet> GetTweets()
        {
            var tweets = tweetRepo
                .All()
                .ToArray();

            return tweets;
        }

        public ICollection<Tweet> GetTweetsForFriend(string currentLoggedUserScreenName, string friendScreenName)
        {
            var tweets = tweetRepo
                .All()
                .Where(tweet => tweet.CreatedByScreenName == currentLoggedUserScreenName && tweet.Owner.ScreenName == friendScreenName)
                .ToArray();

            return tweets;
        }
    }
}


text:
@interface downLoadValue : UIView

@property (nonatomic) CGFloat personalValue;

@end


text:
{extend name="public/base" /}

{block name="body"}

用户查看

    <form action="{:url()}" method="post" class="form-horizontal">

            用户名(用户名)

                <input type="text" class="text input-large" name="username" value="{$info.username|default=''}">

            手机号(手机号)

                <input type="text" class="text input-large" name="phone" value="{$info.phone|default='未绑定'}">

            邮箱(邮箱)

                <input type="text" class="text input-large" name="email" value="{$info.email|default='未绑定'}">

            真实姓名(真实姓名)

                <input type="text" class="text input-large" name="truename" value="{$info.truename|default='未绑定'}">

            身份证号(身份证号)

                <input type="text" class="text input-large" name="id_card" value="{$info.id_card|default='未绑定'}">

            用户简介

                    <textarea readonly="readonly">{$info.profile|default=''}</textarea>

        <?php $id = input('id');
             if($id){
       ?>
        <input type="hidden" name="id" value="{:$id}">
        <?php } ?>

            <button class="btn submit-btn ajax-post" id="submit" type="submit" target-form="form-horizontal">确 定</button>
            <button class="btn btn-return" onclick="javascript:history.back(-1);return false;">返 回</button>

    </form>
{/block}

{block name="script"}

{/block}


text:
@interface CrashViewController : UIViewController
@end

#endif  // CRASHPAD_TEST_IOS_HOST_CRASH_VIEW_CONTROLLER_H_


text:
package com.youtube.provider;

import com.google.api.client.http.HttpTransport;
import com.google.api.client.http.javanet.NetHttpTransport;
import com.google.api.client.json.JsonFactory;
import com.google.api.client.json.jackson2.JacksonFactory;
import com.google.api.services.youtube.YouTube;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Preconditions;
import com.google.common.collect.Lists;
import com.typesafe.config.Config;
import org.apache.streams.config.StreamsConfigurator;
import org.apache.streams.core.StreamsDatum;
import org.apache.streams.core.StreamsProvider;
import org.apache.streams.core.StreamsResultSet;
import org.apache.streams.google.gplus.configuration.UserInfo;
import org.apache.streams.util.ComponentUtils;
import org.apache.streams.util.api.requests.backoff.BackOffStrategy;
import org.apache.streams.util.api.requests.backoff.impl.ExponentialBackOffStrategy;
import org.apache.youtube.pojo.YoutubeConfiguration;
import org.joda.time.DateTime;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;
import java.math.BigInteger;
import java.security.GeneralSecurityException;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.atomic.AtomicBoolean;

public abstract class YoutubeProvider implements StreamsProvider {

    public static final String STREAMS_ID = "YoutubeProvider";

    private final static Logger LOGGER = LoggerFactory.getLogger(YoutubeProvider.class);
    private final static int MAX_BATCH_SIZE = 1000;

    /**
     * Define a global instance of the HTTP transport.
     */
    public static final HttpTransport HTTP_TRANSPORT = new NetHttpTransport();

    /**
     * Define a global instance of the JSON factory.
     */
    public static final JsonFactory JSON_FACTORY = new JacksonFactory();

    private static final int DEFAULT_THREAD_POOL_SIZE = 5;

    private ExecutorService executor;
    private BlockingQueue<StreamsDatum> datumQueue;
    private AtomicBoolean isComplete;
    private boolean previousPullWasEmpty;

    protected YouTube youtube;
    protected YoutubeConfiguration config;

    public YoutubeProvider() {
        Config config = StreamsConfigurator.config.getConfig("youtube");
        this.config = YoutubeConfigurator.detectConfiguration(config);

        Preconditions.checkNotNull(this.config.getApiKey());
    }

    public YoutubeProvider(YoutubeConfiguration config) {
        this.config = config;

        Preconditions.checkNotNull(this.config.getApiKey());
    }

    @Override
    public String getId() {
        return STREAMS_ID;
    }

    @Override
    public void startStream() {
        BackOffStrategy backOffStrategy = new ExponentialBackOffStrategy(2);

        for(UserInfo user : this.config.getYoutubeUsers()) {
            if(this.config.getDefaultAfterDate() != null && user.getAfterDate() == null) {
                user.setAfterDate(this.config.getDefaultAfterDate());
            }
            if(this.config.getDefaultBeforeDate() != null && user.getBeforeDate() == null) {
                user.setBeforeDate(this.config.getDefaultBeforeDate());
            }
            this.executor.submit(getDataCollector(backOffStrategy, this.datumQueue, this.youtube, user));
        }

        this.executor.shutdown();
    }

    protected abstract Runnable getDataCollector(BackOffStrategy strategy, BlockingQueue<StreamsDatum> queue, YouTube youtube, UserInfo userInfo);

    @Override
    public StreamsResultSet readCurrent() {
        BlockingQueue<StreamsDatum> batch = new LinkedBlockingQueue<>();
        int batchCount = 0;
        while(!this.datumQueue.isEmpty() && batchCount < MAX_BATCH_SIZE) {
            StreamsDatum datum = ComponentUtils.pollWhileNotEmpty(this.datumQueue);
            if(datum != null) {
                ++batchCount;
                ComponentUtils.offerUntilSuccess(datum, batch);
            }
        }
        boolean pullIsEmpty = batch.isEmpty() && this.datumQueue.isEmpty() &&this.executor.isTerminated();
        this.isComplete.set(this.previousPullWasEmpty && pullIsEmpty);
        this.previousPullWasEmpty = pullIsEmpty;
        return new StreamsResultSet(batch);
    }

    @Override
    public StreamsResultSet readNew(BigInteger sequence) {
        return null;
    }

    @Override
    public StreamsResultSet readRange(DateTime start, DateTime end) {
        return null;
    }

    @Override
    public boolean isRunning() {
        return !this.isComplete.get();
    }

    @Override
    public void prepare(Object configurationObject) {
        try {
            this.youtube = createYouTubeClient();
        } catch (IOException |GeneralSecurityException e) {
            LOGGER.error("Failed to created oauth for GPlus : {}", e);
            throw new RuntimeException(e);
        }

        this.executor = Executors.newFixedThreadPool(DEFAULT_THREAD_POOL_SIZE);
        this.datumQueue = new LinkedBlockingQueue<>(1000);
        this.isComplete = new AtomicBoolean(false);
        this.previousPullWasEmpty = false;
    }

    @VisibleForTesting
    protected YouTube createYouTubeClient() throws IOException, GeneralSecurityException {
        return new YouTube.Builder(HTTP_TRANSPORT, JSON_FACTORY, null).setApplicationName("Streams Application").build();
    }

    @Override
    public void cleanUp() {
        ComponentUtils.shutdownExecutor(this.executor, 10, 10);
        this.executor = null;
    }

    public YoutubeConfiguration getConfig() {
        return config;
    }

    public void setConfig(YoutubeConfiguration config) {
        this.config = config;
    }

    /**
     * Set and overwrite the default before date that was read from the configuration file.
     * @param defaultBeforeDate
     */
    public void setDefaultBeforeDate(DateTime defaultBeforeDate) {
        this.config.setDefaultBeforeDate(defaultBeforeDate);
    }

    /**
     * Set and overwrite the default after date that was read from teh configuration file.
     * @param defaultAfterDate
     */
    public void setDefaultAfterDate(DateTime defaultAfterDate) {
        this.config.setDefaultAfterDate(defaultAfterDate);
    }

    /**
     * Sets and overwrite the user info from the configuaration file.  Uses the defaults before and after dates.
     * @param userIds
     */
    public void setUserInfoWithDefaultDates(Set<String> userIds) {
        List<UserInfo> youtubeUsers = Lists.newLinkedList();

        for(String userId : userIds) {
            UserInfo user = new UserInfo();
            user.setUserId(userId);
            user.setAfterDate(this.config.getDefaultAfterDate());
            user.setBeforeDate(this.config.getDefaultBeforeDate());
            youtubeUsers.add(user);
        }

        this.config.setYoutubeUsers(youtubeUsers);
    }

    /**
     * Set and overwrite user into from teh configuration file. Only sets after dater.
     * @param usersAndAfterDates
     */
    public void setUserInfoWithAfterDate(Map<String, DateTime> usersAndAfterDates) {
        List<UserInfo> youtubeUsers = Lists.newLinkedList();

        for(String userId : usersAndAfterDates.keySet()) {
            UserInfo user = new UserInfo();
            user.setUserId(userId);
            user.setAfterDate(usersAndAfterDates.get(userId));
            youtubeUsers.add(user);
        }

        this.config.setYoutubeUsers(youtubeUsers);
    }
}


text:
// Copyright 2014 The Bazel Authors. All rights reserved.
//
// 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.google.devtools.build.lib.skyframe;

import com.google.common.base.Predicate;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.devtools.build.lib.analysis.BlazeDirectories;
import com.google.devtools.build.lib.analysis.WorkspaceStatusAction.Factory;
import com.google.devtools.build.lib.analysis.buildinfo.BuildInfoFactory;
import com.google.devtools.build.lib.analysis.config.BinTools;
import com.google.devtools.build.lib.packages.PackageFactory;
import com.google.devtools.build.lib.packages.Preprocessor;
import com.google.devtools.build.lib.skyframe.PackageLookupFunction.CrossRepositoryLabelViolationStrategy;
import com.google.devtools.build.lib.skyframe.PackageLookupValue.BuildFileName;
import com.google.devtools.build.lib.vfs.PathFragment;
import com.google.devtools.build.skyframe.SkyFunction;
import com.google.devtools.build.skyframe.SkyFunctionName;

/**
 * A factory of SkyframeExecutors that returns SequencedSkyframeExecutor.
 */
public class SequencedSkyframeExecutorFactory implements SkyframeExecutorFactory {

  @Override
  public SkyframeExecutor create(
      PackageFactory pkgFactory,
      BlazeDirectories directories,
      BinTools binTools,
      Factory workspaceStatusActionFactory,
      ImmutableList<BuildInfoFactory> buildInfoFactories,
      Iterable<? extends DiffAwareness.Factory> diffAwarenessFactories,
      Predicate<PathFragment> allowedMissingInputs,
      Preprocessor.Factory.Supplier preprocessorFactorySupplier,
      ImmutableMap<SkyFunctionName, SkyFunction> extraSkyFunctions,
      ImmutableList<PrecomputedValue.Injected> extraPrecomputedValues,
      Iterable<SkyValueDirtinessChecker> customDirtinessCheckers,
      String productName) {
    return SequencedSkyframeExecutor.create(
        pkgFactory,
        directories,
        binTools,
        workspaceStatusActionFactory,
        buildInfoFactories,
        diffAwarenessFactories,
        allowedMissingInputs,
        preprocessorFactorySupplier,
        extraSkyFunctions,
        extraPrecomputedValues,
        customDirtinessCheckers,
        productName,
        CrossRepositoryLabelViolationStrategy.ERROR,
        ImmutableList.of(BuildFileName.BUILD_DOT_BAZEL, BuildFileName.BUILD));
  }
}


text:
package kg.apc.jmeter.gui;

import kg.apc.emulators.FileChooserEmul;
import java.awt.event.ActionEvent;
import javax.swing.JFileChooser;
import javax.swing.JTextField;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import static org.junit.Assert.*;

public class BrowseActionTest {

    private static class BrowseActionEmul extends BrowseAction {

        public BrowseActionEmul(JTextField t) {
            super(t);
        }

        @Override
        protected JFileChooser getFileChooser() {
            return new FileChooserEmul();
        }
    }

    public BrowseActionTest() {
    }

    @BeforeClass
    public static void setUpClass() throws Exception {
    }

    @AfterClass
    public static void tearDownClass() throws Exception {
    }

    @Before
    public void setUp() {
    }

    @After
    public void tearDown() {
    }

    /**
     * Test of actionPerformed method, of class BrowseAction.
     */
    @Test
    public void testActionPerformed() {
        System.out.println("actionPerformed");
        ActionEvent e = null;
        BrowseAction instance = new BrowseActionEmul(new JTextField());
        // instance.actionPerformed(e); don't enable, since it opens modal dialog
    }

    /**
     * Test of getFileChooser method, of class BrowseAction.
     */
    @Test
    public void testGetFileChooser() {
        System.out.println("getFileChooser");
        BrowseAction instance = new BrowseActionEmul(new JTextField());
        JFileChooser result = instance.getFileChooser();
        assertNotNull(result);
    }
}


text:
<!DOCTYPE html>

<meta name="description" content="Simplest possible examples of HTML, CSS and JavaScript." />
<meta name="author" content="//samdutton.com">
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">
<meta itemprop="name" content="simpl.info: simplest possible examples of HTML, CSS and JavaScript">
<meta itemprop="image" content="/icon_192x192.png">
<meta name="mobile-web-app-capable" content="yes">
<meta id="theme-color" name="theme-color" content="#fff">

<base target="_blank">

<title>Device Orientation</title>

    <link rel="stylesheet" href="../css/main.css" />

simpl.info Device Orientation

Tilting and rotating your laptop or device will transform the following image if Device Orientation is available.

  View source on GitHub


text:
var Poltergeist, system, _ref, _ref1, _ref2;

//Inheritance tool
phantom.injectJs("" + phantom.libraryPath + "/Tools/inherit.js");

//Poltergeist main object
phantom.injectJs("" + phantom.libraryPath + "/poltergeist.js");

//Errors that are controller in the poltergeist code
phantom.injectJs("" + phantom.libraryPath + "/Errors/error.js");
phantom.injectJs("" + phantom.libraryPath + "/Errors/obsolete_node.js");
phantom.injectJs("" + phantom.libraryPath + "/Errors/invalid_selector.js");
phantom.injectJs("" + phantom.libraryPath + "/Errors/frame_not_found.js");
phantom.injectJs("" + phantom.libraryPath + "/Errors/mouse_event_failed.js");
phantom.injectJs("" + phantom.libraryPath + "/Errors/javascript_error.js");
phantom.injectJs("" + phantom.libraryPath + "/Errors/browser_error.js");
phantom.injectJs("" + phantom.libraryPath + "/Errors/status_fail_error.js");
phantom.injectJs("" + phantom.libraryPath + "/Errors/no_such_window_error.js");

//web server to control the commands
phantom.injectJs("" + phantom.libraryPath + "/Server/server.js");

phantom.injectJs("" + phantom.libraryPath + "/web_page.js");
phantom.injectJs("" + phantom.libraryPath + "/node.js");
phantom.injectJs("" + phantom.libraryPath + "/browser.js");

system = require('system');

new Poltergeist(system.args[1], system.args[2], system.args[3], system.args[4] === 'false' ? false : true);


text:
ACCEPTED

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
null

#### Original name
Panax leschenaultii DC.

### Remarks
null


text:
package org.hisp.dhis.dxf2.metadata.objectbundle.hooks;

import lombok.AllArgsConstructor;

import org.hisp.dhis.dataset.DataInputPeriod;
import org.hisp.dhis.dxf2.metadata.objectbundle.ObjectBundle;
import org.hisp.dhis.period.Period;
import org.hisp.dhis.period.PeriodService;
import org.springframework.stereotype.Component;

/**
 * @author Stian Sandvold
 */
@Component
@AllArgsConstructor
public class DataInputPeriodObjectBundleHook extends AbstractObjectBundleHook<DataInputPeriod>
{
    private final PeriodService periodService;

    @Override
    public void preCreate( DataInputPeriod object, ObjectBundle bundle )
    {
        setPeriod( object );
    }

    @Override
    public void preUpdate( DataInputPeriod object, DataInputPeriod persistedObject, ObjectBundle bundle )
    {
        setPeriod( object );
    }

    private void setPeriod( DataInputPeriod dataInputPeriod )
    {
        Period period = periodService.getPeriod( dataInputPeriod.getPeriod().getIsoDate() );

        dataInputPeriod.setPeriod( period );
        sessionFactory.getCurrentSession().save( period );
    }
}


text:
#ifndef __XX_AST_VISITOR_H__
#define __XX_AST_VISITOR_H__

#include "ASTDeclarations.h"

#include <vector>

namespace AbstractSyntaxTrees
{

/* === Macros === */

#define DEF_ABSTRACT_VISIT_PROC(name)                           \
    virtual void Visit##name(name* ast, void* args = nullptr)   \
    {                                                           \
        /* dummy */                                             \
    }

#define DECL_VISIT_PROC(name) \
    void Visit##name(name* ast, void* args = nullptr) override

#define DEF_VISIT_PROC(visitor, name) \
    void visitor::Visit##name(name* ast, void* args)

#define DECL_VISITOR_INTERFACE_COMMON           \
    DECL_VISIT_PROC( Program              );    \
    DECL_VISIT_PROC( CodeBlock            );    \
    DECL_VISIT_PROC( VarName              );    \
    DECL_VISIT_PROC( VarDecl              );    \
    DECL_VISIT_PROC( Param                );    \
    DECL_VISIT_PROC( Arg                  );    \
    DECL_VISIT_PROC( ProcSignature        );    \
    DECL_VISIT_PROC( AttribPrefix         );    \
    DECL_VISIT_PROC( Attrib               );    \
    DECL_VISIT_PROC( ArrayAccess          );    \
    DECL_VISIT_PROC( ProcCall             );    \
    DECL_VISIT_PROC( SwitchCase           );

#define DECL_VISITOR_INTERFACE_STMNTS           \
    DECL_VISIT_PROC( ReturnStmnt          );    \
    DECL_VISIT_PROC( CtrlTransferStmnt    );    \
    DECL_VISIT_PROC( ExprStmnt            );    \
                                                \
    DECL_VISIT_PROC( IfStmnt              );    \
    DECL_VISIT_PROC( SwitchStmnt          );    \
                                                \
    DECL_VISIT_PROC( DoWhileStmnt         );    \
    DECL_VISIT_PROC( WhileStmnt           );    \
    DECL_VISIT_PROC( ForStmnt             );    \
    DECL_VISIT_PROC( ForRangeStmnt        );    \
    DECL_VISIT_PROC( ForEachStmnt         );    \
    DECL_VISIT_PROC( RepeatStmnt          );    \
                                                \
    DECL_VISIT_PROC( ClassDeclStmnt       );    \
    DECL_VISIT_PROC( VarDeclStmnt         );    \
    DECL_VISIT_PROC( ProcDeclStmnt        );    \
    DECL_VISIT_PROC( FriendDeclStmnt      );    \
                                                \
    DECL_VISIT_PROC( CopyAssignStmnt      );    \
    DECL_VISIT_PROC( ModifyAssignStmnt    );    \
    DECL_VISIT_PROC( PostOperatorStmnt    );

#define DECL_VISITOR_INTERFACE_EXPRS            \
    DECL_VISIT_PROC( TernaryExpr          );    \
    DECL_VISIT_PROC( BinaryExpr           );    \
    DECL_VISIT_PROC( UnaryExpr            );    \
    DECL_VISIT_PROC( LiteralExpr          );    \
    DECL_VISIT_PROC( CastExpr             );    \
    DECL_VISIT_PROC( ProcCallExpr         );    \
    DECL_VISIT_PROC( PostfixValueExpr     );    \
    DECL_VISIT_PROC( InstanceOfExpr       );    \
    DECL_VISIT_PROC( AllocExpr            );    \
    DECL_VISIT_PROC( VarAccessExpr        );    \
    DECL_VISIT_PROC( InitListExpr         );    \
    DECL_VISIT_PROC( RangeExpr            );

#define DECL_VISITOR_INTERFACE_TDENOTER         \
    DECL_VISIT_PROC( BuiltinTypeDenoter   );    \
    DECL_VISIT_PROC( ArrayTypeDenoter     );    \
    DECL_VISIT_PROC( PointerTypeDenoter   );

#define DECL_VISITOR_INTERFACE      \
    DECL_VISITOR_INTERFACE_COMMON   \
    DECL_VISITOR_INTERFACE_STMNTS   \
    DECL_VISITOR_INTERFACE_EXPRS    \
    DECL_VISITOR_INTERFACE_TDENOTER

/* === Visitor interface === */

class Visitor
{

    public:

        virtual ~Visitor()
        {
        }

        /* --- Common AST nodes --- */

        DEF_ABSTRACT_VISIT_PROC( Program              );
        DEF_ABSTRACT_VISIT_PROC( CodeBlock            );
        DEF_ABSTRACT_VISIT_PROC( VarName              );
        DEF_ABSTRACT_VISIT_PROC( VarDecl              );
        DEF_ABSTRACT_VISIT_PROC( Param                );
        DEF_ABSTRACT_VISIT_PROC( Arg                  );
        DEF_ABSTRACT_VISIT_PROC( ProcSignature        );
        DEF_ABSTRACT_VISIT_PROC( AttribPrefix         );
        DEF_ABSTRACT_VISIT_PROC( Attrib               );
        DEF_ABSTRACT_VISIT_PROC( ArrayAccess          );
        DEF_ABSTRACT_VISIT_PROC( ProcCall             );
        DEF_ABSTRACT_VISIT_PROC( SwitchCase           );

        /* --- Statements --- */

        DEF_ABSTRACT_VISIT_PROC( ReturnStmnt          );
        DEF_ABSTRACT_VISIT_PROC( CtrlTransferStmnt    );
        DEF_ABSTRACT_VISIT_PROC( ExprStmnt            );

        DEF_ABSTRACT_VISIT_PROC( IfStmnt              );
        DEF_ABSTRACT_VISIT_PROC( SwitchStmnt          );

        DEF_ABSTRACT_VISIT_PROC( DoWhileStmnt         );
        DEF_ABSTRACT_VISIT_PROC( WhileStmnt           );
        DEF_ABSTRACT_VISIT_PROC( ForStmnt             );
        DEF_ABSTRACT_VISIT_PROC( ForRangeStmnt        );
        DEF_ABSTRACT_VISIT_PROC( ForEachStmnt         );
        DEF_ABSTRACT_VISIT_PROC( RepeatStmnt          );

        DEF_ABSTRACT_VISIT_PROC( ClassDeclStmnt       );
        DEF_ABSTRACT_VISIT_PROC( VarDeclStmnt         );
        DEF_ABSTRACT_VISIT_PROC( ProcDeclStmnt        );
        DEF_ABSTRACT_VISIT_PROC( FriendDeclStmnt      );

        DEF_ABSTRACT_VISIT_PROC( CopyAssignStmnt      );
        DEF_ABSTRACT_VISIT_PROC( ModifyAssignStmnt    );
        DEF_ABSTRACT_VISIT_PROC( PostOperatorStmnt    );

        /* --- Expressions --- */

        DEF_ABSTRACT_VISIT_PROC( TernaryExpr          );
        DEF_ABSTRACT_VISIT_PROC( BinaryExpr           );
        DEF_ABSTRACT_VISIT_PROC( UnaryExpr            );
        DEF_ABSTRACT_VISIT_PROC( LiteralExpr          );
        DEF_ABSTRACT_VISIT_PROC( CastExpr             );
        DEF_ABSTRACT_VISIT_PROC( ProcCallExpr         );
        DEF_ABSTRACT_VISIT_PROC( PostfixValueExpr     );
        DEF_ABSTRACT_VISIT_PROC( InstanceOfExpr       );
        DEF_ABSTRACT_VISIT_PROC( AllocExpr            );
        DEF_ABSTRACT_VISIT_PROC( VarAccessExpr        );
        DEF_ABSTRACT_VISIT_PROC( InitListExpr         );
        DEF_ABSTRACT_VISIT_PROC( RangeExpr            );

        /* --- Type denoters --- */

        DEF_ABSTRACT_VISIT_PROC( BuiltinTypeDenoter   );
        DEF_ABSTRACT_VISIT_PROC( ArrayTypeDenoter     );
        DEF_ABSTRACT_VISIT_PROC( PointerTypeDenoter   );

    protected:

        template <typename T> void Visit(T ast, void* args = nullptr)
        {
            if (ast)
                ast->Visit(this, args);
        }

        template <typename T> void Visit(const std::vector<std::shared_ptr<T>>& astList, void* args = nullptr)
        {
            for (const auto& ast : astList)
                Visit(ast, args);
        }

};

#undef DefAbstractVisitProc

} // /namespace AbstractSyntaxTrees

#endif

// ================================================================================


text:
package client

import (
	"github.com/kubeflow/pipelines/backend/src/common/util"
	"github.com/kubeflow/pipelines/backend/src/crd/pkg/client/clientset/versioned/typed/scheduledworkflow/v1beta1"
)

type FakeSwfClient struct {
	scheduledWorkflowClientFake *FakeScheduledWorkflowClient
}

func NewFakeSwfClient() *FakeSwfClient {
	return &FakeSwfClient{NewScheduledWorkflowClientFake()}
}

func (c *FakeSwfClient) ScheduledWorkflow(namespace string) v1beta1.ScheduledWorkflowInterface {
	if len(namespace) == 0 {
		panic(util.NewResourceNotFoundError("Namespace", namespace))
	}
	return c.scheduledWorkflowClientFake
}

type FakeSwfClientWithBadWorkflow struct {
	scheduledWorkflowClientFake *FakeBadScheduledWorkflowClient
}

func NewFakeSwfClientWithBadWorkflow() *FakeSwfClientWithBadWorkflow {
	return &FakeSwfClientWithBadWorkflow{&FakeBadScheduledWorkflowClient{}}
}

func (c *FakeSwfClientWithBadWorkflow) ScheduledWorkflow(namespace string) v1beta1.ScheduledWorkflowInterface {
	return c.scheduledWorkflowClientFake
}


text:
@interface Config ()

@property (nonatomic, strong) NSURL *configURL;
@property (nonatomic, strong) NSDictionary *configJSON;

@end

@implementation Config

+ (instancetype)sharedConfig {
    static Config *config = nil;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        config = [[self alloc] init];
        if (config) {
            NSDictionary *info = [[NSBundle mainBundle] infoDictionary];
            NSString *appVersion = info[@"CFBundleVersion"];
            NSString *configURLString = [NSString stringWithFormat:@"%@%@%@/config",
                                         kBaseURL, kConfigWebappPath, appVersion];
            config.configURL = [NSURL URLWithString:configURLString];

            // Initialize properties to sensible defaults in
            // case kShouldRunConfigCheck has disabled checking.
            config.available = YES;
            config.upgradeRecommended = NO;
            config.upgradeRequired = NO;
            config.unrecoverableError = NO;
        }
    });
    return config;
}

#pragma mark - Config Checking

- (void)checkWithCompletion:(completion)completion {
    if (!kShouldRunConfigCheck) {
        // A no-op if this hasn't been set to YES in Constants.m.
        completion();
        return;
    }

    [self getAndParseConfigJSONWithCompletion:^{
        [self checkAvailability];
        if (![self isAvailable]) {
            completion();
            return;
        }

        [self checkUpgradeRecommended];
        [self checkUpgradeRequired];
        [self checkDisabledPortlets];
        [self checkDisabledFolders];

        completion();
    }];
}

- (void)checkAvailability {
    self.available = self.configJSON != nil;
    self.unrecoverableError = !self.available;
}

- (void)checkUpgradeRecommended {
    self.upgradeRecommended = [(NSNumber *)self.configJSON[@"upgradeRecommended"] boolValue];
}

- (void)checkUpgradeRequired {
    self.upgradeRequired = [(NSNumber *)self.configJSON[@"upgradeRequired"] boolValue];
    self.unrecoverableError = self.upgradeRequired;
}

- (void)checkDisabledPortlets {
    self.disabledPortlets = self.configJSON[@"disabledPortlets"];
}

- (void)checkDisabledFolders {
    self.disabledFolders = self.configJSON[@"disabledFolders"];
}

#pragma mark - Alerts

- (void)showUpgradeRecommendedAlert {
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:kUpgradeRecommendedMessage
                                                    message:nil
                                                   delegate:self
                                          cancelButtonTitle:@"Later"
                                          otherButtonTitles:kGoToAppStoreTitle, nil];
    alert.delegate = self;
    [alert show];
}

- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
    NSString *title = [alertView buttonTitleAtIndex:buttonIndex];
    if ([title isEqualToString:kGoToAppStoreTitle]) {
        NSURL *URL = [NSURL URLWithString:kAppStoreURL];
        [[UIApplication sharedApplication] openURL:URL];
    }
}

#pragma mark - JSON Handling

// Sets self.configJSON, or leaves it nil if an error is encountered.
- (void)getAndParseConfigJSONWithCompletion:(completion)completion {
    NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:self.configURL];
    [request setValue:kUserAgent forHTTPHeaderField:@"User-Agent"];
    [NSURLConnection sendAsynchronousRequest:request
                                       queue:[NSOperationQueue mainQueue]
                           completionHandler:^(NSURLResponse *response, NSData *data, NSError *connectionError) {
        NSInteger statusCode = ((NSHTTPURLResponse *)response).statusCode;

        if (statusCode != 200) {
            NSLog(@"Error getting configJSON (received status code %ld)", (long)statusCode);
            if (connectionError) {
                NSLog(@"%@", [connectionError localizedDescription]);
            }
            completion();
            return;
        }

        NSError *error;
        NSDictionary *configJSON = [NSJSONSerialization JSONObjectWithData:data options:0 error:&error];

        if (error) {
            NSLog(@"configJSON parse error: %@", [error localizedDescription]);
            completion();
            return;
        }

        // No errors encountered; assign the constructed dictionary.
        self.configJSON = configJSON;

        completion();
    }];
}

@end


text:
package io.motown.mobieurope.destination.entities;

import io.motown.mobieurope.source.soap.schema.NotifyRequestResultResponse;
import io.motown.mobieurope.source.soap.schema.ResponseError;

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

public class DestinationNotifyRequestResultResponse {

    private ResponseError responseError;

    public DestinationNotifyRequestResultResponse(ResponseError responseError) {
        checkNotNull(responseError);

        this.responseError = responseError;
    }

    public DestinationNotifyRequestResultResponse(NotifyRequestResultResponse notifyRequestResultResponse) {
        checkNotNull(notifyRequestResultResponse);

        this.responseError = notifyRequestResultResponse.getResponseError();
    }

    public ResponseError getResponseError() {
        return responseError;
    }

    public boolean hasError() {
        return responseError != null;
    }
}


text:
<?php

if (!defined('IN_PHPBB'))
{
	exit;
}

/**
* DO NOT CHANGE
*/
if (empty($lang) || !is_array($lang))
{
	$lang = array();
}

// DEVELOPERS PLEASE NOTE
//
// Placeholders can now contain order information, e.g. instead of
// 'Page %s of %s' you can (and should) write 'Page %1$s of %2$s', this allows
// translators to re-order the output of data while ensuring it remains correct
//
// You do not need this where single placeholders are used, e.g. 'Message %d' is fine
// equally where a string contains only two placeholders which are used to wrap text
// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine

$lang = array_merge($lang, array(
	'CLI_CONFIG_CANNOT_CACHED'			=> 'Set this option if the configuration option changes too frequently to be efficiently cached.',
	'CLI_CONFIG_CURRENT'				=> 'Current configuration value, use 0 and 1 to specify boolean values',
	'CLI_CONFIG_DELETE_SUCCESS'			=> 'Successfully deleted config %s.',
	'CLI_CONFIG_NEW'					=> 'New configuration value, use 0 and 1 to specify boolean values',
	'CLI_CONFIG_NOT_EXISTS'				=> 'Config %s does not exist',
	'CLI_CONFIG_OPTION_NAME'			=> 'The configuration option's name',
	'CLI_CONFIG_PRINT_WITHOUT_NEWLINE'	=> 'Set this option if the value should be printed without a new line at the end.',
	'CLI_CONFIG_INCREMENT_BY'			=> 'Amount to increment by',
	'CLI_CONFIG_INCREMENT_SUCCESS'		=> 'Successfully incremented config %s',
	'CLI_CONFIG_SET_FAILURE'			=> 'Could not set config %s',
	'CLI_CONFIG_SET_SUCCESS'			=> 'Successfully set config %s',

	'CLI_DESCRIPTION_CRON_LIST'					=> 'Prints a list of ready and unready cron jobs.',
	'CLI_DESCRIPTION_CRON_RUN'					=> 'Runs all ready cron tasks.',
	'CLI_DESCRIPTION_CRON_RUN_ARGUMENT_1'		=> 'Name of the task to be run',
	'CLI_DESCRIPTION_DB_LIST'					=> 'List all installed and available migrations.',
	'CLI_DESCRIPTION_DB_MIGRATE'				=> 'Updates the database by applying migrations.',
	'CLI_DESCRIPTION_DB_REVERT'					=> 'Revert a migration.',
	'CLI_DESCRIPTION_DELETE_CONFIG'				=> 'Deletes a configuration option',
	'CLI_DESCRIPTION_DISABLE_EXTENSION'			=> 'Disables the specified extension.',
	'CLI_DESCRIPTION_ENABLE_EXTENSION'			=> 'Enables the specified extension.',
	'CLI_DESCRIPTION_FIND_MIGRATIONS'			=> 'Finds migrations that are not depended upon.',
	'CLI_DESCRIPTION_GET_CONFIG'				=> 'Gets a configuration option's value',
	'CLI_DESCRIPTION_INCREMENT_CONFIG'			=> 'Increments a configuration option's integer value',
	'CLI_DESCRIPTION_LIST_EXTENSIONS'			=> 'Lists all extensions in the database and on the filesystem.',

	'CLI_DESCRIPTION_OPTION_ENV'				=> 'The Environment name.',
	'CLI_DESCRIPTION_OPTION_SAFE_MODE'			=> 'Run in Safe Mode (without extensions).',
	'CLI_DESCRIPTION_OPTION_SHELL'				=> 'Launch the shell.',

	'CLI_DESCRIPTION_PURGE_EXTENSION'			=> 'Purges the specified extension.',
	'CLI_DESCRIPTION_REPARSER_LIST'				=> 'Lists the types of text that can be reparsed.',
	'CLI_DESCRIPTION_REPARSER_REPARSE'			=> 'Reparses stored text with the current text_formatter services.',
	'CLI_DESCRIPTION_REPARSER_REPARSE_ARG_1'	=> 'Type of text to reparse. Leave blank to reparse everything.',
	'CLI_DESCRIPTION_REPARSER_REPARSE_OPT_DRY_RUN'		=> 'Do not save any changes; just print what would happen',
	'CLI_DESCRIPTION_REPARSER_REPARSE_OPT_RANGE_MIN'	=> 'Lowest record ID to process',
	'CLI_DESCRIPTION_REPARSER_REPARSE_OPT_RANGE_MAX'	=> 'Highest record ID to process',
	'CLI_DESCRIPTION_REPARSER_REPARSE_OPT_RANGE_SIZE'	=> 'Approximate number of records to process at a time',
	'CLI_DESCRIPTION_REPARSER_REPARSE_OPT_RESUME'		=> 'Start reparsing where the last execution stopped',
	'CLI_DESCRIPTION_RECALCULATE_EMAIL_HASH'	=> 'Recalculates the user_email_hash column of the users table.',
	'CLI_DESCRIPTION_SET_ATOMIC_CONFIG'			=> 'Sets a configuration option's value only if the old matches the current value',
	'CLI_DESCRIPTION_SET_CONFIG'				=> 'Sets a configuration option's value',

	'CLI_DESCRIPTION_THUMBNAIL_DELETE'		=> 'Delete all existing thumbnails.',
	'CLI_DESCRIPTION_THUMBNAIL_GENERATE'	=> 'Generate all missing thumbnails.',
	'CLI_DESCRIPTION_THUMBNAIL_RECREATE'	=> 'Recreate all thumbnails.',

	'CLI_DESCRIPTION_USER_ACTIVATE'				=> 'Activate (or deactivate) a user account.',
	'CLI_DESCRIPTION_USER_ACTIVATE_USERNAME'	=> 'Username of the account to activate.',
	'CLI_DESCRIPTION_USER_ACTIVATE_DEACTIVATE'	=> 'Deactivate the user's account',
	'CLI_DESCRIPTION_USER_ACTIVATE_ACTIVE'		=> 'The user is already active.',
	'CLI_DESCRIPTION_USER_ACTIVATE_INACTIVE'	=> 'The user is already inactive.',
	'CLI_DESCRIPTION_USER_ADD'					=> 'Add a new user.',
	'CLI_DESCRIPTION_USER_ADD_OPTION_USERNAME'	=> 'Username of the new user',
	'CLI_DESCRIPTION_USER_ADD_OPTION_PASSWORD'	=> 'Password of the new user',
	'CLI_DESCRIPTION_USER_ADD_OPTION_EMAIL'		=> 'E-mail address of the new user',
	'CLI_DESCRIPTION_USER_ADD_OPTION_NOTIFY'	=> 'Send account activation email to the new user (not sent by default)',
	'CLI_DESCRIPTION_USER_DELETE'				=> 'Delete a user account.',
	'CLI_DESCRIPTION_USER_DELETE_USERNAME'		=> 'Username of the user to delete',
	'CLI_DESCRIPTION_USER_DELETE_OPTION_POSTS'	=> 'Delete all posts by the user. Without this option, the user's posts will be retained.',
	'CLI_DESCRIPTION_USER_RECLEAN'				=> 'Re-clean usernames.',

	'CLI_EXTENSION_DISABLE_FAILURE'		=> 'Could not disable extension %s',
	'CLI_EXTENSION_DISABLE_SUCCESS'		=> 'Successfully disabled extension %s',
	'CLI_EXTENSION_ENABLE_FAILURE'		=> 'Could not enable extension %s',
	'CLI_EXTENSION_ENABLE_SUCCESS'		=> 'Successfully enabled extension %s',
	'CLI_EXTENSION_NAME'				=> 'Name of the extension',
	'CLI_EXTENSION_PURGE_FAILURE'		=> 'Could not purge extension %s',
	'CLI_EXTENSION_PURGE_SUCCESS'		=> 'Successfully purged extension %s',
	'CLI_EXTENSION_NOT_FOUND'			=> 'No extensions were found.',
	'CLI_EXTENSIONS_AVAILABLE'			=> 'Available',
	'CLI_EXTENSIONS_DISABLED'			=> 'Disabled',
	'CLI_EXTENSIONS_ENABLED'			=> 'Enabled',

	'CLI_FIXUP_RECALCULATE_EMAIL_HASH_SUCCESS'	=> 'Successfully recalculated all email hashes.',

	'CLI_MIGRATION_NAME'					=> 'Migration name, including the namespace (use forward slashes instead of backslashes to avoid problems).',
	'CLI_MIGRATIONS_AVAILABLE'				=> 'Available migrations',
	'CLI_MIGRATIONS_INSTALLED'				=> 'Installed migrations',
	'CLI_MIGRATIONS_ONLY_AVAILABLE'		    => 'Show only available migrations',
	'CLI_MIGRATIONS_EMPTY'                  => 'No migrations.',

	'CLI_REPARSER_REPARSE_REPARSING'		=> 'Reparsing %1$s (range %2$d..%3$d)',
	'CLI_REPARSER_REPARSE_REPARSING_START'	=> 'Reparsing %s...',
	'CLI_REPARSER_REPARSE_SUCCESS'			=> 'Reparsing ended with success',

	// In all the case %1$s is the logical name of the file and %2$s the real name on the filesystem
	// eg: big_image.png (2_a51529ae7932008cf8454a95af84cacd) generated.
	'CLI_THUMBNAIL_DELETED'		=> '%1$s (%2$s) deleted.',
	'CLI_THUMBNAIL_DELETING'	=> 'Deleting thumbnails',
	'CLI_THUMBNAIL_SKIPPED'		=> '%1$s (%2$s) skipped.',
	'CLI_THUMBNAIL_GENERATED'	=> '%1$s (%2$s) generated.',
	'CLI_THUMBNAIL_GENERATING'	=> 'Generating thumbnails',
	'CLI_THUMBNAIL_GENERATING_DONE'	=> 'All thumbnails have been regenerated.',
	'CLI_THUMBNAIL_DELETING_DONE'	=> 'All thumbnails have been deleted.',

	'CLI_THUMBNAIL_NOTHING_TO_GENERATE'	=> 'No thumbnails to generate.',
	'CLI_THUMBNAIL_NOTHING_TO_DELETE'	=> 'No thumbnails to delete.',

	'CLI_USER_ADD_SUCCESS'		=> 'Successfully added user %s.',
	'CLI_USER_DELETE_CONFIRM'	=> 'Are you sure you want to delete '%s'? [y/N]',
	'CLI_USER_RECLEAN_START'	=> 'Re-cleaning usernames',
	'CLI_USER_RECLEAN_DONE'		=> [
		0	=> 'Re-cleaning complete. No usernames needed to be cleaned.',
		1	=> 'Re-cleaning complete. %d username was cleaned.',
		2	=> 'Re-cleaning complete. %d usernames were cleaned.',
	],
));

// Additional help for commands.
$lang = array_merge($lang, array(
	'CLI_HELP_CRON_RUN'			=> $lang['CLI_DESCRIPTION_CRON_RUN'] . ' Optionally you can specify a cron task name to run only the specified cron task.',
	'CLI_HELP_USER_ACTIVATE'	=> 'Activate a user account, or deactivate an account using the <info>--deactivate</info> option.
To optionally send an activation email to the user, use the <info>--send-email</info> option.',
	'CLI_HELP_USER_ADD'			=> 'The <info>%command.name%</info> command adds a new user:
If this command is run without options, you will be prompted to enter them.
To optionally send an email to the new user, use the <info>--send-email</info> option.',
	'CLI_HELP_USER_RECLEAN'		=> 'Re-clean usernames will check all stored usernames and ensure clean versions are also stored. Cleaned usernames are a case insensitive form, NFC normalized and transformed to ASCII.',
));


text:
<?php

namespace Laminas\View\Helper\Navigation\Listener;

use Laminas\EventManager\Event;

/**
 * Default Access Control Listener
 */
class AclListener
{
    /**
     * Determines whether a page should be accepted by ACL when iterating
     *
     * - If helper has no ACL, page is accepted
     * - If page has a resource or privilege defined, page is accepted if the
     *   ACL allows access to it using the helper's role
     * - If page has no resource or privilege, page is accepted
     * - If helper has ACL and role:
     *      - Page is accepted if it has no resource or privilege.
     *      - Page is accepted if ACL allows page's resource or privilege.
     *
     * @param  Event    $event
     * @return bool
     */
    public static function accept(Event $event)
    {
        $accepted = true;
        $params   = $event->getParams();
        $acl      = $params['acl'];
        $page     = $params['page'];
        $role     = $params['role'];

        if (! $acl) {
            return $accepted;
        }

        $resource  = $page->getResource();
        $privilege = $page->getPrivilege();

        if ($resource || $privilege) {
            $accepted = $acl->hasResource($resource)
                        && $acl->isAllowed($role, $resource, $privilege);
        }

        return $accepted;
    }
}


text:
var Router = Ember.Router.extend({
  location: 'history'
}); // ensure we don't share routes between all Router instances

Router.map(function() {
  this.resource('room', { path: '/room/:room_name' });

});

export default Router;


text:
package de.rainu.alexa.cloud.calendar.exception;

public abstract class AlexaExcpetion extends Exception {

  private String messageKey;

  public AlexaExcpetion(String messageKey) {
    super();
    this.messageKey = messageKey;
  }

  public AlexaExcpetion(String messageKey, String message) {
    super(message);
    this.messageKey = messageKey;
  }

  public AlexaExcpetion(String messageKey, String message, Throwable cause) {
    super(message, cause);
    this.messageKey = messageKey;
  }

  public String getMessageKey() {
    return messageKey;
  }
}


text:
import Mirage from 'ember-cli-mirage';
import Model from 'ember-cli-mirage/orm/model';
import Schema from 'ember-cli-mirage/orm/schema';
import Db from 'ember-cli-mirage/db';

/*
  A model with a hasMany association can be in eight states
  with respect to its association. This helper class
  returns a parent (and its children) in these various states.

  The return value is an array of the form

    [parent, [child1, child2...]]

  where the children array may be undefined.
*/
class HasManyHelper {

  constructor() {
    this.db = new Db({
      users: [],
      addresses: []
    });
    this.schema = new Schema(this.db);

    var User = Model.extend({
      addresses: Mirage.hasMany()
    });
    var Address = Model;

    this.schema.registerModels({
      user: User,
      address: Address
    });
  }

  savedParentNoChildren() {
    let insertedUser = this.db.users.insert({name: 'Link'});

    return [this.schema.user.find(insertedUser.id), []];
  }

  savedParentNewChildren() {
    let insertedUser = this.db.users.insert({name: 'Link'});

    var user = this.schema.user.find(insertedUser.id);
    var newAddress = user.newAddress();

    return [user, [newAddress]];
  }

  savedParentSavedChildren() {
    let insertedUser = this.db.users.insert({name: 'Link'});
    let insertedAddress = this.db.addresses.insert({name: '123 Hyrule Way', userId: insertedUser.id});

    var user = this.schema.user.find(insertedUser.id);
    var address = this.schema.address.find(insertedAddress.id);

    return [user, [address]];
  }

  savedParentMixedChildren() {
    let insertedUser = this.db.users.insert({name: 'Link'});
    let insertedAddress = this.db.addresses.insert({name: '123 Hyrule Way', userId: insertedUser.id});

    var user = this.schema.user.find(insertedUser.id);
    var savedAddress = this.schema.address.find(insertedAddress.id);
    var newAddress = user.newAddress();

    return [user, [savedAddress, newAddress]];
  }

  newParentNoChildren() {
    var user = this.schema.user.new();

    return [user, []];
  }

  newParentNewChildren() {
    var user = this.schema.user.new();
    var newAddress = user.newAddress();

    return [user, [newAddress]];
  }

  newParentSavedChildren() {
    let insertedAddress = this.db.addresses.insert({name: '123 Hyrule Way'});
    let savedAddress = this.schema.address.find(insertedAddress.id);
    let newUser = this.schema.user.new({addresses: [savedAddress]});

    return [newUser, [savedAddress]];
  }

  newParentMixedChildren() {
    let insertedAddress = this.db.addresses.insert({name: '123 Hyrule Way'});
    var savedAddress = this.schema.address.find(insertedAddress.id);
    var newAddress = this.schema.address.new();

    var newUser = this.schema.user.new({addresses: [savedAddress, newAddress]});

    return [newUser, [savedAddress, newAddress]];
  }

  // Just a saved unassociated child. The id is high so as not to
  // interfere with any other children
  savedChild() {
    let insertedAddress = this.db.addresses.insert({name: 'foo'});

    return this.schema.address.find(insertedAddress.id);
  }

  newChild() {
    return this.schema.address.new({name: 'Newbie'});
  }

}

export default HasManyHelper;


text:
namespace {

struct CreateIntFromFloat {
    CreateIntFromFloat(float val) : fVal(val) {}
    int* operator()() const { return SkNEW_ARGS(int, ((int)fVal)); }
    float fVal;
};

// As a template argument this must have external linkage.
void custom_destroy(int* ptr) { *ptr = 99; }

} // namespace

DEF_TEST(LazyPtr, r) {
    // Basic usage: calls SkNEW(int).
    SkLazyPtr<int> lazy;
    int* ptr = lazy.get();
    REPORTER_ASSERT(r, ptr);
    REPORTER_ASSERT(r, lazy.get() == ptr);

    // Advanced usage: calls a functor.
    SkLazyPtr<int> lazyFunctor;
    int* six = lazyFunctor.get(CreateIntFromFloat(6.4f));
    REPORTER_ASSERT(r, six);
    REPORTER_ASSERT(r, 6 == *six);

    // Just makes sure this is safe.
    SkLazyPtr<double> neverRead;

    // SkLazyPtr supports custom destroy methods.
    {
        SkLazyPtr<int, custom_destroy> customDestroy;
        ptr = customDestroy.get();
        // custom_destroy called here.
    }
    REPORTER_ASSERT(r, ptr);
    REPORTER_ASSERT(r, 99 == *ptr);
    // Since custom_destroy didn't actually delete ptr, we do now.
    SkDELETE(ptr);
}

namespace {

struct Racer : public SkRunnable {
    Racer() : fLazy(NULL), fSeen(NULL) {}

    void run() SK_OVERRIDE { fSeen = fLazy->get(); }

    SkLazyPtr<int>* fLazy;
    int* fSeen;
};

} // namespace

DEF_TEST(LazyPtr_Threaded, r) {
    static const int kRacers = 321;

    SkLazyPtr<int> lazy;

    Racer racers[kRacers];
    for (int i = 0; i < kRacers; i++) {
        racers[i].fLazy = &lazy;
    }

    SkTaskGroup tg;
    for (int i = 0; i < kRacers; i++) {
        tg.add(racers + i);
    }
    tg.wait();

    for (int i = 1; i < kRacers; i++) {
        REPORTER_ASSERT(r, racers[i].fSeen);
        REPORTER_ASSERT(r, racers[i].fSeen == racers[0].fSeen);
    }
}


text:
using Piranha.Models;

namespace Piranha.Runtime;

public sealed class AppBlock : AppDataItem
{
    /// <summary>
    /// Gets/sets the display name.
    /// </summary>
    public string Name { get; set; }

    /// <summary>
    /// Gets/sets the category.
    /// </summary>
    public string Category { get; set; }

    /// <summary>
    /// Gets/sets the block icon.
    /// </summary>
    public string Icon { get; set; }

    /// <summary>
    /// Gets/sets the field that should be used to render list item title.
    /// </summary>
    public string ListTitleField { get; set; }

    /// <summary>
    /// Gets/sets if the block type should only be listed
    /// where specified explicitly.
    /// </summary>
    public bool IsUnlisted { get; set; }

    /// <summary>
    /// Gets/sets if the block should use a generic model
    /// when rendered in the manager interface.
    /// </summary>
    public bool IsGeneric { get; set; }

    /// <summary>
    /// Gets/sets the name of the component that should be
    /// used to render the block in the manager interface.
    /// </summary>
    public string Component { get; set; }

    /// <summary>
    /// Gets/sets the editor width.
    /// </summary>
    public EditorWidth Width { get; set; }

    /// <summary>
    /// Gets/sets the specified item types.
    /// </summary>
    public IList<Type> ItemTypes { get; set; } = new List<Type>();

    /// <summary>
    /// Gets/sets the optional init methods.
    /// </summary>
    public AppInitMethod Init { get; set; } = new AppInitMethod();
}