text:
"""The Virtual File System (VFS) file-like object interface."""

import abc
import os

# Since this class implements the file-like object interface
# the names of the interface functions are in lower case as an exception
# to the normal naming convention.

class FileIO(object):
  """Class that implements the VFS file-like object interface."""

  def __init__(self, resolver_context):
    """Initializes the file-like object.

    Args:
      resolver_context: the resolver context (instance of resolver.Context).
    """
    super(FileIO, self).__init__()
    self._is_cached = False
    self._is_open = False
    self._resolver_context = resolver_context

  @abc.abstractmethod
  def _Close(self):
    """Closes the file-like object.

    Raises:
      IOError: if the close failed.
    """

  @abc.abstractmethod
  def _Open(self, path_spec=None, mode='rb'):
    """Opens the file-like object defined by path specification.

    Args:
      path_spec: optional path specification (instance of path.PathSpec).
                 The default is None.
      mode: optional file access mode. The default is 'rb' read-only binary.

    Raises:
      AccessError: if the access to open the file was denied.
      IOError: if the file-like object could not be opened.
      PathSpecError: if the path specification is incorrect.
      ValueError: if the path specification is invalid.
    """

  # Note: that the following functions do not follow the style guide
  # because they are part of the file-like object interface.

  def open(self, path_spec=None, mode='rb'):
    """Opens the file-like object defined by path specification.

    Args:
      path_spec: optional path specification (instance of path.PathSpec).
                 The default is None.
      mode: optional file access mode. The default is 'rb' read-only binary.

    Raises:
      AccessError: if the access to open the file was denied.
      IOError: if the file-like object was already opened or the open failed.
      PathSpecError: if the path specification is incorrect.
      ValueError: if the path specification or mode is invalid.
    """
    if self._is_open and not self._is_cached:
      raise IOError(u'Already open.')

    if mode != 'rb':
      raise ValueError(u'Unsupport mode: {0:s}.'.format(mode))

    if not self._is_open:
      self._Open(path_spec=path_spec, mode=mode)
      self._is_open = True

      if path_spec and not self._resolver_context.GetFileObject(path_spec):
        self._resolver_context.CacheFileObject(path_spec, self)
        self._is_cached = True

    if self._is_cached:
      self._resolver_context.GrabFileObject(path_spec)

  def close(self):
    """Closes the file-like object.

    Raises:
      IOError: if the file-like object was not opened or the close failed.
    """
    if not self._is_open:
      raise IOError(u'Not opened.')

    if not self._is_cached:
      close_file_object = True
    elif self._resolver_context.ReleaseFileObject(self):
      self._is_cached = False
      close_file_object = True
    else:
      close_file_object = False

    if close_file_object:
      self._Close()
      self._is_open = False

  @abc.abstractmethod
  def read(self, size=None):
    """Reads a byte string from the file-like object at the current offset.

       The function will read a byte string of the specified size or
       all of the remaining data if no size was specified.

    Args:
      size: Optional integer value containing the number of bytes to read.
            Default is all remaining data (None).

    Returns:
      A byte string containing the data read.

    Raises:
      IOError: if the read failed.
    """

  @abc.abstractmethod
  def seek(self, offset, whence=os.SEEK_SET):
    """Seeks an offset within the file-like object.

    Args:
      offset: The offset to seek.
      whence: Optional value that indicates whether offset is an absolute
              or relative position within the file. Default is SEEK_SET.

    Raises:
      IOError: if the seek failed.
    """

  # get_offset() is preferred above tell() by the libbfio layer used in libyal.
  @abc.abstractmethod
  def get_offset(self):
    """Returns the current offset into the file-like object.

    Raises:
      IOError: if the file-like object has not been opened.
    """

  # Pythonesque alias for get_offset().
  def tell(self):
    """Returns the current offset into the file-like object."""
    return self.get_offset()

  @abc.abstractmethod
  def get_size(self):
    """Returns the size of the file-like object.

    Raises:
      IOError: if the file-like object has not been opened.
    """


text:
<?xml version="1.0" encoding="utf-8"?>
<transitionSet xmlns:tools="http://schemas.android.com/tools"
    xmlns:android="http://schemas.android.com/apk/res/android">
    <fade android:startDelay="100">

        <!-- We don't want the toolbar to fade in, since that is a static element -->
        <targets>
            <target android:excludeId="@id/toolbar"
                tools:ignore="UnusedAttribute" />
        </targets>
    </fade>
</transitionSet>

redpajama_set_name: RedPajamaGithub


text:
namespace remoting {

// This class gathers information about the Wayland Output / Display by
// binding to wl_output and zxdg_output_v1 interfaces provided by the protocol.
class WaylandDisplay {
 public:
  WaylandDisplay();
  ~WaylandDisplay();

  WaylandDisplay(const WaylandDisplay&) = delete;
  WaylandDisplay& operator=(const WaylandDisplay&) = delete;

  // Handles output related global events (that are emitted for each display
  // present on the system).
  // Does not take ownership of |registry|
  void HandleGlobalDisplayEvent(struct wl_registry* registry,
                                uint32_t name,
                                const char* interface,
                                uint32_t version);

  // Returns true if the global object being removed was in fact a display
  // object.
  bool HandleGlobalRemoveDisplayEvent(uint32_t name);

  DesktopDisplayInfo GetCurrentDisplayInfo() const;

 private:
  void InitXdgOutputIfPossible(DisplayInfo& display_info);
  void FinishPartialXdgOutputInitializations();
  static void UpdateDisplayInfo(DisplayInfo display_info,
                                DisplayInfo& existing_info);

  // wl_output interface event handlers.
  static void OnGeometryEvent(void* data,
                              wl_output* wl_output,
                              int x,
                              int y,
                              int physical_width,
                              int physical_height,
                              int subpixel,
                              const char* make,
                              const char* model,
                              int transform);
  static void OnModeEvent(void* data,
                          wl_output* wl_output,
                          uint flags,
                          int width,
                          int height,
                          int refresh);
  static void OnDoneEvent(void* data, wl_output* wl_output);
  static void OnScaleEvent(void* data, wl_output* wl_output, int factor);

  // zxdg_output_v1 interface event handlers.
  static void OnXdgOutputLogicalPositionEvent(void* data,
                                              struct zxdg_output_v1* xdg_output,
                                              int32_t x,
                                              int32_t y);
  static void OnXdgOutputLogicalSizeEvent(void* data,
                                          struct zxdg_output_v1* xdg_output,
                                          int32_t width,
                                          int32_t height);
  static void OnXdgOutputDoneEvent(void* data,
                                   struct zxdg_output_v1* xdg_output);
  static void OnXdgOutputNameEvent(void* data,
                                   struct zxdg_output_v1* xdg_output,
                                   const char* name);
  static void OnXdgOutputDescriptionEvent(void* data,
                                          struct zxdg_output_v1* xdg_output,
                                          const char* description);

  SEQUENCE_CHECKER(sequence_checker_);

  const struct wl_output_listener wl_output_listener_;
  const struct zxdg_output_v1_listener xdg_output_listener_;
  base::raw_ptr<struct zxdg_output_manager_v1> xdg_output_manager_ = nullptr;
  std::vector<DisplayInfo> display_info_;
};

}  // namespace remoting

#endif  // REMOTING_HOST_LINUX_WAYLAND_DISPLAY_H_


text:
using ComputerAlgebra;
using ComputerAlgebra.LinqCompiler;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using System.Reflection;
using Util;
using LinqExpr = System.Linq.Expressions.Expression;
using ParamExpr = System.Linq.Expressions.ParameterExpression;

namespace Circuit
{
    /// <summary>
    /// Exception thrown when a simulation does not converge.
    /// </summary>
    public class SimulationDiverged : FailedToConvergeException
    {
        private long at;
        /// <summary>
        /// Sample number at which the simulation diverged.
        /// </summary>
        public long At { get { return at; } }

        public SimulationDiverged(string Message, long At) : base(Message) { at = At; }

        public SimulationDiverged(int At) : base("Simulation diverged.") { at = At; }
    }

    /// <summary>
    /// Simulate a circuit.
    /// </summary>
    public class Simulation
    {
        protected static readonly Variable t = TransientSolution.t;

        // Largest delay we expect to see. BDF6 is the largest possible
        // realistic (or theoretically possible?) method.
        protected const int MaxDelay = -6;

        private long n = 0;
        /// <summary>
        /// Get which sample the simulation is at.
        /// </summary>
        public long At { get { return n; } }
        /// <summary>
        /// Get the simulation time.
        /// </summary>
        public double Time { get { return At * TimeStep; } }

        /// <summary>
        /// Get the timestep for the simulation.
        /// </summary>
        public double TimeStep { get { return (double)(Solution.TimeStep * oversample); } }

        private ILog log = new NullLog();
        /// <summary>
        /// Log associated with this simulation.
        /// </summary>
        public ILog Log { get { return log; } set { log = value; } }

        private TransientSolution solution;
        /// <summary>
        /// Solution of the circuit we are simulating.
        /// </summary>
        public TransientSolution Solution
        {
            get { return solution; }
            set { solution = value; InvalidateProcess(); }
        }

        private int oversample = 8;
        /// <summary>
        /// Oversampling factor for this simulation.
        /// </summary>
        public int Oversample { get { return oversample; } set { oversample = value; InvalidateProcess(); } }

        private int iterations = 8;
        /// <summary>
        /// Maximum number of iterations allowed for the simulation to converge.
        /// </summary>
        public int Iterations { get { return iterations; } set { iterations = value; InvalidateProcess(); } }

        /// <summary>
        /// The sampling rate of this simulation, the sampling rate of the transient solution divided by the oversampling factor.
        /// </summary>
        public Expression SampleRate { get { return 1 / (Solution.TimeStep * oversample); } }

