text:
package com.github.difflib.unifieddiff;

import com.github.difflib.patch.AbstractDelta;
import java.io.IOException;
import java.io.Writer;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 * @todo use an instance to store contextSize and originalLinesProvider.
 * @author Tobias Warneke (t.warneke@gmx.net)
 */
public class UnifiedDiffWriter {

    private static final Logger LOG = Logger.getLogger(UnifiedDiffWriter.class.getName());

    public static void write(UnifiedDiff diff, Function<String, List<String>> originalLinesProvider, Writer writer, int contextSize) throws IOException {
        Objects.requireNonNull(originalLinesProvider, "original lines provider needs to be specified");
        write(diff, originalLinesProvider, line -> {
            try {
                writer.append(line).append("\n");
            } catch (IOException ex) {
                LOG.log(Level.SEVERE, null, ex);
            }
        }, contextSize);
    }

    public static void write(UnifiedDiff diff, Function<String, List<String>> originalLinesProvider, Consumer<String> writer, int contextSize) throws IOException {
        if (diff.getHeader() != null) {
            writer.accept(diff.getHeader());
        }

        for (UnifiedDiffFile file : diff.getFiles()) {
            List<AbstractDelta<String>> patchDeltas = new ArrayList<>(
                    file.getPatch().getDeltas());
            if (!patchDeltas.isEmpty()) {
                writeOrNothing(writer, file.getDiffCommand());
                if (file.getIndex() != null) {
                    writer.accept("index " + file.getIndex());
                }

                writer.accept("--- " + (file.getFromFile() == null ? "/dev/null" : file.getFromFile()));

                if (file.getToFile() != null) {
                    writer.accept("+++ " + file.getToFile());
                }

                List<String> originalLines = originalLinesProvider.apply(file.getFromFile());

                List<AbstractDelta<String>> deltas = new ArrayList<>();

                AbstractDelta<String> delta = patchDeltas.get(0);
                deltas.add(delta); // add the first Delta to the current set
                // if there's more than 1 Delta, we may need to output them together
                if (patchDeltas.size() > 1) {
                    for (int i = 1; i < patchDeltas.size(); i++) {
                        int position = delta.getSource().getPosition();

                        // Check if the next Delta is too close to the current
                        // position.
                        // And if it is, add it to the current set
                        AbstractDelta<String> nextDelta = patchDeltas.get(i);
                        if ((position + delta.getSource().size() + contextSize) >= (nextDelta
                                .getSource().getPosition() - contextSize)) {
                            deltas.add(nextDelta);
                        } else {
                            // if it isn't, output the current set,
                            // then create a new set and add the current Delta to
                            // it.
                            processDeltas(writer, originalLines, deltas, contextSize, false);
                            deltas.clear();
                            deltas.add(nextDelta);
                        }
                        delta = nextDelta;
                    }

                }
                // don't forget to process the last set of Deltas
                processDeltas(writer, originalLines, deltas, contextSize,
                        patchDeltas.size() == 1 && file.getFromFile() == null);
            }

        }
        if (diff.getTail() != null) {
            writer.accept("--");
            writer.accept(diff.getTail());
        }
    }

    private static void processDeltas(Consumer<String> writer,
            List<String> origLines, List<AbstractDelta<String>> deltas,
            int contextSize, boolean newFile) {
        List<String> buffer = new ArrayList<>();
        int origTotal = 0; // counter for total lines output from Original
        int revTotal = 0; // counter for total lines output from Original
        int line;

        AbstractDelta<String> curDelta = deltas.get(0);

        int origStart;
        if (newFile) {
            origStart = 0;
        } else {
            // NOTE: +1 to overcome the 0-offset Position
            origStart = curDelta.getSource().getPosition() + 1 - contextSize;
            if (origStart < 1) {
                origStart = 1;
            }
        }

        int revStart = curDelta.getTarget().getPosition() + 1 - contextSize;
        if (revStart < 1) {
            revStart = 1;
        }

        // find the start of the wrapper context code
        int contextStart = curDelta.getSource().getPosition() - contextSize;
        if (contextStart < 0) {
            contextStart = 0; // clamp to the start of the file
        }

        // output the context before the first Delta
        for (line = contextStart; line < curDelta.getSource().getPosition()
                && line < origLines.size(); line++) { //
            buffer.add(" " + origLines.get(line));
            origTotal++;
            revTotal++;
        }
        // output the first Delta
        getDeltaText(txt -> buffer.add(txt), curDelta);
        origTotal += curDelta.getSource().getLines().size();
        revTotal += curDelta.getTarget().getLines().size();

        int deltaIndex = 1;
        while (deltaIndex < deltas.size()) { // for each of the other Deltas
            AbstractDelta<String> nextDelta = deltas.get(deltaIndex);
            int intermediateStart = curDelta.getSource().getPosition()
                    + curDelta.getSource().getLines().size();
            for (line = intermediateStart; line < nextDelta.getSource().getPosition()
                    && line < origLines.size(); line++) {
                // output the code between the last Delta and this one
                buffer.add(" " + origLines.get(line));
                origTotal++;
                revTotal++;
            }
            getDeltaText(txt -> buffer.add(txt), nextDelta); // output the Delta
            origTotal += nextDelta.getSource().getLines().size();
            revTotal += nextDelta.getTarget().getLines().size();
            curDelta = nextDelta;
            deltaIndex++;
        }

        // Now output the post-Delta context code, clamping the end of the file
        contextStart = curDelta.getSource().getPosition()
                + curDelta.getSource().getLines().size();
        for (line = contextStart; (line < (contextStart + contextSize))
                && (line < origLines.size()); line++) {
            buffer.add(" " + origLines.get(line));
            origTotal++;
            revTotal++;
        }

        // Create and insert the block header, conforming to the Unified Diff
        // standard
        writer.accept("@@ -" + origStart + "," + origTotal + " +" + revStart + "," + revTotal + " @@");
        buffer.forEach(txt -> {
            writer.accept(txt);
        });
    }

    /**
     * getDeltaText returns the lines to be added to the Unified Diff text from the Delta parameter.
     *
     * @param writer consumer for the list of String lines of code
     * @param delta the Delta to output
     */
    private static void getDeltaText(Consumer<String> writer, AbstractDelta<String> delta) {
        for (String line : delta.getSource().getLines()) {
            writer.accept("-" + line);
        }
        for (String line : delta.getTarget().getLines()) {
            writer.accept("+" + line);
        }
    }

    private static void writeOrNothing(Consumer<String> writer, String str) throws IOException {
        if (str != null) {
            writer.accept(str);
        }
    }
}


text:
print "Let's practice everything"
print "You\'d need to know \'bout escapes with \\ that do \n newlines and \t tabs."

poem = """
\tThe lovely world
with logic so firmly planted
cannot discern \n the needs of love
nor comprehend passion from intuition
and requires an explanation
\n\t\twhere there is none.
"""

print "------------"
print poem
print "------------"

five = 10 - 2 + 3 - 6
print "This should be five: %s" % five

def secret_formula(started):
  jelly_beans = started * 500
  jars = jelly_beans / 1000
  crates = jars /100
  return jelly_beans, jars, crates

start_point = 1000
beans, jars, crates = secret_formula(start_point)

print "With a starting point of: %d" % start_point
print "We'd have %d beans, %d jars, and %d crates." % (beans, jars, crates)

start_point - start_point / 10

print "We can also do it this way:"
print "We'd have %d beans, %d jars and %d crates." % secret_formula(start_point)

redpajama_set_name: RedPajamaGithub


text:
package com.example.ocr;

import android.util.Log;

/**
 * Image binarization methods.
 *
 * @author alanv@google.com (Alan Viverette)
 */
public class Binarize {
    static {
    	try{
    		System.loadLibrary("lept");
    	}catch (UnsatisfiedLinkError e){
    		Log.d("TessBaseAPI", "TessBaseAPI UnsatisfiedLinkError.But this doesn't mean the lib was not loaded before");
    	}
    }

    // Otsu thresholding constants

    /** Desired tile X dimension; actual size may vary */
    public final static int OTSU_SIZE_X = 32;

    /** Desired tile Y dimension; actual size may vary */
    public final static int OTSU_SIZE_Y = 32;

    /** Desired X smoothing value */
    public final static int OTSU_SMOOTH_X = 2;

    /** Desired Y smoothing value */
    public final static int OTSU_SMOOTH_Y = 2;

    /** Fraction of the max Otsu score, typically 0.1 */
    public final static float OTSU_SCORE_FRACTION = 0.1f;

    /**
     * Performs locally-adaptive Otsu threshold binarization with default
     * parameters.
     *
     * @param pixs An 8 bpp PIX source image.
     * @return A 1 bpp thresholded PIX image.
     */
    public static Pix otsuAdaptiveThreshold(Pix pixs) {
        return otsuAdaptiveThreshold(
                pixs, OTSU_SIZE_X, OTSU_SIZE_Y, OTSU_SMOOTH_X, OTSU_SMOOTH_Y, OTSU_SCORE_FRACTION);
    }

    /**
     * Performs locally-adaptive Otsu threshold binarization.
     *

     * Notes:
     *

     *
The Otsu method finds a single global threshold for an image. This
     * function allows a locally adapted threshold to be found for each tile
     * into which the image is broken up.
     *
The array of threshold values, one for each tile, constitutes a
     * highly downscaled image. This array is optionally smoothed using a
     * convolution. The full width and height of the convolution kernel are (2 *
     * smoothX + 1) and (2 * smoothY + 1).
     *
The minimum tile dimension allowed is 16. If such small tiles are
     * used, it is recommended to use smoothing, because without smoothing, each
     * small tile determines the splitting threshold independently. A tile that
     * is entirely in the image bg will then hallucinate fg, resulting in a very
     * noisy binarization. The smoothing should be large enough that no tile is
     * only influenced by one type (fg or bg) of pixels, because it will force a
     * split of its pixels.
     *
To get a single global threshold for the entire image, use input
     * values of sizeX and sizeY that are larger than the image. For this
     * situation, the smoothing parameters are ignored.
     *
The threshold values partition the image pixels into two classes: one
     * whose values are less than the threshold and another whose values are
     * greater than or equal to the threshold. This is the same use of
     * 'threshold' as in pixThresholdToBinary().
     *
The scorefract is the fraction of the maximum Otsu score, which is
     * used to determine the range over which the histogram minimum is searched.
     * See numaSplitDistribution() for details on the underlying method of
     * choosing a threshold.
     *
This uses enables a modified version of the Otsu criterion for
     * splitting the distribution of pixels in each tile into a fg and bg part.
     * The modification consists of searching for a minimum in the histogram
     * over a range of pixel values where the Otsu score is within a defined
     * fraction, scoreFraction, of the max score. To get the original Otsu
     * algorithm, set scoreFraction == 0.
     *

     *
     * @param pixs An 8 bpp PIX source image.
     * @param sizeX Desired tile X dimension; actual size may vary.
     * @param sizeY Desired tile Y dimension; actual size may vary.
     * @param smoothX Half-width of convolution kernel applied to threshold
     *            array: use 0 for no smoothing.
     * @param smoothY Half-height of convolution kernel applied to threshold
     *            array: use 0 for no smoothing.
     * @param scoreFraction Fraction of the max Otsu score; typ. 0.1 (use 0.0
     *            for standard Otsu).
     * @return A 1 bpp thresholded PIX image.
     */
    public static Pix otsuAdaptiveThreshold(
            Pix pixs, int sizeX, int sizeY, int smoothX, int smoothY, float scoreFraction) {
        if (pixs == null)
            throw new IllegalArgumentException("Source pix must be non-null");
        if (pixs.getDepth() != 8)
            throw new IllegalArgumentException("Source pix depth must be 8bpp");

        int nativePix = nativeOtsuAdaptiveThreshold(
                pixs.mNativePix, sizeX, sizeY, smoothX, smoothY, scoreFraction);

        if (nativePix == 0)
            throw new RuntimeException("Failed to perform Otsu adaptive threshold on image");

        return new Pix(nativePix);
    }

