text:
.. _magma-operations:

Operations
==========

Querying properties of objects:

*   :cpp:type:`math::is_member`: test wether an object of the magma type is in the magma.
*   :cpp:type:`math::equal`: test whether two objects are equal.
*   :cpp:type:`math::not_equal`: test whether two objects are not equal.
*   :cpp:type:`math::approximately_equal`: test whether two objects are approximately equal.
*   :cpp:type:`math::compare`: compare two objects with a strict weak ordering.
*   :cpp:func:`math::order`: compare two objects with an ordering implied by a path operation.

Producing objects:

*   :cpp:type:`math::non_member`: return an object of the magma type that is not in the magma.
    E.g. not-a-number for floating-point types.
*   :cpp:func:`math::identity`: return the identity element for a magma and operation.
    E.g. ``1`` for ``times`` on number types.
*   :cpp:func:`math::annihilator`: return the annihilator for a magma and operations.
    E.g. ``0`` for ``times`` on number types.
*   :cpp:func:`math::zero`: return the identity for ``times``.
*   :cpp:func:`math::one`: return the identity for ``plus``.

Binary operations:

..  There seems to be no role ":cpp:variable:"!

*   :cpp:type:`math::pick`: return one value or the other, depending on a condition.
*   :cpp:type:`math::choose`: return the most preferable of two values.
*   :cpp:type:`math::times`: multiply two values.
*   :cpp:type:`math::plus`: add two values.
*   :cpp:func:`math::divide`: divide one value by another.
    For some magmas, left and right division are distinguished.
*   :cpp:func:`math::minus`: subtract one value from another.
    For some magmas, left and right subtraction are distinguished.

Unary operations:

*   :cpp:func:`math::invert`: return the inverse of an element under an operation.
    This is not available for all magmas, even if the inverse operation is available.
*   :cpp:func:`math::reverse`: return the reverse of an element under an operation.
*   :cpp:type:`math::print`: output the element to a stream.

.. *   :cpp:func:`math::closure` - with operation

Operation on operations:

*   :cpp:func:`math::inverse_operation`: return the inverse of an operation.
    The result is also an operation.
    For example, ``inverse_operation <math::left> (math::times)`` returns an object of type ``math::callable::divide <math::left>``.

.. _magma_operations_queries:

Queries about operations:

*   :cpp:class:`math::is::associative`: whether an operation is associative.
*   :cpp:class:`math::is::commutative`: whether an operation is commutative.
*   :cpp:class:`math::is::idempotent`: whether an operation is idempotent.
*   :cpp:class:`math::is::path_operation`: whether an operation is a path operation, i.e. whether it returns either the left or the right argument.
*   :cpp:class:`math::is::distributive`: whether one operation distributions over another.
*   :cpp:class:`math::is::monoid`: whether the magma with operation is a monoid, i.e. whether the operation is associative and has an identity.
*   :cpp:class:`math::is::semiring`: whether the magma is a semiring with multiplication and addition operators.

*   :cpp:class:`math::is::throw_if_undefined`: whether an operation throws if it is undefined on the arguments given.

Compile-time queries about nested call expressions:

*   :cpp:class:`math::has`: whether a nested operation is implemented for specific parameters.
*   :cpp:class:`math::result_of`: the result of a nested operation.
*   :cpp:class:`math::result_of_or`: the result of a nested operation, with back-off in case the operation is not implemented.
*   :cpp:class:`math::is::approximate`: whether the result of an operation is approximate.

Reference
---------

Compile-time helpers
^^^^^^^^^^^^^^^^^^^^

.. doxygenstruct:: math::left
.. doxygenstruct:: math::right
.. doxygenstruct:: math::either

.. doxygenstruct:: math::magma_tag
.. doxygenstruct:: math::is_magma

.. doxygenstruct:: math::merge_magma
.. doxygenstruct:: math::generalise_type

Operations on magmas
^^^^^^^^^^^^^^^^^^^^

.. doxygenvariable:: math::is_member
.. doxygenvariable:: math::equal
.. doxygenvariable:: math::not_equal
.. doxygenvariable:: math::approximately_equal

To support composite magmas (such as :cpp:class:`math::lexicographical`), different comparison operations are available.
:cpp:func:`math::compare`, if implemented, gives a strict weak ordering, and is often equaivalent to ``operator<``.
``order <...>`` also implements a comparison, which may be related to ``compare``, but this is not necessary.
``order <choose>``, if defined, returns ``true`` if the left value is better, in some sense, than the right value.
If it is defined, then :cpp:func:`math::choose` will return the better of two values.

Some magmas, ``cost``, for example, implement the same behaviour with the operation ``plus``.
``order <plus>`` then compares two values; ``plus`` itself returns the best (in this case, lowest-cost) of two.

.. doxygenvariable:: math::compare
.. doxygenfunction:: math::order

Producing a value
"""""""""""""""""

.. doxygenfunction:: math::non_member
.. doxygenfunction:: math::identity
.. doxygenfunction:: math::annihilator
.. doxygenfunction:: math::zero
.. doxygenfunction:: math::one

Binary operations
"""""""""""""""""

.. doxygenvariable:: math::pick
.. doxygenvariable:: math::choose
.. doxygenvariable:: math::times
.. doxygenvariable:: math::plus

.. doxygenfunction:: math::divide
.. doxygenfunction:: math::minus