        private Expression[] input = new Expression[] { };
        /// <summary>
        /// Expressions representing input samples.
        /// </summary>
        public IEnumerable<Expression> Input { get { return input; } set { input = value.ToArray(); InvalidateProcess(); } }

        private Expression[] output = new Expression[] { };
        /// <summary>
        /// Expressions for output samples.
        /// </summary>
        public IEnumerable<Expression> Output { get { return output; } set { output = value.ToArray(); InvalidateProcess(); } }

        // Stores any global state in the simulation (previous state values, mostly).
        private Dictionary<Expression, GlobalExpr<double>> globals = new Dictionary<Expression, GlobalExpr<double>>();
        // Add a new global and set it to 0 if it didn't already exist.
        private void AddGlobal(Expression Name)
        {
            if (!globals.ContainsKey(Name))
                globals.Add(Name, new GlobalExpr<double>(0.0));
        }

        /// <summary>
        /// Create a simulation using the given solution and the specified inputs/outputs.
        /// </summary>
        /// <param name="Solution">Transient solution to run.</param>
        /// <param name="Input">Expressions in the solution to be defined by input samples.</param>
        /// <param name="Output">Expressions describing outputs to be saved from the simulation.</param>
        public Simulation(TransientSolution Solution)
        {
            solution = Solution;

            // If any system depends on the previous value of an unknown, we need a global variable for it.
            for (int n = -1; n >= MaxDelay; n--)
            {
                Arrow t_tn = Arrow.New(t, t + n * Solution.TimeStep);
                IEnumerable<Expression> unknowns_tn = Solution.Solutions.SelectMany(i => i.Unknowns).Select(i => i.Evaluate(t_tn));
                if (!Solution.Solutions.Any(i => i.DependsOn(unknowns_tn)))
                    break;

                foreach (Expression i in Solution.Solutions.SelectMany(i => i.Unknowns))
                    AddGlobal(i.Evaluate(t_tn));
            }

            // Also need globals for any Newton's method unknowns.
            Arrow t_t1 = Arrow.New(t, t - Solution.TimeStep);
            foreach (Expression i in Solution.Solutions.OfType<NewtonIteration>().SelectMany(i => i.Unknowns))
                AddGlobal(i.Evaluate(t_t1));

            // Set the global values to the initial conditions of the solution.
            foreach (KeyValuePair<Expression, GlobalExpr<double>> i in globals)
            {
                // Dumb hack to get f[t - x] -> f[0] for any x.
                Expression i_t0 = i.Key.Evaluate(t, Real.Infinity).Substitute(Real.Infinity, 0);
                Expression init = i_t0.Evaluate(Solution.InitialConditions);
                i.Value.Value = init is Constant ? (double)init : 0.0;
            }

            InvalidateProcess();
        }

        /// <summary>
        /// Process some samples with this simulation. The Input and Output buffers must match the enumerations provided
        /// at initialization.
        /// </summary>
        /// <param name="N">Number of samples to process.</param>
        /// <param name="Input">Buffers that describe the input samples.</param>
        /// <param name="Output">Buffers to receive output samples.</param>
        public void Run(int N, IEnumerable<double[]> Input, IEnumerable<double[]> Output)
        {
            if (_process == null)
                _process = DefineProcess();

            try
            {
                try
                {
                    _process(N, n*TimeStep, Input.AsArray(), Output.AsArray());
                    n += N;
                }
                catch (TargetInvocationException Ex)
                {
                    throw Ex.InnerException;
                }
            }
            catch (SimulationDiverged Ex)
            {
                throw new SimulationDiverged("Simulation diverged near t = " + Quantity.ToString(Time, Units.s) + " + " + Ex.At, n + Ex.At);
            }
        }
        public void Run(int N, IEnumerable<double[]> Output) { Run(N, new double[][] { }, Output); }
        public void Run(double[] Input, IEnumerable<double[]> Output) { Run(Input.Length, new[] { Input }, Output); }
        public void Run(double[] Input, double[] Output) { Run(Input.Length, new[] { Input }, new[] { Output }); }

        private Action<int, double, double[][], double[][]> _process;
        // Force rebuilding of the process function.
        private void InvalidateProcess()
        {
            _process = null;
        }

        // The resulting lambda processes N samples, using buffers provided for Input and Output:
        //  void Process(int N, double t0, double T, double[] Input0 ..., double[] Output0 ...)
        //  { ... }
        private Action<int, double, double[][], double[][]> DefineProcess()
        {
            // Map expressions to identifiers in the syntax tree.
            var inputs = new List<KeyValuePair<Expression, LinqExpr>>();
            var outputs = new List<KeyValuePair<Expression, LinqExpr>>();

            // Lambda code generator.
            CodeGen code = new CodeGen();

            // Create parameters for the basic simulation info (N, t, Iterations).
            ParamExpr SampleCount = code.Decl<int>(Scope.Parameter, "SampleCount");
            ParamExpr t = code.Decl(Scope.Parameter, Simulation.t);
            var ins = code.Decl<double[][]>(Scope.Parameter, "ins");
            var outs = code.Decl<double[][]>(Scope.Parameter, "outs");

            // Create buffer parameters for each input...
            for (int i = 0; i < input.Length; i++)
            {
                inputs.Add(new KeyValuePair<Expression, LinqExpr>(input[i], LinqExpr.ArrayAccess(ins, LinqExpr.Constant(i))));
            }

            // ... and output.
            for (int i = 0; i < output.Length; i++)
            {
                outputs.Add(new KeyValuePair<Expression, LinqExpr>(output[i], LinqExpr.ArrayAccess(outs, LinqExpr.Constant(i))));
            }

            Arrow t_t1 = Arrow.New(Simulation.t, Simulation.t - Solution.TimeStep);

            // Create globals to store previous values of inputs.
            foreach (Expression i in Input.Distinct())
                AddGlobal(i.Evaluate(t_t1));

            // Define lambda body.

            // int Zero = 0
            LinqExpr Zero = LinqExpr.Constant(0);

            // double h = T / Oversample
            LinqExpr h = LinqExpr.Constant(TimeStep / (double)Oversample);

            // double invOversample = 1 / Oversample
            LinqExpr invOversample = LinqExpr.Constant(1.0 / (double)Oversample);

            // Load the globals to local variables and add them to the map.
            foreach (KeyValuePair<Expression, GlobalExpr<double>> i in globals)
                code.DeclInit(i.Key, i.Value);

            foreach (KeyValuePair<Expression, LinqExpr> i in inputs)
                code.DeclInit(i.Key, code[i.Key.Evaluate(t_t1)]);

            // Create arrays for linear systems.
            int M = Solution.Solutions.OfType<NewtonIteration>().Max(i => i.Equations.Count(), 0);
            int N = Solution.Solutions.OfType<NewtonIteration>().Max(i => i.UnknownDeltas.Count(), 0) + 1;
            Log.WriteLine(MessageType.Verbose, Vector.IsHardwareAccelerated ? "Vector hardware acceleration enabled" : "No vector hardware acceleration");

            LinqExpr JxF = code.DeclInit<double[][]>("JxF", LinqExpr.NewArrayBounds(typeof(double[]), LinqExpr.Constant(M)));
            for (int j = 0; j < M; ++j)
                code.Add(LinqExpr.Assign(LinqExpr.ArrayAccess(JxF, LinqExpr.Constant(j)), LinqExpr.NewArrayBounds(typeof(double), Vector.IsHardwareAccelerated ? LinqExpr.Constant(N + Vector<double>.Count - 1) : LinqExpr.Constant(N))));

            // for (int n = 0; n < SampleCount; ++n)
            ParamExpr n = code.Decl<int>("n");
            code.For(
                () => code.Add(LinqExpr.Assign(n, Zero)),
                LinqExpr.LessThan(n, SampleCount),
                () => code.Add(LinqExpr.PreIncrementAssign(n)),
                () =>
                {
                    // Prepare input samples for oversampling interpolation.
                    Dictionary<Expression, LinqExpr> dVi = new Dictionary<Expression, LinqExpr>();
                    foreach (Expression i in Input.Distinct())
                    {
                        LinqExpr Va = code[i];
                        // Sum all inputs with this key.
                        IEnumerable<LinqExpr> Vbs = inputs.Where(j => j.Key.Equals(i)).Select(j => j.Value);
                        LinqExpr Vb = LinqExpr.ArrayAccess(Vbs.First(), n);
                        foreach (LinqExpr j in Vbs.Skip(1))
                            Vb = LinqExpr.Add(Vb, LinqExpr.ArrayAccess(j, n));

                        // dVi = (Vb - Va) / Oversample
                        code.Add(LinqExpr.Assign(
                            Decl<double>(code, dVi, i, "d" + i.ToString().Replace("[t]", "")),
                            LinqExpr.Multiply(LinqExpr.Subtract(Vb, Va), invOversample)));
                    }

                    // Prepare output sample accumulators for low pass filtering.
                    Dictionary<Expression, LinqExpr> Vo = new Dictionary<Expression, LinqExpr>();
                    foreach (Expression i in Output.Distinct())
                        code.Add(LinqExpr.Assign(
                            Decl<double>(code, Vo, i, i.ToString().Replace("[t]", "")),
                            LinqExpr.Constant(0.0)));

                    // int ov = Oversample;
                    // do { -- ov; } while(ov > 0)
                    ParamExpr ov = code.Decl<int>("ov");
                    code.Add(LinqExpr.Assign(ov, LinqExpr.Constant(Oversample)));
                    code.DoWhile(() =>
                    {
                        // t += h
                        code.Add(LinqExpr.AddAssign(t, h));

                        // Interpolate the input samples.
                        foreach (Expression i in Input.Distinct())
                            code.Add(LinqExpr.AddAssign(code[i], dVi[i]));

                        // Compile all of the SolutionSets in the solution.
                        foreach (SolutionSet ss in Solution.Solutions)
                        {
                            if (ss is LinearSolutions)
                            {
                                // Linear solutions are easy.
                                LinearSolutions S = (LinearSolutions)ss;
                                foreach (Arrow i in S.Solutions)
                                    code.DeclInit(i.Left, i.Right);
                            }
                            else if (ss is NewtonIteration)
                            {
                                NewtonIteration S = (NewtonIteration)ss;

                                // Start with the initial guesses from the solution.
                                foreach (Arrow i in S.Guesses)
                                    code.DeclInit(i.Left, i.Right);

                                // int it = iterations
                                LinqExpr it = code.ReDeclInit<int>("it", Iterations);
                                // do { ... --it } while(it > 0)
                                code.DoWhile((Break) =>
                                {
                                    // Solve the un-solved system.
                                    Solve(code, JxF, S.Equations, S.UnknownDeltas);

                                    // Compile the pre-solved solutions.
                                    if (S.KnownDeltas != null)
                                        foreach (Arrow i in S.KnownDeltas)
                                            code.DeclInit(i.Left, i.Right);

                                    // bool done = true
                                    LinqExpr done = code.ReDeclInit("done", true);
                                    foreach (Expression i in S.Unknowns)
                                    {
                                        LinqExpr v = code[i];
                                        LinqExpr dv = code[NewtonIteration.Delta(i)];

                                        // done &= (|dv| < |v|*epsilon)
                                        code.Add(LinqExpr.AndAssign(done, LinqExpr.LessThan(Abs(dv), MultiplyAdd(Abs(v), LinqExpr.Constant(1e-4), LinqExpr.Constant(1e-6)))));
                                        // v += dv
                                        code.Add(LinqExpr.AddAssign(v, dv));
                                    }
                                    // if (done) break
                                    code.Add(LinqExpr.IfThen(done, Break));

                                    // --it;
                                    code.Add(LinqExpr.PreDecrementAssign(it));
                                }, LinqExpr.GreaterThan(it, Zero));

                                //// bool failed = false
                                //LinqExpr failed = Decl(code, code, "failed", LinqExpr.Constant(false));
                                //for (int i = 0; i < eqs.Length; ++i)
                                //    // failed |= |JxFi| > epsilon
                                //    code.Add(LinqExpr.OrAssign(failed, LinqExpr.GreaterThan(Abs(eqs[i].ToExpression().Compile(map)), LinqExpr.Constant(1e-3))));

                                //code.Add(LinqExpr.IfThen(failed, ThrowSimulationDiverged(n)));
                            }
                        }

                        // Update the previous timestep variables.
                        foreach (SolutionSet S in Solution.Solutions)
                        {
                            for (int m = MaxDelay; m < 0; m++)
                            {
                                Arrow t_tm = Arrow.New(Simulation.t, Simulation.t + m * Solution.TimeStep);
                                Arrow t_tm1 = Arrow.New(Simulation.t, Simulation.t + (m + 1) * Solution.TimeStep);
                                foreach (Expression i in S.Unknowns.Where(i => globals.Keys.Contains(i.Evaluate(t_tm))))
                                    code.Add(LinqExpr.Assign(code[i.Evaluate(t_tm)], code[i.Evaluate(t_tm1)]));
                            }
                        }

                        // Vo += i
                        foreach (Expression i in Output.Distinct())
                        {
                            LinqExpr Voi = LinqExpr.Constant(0.0);
                            try
                            {
                                Voi = code.Compile(i);
                            }
                            catch (Exception Ex)
                            {
                                Log.WriteLine(MessageType.Warning, Ex.Message);
                            }
                            code.Add(LinqExpr.AddAssign(Vo[i], Voi));
                        }

                        // Vi_t0 = Vi
                        foreach (Expression i in Input.Distinct())
                            code.Add(LinqExpr.Assign(code[i.Evaluate(t_t1)], code[i]));

                        // --ov;
                        code.Add(LinqExpr.PreDecrementAssign(ov));
                    }, LinqExpr.GreaterThan(ov, Zero));

                    // Output[i][n] = Vo / Oversample
                    foreach (KeyValuePair<Expression, LinqExpr> i in outputs)
                        code.Add(LinqExpr.Assign(LinqExpr.ArrayAccess(i.Value, n), LinqExpr.Multiply(Vo[i.Key], invOversample)));

                    // Every 256 samples, check for divergence.
                    if (Vo.Any())
                        code.Add(LinqExpr.IfThen(LinqExpr.Equal(LinqExpr.And(n, LinqExpr.Constant(0xFF)), Zero),
                            LinqExpr.Block(Vo.Select(i => LinqExpr.IfThenElse(IsNotReal(i.Value),
                                ThrowSimulationDiverged(n),
                                LinqExpr.Assign(i.Value, RoundDenormToZero(i.Value)))))));
                });

            // Copy the global state variables back to the globals.
            foreach (KeyValuePair<Expression, GlobalExpr<double>> i in globals)
                code.Add(LinqExpr.Assign(i.Value, code[i.Key]));

            var lambda = code.Build<Action<int, double, double[][], double[][]>>();
            return lambda.Compile();
        }