    // ***************
    // * NATIVE CODE *
    // ***************

    private static native int nativeOtsuAdaptiveThreshold(
            int nativePix, int sizeX, int sizeY, int smoothX, int smoothY, float scoreFract);
}


text:
namespace remoting {
namespace protocol {

ChannelDispatcherBase::ChannelDispatcherBase(const char* channel_name)
    : channel_name_(channel_name),
      channel_factory_(NULL) {
}

ChannelDispatcherBase::~ChannelDispatcherBase() {
  if (channel_factory_)
    channel_factory_->CancelChannelCreation(channel_name_);
}

void ChannelDispatcherBase::Init(Session* session,
                                 const ChannelConfig& config,
                                 const InitializedCallback& callback) {
  DCHECK(session);
  switch (config.transport) {
    case ChannelConfig::TRANSPORT_MUX_STREAM:
      channel_factory_ = session->GetMultiplexedChannelFactory();
      break;

    case ChannelConfig::TRANSPORT_STREAM:
      channel_factory_ = session->GetTransportChannelFactory();
      break;

    default:
      NOTREACHED();
      callback.Run(false);
      return;
  }

  initialized_callback_ = callback;

  channel_factory_->CreateStreamChannel(channel_name_, base::Bind(
      &ChannelDispatcherBase::OnChannelReady, base::Unretained(this)));
}

void ChannelDispatcherBase::OnChannelReady(
    scoped_ptr<net::StreamSocket> socket) {
  if (!socket.get()) {
    initialized_callback_.Run(false);
    return;
  }

  channel_ = socket.Pass();

  OnInitialized();

  initialized_callback_.Run(true);
}

}  // namespace protocol
}  // namespace remoting


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

    <item android:drawable="@drawable/input_bg_on" android:state_pressed="false" android:state_focused="true"/>
    <item android:drawable="@drawable/input_bg"/>

</selector>


text:
"""
CALCSEEING--Determine the seeing gvine an array of magnitudes
and an array of FWHM

Author                 Version      Date
-----------------------------------------------
S M Crawford (SAAO)    0.1          19 Jun 2011

"""

import math
import numpy as np

from saltfit import *

def hist_stats(arr, bins=200, range=(0,50)):
    h=np.histogram(arr, bins=bins, range=range)
    i=h[0][:-1].argmax()
    #histogram returns the lower edge and we want the middle
    meandiff=np.diff(h[1]).mean()
    return i,h[1][:-1]+meandiff, h[0]

def mirror_hist(p_i, X, data):
   """Remove all points higher than the peak, and replace with a mirror image of the lower points"""

   ndata=data.copy()
   for i in range(len(data[:])):
       if X[i]>X[p_i]:
           j=p_i - (i-p_i)
           if j>=0:
               ndata[i]=data[j]
           else:
               ndata[i]=0
   return ndata

def seeing_stats(arr, bins=200, hrange=(0,50)):
   """Fit_stats finds the peak in a distribution, mirrors the
   data around that peak rejecting all values above the peak, and
   then returns the best Gaussian fit to that peak

   arr--array of FWHM
   bins--the number of bins for the histogram
   hrange--the range for the histogram

   """
   #create the histogram
   p_i, X, data=hist_stats(arr)
   #remove all the seeing values 'above' the peak
   ndata=mirror_hist(p_i, X, data)
   #set up the parameters to fit
   m = sum(X*ndata)/sum(ndata)
   width = (abs(sum((X-m)**2*ndata)/sum(ndata)))**0.5
   dmax=data.max()
   return m, width, dmax, X[p_i]

   #this is unreliable
   mu = Parameter(m)
   sigma = Parameter(width)
   height = Parameter(dmax)
   #return   m, width, max, X[p_i]

   #fit the data
   def f(x): return height() * np.exp(-0.5*((x-mu())/sigma())**2)

   info=fit(f, [mu, sigma, height], ndata)
   return  mu(), sigma(), height(), X[p_i]

def airmass(Z, units='degrees'):
    """Calculate the airmass for a source according to Airmass=sec(Z) where
       Z is the zenith distnce

       Z--zenith distance
       units--units of Z
    """
    if units=='degrees': Z=math.radians(Z)
    return 1.0/math.cos(Z)


text:
'use strict';

app.factory('BucketListService', function ($resource) {

    return {
        auth: $resource('/api/api-token-auth/', {}, {
            login: {
                method: 'POST'
            }
        },{
            stripTrailingSlashes: false
        }),
        verify: $resource('/api/api-token-verify/', {}, {
            token: {
                method: 'POST'
            }
        }, {
            stripTrailingSlashes: false
        }),

        users: $resource('/api/auth/signup/', {}, {
            create: {
                method: 'POST'
            }
        },{
            stripTrailingSlashes: false
        }),

        Bucketlists: $resource("/api/bucketlists/:id/", {id: "@id"}, {
            createBucket: {
                method: 'POST'
            },
            getAllBuckets: {
                method: 'GET',
                isArray: true
            },
            getOneBucket: {
                method: 'GET',
                isArray: false
            },
            updateBucket:  {
                method: 'PUT'
            },
            deleteBucket: {
                method: 'DELETE'
            }
        },{
            stripTrailingSlashes: false
        }),

        BucketlistItems: $resource("/api/bucketlists/:bid/items/:id/", {bid:"@bid", id: "@id"}, {
            createBucketItem: {
                method: 'POST'
            },
            getOneBucketItem: {
                method: 'GET',
                isArray: false
            },
            updateBucketItem:  {
                method: 'PUT'
            },
            deleteBucketItem: {
                method: 'DELETE'
            }
        },{
            stripTrailingSlashes: false
        })
    };
});

app.factory('httpRequestInterceptor', function ($localStorage) {
    return {
        request: function(config) {
            var token = $localStorage.token;
            config.headers = config.headers || {};
            if (token) {
                config.headers['Authorization'] = 'JWT ' + token;
            }

            return config;
        }
    };
});


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

    <group android:checkableBehavior="single">
        <item
            android:id="@+id/nav_lessons"
            android:icon="@drawable/ic_lessons_black_24px"
            android:title="@string/navigation_menu_lessons" />

        <item
            android:id="@+id/nav_logout"
            android:icon="@drawable/ic_logout_black_24dp"
            android:title="@string/navigation_menu_logout" />
    </group>

</menu>


text:
<?php

namespace Symfony\Component\Cache\Simple;

use Symfony\Component\Cache\Exception\CacheException;
use Symfony\Component\Cache\PruneableInterface;
use Symfony\Component\Cache\Traits\PhpFilesTrait;

class PhpFilesCache extends AbstractCache implements PruneableInterface
{
    use PhpFilesTrait;

    /**
     * @param $appendOnly Set to `true` to gain extra performance when the items stored in this pool never expire.
     *                    Doing so is encouraged because it fits perfectly OPcache's memory model.
     *
     * @throws CacheException if OPcache is not enabled
     */
    public function __construct(string $namespace = '', int $defaultLifetime = 0, string $directory = null, bool $appendOnly = false)
    {
        $this->appendOnly = $appendOnly;
        self::$startTime = self::$startTime ?? $_SERVER['REQUEST_TIME'] ?? time();
        parent::__construct('', $defaultLifetime);
        $this->init($namespace, $directory);

        $e = new \Exception();
        $this->includeHandler = function () use ($e) { throw $e; };
    }
}


