text:
package com.horcrux.svg;

import javax.annotation.Nullable;

import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.DashPathEffect;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.Point;
import android.graphics.RectF;

import android.graphics.Color;

import com.facebook.common.logging.FLog;
import com.facebook.react.bridge.JSApplicationIllegalArgumentException;
import com.facebook.react.bridge.JavaOnlyArray;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.bridge.WritableArray;
import com.facebook.react.common.ReactConstants;
import com.facebook.react.uimanager.annotations.ReactProp;

import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * Shadow node for virtual RNSVGPath view
 */
public class RNSVGPathShadowNode extends RNSVGVirtualNode {

    private static final int CAP_BUTT = 0;
    private static final int CAP_ROUND = 1;
    private static final int CAP_SQUARE = 2;

    private static final int JOIN_BEVEL = 2;
    private static final int JOIN_MITER = 0;
    private static final int JOIN_ROUND = 1;

    private static final int FILL_RULE_EVENODD = 0;
    private static final int FILL_RULE_NONZERO = 1;

    public @Nullable ReadableArray mStroke;
    public @Nullable float[] mStrokeDasharray;
    public float mStrokeWidth = 1;
    public float mStrokeOpacity = 1;
    public float mStrokeMiterlimit = 4;
    public float mStrokeDashoffset = 0;
    public Paint.Cap mStrokeLinecap = Paint.Cap.ROUND;
    public Paint.Join mStrokeLinejoin = Paint.Join.ROUND;

    public @Nullable ReadableArray mFill;
    public float mFillOpacity = 1;
    public Path.FillType mFillRule = Path.FillType.WINDING;
    private boolean mFillRuleSet;

    protected Path mPath;
    private float[] mD;

    private ArrayList<String> mChangedList;
    private ArrayList<Object> mOriginProperties;
    protected ReadableArray mPropList = new JavaOnlyArray();
    protected WritableArray mOwnedPropList = new JavaOnlyArray();

    @ReactProp(name = "d")
    public void setPath(@Nullable ReadableArray shapePath) {
        mD = PropHelper.toFloatArray(shapePath);
        setupPath();
        markUpdated();
    }

    @ReactProp(name = "fill")
    public void setFill(@Nullable ReadableArray fill) {
        mFill = fill;
        markUpdated();
    }

    @ReactProp(name = "fillOpacity", defaultFloat = 1f)
    public void setFillOpacity(float fillOpacity) {
        mFillOpacity = fillOpacity;
        markUpdated();
    }

    @ReactProp(name = "fillRule", defaultInt = FILL_RULE_NONZERO)
    public void setFillRule(int fillRule) {
        switch (fillRule) {
            case FILL_RULE_EVENODD:
                mFillRule = Path.FillType.EVEN_ODD;
                break;
            case FILL_RULE_NONZERO:
                break;
            default:
                throw new JSApplicationIllegalArgumentException(
                    "fillRule " + mFillRule + " unrecognized");
        }

        mFillRuleSet = true;
        setupPath();
        markUpdated();
    }

    @ReactProp(name = "stroke")
    public void setStroke(@Nullable ReadableArray strokeColors) {
        mStroke = strokeColors;
        markUpdated();
    }

    @ReactProp(name = "strokeOpacity", defaultFloat = 1f)
    public void setStrokeOpacity(float strokeOpacity) {
        mStrokeOpacity = strokeOpacity;
        markUpdated();
    }

    @ReactProp(name = "strokeDasharray")
    public void setStrokeDasharray(@Nullable ReadableArray strokeDasharray) {

        mStrokeDasharray = PropHelper.toFloatArray(strokeDasharray);
        if (mStrokeDasharray != null && mStrokeDasharray.length > 0) {
            for (int i = 0; i < mStrokeDasharray.length; i++) {
                mStrokeDasharray[i] = mStrokeDasharray[i] * mScale;
            }
        }
        markUpdated();
    }

    @ReactProp(name = "strokeDashoffset", defaultFloat = 0f)
    public void setStrokeDashoffset(float strokeWidth) {
        mStrokeDashoffset = strokeWidth * mScale;
        markUpdated();
    }

    @ReactProp(name = "strokeWidth", defaultFloat = 1f)
    public void setStrokeWidth(float strokeWidth) {
        mStrokeWidth = strokeWidth;
        markUpdated();
    }

    @ReactProp(name = "strokeMiterlimit", defaultFloat = 4f)
    public void setStrokeMiterlimit(float strokeMiterlimit) {
        mStrokeMiterlimit = strokeMiterlimit;
        markUpdated();
    }

    @ReactProp(name = "strokeLinecap", defaultInt = CAP_ROUND)
    public void setStrokeLinecap(int strokeLinecap) {
        switch (strokeLinecap) {
            case CAP_BUTT:
                mStrokeLinecap = Paint.Cap.BUTT;
                break;
            case CAP_SQUARE:
                mStrokeLinecap = Paint.Cap.SQUARE;
                break;
            case CAP_ROUND:
                mStrokeLinecap = Paint.Cap.ROUND;
                break;
            default:
                throw new JSApplicationIllegalArgumentException(
                    "strokeLinecap " + mStrokeLinecap + " unrecognized");
        }
        markUpdated();
    }

    @ReactProp(name = "strokeLinejoin", defaultInt = JOIN_ROUND)
    public void setStrokeLinejoin(int strokeLinejoin) {
        switch (strokeLinejoin) {
            case JOIN_MITER:
                mStrokeLinejoin = Paint.Join.MITER;
                break;
            case JOIN_BEVEL:
                mStrokeLinejoin = Paint.Join.BEVEL;
                break;
            case JOIN_ROUND:
                mStrokeLinejoin = Paint.Join.ROUND;
                break;
            default:
                throw new JSApplicationIllegalArgumentException(
                    "strokeLinejoin " + mStrokeLinejoin + " unrecognized");
        }
        markUpdated();
    }

    @ReactProp(name = "propList")
    public void setPropList(@Nullable ReadableArray propList) {
        WritableArray copy = new JavaOnlyArray();

        if (propList != null) {
            for (int i = 0; i < propList.size(); i++) {
                String fieldName = propertyNameToFieldName(propList.getString(i));
                copy.pushString(fieldName);
                mOwnedPropList.pushString(fieldName);
            }

        }

        mPropList = copy;
        markUpdated();
    }

    @Override
    public void draw(Canvas canvas, Paint paint, float opacity) {
        opacity *= mOpacity;

        if (opacity > MIN_OPACITY_FOR_DRAW) {
            int count = saveAndSetupCanvas(canvas);
            if (mPath == null) {
                throw new JSApplicationIllegalArgumentException(
                    "Paths should have a valid path (d) prop");
            }

            clip(canvas, paint);
            if (setupFillPaint(paint, opacity * mFillOpacity, null)) {
                canvas.drawPath(mPath, paint);
            }
            if (setupStrokePaint(paint, opacity * mStrokeOpacity, null)) {
                canvas.drawPath(mPath, paint);
            }

            restoreCanvas(canvas, count);
            markUpdateSeen();
        }
    }

    private void setupPath() {
        // init path after both fillRule and path have been set
        if (mFillRuleSet && mD != null) {
            mPath = new Path();
            mPath.setFillType(mFillRule);
            super.createPath(mD, mPath);
        }
    }

  /**
   * sorting stops and stopsColors from array
   */
    private static void parseGradientStops(ReadableArray value, int stopsCount, float[] stops, int[] stopsColors, int startColorsPosition) {
        int startStops = value.size() - stopsCount;
        for (int i = 0; i < stopsCount; i++) {
            stops[i] = (float)value.getDouble(startStops + i);
            stopsColors[i] = Color.argb(
                    (int) (value.getDouble(startColorsPosition + i * 4 + 3) * 255),
                    (int) (value.getDouble(startColorsPosition + i * 4) * 255),
                    (int) (value.getDouble(startColorsPosition + i * 4 + 1) * 255),
                    (int) (value.getDouble(startColorsPosition + i * 4 + 2) * 255));

        }
    }

    /**
     * Sets up paint according to the props set on a shadow view. Returns {@code true}
     * if the fill should be drawn, {@code false} if not.
     */
    protected boolean setupFillPaint(Paint paint, float opacity, @Nullable RectF box) {
        if (mFill != null && mFill.size() > 0) {
            paint.reset();
            paint.setFlags(Paint.ANTI_ALIAS_FLAG);
            paint.setStyle(Paint.Style.FILL);
            setupPaint(paint, opacity, mFill, box);
            return true;
        }
        return false;
    }

    /**
     * Sets up paint according to the props set on a shadow view. Returns {@code true}
     * if the stroke should be drawn, {@code false} if not.
     */
    protected boolean setupStrokePaint(Paint paint, float opacity, @Nullable  RectF box) {
        paint.reset();
        if (mStrokeWidth == 0 || mStroke == null || mStroke.size() == 0) {
            return false;
        }

        paint.setFlags(Paint.ANTI_ALIAS_FLAG);
        paint.setStyle(Paint.Style.STROKE);
        paint.setStrokeCap(mStrokeLinecap);
        paint.setStrokeJoin(mStrokeLinejoin);
        paint.setStrokeMiter(mStrokeMiterlimit * mScale);
        paint.setStrokeWidth(mStrokeWidth * mScale);
        setupPaint(paint, opacity, mStroke, box);

        if (mStrokeDasharray != null && mStrokeDasharray.length > 0) {
            paint.setPathEffect(new DashPathEffect(mStrokeDasharray, mStrokeDashoffset));
        }

        return true;
    }

    private void setupPaint(Paint paint, float opacity, ReadableArray colors, @Nullable RectF box) {
        int colorType = colors.getInt(0);
        if (colorType == 0) {
            // solid color
            paint.setARGB(
                (int) (colors.size() > 4 ? colors.getDouble(4) * opacity * 255 : opacity * 255),
                (int) (colors.getDouble(1) * 255),
                (int) (colors.getDouble(2) * 255),
                (int) (colors.getDouble(3) * 255));
        } else if (colorType == 1) {
            if (box == null) {
                box = new RectF();
                mPath.computeBounds(box, true);
            }
            PropHelper.RNSVGBrush brush = getSvgShadowNode().getDefinedBrush(colors.getString(1));
            if (brush != null) {
                brush.setupPaint(paint, box, mScale, opacity);
            }
        } else {
            // TODO: Support pattern.
            FLog.w(ReactConstants.TAG, "RNSVG: Color type " + colorType + " not supported!");
        }

    }

    @Override
    protected Path getPath(Canvas canvas, Paint paint) {
        return mPath;
    }

    @Override
    public int hitTest(Point point, @Nullable Matrix matrix) {
        Bitmap bitmap = Bitmap.createBitmap(
            mCanvasWidth,
            mCanvasHeight,
            Bitmap.Config.ARGB_8888);

        Canvas canvas = new Canvas(bitmap);

        if (matrix != null) {
            canvas.concat(matrix);
        }

        canvas.concat(mMatrix);

        Paint paint = new Paint();
        clip(canvas, paint);
        setHitTestFill(paint);
        canvas.drawPath(mPath, paint);

        if (setHitTestStroke(paint)) {
            canvas.drawPath(mPath, paint);
        }

        canvas.setBitmap(bitmap);
        try {
            if (bitmap.getPixel(point.x, point.y) != 0) {
                return getReactTag();
            }
        } catch (Exception e) {

            return -1;
        } finally {
            bitmap.recycle();
        }
        return -1;
    }

    protected void setHitTestFill(Paint paint) {
        paint.reset();
        paint.setARGB(255, 0, 0, 0);
        paint.setFlags(Paint.ANTI_ALIAS_FLAG);
        paint.setStyle(Paint.Style.FILL);
    }