        // Solve a system of linear equations
        private static void Solve(CodeGen code, LinqExpr Ab, IEnumerable<LinearCombination> Equations, IEnumerable<Expression> Unknowns)
        {
            LinearCombination[] eqs = Equations.ToArray();
            Expression[] deltas = Unknowns.ToArray();

            int M = eqs.Length;
            int N = deltas.Length;

            // Initialize the matrix.
            for (int i = 0; i < M; ++i)
            {
                LinqExpr Abi = code.ReDeclInit<double[]>("Abi", LinqExpr.ArrayAccess(Ab, LinqExpr.Constant(i)));
                for (int x = 0; x < N; ++x)
                    code.Add(LinqExpr.Assign(
                        LinqExpr.ArrayAccess(Abi, LinqExpr.Constant(x)),
                        code.Compile(eqs[i][deltas[x]])));
                code.Add(LinqExpr.Assign(
                    LinqExpr.ArrayAccess(Abi, LinqExpr.Constant(N)),
                    code.Compile(eqs[i][1])));
            }

            // Gaussian elimination on this turd.
            code.Add(LinqExpr.Call(
                GetMethod<Simulation>(Vector.IsHardwareAccelerated ? nameof(RowReduceVector) : nameof(RowReduce), Ab.Type, typeof(int), typeof(int)),
                Ab,
                LinqExpr.Constant(M),
                LinqExpr.Constant(N)));

            // Ab is now upper triangular, solve it.
            for (int j = N - 1; j >= 0; --j)
            {
                LinqExpr _j = LinqExpr.Constant(j);
                LinqExpr Abj = code.ReDeclInit<double[]>("Abj", LinqExpr.ArrayAccess(Ab, _j));

                LinqExpr r = LinqExpr.ArrayAccess(Abj, LinqExpr.Constant(N));
                for (int ji = j + 1; ji < N; ++ji)
                    r = LinqExpr.Add(r, LinqExpr.Multiply(LinqExpr.ArrayAccess(Abj, LinqExpr.Constant(ji)), code[deltas[ji]]));
                code.DeclInit(deltas[j], LinqExpr.Divide(LinqExpr.Negate(r), LinqExpr.ArrayAccess(Abj, _j)));
            }
        }

        // A human readable implementation of RowReduce.
        private static void RowReduce(double[][] Ab, int M, int N)
        {
            // Solve for dx.
            // For each variable in the system...
            for (int j = 0; j + 1 < N; ++j)
            {
                int pi = j;
                double max = Math.Abs(Ab[j][j]);

                // Find a pivot row for this variable.
                for (int i = j + 1; i < M; ++i)
                {
                    double[] Abi = Ab[i];
                    // if(|JxF[i][j]| > max) { pi = i, max = |JxF[i][j]| }
                    double maxj = Math.Abs(Abi[j]);
                    if (maxj > max)
                    {
                        pi = i;
                        max = maxj;
                    }
                }

                // Swap pivot row with the current row.
                if (pi != j)
                {
                    var Abpi = Ab[pi];
                    Ab[pi] = Ab[j];
                    Ab[j] = Abpi;
                }

                double[] Abj = Ab[j];

                // Eliminate the rows after the pivot.
                double p = Abj[j];
                for (int i = j + 1; i < M; ++i)
                {
                    double[] Abi = Ab[i];
                    double s = Abi[j] / p;
                    if (s != 0.0)
                        for (int ij = j + 1; ij <= N; ++ij)
                            Abi[ij] -= Abj[ij] * s;
                }
            }
        }

        //This algorith has no tail-loop - it requires arrays to be padded to N + Vector.Count - 1
        private static void RowReduceVector(double[][] Ab, int M, int N)
        {
            // Solve for dx.
            // For each variable in the system...
            for (int j = 0; j + 1 < N; ++j)
            {
                int pi = j;
                double max = Math.Abs(Ab[j][j]);

                // Find a pivot row for this variable.
                for (int i = j + 1; i < M; ++i)
                {
                    // if(|JxF[i][j]| > max) { pi = i, max = |JxF[i][j]| }
                    double maxj = Math.Abs(Ab[i][j]);
                    if (maxj > max)
                    {
                        pi = i;
                        max = maxj;
                    }
                }

                // Swap pivot row with the current row.
                if (pi != j)
                {
                    var tmp = Ab[pi];
                    Ab[pi] = Ab[j];
                    Ab[j] = tmp;
                }

                var vectorLength = Vector<double>.Count;
                // Eliminate the rows after the pivot.
                double p = Ab[j][j];
                for (int i = j + 1; i < M; ++i)
                {
                    double s = Ab[i][j] / p;
                    if (s != 0.0)
                    {
                        int jj;
                        for (jj = j + 1; jj <= N; jj += vectorLength)
                        {
                            var source = new Vector<double>(Ab[j], jj);
                            var target = new Vector<double>(Ab[i], jj);
                            var res = target - (source * s);
                            res.CopyTo(Ab[i], jj);
                        }
                    }
                }
            }
        }