text:
System.register(["aurelia-task-queue", "./array-observation", "./map-observation", "./event-manager", "./dirty-checking", "./property-observation", "aurelia-dependency-injection", "./computed-observation"], function (_export) {
  var TaskQueue, getArrayObserver, getMapObserver, EventManager, DirtyChecker, DirtyCheckProperty, SetterObserver, OoObjectObserver, OoPropertyObserver, ElementObserver, All, hasDeclaredDependencies, ComputedPropertyObserver, _prototypeProperties, _classCallCheck, hasObjectObserve, ObserverLocator, ObjectObservationAdapter;

  function createObserversLookup(obj) {
    var value = {};

    try {
      Object.defineProperty(obj, "__observers__", {
        enumerable: false,
        configurable: false,
        writable: false,
        value: value
      });
    } catch (_) {}

    return value;
  }

  function createObserverLookup(obj, observerLocator) {
    var value = new OoObjectObserver(obj, observerLocator);

    try {
      Object.defineProperty(obj, "__observer__", {
        enumerable: false,
        configurable: false,
        writable: false,
        value: value
      });
    } catch (_) {}

    return value;
  }

  return {
    setters: [function (_aureliaTaskQueue) {
      TaskQueue = _aureliaTaskQueue.TaskQueue;
    }, function (_arrayObservation) {
      getArrayObserver = _arrayObservation.getArrayObserver;
    }, function (_mapObservation) {
      getMapObserver = _mapObservation.getMapObserver;
    }, function (_eventManager) {
      EventManager = _eventManager.EventManager;
    }, function (_dirtyChecking) {
      DirtyChecker = _dirtyChecking.DirtyChecker;
      DirtyCheckProperty = _dirtyChecking.DirtyCheckProperty;
    }, function (_propertyObservation) {
      SetterObserver = _propertyObservation.SetterObserver;
      OoObjectObserver = _propertyObservation.OoObjectObserver;
      OoPropertyObserver = _propertyObservation.OoPropertyObserver;
      ElementObserver = _propertyObservation.ElementObserver;
    }, function (_aureliaDependencyInjection) {
      All = _aureliaDependencyInjection.All;
    }, function (_computedObservation) {
      hasDeclaredDependencies = _computedObservation.hasDeclaredDependencies;
      ComputedPropertyObserver = _computedObservation.ComputedPropertyObserver;
    }],
    execute: function () {
      "use strict";

      _prototypeProperties = function (child, staticProps, instanceProps) { if (staticProps) Object.defineProperties(child, staticProps); if (instanceProps) Object.defineProperties(child.prototype, instanceProps); };

      _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };

      if (typeof Object.getPropertyDescriptor !== "function") {
        Object.getPropertyDescriptor = function (subject, name) {
          var pd = Object.getOwnPropertyDescriptor(subject, name);
          var proto = Object.getPrototypeOf(subject);
          while (typeof pd === "undefined" && proto !== null) {
            pd = Object.getOwnPropertyDescriptor(proto, name);
            proto = Object.getPrototypeOf(proto);
          }
          return pd;
        };
      }

      hasObjectObserve = (function detectObjectObserve() {
        if (typeof Object.observe !== "function") {
          return false;
        }

        var records = [];

        function callback(recs) {
          records = recs;
        }

        var test = {};
        Object.observe(test, callback);
        test.id = 1;
        test.id = 2;
        delete test.id;

        Object.deliverChangeRecords(callback);
        if (records.length !== 3) {
          return false;
        }if (records[0].type != "add" || records[1].type != "update" || records[2].type != "delete") {
          return false;
        }

        Object.unobserve(test, callback);

        return true;
      })();

      ObserverLocator = _export("ObserverLocator", (function () {
        function ObserverLocator(taskQueue, eventManager, dirtyChecker, observationAdapters) {
          _classCallCheck(this, ObserverLocator);

          this.taskQueue = taskQueue;
          this.eventManager = eventManager;
          this.dirtyChecker = dirtyChecker;
          this.observationAdapters = observationAdapters;
        }

        _prototypeProperties(ObserverLocator, {
          inject: {
            value: function inject() {
              return [TaskQueue, EventManager, DirtyChecker, All.of(ObjectObservationAdapter)];
            },
            writable: true,
            configurable: true
          }
        }, {
          getObserversLookup: {
            value: function getObserversLookup(obj) {
              return obj.__observers__ || createObserversLookup(obj);
            },
            writable: true,
            configurable: true
          },
          getObserver: {
            value: function getObserver(obj, propertyName) {
              var observersLookup = this.getObserversLookup(obj);

              if (propertyName in observersLookup) {
                return observersLookup[propertyName];
              }

              return observersLookup[propertyName] = this.createPropertyObserver(obj, propertyName);
            },
            writable: true,
            configurable: true
          },
          getObservationAdapter: {
            value: function getObservationAdapter(obj, propertyName, descriptor) {
              var i, ii, observationAdapter;
              for (i = 0, ii = this.observationAdapters.length; i < ii; i++) {
                observationAdapter = this.observationAdapters[i];
                if (observationAdapter.handlesProperty(obj, propertyName, descriptor)) {
                  return observationAdapter;
                }
              }
              return null;
            },
            writable: true,
            configurable: true
          },
          createPropertyObserver: {
            value: function createPropertyObserver(obj, propertyName) {
              var observerLookup, descriptor, handler, observationAdapter;

              if (obj instanceof Element) {
                handler = this.eventManager.getElementHandler(obj, propertyName);
                return new ElementObserver(obj, propertyName, handler);
              }

              descriptor = Object.getPropertyDescriptor(obj, propertyName);

              if (hasDeclaredDependencies(descriptor)) {
                return new ComputedPropertyObserver(obj, propertyName, descriptor, this);
              }

              if (descriptor && (descriptor.get || descriptor.set)) {
                // attempt to use an adapter before resorting to dirty checking.
                observationAdapter = this.getObservationAdapter(obj, propertyName, descriptor);
                if (observationAdapter) {
                  return observationAdapter.getObserver(obj, propertyName, descriptor);
                }return new DirtyCheckProperty(this.dirtyChecker, obj, propertyName);
              }

              if (hasObjectObserve) {
                observerLookup = obj.__observer__ || createObserverLookup(obj, this);
                return observerLookup.getObserver(propertyName, descriptor);
              }

              if (obj instanceof Array) {
                observerLookup = this.getArrayObserver(obj);
                return observerLookup.getObserver(propertyName);
              } else if (obj instanceof Map) {
                observerLookup = this.getMapObserver(obj);
                return observerLookup.getObserver(propertyName);
              }

              return new SetterObserver(this.taskQueue, obj, propertyName);
            },
            writable: true,
            configurable: true
          },
          getArrayObserver: {
            value: (function (_getArrayObserver) {
              var _getArrayObserverWrapper = function getArrayObserver(_x) {
                return _getArrayObserver.apply(this, arguments);
              };

              _getArrayObserverWrapper.toString = function () {
                return _getArrayObserver.toString();
              };

              return _getArrayObserverWrapper;
            })(function (array) {
              if ("__array_observer__" in array) {
                return array.__array_observer__;
              }

              return array.__array_observer__ = getArrayObserver(this.taskQueue, array);
            }),
            writable: true,
            configurable: true
          },
          getMapObserver: {
            value: (function (_getMapObserver) {
              var _getMapObserverWrapper = function getMapObserver(_x2) {
                return _getMapObserver.apply(this, arguments);
              };

              _getMapObserverWrapper.toString = function () {
                return _getMapObserver.toString();
              };

              return _getMapObserverWrapper;
            })(function (map) {
              if ("__map_observer__" in map) {
                return map.__map_observer__;
              }

              return map.__map_observer__ = getMapObserver(this.taskQueue, map);
            }),
            writable: true,
            configurable: true
          }
        });

        return ObserverLocator;
      })());
      ObjectObservationAdapter = _export("ObjectObservationAdapter", (function () {
        function ObjectObservationAdapter() {
          _classCallCheck(this, ObjectObservationAdapter);
        }

        _prototypeProperties(ObjectObservationAdapter, null, {
          handlesProperty: {
            value: function handlesProperty(object, propertyName, descriptor) {
              throw new Error("BindingAdapters must implement handlesProperty(object, propertyName).");
            },
            writable: true,
            configurable: true
          },
          getObserver: {
            value: function getObserver(object, propertyName, descriptor) {
              throw new Error("BindingAdapters must implement createObserver(object, propertyName).");
            },
            writable: true,
            configurable: true
          }
        });

        return ObjectObservationAdapter;
      })());
    }
  };
});


text:
package shims

import cats.kernel.laws.discipline._
import scalaz.std.anyVal._
import cats.instances.option._

import org.specs2.mutable._
import org.typelevel.discipline.specs2.mutable.Discipline

object KernelConversionSpecs extends Specification with Discipline {

  "eq conversion" >> {
    cats.Eq[Int]
    scalaz.Equal[Int]

    "scalaz -> cats" >> {
      checkAll("Int", EqTests[Int].eqv)
    }
  }

  "order conversion" >> {
    cats.Order[Int]
    scalaz.Order[Int]

    "scalaz -> cats" >> {
      checkAll("Int", OrderTests[Int].order)
    }
  }

  "semigroup conversion" >> {
    cats.Semigroup[Int]
    scalaz.Semigroup[Int]

    "scalaz -> cats" >> checkAll("Int", SemigroupTests[Int].semigroup)
  }

  "monoid conversion" >> {
    cats.Monoid[Int]
    scalaz.Monoid[Int]

    "scalaz -> cats" >> checkAll("Int", MonoidTests[Int].monoid)
  }

  "show conversion" >> {
    import cats.syntax.show._

    cats.Show[Int]
    scalaz.Show[Int]

    "scalaz -> cats" >> {
      show"testing ${42}" mustEqual "testing 42"
    }
  }
}


text:
<!DOCTYPE html>
<!-- Copyright 2014 The Chromium Authors. All rights reserved.
  -- Use of this source code is governed by a BSD-style license that can be
  -- found in the LICENSE file.
  -->
<html>
<body>

<script type="text/javascript">
  // importScripts is used in metadata_dispatcher.js which is designed to work inside SharedWorker.
  function importScripts(arg1) {}
</script>
<script src="../../../../webui/resources/js/assert.js"></script>

<script src="../../../file_manager/foreground/js/metadata/metadata_cache.js"></script>
<script src="../../../file_manager/foreground/js/metadata/byte_reader.js"></script>
<script src="../../../file_manager/foreground/js/metadata/metadata_parser.js"></script>
<script src="../../../file_manager/foreground/js/metadata/metadata_dispatcher.js"></script>
<script src="../../../file_manager/foreground/js/metadata/exif_parser.js"></script>
<script src="../../../file_manager/foreground/js/metadata/exif_constants.js"></script>

<script src="image_encoder.js"></script>
<script src="exif_encoder.js"></script>

<script src="test_util.js"></script>
<script src="exif_encoder_unittest.js"></script>

</body>
</html>


text:
package org.cyclops.cyclopscore.config;

import org.cyclops.cyclopscore.config.configurabletypeaction.*;
import org.cyclops.cyclopscore.config.extendedconfig.*;

/**
 * The different types of configurable.
 * @author rubensworks
 *
 */
public class ConfigurableType {

    /**
     * Item type.
     */
    public static final ConfigurableType ITEM = new ConfigurableType(true, ItemConfig.class, new ItemAction(), "item");
    /**
     * Block type.
     */
    public static final ConfigurableType BLOCK = new ConfigurableType(true, BlockConfig.class, new BlockAction(), "block");
    /**
     * Regular entity type.
     */
    public static final ConfigurableType ENTITY = new ConfigurableType(true, EntityConfig.class, new EntityAction(), "entity");
    /**
     * Fluid type.
     */
    public static final ConfigurableType FLUID = new ConfigurableType(true, FluidConfig.class, new FluidAction(), "fluid");
    /**
     * Enchantment type.
     */
    public static final ConfigurableType ENCHANTMENT = new ConfigurableType(true, EnchantmentConfig.class, new EnchantmentAction(), "enchantment");
    /**
     * Villager type.
     */
    public static final ConfigurableType VILLAGER = new ConfigurableType(true, VillagerConfig.class, new VillagerAction(), "mob");
    /**
     * Biome type.
     */
    public static final ConfigurableType BIOME = new ConfigurableType(true, BiomeConfig.class, new BiomeAction(), "biome");
    /**
     * Potion effect type.
     */
    public static final ConfigurableType EFFECT = new ConfigurableType(true, EffectConfig.class, new EffectAction(), "potion");
    /**
     * Capability type.
     */
    public static final ConfigurableType CAPABILITY = new ConfigurableType(false, CapabilityConfig.class, new CapabilityAction<>(), "capability");
    /**
     * Gui type.
     */
    public static final ConfigurableType GUI = new ConfigurableType(true, GuiConfig.class, new GuiAction(), "gui");
    /**
     * Recipe serializer type.
     */
    public static final ConfigurableType RECIPE = new ConfigurableType(true, RecipeConfig.class, new RecipeAction(), "recipe");
    /**
     * Recipe type type.
     */
    public static final ConfigurableType RECIPE_TYPE = new ConfigurableType(true, RecipeTypeConfig.class, new RecipeTypeAction(), "recipe_type");
    /**
     * Recipe condition type.
     */
    public static final ConfigurableType RECIPE_CONDITION = new ConfigurableType(true, RecipeConditionConfig.class, new RecipeConditionAction(), "recipe_condition");
    /**
     * Particle type.
     */
    public static final ConfigurableType PARTICLE = new ConfigurableType(true, ParticleConfig.class, new ParticleAction(), "particle");
    /**
     * Block entity type.
     */
    public static final ConfigurableType BLOCK_ENTITY = new ConfigurableType(true, BlockEntityConfig.class, new BlockEntityAction(), "block_entity");
    /**
     * World feature type.
     */
    public static final ConfigurableType WORLD_FEATURE = new ConfigurableType(true, WorldFeatureConfig.class, new WorldFeatureAction(), "world_feature");
    public static final ConfigurableType WORLD_STRUCTURE = new ConfigurableType(true, WorldStructureConfig.class, new WorldStructureAction(), "world_structure");
    public static final ConfigurableType FOLIAGE_PLACER = new ConfigurableType(true, FoliagePlacerConfig.class, new FoliagePlacerAction(), "foliage_placer");
    public static final ConfigurableType TRUNK_PLACER = new ConfigurableType(true, TrunkPlacerConfig.class, new TrunkPlacerAction(), "trunk_placer");
    public static final ConfigurableType ARGUMENT_TYPE = new ConfigurableType(true, ArgumentTypeConfig.class, new ArgumentTypeAction(), "argument_type");
    public static final ConfigurableType BIOME_MODIFIER = new ConfigurableType(true, BiomeModifierConfig.class, new BiomeModifierAction(), "biome_modifier");

    /**
     * Dummy type, only used for configs that refer to nothing.
     */
    public static final ConfigurableType DUMMY = new ConfigurableType(false, DummyConfig.class, new DummyAction(), "general");

    private final boolean uniqueInstance;
    @SuppressWarnings("rawtypes")
    private final Class<? extends ExtendedConfig> configClass;
    @SuppressWarnings("rawtypes")
    private final ConfigurableTypeAction action;
    private final String category;