    protected boolean setHitTestStroke(Paint paint) {
        if (mStrokeWidth == 0) {
            return false;
        }

        paint.reset();
        paint.setARGB(255, 0, 0, 0);
        paint.setFlags(Paint.ANTI_ALIAS_FLAG);
        paint.setStyle(Paint.Style.STROKE);
        paint.setStrokeWidth(mStrokeWidth * mScale);
        paint.setStrokeCap(mStrokeLinecap);
        paint.setStrokeJoin(mStrokeLinejoin);
        return true;
    }

    @Override
    public void mergeProperties(RNSVGVirtualNode target, ReadableArray mergeList, boolean inherited) {
        if (mergeList.size() == 0) {
            return;
        }

        if (!inherited) {
            mOriginProperties = new ArrayList<>();
            mChangedList = new ArrayList<>();
        }

        WritableArray propList = new JavaOnlyArray();
        for (int i = 0; i < mPropList.size(); i++) {
            propList.pushString(mPropList.getString(i));
        }
        mOwnedPropList = propList;

        for (int i = 0, size = mergeList.size(); i < size; i++) {
            try {
                String fieldName = mergeList.getString(i);
                Field field = getClass().getField(fieldName);
                Object value = field.get(target);

                if (inherited) {
                    if (!hasOwnProperty(fieldName)) {
                        field.set(this, value);
                        propList.pushString(fieldName);
                    }
                } else {
                    mOriginProperties.add(field.get(this));
                    mChangedList.add(fieldName);
                    field.set(this, value);
                }
            } catch (Exception e) {
                throw new IllegalStateException(e);
            }
        }
    }

    @Override
    public void mergeProperties(RNSVGVirtualNode target, ReadableArray mergeList) {
        mergeProperties(target, mergeList, false);
    }

    @Override
    public void resetProperties() {
        if (mChangedList != null) {
            try {
                for (int i = mChangedList.size() - 1; i >= 0; i--) {
                    Field field = getClass().getField(mChangedList.get(i));
                    field.set(this, mOriginProperties.get(i));
                }
            } catch (Exception e) {
                throw new IllegalStateException(e);
            }

            mChangedList = null;
            mOriginProperties = null;
        }
    }

    // convert propertyName something like fillOpacity to fieldName like mFillOpacity
    private String propertyNameToFieldName(String fieldName) {
        Pattern pattern = Pattern.compile("^(\\w)");
        Matcher matched = pattern.matcher(fieldName);
        StringBuffer sb = new StringBuffer("m");
        while (matched.find()) {
            matched.appendReplacement(sb, matched.group(1).toUpperCase());
        }
        matched.appendTail(sb);
        return sb.toString();
    }

    private boolean hasOwnProperty(String propName) {
        for (int i = mOwnedPropList.size() - 1; i >= 0; i--) {
            if (mOwnedPropList.getString(i).equals(propName)) {
                return true;
            }
        }
        return false;
    }
}

redpajama_set_name: RedPajamaGithub


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<TITLE>
SlideShowRecordDumper (POI API Documentation)
</TITLE>

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../stylesheet.css" TITLE="Style">

      Overview
      Package
    Class
      Use
      Tree
      Deprecated
      Index
      Help

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  All Classes

  SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD

org.apache.poi.hslf.dev

Class SlideShowRecordDumper

java.lang.Object
  org.apache.poi.hslf.dev.SlideShowRecordDumper

public final class SlideShowRecordDumper
extends java.lang.Object

This class provides a way to view the contents of a powerpoint file.
 It will use the recored layer to grok the contents of the file, and
  will print out what it finds.

Author:

Nick Burch

Constructor Summary

SlideShowRecordDumper(java.io.PrintStream ps,
                      java.lang.String fileName,
                      boolean verbose,
                      boolean escher)

          Constructs a Powerpoint dump from fileName.

Method Summary

 int
getDiskLen(Record r)

 java.lang.String
getPrintableRecordContents(Record r)

static void
main(java.lang.String[] args)

          right now this function takes one parameter: a ppt file, and outputs a
 dump of what it contains

 java.lang.String
makeHex(int number,
        int padding)

 void
printDump()

 void
printEscherRecord(EscherRecord er,
                  int indent)

static void
printUsage()

 java.lang.String
reverseHex(java.lang.String s)

 void
walkTree(int depth,
         int pos,
         Record[] records,
         int indent)

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

SlideShowRecordDumper

public SlideShowRecordDumper(java.io.PrintStream ps,
                             java.lang.String fileName,
                             boolean verbose,
                             boolean escher)
                      throws java.io.IOException

Constructs a Powerpoint dump from fileName. Parses the document
 and dumps out the contents

Parameters:
fileName - The name of the file to read.

Throws:

java.io.IOException - if there is a problem while parsing the document.

Method Detail

main

public static void main(java.lang.String[] args)
                 throws java.io.IOException

right now this function takes one parameter: a ppt file, and outputs a
 dump of what it contains

Throws:

java.io.IOException

printUsage

public static void printUsage()

printDump

public void printDump()
               throws java.io.IOException

Throws:

java.io.IOException

makeHex

public java.lang.String makeHex(int number,
                                int padding)

reverseHex

public java.lang.String reverseHex(java.lang.String s)

getDiskLen

public int getDiskLen(Record r)
               throws java.io.IOException

Throws:

java.io.IOException

getPrintableRecordContents

public java.lang.String getPrintableRecordContents(Record r)
                                            throws java.io.IOException

Throws:

java.io.IOException

printEscherRecord

public void printEscherRecord(EscherRecord er,
                              int indent)

walkTree

public void walkTree(int depth,
                     int pos,
                     Record[] records,
                     int indent)
              throws java.io.IOException

Throws:

java.io.IOException

      Overview
      Package
    Class
      Use
      Tree
      Deprecated
      Index
      Help

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  All Classes

  SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD

                Copyright 2017 The Apache Software Foundation or
        its licensors, as applicable.


text:
=head1 NAME

pacfile - display information about package files

=head1 SYNOPSIS

 pacfile [options] <path>...
 pacfile (--help|--version)

=head1 DESCRIPTION

Display file information from the local package database.

=head1 OPTIONS

=over

=item B<--config>=F<path>

Set an alternate configuration file path.

=item B<--dbpath>=F<path>

Set an alternate database path.

=item B<--root>=F<path>

Set an alternate installation root.

=item B<--sysroot>=F<path>

Set an alternate system root.  See L<pacutils-sysroot(7)>.

=item B<--package>=I<pkgname>

Limit information to the specified package.  May be specified multiple times.

=item B<--check>

Compare database values to the file system.

=item B<--help>

Display usage information and exit.

=item B<--version>

Display version information and exit.

=back


text:
#undef _RWSTD_NO_EXTENSIONS
#define _RWSTD_NO_EXTENSIONS

// working around a SunOS/SunPro bug (PR #26255)
#if defined (__SUNPRO_CC) && (defined (__SunOS_5_8) || defined (__SunOS_5_9))
#  include <time.h>
#endif   // SunPro && SunOS 5.{8,9}

#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cwchar>
#include <cwctype>

#include <assert.h>
#include <ctype.h>
#include <errno.h>
#include <float.h>
#include <iso646.h>
#include <limits.h>
#include <locale.h>
#include <math.h>
#include <setjmp.h>
#include <signal.h>
#include <stdarg.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <wchar.h>
#include <wctype.h>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

/***********************************************************************/

int count_called = 0;
int count_pred_called = 0;
int distance_called = 0;

#if !defined (__SUNPRO_CC) || __SUNPRO_CC > 0x550

template <class T, class U>
void count (T, T, const U&, ...) { ++count_called; }

template <class T, class U>
void count_if (T, T, U, ...) { ++count_pred_called; }

template <class T>
void distance (T, T, ...) { ++distance_called; }

#else

// working around a SunPro bug (PR #28678)

template <class T, class U>
void count (T, T, const U&, std::size_t&) { ++count_called; }

template <class T, class U>
void count_if (T, T, U, std::size_t&) { ++count_pred_called; }

template <class T>
void distance (T, T, std::size_t&) { ++distance_called; }

#endif   // SunPro

#if !defined (__GNUG__) || __GNUG__ > 2

int ellipsis_called /* = 0 */;

struct NumGet: std::num_get<char>
{
    typedef std::num_get<char> Base;

#  ifndef _RWSTD_NO_USING_ACCESS_ADJUSTMENT

    _USING (Base::get);

#  else   // if defined (_RWSTD_NO_USING_ACCESS_ADJUSTMENT)

    Base::get;

#  endif   // _RWSTD_NO_USING_ACCESS_ADJUSTMENT

    iter_type get (iter_type, iter_type,
                   std::ios_base&, std::ios_base::iostate&, ...) const {
        ++ellipsis_called;
        return iter_type ();
    }
};

#endif   // gcc > 2.x

template <class T>
struct convertible
{
    operator T () const {
        static union {
            void *dummy;
            char buffer [sizeof (T)];
        } u;

        return (T)*u.buffer;
    }
};

struct base { /* empty */ };
struct badbit_set: base { /* empty */ };
struct eofbit_set: base { /* empty */ };
struct failbit_set: base { /* empty */ };

struct Bin: base { /* empty */ } *bin;
struct Nolock: base { /* empty */ } *nolock;
struct NolockBuf: base { /* empty */ } *nolockbuf;

struct IosBase: std::ios_base
{
    static bool check (int, base*) { return true; }
    static bool check (int, ...) { return false; }

    // members are preferred over non-members during unqualified lookup
    static bool check_badbit () { return check (0, (badbit_set*)0); }
    static bool check_eofbit () { return check (0, (eofbit_set*)0); }
    static bool check_failbit () { return check (0, (failbit_set*)0); }

    static bool check_bin () { return check (0, bin); }

    static bool check_nolock () { return check (0, nolock); }
    static bool check_nolockbuf () { return check (0, nolockbuf); }
};

_RWSTD_NAMESPACE (std) {

// define bogus primary templates to verify
// that they are not defined by the library

#ifdef _RWSTD_NO_EXT_CHAR_TRAITS_PRIMARY

template <class charT>
struct char_traits { /* empty */ };

#endif   // _RWSTD_NO_EXT_CHAR_TRAITS_PRIMARY

#ifdef _RWSTD_NO_EXT_CODECVT_PRIMARY

template <class internT, class externT, class stateT>
struct codecvt { /* empty */ };

#endif   // _RWSTD_NO_EXT_CODECVT_PRIMARY

#ifdef _RWSTD_NO_EXT_CTYPE_PRIMARY

template <class charT>
struct ctype { /* empty */ };

#endif   // _RWSTD_NO_EXT_CTYPE_PRIMARY

#ifdef _RWSTD_NO_EXT_COLLATE_PRIMARY

template <class charT>
struct collate { /* empty */ };

#endif   // _RWSTD_NO_EXT_COLLATE_PRIMARY

#ifdef _RWSTD_NO_EXT_MONEYPUNCT_PRIMARY

template <class charT, bool Intl>
struct moneypunct { /* empty */ };

#endif   // _RWSTD_NO_EXT_MONEYPUNCT_PRIMARY

#ifdef _RWSTD_NO_EXT_NUMPUNCT_PRIMARY

template <class charT>
struct numpunct { /* empty */ };

#endif   // _RWSTD_NO_EXT_NUMPUNCT_PRIMARY

#ifdef _RWSTD_NO_EXT_TIME_GET_PRIMARY

template <class charT, class InputIterator>
struct time_get { /* empty */ };

#endif   // _RWSTD_NO_EXT_TIME_GET_PRIMARY

#ifdef _RWSTD_NO_EXT_TIME_PUT_PRIMARY

template <class charT, class OutputIterator>
struct time_put { /* empty */ };

#endif   // _RWSTD_NO_EXT_TIME_PUT_PRIMARY

#ifdef _RWSTD_NO_EXT_MESSAGES_PRIMARY

template <class charT>
struct messages { /* empty */ };

#endif   // _RWSTD_NO_EXT_MESSAGES_PRIMARY

}   // namespace std

/***********************************************************************/

#include <rw_driver.h>

bool predicate (int /* unused */) { return true; }