        // Returns a throw SimulationDiverged expression at At.
        private LinqExpr ThrowSimulationDiverged(LinqExpr At)
        {
            return LinqExpr.Throw(LinqExpr.New(typeof(SimulationDiverged).GetConstructor(new Type[] { At.Type }), At));
        }

        private static ParamExpr Decl<T>(CodeGen Target, ICollection<KeyValuePair<Expression, LinqExpr>> Map, Expression Expr, string Name)
        {
            ParamExpr p = Target.Decl<T>(Name);
            Map.Add(new KeyValuePair<Expression, LinqExpr>(Expr, p));
            return p;
        }

        private static ParamExpr Decl<T>(CodeGen Target, ICollection<KeyValuePair<Expression, LinqExpr>> Map, Expression Expr)
        {
            return Decl<T>(Target, Map, Expr, Expr.ToString());
        }

        private static LinqExpr ConstantExpr(double x, Type T)
        {
            if (T == typeof(double))
                return LinqExpr.Constant(x);
            else if (T == typeof(float))
                return LinqExpr.Constant((float)x);
            else
                throw new NotImplementedException("Constant");
        }

        // Get a method of T with the given name/param types.
        private static MethodInfo GetMethod(Type T, string Name, params Type[] ParamTypes) { return T.GetMethod(Name, BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic, null, ParamTypes, null); }
        private static MethodInfo GetMethod<T>(string Name, params Type[] ParamTypes) { return GetMethod(typeof(T), Name, ParamTypes); }

        // Returns a * b + c.
        private static LinqExpr MultiplyAdd(LinqExpr a, LinqExpr b, LinqExpr c) { return LinqExpr.Add(LinqExpr.Multiply(a, b), c); }
        // Returns 1 / x.
        private static LinqExpr Reciprocal(LinqExpr x) { return LinqExpr.Divide(ConstantExpr(1.0, x.Type), x); }
        // Returns abs(x).
        private static LinqExpr Abs(LinqExpr x) { return LinqExpr.Call(GetMethod(typeof(Math), "Abs", x.Type), x); }
        // Returns x*x.
        private static LinqExpr Square(LinqExpr x) { return LinqExpr.Multiply(x, x); }

        // Returns true if x is not NaN or Inf
        private static LinqExpr IsNotReal(LinqExpr x)
        {
            return LinqExpr.Or(
                LinqExpr.Call(GetMethod(x.Type, "IsNaN", x.Type), x),
                LinqExpr.Call(GetMethod(x.Type, "IsInfinity", x.Type), x));
        }
        // Round x to zero if it is sub-normal.
        private static LinqExpr RoundDenormToZero(LinqExpr x) { return x; }
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    tools:context=".ui.DetailActivity">

</menu>


text:
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
//
// This file is part of BasicLTI4Moodle
//
// BasicLTI4Moodle is an IMS BasicLTI (Basic Learning Tools for Interoperability)
// consumer for Moodle 1.9 and Moodle 2.0. BasicLTI is a IMS Standard that allows web
// based learning tools to be easily integrated in LMS as native ones. The IMS BasicLTI
// specification is part of the IMS standard Common Cartridge 1.1 Sakai and other main LMS
// are already supporting or going to support BasicLTI. This project Implements the consumer
// for Moodle. Moodle is a Free Open source Learning Management System by Martin Dougiamas.
// BasicLTI4Moodle is a project iniciated and leaded by Ludo(Marc Alier) and Jordi Piguillem
// at the GESSI research group at UPC.
// SimpleLTI consumer for Moodle is an implementation of the early specification of LTI
// by Charles Severance (Dr Chuck) htp://dr-chuck.com , developed by Jordi Piguillem in a
// Google Summer of Code 2008 project co-mentored by Charles Severance and Marc Alier.
//
// BasicLTI4Moodle is copyright 2009 by Marc Alier Forment, Jordi Piguillem and Nikolas Galanis
// of the Universitat Politecnica de Catalunya http://www.upc.edu
// Contact info: Marc Alier Forment granludo @ gmail.com or marc.alier @ upc.edu.