    /**
     * Make a new instance.
     * @param uniqueInstance If this type has a unique instance for each config.
     * @param configClass The config class.
     * @param action The action instance that helps with saving of the config and optional instance.
     * @param category The category in which the configs should be saved.
     */
    @SuppressWarnings("rawtypes")
    public ConfigurableType(boolean uniqueInstance, Class<? extends ExtendedConfig> configClass,
                            ConfigurableTypeAction action, String category) {
        this.uniqueInstance = uniqueInstance;
        this.configClass = configClass;
        this.action = action;
        this.category = category;
    }

    /**
     * If this type should refer to a configurable with a unique instance.
     * If this is true, the configurable should have a public static void
     * initInstance(ExtendedConfig eConfig) method and also a public static
     * (? extends IConfigurable) getInstance() method.
     * @return If it has a unique instance.
     */
    public boolean hasUniqueInstance() {
        return uniqueInstance;
    }

    /**
     * Get the class that extends {@link ExtendedConfig} this type can hold.
     * @return The class that extends {@link ExtendedConfig} this type can hold.
     */
    @SuppressWarnings("rawtypes")
    public Class<? extends ExtendedConfig> getConfigClass() {
        return configClass;
    }

    /**
     * The action for this type after the the configurable has configured so it can be registered.
     * @return The action for this type.
     */
    @SuppressWarnings("rawtypes")
    public ConfigurableTypeAction getConfigurableTypeAction() {
        return action;
    }

    /**
     * The category of this type.
     * @return The category.
     */
    public String getCategory() {
        return category;
    }
}


text:
Tarina

 Tarinan aloitti: {{authentication.user.displayName}} , {{story.created | date}}

Nyt kirjoitetaan osaa nro: {{story.storyparts.length+1}}

        <ng-form class="form-horizontal" data-ng-submit="update()" novalidate>

            <ui-view></ui-view>

        </ng-form>


text:
{% extends "locksmith/base.html" %}
{% block title %}API Key Confirmation{% endblock title %}

{% block content %}

{% if error %}

Error Activating Key

    Could not activate key: {{error}}.
{% else %}

Key Successfully Activated!

    Your API key has been successfully activated, you may now use the API.
{% endif %}

{% endblock content %}


text:
package com.raymond.map;

import java.util.Objects;

/**
 * Created by Raymond Kwong on 5/26/2016.
 */
public class RaymondMap<T, K> implements RaymondM<T, K>{
    private int size;
    private RaymondEntry[] map;

    public RaymondMap() {
        this.map = new RaymondEntry[10];
        this.size = 0;
    }

    public synchronized void put(T key, K value) {
        int hash = hash(key);
        RaymondEntry node = map[hash];
        if (node == null) { //empty
            RaymondEntry firstEntry = new RaymondEntry(key, value, null);
            map[hash] = firstEntry;
            this.size++;
        }
        else {
            //Need to also check if the array already contains this value and if it does, overwrite it
            while (node.getNext() != null) {
                if (node.getKey().equals(key)) {
                    node.setValue(value);//overwrite
                    return;
                }
                node = node.getNext();
            }
            if (node.getKey().equals(key)) {
                node.setValue(value);//overwrite
            }
            else {
                RaymondEntry newEntry = new RaymondEntry(key, value, node);
                map[hash] = newEntry;
                this.size++;
            }
        }
    }

    public synchronized K get(T key) {
        int hash = hash(key);
        RaymondEntry<T, K> entry = map[hash];
        if (entry == null) {
            return null;
        }
        else {
            while (entry.getNext() != null) {
                if (Objects.equals(entry.getKey(), key)) {
                    return entry.getValue();
                }
                entry = entry.getNext();
            }
            if (Objects.equals(entry.getKey(), key)) {
                return entry.getValue();
            }
        }
        return null;
    }

    public synchronized void remove(T key) {
        int hash = hash(key);
        RaymondEntry node = map[hash];
        RaymondEntry previousNode = node;
        if (node != null) {
            if (node.getNext() == null) {
                map[hash] = null;
                this.size--;
                return;
            }
            while (node.getNext() != null) {
                if (node.getKey().equals(key)) {
                    //need some linkedlist logic
                    //needs to cover removal at head
                    //removal in the middle
                    //removal at the end
                    if (node == previousNode) {
                        map[hash] = node.getNext();
                        this.size--;
                        return;
                    }
                    node = node.getNext();
                    previousNode.setNext(node);
                    this.size--;
                    return;
                }
                previousNode = node;
                node = node.getNext();
            }
            if (node.getKey().equals(key)) { //at tail
                previousNode.setNext(node.getNext());
                this.size--;
                return;
            }
        }
    }

    public RaymondEntry[] getMap() {
        return map;
    }

    public int getSize() {
        return size;
    }

    public int hash(T key) {
        int h = Objects.hashCode(key);
        if (h < 0) {
            h = h * -1;
        }
        int modulus = h % 10; //Take last digit, assume capacity then is max 10, 0-9
        return modulus;
    }

    /*public static void main(String[] args) {

        RaymondMap<String, String> m = new RaymondMap();
        m.put("Hi", "No");
        m.put("b", "Blue");
        m.put("g", "Green");
        m.put("r", "Red");
        m.put("Eye", "Black");
        m.put("race", "indian");
        m.put("race", "joe");
        m.put("lips", "red");
        m.put("finder", "ring");
        m.put("ear", "rings");
        m.put("teeth", "white");
        m.put("arm", "tattoo");
        m.put("glue", "stick");
        m.put("table", "wood");
        m.put("bag", "white");
        m.put("lips", "orange");
        String dd = m.get("lips");
        String arm = m.get("arm");
        System.out.println(dd);
        System.out.println(arm);

        int i = 2;
        while (i > 0) {
            new Thread(new RaymondMapProducer(m)).start();//1
            i--;
        }

        int j = 3;
        while (j > 0) {
            new Thread(new RaymondMapConsumer(m)).start();//1
            j--;
        }
        try {
            Thread.sleep(5000);
        }
        catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("Size=" + m.getSize());
    }*/

}


text:
from __future__ import unicode_literals

from django.db import migrations, models
import django.db.models.deletion

class Migration(migrations.Migration):

    dependencies = [
        ('sponsor', '0004_auto_20190728_1719'),
    ]

    operations = [
        migrations.AlterField(
            model_name='sponsorrelation',
            name='lan',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='lan.LAN', verbose_name='LAN'),
        ),
        migrations.AlterField(
            model_name='sponsorrelation',
            name='priority',
            field=models.IntegerField(help_text='Higher priority means closer to the top of the sponsor list.', verbose_name='priority'),
        ),
    ]


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <title>servers Widget Unit Test</title>

    <link rel="stylesheet" type="text/css" href="../../../css/base.css" />
    <link rel="stylesheet" type="text/css" href="../../../css/style.css" />

      <button class="b">Click Me </button>


text:
package react

type Event interface{}

type OnChange interface {
	Event

	OnChange(e *SyntheticEvent)
}

type OnClick interface {
	Event

	OnClick(e *SyntheticMouseEvent)
}


text:
title: "Snack: a playground in your browser"
---

import SnackEmbed from '~/components/plugins/SnackEmbed';
import SnackInline from '~/components/plugins/SnackInline';

Creating a shareable and runnable code example should be quick and easy. Without Snack, if you have some code that you want to share then other developers that want to run it need to have a development environment set up, they need to download your project, trust that it is safe to run, install the dependencies, and then start the project. Tools like CodeSandbox, Blitz, and Replit solved this for web apps. You can create a project, write the code in your browser, and share it with a link.

Snack solves precisely that problem. It's an open-source platform for running React Native apps in the browser. You can write React Native code and run it directly in Expo Go or even in the browser. When you want to share the code, save it and share the URL, or embed it on your website, like in the [React Native](http://reactnative.dev/) and [React Navigation](https://reactnavigation.org/) documentation sites.

## Let's get started