Unary operations
""""""""""""""""

.. doxygenfunction:: math::invert
.. doxygenfunction:: math::reverse
.. doxygenvariable:: math::print

Operations on operations
^^^^^^^^^^^^^^^^^^^^^^^^

The following are operations on operations.

Run-time
""""""""

.. doxygenfunction:: math::inverse_operation

Compile-time queries about operations
"""""""""""""""""""""""""""""""""""""

.. doxygenstruct:: math::is::associative
.. doxygenstruct:: math::is::commutative
.. doxygenstruct:: math::is::idempotent
.. doxygenstruct:: math::is::path_operation
.. doxygenstruct:: math::is::distributive
.. doxygenstruct:: math::is::monoid
.. doxygenstruct:: math::is::semiring

Compile-time queries about nested call expressions
""""""""""""""""""""""""""""""""""""""""""""""""""

These are convenient ways of querying the availability or the results of an expression composed of magma operations.
Internally, this uses the :ref:`nested callable protocol <nested_callable>` for function objects.

.. doxygenstruct:: math::has
.. doxygenstruct:: math::result_of
.. doxygenstruct:: math::result_of_or
.. doxygenstruct:: math::is::approximate

Exception classes
^^^^^^^^^^^^^^^^^

The following types of exception can be thrown:

.. doxygenclass:: math::magma_not_convertible
.. doxygenclass:: math::operation_error
.. doxygenclass:: math::operation_undefined
.. doxygenclass:: math::inverse_of_annihilator
.. doxygenclass:: math::divide_by_zero


text:
package eu.qualimaster.adaptation.internal;

/**
 * Contains the information to be logged for a single adaptation event (from
 * start to enactment).
 *
 * @author Andrea Ceroni
 */
public class AdaptationUnit {

    /** The time (milliseconds) when the adaptation starts. */
    private long startTime;

    /** The time when the adaptation ends (i.e. when it has been enacted) */
    private long endTime;

    /** The class name of the adaptation event. */
    private String event;

    /**
     * The condition that triggered the adaptation (needed to define success
     * indicators).
     */
    private String condition;

    /** The name of the performed strategy. */
    private String strategy;

    /** The outcome of the performed strategy. */
    private boolean strategySuccess;

    /** The name of the performed tactic. */
    private String tactic;

    /** The outcome of the performed tactic. */
    private boolean tacticSuccess;

    /** The outcome of the adaptation. */
    private boolean adaptationSuccess;

    /** The message id contained within the Coordination Command. */
    private String message;

    /** Default constructor. */
    public AdaptationUnit() {
        this.startTime = -1;
        this.endTime = -1;
        this.event = null;
        this.condition = null;
        this.strategy = null;
        this.strategySuccess = false;
        this.tactic = null;
        this.tacticSuccess = false;
        this.message = null;
        this.adaptationSuccess = false;
    }

    /** Copy constructor.
     *
     * @param unit the unit to copy
     */
    public AdaptationUnit(AdaptationUnit unit) {
        this.startTime = unit.getStartTime();
        this.endTime = unit.getEndTime();
        this.event = unit.getEvent();
        this.condition = unit.getCondition();
        this.strategy = unit.getStrategy();
        this.strategySuccess = unit.isStrategySuccess();
        this.tactic = unit.getTactic();
        this.tacticSuccess = unit.isTacticSuccess();
        this.message = unit.getMessage();
        this.adaptationSuccess = unit.isAdaptationSuccess();
    }

    /**
     * Returns the start time.
     *
     * @return the start time
     */
    public long getStartTime() {
        return startTime;
    }

    /**
     * Defines the start time.
     *
     * @param startTime the start time
     */
    public void setStartTime(long startTime) {
        this.startTime = startTime;
    }

    /**
     * Returns the end time.
     *
     * @return the end time
     */
    public long getEndTime() {
        return endTime;
    }

    /**
     * Defines the end time.
     *
     * @param endTime the end time
     */
    public void setEndTime(long endTime) {
        this.endTime = endTime;
    }

    /**
     * Returns the event.
     *
     * @return the event
     */
    public String getEvent() {
        return event;
    }

    /**
     * Defines the event.
     *
     * @param event the event
     */
    public void setEvent(String event) {
        this.event = event;
    }

    /**
     * Returns the condition.
     *
     * @return the condition
     */
    public String getCondition() {
        return condition;
    }

    /**
     * Defines the condition.
     *
     * @param condition the condition
     */
    public void setCondition(String condition) {
        this.condition = condition;
    }

    /**
     * Returns the strategy.
     *
     * @return the strategy
     */
    public String getStrategy() {
        return strategy;
    }

    /**
     * Defines the strategy.
     *
     * @param strategy the strategy
     */
    public void setStrategy(String strategy) {
        this.strategy = strategy;
    }

    /**
     * Returns whether the strategy was successful.
     *
     * @return whether the strategy was successful
     */
    public boolean isStrategySuccess() {
        return strategySuccess;
    }

    /**
     * Defines whether the strategy was successful.
     *
     * @param strategySuccess whether the strategy was successful
     */
    public void setStrategySuccess(boolean strategySuccess) {
        this.strategySuccess = strategySuccess;
    }

    /**
     * Returns the tactic.
     *
     * @return the tactic
     */
    public String getTactic() {
        return tactic;
    }

    /**
     * Changes the tactic.
     *
     * @param tactic the tactic
     */
    public void setTactic(String tactic) {
        this.tactic = tactic;
    }

    /**
     * Defines whether the tactic was successful.
     *
     * @return whether the tactic was successful
     */
    public boolean isTacticSuccess() {
        return tacticSuccess;
    }

    /**
     * Defines whether the tactic was successful.
     *
     * @param tacticSuccess whether the tactic was successful
     */
    public void setTacticSuccess(boolean tacticSuccess) {
        this.tacticSuccess = tacticSuccess;
    }

    /**
     * Returns whether the adaptation execution was successful.
     *
     * @return whether the adaptation execution was successful
     */
    public boolean isAdaptationSuccess() {
        return adaptationSuccess;
    }

    /**
     * Defines whether the adaptation execution was successful.
     *
     * @param adaptationSuccess whether the adaptation execution was successful
     */
    public void setAdaptationSuccess(boolean adaptationSuccess) {
        this.adaptationSuccess = adaptationSuccess;
    }

    /**
     * Returns the (failure) message.
     *
     * @return the message
     */
    public String getMessage() {
        return message;
    }

    /**
     * Changes the (failure) message.
     *
     * @param message the message
     */
    public void setMessage(String message) {
        this.message = message;
    }
}

redpajama_set_name: RedPajamaGithub


text:
The commit messages of the main branch should follow the convention.

## Commit Message Format

```
<Type>: short description (fix #1234)

Longer description here if necessary

BREAKING CHANGE: only contain breaking change
```

- Any line of the commit message cannot be longer 100 characters!

## Revert

```
revert: commit <short-hash>

This reverts commit <full-hash>
More description if needed
```

## Type

The type is determined by the intention.
Must be one of the following:

- **feat**: A new feature
- **fix**: A bug fix
- **docs**: Documentation only changes
- **refactor**: A code change that neither fixes a bug nor adds a feature
- **perf**: A code change that improves performance
- **test**: Adding missing or correcting existing tests
- **chore**: Changes to the build process or auxiliary tools and libraries such as documentation generation
- **env**: Update dependencies, Changes to environment configuration files(package.json, elintrc, babelrc, webpack-config. browserlist, etc)

## Subject

- use the imperative, **present** tense: "change" not "changed" nor "changes"
- don't capitalize the first letter
- no dot (.) at the end
- reference GitHub issues at the end. If the commit doesn't completely fix the issue, then use `(refs #1234)` instead of `(fixes #1234)`.

## Body

- use the imperative, **present** tense: "change" not "changed" nor "changes".
- the motivation for the change and contrast this with previous behavior.

## BREAKING CHANGE

- This commit contains breaking change(s).
- start with the word BREAKING CHANGE: with a space or two newlines. The rest of the commit message is then used for this.

This convention is based on [AngularJS](https://github.com/angular/angular.js/blob/master/DEVELOPERS.md#commits) and [ESLint](https://eslint.org/docs/developer-guide/contributing/pull-requests#step2)


text:
namespace ShowUI
{

using System;
using System.ComponentModel;
using System.Globalization;
using System.Linq;
using System.Management.Automation;
using System.Windows;
using System.Windows.Data;
using System.Windows.Markup;

   public class BindingTypeDescriptionProvider : TypeDescriptionProvider
   {
      private static readonly TypeDescriptionProvider DefaultTypeProvider = TypeDescriptor.GetProvider(typeof(Binding));

      public BindingTypeDescriptionProvider() : base(DefaultTypeProvider) { }

      public override ICustomTypeDescriptor GetTypeDescriptor(Type objectType, object instance)
      {
         ICustomTypeDescriptor defaultDescriptor = base.GetTypeDescriptor(objectType, instance);
         return instance == null ? defaultDescriptor : new BindingCustomTypeDescriptor(defaultDescriptor);
      }
   }

   public class BindingCustomTypeDescriptor : CustomTypeDescriptor
   {
      public BindingCustomTypeDescriptor(ICustomTypeDescriptor parent) : base(parent) { }

      public override PropertyDescriptorCollection GetProperties(Attribute[] attributes)
      {
         PropertyDescriptor pd;
         var pdc = new PropertyDescriptorCollection(base.GetProperties(attributes).Cast<PropertyDescriptor>().ToArray());
         if ((pd = pdc.Find("Source", false)) != null)
         {
            pdc.Add(TypeDescriptor.CreateProperty(typeof(Binding), pd, new Attribute[] { new DefaultValueAttribute("null") }));
            pdc.Remove(pd);
         }
         return pdc;
      }
   }

   public class BindingConverter : ExpressionConverter
   {
      public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
      {
         return (destinationType == typeof(MarkupExtension)) ? true : false;
      }
      public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
      {
         if (destinationType == typeof(MarkupExtension))
         {
            var bindingExpression = value as BindingExpression;
            if (bindingExpression == null) throw new Exception();
            return bindingExpression.ParentBinding;
         }

         return base.ConvertTo(context, culture, value, destinationType);
      }
   }

   public static class XamlTricks
   {
      public static void FixSerialization()
      {
         // this is absolutely vital:
         TypeDescriptor.AddProvider(new BindingTypeDescriptionProvider(), typeof(Binding));
         TypeDescriptor.AddAttributes(typeof(BindingExpression), new Attribute[] { new TypeConverterAttribute(typeof(BindingConverter)) });
      }
   }
}


text:
#ifndef __ctkVTKScalarsToColorsView_h
#define __ctkVTKScalarsToColorsView_h

// CTK includes
#include "ctkVTKChartView.h"
#include "ctkVTKObject.h"
class ctkVTKScalarsToColorsViewPrivate;

// VTK includes
#include <vtkChartXY.h>

class vtkColorTransferFunction;
class vtkControlPointsItem;
class vtkLookupTable;
class vtkPiecewiseFunction;

/// \ingroup Visualization_VTK_Widgets
class CTK_VISUALIZATION_VTK_WIDGETS_EXPORT ctkVTKScalarsToColorsView
  : public ctkVTKChartView
{
  Q_OBJECT
  QVTK_OBJECT
  /// Add an empty space around the view to give space to the corner control
  /// points. False by default
  Q_PROPERTY(bool bordersVisible READ areBordersVisible WRITE setBordersVisible)

public:
  typedef ctkVTKChartView Superclass;
  ctkVTKScalarsToColorsView(QWidget* parent = 0);
  virtual ~ctkVTKScalarsToColorsView();

  Q_INVOKABLE virtual void addPlot(vtkPlot* plot);

  Q_INVOKABLE vtkPlot* addLookupTable(vtkLookupTable* lut);
  Q_INVOKABLE vtkPlot* addColorTransferFunction(vtkColorTransferFunction* colorTF, bool editable = true);
  Q_INVOKABLE vtkPlot* addOpacityFunction(vtkPiecewiseFunction* opacityTF, bool editable = true);
  Q_INVOKABLE vtkPlot* addCompositeFunction(vtkColorTransferFunction* colorTF,
                                vtkPiecewiseFunction* opacityTF,
                                bool colorTFEditable = true,
                                bool opacityTFEditable = true);
  Q_INVOKABLE vtkPlot* addPiecewiseFunction(vtkPiecewiseFunction* piecewiseTF, bool editable = true);

  Q_INVOKABLE vtkPlot* addColorTransferFunctionControlPoints(vtkColorTransferFunction* colorTF);
  Q_INVOKABLE vtkPlot* addOpacityFunctionControlPoints(vtkPiecewiseFunction* opacityTF);
  Q_INVOKABLE vtkPlot* addCompositeFunctionControlPoints(vtkColorTransferFunction* colorTF,
                                             vtkPiecewiseFunction* opacityTF);
  Q_INVOKABLE vtkPlot* addPiecewiseFunctionControlPoints(vtkPiecewiseFunction* piecewiseTF);

  Q_INVOKABLE QList<vtkPlot*> plots()const;
  template<class T>
  QList<T*> plots()const;
  Q_INVOKABLE QList<vtkControlPointsItem*> controlPointsItems()const;
  Q_INVOKABLE QList<vtkPlot*> lookupTablePlots()const;
  Q_INVOKABLE QList<vtkPlot*> lookupTablePlots(vtkLookupTable* lut)const;
  Q_INVOKABLE QList<vtkPlot*> colorTransferFunctionPlots()const;
  Q_INVOKABLE QList<vtkPlot*> colorTransferFunctionPlots(vtkColorTransferFunction* colorTF)const;
  Q_INVOKABLE QList<vtkPlot*> opacityFunctionPlots()const;
  Q_INVOKABLE QList<vtkPlot*> opacityFunctionPlots(vtkPiecewiseFunction* opacityTF)const;

  Q_INVOKABLE void setLookuptTableToPlots(vtkLookupTable* lut);
  Q_INVOKABLE void setColorTransferFunctionToPlots(vtkColorTransferFunction* colorTF);
  Q_INVOKABLE void setOpacityFunctionToPlots(vtkPiecewiseFunction* opacityTF);
  Q_INVOKABLE void setPiecewiseFunctionToPlots(vtkPiecewiseFunction* piecewiseTF);

  bool areBordersVisible()const;
  void setBordersVisible(bool show);

  Q_INVOKABLE void validBounds(double bounds[4])const;
  Q_INVOKABLE void setValidBounds(double bounds[4]);

  Q_INVOKABLE void setPlotsUserBounds(double* bounds);

  /// Reimplemented to set the bounds to the plots as well
  Q_INVOKABLE virtual void boundAxesToChartBounds();

Q_SIGNALS:
  /// Emitted when a new function is set to the view
  /// \sa setLookuptTableToPlots, \sa setColorTransferFunctionToPlots,
  /// \sa setOpacityFunctionToPlots, \sa setPiecewiseFunctionToPlots
  void functionChanged();

public Q_SLOTS:
  void editPoint(vtkObject* plot, void * pointId);

  /// Move all the control points by a given offset.
  /// \sa vtkControlPoints::movePoints()
  void moveAllPoints(double xOffset, double yOffset = 0.,
                     bool dontMoveFirstAndLast = false);

  /// Spread all the control points by a given offset.
  /// A value >0 will space the control points, a value <0. will contract
  /// them.
  /// \sa vtkControlPoints::spreadPoints()
  void spreadAllPoints(double factor = 1.,
                       bool dontMoveFirstAndLast = false);

protected Q_SLOTS:
  void onBoundsChanged();

protected:
  QScopedPointer<ctkVTKScalarsToColorsViewPrivate> d_ptr;

private:
  Q_DECLARE_PRIVATE(ctkVTKScalarsToColorsView);
  Q_DISABLE_COPY(ctkVTKScalarsToColorsView);
};

// ----------------------------------------------------------------------------
template<class T>
QList<T*> ctkVTKScalarsToColorsView::plots()const
{
  QList<T*> res;
  const vtkIdType count = this->chart()->GetNumberOfPlots();
  for(vtkIdType i = 0; i < count; ++i)
    {
    vtkPlot* plot = this->chart()->GetPlot(i);
    if (T::SafeDownCast(plot) != 0)
      {
      res << T::SafeDownCast(plot);
      }
    }
  return res;
}

#endif


text:
* Specify SSH identity to use in the git push

### CAPISTRANO
* Automatically provision / push / use the public URL to deploy / deprovision


text:
package org.ovirt.engine.api.resource;

import javax.ws.rs.GET;
import javax.ws.rs.Produces;

import org.jboss.resteasy.annotations.providers.jaxb.Formatted;
import org.ovirt.engine.api.model.Hook;

@Produces({ ApiMediaType.APPLICATION_XML, ApiMediaType.APPLICATION_JSON, ApiMediaType.APPLICATION_X_YAML })
public interface HostHookResource {

    @GET
    @Formatted
    public Hook get();
}


text:
import pickle
from . import get_cache_filename

def save(k, v):
    with open(get_cache_filename(k), 'wb') as f:
        pickle.dump(v, f)
        print(k, "saved")

def load(k):
    try:
        with open(get_cache_filename(k), 'rb') as f:
            return pickle.load(f)
    except:
        print("Cannot load cache for", k)
        return None

def main():
    print(get_cache_filename("abc"))

if __name__ == '__main__':
    main()


text:
<?php

add_filter("get_next_post_plus_join", "avada_get_next_post_plus_join");

add_filter("get_next_post_plus_where", "avada_get_next_post_plus_where");

add_filter("get_previous_post_plus_join", "avada_get_next_post_plus_join");

add_filter("get_previous_post_plus_where", "avada_get_next_post_plus_where");

function avada_get_next_post_plus_join($join) {
	global $wpdb;
	$join .= "LEFT JOIN {$wpdb->prefix}icl_translations as t on t.element_id = p.ID";
	return $join;
}

function avada_get_next_post_plus_where($where) {
	global $sitepress;
	$where .= "AND t.language_code = '" . $sitepress->get_current_language() . "'";
	return $where;
}

// Omit closing PHP tag to avoid "Headers already sent" issues.


text:
namespace search
{
RankTable const & RankTableCache::Get(Index & index, TId const & mwmId)
{
  auto const it = m_ranks.find(TKey(mwmId));
  if (it != m_ranks.end())
    return *it->second;

  TKey handle(index.GetMwmHandleById(mwmId));
  auto table = RankTable::Load(handle.GetValue<MwmValue>()->m_cont);
  if (!table)
    table.reset(new DummyRankTable());

  return *(m_ranks.emplace(move(handle), move(table)).first->second.get());
}

void RankTableCache::Remove(TId const & id) { m_ranks.erase(TKey(id)); }

void RankTableCache::Clear() { m_ranks.clear(); }

}  // namespace search


text:
package org.h2.schema;

import java.lang.reflect.Method;
import java.sql.Connection;
import java.sql.SQLException;

import org.h2.api.ErrorCode;
import org.h2.api.Trigger;
import org.h2.command.Parser;
import org.h2.engine.Constants;
import org.h2.engine.DbObject;
import org.h2.engine.Session;
import org.h2.message.DbException;
import org.h2.message.Trace;
import org.h2.result.Row;
import org.h2.table.Table;
import org.h2.util.JdbcUtils;
import org.h2.util.SourceCompiler;
import org.h2.util.StatementBuilder;
import org.h2.util.StringUtils;
import org.h2.value.DataType;
import org.h2.value.Value;

/**
 *A trigger is created using the statement
 * CREATE TRIGGER
 */
public class TriggerObject extends SchemaObjectBase {

    /**
     * The default queue size.
     */
    public static final int DEFAULT_QUEUE_SIZE = 1024;

    private boolean insteadOf;
    private boolean before;
    private int typeMask;
    private boolean rowBased;
    private boolean onRollback;
    // TODO trigger: support queue and noWait = false as well
    private int queueSize = DEFAULT_QUEUE_SIZE;
    private boolean noWait;
    private Table table;
    private String triggerClassName;
    private String triggerSource;
    private Trigger triggerCallback;

    public TriggerObject(Schema schema, int id, String name, Table table) {
        initSchemaObjectBase(schema, id, name, Trace.TRIGGER);
        this.table = table;
        setTemporary(table.isTemporary());
    }

    public void setBefore(boolean before) {
        this.before = before;
    }

    public void setInsteadOf(boolean insteadOf) {
        this.insteadOf = insteadOf;
    }

    private synchronized void load() {
        if (triggerCallback != null) {
            return;
        }
        try {
            Session sysSession = database.getSystemSession();
            Connection c2 = sysSession.createConnection(false);
            Object obj;
            if (triggerClassName != null) {
                obj = JdbcUtils.loadUserClass(triggerClassName).newInstance();
            } else {
                obj = loadFromSource();
            }
            triggerCallback = (Trigger) obj;
            triggerCallback.init(c2, getSchema().getName(), getName(),
                    table.getName(), before, typeMask);
        } catch (Throwable e) {
            // try again later
            triggerCallback = null;
            throw DbException.get(ErrorCode.ERROR_CREATING_TRIGGER_OBJECT_3, e, getName(),
                triggerClassName != null ? triggerClassName : "..source..", e.toString());
        }
    }

    private Trigger loadFromSource() {
        SourceCompiler compiler = database.getCompiler();
        synchronized (compiler) {
            String fullClassName = Constants.USER_PACKAGE + ".trigger." + getName();
            compiler.setSource(fullClassName, triggerSource);
            try {
                Method m = compiler.getMethod(fullClassName);
                if (m.getParameterTypes().length > 0) {
                    throw new IllegalStateException("No parameters are allowed for a trigger");
                }
                return (Trigger) m.invoke(null);
            } catch (DbException e) {
                throw e;
            } catch (Exception e) {
                throw DbException.get(ErrorCode.SYNTAX_ERROR_1, e, triggerSource);
            }
        }
    }

    /**
     * Set the trigger class name and load the class if possible.
     *
     * @param triggerClassName the name of the trigger class
     * @param force whether exceptions (due to missing class or access rights)
     *            should be ignored
     */
    public void setTriggerClassName(String triggerClassName, boolean force) {
        this.setTriggerAction(triggerClassName, null, force);
    }

    /**
     * Set the trigger source code and compile it if possible.
     *
     * @param source the source code of a method returning a {@link Trigger}
     * @param force whether exceptions (due to syntax error)
     *            should be ignored
     */
    public void setTriggerSource(String source, boolean force) {
        this.setTriggerAction(null, source, force);
    }

    private void setTriggerAction(String triggerClassName, String source, boolean force) {
        this.triggerClassName = triggerClassName;
        this.triggerSource = source;
        try {
            load();
        } catch (DbException e) {
            if (!force) {
                throw e;
            }
        }
    }

    /**
     * Call the trigger class if required. This method does nothing if the
     * trigger is not defined for the given action. This method is called before
     * or after any rows have been processed, once for each statement.
     *
     * @param session the session
     * @param type the trigger type
     * @param beforeAction if this method is called before applying the changes
     */
    public void fire(Session session, int type, boolean beforeAction) {
        if (rowBased || before != beforeAction || (typeMask & type) == 0) {
            return;
        }
        load();
        Connection c2 = session.createConnection(false);
        boolean old = false;
        if (type != Trigger.SELECT) {
            old = session.setCommitOrRollbackDisabled(true);
        }
        Value identity = session.getLastScopeIdentity();
        try {
            triggerCallback.fire(c2, null, null);
        } catch (Throwable e) {
            throw DbException.get(ErrorCode.ERROR_EXECUTING_TRIGGER_3, e, getName(),
                    triggerClassName != null ? triggerClassName : "..source..", e.toString());
        } finally {
            if (session.getLastTriggerIdentity() != null) {
                session.setLastScopeIdentity(session.getLastTriggerIdentity());
                session.setLastTriggerIdentity(null);
            } else {
                session.setLastScopeIdentity(identity);
            }
            if (type != Trigger.SELECT) {
                session.setCommitOrRollbackDisabled(old);
            }
        }
    }

    private static Object[] convertToObjectList(Row row) {
        if (row == null) {
            return null;
        }
        int len = row.getColumnCount();
        Object[] list = new Object[len];
        for (int i = 0; i < len; i++) {
            list[i] = row.getValue(i).getObject();
        }
        return list;
    }

    /**
     * Call the fire method of the user-defined trigger class if required. This
     * method does nothing if the trigger is not defined for the given action.
     * This method is called before or after a row is processed, possibly many
     * times for each statement.
     *
     * @param session the session
     * @param oldRow the old row
     * @param newRow the new row
     * @param beforeAction true if this method is called before the operation is
     *            applied
     * @param rollback when the operation occurred within a rollback
     * @return true if no further action is required (for 'instead of' triggers)
     */
    public boolean fireRow(Session session, Row oldRow, Row newRow,
            boolean beforeAction, boolean rollback) {
        if (!rowBased || before != beforeAction) {
            return false;
        }
        if (rollback && !onRollback) {
            return false;
        }
        load();
        Object[] oldList;
        Object[] newList;
        boolean fire = false;
        if ((typeMask & Trigger.INSERT) != 0) {
            if (oldRow == null && newRow != null) {
                fire = true;
            }
        }
        if ((typeMask & Trigger.UPDATE) != 0) {
            if (oldRow != null && newRow != null) {
                fire = true;
            }
        }
        if ((typeMask & Trigger.DELETE) != 0) {
            if (oldRow != null && newRow == null) {
                fire = true;
            }
        }
        if (!fire) {
            return false;
        }
        oldList = convertToObjectList(oldRow);
        newList = convertToObjectList(newRow);
        Object[] newListBackup;
        if (before && newList != null) {
            newListBackup = new Object[newList.length];
            System.arraycopy(newList, 0, newListBackup, 0, newList.length);
        } else {
            newListBackup = null;
        }
        Connection c2 = session.createConnection(false);
        boolean old = session.getAutoCommit();
        boolean oldDisabled = session.setCommitOrRollbackDisabled(true);
        Value identity = session.getLastScopeIdentity();
        try {
            session.setAutoCommit(false);
            triggerCallback.fire(c2, oldList, newList);
            if (newListBackup != null) {
                for (int i = 0; i < newList.length; i++) {
                    Object o = newList[i];
                    if (o != newListBackup[i]) {
                        Value v = DataType.convertToValue(session, o, Value.UNKNOWN);
                        newRow.setValue(i, v);
                    }
                }
            }
        } catch (Exception e) {
            if (onRollback) {
                // ignore
            } else {
                throw DbException.convert(e);
            }
        } finally {
            if (session.getLastTriggerIdentity() != null) {
                session.setLastScopeIdentity(session.getLastTriggerIdentity());
                session.setLastTriggerIdentity(null);
            } else {
                session.setLastScopeIdentity(identity);
            }
            session.setCommitOrRollbackDisabled(oldDisabled);
            session.setAutoCommit(old);
        }
        return insteadOf;
    }

    /**
     * Set the trigger type.
     *
     * @param typeMask the type
     */
    public void setTypeMask(int typeMask) {
        this.typeMask = typeMask;
    }

    public void setRowBased(boolean rowBased) {
        this.rowBased = rowBased;
    }

    public void setQueueSize(int size) {
        this.queueSize = size;
    }

    public int getQueueSize() {
        return queueSize;
    }

    public void setNoWait(boolean noWait) {
        this.noWait = noWait;
    }

    public boolean isNoWait() {
        return noWait;
    }

    public void setOnRollback(boolean onRollback) {
        this.onRollback = onRollback;
    }

    @Override
    public String getDropSQL() {
        return null;
    }

    @Override
    public String getCreateSQLForCopy(Table targetTable, String quotedName) {
        StringBuilder buff = new StringBuilder("CREATE FORCE TRIGGER ");
        buff.append(quotedName);
        if (insteadOf) {
            buff.append(" INSTEAD OF ");
        } else if (before) {
            buff.append(" BEFORE ");
        } else {
            buff.append(" AFTER ");
        }
        buff.append(getTypeNameList());
        buff.append(" ON ").append(targetTable.getSQL());
        if (rowBased) {
            buff.append(" FOR EACH ROW");
        }
        if (noWait) {
            buff.append(" NOWAIT");
        } else {
            buff.append(" QUEUE ").append(queueSize);
        }
        if (triggerClassName != null) {
            buff.append(" CALL ").append(Parser.quoteIdentifier(triggerClassName));
        } else {
            buff.append(" AS ").append(StringUtils.quoteStringSQL(triggerSource));
        }
        return buff.toString();
    }

    public String getTypeNameList() {
        StatementBuilder buff = new StatementBuilder();
        if ((typeMask & Trigger.INSERT) != 0) {
            buff.appendExceptFirst(", ");
            buff.append("INSERT");
        }
        if ((typeMask & Trigger.UPDATE) != 0) {
            buff.appendExceptFirst(", ");
            buff.append("UPDATE");
        }
        if ((typeMask & Trigger.DELETE) != 0) {
            buff.appendExceptFirst(", ");
            buff.append("DELETE");
        }
        if ((typeMask & Trigger.SELECT) != 0) {
            buff.appendExceptFirst(", ");
            buff.append("SELECT");
        }
        if (onRollback) {
            buff.appendExceptFirst(", ");
            buff.append("ROLLBACK");
        }
        return buff.toString();
    }

    @Override
    public String getCreateSQL() {
        return getCreateSQLForCopy(table, getSQL());
    }

    @Override
    public int getType() {
        return DbObject.TRIGGER;
    }

    @Override
    public void removeChildrenAndResources(Session session) {
        table.removeTrigger(this);
        database.removeMeta(session, getId());
        if (triggerCallback != null) {
            try {
                triggerCallback.remove();
            } catch (SQLException e) {
                throw DbException.convert(e);
            }
        }
        table = null;
        triggerClassName = null;
        triggerSource = null;
        triggerCallback = null;
        invalidate();
    }

    @Override
    public void checkRename() {
        // nothing to do
    }

    /**
     * Get the table of this trigger.
     *
     * @return the table
     */
    public Table getTable() {
        return table;
    }

    /**
     * Check if this is a before trigger.
     *
     * @return true if it is
     */
    public boolean isBefore() {
        return before;
    }

    /**
     * Get the trigger class name.
     *
     * @return the class name
     */
    public String getTriggerClassName() {
        return triggerClassName;
    }

    public String getTriggerSource() {
        return triggerSource;
    }

    /**
     * Close the trigger.
     */
    public void close() throws SQLException {
        if (triggerCallback != null) {
            triggerCallback.close();
        }
    }

    /**
     * Check whether this is a select trigger.
     *
     * @return true if it is
     */
    public boolean isSelectTrigger() {
        return (typeMask & Trigger.SELECT) != 0;
    }

}


text:
<?xml version="1.0" encoding="UTF-8"?><!--  Copyright (C) 2006 The Android Open Source Project

     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.
 -->

<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">

    <string name="select_hours">"Uren selecteren"</string>
    <string name="select_minutes">"Minuten selecteren"</string>
    <string name="day_picker_description">"Maandraster van dagen"</string>
    <string name="year_picker_description">"Jaarlijst"</string>
    <string name="select_day">"Maand en dag selecteren"</string>
    <string name="select_year">"Jaar selecteren"</string>
    <string name="item_is_selected">"<xliff:g id="ITEM">%1$s</xliff:g> geselecteerd"</string>
    <string name="deleted_key">"<xliff:g id="KEY">%1$s</xliff:g> verwijderd"</string>

    <string name="ok">"OK"</string>
    <string name="cancel">"Annuleren"</string>

    <string name="endByDate">"; tot <xliff:g id="DATE">%s</xliff:g>"</string>
    <plurals name="endByCount">
        <item quantity="one">"; één keer"</item>
        <item quantity="other">"; <xliff:g id="NUMBER">%d</xliff:g> keer"</item>
    </plurals>
    <plurals name="daily">
        <item quantity="one">"Dagelijks"</item>
        <item quantity="other">"Elke <xliff:g id="NUMBER">%d</xliff:g> dagen"</item>
    </plurals>
    <string name="every_weekday">"Elke werkdag (ma - vr)"</string>
    <plurals name="weekly">
        <item quantity="one">"Wekelijks op <xliff:g id="DAYS_OF_WEEK">%2$s</xliff:g>"</item>
        <item quantity="other">"Elke <xliff:g id="NUMBER">%1$d</xliff:g> weken op <xliff:g id="DAYS_OF_WEEK">%2$s</xliff:g>"</item>
    </plurals>
    <string name="monthly">"Maandelijks"</string>
    <string name="yearly_plain">"Jaarlijks"</string>
    <plurals name="recurrence_interval_daily">
        <item quantity="one">"Elke <xliff:g id="COUNT">%d</xliff:g> dag"</item>
        <item quantity="other">"Elke <xliff:g id="COUNT">%d</xliff:g> dagen"</item>
    </plurals>
    <plurals name="recurrence_interval_weekly">
        <item quantity="one">"Elke <xliff:g id="COUNT">%d</xliff:g> week"</item>
        <item quantity="other">"Elke <xliff:g id="COUNT">%d</xliff:g> weken"</item>
    </plurals>
    <plurals name="recurrence_interval_monthly">
        <item quantity="one">"Elke <xliff:g id="COUNT">%d</xliff:g> maand"</item>
        <item quantity="other">"Elke <xliff:g id="COUNT">%d</xliff:g> maanden"</item>
    </plurals>
    <plurals name="recurrence_interval_yearly">
        <item quantity="one">"Elk <xliff:g id="COUNT">%d</xliff:g> jaar"</item>
        <item quantity="other">"Elke <xliff:g id="COUNT">%d</xliff:g> jaar"</item>
    </plurals>
    <string name="recurrence_month_pattern_by_day">"elke maand op dezelfde dag"</string>
    <string name="recurrence_end_continously">"Voor altijd"</string>
    <string name="recurrence_end_date_label">"Tot een datum"</string>
    <string name="recurrence_end_date">"Tot <xliff:g id="DATE">%s</xliff:g>"</string>
    <string name="recurrence_end_count_label">"Voor een aantal evenementen"</string>
    <plurals name="recurrence_end_count">
        <item quantity="one">"Voor <xliff:g id="EVENT_COUNT">%d</xliff:g> afspraak"</item>
        <item quantity="other">"Voor <xliff:g id="EVENT_COUNT">%d</xliff:g> evenementen"</item>
    </plurals>
    <string name="acessibility_recurrence_choose_end_date_description">"einddatum wijzigen"</string>
</resources>


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

class M_Login extends CI_Model {

	public function __construct()
	{
		parent::__construct();
		$this->load->database();
	}

	public function getUserPass($data){
		$this->db->select('*');
		$this->db->where('id_user', $data['username']);
		$this->db->where('pass_user', $data['password']);
		$this->db->where('blokir_user', 'T');
		$query = $this->db->get('list_user');

		if ($query->num_rows() == 1) {
			return true;
		} else {
			return false;
		}
	}

	public function getUserInformation($data){
		$this->db->select('id_list_user');
		$this->db->select('id_user');
		$this->db->select('level_user');
		$this->db->where('id_user', $data['username']);
		$this->db->where('pass_user', $data['password']);
		$this->db->where('blokir_user', 'T');
		$query = $this->db->get('list_user');
		return $query->result_array();
	}

}

/* End of file login.php */
/* Location: ./application/models/login.php */


text:
Research
--------

The Research folder contains all the material generated while doing the research where each folder represents the topic of  research. We aim to make our research that we do, or that we may inspire in the future to be :-

   - Reproducable
   - Understandable
   - Collabarative

To ensure the above 3 we encourage to follow the following structure for the research folders

Structure
---------

```
./research
|   +-- topic-of-research
|   |    +-- notebooks
|   |    |   +-- research_trial.ipynb
|   |    |   +-- another_research_trail.ipynb
|   |    +-- code
|   |    |   +-- code.py
|   |    |   +-- another_code.py
|   |    +-- README.md
```

All the research trials go into ipython notebooks in the `notebooks` folder, the code generated based on the research goes into `code` as it might not always be simple to integrate the code directly into production.The Readme contains description of the idea and overall an idea of the process.

Contribute
----------

To contribute you are welcomed to fork and start a research project or start a research project in your personal github repositories and we can add that as a submodule to this folder, feel free to start discussions on a research topic that you may have in mind.

Incase you have forked the repo open a pull request and assign to it either @heaven00 or @gggodhwani for review and if you have your own repo for the research mark us in one of your commits or start a discussion about it.


text:
<!http://www.dreamtemplate.com/templates/826/0825.html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv=Content-Type content="text/plain; charset=iso-8859-1">
<title>katya vasilaky</title>
<link href="main.css" rel="stylesheet" type="text/css" />

<noframes></noframes> kathryn <noframes></noframes> (katya)  <noframes></noframes> vasilaky

pages

								bio

								publications

								teaching

								grants, field work

								seminars

								job listings

								cv

bio

						I am an Assistant Professor at the Department of Economics, Orfalea College of Business, Cal Poly and Research Affiliate at the International Research Institute for Climate and Society at Columbia University.

						My research is in experimental and development economics, as well as the intersection of data science and econometrics.  In my applied work I focus on the economic development via group-based technology adoption, and gender and competition. In my methodological work I focus on bias correction methods - where the bias may be statisical, user-driven, or algorithmic.

						In line with my research, I believe in making education accessible and inclusive. To this end I co-ran<noframes></noframes>  Pyladies NYC, taught for Girls Who Code, currently co-run  PyData SLO, am a mentor for Beacon, teach for Cal Poly's  EPIC, am a founding member of Cal Poly's  Data Science initiative where we host free programming  workshops.

						I am an avid farmer, and have volunteered with  WOOF in several countries; am a co-founder of  Ground Truth Data, a startup that collects granular weather data; and in my past life was a professional ballet dancer with the  San Francisco Ballet company.


text:
function doc_keyUp(e) {

//document.getElementById("mytext").focus();

//left arrow  37
//up arrow  38
//right arrow  39
//down arrow  40

//http://www.telerik.com/help/silverlight/radtreeview-feautres-treeviewitem-expanding-and-collapsing-items.html

    if (e.keyCode == 13) { // subtract
            if (document.activeElement) {
                var id = document.activeElement.id;
	        if (document.getElementById(id) != null) {
		    simulate(document.getElementById(id), "click");
	        }
	    }

    } else if (e.shiftKey && e.keyCode == 189) { // subtract
            if (document.activeElement) {
                var id = document.activeElement.id;

                var n = id.indexOf("N_");
                if (n == 0) {
                    var img_id = "IMG_" + id;

                    if (document.getElementById(img_id).getAttribute('src') == "/tree/images/minus.gif") {
                        return;
                    }

                    if (document.getElementById(img_id) != null) {
                        simulate(document.getElementById(img_id), "click");
                    }
                }
            }

    } else if (e.shiftKey && e.keyCode == 187) {
            if (document.activeElement) {
                var id = document.activeElement.id;

                var n = id.indexOf("N_");
                if (n == 0) {
                    var img_id = "IMG_" + id;

                    if (document.getElementById(img_id).getAttribute('src') == "/tree/images/plus.gif") {
                        return;
                    }

                    //alert(document.getElementById(img_id).getAttribute('src'));

                    if (document.getElementById(img_id) != null) {
                        simulate(document.getElementById(img_id), "click");
                    }
                }
            }

    // this would test for whichever key is 40 and the ctrl key at the same time
    } else if (e.ctrlKey && e.keyCode == 40) {
            if (document.activeElement) {
                //alert(document.activeElement.id);
                simulate(document.getElementById(document.activeElement.id), "click");
            }

    } else if (e.keyCode == 36) {
            if (document.activeElement) {
                //alert("home key pressed -- id: " + document.activeElement.id);
                //simulate(document.getElementById(document.activeElement.id), "click");
            }

    } else if (e.keyCode == 37) { // left arrow
            if (document.activeElement) {
                var curr_id = document.activeElement.id;
		var n = curr_id.lastIndexOf("_");
		if (n != -1) {
		    var prefix = curr_id.substring(0, n);
		    var node_num = curr_id.substring(n+1, curr_id.length);
		    var prev_node_num = parseInt(node_num) - 1;
 		    var prev_node_num_str = prev_node_num.toString();
 		    var prev_sibling = prefix + "_" + prev_node_num_str;
 		    if (document.getElementById(prev_sibling) != null) {
 		        document.getElementById(prev_sibling).focus();
 		    } else if (document.getElementById(prefix) != null) {
                        document.getElementById(prefix).focus();
		    }
                }
            }

    } else if (e.keyCode == 39) {  // right arrow
            if (document.activeElement) {
                var curr_id = document.activeElement.id;
		var n = curr_id.lastIndexOf("_");
		if (n != -1) {
		    var prefix = curr_id.substring(0, n);
		    var node_num = curr_id.substring(n+1, curr_id.length);
		    var next_node_num = parseInt(node_num) + 1;
 		    var next_node_num_str = next_node_num.toString();
 		    var next_sibling = prefix + "_" + next_node_num_str;
 		    if (document.getElementById(next_sibling) != null) {
 		        document.getElementById(next_sibling).focus();
 		    } else if (document.getElementById(prefix) != null) {
 		        var m = prefix.lastIndexOf("_");
 		        var next_prefix = prefix.substring(0, m);
 		        node_num = prefix.substring(m+1, prefix.length);
			next_node_num = parseInt(node_num) + 1;
			next_node_num_str = next_node_num.toString();
			var next_parent = next_prefix + "_" + next_node_num_str;
 		        if (document.getElementById(next_parent) != null) {
                            document.getElementById(next_parent).focus();
                        }
		    }
                }
            }

    }}
// register the handler
document.addEventListener('keyup', doc_keyUp, false);

 			function updateChildNodeStatus(id) {
 				var prefix = id.concat("_");
 				var child_cnt = 1;
 				child_id = prefix.concat(child_cnt.toString());
 				while (document.getElementById(child_id) != null) {
 					child_cnt++;
 					child_id = prefix.concat(child_cnt.toString());
 				}
 				child_cnt = child_cnt - 1;
 				if (child_cnt == 0) {
 				    return;
 				}

 				child_cnt = 1;
 				child_id = prefix.concat(child_cnt.toString());
 				while (document.getElementById(child_id) != null) {
 					document.getElementById(child_id).checked = document.getElementById(id).checked;
 					updateChildNodeStatus(child_id);
 					child_cnt++;
 					child_id = prefix.concat(child_cnt.toString());
 				}
 			}

 			function uncheckParentNodeStatus(id, status) {
 				var n = id.lastIndexOf("_");
 				if (n != -1) {
 					var parent_id = id.substring(0, n);
 					if (document.getElementById(parent_id) != null) {
 						document.getElementById(parent_id).checked = status;
 						uncheckParentNodeStatus(parent_id, status);
 					}
 				}
 			}

 			function updateParentNodeStatus(id) {
 				var n = id.lastIndexOf("_");
 				if (n != -1) {
 					var parent_id = id.substring(0, n);
 					var prefix = parent_id.concat("_");
 					if (document.getElementById(parent_id) != null) {
 						var child_cnt = 1;
 						child_id = prefix.concat(child_cnt.toString());
 						while (document.getElementById(child_id) != null) {
 							child_cnt++;
 							child_id = prefix.concat(child_cnt.toString());
 						}
 						child_cnt = child_cnt - 1;
 						if (child_cnt == 0) return;
 						child_cnt = 1;
 						child_id = prefix.concat(child_cnt.toString());

 						var has_unchecked_sub = false;
 						var knt = 0;
 						while (document.getElementById(child_id) != null) {
 							if (!document.getElementById(child_id).checked) {
 								has_unchecked_sub = true;
 								//break;
 							} else {
 							    knt++;
 							}
 							child_cnt++;
 							child_id = prefix.concat(child_cnt.toString());
 						}
 						child_cnt = child_cnt - 1;

 						if (has_unchecked_sub == true && document.getElementById(parent_id).checked) {
 						    document.getElementById(parent_id).checked = !document.getElementById(parent_id).checked;
 						} else if (knt == child_cnt) {
 						    child_id = prefix.concat("1");
 						    document.getElementById(parent_id).checked = document.getElementById(child_id).checked;
 						}
 						updateParentNodeStatus(parent_id);
 					}
 				}
 			}

 			function updateCheckbox(id) {
 			    updateChildNodeStatus(id);
 			    updateParentNodeStatus(id);
 			    document.getElementById(parent_id).checked = !document.getElementById(parent_id).checked;
 			}

	function changeImage(img_id) {
		var img_obj = document.getElementById(img_id);
		if (img_obj.getAttribute("src").indexOf("minus") != -1) {
			var s = img_obj.getAttribute("src");
			s = s.replace("minus", "plus");
			img_obj.setAttribute("src", s);
		} else if (img_obj.getAttribute("src").indexOf("plus") != -1) {
			var s = img_obj.getAttribute("src");
			s = s.replace("plus", "minus");
			img_obj.setAttribute("src", s);
		}
	}

	function show_hide(div_id) {
		var img_id = "IMG_" + div_id.substring(4, div_id.length);
		var img_obj = document.getElementById(img_id);
		if (img_obj.getAttribute("src").indexOf("minus") != -1) {
			document.getElementById(div_id).style.display = "none";
		} else if (img_obj.getAttribute("src").indexOf("plus") != -1) {
			document.getElementById(div_id).style.display = "block";
		}
		changeImage(img_id);
	}

	function show(div_id) {
		var img_id = "IMG_" + div_id.substring(4, div_id.length);
		var img_obj = document.getElementById(img_id);
		if (img_obj.getAttribute("src").indexOf("plus") != -1) {
			document.getElementById(div_id).style.display = "block";
			changeImage(img_id);
		}
	}

	function hide(div_id) {
		var img_id = "IMG_" + div_id.substring(4, div_id.length);
		var img_obj = document.getElementById(img_id);
		if (img_obj.getAttribute("src").indexOf("minus") != -1) {
			document.getElementById(div_id).style.display = "none";
			changeImage(img_id);
		}
	}

 			function select_all() {
 			    var id = "N";
 				var prefix = id.concat("_");
 				var child_cnt = 1;
 				child_id = prefix.concat(child_cnt.toString());
 				while (document.getElementById(child_id) != null) {
 				    if (!document.getElementById(child_id).checked) {
 				        document.getElementById(child_id).checked = !document.getElementById(child_id).checked;
                                        updateChildNodeStatus(child_id);
 				    }
 				    child_cnt++;
 				    child_id = prefix.concat(child_cnt.toString());
 				}
 			}

 			function select_none() {
 			    select_all();
 			    var id = "N";
 				var prefix = id.concat("_");
 				var child_cnt = 1;
 				child_id = prefix.concat(child_cnt.toString());
 				while (document.getElementById(child_id) != null) {
 				    if (document.getElementById(child_id).checked) {
 				        document.getElementById(child_id).checked = !document.getElementById(child_id).checked;
                         updateChildNodeStatus(child_id);
 				    }
 					child_cnt++;
 					child_id = prefix.concat(child_cnt.toString());
 				}
 			}

             function get_selection() {
                 var checkedNodes = get_checked_nodes("N");
                 if (checkedNodes.length > 0) {
                     checkedNodes = checkedNodes.substring(1, checkedNodes.length);
                 }
                 alert(checkedNodes);
             }

        		function get_checked_nodes(id) {
                                var checkedNodes = "";
 				var child_checkedNodes = "";

 				if (document.getElementById(id) != null && document.getElementById(id).checked) {
 				    checkedNodes = checkedNodes.concat("|");
 					checkedNodes = checkedNodes.concat(id);
 				}

 				var prefix = id.concat("_");
 				var child_cnt = 1;
 				child_id = prefix.concat(child_cnt.toString());

 				while (document.getElementById(child_id) != null) {
 					child_checkedNodes = get_checked_nodes(child_id);
 					if (child_checkedNodes.length > 0) {
 						checkedNodes = checkedNodes.concat(child_checkedNodes);
 					}
 					child_cnt++;
 					child_id = prefix.concat(child_cnt.toString());
 				}
 				return checkedNodes;
 			}

   			//function expand_all() {
   			//        var prefix = "N_";
  			//        expand_node(prefix);
 			//}

	function expand_node(prefix) {
		var div = "DIV_";
		var child_cnt = 1;
		child_id = prefix.concat(child_cnt.toString());
		while (document.getElementById(div.concat(child_id)) != null) {
			show(div.concat(child_id));
			expand_node(child_id.concat("_"));
			child_cnt++;
			child_id = prefix.concat(child_cnt.toString());
		}
	}

	function getLevel(div) {
		var n = div.length;
		var c;
		var knt = 0;
		for (var i=0; i<n; i++) {
		   c = div.charAt(i);
		   if (c == "_") {
			knt++;
		   }
		}
		return knt-1;
	}

	function collapse_all() {
		var divTags = document.getElementsByTagName('div');
		for (var i=0;i<divTags.length;i++) {
			if (divTags[i].id.indexOf("DIV_N_") == 0) {
				hide(divTags[i].id);
			}
		}
	}

     function expand(level) {
         expand_all();
         collapse_all();
         var divTags = document.getElementsByTagName('div');

 		for (var i=0;i<divTags.length;i++) {
 		    var div_id = divTags[i].id;
 		    if (divTags[i].id.indexOf("DIV_N_") >= 0) {
 				if (divTags[i].id.indexOf("DIV_N_") == 0) {

 					if (getLevel(div_id) <= level) {

 						document.getElementById(div_id).style.display = "block";
 						var img_id = "IMG_" + div_id.substring(4, div_id.length);
 						changeImage(img_id);
 					}
 				}
 		    }
 		}
    }

	function expand_tree() {
	    var level = document.getElementById('level').value;
	    expand(level);
	}

                        function onValueSetNodeClicked(node_id) {
				var url="/ncitbrowser/ajax?action=create_src_vs_tree&vsd_uri=" + node_id;
				window.location.href = url;
				return false ;
			}

                        function getCheckedVocabularies() {
                        alert("getCheckedVocabularies");

			    var inputCheckBox = document.getElementsByTagName("input");
			    var checked_vocabularies = "";
			    var knt = 0;
			    for(var i=0; i<inputCheckBox.length; i++){
			        if (document.getElementById(inputCheckBox[i]).checked) {
			            knt++;
			            if (knt > 1) {
			                checked_vocabularies.append(",");
			            }
			            alert(inputCheckBox[i].id);

			            checked_vocabularies.append(inputCheckBox[i].id);
			        }
			    }
			    alert(checked_vocabularies);
			}

	function expand_all() {
		var divTags = document.getElementsByTagName('div');
		for (var i=0;i<divTags.length;i++) {
			if (divTags[i].id.indexOf("DIV_N_") == 0) {
				show(divTags[i].id);
			}
		}
	}

			function getCollapseDivID() {
				var divTags = document.getElementsByTagName('div');
				var div_id = "";
				for (var i=0;i<divTags.length;i++) {
					if (divTags[i].id.indexOf("DIV_N_") == 0) {
						var num = divTags[i].id.substring(6, divTags[i].id.length);
						var img_id = "IMG_N_" + num;
						var img_obj = document.getElementById(img_id);
						if (img_obj.getAttribute("src").indexOf("plus") != -1) {
						    return divTags[i].id;
						}
					}
				}
			}


text:
package org.apache.sling.distribution.serialization.impl.vlt;

import javax.annotation.Nonnull;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;

import org.apache.jackrabbit.vault.packaging.VaultPackage;
import org.apache.sling.distribution.DistributionRequestType;
import org.apache.sling.distribution.packaging.DistributionPackage;
import org.apache.sling.distribution.packaging.DistributionPackageInfo;
import org.apache.sling.distribution.serialization.impl.AbstractDistributionPackage;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * a FileVault {@link org.apache.sling.distribution.packaging.DistributionPackage}
 */
public class FileVaultDistributionPackage extends AbstractDistributionPackage implements DistributionPackage {

    Logger log = LoggerFactory.getLogger(FileVaultDistributionPackage.class);

    private final VaultPackage pkg;

    public FileVaultDistributionPackage(String type, VaultPackage pkg) {
        super(pkg.getFile().getAbsolutePath(), type);
        this.pkg = pkg;
        String[] paths = VltUtils.getPaths(pkg.getMetaInf());

        this.getInfo().put(DistributionPackageInfo.PROPERTY_REQUEST_PATHS, paths);
        this.getInfo().put(DistributionPackageInfo.PROPERTY_REQUEST_TYPE, DistributionRequestType.ADD);
    }

    @Nonnull
    public InputStream createInputStream() throws IOException {
        return new FileInputStream(pkg.getFile());
    }

    public void close() {
        pkg.close();
    }

    public void delete() {
        try {
            VltUtils.deletePackage(pkg);
        } catch (Throwable e) {
            log.error("cannot delete file", e);
        }
    }

    @Override
    public String toString() {
        return "FileVaultDistributionPackage{" +
                "id='" + getId() + '\'' +
                ", pkg=" + pkg +
                '}';
    }
}


text:
function createFilePropElement(pathToSave, cellType)

f=fopen([pathToSave '/data/file_prop_elem.dat'],'w');

fprintf(f,'1\n');
fprintf(f,'1 1 0 1 1.0\n');

fclose(f);

disp('File file_prop_elem.dat created')


text:
package com.fasterxml.jackson.databind.mixins;

import java.io.*;
import java.util.*;

import com.fasterxml.jackson.annotation.*;
import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
import com.fasterxml.jackson.databind.*;
import com.fasterxml.jackson.databind.json.JsonMapper;

public class TestMixinSerForClass
    extends BaseMapTest
{
    @JsonInclude(JsonInclude.Include.ALWAYS)
    static class BaseClass
    {
        protected String _a, _b;
        protected String _c = "c";

        protected BaseClass() { }

        public BaseClass(String a) {
            _a = a;
        }

        // will be auto-detectable unless disabled:
        public String getA() { return _a; }

        @JsonProperty
        public String getB() { return _b; }

        @JsonProperty
        public String getC() { return _c; }
    }

    @JsonInclude(JsonInclude.Include.NON_DEFAULT)
    static class LeafClass
        extends BaseClass
    {
        public LeafClass() { super(null); }

        public LeafClass(String a) {
            super(a);
        }
    }

    /**
     * This interface only exists to add "mix-in annotations": that is, any
     * annotations it has can be virtually added to mask annotations
     * of other classes
     */
    @JsonInclude(JsonInclude.Include.NON_NULL)
    interface MixIn { }

    // test disabling of autodetect...
    @JsonAutoDetect(getterVisibility=Visibility.NONE, fieldVisibility=Visibility.NONE)
    interface MixInAutoDetect { }

    // [databind#245]
    @JsonFilter(PortletRenderExecutionEventFilterMixIn.FILTER_NAME)
    private interface PortletRenderExecutionEventFilterMixIn {
        static final String FILTER_NAME = "PortletRenderExecutionEventFilter";
    }

    // [databind#3035]
    static class Bean3035 {
        public int getA() { return 42; }
    }

    static class Rename3035Mixin extends Bean3035 {
        @JsonProperty("b")
        @Override
        public int getA() { return super.getA(); }
    }

    /*
    /**********************************************************************
    /* Test methods
    /**********************************************************************
     */

    private final ObjectMapper MAPPER = newJsonMapper();

    public void testClassMixInsTopLevel() throws IOException
    {
        Map<String,Object> result;

        // first: with no mix-ins:
        result = writeAndMap(MAPPER, new LeafClass("abc"));
        assertEquals(1, result.size());
        assertEquals("abc", result.get("a"));

        // then with top-level override
        ObjectMapper mapper = new ObjectMapper();
        mapper.addMixIn(LeafClass.class, MixIn.class);
        result = writeAndMap(mapper, new LeafClass("abc"));
        assertEquals(2, result.size());
        assertEquals("abc", result.get("a"));
        assertEquals("c", result.get("c"));

        // mid-level override; should not have any effect
        mapper = new ObjectMapper();
        mapper.addMixIn(BaseClass.class, MixIn.class);
        result = writeAndMap(mapper, new LeafClass("abc"));
        assertEquals(1, result.size());
        assertEquals("abc", result.get("a"));
    }

    public void testClassMixInsMidLevel() throws IOException
    {
        Map<String,Object> result;
        LeafClass bean = new LeafClass("xyz");
        bean._c = "c2";

        // with no mix-ins first...
        result = writeAndMap(MAPPER, bean);
        assertEquals(2, result.size());
        assertEquals("xyz", result.get("a"));
        assertEquals("c2", result.get("c"));

        // then with working mid-level override, which effectively suppresses 'a'
        ObjectMapper mapper = new ObjectMapper();
        mapper.addMixIn(BaseClass.class, MixInAutoDetect.class);
        result = writeAndMap(mapper, bean);
        assertEquals(1, result.size());
        assertEquals("c2", result.get("c"));

        // and related to [databind#245], apply mix-ins to a copy of ObjectMapper
        ObjectMapper mapper2 = new ObjectMapper();
        result = writeAndMap(mapper2, bean);
        assertEquals(2, result.size());
        ObjectMapper mapper3 = mapper2.copy();
        mapper3.addMixIn(BaseClass.class, MixInAutoDetect.class);
        result = writeAndMap(mapper3, bean);
        assertEquals(1, result.size());
        assertEquals("c2", result.get("c"));
    }

    // [databind#3035]: ability to remove mix-ins:
    public void testClassMixInRemoval() throws Exception
    {
        // First, no mix-in
        assertEquals(a2q("{'a':42}"), MAPPER.writeValueAsString(new Bean3035()));

        // then with mix-in
        assertEquals(a2q("{'b':42}"),
                JsonMapper.builder()
                    .addMixIn(Bean3035.class, Rename3035Mixin.class)
                    .build()
                    .writeValueAsString(new Bean3035()));

        // and then with a convoluted example to verify removal can work:
        assertEquals(a2q("{'a':42}"),
                JsonMapper.builder()
                    .addMixIn(Bean3035.class, Rename3035Mixin.class)
                    .removeMixIn(Bean3035.class)
                    .build()
                    .writeValueAsString(new Bean3035()));
    }
}


text:
package resource

import (
	"github.com/google/go-github/v39/github"
	"regexp"
	"strconv"
	"time"
)

var defaultTagFilter = "^v?([^v].*)"

type versionParser struct {
	re *regexp.Regexp
}

func newVersionParser(filter string) (versionParser, error) {
	if filter == "" {
		filter = defaultTagFilter
	}
	re, err := regexp.Compile(filter)
	if err != nil {
		return versionParser{}, err
	}
	return versionParser{re: re}, nil
}

func (vp *versionParser) parse(tag string) string {
	matches := vp.re.FindStringSubmatch(tag)
	if len(matches) > 0 {
		return matches[len(matches)-1]
	}
	return ""
}

func getTimestamp(release *github.RepositoryRelease) time.Time {
	if release.PublishedAt != nil {
		return release.PublishedAt.Time
	} else if release.CreatedAt != nil {
		return release.CreatedAt.Time
	} else {
		return time.Time{}
	}
}

func versionFromRelease(release *github.RepositoryRelease) Version {
	v := Version{
		ID:        strconv.FormatInt(*release.ID, 10),
		Timestamp: getTimestamp(release),
	}
	if release.TagName != nil {
		v.Tag = *release.TagName
	}
	return v
}


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

import ASIS_Controller.*;
import asis.ASISSaveFile.GUISettings;
import asis.gui.*;
import asis.ini_asis.TweakIniList;
import java.awt.Color;
import java.awt.Font;
import java.awt.Point;
import java.io.File;
import java.io.IOException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import javax.sound.sampled.*;
import javax.sound.sampled.LineEvent.Type;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import lev.gui.LSaveFile;
import org.ini4j.Config;
import org.ini4j.Ini;
import skyproc.*;
import skyproc.gui.SPMainMenuPanel;
import skyproc.gui.SPProgressBarPlug;
import skyproc.gui.SUM;
import skyproc.gui.SUMGUI;

/**
 *
 * @author pc tech
 */
public class ASIS implements SUM {

    public static String ASISlanguage;
    static ArrayList<String> modExclusions = new ArrayList<>(0);
    public static final RecordValidator validNPCs_NoScripts = new RecordValidator() {
        @Override
        public boolean useDeleted() {
            return false;
        }

        @Override
        public boolean isRejectedTemplate(MajorRecord rec) {
            NPC_ n = (NPC_) rec;
            if (n != null) {
                return n.isTemplated() && n.get(NPC_.TemplateFlag.USE_SCRIPTS);
            }
            return true;
        }
    };
    public static final RecordValidator validNPCs_NoSpellsPerks = new RecordValidator() {
        @Override
        public boolean useDeleted() {
            return false;
        }

        @Override
        public boolean isRejectedTemplate(MajorRecord rec) {
            NPC_ n = (NPC_) rec;
            if (n != null) {
                return n.isTemplated() && n.get(NPC_.TemplateFlag.USE_SPELL_LIST);
            }
            return true;
        }
    };
    Map settingsMap;
    public static boolean debug;
    //Stores the memory for the program, read from the ini and then restarts the program.
    public static int memory;
    private String finishedSound;
    //Stores the save file to store user settings on the disk.
    public static LSaveFile save = new ASISSaveFile();
    //Colors used in the GUI.
    static public Color blue = new Color(0, 147, 196);
    static public Color green = new Color(67, 162, 10);
    static public Color darkGreen = new Color(61, 128, 21);
    static public Color orange = new Color(247, 163, 52);
    static public Color yellow = new Color(255, 204, 26);
    static public Color lightGray = new Color(190, 190, 190);
    static public Color darkGray = new Color(110, 110, 110);
    public static Color headerColor = new Color(66, 181, 184);  // Teal
    public static Color settingsColor = new Color(72, 179, 58);  // Green
    //Fonts used in the GUI.
    static public Font settingsFont = new Font("Serif", Font.BOLD, 14);
    static public Font settingsFontSmall = new Font("Serif", Font.BOLD, 12);
    //The Main Menu panel for the background.
    static public SPMainMenuPanel settingsMenu;
    //All the individual panels for editing settings.
    //static public Settings settingsPanel;
    static public SettingsIncreasedSpawns settingsIncreasedSpawns;
    static public SettingsSpawnRandomizer settingsSpawnRandomizer;
    static public SettingsNPCPotions settingsNPCPotions;
    static public SettingsAutomaticPerks settingsAutomaticPerks;
    static public SettingsAutomaticSpells settingsAutomaticSpells;
    static public SettingsCustomizedAI settingsCustomizedAI;
    static public SettingsCustomizedGMSTs settingsCustomizedGMSTs;
    static public SettingsNPCEnchantFix settingsNPCEnchantFix;
    static public OtherSettingsPanel otherSettingsPanel;
    // Version
    public static final String version = "1.42.5";
    //Number of progress steps.
    final static int numSteps = 30;
    static int steps = 0;
    //Tweak INI's
    public TweakIniList tweakInis;

    // records changed by modules
    static final Set<FormID> npcsToWrite = new HashSet<>();
    static Ini asisIni;

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {// throws IOException, Exception {
        //ArrayList<String> arguments = new ArrayList<>(Arrays.asList(args));
        //ASIS main = new ASIS();
        //main.processINI();

        /*if (!arguments.contains("-nonew") && memory != 0) {
         *
         * NiftyFunc.allocateMoreMemory("100m", memory + "m", "ASIS.jar", "-nonew");
         * }
         *SPGlobal.setGlobalPatch(main.getExportPatch());
         */
        //save.init();
        try {
            SPGlobal.createGlobalLog();

//            List<String> temp = Arrays.asList(args);
//            if (!temp.contains("-NOBOSS")) {
//                List<String> newList = new ArrayList<>(temp);
//                newList.add("-NOBOSS");
//                args = newList.toArray(new String[0]);
//            }
            SUMGUI.open(new ASIS(), args);
        } catch (Exception e) {
            // If a major error happens, print it everywhere and display a message box.
            System.err.println(e.toString());
            SPGlobal.logException(e);
            JOptionPane.showMessageDialog(null, "There was an exception thrown during program execution: '" + e + "'  Check the debug logs or contact the author.");
            SPGlobal.closeDebug();
        }

    }

    @Override
    public String description() {
        return "The patcher for ASIS.";
    }

    @Override
    public void runChangesToPatch() throws Exception {
        SPGlobal.loggingSync(true);
        SPGlobal.logging(true);
//        SPGlobal.getGlobalPatch().setFlag(Mod.Mod_Flags.STRING_TABLED, false);

        SPProgressBarPlug.setMax(numSteps);
        SPProgressBarPlug.setStatus("Initializing ASIS");

        asis();
    }

    public void asis() throws Exception {
        //SPProgressBarPlug.setStatus("Starting Import Process");
        //SPGUI.progress.pause(true);

        if (asis.ASIS.debug) {
            setSkyProcGlobalDebug();
        }

        //Mod patch = runModSetup();
        getTweakIniSetup();

        runClasses();

        SPProgressBarPlug.incrementBar();
    }

    public ArrayList<String> getModExclusions() {
        return modExclusions;
    }

    public TweakIniList getTweakIni() {
        return tweakInis;
    }

    private void setSkyProcGlobalDebug() {
//        SPGlobal.createGlobalLog();
//        SPGlobal.debugModMerge = true;
    }

    private void runClasses() throws IOException {
        Controller asisController = new Controller();
        UnTemplate unTemplateNpcs = new UnTemplate();

        Set<FormID> unTemplated = new HashSet<>();
        Mod patch = SPGlobal.getGlobalPatch();
        for (NPC_ n : patch.getNPCs()) {
            unTemplated.add(n.getForm());
        }

        if (save.getBool(GUISettings.AUTOMATICSPELLS_ON)) {
            SPProgressBarPlug.setStatus("Processing Automatic Spells");
            AutomaticSpellsModule spells = new AutomaticSpellsModule();
            asisController.runModule(spells);
        }
        SPProgressBarPlug.incrementBar();

        if (save.getBool(GUISettings.INCREASEDSPAWNS_ON)) {
            SPProgressBarPlug.setStatus("Processing Increased Spawns");
            IncreasedSpawnsModule increasedSpawns = new IncreasedSpawnsModule();
            asisController.runModule(increasedSpawns);
        }
        SPProgressBarPlug.incrementBar();

        if (save.getBool(GUISettings.NPCPOTIONS_ON)) {
            SPProgressBarPlug.setStatus("Processing NPCPotions");
            ASISnpcPotionsModule npcPotions = new ASISnpcPotionsModule();
            asisController.runModule(npcPotions);
        }
        SPProgressBarPlug.incrementBar();

        if (save.getBool(GUISettings.CUSTOMIZEDAI_ON)) {
            SPProgressBarPlug.setStatus("Processing Customized AI");
            CustomizedAI myCustomizedAI = new CustomizedAI();
            myCustomizedAI.runCustomizedAI(this);
        }
        SPProgressBarPlug.incrementBar();

        if (save.getBool(GUISettings.AUTOMATICPERKS_ON)) {
            SPProgressBarPlug.setStatus("Processing Automatic Perks");
            AutomaticPerksModule perks = new AutomaticPerksModule();
            asisController.runModule(perks);
        }
        SPProgressBarPlug.incrementBar();

        if (save.getBool(GUISettings.SPAWNRANDOMIZER_ON)) {
            SPProgressBarPlug.setStatus("Processing Spawn Randomizer");
            RandomSpawnsModule randomSpawns = new RandomSpawnsModule();
            asisController.runModule(randomSpawns);
        }
        SPProgressBarPlug.incrementBar();

        if (save.getBool(GUISettings.CUSTOMIZEDGMSTS_ON)) {
            SPProgressBarPlug.setStatus("Processing Customized GMSTs");
            customizedGMSTs customGMSTs = new customizedGMSTs();
            customGMSTs.runCustomizedGMSTs(this);
        }
        SPProgressBarPlug.incrementBar();

        if (save.getBool(GUISettings.NPCENCHANTFIX_ON)) {
            SPProgressBarPlug.setStatus("Processing NPC Enchantment Fix");
            npcEnchantModule npcEnchantFix = new npcEnchantModule();
            asisController.runModule(npcEnchantFix);
        }
        SPProgressBarPlug.incrementBar();

        unTemplated.removeAll(npcsToWrite);
        for (FormID f : unTemplated) {
            patch.remove(f);
        }

    }

    private void getTweakIniSetup() {
        try {
            tweakInis = new TweakIniList();
        } catch (Exception e) {
            JOptionPane.showMessageDialog(null, "There was an error with Tweak Inis.  Please contact the author.");
        }
    }

    public String getLanguage() {
        return ASISlanguage;
    }

    @Override
    public String getName() {
        return "ASIS";
    }

    @Override
    public GRUP_TYPE[] importRequests() {
        return new GRUP_TYPE[]{
            GRUP_TYPE.NPC_,
            GRUP_TYPE.SPEL,
            GRUP_TYPE.MGEF,
            GRUP_TYPE.PERK,
            GRUP_TYPE.LVLI,
            GRUP_TYPE.LVLN,
            GRUP_TYPE.FACT,
            GRUP_TYPE.AVIF,
            GRUP_TYPE.GLOB,
            GRUP_TYPE.KYWD
        };
    }

    @Override
    public boolean importAtStart() {
        return false;
    }

    @Override
    public boolean hasStandardMenu() {
        return true;
    }

    @Override
    public SPMainMenuPanel getStandardMenu() {
        settingsMenu = new SPMainMenuPanel(blue);
        settingsMenu.setVersion(version, new Point(80, 88));
        SUMGUI.helpPanel.setHeaderFont(new Font("Serif", Font.BOLD, 18));

        settingsIncreasedSpawns = new SettingsIncreasedSpawns(settingsMenu);
        settingsMenu.addMenu(settingsIncreasedSpawns, true, save, GUISettings.INCREASEDSPAWNS_ON);

        settingsAutomaticPerks = new SettingsAutomaticPerks(settingsMenu);
        settingsMenu.addMenu(settingsAutomaticPerks, true, save, GUISettings.AUTOMATICPERKS_ON);

        settingsAutomaticSpells = new SettingsAutomaticSpells(settingsMenu);
        settingsMenu.addMenu(settingsAutomaticSpells, true, save, GUISettings.AUTOMATICSPELLS_ON);

        settingsCustomizedAI = new SettingsCustomizedAI(settingsMenu);
        settingsMenu.addMenu(settingsCustomizedAI, true, save, GUISettings.CUSTOMIZEDAI_ON);

        settingsCustomizedGMSTs = new SettingsCustomizedGMSTs(settingsMenu);
        settingsMenu.addMenu(settingsCustomizedGMSTs, true, save, GUISettings.CUSTOMIZEDGMSTS_ON);

        settingsNPCPotions = new SettingsNPCPotions(settingsMenu);
        settingsMenu.addMenu(settingsNPCPotions, true, save, GUISettings.NPCPOTIONS_ON);

        settingsSpawnRandomizer = new SettingsSpawnRandomizer(settingsMenu);
        settingsMenu.addMenu(settingsSpawnRandomizer, true, save, GUISettings.SPAWNRANDOMIZER_ON);

        settingsNPCEnchantFix = new SettingsNPCEnchantFix(settingsMenu);
        settingsMenu.addMenu(settingsNPCEnchantFix, true, save, GUISettings.NPCENCHANTFIX_ON);

//        otherSettingsPanel = new OtherSettingsPanel(settingsMenu);
//        settingsMenu.addMenu(otherSettingsPanel, false, save, GUISettings.OTHER_SETTINGS);
        return settingsMenu;
    }

    @Override
    public boolean hasCustomMenu() {
        return false;
    }

    @Override
    public boolean hasLogo() {
        return false;
    }

    @Override
    public URL getLogo() {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public boolean hasSave() {
        return true;
    }

    @Override
    public LSaveFile getSave() {
        return save;
    }

    @Override
    public String getVersion() {
        return version;
    }

    @Override
    public ModListing getListing() {
        return new ModListing("ASIS", false);
    }

    @Override
    public Mod getExportPatch() {
        Mod patch = new Mod(getListing());
        patch.setFlag(Mod.Mod_Flags.STRING_TABLED, false);
        patch.setAuthor("Pluto and Dres Croffgrin");
        return patch;
    }

    @Override
    public Color getHeaderColor() {
        return blue;
    }

    @Override
    public GRUP_TYPE[] dangerousRecordReport() {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public JFrame openCustomMenu() {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public boolean needsPatching() {
        return true;
    }

    @Override
    public void onStart() throws Exception {
        processINI();
        SPGlobal.Language lang;
        try {
            lang = SPGlobal.Language.valueOf(ASISlanguage);
        } catch (EnumConstantNotPresentException e) {
            lang = SPGlobal.Language.English;
        }
        SPGlobal.language = lang;
    }

    @Override
    public void onExit(boolean patchWasGenerated) throws Exception {
        if ( (finishedSound != null) && !finishedSound.isEmpty()){
            try {
                File soundFile = new File(finishedSound);
                playClip(soundFile);
            } catch (IOException | InterruptedException | LineUnavailableException | UnsupportedAudioFileException ex){
                SPGlobal.log("OnExit", "Could not play sound: " + ex);
            }
        }
        SPGlobal.logMain("EXIT", "Closing ASIS.");
    }

    @Override
    public ArrayList<ModListing> requiredMods() {
        return new ArrayList<>(Arrays.asList(new ModListing("ASIS-Dependency.esp")));
    }

    enum INItypes {

        LANGUAGE,
        MODEXCLUSIONS
    }

    private void processINI() throws IOException {
        SPProgressBarPlug.setStatus("ASIS: Processing INI");
        SPProgressBarPlug.incrementBar();
        //Sets up the file reader for the ini file.
        asisIni = new Ini();
        Config c = asisIni.getConfig();
        c.setEmptyOption(true);
        c.setEmptySection(true);
        c.setEscape(false);
        asisIni.load(new File("ASIS.ini"));

        Ini.Section lang = asisIni.get("LANGUAGE");
        try {
            Set<String> langKeys = lang.keySet();
            ASISlanguage = langKeys.iterator().next();
        } catch (Exception e) {
            ASISlanguage = "English";
        }

        Ini.Section exclusions = asisIni.get("ModExclusions");
        modExclusions.addAll(exclusions.keySet());

        Ini.Section settings = asisIni.get("Settings");
        try {
            debug = Boolean.parseBoolean(settings.get("debug"));
        } catch (Exception e) {
            debug = false;
        }
        try {
            memory = Integer.parseInt(settings.get("memory"));
        } catch (NumberFormatException numberFormatException) {
            memory = 1024;
        }

        try {
            finishedSound = settings.get("finishedSound");
        } catch (Exception e) {
            finishedSound = "";
        }

    }

    public static Ini getAsisIni() {
        return asisIni;
    }

    private static void playClip(File clipFile) throws IOException,
            UnsupportedAudioFileException, LineUnavailableException, InterruptedException {
        class AudioListener implements LineListener {

            private boolean done = false;

            @Override
            public synchronized void update(LineEvent event) {
                Type eventType = event.getType();
                if (eventType == Type.STOP || eventType == Type.CLOSE) {
                    done = true;
                    notifyAll();
                }
            }

            public synchronized void waitUntilDone() throws InterruptedException {
                while (!done) {
                    wait();
                }
            }
        }
        AudioListener listener = new AudioListener();
        try (AudioInputStream audioInputStream = AudioSystem.getAudioInputStream(clipFile)) {
            Clip clip = AudioSystem.getClip();
            clip.addLineListener(listener);
            clip.open(audioInputStream);
            try {
                clip.start();
                listener.waitUntilDone();
            } finally {
                clip.close();
            }
        }
    }
}


text:
cd `dirname $0`
script=$PWD/`basename $0 .sh`.rb
base=/var/www/bridgepdx_ocw
report=$base/`basename $0 .sh`.txt
cd $base/current
./script/runner -e production $script | tee $report
echo "# Saved report to: $report"


text:
/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.nomencurator.gui.swing;

import java.awt.Dimension;

import javax.swing.JTable;
import javax.swing.ListSelectionModel;

import javax.swing.table.TableModel;
import javax.swing.table.TableColumnModel;

/**
 * {@code ViewportSizedTable} is a {@code JTable}.
 * having specified viewport size
 *
 * @see http://www.nomencurator.org/
 * @see javax.swing.JTable
 *
 * @version 	29 June 2016
 * @author 	Nozomi `James' Ytow
 */
public class ViewportSizedTable
    extends JTable
{
    private static final long serialVersionUID = -6859738296881435093L;

    public static final int DEFAULT_ROWS = 4;

    protected int viewportRows;

    public ViewportSizedTable()
    {
	this(null);
    }

    public ViewportSizedTable(TableModel dataModel)
    {
	this(dataModel, null);
    }

    public ViewportSizedTable(TableModel dataModel, int rows)
    {
	this(dataModel, null, rows);
    }

    public ViewportSizedTable(TableModel dataModel, TableColumnModel columnModel)
    {
        this(dataModel, columnModel, null);
    }

    public ViewportSizedTable(TableModel dataModel, TableColumnModel columnModel, int rows)
    {
        this(dataModel, columnModel, null, rows);
    }

    public ViewportSizedTable(TableModel dataModel,
			      TableColumnModel columnModel,
			      ListSelectionModel selectionModel)
    {
        this(dataModel, columnModel, selectionModel, DEFAULT_ROWS);
    }

    public ViewportSizedTable(TableModel dataModel,
			      TableColumnModel columnModel,
			      ListSelectionModel selectionModel,
			      int rows)
    {
	super(dataModel, columnModel, selectionModel);
	setViewportRows(rows);
    }

    public int getViewportRows()
    {
	return viewportRows;
    }

    public void setViewportRows(int rows)
    {
	if(viewportRows == rows)
	    return;
	if(rows > 0) {
	    Dimension d = getPreferredScrollableViewportSize();
	    d.height = rows * getRowHeight();
	    if(getShowHorizontalLines())
		d.height += (rows - 1) * getRowMargin();
	    setPreferredScrollableViewportSize(d);
	}
    }
}


text:
layout: post
title: "Tmux"
tags:
- Tmux
---

Tmux is a program used to multiplex several virtual consoles akin to GNU Screen (parphrased form [Wikipedia](https://en.wikipedia.org/wiki/Tmux)). This means that whith this program one can open a new shell and exit it while this shell keeps running or also one can reconnect to an alredy running shell.

This is very practical when connect over SSH to a remote computer as one might not want to interrupt a task if suddently the connection to the remote host is lost. Also imagine running an intensive task on a remote machine and then having to terminate the connection because you have to shutdown your computer or similar.

Below there is a biref cheat sheet which was obtained by seraching for [tmux cheat sheet on Duck Duck go](https://duckduckgo.com/?q=tmux+cheat+sheet&ia=answer).

## Session Control (from the command line)
| Command        | Note                                                        |
|:---------------|:------------------------------------------------------------|
| tmux 	         | Start a new session                                         |
| tmux attach    | Re-attach a detached session                                |
| tmux attach -d | Re-attach a detached session (and detach it from elsewhere) |

## Pane Control (from whithin tmux)
| Command        | Note                                                        |
|:---------------|:------------------------------------------------------------|
| Ctrl-B "       | Split pane horizontally                                     |
| Ctrl-B %       | Split pane vertically                                       |
| Ctrl-B o       | Next pane                                                   |
| Ctrl-B ;       | Previous pane                                               |
| Ctrl-B x       | Kill current pane                                           |
| Ctrl-B !       | Kill all panes but the current one                          |
| Ctrl-B Ctrl-O  | Swap panes                                                  |
| Ctrl-B t       | Display clock                                               |
| Ctrl-B q       | Transpose two letters (delete and paste)                    |

## Window Control (from whithin tmux)
| Command        | Note                                                        |
|:---------------|:------------------------------------------------------------|
| Ctrl-B c       | Create new window                                           |
| Ctrl-B d       | Detach from session                                         |
| Ctrl-B ,       | Rename a window                                             |
| Ctrl-B w       | List windows                                                |

## Copy-Mode (Emacs) (from whithin tmux)
| Command        | Note                                                        |
|:---------------|:------------------------------------------------------------|
| Ctrl-B [       | Enter copy mode |
| Ctrl-B M-<     | Bottom of history |
| Ctrl-B M->     | Top of histroy |
| Ctrl-B M-w     | Copy selection |
| Ctrl-B M-y     | Paste selection |
| Ctrl-B Up      | Cursor Up |
| Ctrl-B Down    | Cursor Down |
| Ctrl-B Left    | Cursor Left |
| Ctrl-B Right   | Cursor Right |

## Copy-Mode (vi) (from whithin tmux)
| Command        | Note                                                        |
|:---------------|:------------------------------------------------------------|
| Ctrl-B [       | Enter copy mode |
| Ctrl-B G       | Bottom of history |
| Ctrl-B g       | Top of histroy |
| Ctrl-B Enter   | Copy selection |
| Ctrl-B p       | Paste selection |
| Ctrl-B k       | Cursor Up |
| Ctrl-B j       | Cursor Down |
| Ctrl-B h       | Cursor Left |
| Ctrl-B l       | Cursor Right |


text:
from django.apps import AppConfig

class WagtailSettingsAppConfig(AppConfig):
    name = 'wagtail.contrib.settings'
    label = 'wagtailsettings'
    verbose_name = "Wagtail site settings"


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

namespace AOC2020.Day05
{
    public class Puzzle : PuzzleBase<int, int>
    {
        public Puzzle(IEnumerable<string> input)
        {
            _seats = input.Select(line => GetSeatId(line)).ToHashSet();
        }

        private readonly HashSet<int> _seats;

        public static int GetSeatId(string seat)
        {
            var sum = 0;
            foreach (var l in seat)
            {
                sum *= 2;
                sum += (l == 'B' || l == 'R') ? 1 : 0;
            }
            return sum;
        }

        public override int Solution1() => _seats.Max();

        public override int Solution2() =>
            Enumerable.Range(_seats.Min(), _seats.Max() - _seats.Min())
                .FirstOrDefault(s => !_seats.Contains(s) && _seats.Contains(s - 1) && _seats.Contains(s + 1));

    }
}


text:
function paintButton() {
	function setClass(elements, display) {
		for ( var i in elements)
			try {
				elements[i].style.display = display;
			} catch (err) {
			}
	}

	var z = {
		display : null,
		control : null,
		sources : null,
		label : " LaTeX for Z notation (or press 'z')",
		toggle : function() {
			if (!this.display) {
				setClass(this.sources, "block");
				this.control.removeChild(this.control.childNodes[0]);
				this.control.appendChild(document.createTextNode("Hide"
						+ this.label));
				this.display = true;
			} else {
				setClass(this.sources, "none");
				this.control.removeChild(this.control.childNodes[0]);
				this.control.appendChild(document.createTextNode("Display"
						+ this.label));
				this.display = false;
			}
		},
		prepare : function() {
			var intro = document.getElementById("intro");
			var p = document.createElement("p");
			this.control = document.createElement("button");
			this.control.appendChild(document.createTextNode("Display"
					+ this.label));
			p.appendChild(this.control);
			intro.appendChild(p);
			this.control.addEventListener("click", function() {
				z.toggle();
			}, false);
			this.sources = document.getElementsByClassName("Z-source");
			this.display = false;
			setClass(this.sources, "none");
		}
	};

	var g = {
		display : null,
		sources : null,
		toggle : function() {
			if (!this.display) {
				setClass(this.sources, "block");
				this.display = true;
			} else {
				setClass(this.sources, "none");
				this.display = false;
			}
		},
		prepare : function() {
			this.sources = document.getElementsByClassName("math-display");
			this.display = false;
			setClass(this.sources, "none");
		}
	};

	z.prepare();
	// g.prepare();
	window.onkeypress = function(evt) {
		var code = evt.keyCode ? evt.keyCode : evt.charCode
		if (code == 90 || code == 122)
			z.toggle();
		// else if (code == 71 || code == 103)
		// g.toggle();
	}
}


text:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

        <TextView
		android:text="@string/route_label"
		android:layout_height="wrap_content"
		android:layout_width="wrap_content"
		android:layout_gravity="left"
		android:textSize="18sp"
		android:layout_marginRight="5dip"
		android:textColor="#ffffff"
		android:textStyle="bold" />

    <Spinner
		android:id="@+id/route_spinner"
		android:layout_width="wrap_content"
		android:layout_height="wrap_content" />

    <TextView
		android:text="@string/bus_stop_label"
		android:layout_height="wrap_content"
		android:layout_width="wrap_content"
		android:layout_gravity="left"
		android:textSize="18sp"
		android:layout_marginRight="5dip"
		android:textColor="#ffffff"
		android:textStyle="bold" />

    <Spinner
		android:id="@+id/stop_spinner"
		android:layout_width="wrap_content"
		android:layout_height="wrap_content" />

    <TimePicker
        android:id="@+id/scheduleTimePicker"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" />

    <Button
        android:id="@+id/selectButton"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:onClick="onDateSelectedButtonClick"
        android:text="Set notification for this time" />

</LinearLayout>