static int
run_test (int /* unused */, char* /* unused */ [])
{
    // exercise _RWSTD_NO_EXT_VOID_COUNT
    rw_info (0, 0, __LINE__, "_RWSTD_NO_EXT_VOID_COUNT");

    std::reverse_iterator<int*> it (0);

    std::size_t n = 0;

#ifndef _RWSTD_NO_EXT_VOID_COUNT
    rw_assert (0, __FILE__, __LINE__,
               "_RWSTD_NO_EXT_VOID_COUNT not #defined");
#endif

    // call the 4-argument overload of count() and expect Koenig lookup
    // to find ::count(); the std::count() extension will be preferred
    // if it exists and is a viable candidate, in which case the test
    // below will fail
    count (it, it, 0, n);

    rw_assert (1 == count_called, __FILE__, __LINE__,
               "_RWSTD_NO_EXTENSIONS #defined and an extended "
               "definition of std::count() found");

    // call the 4-argument overload of count() and expect Koenig lookup
    // to find ::count(); the std::count() extension will be preferred
    // if it exists and is a viable candidate
    count_if (it, it, predicate, n);

    rw_assert (1 == count_pred_called, __FILE__, __LINE__,
               "_RWSTD_NO_EXTENSIONS #defined and an extended "
               "definition of std::count_if() found");

    // exercise _RWSTD_NO_EXT_VOID_DISTANCE
    rw_info (0, 0, __LINE__, "_RWSTD_NO_EXT_VOID_DISTANCE");

#ifndef _RWSTD_NO_EXT_VOID_DISTANCE
    rw_assert (0, __FILE__, __LINE__,
               "_RWSTD_NO_EXT_VOID_DISTANCE not #defined");
#endif

    // call the 3-argument overload of distance() and expect Koenig
    // lookup to find ::distance(); std::distance() will be preferred
    // if it exists and is a viable candidate
    distance (it, it, n);

    rw_assert (1 == distance_called, __FILE__, __LINE__,
               "_RWSTD_NO_EXTENSIONS #defined and an extended "
               "definition of std::distance() found");

    // exercise _RWSTD_NO_EXT_NUM_GET
    rw_info (0, 0, __LINE__, "_RWSTD_NO_EXT_NUM_GET");

#ifndef _RWSTD_NO_EXT_NUM_GET
    rw_assert (0, __FILE__, __LINE__,
               "_RWSTD_NO_EXT_NUM_GET not #defined");
#endif

#if !defined (__GNUG__) || __GNUG__ > 2

#  define STRING(x) #x
#  define TEST_GET(T)                                               \
    do {                                                            \
        NumGet::iter_type in;                                       \
        std::ios_base::iostate err = std::ios_base::failbit;        \
        ellipsis_called = 0;                                        \
        NumGet ().get (in, in, std::cin, err, convertible<T&>());   \
        rw_assert (1 == ellipsis_called, __FILE__, __LINE__,        \
                   "_RWSTD_NO_EXTENSIONS #defined and std::"        \
                   "num_get<char>::get(..., " STRING(T) ") found"); \
    } while (0)

    TEST_GET (short);
    TEST_GET (int);

#  ifdef _RWSTD_LONG_LONG

    TEST_GET (_RWSTD_LONG_LONG);
    TEST_GET (unsigned _RWSTD_LONG_LONG);

#  endif   // _RWSTD_NO_LONG_LONG

#endif   // gcc > 2.x

    // exercise _RWSTD_NO_EXT_FAILURE
    rw_info (0, 0, __LINE__, "_RWSTD_NO_EXT_FAILURE");

#ifndef _RWSTD_NO_EXT_FAILURE
    rw_assert (0, __FILE__, __LINE__, "_RWSTD_NO_EXT_FAILURE not #defined");
#endif

    rw_assert (IosBase::check_badbit (), __FILE__, __LINE__,
               "_RWSTD_NO_EXTENSIONS #defined and "
               " class std::ios_base::badbit_set found");

    rw_assert (IosBase::check_eofbit (), __FILE__, __LINE__,
               "_RWSTD_NO_EXTENSIONS #defined and "
               " class std::ios_base::eofbit_set found");

    rw_assert (IosBase::check_eofbit (), __FILE__, __LINE__,
               "_RWSTD_NO_EXTENSIONS #defined and "
               " class std::ios_base::failbit_set found");

    // exercise _RWSTD_NO_EXT_BIN_IO
    rw_info (0, 0, __LINE__, "_RWSTD_NO_EXT_BIN_IO");

#ifndef _RWSTD_NO_EXT_BIN_IO
    rw_assert (0, __FILE__, __LINE__,
               "_RWSTD_NO_EXT_BIN_IO not #defined");
#endif

    rw_assert (IosBase::check_bin (), __FILE__, __LINE__,
               "_RWSTD_NO_EXTENSIONS #defined and "
               " std::ios_base::bin found");

    // exercise _RWSTD_NO_EXT_REENTRANT_IO
    rw_info (0, 0, __LINE__, "_RWSTD_NO_EXT_REENTRANT_IO");

#ifndef _RWSTD_NO_EXT_REENTRANT_IO
    rw_assert (0, __FILE__, __LINE__,
               "_RWSTD_NO_EXT_REENTRANT_IO not #defined");
#endif

    rw_assert (IosBase::check_nolock (), __FILE__, __LINE__,
               "_RWSTD_NO_EXTENSIONS #defined and "
               " std::ios_base::nolock found");

    rw_assert (IosBase::check_nolockbuf (), __FILE__, __LINE__,
               "_RWSTD_NO_EXTENSIONS #defined and "
               " std::ios_base::nolockbuf found");

    // exercise _RWSTD_NO_EXT_CHAR_TRAITS_PRIMARY
    rw_info (0, 0, __LINE__, "_RWSTD_NO_EXT_CHAR_TRAITS_PRIMARY");

#ifndef _RWSTD_NO_EXT_CHAR_TRAITS_PRIMARY
    rw_assert (0, __FILE__, __LINE__,
               "_RWSTD_NO_EXT_CHAR_TRAITS_PRIMARY not #defined");
#endif   // _RWSTD_NO_EXT_CHAR_TRAITS_PRIMARY

    // exercise _RWSTD_NO_EXT_CODECVT_PRIMARY
    rw_info (0, 0, __LINE__, "_RWSTD_NO_EXT_CODECVT_PRIMARY");

#ifndef _RWSTD_NO_EXT_CODECVT_PRIMARY
    rw_assert (0, __FILE__, __LINE__,
               "_RWSTD_NO_EXT_CODECVT_PRIMARY not #defined");
#endif   // _RWSTD_NO_EXT_CODECVT_PRIMARY

    // exercise _RWSTD_NO_EXT_COLLATE_PRIMARY
    rw_info (0, 0, __LINE__, "_RWSTD_NO_EXT_COLLATE_PRIMARY");

#ifndef _RWSTD_NO_EXT_COLLATE_PRIMARY
    rw_assert (0, __FILE__, __LINE__,
               "_RWSTD_NO_EXT_COLLATE_PRIMARY not #defined");
#endif   // _RWSTD_NO_EXT_COLLATE_PRIMARY

    // exercise _RWSTD_NO_EXT_CTYPE_PRIMARY
    rw_info (0, 0, __LINE__, "_RWSTD_NO_EXT_CTYPE_PRIMARY");

#ifndef _RWSTD_NO_EXT_CTYPE_PRIMARY
    rw_assert (0, __FILE__, __LINE__,
               "_RWSTD_NO_EXT_CTYPE_PRIMARY not #defined");
#endif   // _RWSTD_NO_EXT_CTYPE_PRIMARY

    // exercise _RWSTD_NO_EXT_MONEYPUNCT_PRIMARY
    rw_info (0, 0, __LINE__, "_RWSTD_NO_EXT_MONEYPUNCT_PRIMARY");

#ifndef _RWSTD_NO_EXT_MONEYPUNCT_PRIMARY
    rw_assert (0, __FILE__, __LINE__,
               "_RWSTD_NO_EXT_MONEYPUNCT_PRIMARY not #defined");
#endif   // _RWSTD_NO_EXT_MONEYPUNCT_PRIMARY

    // exercise _RWSTD_NO_EXT_NUMPUNCT_PRIMARY
    rw_info (0, 0, __LINE__, "_RWSTD_NO_EXT_NUMPUNCT_PRIMARY");

#ifndef _RWSTD_NO_EXT_NUMPUNCT_PRIMARY
    rw_assert (0, __FILE__, __LINE__,
               "_RWSTD_NO_EXT_NUMPUNCT_PRIMARY not #defined");
#endif   // _RWSTD_NO_EXT_NUMPUNCT_PRIMARY

    // exercise _RWSTD_NO_EXT_TIME_GET_PRIMARY
    rw_info (0, 0, __LINE__, "_RWSTD_NO_EXT_TIME_GET_PRIMARY");

#ifndef _RWSTD_NO_EXT_TIME_GET_PRIMARY
    rw_assert (0, __FILE__, __LINE__,
               "_RWSTD_NO_EXT_TIME_GET_PRIMARY not #defined");
#endif   // _RWSTD_NO_EXT_TIME_GET_PRIMARY

    // exercise _RWSTD_NO_EXT_TIME_PUT_PRIMARY
    rw_info (0, 0, __LINE__, "_RWSTD_NO_EXT_TIME_PUT_PRIMARY");

#ifndef _RWSTD_NO_EXT_TIME_PUT_PRIMARY
    rw_assert (0, __FILE__, __LINE__,
               "_RWSTD_NO_EXT_TIME_PUT_PRIMARY not #defined");
#endif   // _RWSTD_NO_EXT_TIME_PUT_PRIMARY

    // exercise _RWSTD_NO_EXT_MESSAGES_PRIMARY
    rw_info (0, 0, __LINE__, "_RWSTD_NO_EXT_MESSAGES_PRIMARY");

#ifndef _RWSTD_NO_EXT_MESSAGES_PRIMARY
    rw_assert (0, __FILE__, __LINE__,
               "_RWSTD_NO_EXT_MESSAGES_PRIMARY not #defined");
#endif   // _RWSTD_NO_EXT_MESSAGES_PRIMARY

    return 0;
}

/* extern */ int
main (int argc, char* argv [])
{
    return rw_test (argc, argv, __FILE__,
                    "intro.compliance",
                    0,   // no comment
                    run_test, "", 0);
}