Head over to [https://snack.expo.dev](https://snack.expo.dev) and start typing! On the right, you'll see the preview of the changes you make. By going to the "Android" or "iOS" tabs, you can preview it on a simulator directly in the browser. To open it on your device, go to the "My Device" tab and open it in the Expo Go app.

## Adding a library

You can add any library that works in a managed Expo project, like [`expo-camera`](../../versions/latest/sdk/camera.md) or [`React Navigation`](https://reactnavigation.org). Add the import in the file that you want, and Snack will prompt you to install that dependency. You can also specify the exact version by adding it to your **package.json** file.

> Not all React Native libraries will work on Snack. First, [the same constraints](../../workflow/using-libraries.md) that apply to the Expo managed workflow apply here. Second, Snack bundles the code differently than Expo CLI and React Native CLI, so in some cases libraries that work locally on your machine will fail to load in Snack.

## Saving and sharing code

You can always share the code you just created. Save the Snack on your Expo account, and share the link. Anyone with that link can view, fork and edit, and share it as another Snack. Saved Snacks will appear for your account under the Profile tab in the Expo Go app.

## Embed it on your website

Snacks can also be embedded as "live" code previews, like the [React Native docs](https://reactnative.dev/docs/intro-react#your-first-component). Either share a link with the embedded code or use [the embed script](https://github.com/expo/snack/blob/main/docs/embedding-snacks.md) for the live preview. If you use [Docusaurus](https://docusaurus.io/), check out the [remark-snackplayer plugin](https://github.com/facebook/react-native-website/tree/master/plugins/remark-snackplayer).

<SnackEmbed snackId="@brents/hello-world" preview />

<br />

It's also possible to format the code however you like on your website and send the code to run on Snack when requested by the user. See [SnackInline](https://github.com/expo/expo/blob/master/docs/components/plugins/SnackInline.tsx) for how we implement this in the Expo documentation.

<SnackInline>

```js
import React from 'react';
import { StyleSheet, Text, View } from 'react-native';

export default function App() {
  return (
    <View style={styles.container}>
      <Text>Hello, World!</Text>
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#fff',
    alignItems: 'center',
    justifyContent: 'center',
  },
});
```

</SnackInline>

## Debugging your code

All logs from the web and mobile device previews are visible in toolbar below the editor. To inspect the logs, click on bottom toolbar and go to the "Logs" tab. While it's possible to view logs, it is not possible to connect a JavaScript debugger in Snack, you will need to download your project and run it with `expo-cli` in order to do this. Press the download button in the header bar on the right to download the project to your machine.

## Static analysis

ESLint and TypeScript are integrated with Snack. When making a syntax error or just a typo, you will be warned about the error. TypeScript will give you autocompletion as well. Right click your **App.js** file in the file browser on the left side of the editor and choose "Rename to App.tsx" to enable TypeScript.


text:
SYNONYM

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

#### Published in
in Orbigny, Dict. Univ. Hist. Nat. 12: 785 [19 of extr. ] (1848)

#### Original name
Trichobasis umbellatarum Lév., 1849

### Remarks
null


text:
package org.ak80.standin.matcher;

import org.junit.Test;

import java.util.function.Predicate;

import static org.ak80.att.BuilderDsl.a;
import static org.ak80.att.ValueTdf.$String;
import static org.hamcrest.core.Is.is;
import static org.junit.Assert.assertThat;

public class ReceivedPredicateMessageMatcherTest {

    private final String expectedMessage = a($String());
    private final Predicate<Object> matcher = message -> expectedMessage.equals(message);

    @Test
    public void testMatch_whenSameClass_matches() {
        // Given
        ReceivedMessageMatcher messageMatcher = new ReceivedPredicateMessageMatcher(matcher);

        // When
        boolean matches = messageMatcher.matches(expectedMessage);

        // Then
        assertThat(matches, is(true));
    }

    @Test
    public void testMatch_whenNotSameClass_matchesNot() {
        // Given
        ReceivedMessageMatcher messageMatcher = new ReceivedPredicateMessageMatcher(matcher);

        // When
        boolean matches = messageMatcher.matches(a($String()));

        // Then
        assertThat(matches, is(false));
    }

    @Test
    public void testExplain() {
        // Given
        ReceivedMessageMatcher messageMatcher = new ReceivedPredicateMessageMatcher(matcher);

        // When
        String explain = messageMatcher.explain();

        // Then
        assertThat(explain, is("a message matching a custom condition"));
    }

}


text:
GPGSChecker* GPGSChecker::m_pInstance = nullptr;
GPGSChecker::CGarbo GPGSChecker::m_garbo;

GPGSChecker::GPGSChecker()
{
    if (isHaveSaveFile()) {
        _playerLocalConfig = {
            CCUserDefault::getInstance()->getBoolForKey("firstblood",false),
            CCUserDefault::getInstance()->getBoolForKey("firstvictory",false),
            CCUserDefault::getInstance()->getBoolForKey("sucidal",false),
            CCUserDefault::getInstance()->getBoolForKey("masochist",false),
            CCUserDefault::getInstance()->getBoolForKey("banger",false),
            CCUserDefault::getInstance()->getBoolForKey("collarteraldamage",false),
            CCUserDefault::getInstance()->getBoolForKey("invincible",false),
            CCUserDefault::getInstance()->getIntegerForKey("victorys",0)
        };
    }
}

bool GPGSChecker::isHaveSaveFile()
{
    if(!CCUserDefault::getInstance()->getBoolForKey("isHaveSaveFileXml"))
    {
        CCUserDefault::getInstance()->setBoolForKey("isHaveSaveFileXml", true);
        CCUserDefault::getInstance()->setBoolForKey("firstblood", false);
        CCUserDefault::getInstance()->setBoolForKey("firstvictory", false);
        CCUserDefault::getInstance()->setBoolForKey("sucidal", false);
        CCUserDefault::getInstance()->setBoolForKey("masochist", false);
        CCUserDefault::getInstance()->setBoolForKey("banger", false);
        CCUserDefault::getInstance()->setBoolForKey("collarteraldamage", false);
        CCUserDefault::getInstance()->setBoolForKey("invincible", false);
        CCUserDefault::getInstance()->setIntegerForKey("victorys",0);

        CCUserDefault::getInstance()->flush();

        _playerLocalConfig = {false, false, false, false, false, false, false, 0};

        return false;
    }
    else
    {
        return true;
    }
}

void GPGSChecker::chcekFirstBlood()
{
    if (!_playerLocalConfig.firstblood) {
        GPGSManager::UnlockAchievement(ACH_FIRST_BLOOD);
        _playerLocalConfig.firstblood = true;
        CCUserDefault::getInstance()->setBoolForKey("firstblood", true);
        CCUserDefault::getInstance()->flush();
    }
}

void GPGSChecker::checkFirstVictory()
{
    if (!_playerLocalConfig.firstvictory) {
        GPGSManager::UnlockAchievement(ACH_TASTE_OF_VICTORY);
        _playerLocalConfig.firstvictory = true;
        CCUserDefault::getInstance()->setBoolForKey("firstvictory", true);
        CCUserDefault::getInstance()->flush();
    }
}

void GPGSChecker::checkSuicidal()
{
    if (!_playerLocalConfig.sucidal) {
        GPGSManager::UnlockAchievement(ACH_SUICIDAL);
        _playerLocalConfig.sucidal = true;
        CCUserDefault::getInstance()->setBoolForKey("sucidal", true);
        CCUserDefault::getInstance()->flush();
    }
}

void GPGSChecker::checkMasochist()
{
    if (!_playerLocalConfig.masochist) {
        GPGSManager::UnlockAchievement(ACH_MASOCHIST);
        _playerLocalConfig.masochist = true;
        CCUserDefault::getInstance()->setBoolForKey("masochist", true);
        CCUserDefault::getInstance()->flush();
    }
}

void GPGSChecker::checkBanger()
{
    if (!_playerLocalConfig.banger) {
        GPGSManager::UnlockAchievement(ACH_BANGER);
        _playerLocalConfig.banger = true;
        CCUserDefault::getInstance()->setBoolForKey("banger", true);
        CCUserDefault::getInstance()->flush();
    }
}

void GPGSChecker::checkCollateralDamage()
{
    if (!_playerLocalConfig.collarteraldamage) {
        GPGSManager::UnlockAchievement(ACH_COLLATERAL_DAMAGE);
        _playerLocalConfig.collarteraldamage = true;
        CCUserDefault::getInstance()->setBoolForKey("collarteraldamage", true);
        CCUserDefault::getInstance()->flush();
    }
}

void GPGSChecker::checkInvincible()
{
    if (!_playerLocalConfig.invincible) {
        GPGSManager::UnlockAchievement(ACH_INVINCIBLE);
        _playerLocalConfig.invincible = true;
        CCUserDefault::getInstance()->setBoolForKey("invincible", true);
        CCUserDefault::getInstance()->flush();
    }
}

void GPGSChecker::sumbitNewVictory()
{
    _playerLocalConfig.victorys++;
    GPGSManager::SubmitHighScore(LEAD_VICTORIES, _playerLocalConfig.victorys);
    CCUserDefault::getInstance()->setIntegerForKey("victorys", _playerLocalConfig.victorys);
    CCUserDefault::getInstance()->flush();
}


text:
from distutils.core import setup

setup(
            name="knlx",
            version="0.01",
            description="Module of functions for reading some Neuralynx files",
            long_description="Python module of functions for reading Neuralynx files for events (.Nev), video position-tracking (Pos.p), and continuous records (.Ncs); as well as an ASCII export function for position data",
            author="Joe Monaco",
            author_email="jmonaco@jhu.edu",
            url="http://jdmonaco.com/",
            platforms=['Mac OSX', 'Linux', 'Windows'],
            license='The MIT License',
            package_dir={'knlx': 'lib'},
            packages=['knlx'],
)


text:
> Allow parsing of the pipeline operator

See our website [@babel/plugin-syntax-pipeline-operator](https://babeljs.io/docs/en/next/babel-plugin-syntax-pipeline-operator.html) for more information.

## Install

Using npm:

```sh
npm install --save @babel/plugin-syntax-pipeline-operator
```

or using yarn:

```sh
yarn add --save @babel/plugin-syntax-pipeline-operator
```


text:
/* $Id$ */

package ibis.compile;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.jar.JarEntry;
import java.util.zip.ZipOutputStream;

/**
 * Maintains information about the content of a jarfile entry.
 */
public class JarEntryInfo {

    private JarEntry       jarEntry;
    private byte[]         content;
    private JarInfo        jarInfo;
    private IbiscEntry     ibiscEntry;

    JarEntryInfo(JarEntry jarEntry, JarInfo jarInfo) throws IOException {
        this.jarEntry = jarEntry;
        this.jarInfo = jarInfo;
        this.content = getContent();
        this.ibiscEntry = getIbiscEntry();
    }

    JarEntryInfo(JarEntry jarEntry, JarInfo jarInfo, byte[] content) {
        this.jarEntry = jarEntry;
        this.jarInfo = jarInfo;
        this.content = content;
        this.ibiscEntry = getIbiscEntry();
    }

    JarEntryInfo(JarEntry jarEntry, JarInfo jarInfo, byte[] content, IbiscEntry ibiscEntry) {
        this.jarEntry = jarEntry;
        this.jarInfo = jarInfo;
        this.content = content;
        this.ibiscEntry = ibiscEntry;
    }

    private IbiscEntry getIbiscEntry() {
        String iname = jarEntry.getName();
        if (iname.endsWith(".class")) {
            try {
                ClassInfo cl = Ibisc.w.parseInputStream(getInputStream(),
                            iname);
                IbiscEntry entry = new IbiscEntry(cl, iname, jarInfo);
                Ibisc.allClasses.put(cl.getClassName(), entry);
                return entry;
            } catch(IOException e) {
                System.err.println("Ibisc: warning: could not read "
                        + "class " + iname + " from jar file "
                        + jarInfo.getName());
            }
        }
        return null;
    }

    private byte[] getContent() throws IOException {
        ByteArrayOutputStream Bos = new ByteArrayOutputStream();
        byte[] buf = new byte[16384];
        InputStream in = jarInfo.getInputStream(jarEntry);
        int cnt;
        do {
            cnt = in.read(buf, 0, 16384);
            if (cnt >= 0) {
                Bos.write(buf, 0, cnt);
            }
        } while (cnt >= 0);
        in.close();
        buf = Bos.toByteArray();
        return buf;
    }

    void write(ZipOutputStream ozip) throws IOException {
        JarEntry je = new JarEntry(jarEntry.getName());
        byte[] extra = jarEntry.getExtra();
        if (extra != null) {
            je.setExtra(extra);
        }
        if (ibiscEntry != null && ibiscEntry.getModified()) {
            je.setTime(System.currentTimeMillis());
            content = ibiscEntry.getClassInfo().getBytes();
        }
        ozip.putNextEntry(je);
        ozip.write(content);
        ozip.closeEntry();
    }

    InputStream getInputStream() {
        return new ByteArrayInputStream(content);
    }

    /**
     * Returns the {@link JarEntry} of this entry.
     * @return the jarEntry
     */
    public JarEntry getJarEntry() {
        return jarEntry;
    }

    /**
     * Returns the {@link JarInfo} of this entry.
     * @return the jarInfo
     */
    public JarInfo getJarInfo() {
        return jarInfo;
    }
}


text:
<!doctype html>

<meta charset="utf-8">
<title>Check Address Area</title>
<link href="../third-party/bootstrap-3.3.0/css/bootstrap.min.css" rel="stylesheet">

    <tabs>
      <pane title="Current Dictionary">

Current Dictionary

Kowloon:<textarea cols="100" rows="3" class="col-md-6" ng-model="$root.asAtFileContent['k']"></textarea>

Hong Kong Island:<textarea cols="100" rows="3" class="col-md-6" ng-model="$root.asAtFileContent['h']"></textarea>

New Territories:<textarea cols="100" rows="3" class="col-md-6" ng-model="$root.asAtFileContent['n']"></textarea>

Foreign:<textarea cols="100" rows="3" class="col-md-6" ng-model="$root.asAtFileContent['f']"></textarea>

      </pane>
      <pane title="Source code">

Source code ( Get external JSON...{{getJSONResult}} )

{{$root.asAtFileContent | json}}

      </pane>
    </tabs>

How to use

	  This web page help you to quick fill in the excel column.

The dictionary matching table will get by Ajax automatically.

Paste your list of address copy from excel to the 'Type your address here' panel at below,

			one address must be in one sentence, each address must use a comma to separate each part of the address.

			once the content of 'Type your address here' panel is changed, it will trigger the following action

The last part of the address sentence will trim by comma, all the last parts will display on the 'Get the substring' panel.

A block will generate for each last part for your further assign the area code.

If the last part was found in the dictionary, the area code will auto assign to the block regarding the dictionary definition.

We are assuming the auto identification is correct, the block will lock for safety reason.

If the identification is incorrect, you may also release the lock and assign another area code manually.

any last part cannot identify the area code in the dictionary, you may select/input the area code in selection box/input box.

網頁載入後會以 Ajax 自動獲取字典檔

在'Type your address here' 中輸入一個或多個的地址,每一行為一個地址。

			'Type your address here' 中的內容有變更時,會自動執行以下動作。

每個地址中需以 ',' 分間,找出最後的部份,最後的部份會顯示在旁邊的 'Get the substring'

網頁會按照最後部份的地址,個別生成一個可指定地區的介面

如果最後的部份在字典中成功匹配,會自動按照字典的分區進行指派。指派後,會自動鎖上個別方框。

自動指派後,會自動鎖上個別方框。那是為了防止用家誤改。如果發現字典誤判,可以自行解鎖再自行更正分區。

其它未能匹配分區的地址的方框,用家可在 Selection Box / Input Box 指派適當的分區

How to update the dictionary

After finishing your manual assignment, you may see the 'Dictionary New Definition' panel have some new definition

You may change and edit those new definitions in the "Dictionary New Definition" panel

Click [Refresh Json Dictionary] button, the new json code will generate and display on the nearby text box

Click [Update Json Dictionary] to update the json file by PHP or copy the new json code and update to the json file by yourself

完成所有area code的選取後,你可以更新字典。令日後遇到相同地址時,程式懂得自動指派area code。

新的地址和分區定義將會出現在 "Dictionary New Definition" ,新定義可手動修改。

如果伺服器支援 PHP,可直接按 [Update Json Dictionary] 按鈕,更新字典動作便會開始。

如果伺服器不支援 PHP,可按 [Refresh Json Dictionary] 按鈕,新的字典內容會顯示在旁的文字方塊,你需要手動複製並取代舊字典的內容。

Version 2014-11-14

Require web server to get JSON file

Require PHP server to update the JSON file

		  Reference: https://docs.angularjs.org/api/ng/directive/ngModel

Type your address here

				  <textarea name="client-address" id="client-address" cols="100" rows="10" ng-model="customAddressText" ng-change="getAddressLastPart(customAddressText)"></textarea>

Get the substring

				  <textarea name="address-substring" id="address-substring" cols="50" rows="10" readonly  ng-bind="addressLastPart"></textarea>

    <tabs>
      <pane title="New Dictionary">

Dictionary New Definition

				  Kowloon:

					<textarea class="form-control" cols="100" rows="3" ng-model="toBe['K']" ng-disabled="isDisabled"></textarea>

				  Hong Kong Island:

					<textarea class="form-control" cols="100" rows="3" ng-model="toBe['H']" ng-disabled="isDisabled"></textarea>

				  New Territories:

					<textarea class="form-control" cols="100" rows="3" ng-model="toBe['N']" ng-disabled="isDisabled"></textarea>

				  Foreign:

					<textarea class="form-control" cols="100" rows="3" ng-model="toBe['F']" ng-disabled="isDisabled"></textarea>

	  </pane>
      <pane title="New Json">

New Json

				<form action="update-json.php" method="post" class="form-horizontal">

						<button type="button" class="btn btn-default" ng-click="refreshNewJson()" ng-disabled="isDisabled">Refresh Json Dictionary</button>

						<button type="submit" class="btn btn-default" ng-click="refreshNewJson()">Update Json Dictionary</button>

					  <textarea class="form-control new-source" name="json" rows="10" cols="100" ng-bind="newjson | json"></textarea>

				</form>

	  </pane>

Custom address area code

				    <input class="lock form-control" type="button" ng-show="!(isLock[$index])" ng-click="reverseLock('lock',$index)">
					<input class="unlock form-control" type="button" ng-show="isLock[$index]" ng-click="reverseLock('unlock', $index)">

					<input type="text" class="political-area form-group form-control" ng-model="lastPart.text" readonly>
					<select class="area-list form-group form-control" style="margin-left: 10px;" ng-model="lastPart.areaCode" ng-change="customAreaCodeChange(lastPart.text, lastPart.areaCode)" ng-disabled="isDisabled || isLock[$index]">
				  	  <option value="" selected>--Select--</option>
				  	  <option value="K">Kowloon</option>
				  	  <option value="H">Hong Kong Island</option>
				  	  <option value="N">New Territories</option>
				  	  <option value="F">Foreign</option>
				  	</select>
					<input type="text" class="area-code form-group form-control" style="margin-left: 10px; text-transform: uppercase;" ng-model="lastPart.areaCode" ng-change="customAreaCodeChange(lastPart.text, lastPart.areaCode)" ng-disabled="isDisabled || isLock[$index]">

Area code identification

				  <textarea cols="40" rows="20" id="to-excel" style="margin-left: 50px;" ng-model="toExcelAreaCode" ng-disabled="isDisabled" ng-trim="false"></textarea>


text:
@interface MQBotMenuAnswerCell()

@property (nonatomic, strong) MQBotMenuAnswerCellModel *cellModel;
@property (nonatomic, strong) UIImageView *itemsView;
@property (nonatomic, strong) UIImageView *avatarImageView;

@property (nonatomic, strong) UILabel *contentLabel;
@property (nonatomic, strong) UILabel *menuTitleLabel;
@property (nonatomic, strong) UILabel *menuFootnoteLabel;

@property (nonatomic, strong) UIView *evaluateView;
@property (nonatomic, strong) UIView *evaluatedView;

@property (nonatomic, assign) CGFloat currentCellWidth;
@property (nonatomic, assign) CGFloat currentContentWidth;

@property (nonatomic, assign) BOOL manuallySetToEvaluated;

@end

@implementation MQBotMenuAnswerCell

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self.contentView addSubview:self.avatarImageView];
        [self.contentView addSubview:self.itemsView];

        [self.itemsView addSubview:self.contentLabel];
        [self.itemsView addSubview:self.menuTitleLabel];
        [self.itemsView addSubview:self.menuFootnoteLabel];
        [self updateUI];

    }
    return self;
}

- (void)updateCellWithCellModel:(id<MQCellModelProtocol>)model {
    self.manuallySetToEvaluated = NO;
    self.cellModel = model;

    [self updateUI];

    __weak typeof(self) wself = self;
    self.cellModel.provoideCellHeight = ^{
        __strong typeof (wself) sself = wself;
        return sself.contentView.viewHeight;
    };

    if (self.cellModel.avatarImage) {
        self.avatarImageView.image = self.cellModel.avatarImage;
    } else {
        [self.cellModel setAvatarLoaded:^(UIImage *avatar) {
            __strong typeof (wself) sself = wself;
            if (avatar) {
                sself.avatarImageView.image = avatar;
            }
        }];
    }
}

- (void)updateUI {
    //layout fix components
    [self.avatarImageView align:ViewAlignmentTopLeft relativeToPoint:CGPointMake(kMQCellAvatarToVerticalEdgeSpacing, kMQCellAvatarToHorizontalEdgeSpacing)];
    [self.itemsView align:ViewAlignmentTopLeft relativeToPoint:CGPointMake(self.avatarImageView.viewRightEdge + kMQCellAvatarToBubbleSpacing, self.avatarImageView.viewY)];

    self.itemsView.viewWidth = self.contentView.viewWidth - kMQCellBubbleMaxWidthToEdgeSpacing - self.avatarImageView.viewRightEdge;
    self.currentCellWidth = self.contentView.viewWidth;
    self.currentContentWidth = self.itemsView.viewWidth - kMQCellAvatarToHorizontalEdgeSpacing - kMQCellAvatarToHorizontalEdgeSpacing;

    self.contentLabel.text = self.cellModel.content;
    self.contentLabel.viewWidth = self.currentContentWidth;
    [self.contentLabel sizeToFit];
    [self.contentLabel align:(ViewAlignmentTopLeft) relativeToPoint:CGPointMake(kMQCellAvatarToHorizontalEdgeSpacing, kMQCellAvatarToHorizontalEdgeSpacing)];

    self.menuTitleLabel.text = self.cellModel.menuTitle;
    self.menuTitleLabel.viewWidth = self.currentContentWidth;
    [self.menuTitleLabel sizeToFit];
    [self.menuTitleLabel align:(ViewAlignmentTopLeft) relativeToPoint:CGPointMake(self.contentLabel.leftBottomCorner.x, self.contentLabel.leftBottomCorner.y + SPACE_INTERNAL_VERTICAL)];

    //recreate menus view
    UIView *menusView = [self menusView:self.cellModel.menus];
    [[self.itemsView viewWithTag:menusView.tag] removeFromSuperview];
    [self.itemsView addSubview:menusView];
    [menusView align:(ViewAlignmentTopLeft) relativeToPoint:CGPointMake(self.menuTitleLabel.leftBottomCorner.x, self.menuTitleLabel.leftBottomCorner.y + SPACE_INTERNAL_VERTICAL)];

    self.menuFootnoteLabel.text = self.cellModel.menuFootnote;
    self.menuFootnoteLabel.viewWidth = self.currentContentWidth;
    [self.menuFootnoteLabel sizeToFit];
    [self.menuFootnoteLabel align:(ViewAlignmentTopLeft) relativeToPoint:menusView.leftBottomCorner];

    //recreate evaluate view
    UIView *evaluateView = [self evaluateRelatedView];
    [[self.itemsView viewWithTag:evaluateView.tag] removeFromSuperview];
    [self.itemsView addSubview:evaluateView];
    [evaluateView align:(ViewAlignmentTopLeft) relativeToPoint:CGPointMake(8, self.menuFootnoteLabel.leftBottomCorner.y + SPACE_INTERNAL_VERTICAL)];

    self.itemsView.viewHeight = evaluateView.viewBottomEdge;
    self.contentView.viewHeight = self.itemsView.viewBottomEdge;
    self.viewHeight = self.contentView.viewHeight;
}

- (void)updateEvaluateViewAnimatedComplete:(void(^)(void))action {
    self.manuallySetToEvaluated = YES;

    UIView *oldView = [self.itemsView viewWithTag:TAG_EVALUATE];

    UIView *newView = [self evaluateRelatedView];
    newView.alpha = 0.0;
    newView.frame = oldView.frame;
    [self.itemsView addSubview:newView];

    [UIView animateKeyframesWithDuration:0.3 delay:0.0 options:0 animations:^{
        [UIView addKeyframeWithRelativeStartTime:0.0 relativeDuration:0.5 animations:^{
            oldView.alpha = 0.0;
        }];

        [UIView addKeyframeWithRelativeStartTime:0.5 relativeDuration:0.5 animations:^{
            newView.alpha = 1.0;
        }];
    } completion:^(BOOL finished) {
        [oldView removeFromSuperview];
        if (action) {
            action();
        }
    }];
}

#pragma mark - dynamic views

- (UIView *)menusView:(NSArray *)menus {
    UIView *container = [UIView new];
    container.tag = TAG_MENUS;
    container.viewWidth = self.currentContentWidth;
    container.autoresizingMask = UIViewAutoresizingFlexibleWidth;

    CGFloat topOffset = 0;
    for (NSString *menuTitle in menus) {
        UIButton *menu = [UIButton buttonWithType:(UIButtonTypeCustom)];
        menu.viewWidth = container.viewWidth;
        menu.titleLabel.numberOfLines = 0;
        menu.autoresizingMask = UIViewAutoresizingFlexibleWidth;
        menu.titleLabel.lineBreakMode = NSLineBreakByWordWrapping;
        [menu setTitle:menuTitle forState:(UIControlStateNormal)];
        [menu setContentHorizontalAlignment:(UIControlContentHorizontalAlignmentLeft)];
        [menu.titleLabel setFont:[UIFont systemFontOfSize:FONT_SIZE_MENU]];
        [menu addTarget:self action:@selector(menuTapped:) forControlEvents:(UIControlEventTouchUpInside)];
        [menu setTitleColor:[MQChatViewConfig sharedConfig].chatViewStyle.btnTextColor forState:(UIControlStateNormal)];
        [menu align:(ViewAlignmentTopLeft) relativeToPoint:CGPointMake(0, topOffset)];
        [container addSubview:menu];
        menu.viewHeight = [MQStringSizeUtil getHeightForText:menuTitle withFont:[UIFont systemFontOfSize:FONT_SIZE_MENU] andWidth:container.viewWidth];

        topOffset += menu.viewHeight + SPACE_INTERNAL_VERTICAL;

    }

    container.viewHeight = topOffset;
    return container;
}

- (UIView *)evaluateRelatedView {
    UIView *view;
    if (self.cellModel.isEvaluated || self.manuallySetToEvaluated) {
        if (self.evaluateView.superview) {
            [self.evaluateView removeFromSuperview];
        }
        view = self.evaluatedView;
    } else {
        if (self.evaluatedView.superview) {
            [self.evaluatedView removeFromSuperview];
        }
        view = self.evaluateView;
    }

    view.tag = TAG_EVALUATE;
    return view;
}

#pragma mark - actions

- (void)menuTapped:(UIButton *)menu {
    NSString *didTapMenuText = menu.titleLabel.text;

    if ([self.chatCellDelegate respondsToSelector:@selector(didTapMenuWithText:)]) {
        [self.chatCellDelegate didTapMenuWithText:didTapMenuText];
    }
}

- (void)didTapPositive {

    [self updateEvaluateViewAnimatedComplete:^{
        if ([self.chatCellDelegate respondsToSelector:@selector(evaluateBotAnswer:messageId:)]) {
            [self.chatCellDelegate evaluateBotAnswer:true messageId:self.cellModel.messageId];
        }
    }];
}

- (void)didTapNegative {
    [self updateEvaluateViewAnimatedComplete:^{
        if ([self.chatCellDelegate respondsToSelector:@selector(evaluateBotAnswer:messageId:)]) {
            [self.chatCellDelegate evaluateBotAnswer:false messageId:self.cellModel.messageId];
        }
    }];
}

#pragma mark - lazy load

- (UIView *)evaluateView {
//    if (!_evaluateView) {
        _evaluateView = [UIView new];
        _evaluateView.viewWidth = self.itemsView.viewWidth - 8;
        _evaluateView.viewHeight = HEIHGT_VIEW_EVALUATE;
        _evaluateView.autoresizingMask = UIViewAutoresizingFlexibleWidth;

        UIView *lineH = [UIView new];
        lineH.backgroundColor = [UIColor colorWithWhite:.8 alpha:1];
        lineH.viewHeight = 0.5;
        lineH.viewWidth = _evaluateView.viewWidth;
        lineH.autoresizingMask = UIViewAutoresizingFlexibleWidth;

        UIButton *usefulButton = [UIButton new];
        usefulButton.viewWidth = _evaluateView.viewWidth / 2 - 0.5;
        usefulButton.viewHeight = _evaluateView.viewHeight - 0.5;
        usefulButton.viewY = 0.5;
        [usefulButton.titleLabel setFont:[UIFont systemFontOfSize:FONT_SIZE_EVALUATE_BUTTON]];
        usefulButton.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleRightMargin;
    [usefulButton setTitle:[MQBundleUtil localizedStringForKey:@"mq_solved"] forState:(UIControlStateNormal)];
        [usefulButton setTitleColor:[MQChatViewConfig sharedConfig].chatViewStyle.btnTextColor forState:(UIControlStateNormal)];
        [usefulButton addTarget:self action:@selector(didTapPositive) forControlEvents:(UIControlEventTouchUpInside)];

        UIView *lineV = [UIView new];
        lineV.backgroundColor = [UIColor colorWithWhite:.8 alpha:1];
        lineV.viewHeight = HEIHGT_VIEW_EVALUATE;
        lineV.viewWidth = 0.5;
        [lineV align:(ViewAlignmentTopLeft) relativeToPoint:usefulButton.rightTopCorner];
        lineV.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin;

        UIButton *uselessButton = [UIButton new];
        [uselessButton setTitleColor:[MQChatViewConfig sharedConfig].chatViewStyle.btnTextColor forState:(UIControlStateNormal)];
    [uselessButton setTitle:[MQBundleUtil localizedStringForKey:@"mq_unsolved"] forState:(UIControlStateNormal)];
        [uselessButton.titleLabel setFont:[UIFont systemFontOfSize:FONT_SIZE_EVALUATE_BUTTON]];
        [uselessButton addTarget:self action:@selector(didTapNegative) forControlEvents:(UIControlEventTouchUpInside)];
        uselessButton.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleLeftMargin;
        uselessButton.viewWidth = _evaluateView.viewWidth / 2;
        uselessButton.viewHeight = _evaluateView.viewHeight - 0.5;
        uselessButton.viewY = 0.5;
        [uselessButton align:(ViewAlignmentTopLeft) relativeToPoint:CGPointMake(usefulButton.viewRightEdge + 0.5, usefulButton.viewY)];

        [_evaluateView addSubview:lineH];
        [_evaluateView addSubview:lineV];
        [_evaluateView addSubview:usefulButton];
        [_evaluateView addSubview:uselessButton];
//    }
    return _evaluateView;
}

- (UIView *)evaluatedView {
//    if (!_evaluatedView) {
        _evaluatedView = [UIView new];
        _evaluatedView.viewWidth = self.itemsView.viewWidth - 8;
        _evaluatedView.viewHeight = HEIHGT_VIEW_EVALUATE;
        _evaluatedView.autoresizingMask = UIViewAutoresizingFlexibleWidth;

        UIView *lineH = [UIView new];
        lineH.backgroundColor = [UIColor colorWithWhite:.8 alpha:1];
        lineH.viewHeight = 0.5;
        lineH.viewWidth = _evaluatedView.viewWidth;
        lineH.autoresizingMask = UIViewAutoresizingFlexibleWidth;
        [_evaluatedView addSubview:lineH];

        UIButton *button = [UIButton new];
        button.viewWidth = _evaluatedView.viewWidth;
        button.viewHeight = _evaluatedView.viewHeight - 0.5;
        button.viewY = 0.5;
        [button setTitleColor:[UIColor lightGrayColor] forState:(UIControlStateNormal)];
        [button.titleLabel setFont:[UIFont systemFontOfSize:FONT_SIZE_EVALUATE_BUTTON]];
    [button setTitle:[MQBundleUtil localizedStringForKey:@"mq_commited"] forState:(UIControlStateNormal)];
        [button setAutoresizingMask:(UIViewAutoresizingFlexibleWidth)];
        [_evaluatedView addSubview:button];
//    }
    return _evaluatedView;
}

- (UILabel *)contentLabel {
    if (!_contentLabel) {
        _contentLabel = [UILabel new];
        _contentLabel.numberOfLines = 0;
        _contentLabel.font = [UIFont systemFontOfSize:FONT_SIZE_CONTENT];
        _contentLabel.textColor = [MQChatViewConfig sharedConfig].incomingMsgTextColor;
    }
    return _contentLabel;
}

- (UILabel *)menuTitleLabel {
    if (!_menuTitleLabel) {
        _menuTitleLabel = [UILabel new];
        _menuTitleLabel.numberOfLines = 0;
        _menuTitleLabel.font = [UIFont systemFontOfSize:FONT_SIZE_MENU_TITLE];
        _menuTitleLabel.textColor = [UIColor grayColor];
    }
    return _menuTitleLabel;
}

- (UILabel *)menuFootnoteLabel {
    if (!_menuFootnoteLabel) {
        _menuFootnoteLabel = [UILabel new];
        _menuFootnoteLabel.numberOfLines = 0;
        _menuFootnoteLabel.font = [UIFont systemFontOfSize:FONT_SIZE_MENU_FOOTNOTE];
        _menuFootnoteLabel.textColor = [UIColor grayColor];
    }
    return _menuFootnoteLabel;
}

- (UIImageView *)itemsView {
    if (!_itemsView) {
        _itemsView = [UIImageView new];
        _itemsView.userInteractionEnabled = true;
        UIImage *bubbleImage = [MQChatViewConfig sharedConfig].incomingBubbleImage;
        if ([MQChatViewConfig sharedConfig].incomingBubbleColor) {
            bubbleImage = [MQImageUtil convertImageColorWithImage:bubbleImage toColor:[MQChatViewConfig sharedConfig].incomingBubbleColor];
        }
        bubbleImage = [bubbleImage resizableImageWithCapInsets:[MQChatViewConfig sharedConfig].bubbleImageStretchInsets];
        _itemsView.image = bubbleImage;
    }
    return _itemsView;
}

- (UIImageView *)avatarImageView {
    if (!_avatarImageView) {
        _avatarImageView = [[UIImageView alloc] init];
        _avatarImageView.contentMode = UIViewContentModeScaleAspectFit;
        _avatarImageView.viewSize = CGSizeMake(kMQCellAvatarDiameter, kMQCellAvatarDiameter);
        _avatarImageView.image = [MQChatViewConfig sharedConfig].incomingDefaultAvatarImage;
        if ([MQChatViewConfig sharedConfig].enableRoundAvatar) {
            _avatarImageView.layer.masksToBounds = YES;
            _avatarImageView.layer.cornerRadius = _avatarImageView.viewSize.width/2;
        }
    }
    return _avatarImageView;
}

@end


text:
CREATE TABLE IF NOT EXISTS lister.ls_simple_type (
    subject_id uuid NOT NULL
  , record_id uuid NOT NULL
  , created timestamp(6) with time zone DEFAULT current_timestamp
  , created_by varchar(50) NOT NULL
  , is_current boolean NOT NULL
  , replaced timestamp(6) with time zone NULL
  , replaced_by_record uuid NULL
  , storage_option varchar(30) NOT NULL
  , name varchar(240) NOT NULL
  , constructor varchar(320) NOT NULL

  CONSTRAINT
    PRIMARY KEY ( subject_id, record_id )
    UNIQUE name
);

CREATE INDEX IF NOT EXISTS lister.ls_simple_type_subject ON lister.ls_simple_type ( subject_id );
CREATE INDEX IF NOT EXISTS lister.ls_simple_type_current ON lister.ls_simple_type ( subject_id, is_current );
CREATE INDEX IF NOT EXISTS lister.ls_simple_type_author ON lister.ls_simple_type ( created_by );
CREATE INDEX IF NOT EXISTS lister.ls_simple_type_key ON lister.ls_simple_type ( name, is_current );

COMMENT ON TABLE lister.ls_simple_type IS
  'Defines the available primitive value types that can be used in templates, documents, and composite types.';
COMMENT ON COLUMN lister.ls_simple_type.subject_id IS
  'A universally unique identifier for a subject, about which this table contains one or more records.';
COMMENT ON COLUMN lister.ls_simple_type.record_id IS
  'A universally unique identifier for a record about a subject.';
COMMENT ON COLUMN lister.ls_simple_type.created IS
  'A time stamp indicating the instant the record was created.';
COMMENT ON COLUMN lister.ls_simple_type.created_by IS
  'The user name of the user responsible for creating this record.';
COMMENT ON COLUMN lister.ls_simple_type.is_current IS
  'Indicates whether or not this record is the currently valid record for the subject.';
COMMENT ON COLUMN lister.ls_simple_type.replaced IS
  'A time stamp indicating the instant the record was replaced by another record as the currently valid record. NULL if this is the currently valid record.';
COMMENT ON COLUMN lister.ls_simple_type.replaced_by_record IS
  'The record_id of the record that replaced this one as the currently valid record. NULL if this is the currently valid record.';
COMMENT ON COLUMN lister.ls_simple_type.storage_option IS
  'Specifies whether value representations of this type will be stored in the table ls_value or ls_object. Should be either "value" or "object".';
COMMENT ON COLUMN lister.ls_simple_type.name IS
  'The name of the the value type. Use namespacing where required, as this value must be unique for the system.';
COMMENT ON COLUMN lister.ls_simple_type.constructor IS
  'A callable reference to the function that will convert the value type\'s string representation to the value type. ("Callable" means that the selected "sinclair" back-end system can use this value to call the function at runtime.';


text:
<!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/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.7"/>
<title>MAGMA: double precision</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>

<link href="navtree.css" rel="stylesheet" type="text/css"/>

<link href="search/search.css" rel="stylesheet" type="text/css"/>

<link href="doxygen.css" rel="stylesheet" type="text/css" />

MAGMA
    1.6.1

Matrix Algebra for GPU and Multicore Architectures

Main Page

Related Pages

Modules

Classes

Files

          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)"
               onblur="searchBox.OnSearchFieldFocus(false)"
               onkeyup="searchBox.OnSearchFieldChange(event)"/>

 All Classes Files Functions Friends Groups Pages