 defined('MOODLE_INTERNAL') || die;

/**
 * xmldb_lti_upgrade is the function that upgrades
 * the lti module database when is needed
 *
 * This function is automaticly called when version number in
 * version.php changes.
 *
 * @param int $oldversion New old version number.
 *
 * @return boolean
 */
function xmldb_lti_upgrade($oldversion) {
    global $CFG, $DB;

    require_once(__DIR__ . '/upgradelib.php');

    $dbman = $DB->get_manager();

    if ($oldversion < 2014060201) {

        // Changing type of field grade on table lti to int.
        $table = new xmldb_table('lti');
        $field = new xmldb_field('grade', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '100',
                'instructorchoiceacceptgrades');

        // Launch change of type for field grade.
        $dbman->change_field_type($table, $field);

        // Lti savepoint reached.
        upgrade_mod_savepoint(true, 2014060201, 'lti');
    }

    if ($oldversion < 2014061200) {

        // Define table lti_tool_proxies to be created.
        $table = new xmldb_table('lti_tool_proxies');

        // Adding fields to table lti_tool_proxies.
        $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
        $table->add_field('name', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, 'Tool Provider');
        $table->add_field('regurl', XMLDB_TYPE_TEXT, null, null, null, null, null);
        $table->add_field('state', XMLDB_TYPE_INTEGER, '2', null, XMLDB_NOTNULL, null, '1');
        $table->add_field('guid', XMLDB_TYPE_CHAR, '255', null, null, null, null);
        $table->add_field('secret', XMLDB_TYPE_CHAR, '255', null, null, null, null);
        $table->add_field('vendorcode', XMLDB_TYPE_CHAR, '255', null, null, null, null);
        $table->add_field('capabilityoffered', XMLDB_TYPE_TEXT, null, null, XMLDB_NOTNULL, null, null);
        $table->add_field('serviceoffered', XMLDB_TYPE_TEXT, null, null, XMLDB_NOTNULL, null, null);
        $table->add_field('toolproxy', XMLDB_TYPE_TEXT, null, null, null, null, null);
        $table->add_field('createdby', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
        $table->add_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
        $table->add_field('timemodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);

        // Adding keys to table lti_tool_proxies.
        $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));

        // Adding indexes to table lti_tool_proxies.
        $table->add_index('guid', XMLDB_INDEX_UNIQUE, array('guid'));

        // Conditionally launch create table for lti_tool_proxies.
        if (!$dbman->table_exists($table)) {
            $dbman->create_table($table);
        }

        // Define table lti_tool_settings to be created.
        $table = new xmldb_table('lti_tool_settings');

        // Adding fields to table lti_tool_settings.
        $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
        $table->add_field('toolproxyid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
        $table->add_field('course', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
        $table->add_field('coursemoduleid', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
        $table->add_field('settings', XMLDB_TYPE_TEXT, null, null, XMLDB_NOTNULL, null, null);
        $table->add_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
        $table->add_field('timemodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);

        // Adding keys to table lti_tool_settings.
        $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
        $table->add_key('toolproxy', XMLDB_KEY_FOREIGN, array('toolproxyid'), 'lti_tool_proxies', array('id'));
        $table->add_key('course', XMLDB_KEY_FOREIGN, array('course'), 'course', array('id'));
        $table->add_key('coursemodule', XMLDB_KEY_FOREIGN, array('coursemoduleid'), 'lti', array('id'));

        // Conditionally launch create table for lti_tool_settings.
        if (!$dbman->table_exists($table)) {
            $dbman->create_table($table);
        }

        // Define table lti_types to be updated.
        $table = new xmldb_table('lti_types');

        // Adding fields to table lti_types.
        $field = new xmldb_field('toolproxyid', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
        if (!$dbman->field_exists($table, $field)) {
            $dbman->add_field($table, $field);
        }
        $field = new xmldb_field('enabledcapability', XMLDB_TYPE_TEXT, null, null, null, null, null);
        if (!$dbman->field_exists($table, $field)) {
            $dbman->add_field($table, $field);
        }
        $field = new xmldb_field('parameter', XMLDB_TYPE_TEXT, null, null, null, null, null);
        if (!$dbman->field_exists($table, $field)) {
            $dbman->add_field($table, $field);
        }
        $field = new xmldb_field('icon', XMLDB_TYPE_TEXT, null, null, null, null, null);
        if (!$dbman->field_exists($table, $field)) {
            $dbman->add_field($table, $field);
        }
        $field = new xmldb_field('secureicon', XMLDB_TYPE_TEXT, null, null, null, null, null);
        if (!$dbman->field_exists($table, $field)) {
            $dbman->add_field($table, $field);
        }

        // Lti savepoint reached.
        upgrade_mod_savepoint(true, 2014061200, 'lti');
    }

    if ($oldversion < 2014100300) {

        mod_lti_upgrade_custom_separator();

        // Lti savepoint reached.
        upgrade_mod_savepoint(true, 2014100300, 'lti');
    }

    // Moodle v2.8.0 release upgrade line.
    // Put any upgrade step following this.

    // Moodle v2.9.0 release upgrade line.
    // Put any upgrade step following this.

    // Moodle v3.0.0 release upgrade line.
    // Put any upgrade step following this.

    if ($oldversion < 2016041800) {

        // Define field description to be added to lti_types.
        $table = new xmldb_table('lti_types');
        $field = new xmldb_field('description', XMLDB_TYPE_TEXT, null, null, null, null, null, 'timemodified');

        // Conditionally launch add field description.
        if (!$dbman->field_exists($table, $field)) {
            $dbman->add_field($table, $field);
        }

        // Lti savepoint reached.
        upgrade_mod_savepoint(true, 2016041800, 'lti');
    }

    // Moodle v3.1.0 release upgrade line.
    // Put any upgrade step following this.

    if ($oldversion < 2016052301) {

        // Changing type of field value on table lti_types_config to text.
        $table = new xmldb_table('lti_types_config');
        $field = new xmldb_field('value', XMLDB_TYPE_TEXT, null, null, XMLDB_NOTNULL, null, null, 'name');

        // Launch change of type for field value.
        $dbman->change_field_type($table, $field);

        // Lti savepoint reached.
        upgrade_mod_savepoint(true, 2016052301, 'lti');
    }

    // Automatically generated Moodle v3.2.0 release upgrade line.
    // Put any upgrade step following this.

    return true;
}


text:
// Copyright (c) 2006, 2007 Julio M. Merino Vidal
// Copyright (c) 2008 Ilya Sokolov, Boris Schaeling
// Copyright (c) 2009 Boris Schaeling
// Copyright (c) 2010 Felipe Tanus, Boris Schaeling
// Copyright (c) 2011, 2012 Jeff Flinn, Boris Schaeling
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

/**
 * \file boost/process/wait_for_exit.hpp
 *
 * Defines a function to wait for a process to exit.
 */

#ifndef BOOST_PROCESS_WAIT_FOR_EXIT_HPP
#define BOOST_PROCESS_WAIT_FOR_EXIT_HPP

#include <boost/process/config.hpp>

#include BOOST_PROCESS_PLATFORM_PROMOTE_PATH(wait_for_exit)
BOOST_PROCESS_PLATFORM_PROMOTE_NAMESPACE(wait_for_exit)

#if defined(BOOST_PROCESS_DOXYGEN)
namespace boost { namespace process {

/**
 * Waits for a process to exit.
 *
 * On Window boost::process::wait_for_exit returns the exit code
 * of the process. On POSIX the exit status is returned. You must
 * use the macro \c WEXITSTATUS (defined in sys/wait.h) to fetch
 * the exit code from the exit status.
 *
 * \note This is a blocking function.
 *
 * \throws boost::system::system_error in case of an error
 */
template <class Process>
int_type wait_for_exit(const Process &p);

/**
 * Waits for a process to exit.
 *
 * On Window boost::process::wait_for_exit returns the exit code
 * of the process. On POSIX the exit status is returned. You must
 * use the macro \c WEXITSTATUS (defined in sys/wait.h) to fetch
 * the exit code from the exit status.
 *
 * \note This is a blocking function.
 */
template <class Process>
int_type wait_for_exit(const Process &p, boost::system::error_code &ec);

}}
#endif

#endif


text:
import { ArrayBufferBuilder } from "../../../../utils/ArrayBufferBuilder";
import { PokerCommandHeaderSerializer } from "../../core/serializers/PokerCommandHeaderSerializer";
import { PokerCommandHeader } from "../../core/data/PokerCommandHeader";
import { ClVoteForRematchCommand } from "../commands/ClVoteForRematchCommand";
import { ClVoteForRematchData } from "../data/ClVoteForRematchData";
import { ClVoteForRematchDataSerializer } from "./ClVoteForRematchDataSerializer";

export class ClVoteForRematchCommandSerializer {
	public static serialize(buffer: ArrayBufferBuilder, command: ClVoteForRematchCommand ): void {
		buffer.pointer += PokerCommandHeader.HEADER_SIZE_BYTES;
		ClVoteForRematchDataSerializer.serialize(buffer, command.data);

		PokerCommandHeaderSerializer.serialize(buffer, command.header);
	}

	public static deserialize(buffer: ArrayBufferBuilder, command: ClVoteForRematchCommand ): void {
		PokerCommandHeaderSerializer.deserialize(buffer, command.header);

			command.data = new ClVoteForRematchData();
            ClVoteForRematchDataSerializer.deserialize(buffer, command.data);
	}
}


text:
from __future__ import absolute_import
from __future__ import print_function

import os

import numpy
import matplotlib.pyplot as plt
import datetime

import clawpack.visclaw.colormaps as colormap
import clawpack.visclaw.gaugetools as gaugetools
import clawpack.clawutil.data as clawutil
import clawpack.amrclaw.data as amrclaw
import clawpack.geoclaw.data as geodata
from clawpack.geoclaw.util import fetch_noaa_tide_data

import clawpack.geoclaw.surge.plot as surgeplot

try:
    from setplotfg import setplotfg
except:
    setplotfg = None

def setplot(plotdata=None):
    """"""

    if plotdata is None:
        from clawpack.visclaw.data import ClawPlotData
        plotdata = ClawPlotData()

    # clear any old figures,axes,items data
    plotdata.clearfigures()
    plotdata.format = 'ascii'

    # Load data from output
    clawdata = clawutil.ClawInputData(2)
    clawdata.read(os.path.join(plotdata.outdir, 'claw.data'))
    physics = geodata.GeoClawData()
    physics.read(os.path.join(plotdata.outdir, 'geoclaw.data'))
    surge_data = geodata.SurgeData()
    surge_data.read(os.path.join(plotdata.outdir, 'surge.data'))
    friction_data = geodata.FrictionData()
    friction_data.read(os.path.join(plotdata.outdir, 'friction.data'))

    # Load storm track
    track = surgeplot.track_data(os.path.join(plotdata.outdir, 'fort.track'))

    # Set afteraxes function
    def surge_afteraxes(cd):
        surgeplot.surge_afteraxes(cd, track, plot_direction=False,
                                             kwargs={"markersize": 4})

#HAS EXCESS CODE HERE THAT IKE NOR OPHELIA HAVE.
    # Color limits
    surface_limits = [physics.sea_level - 5.0, physics.sea_level + 5.0]
    surface_ticks = [-5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5]
    surface_labels = [str(value) for value in surface_ticks]
    speed_limits = [0.0, 3.0]
    speed_ticks = [0, 1, 2, 3]
    speed_labels = [str(value) for value in speed_ticks]
    wind_limits = [0, 64]
    pressure_limits = [935, 1013]
    friction_bounds = [0.01, 0.04]

    def add_custom_colorbar_ticks_to_axes(axes, item_name, ticks,
                                          tick_labels=None):
        """Adjust colorbar ticks and labels"""
        axes.plotitem_dict[item_name].colorbar_ticks = ticks
        axes.plotitem_dict[item_name].colorbar_tick_labels = tick_labels

    def gulf_after_axes(cd):
        # plt.subplots_adjust(left=0.08, bottom=0.04, right=0.97, top=0.96)
        surge_afteraxes(cd)

    def latex_after_axes(cd):
        # plt.subplot_adjust()
        surge_afteraxes(cd)
#EXCESS CODE ENDS HERE, BACK TO ORIGINAL PROGRAMMING!
    def friction_after_axes(cd):
        # plt.subplots_adjust(left=0.08, bottom=0.04, right=0.97, top=0.96)
        plt.title(r"Manning's $n$ Coefficient")
        # surge_afteraxes(cd)

    # ==========================================================================
    #   Plot specifications
    # ==========================================================================
    regions = {"Atlantic": {"xlimits": (clawdata.lower[0], clawdata.upper[0]),
                        "ylimits": (clawdata.lower[1], clawdata.upper[1]),
                        "figsize": (6.4, 4.8)},
                "Savannah": {"xlimits": (-82, -76),
                               "ylimits": (29.5, 34.5),
                               "figsize": (8, 2.7)}}
    #changing this up! selected the DR, should select savannah prolly.
    for (name, region_dict) in regions.items():

        # Surface Figure
        plotfigure = plotdata.new_plotfigure(name="Surface - %s" % name)
        plotfigure.kwargs = {"figsize": region_dict['figsize']}
        plotaxes = plotfigure.new_plotaxes()
        plotaxes.title = "Surface"
        plotaxes.xlimits = region_dict["xlimits"]
        plotaxes.ylimits = region_dict["ylimits"]
        plotaxes.afteraxes = surge_afteraxes
        plotaxes.scaled = True #OPTIONAL - CAN KEEP AS A SQUARE.

        surgeplot.add_surface_elevation(plotaxes, bounds=surface_limits)
        surgeplot.add_land(plotaxes, bounds=[0.0, 20.0])
        plotaxes.plotitem_dict['surface'].amr_patchedges_show = [0] * 10
        plotaxes.plotitem_dict['land'].amr_patchedges_show = [0] * 10
        add_custom_colorbar_ticks_to_axes(plotaxes, 'surface', surface_ticks,
                                          surface_labels)

        # Speed Figure
        plotfigure = plotdata.new_plotfigure(name="Currents - %s" % name)
        plotfigure.kwargs = {"figsize": region_dict['figsize']}
        plotaxes = plotfigure.new_plotaxes()
        plotaxes.title = "Currents"
        plotaxes.xlimits = region_dict["xlimits"]
        plotaxes.ylimits = region_dict["ylimits"]
        plotaxes.afteraxes = surge_afteraxes
        plotaxes.scaled = True #OPTIONAL - CAN KEEP AS A SQUARE.

        surgeplot.add_speed(plotaxes, bounds=speed_limits)
        surgeplot.add_land(plotaxes, bounds=[0.0, 20.0])
        plotaxes.plotitem_dict['speed'].amr_patchedges_show = [0] * 10
        plotaxes.plotitem_dict['land'].amr_patchedges_show = [0] * 10
        add_custom_colorbar_ticks_to_axes(plotaxes, 'speed', speed_ticks,
                                          speed_labels)

    #
    # Friction field
    #
    plotfigure = plotdata.new_plotfigure(name='Friction')
    plotfigure.show = friction_data.variable_friction and True

    plotaxes = plotfigure.new_plotaxes()
    plotaxes.xlimits = regions['Atlantic']['xlimits']
    plotaxes.ylimits = regions['Atlantic']['ylimits']
    # plotaxes.title = "Manning's N Coefficient"
    plotaxes.afteraxes = friction_after_axes
    plotaxes.scaled = True

    surgeplot.add_friction(plotaxes, bounds=friction_bounds, shrink=0.9)
    plotaxes.plotitem_dict['friction'].amr_patchedges_show = [0] * 10
    plotaxes.plotitem_dict['friction'].colorbar_label = "$n$"

    #
    #  Hurricane Forcing fields
    #
    # Pressure field
    plotfigure = plotdata.new_plotfigure(name='Pressure')
    plotfigure.show = surge_data.pressure_forcing and True

    plotaxes = plotfigure.new_plotaxes()
    plotaxes.xlimits = regions['Atlantic']['xlimits']
    plotaxes.ylimits = regions['Atlantic']['ylimits']
    plotaxes.title = "Pressure Field"
    plotaxes.afteraxes = surge_afteraxes
    plotaxes.scaled = True
    surgeplot.add_pressure(plotaxes, bounds=pressure_limits)
    surgeplot.add_land(plotaxes, bounds=[0.0, 20.0])

    # Wind field
    plotfigure = plotdata.new_plotfigure(name='Wind Speed')
    plotfigure.show = surge_data.wind_forcing and True

    plotaxes = plotfigure.new_plotaxes()
    plotaxes.xlimits = regions['Atlantic']['xlimits']
    plotaxes.ylimits = regions['Atlantic']['ylimits']
    plotaxes.title = "Wind Field"
    plotaxes.afteraxes = surge_afteraxes
    plotaxes.scaled = True
    surgeplot.add_wind(plotaxes, bounds=wind_limits)
    surgeplot.add_land(plotaxes, bounds=[0.0, 20.0])

    # ========================================================================
    #  Figures for gauges
    # ========================================================================
    plotfigure = plotdata.new_plotfigure(name='Gauge Surfaces', figno=300,
                                         type='each_gauge')
    plotfigure.show = True
    plotfigure.clf_each_gauge = True

    plotaxes = plotfigure.new_plotaxes()
    #Time Conversions
    def days2seconds(days):
      return days * 60.0**2 * 24.0

    #Getting the data for each gauge from NOAA's API
    stations = [('9759110', 'Magueyes Island, PR'),
                ('8722670', 'Lake Worth Pier, FL'),
                ('8670870', 'Fort Pulaski, GA'),
                ('8661070', 'Springmaid Pier, SC'),
                ('8658120', 'Wilmington, NC'),
                ('8540433', 'Marcus Hook, PA')]

    landfall_time = numpy.datetime64('2020-07-31T00:00')
    begin_date = datetime.datetime(2020, 7, 30)
    end_date = datetime.datetime(2020, 8, 5)

    def get_actual_water_levels(station_id):
        # Fetch water levels and tide predictions for given station
        date_time, water_level, tide = fetch_noaa_tide_data(station_id,
                begin_date, end_date)

        # Calculate times relative to landfall
        seconds_rel_landfall = (date_time - landfall_time) / numpy.timedelta64(1, 's')
        # Subtract tide predictions from measured water levels
        water_level -= tide

        return seconds_rel_landfall, water_level

    def gauge_afteraxes(cd):
        station_id, station_name = stations[cd.gaugeno-1]
        seconds_rel_landfall, actual_level = get_actual_water_levels(station_id)

        axes = plt.gca()
        surgeplot.plot_landfall_gauge(cd.gaugesoln, axes)
        axes.plot(seconds_rel_landfall, actual_level, 'g')

        # Fix up plot - in particular fix time labels
        axes.set_title(station_name)
        axes.set_xlabel('Days relative to landfall')
        axes.set_ylabel('Surface (m)')
        axes.set_xlim([days2seconds(-1), days2seconds(5)])
        #axes.set_xlim([-1, 5])
        axes.set_ylim([-1, 2])
        axes.set_xticks([days2seconds(-1), days2seconds(0), days2seconds(1),
                        days2seconds(2), days2seconds(3), days2seconds(4), days2seconds(5)])
        #axes.set_xticks([-1, 0, 1, 2, 3, 4, 5])
        axes.set_xticklabels([r"$-1$", r"$0$", r"$1$", r"$2$", r"$3$", r"$4$", r"$5$"])
        axes.grid(True)

    # Set up for axes in this figure:
    plotaxes = plotfigure.new_plotaxes()
    #plotaxes.xlimits = [-1, 5]
    # plotaxes.xlabel = "Days from landfall"
    # plotaxes.ylabel = "Surface (m)"
    #plotaxes.ylimits = [-1, 2]
    #plotaxes.title = 'Surface'
    plotaxes.afteraxes = gauge_afteraxes

    # Plot surface as blue curve:
    plotitem = plotaxes.new_plotitem(plot_type='1d_plot')
    plotitem.plot_var = 3
    plotitem.plotstyle = 'b-'

    #Gauge Locations
    def gauge_1_afteraxes(cd):
        plt.subplots_adjust(left=0.12, bottom=0.06, right=0.97, top=0.97)
        surge_afteraxes(cd)
        gaugetools.plot_gauge_locations(cd.plotdata, gaugenos=[1], format_string='ko', add_labels=True)

    def gauge_2_afteraxes(cd):
        plt.subplots_adjust(left=0.12, bottom=0.06, right=0.97, top=0.97)
        surge_afteraxes(cd)
        gaugetools.plot_gauge_locations(cd.plotdata, gaugenos=[2], format_string='ko', add_labels=True)

    def gauge_3_afteraxes(cd):
        plt.subplots_adjust(left=0.12, bottom=0.06, right=0.97, top=0.97)
        surge_afteraxes(cd)
        gaugetools.plot_gauge_locations(cd.plotdata, gaugenos=[3], format_string='ko', add_labels=True)

    def gauge_4_afteraxes(cd):
        plt.subplots_adjust(left=0.12, bottom=0.06, right=0.97, top=0.97)
        surge_afteraxes(cd)
        gaugetools.plot_gauge_locations(cd.plotdata, gaugenos=[4], format_string='ko', add_labels=True)

    def gauge_5_afteraxes(cd):
        plt.subplots_adjust(left=0.12, bottom=0.06, right=0.97, top=0.97)
        surge_afteraxes(cd)
        gaugetools.plot_gauge_locations(cd.plotdata, gaugenos=[5], format_string='ko', add_labels=True)

    def gauge_6_afteraxes(cd):
        plt.subplots_adjust(left=0.12, bottom=0.06, right=0.97, top=0.97)
        surge_afteraxes(cd)
        gaugetools.plot_gauge_locations(cd.plotdata, gaugenos=[6], format_string='ko', add_labels=True)

    plotfigure = plotdata.new_plotfigure(name="1. Magueyes Island, PR")
    plotfigure.show = True
    # Set up for axes in this figure:
    plotaxes = plotfigure.new_plotaxes()
    plotaxes.title = '1. Magueyes Island, PR'
    plotaxes.scaled = True
    #0.5x0.5
    plotaxes.xlimits = [-67.25, -66.75]
    plotaxes.ylimits = [17.75, 18.25]
    plotaxes.afteraxes = gauge_1_afteraxes
    surgeplot.add_surface_elevation(plotaxes, bounds=surface_limits)
    surgeplot.add_land(plotaxes)
    plotaxes.plotitem_dict['surface'].amr_patchedges_show = [0] * 10
    plotaxes.plotitem_dict['land'].amr_patchedges_show = [0] * 10

    plotfigure = plotdata.new_plotfigure(name="2. Lake Worth Pier, FL")
    plotfigure.show = True
    # Set up for axes in this figure:
    plotaxes = plotfigure.new_plotaxes()
    plotaxes.title = '2. Lake Worth Pier, FL'
    plotaxes.scaled = True
    #0.5x0.5
    plotaxes.xlimits = [-80.25, -79.75]
    plotaxes.ylimits = [26.35, 26.85]
    plotaxes.afteraxes = gauge_2_afteraxes
    surgeplot.add_surface_elevation(plotaxes, bounds=surface_limits)
    surgeplot.add_land(plotaxes)
    plotaxes.plotitem_dict['surface'].amr_patchedges_show = [0] * 10
    plotaxes.plotitem_dict['land'].amr_patchedges_show = [0] * 10

    plotfigure = plotdata.new_plotfigure(name="3. Fort Pulaski, GA")
    plotfigure.show = True
    # Set up for axes in this figure:
    plotaxes = plotfigure.new_plotaxes()
    plotaxes.title = '3. Fort Pulaski, GA'
    plotaxes.scaled = True
    #0.6x0.6
    plotaxes.xlimits = [-81.2, -80.6]
    plotaxes.ylimits = [31.7, 32.3]
    plotaxes.afteraxes = gauge_3_afteraxes
    surgeplot.add_surface_elevation(plotaxes, bounds=surface_limits)
    surgeplot.add_land(plotaxes)
    plotaxes.plotitem_dict['surface'].amr_patchedges_show = [0] * 10
    plotaxes.plotitem_dict['land'].amr_patchedges_show = [0] * 10

    plotfigure = plotdata.new_plotfigure(name="4. Springmaid Pier, SC")
    plotfigure.show = True
    # Set up for axes in this figure:
    plotaxes = plotfigure.new_plotaxes()
    plotaxes.title = '4. Springmaid Pier, SC'
    plotaxes.scaled = True
    #0.5x0.5
    plotaxes.xlimits = [-79.15, -78.65]
    plotaxes.ylimits = [33.4, 33.9]
    plotaxes.afteraxes = gauge_4_afteraxes
    surgeplot.add_surface_elevation(plotaxes, bounds=surface_limits)
    surgeplot.add_land(plotaxes)
    plotaxes.plotitem_dict['surface'].amr_patchedges_show = [0] * 10
    plotaxes.plotitem_dict['land'].amr_patchedges_show = [0] * 10

    plotfigure = plotdata.new_plotfigure(name="5. Wilmington, NC")
    plotfigure.show = True
    # Set up for axes in this figure:
    plotaxes = plotfigure.new_plotaxes()
    plotaxes.title = '5. Wilmington, NC'
    plotaxes.scaled = True
    #0.5x0.5
    plotaxes.xlimits = [-78.2, -77.7]
    plotaxes.ylimits = [33.95, 34.45]
    plotaxes.afteraxes = gauge_5_afteraxes
    surgeplot.add_surface_elevation(plotaxes, bounds=surface_limits)
    surgeplot.add_land(plotaxes)
    plotaxes.plotitem_dict['surface'].amr_patchedges_show = [0] * 10
    plotaxes.plotitem_dict['land'].amr_patchedges_show = [0] * 10

    plotfigure = plotdata.new_plotfigure(name="6. Marcus Hook, PA")
    plotfigure.show = True
    # Set up for axes in this figure:
    plotaxes = plotfigure.new_plotaxes()
    plotaxes.title = '6. Marcus Hook, PA'
    plotaxes.scaled = True
    plotaxes.xlimits = [-75.65, -75.15]
    plotaxes.ylimits = [39.55, 40.05]
    plotaxes.afteraxes = gauge_6_afteraxes
    surgeplot.add_surface_elevation(plotaxes, bounds=surface_limits)
    surgeplot.add_land(plotaxes)
    plotaxes.plotitem_dict['surface'].amr_patchedges_show = [0] * 10
    plotaxes.plotitem_dict['land'].amr_patchedges_show = [0] * 10

    # -----------------------------------------
    # Parameters used only when creating html and/or latex hardcopy
    # e.g., via pyclaw.plotters.frametools.printframes:

    plotdata.printfigs = True                # print figures
    plotdata.print_format = 'png'            # file format
    plotdata.print_framenos = 'all'          # list of frames to print
    plotdata.print_gaugenos = [1, 2, 3, 4, 5, 6]   # list of gauges to print
    plotdata.print_fignos = 'all'            # list of figures to print
    plotdata.html = True                     # create html files of plots?
    plotdata.latex = True                    # create latex file of plots?
    plotdata.latex_figsperline = 2           # layout of plots
    plotdata.latex_framesperline = 1         # layout of plots
    plotdata.latex_makepdf = False           # also run pdflatex?
    plotdata.parallel = True                 # parallel plotting

    return plotdata


text:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class MY_Controller extends CI_Controller
{
	public $admin_granted = false;
	public $logged_in = false;
	public $any_error = array();

	public function __construct() {
		parent::__construct();

		date_default_timezone_set('Asia/Jakarta');

		$this->is_logged_in();
		$this->cms_has_access();
		/*
		$this->load->model('Course_m');
		$this->load->model('Teacher_m');
		$this->load->model('Student_m');
		$this->load->model('Order_m');
		$this->load->model('Location_m');
		$this->load->model('Content_m');
		$this->load->model('User_m');
		$this->load->model('Common');
                */
		// load language in session, if no language session then back to config language
		if($this->session->userdata('language')==""){
			$this->lang->load('id','indonesia');
			$this->session->set_userdata('language', 'id');
			$this->session->set_userdata('idiom_language', 'indonesia');
		}
		else
			$this->lang->load($this->session->userdata('language'), $this->session->userdata('idiom_language'));

		// assign currency
		if($this->session->userdata('currency')=="")
			$this->session->set_userdata('currency', 'IDR');
	}

	function is_logged_in() {
	   	$user = $this->session->userdata('logged');
	   	if($user=="")
	   		$this->logged_in = false;
	   	else
	   		$this->logged_in = true;
	}

	function cms_has_access(){
		$user_level = $this->session->userdata('level');
		if($user_level=="student" or $user_level=="teacher")
			$this->admin_granted = false;
		else
			$this->admin_granted = true;
	}

	function open_page($file_name, $data=null){
		if($this->session->userdata('curr_page') <> current_url()){
			$this->session->set_userdata('prev_page', $this->session->userdata('curr_page'));
			$this->session->set_userdata('curr_page', current_url());
		}

		if($this->uri->segment(1).'/'.$this->uri->segment(2) == "frontpage/checkout" ){
			$this->session->set_userdata('prev_page', $this->session->userdata('curr_page'));
		}

		/*$get_options = $this->Content_m->get_all_options();
		foreach($get_options->result() as $param){
			$options[$param->parameter_name]['desc'] = $param->description;
			$options[$param->parameter_name]['value'] = $param->parameter_value;
		}
		$footer['options'] = $options;*/

		$this->load->view('iknow/header_2', $data);
		$this->load->view('iknow/'.$file_name, $data);
		$this->load->view('iknow/footer');
	}

	function open_admin_page($file_name, $data=null){
		// if($this->logged_in){
		// 	if($this->admin_granted and $this->session->userdata('level')<>""){
				// get notifications
		$this->load->library('notification');
		$this->load->helper('menu_builder_helper');
		$data['notifications'] = $this->notification->get_data();
		$data['notif_unread'] = $this->notification->count_unread();

		$data['navigator'] = $this->Content_m->get_top_navigator_by_user_level($this->session->userdata('level'));

		$this->load->model('Software_m');
		$data['latest_version'] = $this->Software_m->get_latest_version('tutordoors.com');

		$this->load->view('admin/header', $data);
		$this->load->view('admin/sidebar_left');
		$this->load->view($file_name);
			// }
			// else
			// 	print_r($this->logged_in);
				// show_error('Anda tidak boleh mengakses halaman ini.', 403);
		// }
		// else
		// 	redirect('cms/login');
	}

	function show_error_page($error_no, $message){
		$data['error_no'] = $error_no;
		$data['error_message'] = $message;
		$data['page_title'] = 'Pesan kesalahan';
		$this->open_page('error_message', $data);
	}

	function show_success_page($error_no, $message){
		$data['error_no'] = $error_no;
		$data['error_message'] = $message;
		$data['page_title'] = 'Sukses';
		$this->open_page('error_message', $data);
	}

	function get_data_for_profile($user_id){
		$data['user_info'] = $this->get_user_info($user_id);
		$data['image_thumb'] = '';
		if($data['user_info']<>false)
			if($data['user_info']->file_name<>"")
				$data['image_thumb'] = set_image_thumb_name($data['user_info']);
		$this->load->library('notification');
		$data['unread_message'] = $this->notification->count_unread_by_userid($user_id);

		return $data;
	}

	function get_user_info($user_id){
		$user_info = $this->User_m->get_user_info($user_id);

		if($user_info<>false and $user_info->file_name<>""){
			$config['image_library'] = 'gd2';
			$config['source_image'] = './assets/uploads/'.$user_info->file_name;
			$config['create_thumb'] = TRUE;
			$config['maintain_ratio'] = TRUE;
			$config['width'] = 140;
			$config['height'] = 140;

			$this->load->library('image_lib', $config);

			$this->image_lib->resize();
		}

		return $user_info;
	}

	function check_user_access(){
		if(!$this->logged_in)
			redirect('cms/login');
		if(!$this->admin_granted)
			show_error('Anda tidak boleh mengakses halaman ini.', 403);
	}

	function set_session_response_no_redirect($transaction, $trans_result){
		if($trans_result->status){
			$this->session->set_flashdata('err_no', '200');
			$this->session->set_flashdata('err_msg', $this->lang->line('response_'.$transaction.'_ok'));
		}
		else{
			array_push($this->any_error, $trans_result->output);
			$this->session->set_flashdata('err_no', '204');
			$this->session->set_flashdata('err_msg', $this->any_error);
		}
	}

	function set_session_response_no_redirect_by_error($transaction){
		if(empty($this->any_error)){
			$this->session->set_flashdata('err_no', '200');
			$this->session->set_flashdata('err_msg', $this->lang->line('response_'.$transaction.'_ok'));
		}
		else{
			$this->session->set_flashdata('err_no', '204');
			$this->session->set_flashdata('err_msg', $this->any_error);
		}
	}

	function push_if_transaction_error($trans_result){
		if(!$trans_result->status)
			array_push($this->any_error, $trans_result->output);
	}

	function export_query($query){
		$add = $this->Common->add_to_table('query_strings', array('query'=>$query));
	}
}

/* End of file home.php */
/* Location: ./application/controllers/admin/home.php */


text:
This is upgraded version of 04 project.
Added jQuery slider which steers diode light.

## Running

1. Start MQTT Broker
```
> mosquitto_sub -h 192.168.0.108 -t "World" -v
```
2. Run python program
3. Open html page with Websocket and connect to Mosquitto
4. Slide and enjoy changing diode light intensity


text:
using System.Collections.Generic;
using System.Text.Json;
using Azure.Core;

namespace Azure.AI.Translation.Document.Models
{
    internal partial class SupportedStorageSources
    {
        internal static SupportedStorageSources DeserializeSupportedStorageSources(JsonElement element)
        {
            IReadOnlyList<StorageSource> value = default;
            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("value"))
                {
                    List<StorageSource> array = new List<StorageSource>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(new StorageSource(item.GetString()));
                    }
                    value = array;
                    continue;
                }
            }
            return new SupportedStorageSources(value);
        }
    }
}


text:
/**
 * @author Im Frizzy <skype:kfriz1998>
 * @author Frosty Teh Snowman <skype:travis.mccorkle>
 * @author Arthur <skype:arthur.behesnilian>
 * @author Kayla <skype:ashbysmith1996>
 * @author Sundays211
 * @since 24/01/2015
 */
var CompCapeListener = Java.extend(Java.type('org.virtue.engine.script.listeners.EventListener'), {
	invoke : function (event, objTypeId, args) {
		var player = args.player;
		if (event == EventType.OPWORN1) {//Kandarin Monastery
			api.teleportEntity(player, 3086, 3502, 0);
		} else if (event == EventType.OPWORN2) {//Ardougne farm
			api.teleportEntity(player, 2663, 3374, 0);
		} else if (event == EventType.OPWORN3) {//Max Guild
			api.teleportEntity(player, 2276, 3314, 1);
		} else if (event == EventType.OPWORN4) {//Summoning restore
			api.sendMessage(player, "<col=ff0000>will be added soon. bugged atm.");
		}

		/*switch (option) {
		case 26://Customise
			api.openCentralWidget(player, 20, false);
			return true;
		default:
			api.sendMessage(player, "Unhandled cape option: item="+item.getID()+", option="+option);
		}*/
	}
});

var MaxCapeListener = Java.extend(Java.type('org.virtue.engine.script.listeners.EventListener'), {
	invoke : function (event, objTypeId, args) {
		var player = args.player;
		if (event == EventType.OPWORN1) {//Customise
			api.openCentralWidget(player, 20, false);
		} else if (event == EventType.OPWORN2) {//Max Guild
			api.teleportEntity(player, 2276, 3314, 1);
		}
	}
});

/* Listen to the item ids specified */
var listen = function(scriptManager) {
	var ids = [ 20767, 20769, 20771, 32151, 32152, 32153 ];
	var compCapeListener = new CompCapeListener();
	for (var i in ids) {
		scriptManager.registerListener(EventType.OPWORN1, ids[i], compCapeListener);
		scriptManager.registerListener(EventType.OPWORN2, ids[i], compCapeListener);
		scriptManager.registerListener(EventType.OPWORN3, ids[i], compCapeListener);
		scriptManager.registerListener(EventType.OPWORN4, ids[i], compCapeListener);
	}

	ids = [ 20767, 20769, 20771, 32151, 32152, 32153 ];
	var maxCapeListener = new MaxCapeListener();
	for (var i in ids) {
		scriptManager.registerListener(EventType.OPWORN1, ids[i], maxCapeListener);
		scriptManager.registerListener(EventType.OPWORN2, ids[i], maxCapeListener);
	}
}


text:
"use strict";
var __extends = (this && this.__extends) || (function () {
    var extendStatics = Object.setPrototypeOf ||
        ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
        function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
Object.defineProperty(exports, "__esModule", { value: true });
var matmul_1 = require("../../math/backends/types/matmul");
var graph_util = require("../graph_util");
var op_1 = require("./op");
var MatMul = (function (_super) {
    __extends(MatMul, _super);
    function MatMul(x1Tensor, x2Tensor, yTensor) {
        var _this = _super.call(this) || this;
        _this.x1Tensor = x1Tensor;
        _this.x2Tensor = x2Tensor;
        _this.yTensor = yTensor;
        return _this;
    }
    MatMul.prototype.feedForward = function (math, inferenceArrays) {
        var _this = this;
        var x1 = inferenceArrays.get(this.x1Tensor);
        var x2 = inferenceArrays.get(this.x2Tensor);
        math.scope(function (keep) {
            if (x1.shape.length === 2 && x2.shape.length === 2) {
                inferenceArrays.set(_this.yTensor, keep(math.matMul(x1, x2)));
            }
            else if (x1.shape.length === 2 && x2.shape.length === 1) {
                inferenceArrays.set(_this.yTensor, keep(math.matrixTimesVector(x1, x2)));
            }
            else if (x1.shape.length === 1 && x2.shape.length === 2) {
                inferenceArrays.set(_this.yTensor, keep(math.vectorTimesMatrix(x1, x2)));
            }
        });
    };
    MatMul.prototype.backProp = function (math, inferenceArrays, gradientArrays) {
        var _this = this;
        var x1 = inferenceArrays.get(this.x1Tensor);
        var x2 = inferenceArrays.get(this.x2Tensor);
        var dy = gradientArrays.get(this.yTensor);
        if (x1.shape.length === 1) {
            x1 = x1.reshape([1, x1.size]);
            dy = dy.reshape([1, dy.size]);
        }
        if (x2.shape.length === 1) {
            x2 = x2.reshape([x2.size, 1]);
            dy = dy.reshape([dy.size, 1]);
        }
        math.scope(function () {
            if (graph_util.shouldBackProp(_this.x1Tensor)) {
                var dx1 = math.matMul(dy, x2, matmul_1.MatrixOrientation.REGULAR, matmul_1.MatrixOrientation.TRANSPOSED);
                gradientArrays.add(_this.x1Tensor, _this.x1Tensor.shape.length === 1 ? dx1.as1D() : dx1);
            }
            if (graph_util.shouldBackProp(_this.x2Tensor)) {
                var dx2 = math.matMul(x1, dy, matmul_1.MatrixOrientation.TRANSPOSED, matmul_1.MatrixOrientation.REGULAR);
                gradientArrays.add(_this.x2Tensor, _this.x2Tensor.shape.length === 1 ? dx2.as1D() : dx2);
            }
        });
    };
    return MatMul;
}(op_1.Operation));
exports.MatMul = MatMul;


text:
<?php
/**
 * Description of AuthenticationHandler
 *
 * @author mauro
 */

namespace Mozcu\MozcuBundle\Handler;

use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Bundle\FrameworkBundle\Routing\Router;
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Security\Http\Authentication\AuthenticationSuccessHandlerInterface;
use Symfony\Component\Security\Http\Authentication\AuthenticationFailureHandlerInterface;
use Symfony\Component\Security\Core\Exception\AuthenticationException;
use Symfony\Component\Security\Http\Logout\LogoutSuccessHandlerInterface;

class AuthenticationHandler implements AuthenticationSuccessHandlerInterface,
                                        AuthenticationFailureHandlerInterface,
                                        LogoutSuccessHandlerInterface {

    private $router;

    public function __construct(Router $router)
    {
        $this->router = $router;
    }

    /**
     *
     * @param \Symfony\Component\HttpFoundation\Request $request
     * @param \Symfony\Component\Security\Core\Exception\AuthenticationException $exception
     * @return \Symfony\Component\HttpFoundation\Response|\Symfony\Component\HttpFoundation\RedirectResponse
     */
    public function onAuthenticationFailure(Request $request, AuthenticationException $exception) {
        if ($request->isXmlHttpRequest()) {
            $response = new Response(json_encode(array('success' => false, 'message' => $exception->getMessage())));
            $response->headers->set('Content-Type', 'application/json');
            return $response;
        } else {
            // Create a flash message with the authentication error message
            $request->getSession()->setFlash('error', $exception->getMessage());
            $url = $this->router->generate('MozcuMozcuBundle_home');

            return new RedirectResponse($url);
        }
    }

    /**
     *
     * @param \Symfony\Component\HttpFoundation\Request $request
     * @param \Symfony\Component\Security\Core\Authentication\Token\TokenInterface $token
     * @return \Symfony\Component\HttpFoundation\Response|\Symfony\Component\HttpFoundation\RedirectResponse
     */
    public function onAuthenticationSuccess(Request $request, TokenInterface $token) {
        $user = $token->getUser();
        $url = $this->router->generate('MozcuMozcuBundle_profile', array('username' => $user->getUsername()));

        if ($request->isXmlHttpRequest()) {
            $response = new Response(json_encode(array('success' => true, 'callback_url' => $url)));
            $response->headers->set('Content-Type', 'application/json');
            return $response;
        } else {
            return new RedirectResponse($url);
        }
    }

    /**
     *
     * @param \Symfony\Component\HttpFoundation\Request $request
     * @return \Symfony\Component\HttpFoundation\Response|\Symfony\Component\HttpFoundation\RedirectResponse
     */
    public function onLogoutSuccess(Request $request)
    {
        $request->getSession()->invalidate();
        if ($request->isXmlHttpRequest()) {
            $url = $this->router->generate('MozcuMozcuBundle_home');
            $response = new Response(json_encode(array('success' => true, 'callback_url' => $url)));
            $response->headers->set('Content-Type', 'application/json');
            return $response;
        } else {
            $url = $this->router->generate('MozcuMozcuBundle_home');
            return new RedirectResponse($url);
        }
    }

}


text:
require 'rack/test'
require 'stringio'

ENV['RACK_ENV'] = 'test'

require_relative '../lib/tarona.rb'
require 'game/game'

RSpec.configure do |config|
  config.expect_with :rspec do |expectations|
    expectations.include_chain_clauses_in_custom_matcher_descriptions = true
  end

  config.mock_with :rspec do |mocks|
    mocks.verify_partial_doubles = true
  end
end


text:
namespace EventStore.Core.Tests.Services.ElectionsService.Randomized
{
    internal static class GossipUpdateParams
    {
        public const int AddNodeProbabilityPercent = 12;
        public const int KillNodeProbabilityPercent = 5;
    }
}