text:
- Start Date: 2022-08-08
- FLIP Issue: [#2434](https://github.com/google/flax/issues/2434)
- FLIP PR: [#2435](https://github.com/google/flax/pull/2435)
- Status: Proposal

## Summary

This FLIP proposes to extend Flax's variable collections with a generic axis metadata API.
The core of the API is an abstract base class that is recognized by lifting transformations that can add an axis (vmap, scan).
Users can extend the base class to keep track of per-axis metadata in a way that works with lifted transformations.

## Motivation

Generally, there is no way in Flax to track metadata for variables across lifted transformations.
Axis metadata is used to keep track of semantic information about axes into other (Flax independent) APIs.
For example, optimizers like AdaFactor can be configured on a per-axis level and partitioning APIs
in JAX like xmap or pjit require per variable annotations to map effectiently to parallel hardware.

Currently, there is an experimental [API](https://github.com/google/flax/blob/main/flax/linen/partitioning.py)
supporting partitioning annotations with wrappers around lifted transforms that change axes (``nn.scan_with_axes``, ``nn.vmap_with_axes``)
and a special APIs to create variables (``param_with_axes`` and ``variable_with_axes``).
The experimental partitioning API stores the metadata in a separate collection named "[collection]_axes".

The experimental API has a number of shortcomings that we like to solve:
1. The current API works for tracking PartitionSpecs but not for other types of metadata like optimizer annotations.
2. The implementation using an "xxx_axes" collection requires error-prone and non-composable string manipulation.
3. Special, partioning-aware variable creators and lifted transforms are required
4. The partioning API is hard to use with pre-existing Modules that aren't partioning aware.

## Proposal

To generalize metadata tracking and keep the specific metadata out of core Flax we propose the following abstract base class:

```python
TAxisMetadata = TypeVar("TAxisMetadata", bound="AxisMetadata")

class AxisMetadata(metaclass=abc.ABCMeta):
  """Abstract base class for boxed Metadata.

  ``AxisMetadata`` enables arbitrary, per axis metadata for variables.
  By using ``unbox`` the metadata is stripped away to obtain the original
  variables. By using unboxing, most code handling variables does not need
  to handle ``AxisMetadata`` specifically, but can directly operate on the JAX
  arrays that they wrap.

  Additionally, ``AxisMetadata`` supports updating metadata whenever an axis
  is added or removed by a functional transformation
  (e.g.: ``nn.scan`` or ``nn.vmap``) using the ``add_axis`` and ``remove_axis``
  methods.

  By extending ``AxisMetadata``, custom metadata can be stored. See
  ``Partitioned`` for a specific implementation.
  """

  @abc.abstractmethod
  def unbox(self) -> Any:
    """Returns the content of the AxisMetadata box.

    Note that unlike ``meta.unbox`` the unbox call should recursively unbox
    metadata. It should simply return value that it wraps directly even
    if that value itself is an instance of AxisMetadata.

    In practise, AxisMetadata subclasses should be registred as PyTree nodes to
    support passing instances to JAX and Flax APIs. The leaves returned for this
    note should correspond to the value returned by unbox.

    Returns:
      The unboxed value.
    """
    pass

  @abc.abstractmethod
  def add_axis(self: TAxisMetadata, index: int,
               params: Dict[Any, Any]) -> TAxisMetadata:
    """Adds a new axis to the axis metadata.

    Note that add_axis and remove_axis should act as each other's inverse
    (meaning: ``x.add_axis(i, p).remove_axis(i, p) == x``)

    Args:
      index: The position at which the new axis will be inserted
      params: An arbitrary dictionary of parameters passed by the transformation
        that introduces the new axis (e.g.: ``nn.scan`` or ``nn.vmap``). The
        user passes this dictionary as the `metadata_param` argument to the
        transformation.
    Returns:
      A new instance of the same type as self and with the same ``unbox``
      content with updated axis metadata.
    """
    pass

  @abc.abstractmethod
  def remove_axis(self: TAxisMetadata, index: int,
                  params: Dict[Any, Any]) -> TAxisMetadata:
    """Removes an axis from the axis metadata.

    Note that add_axis and remove_axis should act as each other's inverse
    (meaning: ``x.remove_axis(i, p).add_axis(i, p) == x``)

    Args:
      index: The position of the axis that is to be removed
      params: An arbitrary dictionary of parameters passed by the transformation
        that introduced the axis (e.g.: ``nn.scan`` or ``nn.vmap``). The
        user passes this dictionary as the `metadata_param` argument to the
        transformation.
    Returns:
      A new instance of the same type as self and with the same ``unbox``
      content with updated axis metadata.
    """
    pass
```

We call this type of class wrapping a value and keeping track of some additional data a **box**.
By defining an abstract base class for this box, the API does not need to be aware of the specifics of the metadata that is tracked.
This should make the API future proof and modular.

The ``add_axis`` and ``remove_axis`` method return an instance of their own type instead of mutating in-place.
Typically, an implementation would be a ``flax.struct.PyTreeNode`` because the box should still be a valid JAX value and must therefore be handled by the PyTree API.
Calling ``jax.tree_map`` on a boxed value will simply map over the value in the box.
The lifted transforms that need to handle metadata will call ``jax.tree_map(..., is_leaf=lambda x: isinstance(x, AxisMetadata))`` to find the AxisMetadata instances within a PyTree.

Advantages of the boxing approach:
1. Boxing can be used outside of Flax and metadata is automatically "inherited". For example, the optimizer state will
   have the same partitioning spec as the parameters, because the state is initialized using a ``jax.tree_map`` over the boxed parameters.
2. Boxes are composable.
3. Boxing avoids string manipulation and generally avoids having to handle additional auxilary collections like "param_axes" in the current
   partitioning API.
4. No need to lift metadata collections seperately.

Disadvantages:
1. Adding the boxes changes the PyTree hierarchy and introduces dataclasses within the otherwise plain, nested dict of variables.
3. Custom Pytree nodes have a small runtime overhead. It's hard to observe this in practise because JAX calls are async.

### Init syntax

Boxes can be created directly by the init function of a variable. Therefore, we propose to create metadata using higher-order initializers.
The main advantage of this is that we can decouple metadata handling completely from the Module definition. Also, most Modules already overwrite
attributes to override the default initialzers so users can add metadata to existing Modules without requiring any code changes.

To illustrate this, let's consider a metadata class that keeps track of PartitionSpecs used by ``pjit``:

```python
class Partitioned(flax.struct.PyTreeNode, AxisMetadata):
  value: Any
  names: Tuple[Optional[str], ...] = flax.struct.field(pytree_node=False)

  def add_axis(self, index: int, params: Dict[Any, Any]) -> TAxisMetadata:
    axis_name = self._get_partition_name(params)
    names = list(self.names)
    names.insert(index, axis_name)
    return self.replace(names=tuple(names))

  def remove_axis(self, index: int, params: Dict[Any, Any]) -> TAxisMetadata:
    axis_name = self._get_partition_name(params)
    names = list(self.names)
    assert names.pop(index) == axis_name
    return self.replace(names=tuple(names))

def with_partitioning(init_fn, names):
  def wrapper(*args, **kwargs):
    return Partitioned(init_fn(*args, **kwargs), names)
  return wrapper
```

Here we also defined a small utility called ``with_partitioning`` that we can use to wrap existing initialzers to add metadata:

```python
# init kernel with lecun normal and split the output features over the data axis
partitioned_dense = nn.Dense(features, kernel_init=with_partitioning(nn.initializers.lecun_normal, (None, "data")))
```

Initializing a model that creates partitioned weights would result in the following variable structure:

```python
variables = partitioned_dense.init(rng, jnp.ones((4,)))
jax.tree_map(np.shape, variables)  # => {"params": {"kernel": Partitioned(value=(4, 8), names=(None, "data")), bias: (8,)}}
```

The variable tree with metadata can be used to integrate with other libaries and APIs.
For example, we can turn the ``Partitioned`` metadata into ``jax.pjit`` sharding annotations:

```python
def to_sharding_spec(x):
  if isinstance(x, Partitioned):
    return PartitionSpec(*x.names)
  else:
    # fully replicated
    return PartitionSpec()

# Result: {"params": {"kernel": PartitionSpec(None, "data"), bias: PartitionSpec()}}
variables_pspec = jax.tree_map(to_sharding_spec, variables, is_leaf=lambda x: isinstance(x, Partitioned))
```

### Unbox syntax

Metadata typically doesn't need to be handled by Modules directly. Therefore, we propose to make Modules agnostic to Metadata boxes by default.
The ``unbox`` method can be used to unpack a variable such that only the original JAX arrays remain. Users can manually call unbox but to make
sure Module classes don't have to call it everywhere we add an unbox keyword arg to variable returning APIs (e.g.: ``.param``, ``.variable``, ``.get_variable``).
The keyword arg ``unbox`` will default to ``True`` such that a Modules are metadata agnostic by default. This also means existing Modules will be backward compatible
with the new API.

```python
kernel = self.param("kernel", self.kernel_init, shape)  # No AxisMetadata instances
kernel_box = self.get_variable("param", "kernel", unbox=False)  # AxisMetadata boxes are preserved
```

### Lift syntax

When calling a lifted transformation that adds an axis you will now be able to pass a dictionary with arguments.
These params will be passed to ``AxisMetadata`` add_axis/remove_axis callbacks:

```python
nn.scan(..., variable_axes={"params": 0}, metadata_params={nn.Partitioned.AXIS_NAME: "layers"})
```

A dict is used such that users can add their own arguments to custom AxisMetadata classes.


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>Source code</title>
<link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style">

001package squidpony.squidgrid.mapping.locks.constraints;
002
003import squidpony.squidgrid.Direction;
004import squidpony.squidgrid.mapping.locks.IRoomLayout;
005import squidpony.squidgrid.mapping.locks.generators.ILayoutGenerator;
006import squidpony.squidmath.Arrangement;
007import squidpony.squidmath.Coord;
008import squidpony.squidmath.IntVLA;
009
010import java.util.*;
011
012/**
013 * Limits the {@link ILayoutGenerator} in
014 * the <i>number</i> of keys, switches and rooms it is allowed to place.
015 *
016 * Also restrict to a grid of 1x1 rooms.
017 *
018 * @see ILayoutConstraints
019 */
020public class CountConstraints implements ILayoutConstraints {
021
022    protected int maxSpaces, maxKeys, maxSwitches;
023
024    protected Arrangement<Coord> roomIds;
025    protected int firstRoomId;
026
027    public CountConstraints(int maxSpaces, int maxKeys, int maxSwitches) {
028        this.maxSpaces = maxSpaces;
029        this.maxKeys = maxKeys;
030        this.maxSwitches = maxSwitches;
031
032        roomIds = new Arrangement<Coord>();
033        Coord first = Coord.get(127,127);
034        firstRoomId = getRoomId(first);
035    }
036
037    public int getRoomId(Coord xy) {
038        if (roomIds.containsKey(xy)) {
039            return roomIds.get(xy);
040        } else {
041            roomIds.add(xy);
042            return roomIds.size()-1;
043        }
044    }
045
046    public Coord getRoomCoords(int id) {
047        assert roomIds.containsValue(id);
048        return roomIds.keyAt(id);
049
050    }
051
052    @Override
053    public int getMaxRooms() {
054        return maxSpaces;
055    }
056
057    public void setMaxSpaces(int maxSpaces) {
058        this.maxSpaces = maxSpaces;
059    }
060
061    @Override
062    public IntVLA initialRooms() {
063        return IntVLA.with(firstRoomId);
064    }
065
066    @Override
067    public int getMaxKeys() {
068        return maxKeys;
069    }
070
071    public void setMaxKeys(int maxKeys) {
072        this.maxKeys = maxKeys;
073    }
074
075    @Override
076    public boolean isAcceptable(IRoomLayout dungeon) {
077        return true;
078    }
079
080    @Override
081    public int getMaxSwitches() {
082        return maxSwitches;
083    }
084
085    public void setMaxSwitches(int maxSwitches) {
086        this.maxSwitches = maxSwitches;
087    }
088
089    protected boolean validRoomCoords(Coord c) {
090        return c.y >= 0 && c.x >= 0 && c.x <= 255 && c.y <= 255;
091    }
092
093    @Override
094    public IntVLA getAdjacentRooms(int id, int keyLevel) {
095        Coord xy = roomIds.keyAt(id);
096        IntVLA ids = new IntVLA();
097        for (Direction d: Direction.CARDINALS) {
098            Coord neighbor = xy.translate(d);
099            if (validRoomCoords(neighbor))
100                ids.add(getRoomId(neighbor));
101        }
102        return ids;
103    }
104
105    @Override
106    public Set<Coord> getCoords(int id) {
107        return Collections.singleton(getRoomCoords(id));
108    }
109
110    @Override
111    public double edgeGraphifyProbability(int id, int nextId) {
112        return 0.2;
113    }
114
115    @Override
116    public boolean roomCanFitItem(int id, int key) {
117        return true;
118    }
119
120}


text:
<?php

/**
 * Posts Settings
 */
Configure::write('SB.PaginationLimit', 10);

/**
 * Author Configuration
 */
Configure::write('SB.EnableAuthor', true);
Configure::write('SB.AuthorSettings', array(
	'alias' => 'User',
	'name' => 'User.username',
	'action' => array(
		'controller' => 'users',
		'action' => 'view'
	)
));


text:
@interface PDCFlickrTVC : UITableViewController

@end


text:
package com.github.cleverage.elasticsearch;

import org.elasticsearch.search.facet.Facets;

import java.util.List;

/**
 * The Class IndexResult.
 *
 * @param <T> extends Index
 */
public class IndexResults<T extends Index> {

    /** The total count. */
    public long totalCount;

    /**
     * Nb result by page
     */
    public long pageSize;

    /**
     * Number of current page
     */
    public long pageCurrent;

    /**
     * Number of total pages
     */
    public long pageNb;

    /** The results. */
    public List<T> results;

    /** The facets. */
    public Facets facets;

    /**
     * Create new Index Result
     * @param totalCount
     * @param pageSize
     * @param pageCurrent
     * @param pageNb
     * @param results
     * @param facets
     */
    public IndexResults(long totalCount,long pageSize, long pageCurrent, long pageNb, List<T> results, Facets facets) {
        this.totalCount = totalCount;
        this.pageSize = pageSize;
        this.pageCurrent = pageCurrent;
        this.pageNb = pageNb;
        this.results = results;
        this.facets = facets;
    }

}


text:
Client library for IdealSpot GeoData

## Installation and Usage
```bash
npm install --save @datafire/rapidapi_idealspot_geodata
```
```js
let rapidapi_idealspot_geodata = require('@datafire/rapidapi_idealspot_geodata').create();

.then(data => {
  console.log(data);
});
```

## Description

Hyperlocal Demographics, Vehicle Traffic, Economic, Market Signals, and More. Use this API to request IdealSpot hyperlocal geospatial market insight and geometry data.

## Detailed Description

Use this API as your **local economy microscope** by querying [IdealSpot](https://www.idealspot.com) hyperlocal market insight and geometry data. We offer the most precise, extensive, and frequently-updated local market data in the US. Our data is available across the entire US and can be queried at geographic scales ranging from the micro (Census block) through the macro (nation).

Better data and analysis leads to a better understanding of local market opportunities and risks. Integrate with your commercial real estate and marketing applications, machine learning workflows, and other investment analytics.

Our goal is to offer the most complete snapshot of the geographically distributed consumer and retail economy. We start with the fundamentals of consumers and business establishments. To connect retailers with consumers, we provide mobility data like vehicle traffic and mobile device data. To describe consumer intent, we provide geolocated digital marketing data.

We believe that accurate capital allocation through reliable local market data is foundational to creating robust, healthy, and livable communities for all. We hope you and your clients find tremendous value in this service.

## Features

Query data and GeoJSON geometries at these scales for any US latitude and longitude:

* Rings (0.5 km+)
* Drive time (1-60 minutes)
* Bike time (3-60 minutes)
* Walk time (5-60 minutes)
* Public transit time (5-60 minutes)
* Administrative region (US, states, core-based statistical areas, counties, Census-designated places, Census tracts, zipcodes, Census block groups, opportunity zones)

| Data Feature | Description |
| ------- | ------------------------------|
| Demographics, Housing, Spending | *Updated Quarterly*.  Current and historical market data including population, spending, and housing. Vendor (PopStats) is relied upon by Walgreens, Ulta Beauty, Blackstone, etc |
| Labor, Business Establishments, Economic Conditions | *Updated Quarterly*.  Traditional market data including workforce, business establishment counts, and economic conditions like local GDP, unemployment rates. Vendor (PopStats) is relied upon by Walgreens, Ulta Beauty, Blackstone, etc |
| Consumer segmentation	| *Updated Annually*. Demographics grouped into narrative-oriented segments. |
| Vehicle Traffic |	*Updated semi-annually*. Gold standard in vehicle traffic data from INRIX. Counts by day of week, time of day and side of street. |
| Rings and Travel time polygons | *Estimate in Real-time*. Rings alongside drive time, walk time, bike time, and public transit time polygons. Request as GeoJSON geometries for mapping or use with data queries |
| Administrative region polygons | *Updated Annually*. GeoJSON administrative regions from US Census Bureau: block groups, tracts, counties, CBSAs, states, opportunity zones, USPS zipcodes |
| Internet Search Volumes | 30 day rolling averages for geolocated advertising potential across 450 business categories from major search engines |
| Social Media Interest	| 30 day rolling average for geolocated advertising potential across 450 business categories from major social networks |

### Coming Soon!

This API powers our local market research platform at [IdealSpot.com](https://www.idealspot.com). The functionality exposed so far is only a portion of our current capabilities. We will be exposing additional API features in time so watch this space!

| Data Feature | Description |
| ------- | ------------------------------|
Mobile device visit counts, points of interest, brands | Fresh point of interest data across 3000+ brands, millions of POI, and historical foot traffic counts using mobile data for those points of interest
Origin/destination trips from mobile devices | Map origins and destinations of devices visiting an arbitrary catchment area
Competition search | Search all major point-of-interest aggregators in one query
Environment/climate | Expected weather patterns like temperature and precipitation
Filter search API | Query data for all counties in state, all tracts in MSA, etc
Road segment tiles | Plot road segments on maps in interactive applications

## Developer Website

For more detail see https://developer.idealspot.com/

## Actions

### FetchAvailableInsights
List all insights that the user has access to. This includes population, household income, crime statistics, walking traffic, vehicle traffic counts, employment, and much more,

```js
rapidapi_idealspot_geodata.FetchAvailableInsights({
  "X-RapidAPI-Key": "",
  "X-RapidAPI-Host": ""
}, context)
```

#### Input
* input `object`
  * X-RapidAPI-Key **required** `string`: (Required) Rapid API Key. See https://rapidapi.com/idealspot-inc-idealspot-inc-default/api/idealspot-geodata
  * X-RapidAPI-Host **required** `string`

#### Output
* output [ListAllLocalInsights](#listalllocalinsights)

### FetchInsightQueryParameters
Fetch request/response structure metadata for a given Insight. This provides you the periods of data available as well as any other parameters you may want to query the Insight by. Example Insights include population and market data such as: age, daytime population, avg. home value, crime indexes, foot traffic, employment, income, occupation, etc.  For the full-list see the developer documentation.

```js
rapidapi_idealspot_geodata.FetchInsightQueryParameters({
  "insight_id:": "",
  "X-RapidAPI-Key": "",
  "X-RapidAPI-Host": ""
}, context)
```

#### Input
* input `object`
  * insight_id: **required** `string`: Insight ID. See developer documentation for full list.
  * X-RapidAPI-Key **required** `string`: (Required) Rapid API Key. See https://rapidapi.com/idealspot-inc-idealspot-inc-default/api/idealspot-geodata
  * X-RapidAPI-Host **required** `string`

#### Output
* output [Describe_occupation_Insight](#describe_occupation_insight)

### QueryInsightatLocation
Execute a query for a given insight and location(s). Some Insights may require you to provide required options. ie., when querying `occupation` for White-Collar Workers, you can filter by opt=`{"data":{"category":[2469]}}`

For examples of `locations`, please see [Location API Documentation](https://idealspot.gitlab.io/developer-docs/#location)

```js
rapidapi_idealspot_geodata.QueryInsightatLocation({
  "version": "",
  "location[]": "",
  "insight_id:": "",
  "X-RapidAPI-Key": "",
  "X-RapidAPI-Host": ""
}, context)
```

#### Input
* input `object`
  * version **required** `string`: (Required) Insight version. Insight versions are incremented when a response format changes in any way, including the addition of new groups. Old versions are retained, unmodified, for backwards compatibility.
  * location[] **required** `string`: (Required) Represents a buffer, region, or custom polygon specification. Accepts the `Location` model (as a `Buffer`, `Region`, or `Custom Polygon`) formatted as a JSON string. Multiple `location` query parameters are allowed. NOTE: When requesting multiple locations, you must include brackets(i.e. `?location[]=...&location[]=...`). If not included, only the last location will be used. For more detail, see https://idealspot.gitlab.io/developer-docs/#location
  * insight_id: **required** `string`: Insight ID. See https://developer.idealspot.com/data for full list.
  * X-RapidAPI-Key **required** `string`: (Required) Rapid API Key. See https://rapidapi.com/idealspot-inc-idealspot-inc-default/api/idealspot-geodata
  * X-RapidAPI-Host **required** `string`

#### Output
* output [Homevalueswithin1mi.radiusofLocation](#homevalueswithin1mi.radiusoflocation)

### FetchGeometries
Fetch location GeoJSON

```js
rapidapi_idealspot_geodata.FetchGeometries({
  "location[]": "",
  "X-RapidAPI-Key": "",
  "X-RapidAPI-Host": ""
}, context)
```

#### Input
* input `object`
  * location[] **required** `string`: (Required) Represents a buffer, region, or custom polygon specification. Accepts the `Location` model (as a `Buffer`, `Region`, or `Custom Polygon`) formatted as a JSON string. Multiple `location` query parameters are allowed. NOTE: When requesting multiple locations, you must include brackets(i.e. `?location[]=...&location[]=...`). If not included, only the last location will be used.
  * X-RapidAPI-Key **required** `string`: (Required) Rapid API Key. See https://rapidapi.com/idealspot-inc-idealspot-inc-default/api/idealspot-geodata
  * X-RapidAPI-Host **required** `string`

#### Output
* output [Describetheregionwithin5minutedrive-timeofageographicpoint](#describetheregionwithin5minutedrive-timeofageographicpoint)

### geometries.regions.intersecting.latitude.longitude.get
For given latitude and longitude, find intersecting administrative regions. Region polygons are simplified for web mapping.

```js
rapidapi_idealspot_geodata.geometries.regions.intersecting.latitude.longitude.get({
  "latitude": 0,
  "longitude": 0,
  "X-RapidAPI-Key": "",
  "X-RapidAPI-Host": ""
}, context)
```

#### Input
* input `object`
  * latitude **required** `number`: (Required) Search coordinate latitude
  * longitude **required** `number`: (Required) Search coordinate longitude
  * X-RapidAPI-Key **required** `string`: (Required) Rapid API Key. See https://rapidapi.com/idealspot-inc-idealspot-inc-default/api/idealspot-geodata
  * X-RapidAPI-Host **required** `string`

#### Output
* output [FetchAdministrativeRegionsusingLat_Lng](#fetchadministrativeregionsusinglat_lng)

### VehicleTrafficCountsforRoadSegment
Time of day, day of week, and side of street vehicle traffic counts.

```js
rapidapi_idealspot_geodata.VehicleTrafficCountsforRoadSegment({
  "segment_id": 0,
  "X-RapidAPI-Key": "",
  "X-RapidAPI-Host": ""
}, context)
```

#### Input
* input `object`
  * segment_id **required** `integer`: (Required) Road segment ID. Fetched from Search Road Segments
  * X-RapidAPI-Key **required** `string`: (Required) Rapid API Key. See https://rapidapi.com/idealspot-inc-idealspot-inc-default/api/idealspot-geodata
  * X-RapidAPI-Host **required** `string`

#### Output
* output [VehicleTrafficCountsforRoadSegment](#vehicletrafficcountsforroadsegment)

### FetchNearestRoadSegments
For given latitude and longitude, find `n` nearest road segments

```js
rapidapi_idealspot_geodata.FetchNearestRoadSegments({
  "n": 0,
  "latitude": 0,
  "longitude": 0,
  "X-RapidAPI-Key": "",
  "X-RapidAPI-Host": ""
}, context)
```

#### Input
* input `object`
  * n **required** `integer`: Number of road segments to return (between 1 and 20)
  * latitude **required** `number`: (Required) Search coordinate latitude
  * longitude **required** `number`: (Required) Search coordinate longitude
  * X-RapidAPI-Key **required** `string`: (Required) Rapid API Key. See https://rapidapi.com/idealspot-inc-idealspot-inc-default/api/idealspot-geodata
  * X-RapidAPI-Host **required** `string`

#### Output
* output [SearchRoadSegments](#searchroadsegments)

## Definitions

### Autocomplete
* Autocomplete `object`
  * input **required** `array`
    * items `string`

### Category
* Category `object`
  * description **required** `string`
  * id **required** `integer`
  * label **required** `string`
  * parent_id **required** `string`

### Crs
* Crs `object`
  * properties **required** [Properties4](#properties4)
  * type **required** `string`

### Data
* Data `object`
  * parameters **required** [Parameters](#parameters)
  * description **required** `string`
  * groups **required** `array`
    * items `string`
  * id **required** `string`
  * name **required** `string`
  * periods **required** `array`
    * items `string`
  * slug **required** `string`
  * version **required** `string`

### Data1
* Data1 `object`
  * data **required** `array`
    * items `array`
      * items `string`
  * location **required** [Location1](#location1)
  * location_index **required** `integer`
  * metadata **required** [Metadata](#metadata)

### Data2
* Data2 `object`
  * geometry **required** [Geometry](#geometry)
  * properties **required** [Properties](#properties)
  * type **required** `string`

### Data3
* Data3 `object`
  * features **required** `array`
    * items [Feature](#feature)
  * type **required** `string`

### Data4
* Data4 `object`
  * crs **required** [Crs](#crs)
  * features **required** `array`
    * items [Feature1](#feature1)
  * type **required** `string`

### Data5
* Data5 `object`
  * data **required** `array`
    * items `array`
      * items `integer`
  * metadata **required** [Metadata1](#metadata1)
  * roadsegment **required** [Roadsegment](#roadsegment)
  * stats **required** [Stats](#stats)

### Datum
* Datum `object`
  * description **required** `string`
  * id **required** `string`
  * name **required** `string`
  * version **required** `string`

### Describe_occupation_Insight
* Describe`occupation`Insight `object`
  * data **required** [Data](#data)

### Describetheregionwithin5minutedrive-timeofageographicpoint
* Describetheregionwithin5minutedrive-timeofageographicpoint `object`
  * data **required** [Data3](#data3)

### Feature
* Feature `object`
  * geometry **required** [Geometry](#geometry)
  * properties **required** [Properties2](#properties2)
  * type **required** `string`

### Feature1
* Feature1 `object`
  * geometry **required** [Geometry](#geometry)
  * properties **required** [Properties3](#properties3)
  * type **required** `string`

### FetchAdministrativeRegionsusingLat_Lng
* FetchAdministrativeRegionsusingLat/Lng `object`
  * data **required** `array`
    * items [Data2](#data2)

### Geometry
* Geometry `object`
  * coordinates **required** `array`
    * items `array`
      * items `number`
  * type **required** `string`

### Homevalueswithin1mi.radiusofLocation
* Homevalueswithin1mi.radiusofLocation `object`
  * data **required** `array`
    * items [Data1](#data1)

### ListAllLocalInsights
* ListAllLocalInsights `object`
  * data **required** `array`
    * items [Datum](#datum)

### Location1
* Location1 `object`
  * areatype **required** `string`
  * latitude **required** `number`
  * longitude **required** `number`
  * radius **required** `integer`
  * type **required** `string`
  * units **required** `string`

### Location3
* Location3 `object`
  * areatype **required** `string`
  * latitude **required** `number`
  * longitude **required** `number`
  * radius **required** `string`
  * type **required** `string`
  * units **required** `string`

### Metadata
* Metadata `object`
  * datetime **required** `array`
    * items `array`
      * items `string`
  * display_groups **required** `array`
    * items `array`
      * items `string`
  * units **required** [Units](#units)

### Metadata1
* Metadata1 `object`
  * bearing **required** `string`
  * columns **required** `array`
    * items `string`
  * name **required** `string`
  * rows **required** `array`
    * items `string`
  * segment_id **required** `string`
  * state **required** `string`

### Parameters
* Parameters `object`
  * category **required** `array`
    * items [Category](#category)

### Properties
* Properties `object`
  * _properties **required** [Properties1](#properties1)
  * altname **required** `string`
  * autocomplete **required** [Autocomplete](#autocomplete)
  * calculated_area_sq_meters **required** `number`
  * name **required** `string`
  * region_id **required** `string`
  * regiontype **required** `string`
  * state_code **required** `string`
  * timestamp **required** `string`

### Properties1
* Properties1 `object`
  * AFFGEOID `string`
  * ALAND **required** `integer`
  * AWATER `integer`
  * BLKGRPCE `string`
  * CBSAFP `string`
  * CLASSFP `string`
  * COUNTYFP `string`
  * COUNTYNS `string`
  * CSAFP `string`
  * DIVISION `string`
  * FUNCSTAT `string`
  * GEOID `string`
  * INTPTLAT `string`
  * INTPTLON `string`
  * LSAD `string`
  * MEMI `string`
  * METDIVFP `string`
  * MTFCC `string`
  * NAME `string`
  * NAMELSAD `string`
  * PCICBSA `string`
  * PCINECTA `string`
  * PLACEFP `string`
  * PLACENS `string`
  * POPULATION `integer`
  * POP_SQMI `number`
  * PO_NAME `string`
  * REGION `string`
  * SQMI `number`
  * STATE `string`
  * STATEFP `string`
  * STATENS `string`
  * STUSPS `string`
  * Shape_Area `number`
  * Shape_Leng `number`
  * TRACTCE `string`
  * ZIP_CODE `string`

### Properties2
* Properties2 `object`
  * calculated_area_sq_meters **required** `number`
  * location **required** [Location3](#location3)
  * status **required** `integer`

### Properties3
* Properties3 `object`
  * bearing **required** `string`
  * roadname **required** `string`
  * segment_id **required** `string`
  * state **required** `string`

### Properties4
* Properties4 `object`
  * name **required** `string`

### Roadsegment
* Roadsegment `object`
  * coordinates **required** `array`
    * items `array`
      * items `number`
  * type **required** `string`

### SearchRoadSegments
* SearchRoadSegments `object`
  * data **required** [Data4](#data4)

### Stats
* Stats `object`
  * aadt **required** `integer`

### Units
* Units `object`
  * $100k-125k **required** `string`
  * $10k-15k **required** `string`
  * $125k-150k **required** `string`
  * $150k-175k **required** `string`
  * $15k-20k **required** `string`
  * $175k-200k **required** `string`
  * $200k-250k **required** `string`
  * $20k-25k **required** `string`
  * $250k-300k **required** `string`
  * $25k-30k **required** `string`
  * $300k-400k **required** `string`
  * $30k-35k **required** `string`
  * $35k-40k **required** `string`
  * $400k-500k **required** `string`
  * $40k-50k **required** `string`
  * $500k-750k **required** `string`
  * $50k-60k **required** `string`
  * $60k-70k **required** `string`
  * $70k-80k **required** `string`
  * $750k-1M **required** `string`
  * $80k-90k **required** `string`
  * $90k-100k **required** `string`
  * Median Home Value **required** `string`
  * Over $1M **required** `string`
  * Owner Occupied Households **required** `string`
  * Under $10k **required** `string`
  * context.households **required** `string`
  * context.landarea **required** `string`

### VehicleTrafficCountsforRoadSegment
* VehicleTrafficCountsforRoadSegment `object`
  * data **required** `array`
    * items [Data5](#data5)

### locationArray
* location[] `object`
  * areatype **required** `string`
  * latitude **required** `number`
  * longitude **required** `number`
  * radius **required** `string`
  * type **required** `string`
  * units **required** `string`

### locationArray2
* location[]2 `object`
  * region_id **required** `string`
  * regiontype **required** `string`
  * type **required** `string`


text:
package org.consumersunion.stories.server.cache;

public class MemcacheKeys {
    public static final String NOTIFICATION_PROCESSING = "NOTIFICATION_PROCESSING";
}


text:
require 'aws-sdk-core'
require 'aws-sigv4'

require_relative 'aws-sdk-costandusagereportservice/types'
require_relative 'aws-sdk-costandusagereportservice/client_api'
require_relative 'aws-sdk-costandusagereportservice/plugins/endpoints.rb'
require_relative 'aws-sdk-costandusagereportservice/client'
require_relative 'aws-sdk-costandusagereportservice/errors'
require_relative 'aws-sdk-costandusagereportservice/resource'
require_relative 'aws-sdk-costandusagereportservice/endpoint_parameters'
require_relative 'aws-sdk-costandusagereportservice/endpoint_provider'
require_relative 'aws-sdk-costandusagereportservice/endpoints'
require_relative 'aws-sdk-costandusagereportservice/customizations'

# This module provides support for AWS Cost and Usage Report Service. This module is available in the
# `aws-sdk-costandusagereportservice` gem.
#
# # Client
#
# The {Client} class provides one method for each API operation. Operation
# methods each accept a hash of request parameters and return a response
# structure.
#
#     costand_usage_report_service = Aws::CostandUsageReportService::Client.new
#     resp = costand_usage_report_service.delete_report_definition(params)
#
# See {Client} for more information.
#
# # Errors
#
# Errors returned from AWS Cost and Usage Report Service are defined in the
# {Errors} module and all extend {Errors::ServiceError}.
#
#     begin
#       # do stuff
#     rescue Aws::CostandUsageReportService::Errors::ServiceError
#       # rescues all AWS Cost and Usage Report Service API errors
#     end
#
# See {Errors} for more information.
#
# @!group service
module Aws::CostandUsageReportService

  GEM_VERSION = '1.42.0'

end


text:
<?php $this->load->view('back/head'); ?>
<?php $this->load->view('back/header'); ?>
<?php $this->load->view('back/leftbar'); ?>

 Selamat Datang, <?php echo $this->session->userdata('nama') ?>

Shortcut Panel

                <button type="button" class="btn btn-success bg-blue btn-sm" data-widget="collapse">
                </button>

 <?php echo $total_berita ?>

Berita

          <a href='<?php echo base_url('admin/berita') ?>' class='small-box-footer'>Selengkapnya

 <?php echo $total_featured ?>

Featured

          <a href='<?php echo base_url('admin/featured') ?>' class='small-box-footer'>Selengkapnya

 <?php echo $total_kategori ?>

Kategori

          <a href='<?php echo base_url('admin/kategori') ?>' class='small-box-footer'>Selengkapnya

 <?php echo $total_vimi ?>

Visi dan Misi

          <a href='<?php echo base_url('admin/Vimi') ?>' class='small-box-footer'>Selengkapnya

 <?php echo $total_komen ?>

Total Komentar

          <a href='<?php echo base_url('admin/komentar') ?>' class='small-box-footer'>Selengkapnya

 <?php echo $total_komen_pending ?>

Komentar Baru

          <a href='<?php echo base_url('admin/komentar/pending') ?>' class='small-box-footer'>Selengkapnya

 <?php echo $total_user ?>

User

          <a href='<?php echo base_url('admin/auth/user') ?>' class='small-box-footer'>Selengkapnya

 <?php echo $total_data_pejabat ?>

Data Pejabat

          <a href='<?php echo base_url('admin/data_pejabat') ?>' class='small-box-footer'>Selengkapnya

<?php $this->load->view('back/footer'); ?>


text:
@interface ZFReindexPhotoSetHttpGetOut : FLModelObject {
@private
}

+ (ZFReindexPhotoSetHttpGetOut*) reindexPhotoSetHttpGetOut;

@end


text:
<?php

namespace com\mohiva\pyramid\exceptions;

use com\mohiva\common\exceptions\MohivaException;

/**
 * Signals that an identifier is already in use for an other operand.
 *
 * @category  Mohiva/Pyramid
 * @package   Mohiva/Pyramid/Exceptions
 * @author    Christian Kaps <christian.kaps@mohiva.com>
 * @copyright Copyright (c) 2007-2012 Christian Kaps (http://www.mohiva.com)
 * @license   https://github.com/mohiva/pyramid/blob/master/LICENSE.textile New BSD License
 * @link      https://github.com/mohiva/pyramid
 */
class DoubleIdentifierUsageException extends \Exception implements MohivaException {}


text:
/*	$NetBSD: elf_shnum.c,v 1.2 2014/03/09 16:58:04 christos Exp $	*/

/*-
 * Copyright (c) 2006,2008 Joseph Koshy
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 */

#include <sys/cdefs.h>

#include <ar.h>
#include <libelf.h>

#include "_libelf.h"

__RCSID("$NetBSD: elf_shnum.c,v 1.2 2014/03/09 16:58:04 christos Exp $");
ELFTC_VCSID("Id: elf_shnum.c 2225 2011-11-26 18:55:54Z jkoshy ");

static int
_libelf_getshdrnum(Elf *e, size_t *shnum)
{
	void *eh;
	int ec;

	if (e == NULL || e->e_kind != ELF_K_ELF ||
	    ((ec = e->e_class) != ELFCLASS32 && ec != ELFCLASS64)) {
		LIBELF_SET_ERROR(ARGUMENT, 0);
		return (-1);
	}

	if ((eh = _libelf_ehdr(e, ec, 0)) == NULL)
		return (-1);

	*shnum = e->e_u.e_elf.e_nscn;

	return (0);
}

int
elf_getshdrnum(Elf *e, size_t *shnum)
{
	return (_libelf_getshdrnum(e, shnum));
}

/* Deprecated API. */
int
elf_getshnum(Elf *e, size_t *shnum)
{
	return (_libelf_getshdrnum(e, shnum) >= 0);
}


text:
package br.ufrj.ppgi.greco.infmod.config;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import br.ufrj.ppgi.greco.infmod.Loader;
import br.ufrj.ppgi.greco.infmod.QueryConfig;

//@XmlRootElement(name="QueryConfig")
//@XmlAccessorType(XmlAccessType.FIELD)
public abstract class XsQueryConfig {

	public static List<String> valuesToFind = new ArrayList<String>(4);

	static {
		valuesToFind.add("SELECT");
		valuesToFind.add("CONSTRUCT");
		valuesToFind.add("ASK");
		valuesToFind.add("DESCRIBE");
	}

	//@XmlElement
	public String query;

	//@XmlElement
	public String description;

	//@XmlElement
	public XsQueryParameterBinder binder;

	//@XmlElement
	public XsResultHandler resultHandler;

	@Override
	public String toString() {
		StringBuffer sb = new StringBuffer();
		sb.append("desc='");
		sb.append(description);
		sb.append("', query='");

		String qt = query.trim().replaceAll("\\s+", " ");
		String s = qt.toUpperCase();
		int index = -1;
		for (String valueToFind : valuesToFind) {
			index = s.indexOf(valueToFind);
			if (index >= 0) break;
		}
		if (index >= 0) s = qt.substring(index, index+24);

		sb.append(s);
		sb.append("...', binder=");
		sb.append(binder.toString());
		sb.append(", resHdlr=");
		sb.append(resultHandler.toString());
		return sb.toString();
	}

	public abstract QueryConfig createQueryConfig(Loader loader, Map<String, String> prefixesMap);
}


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

<LinearLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/com_facebook_search_bar_view"
        android:orientation="horizontal"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:paddingTop="0dp"
        android:paddingBottom="0dp"
        android:paddingLeft="5dp"
        android:paddingRight="5dp"
        android:background="@color/com_facebook_picker_search_bar_background"
        >
    <EditText
            android:id="@+id/com_facebook_picker_search_text"
            android:layout_width="match_parent"
            android:layout_height="48dp"
            android:layout_marginLeft="5dp"
            android:singleLine="true"
            android:layout_gravity="center"
            android:gravity="center_vertical"
            android:textSize="16sp"
            android:textColor="@android:color/black"
            android:textColorHint="@color/com_facebook_picker_search_bar_text"
            android:background="@color/com_facebook_picker_search_bar_background"
            android:drawableLeft="@drawable/com_facebook_picker_magnifier"
            android:drawablePadding="5dp"
            android:imeOptions="actionDone"
            />
</LinearLayout><!-- From: file:/Users/karthiks/Code/android-sdk/facebook/res/layout/com_facebook_search_bar_layout.xml -->


text:
/* tslint:disable:no-unused-variable */
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { By } from '@angular/platform-browser';
import { DebugElement } from '@angular/core';

import { ResourcesBarComponent } from './resources-bar.component';

describe('ResourcesBarComponent', () => {
  let component: ResourcesBarComponent;
  let fixture: ComponentFixture<ResourcesBarComponent>;

  beforeEach(async(() => {
    TestBed.configureTestingModule({
      declarations: [ ResourcesBarComponent ]
    })
    .compileComponents();
  }));

  beforeEach(() => {
    fixture = TestBed.createComponent(ResourcesBarComponent);
    component = fixture.componentInstance;
    fixture.detectChanges();
  });

  it('should create', () => {
    expect(component).toBeTruthy();
  });
});


text:
/**
 * 对zeptojs的ajax进行封装,实现离线访问
 * 推荐纯数据的ajax请求调用本方法,其他的依旧使用zeptojs自己的ajax
 * @Deprecated 用J.Cache代替
 */
J.Service = (function($){
    var UNPOST_KEY = 'JINGLE_POST_DATA',
        GET_KEY_PREFIX = 'JINGLE_GET_';
    var ajax = function(options){
        if(options.type == 'post'){
            _doPost(options);
        }else{
            _doGet(options);
        }
    }

    var _doPost = function(options){
        if(J.offline){//离线模式,将数据存到本地,连线时进行提交
            _setUnPostData(options.url,options.data);
            options.success('数据已存至本地');
        }else{//在线模式,直接提交
            $.ajax(options);
        }
    }
    var _doGet = function(options){
        var key = options.url +JSON.stringify(options.data);
        if(J.offline){//离线模式,直接从本地读取
            var result = _getCache(key);
            if(result){
                options.success(result.data,key,result.cacheTime);
            }else{//未缓存该数据
                options.success(result);
            }
        }else{//在线模式,将数据保存到本地
            var callback = options.success;
            options.success = function(result){
                _saveData2local(key,result);
                callback(result,key);
            }
            $.ajax(options);
        }
    }

    /**
     * 获取本地已缓存的数据
     * @private
     */
    var _getCache = function(key){
         return JSON.parse(window.localStorage.getItem(GET_KEY_PREFIX+key));
    }
    /**
     * 缓存数据到本地
     * @private
     */
    var _saveData2local = function(key,result){
        var data = {
            data : result,
            cacheTime : new Date()
        }
        window.localStorage.setItem(GET_KEY_PREFIX+key,JSON.stringify(data));
    }

    /**
     * 将post的数据保存至本地
     * @param url
     * @param result
     * @private
     */
    var _setUnPostData = function(url,result){
        var data = getUnPostData();
        data = data || {};
        data[url] = {
            data : result,
            createdTime : new Date()
        }
        window.localStorage.setItem(UNPOST_KEY,JSON.stringify(data));
    }
    /**
     *  获取尚未同步的post数据
     * @param url  没有就返回所有未同步的数据
     */
    var getUnPostData = function(url){
        var data = JSON.parse(window.localStorage.getItem(UNPOST_KEY));
        return (data && url ) ? data[url] : data;
    }
    /**
     * 移除未同步的数据
     * @param url 没有就移除所有未同步的数据
     */
    var removeUnPostData = function(url){
        if(url){
            var data = getUnPostData();
            delete data[url];
            window.localStorage.setItem(UNPOST_KEY,JSON.stringify(data));
        }else{
            window.localStorage.removeItem(UNPOST_KEY);
        }
    }

    /**
     * 同步本地缓存的post数据
     * @param url
     */
    var syncPostData = function(url,success,error){
        var unPostData = getUnPostData(url).data;
        $.ajax({
            url : url,
            contentType:'application/json',
            data : unPostData,
            type : 'post',
            success : function(){
                success(url);
            },
            error : function(){
                error(url);
            }
        })
    }
    /**
     * 同步所有的数据
     * @param callback
     */
    var syncAllPostData = function(success,error){
        var unPostData = getUnPostData();
        for(var url in unPostData){
            syncPostData(url,success,error);
        }
        removeUnPostData();
    }

    //copy from zepto
    function parseArguments(url, data, success, dataType) {
        var hasData = !$.isFunction(data)
        return {
            url:      url,
            data:     hasData  ? data : undefined,
            success:  !hasData ? data : $.isFunction(success) ? success : undefined,
            dataType: hasData  ? dataType || success : success
        }
    }

    var get = function(url, data, success, dataType){
        return ajax(parseArguments.apply(null, arguments))
    }

    var post = function(url, data, success, dataType){
        var options = parseArguments.apply(null, arguments)
        options.type = 'POST'
        return ajax(options)
    }

    var getJSON = function(url, data, success){
        var options = parseArguments.apply(null, arguments);
        options.dataType = 'json'
        return ajax(options)
    }
    var clear = function(){
        var storage = window.localStorage;
        var keys = [];
        for(var i = 0; i< storage.length; i++){
            var key = storage.key(i);
            key.indexOf(GET_KEY_PREFIX) == 0 && keys.push(key);
        }
        for(var i = 0; i < keys.length; i++){
            storage.removeItem(keys[i]);
        }
        storage.removeItem(UNPOST_KEY);
    }
    return {
        ajax : ajax,
        get : get,
        post : post,
        getJSON : getJSON,
        getUnPostData : getUnPostData,
        removeUnPostData : removeUnPostData,
        syncPostData : syncPostData,
        syncAllPostData : syncAllPostData,
        getCacheData : _getCache,
        saveCacheData : _saveData2local,
        clear : clear
    }
})(J.$);


text:
package com.avenwu.deepinandroid.eventbus;

import android.os.Handler;
import android.os.Looper;
import android.os.Message;

import java.util.concurrent.CopyOnWriteArrayList;

/**
 * Created by chaobin on 1/29/15.
 */
public class PostHandler extends Handler {

    final Bus mBus;

    public PostHandler(Looper looper, Bus bus) {
        super(looper);
        mBus = bus;
    }

    @Override
    public void handleMessage(Message msg) {
        CopyOnWriteArrayList<Subscriber> subscribers = mBus.mSubscriberMap.get(msg.obj.getClass());
        for (Subscriber subscriber : subscribers) {
            subscriber.mMethod.setAccessible(true);
            try {
                subscriber.mMethod.invoke(subscriber.mSubscriber, msg.obj);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }

    void enqueue(Object event) {
        Message message = obtainMessage();
        message.obj = event;
        sendMessage(message);
    }
}


text:
#include <algorithm>
#include <vector>

#ifndef LIBLOGCABIN_CORE_STLUTIL_H
#define LIBLOGCABIN_CORE_STLUTIL_H

namespace LibLogCabin {
namespace Core {
namespace STLUtil {

/**
 * Sort an R-value in place.
 * \param container
 *      An R-value to sort.
 * \return
 *      The sorted input.
 */
template<typename Container>
Container
sorted(Container container)
{
    std::sort(container.begin(), container.end());
    return container;
}

/**
 * Return a copy of the keys of a map.
 */
template<typename Map>
std::vector<typename Map::key_type>
getKeys(const Map& map)
{
    std::vector<typename Map::key_type> keys;
    for (auto it = map.begin(); it != map.end(); ++it)
        keys.push_back(it->first);
    return keys;
}

/**
 * Return a copy of the values of a map.
 */
template<typename Map>
std::vector<typename Map::mapped_type>
getValues(const Map& map)
{
    std::vector<typename Map::mapped_type> values;
    for (auto it = map.begin(); it != map.end(); ++it)
        values.push_back(it->second);
    return values;
}

/**
 * Return a copy of the key-value pairs of a map.
 */
template<typename Map>
std::vector<std::pair<typename Map::key_type,
                      typename Map::mapped_type>>
getItems(const Map& map)
{
    std::vector<std::pair<typename Map::key_type,
                          typename Map::mapped_type>> items;
    for (auto it = map.begin(); it != map.end(); ++it)
        items.push_back(*it);
    return items;
}

} // namespace LibLogCabin::Core::STLUtil
} // namespace LibLogCabin::Core
} // namespace LibLogCabin

#endif /* LIBLOGCABIN_CORE_STLUTIL_H */


text:
/*
################################################################################
#  THIS FILE IS 100% GENERATED BY ZPROJECT; DO NOT EDIT EXCEPT EXPERIMENTALLY  #
#  Please refer to the README for information about making permanent changes.  #
################################################################################
*/

#include "QmlZframe.h"

///
//  Return number of bytes in frame data
size_t QmlZframe::size () {
    return zframe_size (self);
};

///
//  Return address of frame data
byte *QmlZframe::data () {
    return zframe_data (self);
};

///
//  Create a new frame that duplicates an existing frame. If frame is null,
//  or memory was exhausted, returns null.
QmlZframe *QmlZframe::dup () {
    QmlZframe *retQ_ = new QmlZframe ();
    retQ_->self = zframe_dup (self);
    return retQ_;
};

///
//  Return frame data encoded as printable hex string, useful for 0MQ UUIDs.
//  Caller must free string when finished with it.
QString QmlZframe::strhex () {
    char *retStr_ = zframe_strhex (self);
    QString retQStr_ = QString (retStr_);
    free (retStr_);
    return retQStr_;
};

///
//  Return frame data copied into freshly allocated string
//  Caller must free string when finished with it.
QString QmlZframe::strdup () {
    char *retStr_ = zframe_strdup (self);
    QString retQStr_ = QString (retStr_);
    free (retStr_);
    return retQStr_;
};

///
//  Return TRUE if frame body is equal to string, excluding terminator
bool QmlZframe::streq (const QString &string) {
    return zframe_streq (self, string.toUtf8().data());
};

///
//  Return frame MORE indicator (1 or 0), set when reading frame from socket
//  or by the zframe_set_more() method
int QmlZframe::more () {
    return zframe_more (self);
};

///
//  Set frame MORE indicator (1 or 0). Note this is NOT used when sending
//  frame to socket, you have to specify flag explicitly.
void QmlZframe::setMore (int more) {
    zframe_set_more (self, more);
};

///
//  Return frame routing id, set when reading frame from server socket
//  or by the zframe_set_routing_id() method.
size_t QmlZframe::routingId () {
    return zframe_routing_id (self);
};

///
//  Set frame routing id. Only relevant when sending to server socket.
void QmlZframe::setRoutingId (size_t routingId) {
    zframe_set_routing_id (self, routingId);
};

///
//  Return TRUE if two frames have identical size and data
//  If either frame is NULL, equality is always false.
bool QmlZframe::eq (QmlZframe *other) {
    return zframe_eq (self, other->self);
};

///
//  Set new contents for frame
void QmlZframe::reset (const void *data, size_t size) {
    zframe_reset (self, data, size);
};

///
//  Send message to zsys log sink (may be stdout, or system facility as
//  configured by zsys_set_logstream). Prefix shows before frame, if not null.
void QmlZframe::print (const QString &prefix) {
    zframe_print (self, prefix.toUtf8().data());
};

QObject* QmlZframe::qmlAttachedProperties(QObject* object) {
    return new QmlZframeAttached(object);
}

///
//  Create an empty (zero-sized) frame
QmlZframe *QmlZframeAttached::newEmpty () {
    QmlZframe *retQ_ = new QmlZframe ();
    retQ_->self = zframe_new_empty ();
    return retQ_;
};

///
//  Create a frame with a specified string content.
QmlZframe *QmlZframeAttached::from (const QString &string) {
    QmlZframe *retQ_ = new QmlZframe ();
    retQ_->self = zframe_from (string.toUtf8().data());
    return retQ_;
};

///
//  Receive frame from socket, returns zframe_t object or NULL if the recv
//  was interrupted. Does a blocking recv, if you want to not block then use
//  zpoller or zloop.
QmlZframe *QmlZframeAttached::recv (void *source) {
    QmlZframe *retQ_ = new QmlZframe ();
    retQ_->self = zframe_recv (source);
    return retQ_;
};

///
//  Send a frame to a socket, destroy frame after sending.
//  Return -1 on error, 0 on success.
int QmlZframeAttached::send (QmlZframe *selfP, void *dest, int flags) {
    return zframe_send (&selfP->self, dest, flags);
};

///
//  Send a reply frame to a server socket, copy the routing id from source message, destroy frame after sending.
//  Return -1 on error, 0 on success.
int QmlZframeAttached::sendReply (QmlZframe *selfP, QmlZframe *sourceMsg, void *dest, int flags) {
    return zframe_send_reply (&selfP->self, sourceMsg->self, dest, flags);
};

///
//  Probe the supplied object, and report if it looks like a zframe_t.
bool QmlZframeAttached::is (void *self) {
    return zframe_is (self);
};

///
//  Self test of this class
void QmlZframeAttached::test (bool verbose) {
    zframe_test (verbose);
};

///
//  Create a new frame. If size is not null, allocates the frame data
//  to the specified size. If additionally, data is not null, copies
//  size octets from the specified data into the frame body.
QmlZframe *QmlZframeAttached::construct (const void *data, size_t size) {
    QmlZframe *qmlSelf = new QmlZframe ();
    qmlSelf->self = zframe_new (data, size);
    return qmlSelf;
};

///
//  Destroy a frame
void QmlZframeAttached::destruct (QmlZframe *qmlSelf) {
    zframe_destroy (&qmlSelf->self);
};

/*
################################################################################
#  THIS FILE IS 100% GENERATED BY ZPROJECT; DO NOT EDIT EXCEPT EXPERIMENTALLY  #
#  Please refer to the README for information about making permanent changes.  #
################################################################################
*/


text:
<!DOCTYPE html>

	<meta charset="utf-8">
	<title>Observer Test Suite</title>

	<link rel="stylesheet" href="qunit/qunit.css" media="screen">

Observer Test Suite

		lame test markup
		normal test markup
		awesome test markup


text:
__author__ = 'luke Berezynskyj <eat.lemons@gmail.com>'

import re
import logging
import subprocess
import pjsua as pj
from time import sleep

class CallHandler(pj.CallCallback):
    def __init__(self, call=None):
        self.lib = pj.Lib.instance()
        pj.CallCallback.__init__(self, call)
        self.wait_for_hash = False
        self.collection = ''
        self.action = None
        self.account = None

    def set_account(self, account):
        self.account = account

    def play_file(self, file="default.wav", enforce_playback=False):
        logging.info("Playing file %s" % file)
        player = self.lib.create_player(file)
        player_slot = self.lib.player_get_slot(player)
        self.lib.conf_connect(player_slot, self.call.info().conf_slot)
        if enforce_playback:
            meta = subprocess.check_output(["sox", file, "-n", "stat"], stderr=subprocess.STDOUT)
            duration = re.search("Length[^\d]+((?:\d|\.)+)", meta).group(1)
            logging.info("Enforcing media playback with duration: %s" % duration)
            sleep(float(duration)+0.6)
            self.lib.player_destroy(player)
        return player

    def on_state(self):
        logging.info("Call with %s is %s. Last code: %s (%s)" % (self.call.info().remote_uri,
                                                                 self.call.info().state_text,
                                                                 self.call.info().last_code,
                                                                 self.call.info().last_reason))

        if self.call.info().state == pj.CallState.DISCONNECTED:
            logging.info('Call disconnected')

    def on_media_state(self):
        logging.info("Media state: %s" % self.call.info().media_state)
        if self.call.info().media_state == pj.MediaState.ACTIVE:
            logging.info("Media is now active")
        else:
            logging.info("Media is inactive")

    def on_dtmf_digit(self, digits):
        logging.info("Got DTMF digit: %s" % digits)
        pass
        if digits == '#':
            self.wait_for_hash = False
            logging.info("Collected DTMF: %s" % self.collection)
            if self.action == "newcall":
                self.account.new_call(self.collection, self.call.info().conf_slot)
        if self.wait_for_hash:
            self.collection += digits
            return
        if digits == '7':
            self.play_file("../audio/default.wav", enforce_playback=True)
            self.wait_for_hash = True
            self.action = "newcall"


text:
package org.sakaiproject.calendar.api;

/**
 * This allows creation and retrieval of OpaqueUrls
 * @see org.sakaiproject.calendar.api.OpaqueUrl
 */
public interface OpaqueUrlDao {

	OpaqueUrl newOpaqueUrl(String userUUID, String calendarRef);

	OpaqueUrl getOpaqueUrl(String userUUID, String calendarRef);

	OpaqueUrl getOpaqueUrl(String opaqueUUID);

	void deleteOpaqueUrl(String userUUID, String calendarRef);

}


text:
using System;
using System.Drawing;
using System.Linq;
using System.Windows.Forms;
using DropDownControls.FilteredGroupedComboBox;

namespace DemoApp
{

    /// <summary>
    ///
    /// </summary>
    public partial class DemoForm : Form
    {
        /// <summary>
        ///
        /// </summary>
        public DemoForm()
        {
            InitializeComponent();

            // define our collection of list items
                var groupedItems = new[] {
                    new GroupedColoredComboBoxItem{ Group = "Gases", Value = "1", Display = "Helium", Color = Color.Blue },
				    new GroupedColoredComboBoxItem{ Group = "Gases", Value = "2", Display = "Hydrogen", Color = Color.Blue },
				    new GroupedColoredComboBoxItem{ Group = "Gases", Value = "3", Display = "Oxygen", Color = Color.Blue },
				    new GroupedColoredComboBoxItem{ Group = "Gases", Value = "4", Display = "Argon", Color = Color.Blue },
				    new GroupedColoredComboBoxItem{ Group = "Metals", Value = "5", Display = "Iron", Color = Color.Gray },
				    new GroupedColoredComboBoxItem{ Group = "Metals", Value = "6", Display = "Lithium", Color = Color.Gray },
				    new GroupedColoredComboBoxItem{ Group = "Metals", Value = "7", Display = "Copper", Color = Color.Gray },
				    new GroupedColoredComboBoxItem{ Group = "Metals", Value = "8", Display = "Gold", Color = Color.Gray },
				    new GroupedColoredComboBoxItem{ Group = "Metals", Value = "9", Display = "Silver", Color = Color.Gray },
				    new GroupedColoredComboBoxItem{ Group = "Radioactive", Value = "10", Display = "Uranium", Color = Color.MediumPurple },
				    new GroupedColoredComboBoxItem{ Group = "Radioactive", Value = "11", Display = "Plutonium", Color = Color.MediumPurple },
				    new GroupedColoredComboBoxItem{ Group = "Radioactive", Value = "12", Display = "Americium", Color = Color.MediumPurple },
				    new GroupedColoredComboBoxItem{ Group = "Radioactive", Value = "13", Display = "Radon", Color = Color.MediumPurple }

			    };

            gcbEditable.FilterableGroupableDataSource(groupedItems.AsEnumerable());

        }

    }

}


text:
import datetime
import sys
import traceback
import collections

def UTCTimestampUsec():
    epoch = datetime.datetime.utcfromtimestamp(0)
    now = datetime.datetime.utcnow()
    delta = now-epoch
    return (delta.microseconds +
            (delta.seconds + delta.days * 24 * 3600) * 10**6)
# end UTCTimestampUsec

def UTCTimestampUsecToString(utc_usec):
    return datetime.datetime.fromtimestamp(
        utc_usec/1000000).strftime('%Y-%m-%d %H:%M:%S')
# end UTCTimestampUsecToString

def enum(*sequential, **named):
    enums = dict(zip(sequential, range(len(sequential))), **named)
    return type('Enum', (), enums)
# end enum

def import_class(import_str):
    """Returns a class from a string including module and class."""
    mod_str, _sep, class_str = import_str.rpartition('.')
    __import__(mod_str)
    try:
        return getattr(sys.modules[mod_str], class_str)
    except AttributeError:
        raise ImportError('Class %s cannot be found (%s)' %
                          (class_str,
                           traceback.format_exception(*sys.exc_info())))

class deque(collections.deque):
    def __init__(self, iterable=(), maxlen=None):
        super(deque, self).__init__(iterable, maxlen)
        self._maxlen = maxlen
    @property
    def maxlen(self):
        return self._maxlen

# end class deque