Functions

double precision
Level-1 auxiliary

Functions

void 	magmablas_dlarfg_q (magma_int_t n, magmaDouble_ptr dalpha, magmaDouble_ptr dx, magma_int_t incx, magmaDouble_ptr dtau, magma_queue_t queue)

 	DLARFG generates a real elementary reflector (Householder matrix) H of order n, such that.  More...

void 	magmablas_dlarfg (magma_int_t n, magmaDouble_ptr dalpha, magmaDouble_ptr dx, magma_int_t incx, magmaDouble_ptr dtau)

Detailed Description

Function Documentation

          void magmablas_dlarfg
          (
          magma_int_t
          n,

          magmaDouble_ptr
          dalpha,

          magmaDouble_ptr
          dx,

          magma_int_t
          incx,

          magmaDouble_ptr
          dtau

          )

See also

magmablas_dlarfg_q

          void magmablas_dlarfg_q
          (
          magma_int_t
          n,

          magmaDouble_ptr
          dalpha,

          magmaDouble_ptr
          dx,

          magma_int_t
          incx,

          magmaDouble_ptr
          dtau,

          magma_queue_t
          queue

          )

DLARFG generates a real elementary reflector (Householder matrix) H of order n, such that.

H * ( alpha ) = ( beta ), H**H * H = I. ( x ) ( 0 )

where alpha and beta are scalars, with beta real and beta = ±norm([alpha, x]), and x is an (n-1)-element real vector. H is represented in the form

 H = I - tau * ( 1 ) * ( 1 v**H ),
               ( v )

where tau is a real scalar and v is a real (n-1)-element vector. Note that H is not symmetric.

If the elements of x are all zero and dalpha is real, then tau = 0 and H is taken to be the unit matrix.

Otherwise 1 <= real(tau) <= 2 and abs(tau-1) <= 1.

Parameters

[in]	n	INTEGER The order of the elementary reflector.

[in,out]	dalpha	DOUBLE_PRECISION* on the GPU. On entry, pointer to the value alpha, i.e., the first entry of the vector. On exit, it is overwritten with the value beta.

[in,out]	dx	DOUBLE_PRECISION array, dimension (1+(N-2)*abs(INCX)), on the GPU On entry, the (n-1)-element vector x. On exit, it is overwritten with the vector v.

[in]	incx	INTEGER The increment between elements of X. INCX > 0.

[out]	dtau	DOUBLE_PRECISION* on the GPU. Pointer to the value tau.

[in]	queue	magma_queue_t Queue to execute in.

Generated on Fri Jan 30 2015 19:00:48 for MAGMA by

     1.8.7


text:
package com.googlecode.leptonica.android;

import android.graphics.Rect;

/**
 * Java representation of a native Leptonica PIX object.
 *
 * @author alanv@google.com (Alan Viverette)
 */
public class Pix {
    static {
        System.loadLibrary("pngtess");
        System.loadLibrary("lept");
    }

    /** Index of the image width within the dimensions array. */
    public static final int INDEX_W = 0;

    /** Index of the image height within the dimensions array. */
    public static final int INDEX_H = 1;

    /** Index of the image bit-depth within the dimensions array. */
    public static final int INDEX_D = 2;

    /** Package-accessible pointer to native pix */
    private final long mNativePix;

    private boolean mRecycled;

    /**
     * Creates a new Pix wrapper for the specified native PIX object.
     *
     * @param nativePix A pointer to the native PIX object.
     */
    public Pix(long nativePix) {
        mNativePix = nativePix;
        mRecycled = false;
    }

    public Pix(int width, int height, int depth) {
        if (width <= 0 || height <= 0) {
            throw new IllegalArgumentException("Pix width and height must be > 0");
        } else if (depth != 1 && depth != 2 && depth != 4 && depth != 8 && depth != 16
                && depth != 24 && depth != 32) {
            throw new IllegalArgumentException("Depth must be one of 1, 2, 4, 8, 16, or 32");
        }

        mNativePix = nativeCreatePix(width, height, depth);
        mRecycled = false;
    }

    /**
     * Returns a pointer to the native Pix object. This is used by native code
     * and is only valid within the same process in which the Pix was created.
     *
     * @return a native pointer to the Pix object
     */
    public long getNativePix() {
        if (mRecycled)
            throw new IllegalStateException();

        return mNativePix;
    }

    /**
     * Return the raw bytes of the native PIX object. You can reconstruct the
     * Pix from this data using createFromPix().
     *
     * @return a copy of this PIX object's raw data
     */
    public byte[] getData() {
        if (mRecycled)
            throw new IllegalStateException();

        byte[] buffer = nativeGetData(mNativePix);

        if (buffer == null) {
            throw new RuntimeException("native getData failed");
        }

        return buffer;
    }

    /**
     * Returns an array of this image's dimensions. See Pix.INDEX_* for indices.
     *
     * @return an array of this image's dimensions or null on
     *         failure
     */
    public int[] getDimensions() {
        if (mRecycled)
            throw new IllegalStateException();

        int[] dimensions = new int[3];

        if (getDimensions(dimensions)) {
            return dimensions;
        }

        return null;
    }

    /**
     * Fills an array with this image's dimensions. The array must be at least 3
     * elements long.
     *
     * @param dimensions An integer array with at least three elements.
     * @return true on success
     */
    public boolean getDimensions(int[] dimensions) {
        if (mRecycled)
            throw new IllegalStateException();

        return nativeGetDimensions(mNativePix, dimensions);
    }

    /**
     * Returns a clone of this Pix. This does NOT create a separate copy, just a
     * new pointer that can be recycled without affecting other clones.
     *
     * @return a clone (shallow copy) of the Pix
     */
    @Override
    public Pix clone() {
        if (mRecycled)
            throw new IllegalStateException();

        long nativePix = nativeClone(mNativePix);

        if (nativePix == 0) {
            throw new OutOfMemoryError();
        }

        return new Pix(nativePix);
    }

    /**
     * Returns a deep copy of this Pix that can be modified without affecting
     * the original Pix.
     *
     * @return a copy of the Pix
     */
    public Pix copy() {
        if (mRecycled)
            throw new IllegalStateException();

        long nativePix = nativeCopy(mNativePix);

        if (nativePix == 0) {
            throw new OutOfMemoryError();
        }

        return new Pix(nativePix);
    }

    /**
     * Inverts this Pix in-place.
     *
     * @return true on success
     */
    public boolean invert() {
        if (mRecycled)
            throw new IllegalStateException();

        return nativeInvert(mNativePix);
    }

    /**
     * Releases resources and frees any memory associated with this Pix. You may
     * not modify or access the pix after calling this method.
     */
    public void recycle() {
        if (!mRecycled) {
            nativeDestroy(mNativePix);

            mRecycled = true;
        }
    }

    /**
     * Creates a new Pix from raw Pix data obtained from getData().
     *
     * @param pixData Raw pix data obtained from getData().
     * @param width The width of the original Pix.
     * @param height The height of the original Pix.
     * @param depth The bit-depth of the original Pix.
     * @return a new Pix or null on error
     */
    public static Pix createFromPix(byte[] pixData, int width, int height, int depth) {
        long nativePix = nativeCreateFromData(pixData, width, height, depth);

        if (nativePix == 0) {
            throw new OutOfMemoryError();
        }

        return new Pix(nativePix);
    }

    /**
     * Returns a Rect with the width and height of this Pix.
     *
     * @return a Rect with the width and height of this Pix
     */
    public Rect getRect() {
        int w = getWidth();
        int h = getHeight();

        return new Rect(0, 0, w, h);
    }

    /**
     * Returns the width of this Pix.
     *
     * @return the width of this Pix
     */
    public int getWidth() {
        if (mRecycled)
            throw new IllegalStateException();

        return nativeGetWidth(mNativePix);
    }

    /**
     * Returns the height of this Pix.
     *
     * @return the height of this Pix
     */
    public int getHeight() {
        if (mRecycled)
            throw new IllegalStateException();

        return nativeGetHeight(mNativePix);
    }

    /**
     * Returns the depth of this Pix.
     *
     * @return the depth of this Pix
     */
    public int getDepth() {
        if (mRecycled)
            throw new IllegalStateException();

        return nativeGetDepth(mNativePix);
    }

    public int getRefCount() {
        return nativeGetRefCount(mNativePix);
    }

    /**
     * Returns the {@link android.graphics.Color} at the specified location.
     *
     * @param x The x coordinate (0...width-1) of the pixel to return.
     * @param y The y coordinate (0...height-1) of the pixel to return.
     * @return The argb {@link android.graphics.Color} at the specified
     *         coordinate.
     * @throws IllegalArgumentException If x, y exceeds the image bounds.
     */
    public int getPixel(int x, int y) {
        if (mRecycled)
            throw new IllegalStateException();

        if (x < 0 || x >= getWidth()) {
            throw new IllegalArgumentException("Supplied x coordinate exceeds image bounds");
        } else if (y < 0 || y >= getHeight()) {
            throw new IllegalArgumentException("Supplied y coordinate exceeds image bounds");
        }

        return nativeGetPixel(mNativePix, x, y);
    }

    /**
     * Sets the {@link android.graphics.Color} at the specified location.
     *
     * @param x The x coordinate (0...width-1) of the pixel to set.
     * @param y The y coordinate (0...height-1) of the pixel to set.
     * @param color The argb {@link android.graphics.Color} to set at the
     *            specified coordinate.
     * @throws IllegalArgumentException If x, y exceeds the image bounds.
     */
    public void setPixel(int x, int y, int color) {
        if (mRecycled)
            throw new IllegalStateException();

        if (x < 0 || x >= getWidth()) {
            throw new IllegalArgumentException("Supplied x coordinate exceeds image bounds");
        } else if (y < 0 || y >= getHeight()) {
            throw new IllegalArgumentException("Supplied y coordinate exceeds image bounds");
        }

        nativeSetPixel(mNativePix, x, y, color);
    }

    // ***************
    // * NATIVE CODE *
    // ***************

    private static native int nativeGetRefCount(long nativePix);
    private static native long nativeCreatePix(int w, int h, int d);
    private static native long nativeCreateFromData(byte[] data, int w, int h, int d);
    private static native byte[] nativeGetData(long nativePix);
    private static native long nativeClone(long nativePix);
    private static native long nativeCopy(long nativePix);
    private static native boolean nativeInvert(long nativePix);
    private static native void nativeDestroy(long nativePix);
    private static native boolean nativeGetDimensions(long nativePix, int[] dimensions);
    private static native int nativeGetWidth(long nativePix);
    private static native int nativeGetHeight(long nativePix);
    private static native int nativeGetDepth(long nativePix);
    private static native int nativeGetPixel(long nativePix, int x, int y);
    private static native void nativeSetPixel(long nativePix, int x, int y, int color);
}