text
stringlengths
2
99k
meta
dict
lombok.addLombokGeneratedAnnotation = true
{ "pile_set_name": "Github" }
// // LRUK.swift // TySimulator // // Created by ty0x2333 on 2017/7/1. // Copyright © 2017年 ty0x2333. All rights reserved. // import Foundation class LRUK<K: Hashable, V> { private let cache: LRU<K, V> private let bufferSize: Int let history: LRU<K, (hits: Int, value: V)> private let threshold: Int private let semaphore: DispatchSemaphore = DispatchSemaphore(value: 1) public var count: Int { return cache.count } public var datas: [(key: K, value: V)] { return cache.datas } init(capacity: Int, bufferSize: Int, threshold: Int = 2, datas: [(key: K, value: V)]? = nil, history: [(key: K, value: (hits: Int, value: V))]? = nil) { cache = LRU<K, V>(capacity: capacity, datas: datas) self.history = LRU<K, (hits: Int, value: V)>(capacity: bufferSize, datas: history) self.bufferSize = bufferSize self.threshold = threshold } subscript (key: K) -> V? { get { return cache[key] } // if value is nil, it will do nothing set(value) { guard let newValue = value else { return } _ = semaphore.wait(timeout: .distantFuture) if let his = history[key] { let hits = his.hits + 1 if hits < threshold { history[key] = (hits: hits, value: newValue) } else { history[key] = nil cache[key] = newValue } } else if threshold < 2 { cache[key] = newValue } else { history[key] = (hits: 1, value: newValue) } semaphore.signal() } } }
{ "pile_set_name": "Github" }
{-# LANGUAGE DataKinds #-} {-# LANGUAGE GADTs #-} {-# LANGUAGE PolyKinds #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeOperators #-} module T13881 where data family Sing (a :: k) data instance Sing (z :: [a]) where SNil :: Sing '[] SCons :: Sing x -> Sing xs -> Sing (x ': xs) fl :: forall a (l :: [a]). Sing l -> Sing l fl (SNil :: Sing (l :: [y])) = SNil fl (SCons x xs) = SCons x xs
{ "pile_set_name": "Github" }
// Copyright 2015 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // Internal API backing the chrome.certificateProvider API events. // The internal API associates events with replies to these events using request // IDs. A custom binding is used to hide these IDs from the public API. // Before an event hits the extension, the request ID is removed and instead a // callback is added to the event arguments. On the way back, when the extension // runs the callback to report its results, the callback magically prepends the // request ID to the results and calls the respective internal report function // (reportSignature or reportCertificates). [implemented_in = "chrome/browser/extensions/api/certificate_provider/certificate_provider_api.h"] namespace certificateProviderInternal { callback DoneCallback = void (); callback ResultCallback = void (ArrayBuffer[] rejectedCertificates); interface Functions { // Matches certificateProvider.SignCallback. Must be called without the // signature to report an error. static void reportSignature( long requestId, optional ArrayBuffer signature, optional DoneCallback callback); // Matches certificateProvider.CertificatesCallback. Must be called without // the certificates argument to report an error. static void reportCertificates( long requestId, optional certificateProvider.CertificateInfo[] certificates, optional ResultCallback callback); }; };
{ "pile_set_name": "Github" }
/************************************************************************* * * * XV Olimpiada Informatyczna * * * * Zadanie: Lampki (LAM) * * Plik: lams1.cpp * * Autor: Michal Brzozowski * * Opis: Rozwiazanie zbyt wolne, reprezentuje duze liczby * * za pomoca rozkladow na czynniki pierwsze. * * * *************************************************************************/ #include <iostream> #include <algorithm> #include <cassert> #include <vector> #include <sstream> using namespace std; const int nprime = 60000; int primes[nprime]; int cprime=0; int base = 1000000000; int basel=9; typedef long long LL; void razy(LL *c, int& k, LL n){ LL r = 0; int tmp=0; for (int i=0; i<k || r>0 ;++i){ LL a = i<k ? c[i] : 0; a = a*n + r; c[i] = a % base; r = a / base; if (c[i]) tmp=i+1; } k= tmp; } struct pr_liczba { bool zero; int p[nprime]; pr_liczba(){ zero=false; for (int i=0;i<nprime;++i) p[i]=0; } pr_liczba(int k){ zero=false; if (!k){ zero=true; for (int i=0;i<nprime;++i) p[i]=0; } else for (int i=0;i<cprime;++i){ p[i]=0; while (k%primes[i] == 0){ ++p[i]; k/=primes[i]; } } } void razy(const pr_liczba& l){ if (l.zero) zero=true; for (int i=0;i<cprime;++i) p[i]+=l.p[i]; } void skroc(pr_liczba& l){ for (int i=0;i<cprime;++i){ int k = min(p[i], l.p[i]); p[i]-=k; l.p[i]-=k; } } void napis(LL *c, int &k){ if (zero){ c[0]=0; k=1; return; } c[0]=1; for (int i=0;i<cprime;++i){ int j=0; while (j<p[i]){ LL mno=primes[i]; ++j; while (mno * primes[i] < 2000000000 && j<p[i]){ mno*=primes[i]; ++j; } ::razy(c, k, mno); } /*for (int j=0;j<p[i];++j){ if (j<p[i]-1 && LL(primes[i])*LL(primes[i])<2000000000){ ::razy(c, k, primes[i]* primes[i]); ++j; } else ::razy(c, k, primes[i]); }*/ } } }; LL nwd(LL a, LL b){ if (b==0) return a; return nwd(b, a%b); } struct int_liczba { LL i; int_liczba():i(1){} int_liczba(LL k):i(k){} void razy(const int_liczba& l){ i*=l.i; } void skroc(int_liczba& l){ LL g = nwd(i, l.i); i/=g; l.i/=g; } void napis(LL *c, int &k){ LL a = i; while (a){ c[k-1] = a%base; a/=base; if (a) ++k; } } }; typedef pr_liczba liczba; LL buf[1000000]; void rozklad(int k){ while (k>1){ bool podz=false; for (int i=2;i*i<=k;++i) if (k%i==0) { podz=true; k/=i; primes[cprime++]=i; } if (!podz){ primes[cprime++]=k; break; } } } int n; int main(){ cin >> n; int num[1000]; for (int i=0;i<n;++i){ cin >> num[i]; rozklad(num[i]); rozklad(num[i]-1); } sort(primes, primes+cprime); int tab[nprime]; int tmp=0; for (int i=0;i<cprime;++i) if (i==0 || primes[i]!=primes[i-1]) tab[tmp++] = primes[i]; cprime = tmp; for (int i=0;i<cprime;++i){ primes[i]=tab[i]; //cout << primes[i]<<' '; } //cout <<endl; liczba licz, mian(num[n-1]); int bufsize=1; vector<string> out; char tbuf[100]; sprintf(tbuf,"1/%d",num[n-1]); out.push_back(tbuf); for (int i=n-2;i>=0;--i){ licz.razy(liczba(num[i+1]-1)); mian.razy(liczba(num[i])); licz.skroc(mian); bufsize=1; licz.napis(buf, bufsize); ostringstream os; os.fill('0'); for (int i=bufsize-1;i>=0;--i){ if (i<bufsize-1) os.width(basel); else os.width(0); os << right << buf[i]; } os <<'/'; bufsize=1; os.fill('0'); if (licz.zero) mian = liczba(1); mian.napis(buf, bufsize); for (int i=bufsize-1;i>=0;--i){ if (i<bufsize-1) os.width(basel); else os.width(0); os << right << buf[i]; } out.push_back(os.str()); } for (int i=n-1;i>=0;--i) cout << out[i]<<endl; }
{ "pile_set_name": "Github" }
// Copyright 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. package org.chromium.content.browser; import android.annotation.SuppressLint; import android.content.Context; import android.content.res.Resources; import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.graphics.Path; import android.graphics.Path.Direction; import android.graphics.PointF; import android.graphics.PorterDuff.Mode; import android.graphics.PorterDuffXfermode; import android.graphics.Rect; import android.graphics.RectF; import android.graphics.Region.Op; import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; import android.os.SystemClock; import android.view.GestureDetector; import android.view.MotionEvent; import android.view.View; import android.view.animation.Interpolator; import android.view.animation.OvershootInterpolator; import org.chromium.base.ApiCompatibilityUtils; import org.chromium.base.Log; import org.chromium.content.R; /** * PopupZoomer is used to show the on-demand link zooming popup. It handles manipulation of the * canvas and touch events to display the on-demand zoom magnifier. */ class PopupZoomer extends View { private static final String TAG = "cr.PopupZoomer"; // The padding between the edges of the view and the popup. Note that there is a mirror // constant in content/renderer/render_view_impl.cc which should be kept in sync if // this is changed. private static final int ZOOM_BOUNDS_MARGIN = 25; // Time it takes for the animation to finish in ms. private static final long ANIMATION_DURATION = 300; /** * Interface to be implemented to listen for touch events inside the zoomed area. * The MotionEvent coordinates correspond to original unzoomed view. */ public static interface OnTapListener { public boolean onSingleTap(View v, MotionEvent event); public boolean onLongPress(View v, MotionEvent event); } private OnTapListener mOnTapListener = null; /** * Interface to be implemented to add and remove PopupZoomer to/from the view hierarchy. */ public static interface OnVisibilityChangedListener { public void onPopupZoomerShown(PopupZoomer zoomer); public void onPopupZoomerHidden(PopupZoomer zoomer); } private OnVisibilityChangedListener mOnVisibilityChangedListener = null; // Cached drawable used to frame the zooming popup. // TODO(tonyg): This should be marked purgeable so that if the system wants to recover this // memory, we can just reload it from the resource ID next time it is needed. // See android.graphics.BitmapFactory.Options#inPurgeable private static Drawable sOverlayDrawable; // The padding used for drawing the overlay around the content, instead of directly above it. private static Rect sOverlayPadding; // The radius of the overlay bubble, used for rounding the bitmap to draw underneath it. private static float sOverlayCornerRadius; private final Interpolator mShowInterpolator = new OvershootInterpolator(); private final Interpolator mHideInterpolator = new ReverseInterpolator(mShowInterpolator); private boolean mAnimating = false; private boolean mShowing = false; private long mAnimationStartTime = 0; // The time that was left for the outwards animation to finish. // This is used in the case that the zoomer is cancelled while it is still animating outwards, // to avoid having it jump to full size then animate closed. private long mTimeLeft = 0; // initDimensions() needs to be called in onDraw(). private boolean mNeedsToInitDimensions; // Available view area after accounting for ZOOM_BOUNDS_MARGIN. private RectF mViewClipRect; // The target rect to be zoomed. private Rect mTargetBounds; // The bitmap to hold the zoomed view. private Bitmap mZoomedBitmap; // How far to shift the canvas after all zooming is done, to keep it inside the bounds of the // view (including margin). private float mShiftX = 0, mShiftY = 0; // The magnification factor of the popup. It is recomputed once we have mTargetBounds and // mZoomedBitmap. private float mScale = 1.0f; // The bounds representing the actual zoomed popup. private RectF mClipRect; // The extrusion values are how far the zoomed area (mClipRect) extends from the touch point. // These values to used to animate the popup. private float mLeftExtrusion, mTopExtrusion, mRightExtrusion, mBottomExtrusion; // The last touch point, where the animation will start from. private final PointF mTouch = new PointF(); // Since we sometimes overflow the bounds of the mViewClipRect, we need to allow scrolling. // Current scroll position. private float mPopupScrollX, mPopupScrollY; // Scroll bounds. private float mMinScrollX, mMaxScrollX; private float mMinScrollY, mMaxScrollY; private GestureDetector mGestureDetector; // These bounds are computed and valid for one execution of onDraw. // Extracted to a member variable to save unnecessary allocations on each invocation. private RectF mDrawRect; private static float getOverlayCornerRadius(Context context) { if (sOverlayCornerRadius == 0) { try { sOverlayCornerRadius = context.getResources().getDimension( R.dimen.link_preview_overlay_radius); } catch (Resources.NotFoundException e) { Log.w(TAG, "No corner radius resource for PopupZoomer overlay found."); sOverlayCornerRadius = 1.0f; } } return sOverlayCornerRadius; } /** * Gets the drawable that should be used to frame the zooming popup, loading * it from the resource bundle if not already cached. */ private static Drawable getOverlayDrawable(Context context) { if (sOverlayDrawable == null) { try { sOverlayDrawable = ApiCompatibilityUtils.getDrawable(context.getResources(), R.drawable.ondemand_overlay); } catch (Resources.NotFoundException e) { Log.w(TAG, "No drawable resource for PopupZoomer overlay found."); sOverlayDrawable = new ColorDrawable(); } sOverlayPadding = new Rect(); sOverlayDrawable.getPadding(sOverlayPadding); } return sOverlayDrawable; } private static float constrain(float amount, float low, float high) { return amount < low ? low : (amount > high ? high : amount); } private static int constrain(int amount, int low, int high) { return amount < low ? low : (amount > high ? high : amount); } /** * Creates Popupzoomer. * @param context Context to be used. * @param overlayRadiusDimensoinResId Resource to be used to get overlay corner radius. */ public PopupZoomer(Context context) { super(context); setVisibility(INVISIBLE); setFocusable(true); setFocusableInTouchMode(true); GestureDetector.SimpleOnGestureListener listener = new GestureDetector.SimpleOnGestureListener() { @Override public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) { if (mAnimating) return true; if (isTouchOutsideArea(e1.getX(), e1.getY())) { hide(true); } else { scroll(distanceX, distanceY); } return true; } @Override public boolean onSingleTapUp(MotionEvent e) { return handleTapOrPress(e, false); } @Override public void onLongPress(MotionEvent e) { handleTapOrPress(e, true); } private boolean handleTapOrPress(MotionEvent e, boolean isLongPress) { if (mAnimating) return true; float x = e.getX(); float y = e.getY(); if (isTouchOutsideArea(x, y)) { // User clicked on area outside the popup. hide(true); } else if (mOnTapListener != null) { PointF converted = convertTouchPoint(x, y); MotionEvent event = MotionEvent.obtainNoHistory(e); event.setLocation(converted.x, converted.y); if (isLongPress) { mOnTapListener.onLongPress(PopupZoomer.this, event); } else { mOnTapListener.onSingleTap(PopupZoomer.this, event); } hide(true); } return true; } }; mGestureDetector = new GestureDetector(context, listener); } /** * Sets the OnTapListener. */ public void setOnTapListener(OnTapListener listener) { mOnTapListener = listener; } /** * Sets the OnVisibilityChangedListener. */ public void setOnVisibilityChangedListener(OnVisibilityChangedListener listener) { mOnVisibilityChangedListener = listener; } /** * Sets the bitmap to be used for the zoomed view. */ public void setBitmap(Bitmap bitmap) { if (mZoomedBitmap != null) { mZoomedBitmap.recycle(); mZoomedBitmap = null; } mZoomedBitmap = bitmap; // Round the corners of the bitmap so it doesn't stick out around the overlay. Canvas canvas = new Canvas(mZoomedBitmap); Path path = new Path(); RectF canvasRect = new RectF(0, 0, canvas.getWidth(), canvas.getHeight()); float overlayCornerRadius = getOverlayCornerRadius(getContext()); path.addRoundRect(canvasRect, overlayCornerRadius, overlayCornerRadius, Direction.CCW); canvas.clipPath(path, Op.XOR); Paint clearPaint = new Paint(); clearPaint.setXfermode(new PorterDuffXfermode(Mode.SRC)); clearPaint.setColor(Color.TRANSPARENT); canvas.drawPaint(clearPaint); } private void scroll(float x, float y) { mPopupScrollX = constrain(mPopupScrollX - x, mMinScrollX, mMaxScrollX); mPopupScrollY = constrain(mPopupScrollY - y, mMinScrollY, mMaxScrollY); invalidate(); } private void startAnimation(boolean show) { mAnimating = true; mShowing = show; mTimeLeft = 0; if (show) { setVisibility(VISIBLE); mNeedsToInitDimensions = true; if (mOnVisibilityChangedListener != null) { mOnVisibilityChangedListener.onPopupZoomerShown(this); } } else { long endTime = mAnimationStartTime + ANIMATION_DURATION; mTimeLeft = endTime - SystemClock.uptimeMillis(); if (mTimeLeft < 0) mTimeLeft = 0; } mAnimationStartTime = SystemClock.uptimeMillis(); invalidate(); } private void hideImmediately() { mAnimating = false; mShowing = false; mTimeLeft = 0; if (mOnVisibilityChangedListener != null) { mOnVisibilityChangedListener.onPopupZoomerHidden(this); } setVisibility(INVISIBLE); mZoomedBitmap.recycle(); mZoomedBitmap = null; } /** * Returns true if the view is currently being shown (or is animating). */ public boolean isShowing() { return mShowing || mAnimating; } /** * Sets the last touch point (on the unzoomed view). */ public void setLastTouch(float x, float y) { mTouch.x = x; mTouch.y = y; } private void setTargetBounds(Rect rect) { mTargetBounds = rect; } private void initDimensions() { if (mTargetBounds == null || mTouch == null) return; // Compute the final zoom scale. mScale = (float) mZoomedBitmap.getWidth() / mTargetBounds.width(); float l = mTouch.x - mScale * (mTouch.x - mTargetBounds.left); float t = mTouch.y - mScale * (mTouch.y - mTargetBounds.top); float r = l + mZoomedBitmap.getWidth(); float b = t + mZoomedBitmap.getHeight(); mClipRect = new RectF(l, t, r, b); int width = getWidth(); int height = getHeight(); mViewClipRect = new RectF(ZOOM_BOUNDS_MARGIN, ZOOM_BOUNDS_MARGIN, width - ZOOM_BOUNDS_MARGIN, height - ZOOM_BOUNDS_MARGIN); // Ensure it stays inside the bounds of the view. First shift it around to see if it // can fully fit in the view, then clip it to the padding section of the view to // ensure no overflow. mShiftX = 0; mShiftY = 0; // Right now this has the happy coincidence of showing the leftmost portion // of a scaled up bitmap, which usually has the text in it. When we want to support // RTL languages, we can conditionally switch the order of this check to push it // to the left instead of right. if (mClipRect.left < ZOOM_BOUNDS_MARGIN) { mShiftX = ZOOM_BOUNDS_MARGIN - mClipRect.left; mClipRect.left += mShiftX; mClipRect.right += mShiftX; } else if (mClipRect.right > width - ZOOM_BOUNDS_MARGIN) { mShiftX = (width - ZOOM_BOUNDS_MARGIN - mClipRect.right); mClipRect.right += mShiftX; mClipRect.left += mShiftX; } if (mClipRect.top < ZOOM_BOUNDS_MARGIN) { mShiftY = ZOOM_BOUNDS_MARGIN - mClipRect.top; mClipRect.top += mShiftY; mClipRect.bottom += mShiftY; } else if (mClipRect.bottom > height - ZOOM_BOUNDS_MARGIN) { mShiftY = height - ZOOM_BOUNDS_MARGIN - mClipRect.bottom; mClipRect.bottom += mShiftY; mClipRect.top += mShiftY; } // Allow enough scrolling to get to the entire bitmap that may be clipped inside the // bounds of the view. mMinScrollX = mMaxScrollX = mMinScrollY = mMaxScrollY = 0; if (mViewClipRect.right + mShiftX < mClipRect.right) { mMinScrollX = mViewClipRect.right - mClipRect.right; } if (mViewClipRect.left + mShiftX > mClipRect.left) { mMaxScrollX = mViewClipRect.left - mClipRect.left; } if (mViewClipRect.top + mShiftY > mClipRect.top) { mMaxScrollY = mViewClipRect.top - mClipRect.top; } if (mViewClipRect.bottom + mShiftY < mClipRect.bottom) { mMinScrollY = mViewClipRect.bottom - mClipRect.bottom; } // Now that we know how much we need to scroll, we can intersect with mViewClipRect. mClipRect.intersect(mViewClipRect); mLeftExtrusion = mTouch.x - mClipRect.left; mRightExtrusion = mClipRect.right - mTouch.x; mTopExtrusion = mTouch.y - mClipRect.top; mBottomExtrusion = mClipRect.bottom - mTouch.y; // Set an initial scroll position to take touch point into account. float percentX = (mTouch.x - mTargetBounds.centerX()) / (mTargetBounds.width() / 2.f) + .5f; float percentY = (mTouch.y - mTargetBounds.centerY()) / (mTargetBounds.height() / 2.f) + .5f; float scrollWidth = mMaxScrollX - mMinScrollX; float scrollHeight = mMaxScrollY - mMinScrollY; mPopupScrollX = scrollWidth * percentX * -1f; mPopupScrollY = scrollHeight * percentY * -1f; // Constrain initial scroll position within allowed bounds. mPopupScrollX = constrain(mPopupScrollX, mMinScrollX, mMaxScrollX); mPopupScrollY = constrain(mPopupScrollY, mMinScrollY, mMaxScrollY); // Compute the bounds in onDraw() mDrawRect = new RectF(); } /* * Tests override it as the PopupZoomer is never attached to the view hierarchy. */ protected boolean acceptZeroSizeView() { return false; } @Override protected void onDraw(Canvas canvas) { if (!isShowing() || mZoomedBitmap == null) return; if (!acceptZeroSizeView() && (getWidth() == 0 || getHeight() == 0)) return; if (mNeedsToInitDimensions) { mNeedsToInitDimensions = false; initDimensions(); } canvas.save(); // Calculate the elapsed fraction of animation. float time = (SystemClock.uptimeMillis() - mAnimationStartTime + mTimeLeft) / ((float) ANIMATION_DURATION); time = constrain(time, 0, 1); if (time >= 1) { mAnimating = false; if (!isShowing()) { hideImmediately(); return; } } else { invalidate(); } // Fraction of the animation to actally show. float fractionAnimation; if (mShowing) { fractionAnimation = mShowInterpolator.getInterpolation(time); } else { fractionAnimation = mHideInterpolator.getInterpolation(time); } // Draw a faded color over the entire view to fade out the original content, increasing // the alpha value as fractionAnimation increases. // TODO(nileshagrawal): We should use time here instead of fractionAnimation // as fractionAnimaton is interpolated and can go over 1. canvas.drawARGB((int) (80 * fractionAnimation), 0, 0, 0); canvas.save(); // Since we want the content to appear directly above its counterpart we need to make // sure that it starts out at exactly the same size as it appears in the page, // i.e. scale grows from 1/mScale to 1. Note that extrusion values are already zoomed // with mScale. float scale = fractionAnimation * (mScale - 1.0f) / mScale + 1.0f / mScale; // Since we want the content to appear directly above its counterpart on the // page, we need to remove the mShiftX/Y effect at the beginning of the animation. // The unshifting decreases with the animation. float unshiftX = -mShiftX * (1.0f - fractionAnimation) / mScale; float unshiftY = -mShiftY * (1.0f - fractionAnimation) / mScale; // Compute the |mDrawRect| to show. mDrawRect.left = mTouch.x - mLeftExtrusion * scale + unshiftX; mDrawRect.top = mTouch.y - mTopExtrusion * scale + unshiftY; mDrawRect.right = mTouch.x + mRightExtrusion * scale + unshiftX; mDrawRect.bottom = mTouch.y + mBottomExtrusion * scale + unshiftY; canvas.clipRect(mDrawRect); // Since the canvas transform APIs all pre-concat the transformations, this is done in // reverse order. The canvas is first scaled up, then shifted the appropriate amount of // pixels. canvas.scale(scale, scale, mDrawRect.left, mDrawRect.top); canvas.translate(mPopupScrollX, mPopupScrollY); canvas.drawBitmap(mZoomedBitmap, mDrawRect.left, mDrawRect.top, null); canvas.restore(); Drawable overlayNineTile = getOverlayDrawable(getContext()); overlayNineTile.setBounds((int) mDrawRect.left - sOverlayPadding.left, (int) mDrawRect.top - sOverlayPadding.top, (int) mDrawRect.right + sOverlayPadding.right, (int) mDrawRect.bottom + sOverlayPadding.bottom); // TODO(nileshagrawal): We should use time here instead of fractionAnimation // as fractionAnimaton is interpolated and can go over 1. int alpha = constrain((int) (fractionAnimation * 255), 0, 255); overlayNineTile.setAlpha(alpha); overlayNineTile.draw(canvas); canvas.restore(); } /** * Show the PopupZoomer view with given target bounds. */ public void show(Rect rect) { if (mShowing || mZoomedBitmap == null) return; setTargetBounds(rect); startAnimation(true); } /** * Hide the PopupZoomer view. * @param animation true if hide with animation. */ public void hide(boolean animation) { if (!mShowing) return; if (animation) { startAnimation(false); } else { hideImmediately(); } } /** * Converts the coordinates to a point on the original un-zoomed view. */ private PointF convertTouchPoint(float x, float y) { x -= mShiftX; y -= mShiftY; x = mTouch.x + (x - mTouch.x - mPopupScrollX) / mScale; y = mTouch.y + (y - mTouch.y - mPopupScrollY) / mScale; return new PointF(x, y); } /** * Returns true if the point is inside the final drawable area for this popup zoomer. */ private boolean isTouchOutsideArea(float x, float y) { return !mClipRect.contains(x, y); } @SuppressLint("ClickableViewAccessibility") @Override public boolean onTouchEvent(MotionEvent event) { mGestureDetector.onTouchEvent(event); return true; } private static class ReverseInterpolator implements Interpolator { private final Interpolator mInterpolator; public ReverseInterpolator(Interpolator i) { mInterpolator = i; } @Override public float getInterpolation(float input) { input = 1.0f - input; if (mInterpolator == null) return input; return mInterpolator.getInterpolation(input); } } }
{ "pile_set_name": "Github" }
import callsites from "callsites"; import chalk from "chalk"; import { existsSync } from "fs"; import { toMatchImageSnapshot } from "jest-image-snapshot"; import { dirname, join, sep } from "path"; import { debugLogger } from "../logger"; import { fetch } from "../network/fetch"; import { Viewport } from "../screenshot-renderer/api"; import { getScreenshotPrefix, SCREENSHOT_MODE, SCREENSHOT_SERVER_URL, } from "../screenshot-server/config"; import { ReactComponentServer } from "./ReactComponentServer"; const logDebug = debugLogger("ReactScreenshotTest"); /** * ReactScreenshotTest is a builder for screenshot tests. * * Example usage: * ``` * ReactScreenshotTest.create("Using runner") * .viewports(VIEWPORTS) * .shoot("with title", <MyComponent title="Hello, World!" />) * .shoot("without title", <MyComponent title={null} />) * .run(); * ``` */ export class ReactScreenshotTest { private readonly _viewports: { [name: string]: Viewport; } = {}; private readonly _shots: { [name: string]: React.ReactNode; } = {}; private readonly _remoteStylesheetUrls: string[] = []; private readonly _staticPaths: Record<string, string> = {}; private ran = false; /** * Creates a screenshot test. */ static create(componentName: string) { return new this(componentName); } private constructor(private readonly componentName: string) { setImmediate(() => { if (!this.ran) { throw new Error("Please call .run()"); } }); } /** * Adds a set of viewports to the screenshot test. */ viewports(viewports: { [name: string]: Viewport }) { for (const [name, viewport] of Object.entries(viewports)) { this.viewport(name, viewport); } return this; } /** * Adds a single viewport to the screenshot test. */ viewport(viewportName: string, viewport: Viewport) { if (this.ran) { throw new Error("Cannot add a viewport after running."); } if (this._viewports[viewportName]) { throw new Error(`Viewport "${viewportName}" is declared more than once`); } this._viewports[viewportName] = viewport; return this; } /** * Adds a specific shot of a component to the screenshot test. */ shoot(shotName: string, component: React.ReactNode) { if (this.ran) { throw new Error("Cannot add a shot after running."); } if (this._shots[shotName]) { throw new Error(`Shot "${shotName}" is declared more than once`); } this._shots[shotName] = component; return this; } remoteStylesheet(stylesheetUrl: string) { this._remoteStylesheetUrls.push(stylesheetUrl); return this; } static(mappedPath: string, dirOrFilePath: string) { if (!mappedPath.startsWith("/")) { throw new Error("Directory mapping path must start with /"); } if (!existsSync(dirOrFilePath)) { throw new Error( `Could not find path "${dirOrFilePath}". Consider using path.resolve() to get an absolute path.` ); } if (this._staticPaths[mappedPath]) { throw new Error("Cannot map multiple directories to the same path"); } this._staticPaths[mappedPath] = dirOrFilePath; return this; } /** * Runs the actual test (delegating to Jest). */ run() { if (this.ran) { throw new Error("Cannot run more than once."); } this.ran = true; if (Object.keys(this._viewports).length === 0) { throw new Error("Please define viewports with .viewport()"); } if (Object.keys(this._shots).length === 0) { throw new Error("Please define shots with .shoot()"); } const componentServer = new ReactComponentServer(this._staticPaths); expect.extend({ toMatchImageSnapshot }); beforeAll(async () => { await componentServer.start(); }); afterAll(async () => { await componentServer.stop(); }); const testFilename = callsites()[1].getFileName()!; const snapshotsDir = dirname(testFilename); const prefix = getScreenshotPrefix(); // jest-image-snapshot doesn't support a snapshot identifier such as // "abc/def". Instead, we need some logic to look for a directory // separator (using `sep`) and set the subdirectory to "abc", only using // "def" as the identifier prefix. let subdirectory = ""; let filenamePrefix = ""; if (prefix.indexOf(sep) > -1) { [subdirectory, filenamePrefix] = prefix.split(sep, 2); } else { filenamePrefix = prefix; } describe(this.componentName, () => { for (const [viewportName, viewport] of Object.entries(this._viewports)) { describe(viewportName, () => { for (const [shotName, shot] of Object.entries(this._shots)) { it(shotName, async () => { const name = `${this.componentName} - ${viewportName} - ${shotName}`; logDebug( `Requesting component server to generate screenshot: ${name}` ); const screenshot = await componentServer.serve( { name, reactNode: shot, remoteStylesheetUrls: this._remoteStylesheetUrls, }, async (port, path) => { const url = SCREENSHOT_MODE === "docker" ? `http://host.docker.internal:${port}${path}` : `http://localhost:${port}${path}`; return this.render(name, url, viewport); } ); logDebug(`Screenshot generated.`); if (screenshot) { logDebug(`Comparing screenshot.`); expect(screenshot).toMatchImageSnapshot({ customSnapshotsDir: join( snapshotsDir, "__screenshots__", this.componentName, subdirectory ), customSnapshotIdentifier: `${filenamePrefix}${viewportName} - ${shotName}`, }); logDebug(`Screenshot compared.`); } else { logDebug(`Skipping screenshot matching.`); } }); } }); } }); } private async render(name: string, url: string, viewport: Viewport) { try { logDebug( `Initiating request to screenshot server at ${SCREENSHOT_SERVER_URL}.` ); const response = await fetch(`${SCREENSHOT_SERVER_URL}/render`, "POST", { name, url, viewport, }); logDebug(`Response received with status code ${response.status}.`); if (response.status === 204) { return null; } return response.body; } catch (e) { // eslint-disable-next-line no-console console.error( chalk.red( `Unable to reach screenshot server. Please make sure that your Jest configuration contains the following: { "globalSetup": "react-screenshot-test/global-setup", "globalTeardown": "react-screenshot-test/global-teardown" } ` ) ); throw e; } } }
{ "pile_set_name": "Github" }
using System.Collections.Generic; namespace ETEditor { public class RsyncConfig { public string Host = ""; public string Account = ""; public string Password = ""; public string RelativePath = ""; public List<string> Exclude = new List<string>(); } }
{ "pile_set_name": "Github" }
/** * Copyright 2016 Yahoo Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ 'use strict'; var config = require('../../config/config.js')(); var dateFormatter = new Intl.DateTimeFormat(config.language, { year: 'numeric', month: 'numeric', day: 'numeric', hour: 'numeric', minute: 'numeric', hour12: false, timeZone: config.timeZone, timeZoneName: 'short' }); module.exports = { formatDate: function(timeStamp) { return timeStamp ? dateFormatter.format(timeStamp) : ''; } };
{ "pile_set_name": "Github" }
# Copyright (c) 2016 Claudiu Popa <pcmanticore@gmail.com> # Licensed under the LGPL: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html # For details: https://github.com/PyCQA/astroid/blob/master/COPYING.LESSER import sys import astroid from astroid import exceptions PY34 = sys.version_info >= (3, 4) def _multiprocessing_transform(): module = astroid.parse(''' from multiprocessing.managers import SyncManager def Manager(): return SyncManager() ''') if not PY34: return module # On Python 3.4, multiprocessing uses a getattr lookup inside contexts, # in order to get the attributes they need. Since it's extremely # dynamic, we use this approach to fake it. node = astroid.parse(''' from multiprocessing.context import DefaultContext, BaseContext default = DefaultContext() base = BaseContext() ''') try: context = next(node['default'].infer()) base = next(node['base'].infer()) except exceptions.InferenceError: return module for node in (context, base): for key, value in node.locals.items(): if key.startswith("_"): continue value = value[0] if isinstance(value, astroid.FunctionDef): # We need to rebound this, since otherwise # it will have an extra argument (self). value = astroid.BoundMethod(value, node) module[key] = value return module def _multiprocessing_managers_transform(): return astroid.parse(''' import array import threading import multiprocessing.pool as pool import six class Namespace(object): pass class Value(object): def __init__(self, typecode, value, lock=True): self._typecode = typecode self._value = value def get(self): return self._value def set(self, value): self._value = value def __repr__(self): return '%s(%r, %r)'%(type(self).__name__, self._typecode, self._value) value = property(get, set) def Array(typecode, sequence, lock=True): return array.array(typecode, sequence) class SyncManager(object): Queue = JoinableQueue = six.moves.queue.Queue Event = threading.Event RLock = threading.RLock BoundedSemaphore = threading.BoundedSemaphore Condition = threading.Condition Barrier = threading.Barrier Pool = pool.Pool list = list dict = dict Value = Value Array = Array Namespace = Namespace __enter__ = lambda self: self __exit__ = lambda *args: args def start(self, initializer=None, initargs=None): pass def shutdown(self): pass ''') astroid.register_module_extender(astroid.MANAGER, 'multiprocessing.managers', _multiprocessing_managers_transform) astroid.register_module_extender(astroid.MANAGER, 'multiprocessing', _multiprocessing_transform)
{ "pile_set_name": "Github" }
# Generated by Django 1.11.23 on 2019-09-14 22:09 from django.db import migrations DISCARDED_LOCALES = ( "af", "az", "cs", "ee", "ff", "fy-NL", "ga-IE", "ha", "hr", "ig", "ka", "ln", "mg", "ml", "ro", "son", "sq", "sr", "sr-Latn", "sw", "ta", "te", "tl", "tn", "wo", "xh", "yo", "zu", ) def update_users_with_discarded_locales(apps, schema_editor): """ Blank the preferred locale of all users with one of the DISCARDED_LOCALES. """ User = apps.get_model("users", "User") User.objects.filter(locale__in=DISCARDED_LOCALES).update(locale="") class Migration(migrations.Migration): dependencies = [ ("users", "0011_auto_20190914_2208"), ] operations = [ migrations.RunPython(update_users_with_discarded_locales), ]
{ "pile_set_name": "Github" }
 using Sandbox.Common.ObjectBuilders; using Sandbox.Definitions; using Sandbox.Game.Entities.Character; using Sandbox.Game.Gui; using Sandbox.Game.Localization; using Sandbox.Game.Multiplayer; using Sandbox.Game.World; using Sandbox.Graphics; using Sandbox.Graphics.GUI; using System; using System.Collections.Generic; using System.Linq; using System.Text; using VRage; using VRage; using VRage.Game; using VRage.Input; using VRage.Library.Utils; using VRage.Utils; using VRage.Utils; using VRageMath; namespace Sandbox.Game.Screens { public delegate void MyWardrobeChangeDelegate(string prevModel, Vector3 prevColorMask, string newModel, Vector3 newColorMask); public class MyGuiScreenWardrobe : MyGuiScreenBase { public static event MyWardrobeChangeDelegate LookChanged; private const string m_hueScaleTexture = "Textures\\GUI\\HueScale.png"; private MyGuiControlCombobox m_modelPicker; private MyGuiControlSlider m_sliderHue; private MyGuiControlSlider m_sliderSaturation; private MyGuiControlSlider m_sliderValue; private MyGuiControlLabel m_labelHue; private MyGuiControlLabel m_labelSaturation; private MyGuiControlLabel m_labelValue; private string m_selectedModel; private Vector3 m_selectedHSV; private MyCharacter m_user; private Dictionary<string, int> m_displayModels; private Dictionary<int, string> m_models; private string m_storedModel; private Vector3 m_storedHSV; private MyCameraControllerSettings m_storedCamera; private bool m_colorOrModelChanged; public MyGuiScreenWardrobe(MyCharacter user, HashSet<string> customCharacterNames = null) : base(size: new Vector2(0.31f, 0.55f), position: MyGuiManager.ComputeFullscreenGuiCoordinate(MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP), backgroundColor: MyGuiConstants.SCREEN_BACKGROUND_COLOR, backgroundTexture: MyGuiConstants.TEXTURE_SCREEN_BACKGROUND.Texture) { EnabledBackgroundFade = false; m_user = user; m_storedModel = m_user.ModelName; m_storedHSV = m_user.ColorMask; m_selectedModel = GetDisplayName(m_user.ModelName); m_selectedHSV = m_storedHSV; m_displayModels = new Dictionary<string, int>(); m_models = new Dictionary<int, string>(); int i = 0; if (customCharacterNames == null) { foreach (var character in MyDefinitionManager.Static.Characters) { // NPCs can't be played with while in survival mode if (MySession.Static.SurvivalMode && !character.UsableByPlayer) continue; if (!character.Public) continue; var key = GetDisplayName(character.Name); m_displayModels[key] = i; m_models[i++] = character.Name; } } else { var definedCharacters = MyDefinitionManager.Static.Characters; foreach (var characterName in customCharacterNames) { MyCharacterDefinition definition; // NPCs can't be played with while in survival mode if (!definedCharacters.TryGetValue(characterName, out definition) || MySession.Static.SurvivalMode && !definition.UsableByPlayer) continue; if (!definition.Public) continue; var key = GetDisplayName(definition.Name); m_displayModels[key] = i; m_models[i++] = definition.Name; } } RecreateControls(true); m_sliderHue.Value = m_selectedHSV.X * 360f; m_sliderSaturation.Value = m_selectedHSV.Y * 100f; m_sliderValue.Value = m_selectedHSV.Z * 100f; m_sliderHue.ValueChanged += OnValueChange; m_sliderSaturation.ValueChanged += OnValueChange; m_sliderValue.ValueChanged += OnValueChange; ChangeCamera(); UpdateLabels(); } private string GetDisplayName(string name) { //MyStringId tmp = MyStringId.GetOrCompute(name); //string result; //if (!MyTexts.TryGet(tmp, out result)) // result = name; //return name; return MyTexts.GetString(name); } public override string GetFriendlyName() { return "MyGuiScreenWardrobe"; } public override void HandleInput(bool receivedFocusInThisUpdate) { if (MyInput.Static.IsNewGameControlPressed(MyControlsSpace.USE)) { ChangeCameraBack(); CloseScreen(); } base.HandleInput(receivedFocusInThisUpdate); } public override void RecreateControls(bool constructor) { base.RecreateControls(constructor); var caption = AddCaption(MyCommonTexts.PlayerCharacterModel); var listSize = MyGuiControlListbox.GetVisualStyle(MyGuiControlListboxStyleEnum.Default).ItemSize; //m_modelPicker = new MyGuiControlCombobox(position: new Vector2(0f, -0.18f)); float currY = -0.19f; m_modelPicker = new MyGuiControlCombobox(position: new Vector2(0f, currY)); foreach (var entry in m_displayModels) m_modelPicker.AddItem(entry.Value, new StringBuilder(entry.Key)); if (m_displayModels.ContainsKey(m_selectedModel)) m_modelPicker.SelectItemByKey(m_displayModels[m_selectedModel]); else if (m_displayModels.Count > 0) m_modelPicker.SelectItemByKey(m_displayModels.First().Value); else System.Diagnostics.Debug.Fail("No character models loaded."); m_modelPicker.ItemSelected += OnItemSelected; currY += 0.045f; var positionOffset = listSize + caption.Size; m_position.X -= (positionOffset.X / 2.5f); m_position.Y += (positionOffset.Y * 3.6f); Controls.Add(new MyGuiControlLabel(position: new Vector2(0f, currY), text: MyTexts.GetString(MyCommonTexts.PlayerCharacterColor), originAlign: MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER)); currY += 0.04f; Controls.Add( new MyGuiControlLabel(position: new Vector2(-0.135f, currY), text: "Hue:", originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); m_labelHue = new MyGuiControlLabel(position: new Vector2(0.090f, currY), text: String.Empty, originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER); currY += 0.035f; m_sliderHue = new MyGuiControlSlider( position: new Vector2(-0.135f, currY), width: 0.3f, minValue: 0, maxValue: 360, labelDecimalPlaces: 0, labelSpaceWidth: 50 / 1200f, intValue: true, originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER, visualStyle: MyGuiControlSliderStyleEnum.Hue ); currY += 0.045f; Controls.Add(new MyGuiControlLabel(position: new Vector2(-0.135f, currY), text: "Saturation:", originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); m_labelSaturation = new MyGuiControlLabel(position: new Vector2(0.09f, currY), text: String.Empty, originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER); currY += 0.035f; m_sliderSaturation = new MyGuiControlSlider( position: new Vector2(-0.135f, currY), width: 0.3f, minValue: -100, maxValue: 100, defaultValue: 0, labelDecimalPlaces: 0, labelSpaceWidth: 50 / 1200f, intValue: true, originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER ); currY += 0.045f; Controls.Add(new MyGuiControlLabel(position: new Vector2(-0.135f, currY), text: "Value:", originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER)); m_labelValue = new MyGuiControlLabel(position: new Vector2(0.09f, currY), text: String.Empty, originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER); currY += 0.035f; m_sliderValue = new MyGuiControlSlider( position: new Vector2(-0.135f, currY), width: 0.3f, minValue: -100, maxValue: 100, defaultValue: 0, labelDecimalPlaces: 0, labelSpaceWidth: 50 / 1200f, intValue: true, originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER ); currY += 0.045f; Controls.Add(caption); Controls.Add(m_modelPicker); Controls.Add(m_labelHue); Controls.Add(m_labelSaturation); Controls.Add(m_labelValue); Controls.Add(m_sliderHue); Controls.Add(m_sliderSaturation); Controls.Add(m_sliderValue); Controls.Add(new MyGuiControlButton(position: new Vector2(0f, 0.16f), text: new StringBuilder("OK"), onButtonClick: OnOkClick)); Controls.Add(new MyGuiControlButton(position: new Vector2(0f, 0.22f), text: new StringBuilder("Cancel"), onButtonClick: OnCancelClick)); m_colorOrModelChanged = false; } protected override void Canceling() { m_sliderHue.ValueChanged -= OnValueChange; m_sliderSaturation.ValueChanged -= OnValueChange; m_sliderValue.ValueChanged -= OnValueChange; ChangeCharacter(m_storedModel, m_storedHSV); ChangeCameraBack(); base.Canceling(); } protected override void OnClosed() { m_sliderHue.ValueChanged -= OnValueChange; m_sliderSaturation.ValueChanged -= OnValueChange; m_sliderValue.ValueChanged -= OnValueChange; MyGuiScreenGamePlay.ActiveGameplayScreen = null; base.OnClosed(); } private void OnOkClick(MyGuiControlButton sender) { if(m_colorOrModelChanged && LookChanged != null) LookChanged(m_storedModel, m_storedHSV, m_user.ModelName, m_user.ColorMask); ChangeCameraBack(); CloseScreenNow(); } private void OnCancelClick(MyGuiControlButton sender) { ChangeCharacter(m_storedModel, m_storedHSV); ChangeCameraBack(); CloseScreenNow(); } private void OnItemSelected() { m_selectedModel = m_models[(int)m_modelPicker.GetSelectedKey()]; ChangeCharacter(m_selectedModel, m_selectedHSV); } private void OnValueChange(MyGuiControlSlider sender) { UpdateLabels(); m_selectedHSV.X = m_sliderHue.Value / 360f; m_selectedHSV.Y = m_sliderSaturation.Value / 100f; m_selectedHSV.Z = m_sliderValue.Value / 100f; m_selectedModel = m_models[(int)m_modelPicker.GetSelectedKey()]; ChangeCharacter(m_selectedModel, m_selectedHSV); } private void UpdateLabels() { m_labelHue.Text = m_sliderHue.Value.ToString() + "°"; m_labelSaturation.Text = m_sliderSaturation.Value.ToString(); m_labelValue.Text = m_sliderValue.Value.ToString(); } private void ChangeCamera() { if (MySession.Static.Settings.Enable3rdPersonView) { m_storedCamera.Controller = MySession.Static.GetCameraControllerEnum(); m_storedCamera.Distance = MySession.Static.GetCameraTargetDistance(); MySession.Static.SetCameraController(MyCameraControllerEnum.ThirdPersonSpectator); MySession.Static.SetCameraTargetDistance(2f); } } private void ChangeCameraBack() { if (MySession.Static.Settings.Enable3rdPersonView) { MySession.Static.SetCameraController(m_storedCamera.Controller, m_user); MySession.Static.SetCameraTargetDistance(m_storedCamera.Distance); } } private void ChangeCharacter(string model, Vector3 colorMaskHSV) { m_colorOrModelChanged = true; m_user.ChangeModelAndColor(model, colorMaskHSV); } } }
{ "pile_set_name": "Github" }
Manifest-Version: 1.0 Class-Path:
{ "pile_set_name": "Github" }
<?php /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */ /** * This file is part of A2Billing (http://www.a2billing.net/) * * A2Billing, Commercial Open Source Telecom Billing platform, * powered by Star2billing S.L. <http://www.star2billing.com/> * * @copyright Copyright (C) 2004-2012 - Star2billing S.L. * @author Belaid Arezqui <areski@gmail.com> * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html * @package A2Billing * * Software License Agreement (GNU Affero General Public License) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * * **/ if (! has_rights (ACX_ACCESS)) { Header ("HTTP/1.0 401 Unauthorized"); Header ("Location: PP_error.php?c=accessdenied"); die(); } getpost_ifset(array('id', 'billingtype', 'did', 'startingdate', 'expirationdate', 'id_cc_didgroup', 'id_cc_country', 'activated', 'fixrate', 'id_trunk', 'choose_country', 'choose_did', 'assign', 'countrycode', 'arecode', 'phonenumber', 'voip_call', 'destination', 'choose_did_rate', 'new_did_page', 'confirm_buy_did', 'action_release')); $HD_Form = new FormHandler("cc_did_destination","destination"); $HD_Form -> FG_DEBUG = 0; $HD_Form -> FG_TABLE_DEFAULT_ORDER = "did"; $HD_Form -> FG_TABLE_DEFAULT_SENS = "DESC"; $HD_Form -> FG_EDITION = true; $HD_Form -> FG_DELETION = true; $HD_Form -> FG_ADDITION = true; $cnts = new Constants(); $actived_list = $cnts->getActivationList(); $billingtype_list = $cnts->getBillingTypeList(); // -- billtype: 0 = fix per month + dialoutrate, 1= fix per month, 2 = dialoutrate, 3 = free $billingtype_list_short = $cnts->getBillingTypeShortList(); $priority_list = array(); for ($k=1;$k<=5;$k++) { $priority_list["$k"] = array( "Priority : $k", "$k"); } $actived_list = array(); $actived_list["1"] = array( gettext("Active"), "1"); $actived_list["0"] = array( gettext("Inactive"), "0"); $validated_list = array(); $validated_list["0"] = array( gettext("Pending"), "0"); $validated_list["1"] = array( gettext("Validated"), "1"); $HD_Form -> AddViewElement(gettext("DESTINATION"), "destination", "20%", "center", "sort"); $HD_Form -> AddViewElement(gettext("DID"), "id_cc_did", "15%", "center", "sort", "15", "lie", "cc_did", "did", "id='%id'", "%1"); $HD_Form -> AddViewElement(gettext("ACTIVATED"), "t1.activated", "10%", "center", "sort", "", "list", $actived_list); $HD_Form -> AddViewElement(gettext("PRIORITY"), "priority", "10%", "center", "sort", "", "list", $priority_list); $HD_Form -> AddViewElement(gettext("USED MINUTE"), "t1.secondusedreal", "10%", "center", "SORT", "30", "", "", "", "", "", "display_minute"); $HD_Form -> AddViewElement(gettext("COUNTRY"), "id_cc_country", "15%", "center", "sort", "15", "lie", "cc_country", "countryname", "id='%id'", "%1"); $HD_Form -> AddViewElement(gettext("VALIDATED"), "validated", "10%", "center", "sort", "", "list", $validated_list); if (isset($form_action) && ($form_action=='ask-edit' || $form_action=='edit')) { $HD_Form -> FG_TABLE_NAME = "cc_did_destination AS t1"; $country_field = ''; $validated = 1; if ($voip_call == 1) { // It's a Voip Call $DBHandle_max = DbConnect(); $numrow = 0; $resmax = $DBHandle_max -> Execute("SELECT * FROM cc_did_destination WHERE id='$id' AND destination='$destination' AND validated=1"); if ( $resmax ) $numrow = $resmax -> RecordCount( ); $validated = ($numrow == 1) ? 1 : 0; if ($validated) NotificationsDAO::AddNotification("did_destination_edited_cust", Notification::$LOW, Notification::$CUST, $_SESSION['card_id'], Notification::$LINK_DID_DESTINATION, $id); //$HD_Form->_processed['destination'] = intval($destination); } else { // It's not a Voip call, check if we don't try to inject $destination = (intval($destination) > 0) ? $destination : 'no valid'; //echo "Validity check ($destination)"; } } else { $HD_Form -> FG_TABLE_NAME = "cc_did_destination AS t1, cc_did AS t2"; $HD_Form -> FG_TABLE_CLAUSE = " id_cc_card='".$_SESSION["card_id"]."' AND t1.id_cc_did=t2.id"; $country_field = ' id_cc_country,'; $validated = 0; } $HD_Form -> FG_COL_QUERY = 'destination, id_cc_did, t1.activated, priority, t1.secondusedreal,'. $country_field .' t1.validated, t1.id '; $HD_Form -> CV_NO_FIELDS = gettext("There are no destinations created"); $HD_Form -> CV_DISPLAY_LINE_TITLE_ABOVE_TABLE = false; $HD_Form -> CV_TEXT_TITLE_ABOVE_TABLE = ''; $HD_Form -> CV_DISPLAY_FILTER_ABOVE_TABLE = false; $HD_Form -> FG_EDITION = true; $HD_Form -> FG_DELETION = true; $HD_Form -> FG_VIEW_TABLE_WITDH = '80%'; if (isset($form_action) && ($form_action=='ask-edit')) { $HD_Form -> AddEditElement (gettext("DESTINATION"), "destination", '$value', "INPUT", "size=50 maxlength=120", "0", "Insert the Destination", "" , "", "", "", "" , "", "", gettext("Enter here the phonenumber you want to call or the SIP/IAX/H323 peer to reach (ie: 347894999 or SIP/jeremy@182.212.1.45). To call SIP/IAX/H323 peer, you need to enable the voip_call below (voip_call = Yes) ")); } $HD_Form -> AddEditElement (gettext("ACTIVATED"), "activated", '1', "RADIOBUTTON", "", "", gettext("Choose if you want to activate this card"), "" , "", "", "Yes :1, - No:0", "", "" , "", ""); $HD_Form -> AddEditElement (gettext("PRIORITY"), "priority", "", "SELECT", "", "", "", "list" , "", "", "", $priority_list, "%1" , "" , ""); $HD_Form -> AddEditElement (gettext("VOIP_CALL"), "voip_call", '1', "RADIOBUTTON", "", "", gettext("Choose if you want to not use the trunk and let the asterisk call directly the destination (ie, Destination : SIP/jeremy@182.212.1.45)"), "" , "", "", "Yes :1, - No:0", "", "" , "" , ""); if (isset($form_action) && ($form_action=='ask-edit')) { $HD_Form -> FieldEditElement ('destination, activated, priority, voip_call'); } else { $HD_Form -> FG_QUERY_EDITION_HIDDEN_FIELDS = "destination, validated"; $HD_Form -> FG_QUERY_EDITION_HIDDEN_VALUE = "$destination, $validated"; } $HD_Form -> FG_INTRO_TEXT_EDITION= ''; $HD_Form -> FG_INTRO_TEXT_ASK_DELETION = gettext("If you really want remove this")." ".$HD_Form->FG_INSTANCE_NAME.", ".gettext("click on the delete button."); $HD_Form -> FG_INTRO_TEXT_ADD = gettext("you can add easily a new")." ".$HD_Form->FG_INSTANCE_NAME.".<br>".gettext("Fill the following fields and confirm by clicking on the button add."); $HD_Form -> FG_INTRO_TEXT_ADITION = ''; $HD_Form -> FG_TEXT_ADITION_CONFIRMATION = gettext("Your new")." ".$HD_Form->FG_INSTANCE_NAME." ".gettext("has been inserted.")."<br>"; $HD_Form -> FG_BUTTON_EDITION_SRC = $HD_Form -> FG_BUTTON_ADITION_SRC = Images_Path."/cormfirmboton.gif"; $HD_Form -> FG_BUTTON_EDITION_BOTTOM_TEXT = $HD_Form -> FG_BUTTON_ADITION_BOTTOM_TEXT = gettext("Setup those values to create or edit the ")." ".$HD_Form->FG_INSTANCE_NAME; $HD_Form -> FG_GO_LINK_AFTER_ACTION_ADD = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; $HD_Form -> FG_GO_LINK_AFTER_ACTION_EDIT = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id="; $HD_Form -> FG_GO_LINK_AFTER_ACTION_DELETE = filter_input(INPUT_SERVER, 'PHP_SELF', FILTER_SANITIZE_URL)."?atmenu=document&stitle=Document&wh=AC&id=";
{ "pile_set_name": "Github" }
package com.effective.android.panel.interfaces /** * -------------------- * | PanelSwitchLayout | * | ---------------- | * | | | | * | |ContentContainer| | * | | | | * | ---------------- | * | ---------------- | * | | PanelContainer | | * | ---------------- | * -------------------- * There are some rules that must be processed: * * 1. [com.effective.android.panel.view.PanelSwitchLayout] must have only two children * [com.effective.android.panel.view.content.IContentContainer] and [com.effective.android.panel.view.PanelContainer] * * 2. [com.effective.android.panel.view.content.IContentContainer] must set "edit_view" value to provide [android.widget.EditText] * * 3. [com.effective.android.panel.view.PanelContainer] has some Children that are [com.effective.android.panel.view.PanelView] * [com.effective.android.panel.view.PanelView] must set "panel_layout" value to provide panelView and set "panel_trigger" value to * specify layout for click to checkout panelView * * Created by yummyLau on 18-7-10 * Email: yummyl.lau@gmail.com * blog: yummylau.com */ interface ViewAssertion { fun assertView() }
{ "pile_set_name": "Github" }
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "CTPolicyEnforcer.h" #include <algorithm> #include <stdint.h> #include <stdio.h> #include "CTLogVerifier.h" #include "CTVerifyResult.h" #include "SignedCertificateTimestamp.h" #include "gtest/gtest.h" #include "hasht.h" #include "prtime.h" // Implemented in CertVerifier.cpp. extern mozilla::pkix::Result GetCertLifetimeInFullMonths(PRTime certNotBefore, PRTime certNotAfter, size_t& months); namespace mozilla { namespace ct { using namespace mozilla::pkix; class CTPolicyEnforcerTest : public ::testing::Test { public: void SetUp() override { OPERATORS_1_AND_2.push_back(OPERATOR_1); OPERATORS_1_AND_2.push_back(OPERATOR_2); } void GetLogId(Buffer& logId, size_t logNo) { logId.resize(SHA256_LENGTH); std::fill(logId.begin(), logId.end(), 0); // Just raw-copy |logId| into the output buffer. assert(sizeof(logNo) <= logId.size()); memcpy(logId.data(), &logNo, sizeof(logNo)); } void AddSct(VerifiedSCTList& verifiedScts, size_t logNo, CTLogOperatorId operatorId, VerifiedSCT::Origin origin, uint64_t timestamp, VerifiedSCT::Status status = VerifiedSCT::Status::Valid) { VerifiedSCT verifiedSct; verifiedSct.status = status; verifiedSct.origin = origin; verifiedSct.logOperatorId = operatorId; verifiedSct.logDisqualificationTime = status == VerifiedSCT::Status::ValidFromDisqualifiedLog ? DISQUALIFIED_AT : UINT64_MAX; verifiedSct.sct.version = SignedCertificateTimestamp::Version::V1; verifiedSct.sct.timestamp = timestamp; Buffer logId; GetLogId(logId, logNo); verifiedSct.sct.logId = std::move(logId); verifiedScts.push_back(std::move(verifiedSct)); } void AddMultipleScts( VerifiedSCTList& verifiedScts, size_t logsCount, uint8_t operatorsCount, VerifiedSCT::Origin origin, uint64_t timestamp, VerifiedSCT::Status status = VerifiedSCT::Status::Valid) { for (size_t logNo = 0; logNo < logsCount; logNo++) { CTLogOperatorId operatorId = logNo % operatorsCount; AddSct(verifiedScts, logNo, operatorId, origin, timestamp, status); } } void CheckCompliance(const VerifiedSCTList& verifiedSct, size_t certLifetimeInCalendarMonths, const CTLogOperatorList& dependentLogOperators, CTPolicyCompliance expectedCompliance) { CTPolicyCompliance compliance; mPolicyEnforcer.CheckCompliance(verifiedSct, certLifetimeInCalendarMonths, dependentLogOperators, compliance); EXPECT_EQ(expectedCompliance, compliance); } protected: CTPolicyEnforcer mPolicyEnforcer; const size_t LOG_1 = 1; const size_t LOG_2 = 2; const size_t LOG_3 = 3; const size_t LOG_4 = 4; const size_t LOG_5 = 5; const CTLogOperatorId OPERATOR_1 = 1; const CTLogOperatorId OPERATOR_2 = 2; const CTLogOperatorId OPERATOR_3 = 3; CTLogOperatorList NO_OPERATORS; CTLogOperatorList OPERATORS_1_AND_2; const VerifiedSCT::Origin ORIGIN_EMBEDDED = VerifiedSCT::Origin::Embedded; const VerifiedSCT::Origin ORIGIN_TLS = VerifiedSCT::Origin::TLSExtension; const VerifiedSCT::Origin ORIGIN_OCSP = VerifiedSCT::Origin::OCSPResponse; // 4 years of cert lifetime requires 5 SCTs for the embedded case. const size_t DEFAULT_MONTHS = 4 * 12L; // Date.parse("2015-08-15T00:00:00Z") const uint64_t TIMESTAMP_1 = 1439596800000L; // Date.parse("2016-04-15T00:00:00Z") const uint64_t DISQUALIFIED_AT = 1460678400000L; // Date.parse("2016-04-01T00:00:00Z") const uint64_t BEFORE_DISQUALIFIED = 1459468800000L; // Date.parse("2016-04-16T00:00:00Z") const uint64_t AFTER_DISQUALIFIED = 1460764800000L; }; TEST_F(CTPolicyEnforcerTest, ConformsToCTPolicyWithNonEmbeddedSCTs) { VerifiedSCTList scts; AddSct(scts, LOG_1, OPERATOR_1, ORIGIN_TLS, TIMESTAMP_1); AddSct(scts, LOG_2, OPERATOR_2, ORIGIN_TLS, TIMESTAMP_1); CheckCompliance(scts, DEFAULT_MONTHS, NO_OPERATORS, CTPolicyCompliance::Compliant); } TEST_F(CTPolicyEnforcerTest, DoesNotConformNotEnoughDiverseNonEmbeddedSCTs) { VerifiedSCTList scts; AddSct(scts, LOG_1, OPERATOR_1, ORIGIN_TLS, TIMESTAMP_1); AddSct(scts, LOG_2, OPERATOR_2, ORIGIN_TLS, TIMESTAMP_1); CheckCompliance(scts, DEFAULT_MONTHS, OPERATORS_1_AND_2, CTPolicyCompliance::NotDiverseScts); } TEST_F(CTPolicyEnforcerTest, ConformsToCTPolicyWithEmbeddedSCTs) { VerifiedSCTList scts; // 5 embedded SCTs required for DEFAULT_MONTHS. AddSct(scts, LOG_1, OPERATOR_1, ORIGIN_EMBEDDED, TIMESTAMP_1); AddSct(scts, LOG_2, OPERATOR_1, ORIGIN_EMBEDDED, TIMESTAMP_1); AddSct(scts, LOG_3, OPERATOR_1, ORIGIN_EMBEDDED, TIMESTAMP_1); AddSct(scts, LOG_4, OPERATOR_1, ORIGIN_EMBEDDED, TIMESTAMP_1); AddSct(scts, LOG_5, OPERATOR_2, ORIGIN_EMBEDDED, TIMESTAMP_1); CheckCompliance(scts, DEFAULT_MONTHS, NO_OPERATORS, CTPolicyCompliance::Compliant); } TEST_F(CTPolicyEnforcerTest, DoesNotConformNotEnoughDiverseEmbeddedSCTs) { VerifiedSCTList scts; // 5 embedded SCTs required for DEFAULT_MONTHS. AddSct(scts, LOG_1, OPERATOR_1, ORIGIN_EMBEDDED, TIMESTAMP_1); AddSct(scts, LOG_2, OPERATOR_1, ORIGIN_EMBEDDED, TIMESTAMP_1); AddSct(scts, LOG_3, OPERATOR_1, ORIGIN_EMBEDDED, TIMESTAMP_1); AddSct(scts, LOG_4, OPERATOR_1, ORIGIN_EMBEDDED, TIMESTAMP_1); AddSct(scts, LOG_5, OPERATOR_2, ORIGIN_EMBEDDED, TIMESTAMP_1); CheckCompliance(scts, DEFAULT_MONTHS, OPERATORS_1_AND_2, CTPolicyCompliance::NotDiverseScts); } TEST_F(CTPolicyEnforcerTest, ConformsToCTPolicyWithPooledNonEmbeddedSCTs) { VerifiedSCTList scts; AddSct(scts, LOG_1, OPERATOR_1, ORIGIN_OCSP, TIMESTAMP_1); AddSct(scts, LOG_2, OPERATOR_2, ORIGIN_TLS, TIMESTAMP_1); CheckCompliance(scts, DEFAULT_MONTHS, NO_OPERATORS, CTPolicyCompliance::Compliant); } TEST_F(CTPolicyEnforcerTest, ConformsToCTPolicyWithPooledEmbeddedSCTs) { VerifiedSCTList scts; AddSct(scts, LOG_1, OPERATOR_1, ORIGIN_EMBEDDED, TIMESTAMP_1); AddSct(scts, LOG_2, OPERATOR_2, ORIGIN_OCSP, TIMESTAMP_1); CheckCompliance(scts, DEFAULT_MONTHS, NO_OPERATORS, CTPolicyCompliance::Compliant); } TEST_F(CTPolicyEnforcerTest, DoesNotConformToCTPolicyNotEnoughSCTs) { VerifiedSCTList scts; AddSct(scts, LOG_1, OPERATOR_1, ORIGIN_EMBEDDED, TIMESTAMP_1); AddSct(scts, LOG_2, OPERATOR_2, ORIGIN_EMBEDDED, TIMESTAMP_1); CheckCompliance(scts, DEFAULT_MONTHS, NO_OPERATORS, CTPolicyCompliance::NotEnoughScts); } TEST_F(CTPolicyEnforcerTest, DoesNotConformToCTPolicyNotEnoughFreshSCTs) { VerifiedSCTList scts; // The results should be the same before and after disqualification, // regardless of the delivery method. // SCT from before disqualification. scts.clear(); AddSct(scts, LOG_1, OPERATOR_1, ORIGIN_TLS, TIMESTAMP_1); AddSct(scts, LOG_2, OPERATOR_2, ORIGIN_TLS, BEFORE_DISQUALIFIED, VerifiedSCT::Status::ValidFromDisqualifiedLog); CheckCompliance(scts, DEFAULT_MONTHS, NO_OPERATORS, CTPolicyCompliance::NotEnoughScts); // SCT from after disqualification. scts.clear(); AddSct(scts, LOG_1, OPERATOR_1, ORIGIN_TLS, TIMESTAMP_1); AddSct(scts, LOG_2, OPERATOR_2, ORIGIN_TLS, AFTER_DISQUALIFIED, VerifiedSCT::Status::ValidFromDisqualifiedLog); CheckCompliance(scts, DEFAULT_MONTHS, NO_OPERATORS, CTPolicyCompliance::NotEnoughScts); // Embedded SCT from before disqualification. scts.clear(); AddSct(scts, LOG_1, OPERATOR_1, ORIGIN_TLS, TIMESTAMP_1); AddSct(scts, LOG_2, OPERATOR_2, ORIGIN_EMBEDDED, BEFORE_DISQUALIFIED, VerifiedSCT::Status::ValidFromDisqualifiedLog); CheckCompliance(scts, DEFAULT_MONTHS, NO_OPERATORS, CTPolicyCompliance::NotEnoughScts); // Embedded SCT from after disqualification. scts.clear(); AddSct(scts, LOG_1, OPERATOR_1, ORIGIN_TLS, TIMESTAMP_1); AddSct(scts, LOG_2, OPERATOR_2, ORIGIN_EMBEDDED, AFTER_DISQUALIFIED, VerifiedSCT::Status::ValidFromDisqualifiedLog); CheckCompliance(scts, DEFAULT_MONTHS, NO_OPERATORS, CTPolicyCompliance::NotEnoughScts); } TEST_F(CTPolicyEnforcerTest, ConformsWithDisqualifiedLogBeforeDisqualificationDate) { VerifiedSCTList scts; // 5 embedded SCTs required for DEFAULT_MONTHS. AddSct(scts, LOG_1, OPERATOR_1, ORIGIN_EMBEDDED, TIMESTAMP_1); AddSct(scts, LOG_2, OPERATOR_1, ORIGIN_EMBEDDED, TIMESTAMP_1); AddSct(scts, LOG_3, OPERATOR_1, ORIGIN_EMBEDDED, TIMESTAMP_1); AddSct(scts, LOG_4, OPERATOR_1, ORIGIN_EMBEDDED, TIMESTAMP_1); AddSct(scts, LOG_5, OPERATOR_2, ORIGIN_EMBEDDED, BEFORE_DISQUALIFIED, VerifiedSCT::Status::ValidFromDisqualifiedLog); CheckCompliance(scts, DEFAULT_MONTHS, NO_OPERATORS, CTPolicyCompliance::Compliant); } TEST_F(CTPolicyEnforcerTest, DoesNotConformWithDisqualifiedLogAfterDisqualificationDate) { VerifiedSCTList scts; // 5 embedded SCTs required for DEFAULT_MONTHS. AddSct(scts, LOG_1, OPERATOR_1, ORIGIN_EMBEDDED, TIMESTAMP_1); AddSct(scts, LOG_2, OPERATOR_1, ORIGIN_EMBEDDED, TIMESTAMP_1); AddSct(scts, LOG_3, OPERATOR_1, ORIGIN_EMBEDDED, TIMESTAMP_1); AddSct(scts, LOG_4, OPERATOR_1, ORIGIN_EMBEDDED, TIMESTAMP_1); AddSct(scts, LOG_5, OPERATOR_2, ORIGIN_EMBEDDED, AFTER_DISQUALIFIED, VerifiedSCT::Status::ValidFromDisqualifiedLog); CheckCompliance(scts, DEFAULT_MONTHS, NO_OPERATORS, CTPolicyCompliance::NotEnoughScts); } TEST_F(CTPolicyEnforcerTest, DoesNotConformWithIssuanceDateAfterDisqualificationDate) { VerifiedSCTList scts; // 5 embedded SCTs required for DEFAULT_MONTHS. AddSct(scts, LOG_1, OPERATOR_1, ORIGIN_EMBEDDED, AFTER_DISQUALIFIED, VerifiedSCT::Status::ValidFromDisqualifiedLog); AddSct(scts, LOG_2, OPERATOR_1, ORIGIN_EMBEDDED, AFTER_DISQUALIFIED); AddSct(scts, LOG_3, OPERATOR_1, ORIGIN_EMBEDDED, AFTER_DISQUALIFIED); AddSct(scts, LOG_4, OPERATOR_1, ORIGIN_EMBEDDED, AFTER_DISQUALIFIED); AddSct(scts, LOG_5, OPERATOR_2, ORIGIN_EMBEDDED, AFTER_DISQUALIFIED); CheckCompliance(scts, DEFAULT_MONTHS, NO_OPERATORS, CTPolicyCompliance::NotEnoughScts); } TEST_F(CTPolicyEnforcerTest, DoesNotConformToCTPolicyNotEnoughUniqueEmbeddedLogs) { VerifiedSCTList scts; // Operator #1 AddSct(scts, LOG_1, OPERATOR_1, ORIGIN_EMBEDDED, TIMESTAMP_1); // Operator #2, different logs AddSct(scts, LOG_2, OPERATOR_2, ORIGIN_EMBEDDED, TIMESTAMP_1); AddSct(scts, LOG_3, OPERATOR_2, ORIGIN_EMBEDDED, TIMESTAMP_1); // Operator #3, same log AddSct(scts, LOG_4, OPERATOR_3, ORIGIN_EMBEDDED, TIMESTAMP_1); AddSct(scts, LOG_4, OPERATOR_3, ORIGIN_EMBEDDED, TIMESTAMP_1); // 5 embedded SCTs required. However, only 4 are from distinct logs. CheckCompliance(scts, DEFAULT_MONTHS, NO_OPERATORS, CTPolicyCompliance::NotEnoughScts); } TEST_F(CTPolicyEnforcerTest, ConformsToPolicyExactNumberOfSCTsForValidityPeriod) { // Test multiple validity periods. const struct TestData { size_t certLifetimeInCalendarMonths; size_t sctsRequired; } kTestData[] = {{3, 2}, {12 + 2, 2}, {12 + 3, 3}, {2 * 12 + 2, 3}, {2 * 12 + 3, 4}, {3 * 12 + 2, 4}, {3 * 12 + 4, 5}}; for (size_t i = 0; i < MOZILLA_CT_ARRAY_LENGTH(kTestData); ++i) { SCOPED_TRACE(i); size_t months = kTestData[i].certLifetimeInCalendarMonths; size_t sctsRequired = kTestData[i].sctsRequired; // Less SCTs than required is not enough. for (size_t sctsAvailable = 0; sctsAvailable < sctsRequired; ++sctsAvailable) { VerifiedSCTList scts; AddMultipleScts(scts, sctsAvailable, 1, ORIGIN_EMBEDDED, TIMESTAMP_1); CTPolicyCompliance compliance; mPolicyEnforcer.CheckCompliance(scts, months, NO_OPERATORS, compliance); EXPECT_EQ(CTPolicyCompliance::NotEnoughScts, compliance) << "i=" << i << " sctsRequired=" << sctsRequired << " sctsAvailable=" << sctsAvailable; } // Add exactly the required number of SCTs (from 2 operators). VerifiedSCTList scts; AddMultipleScts(scts, sctsRequired, 2, ORIGIN_EMBEDDED, TIMESTAMP_1); CTPolicyCompliance compliance; mPolicyEnforcer.CheckCompliance(scts, months, NO_OPERATORS, compliance); EXPECT_EQ(CTPolicyCompliance::Compliant, compliance) << "i=" << i; } } TEST_F(CTPolicyEnforcerTest, TestEdgeCasesOfGetCertLifetimeInFullMonths) { const struct TestData { PRTime notBefore; PRTime notAfter; size_t expectedMonths; } kTestData[] = { { // 1 second less than 1 month 1424863500000000, // Date.parse("2015-02-25T11:25:00Z") * 1000 1427196299000000, // Date.parse("2015-03-24T11:24:59Z") * 1000 0}, { // exactly 1 month 1424863500000000, // Date.parse("2015-02-25T11:25:00Z") * 1000 1427282700000000, // Date.parse("2015-03-25T11:25:00Z") * 1000 1}, { // 1 year, 1 month 1427282700000000, // Date.parse("2015-03-25T11:25:00Z") * 1000 1461583500000000, // Date.parse("2016-04-25T11:25:00Z") * 1000 13}, {// 1 year, 1 month, first day of notBefore month, last of notAfter 1425209100000000, // Date.parse("2015-03-01T11:25:00Z") * 1000 1462015500000000, // Date.parse("2016-04-30T11:25:00Z") * 1000 13}, {// 1 year, adjacent months, last day of notBefore month, first of // notAfter 1427801100000000, // Date.parse("2015-03-31T11:25:00Z") * 1000 1459509900000000, // Date.parse("2016-04-01T11:25:00Z") * 1000 12}}; for (size_t i = 0; i < MOZILLA_CT_ARRAY_LENGTH(kTestData); ++i) { SCOPED_TRACE(i); size_t months; ASSERT_EQ(Success, GetCertLifetimeInFullMonths(kTestData[i].notBefore, kTestData[i].notAfter, months)) << "i=" << i; EXPECT_EQ(kTestData[i].expectedMonths, months) << "i=" << i; } } } // namespace ct } // namespace mozilla
{ "pile_set_name": "Github" }
config { type: "assertion", tags: ["tag1", "tag2"] } select * from ${ref({ schema: "df_integration_test", name: "sample_data" })} where sample = 100
{ "pile_set_name": "Github" }
/* * Copyright (C) 2018 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.server.power.batterysaver; import static org.junit.Assert.assertEquals; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyInt; import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.reset; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import android.metrics.LogMaker; import androidx.test.filters.SmallTest; import androidx.test.runner.AndroidJUnit4; import com.android.internal.logging.MetricsLogger; import com.android.server.power.batterysaver.BatterySavingStats.BatterySaverState; import com.android.server.power.batterysaver.BatterySavingStats.DozeState; import com.android.server.power.batterysaver.BatterySavingStats.InteractiveState; import org.junit.Test; import org.junit.runner.RunWith; import java.io.ByteArrayOutputStream; import java.io.PrintWriter; /** atest $ANDROID_BUILD_TOP/frameworks/base/services/tests/servicestests/src/com/android/server/power/batterysaver/BatterySavingStatsTest.java */ @SmallTest @RunWith(AndroidJUnit4.class) public class BatterySavingStatsTest { private class BatterySavingStatsTestable extends BatterySavingStats { private long mTime = 1_000_000; // Some random starting time. private int mBatteryLevel = 1_000_000_000; private BatterySavingStatsTestable() { super(new Object()); } @Override long injectCurrentTime() { return mTime; } @Override int injectBatteryLevel() { return mBatteryLevel; } @Override int injectBatteryPercent() { return mBatteryLevel / 10; } void assertDumpable() { final ByteArrayOutputStream out = new ByteArrayOutputStream(); dump(new PrintWriter(out), ""); // Just make sure it won't crash. } void advanceClock(int minutes) { mTime += 60_000 * minutes; } void drainBattery(int value) { mBatteryLevel -= value; if (mBatteryLevel < 0) { mBatteryLevel = 0; } } String toDebugString() { final StringBuilder sb = new StringBuilder(); String sep = ""; for (int i = 0; i < mStats.size(); i++) { sb.append(sep); sb.append(stateToString(mStats.keyAt(i))); sb.append(":"); sb.append(mStats.valueAt(i).toStringForTest()); sep = "\n"; } return sb.toString(); } } public MetricsLogger mMetricsLogger = mock(MetricsLogger.class); @Test public void testAll() { checkAll(); } private void checkAll() { final BatterySavingStatsTestable target = new BatterySavingStatsTestable(); target.assertDumpable(); target.advanceClock(1); target.drainBattery(200); target.transitionState( BatterySaverState.OFF, InteractiveState.INTERACTIVE, DozeState.NOT_DOZING); target.advanceClock(4); target.drainBattery(100); target.transitionState( BatterySaverState.OFF, InteractiveState.NON_INTERACTIVE, DozeState.NOT_DOZING); target.advanceClock(2); target.drainBattery(500); target.transitionState( BatterySaverState.OFF, InteractiveState.INTERACTIVE, DozeState.NOT_DOZING); target.advanceClock(4); target.drainBattery(100); target.transitionState( BatterySaverState.OFF, InteractiveState.NON_INTERACTIVE, DozeState.NOT_DOZING); target.advanceClock(2); target.drainBattery(500); target.transitionState( BatterySaverState.OFF, InteractiveState.INTERACTIVE, DozeState.NOT_DOZING); target.advanceClock(3); target.drainBattery(100); target.transitionState( BatterySaverState.OFF, InteractiveState.NON_INTERACTIVE, DozeState.LIGHT); target.advanceClock(5); target.drainBattery(100); target.transitionState( BatterySaverState.OFF, InteractiveState.NON_INTERACTIVE, DozeState.DEEP); target.advanceClock(1); target.drainBattery(200); target.transitionState( BatterySaverState.ON, InteractiveState.INTERACTIVE, DozeState.NOT_DOZING); target.advanceClock(1); target.drainBattery(300); target.transitionState( BatterySaverState.OFF, InteractiveState.INTERACTIVE, DozeState.NOT_DOZING); target.advanceClock(3); target.drainBattery(500); target.transitionState( BatterySaverState.ON, InteractiveState.INTERACTIVE, DozeState.NOT_DOZING); target.advanceClock(3); target.drainBattery(500); target.startCharging(); target.advanceClock(5); target.drainBattery(1000); target.transitionState( BatterySaverState.ON, InteractiveState.INTERACTIVE, DozeState.NOT_DOZING); target.advanceClock(5); target.drainBattery(100); target.startCharging(); target.assertDumpable(); assertEquals( "BS=0,I=0,D=0:{4m,1000,15000.00uA/H,1500.00%}\n" + "BS=1,I=0,D=0:{0m,0,0.00uA/H,0.00%}\n" + "BS=0,I=1,D=0:{14m,800,3428.57uA/H,342.86%}\n" + "BS=1,I=1,D=0:{9m,900,6000.00uA/H,600.00%}\n" + "BS=0,I=0,D=1:{5m,100,1200.00uA/H,120.00%}\n" + "BS=1,I=0,D=1:{0m,0,0.00uA/H,0.00%}\n" + "BS=0,I=1,D=1:{0m,0,0.00uA/H,0.00%}\n" + "BS=1,I=1,D=1:{0m,0,0.00uA/H,0.00%}\n" + "BS=0,I=0,D=2:{1m,200,12000.00uA/H,1200.00%}\n" + "BS=1,I=0,D=2:{0m,0,0.00uA/H,0.00%}\n" + "BS=0,I=1,D=2:{0m,0,0.00uA/H,0.00%}\n" + "BS=1,I=1,D=2:{0m,0,0.00uA/H,0.00%}", target.toDebugString()); } private void assertLog() { verify(mMetricsLogger, times(0)).write(any(LogMaker.class)); } @Test public void testMetricsLogger() { final BatterySavingStatsTestable target = new BatterySavingStatsTestable(); target.advanceClock(1); target.drainBattery(1000); target.transitionState( BatterySaverState.OFF, InteractiveState.INTERACTIVE, DozeState.NOT_DOZING); verify(mMetricsLogger, times(0)).count(anyString(), anyInt()); target.advanceClock(1); target.drainBattery(2000); reset(mMetricsLogger); target.transitionState( BatterySaverState.OFF, InteractiveState.NON_INTERACTIVE, DozeState.NOT_DOZING); assertLog(); target.advanceClock(1); target.drainBattery(2000); reset(mMetricsLogger); target.transitionState( BatterySaverState.OFF, InteractiveState.NON_INTERACTIVE, DozeState.DEEP); target.advanceClock(1); target.drainBattery(2000); verify(mMetricsLogger, times(0)).count(anyString(), anyInt()); target.transitionState( BatterySaverState.OFF, InteractiveState.NON_INTERACTIVE, DozeState.LIGHT); target.advanceClock(1); target.drainBattery(2000); verify(mMetricsLogger, times(0)).count(anyString(), anyInt()); target.transitionState( BatterySaverState.ON, InteractiveState.INTERACTIVE, DozeState.NOT_DOZING); assertLog(); target.advanceClock(10); target.drainBattery(10000); reset(mMetricsLogger); target.startCharging(); assertLog(); target.advanceClock(1); target.drainBattery(2000); reset(mMetricsLogger); target.transitionState( BatterySaverState.ON, InteractiveState.NON_INTERACTIVE, DozeState.NOT_DOZING); verify(mMetricsLogger, times(0)).count(anyString(), anyInt()); target.advanceClock(1); target.drainBattery(2000); target.startCharging(); assertLog(); } }
{ "pile_set_name": "Github" }
#!/bin/sh echo "Enter password" read trythis while [ "$trythis" != "secret" ]; do echo "Sorry, try again" read trythis done exit 0
{ "pile_set_name": "Github" }
#kaocha/v1 {:tests [{:id :inside-is :test-paths ["fixtures/d-tests"] :kaocha.filter/focus [ddd.foo-test/test-3]} {:id :outside-is :test-paths ["fixtures/d-tests"] :ns-patterns [""] :kaocha.filter/focus [ddd.exception-outside-is]}]}
{ "pile_set_name": "Github" }
# # Copyright 2019 The FATE Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # import hashlib from federatedml.framework.homo.blocks.base import HomoTransferBase from federatedml.util import consts class UUIDTransVar(HomoTransferBase): def __init__(self, server=(consts.ARBITER,), clients=(consts.GUEST, consts.HOST), prefix=None): super().__init__(server=server, clients=clients, prefix=prefix) self.uuid = self.create_server_to_client_variable(name="uuid") class Server(object): def __init__(self, trans_var: UUIDTransVar = UUIDTransVar()): self._uuid_transfer = trans_var.uuid self._uuid_set = set() self._ind = -1 self.client_parties = trans_var.client_parties # noinspection PyUnusedLocal @staticmethod def generate_id(ind, *args, **kwargs): return hashlib.md5(f"{ind}".encode("ascii")).hexdigest() def _next_uuid(self): while True: self._ind += 1 uid = Server.generate_id(self._ind) if uid in self._uuid_set: continue self._uuid_set.add(uid) return uid def validate_uuid(self): for party in self.client_parties: uid = self._next_uuid() self._uuid_transfer.remote_parties(obj=uid, parties=[party]) class Client(object): def __init__(self, trans_var: UUIDTransVar = UUIDTransVar()): self._uuid_variable = trans_var.uuid self._server_parties = trans_var.server_parties def generate_uuid(self): uid = self._uuid_variable.get_parties(parties=self._server_parties)[0] return uid
{ "pile_set_name": "Github" }
<?php /** * Authorize.net gateway transaction class. */ class Gateway_Authorizenet_Transaction extends Gateway_Core_Transaction { /** * Authorize.Net's transaction status associations. * * @see https://support.authorize.net/authkb/index?page=content&id=A136 * * @var array */ public $statuses = array( 'capturedPendingSettlement' => 'paid', 'pendingSettlement' => 'paid', 'settledSuccessfully' => 'paid', 'declined' => 'declined', 'refundPendingSettlement' => 'refunded', 'refundSettledSuccessfully' => 'refunded', ); /** * Finds a single instance. * * @param int|array $options Instance identifier or filter data. * * @return array|null */ public function find_one($options = array()) { if (is_numeric($options)) { $transaction_id = $options; } $request = new AuthorizeNetTD(); $response = $request->getTransactionDetails($transaction_id); if (!$response->isOk()) { Log::error('Unable to retrieve Authorize.net transaction.'); return false; } $transaction = $response->xml->transaction; return array( 'id' => $transaction_id, 'amount' => $transaction->authAmount, 'status' => Arr::get($this->statuses, $transaction->transactionStatus, 'error'), ); } /** * Creates a new instance. * * @param $data New instance data. * * @return bool */ public function create(array $data) { $customer_gateway_id = Service_Customer_Gateway::external_id($this->driver->customer, $this->driver->gateway); if (!$customer_gateway_id) { return false; } if (!$payment_method = Arr::get($data, 'payment_method')) { return false; } if (!$amount = Arr::get($data, 'amount')) { return false; } $request = new AuthorizeNetCIM(); $transaction = new AuthorizeNetTransaction(); $transaction->amount = $amount; $transaction->customerProfileId = $customer_gateway_id; $transaction->customerPaymentProfileId = $payment_method->external_id; // AuthOnly or AuthCapture $response = $request->createCustomerProfileTransaction('AuthCapture', $transaction); if (!$response->isOk()) { Log::error('Unable to create Authorize.net transaction.'); return false; } $response = $response->getTransactionResponse(); if (empty($response->transaction_id)) { return false; } return $response->transaction_id; } /** * Updates an existing instance. * * @param array $data Updated instance data. * * @return bool */ public function update(array $data) {} /** * Deletes an existing instance. * * @return bool */ public function delete() {} }
{ "pile_set_name": "Github" }
--- layout: base title: 'Statistics of ADJ in UD_Czech-PDT' udver: '2' --- ## Treebank Statistics: UD_Czech-PDT: POS Tags: `ADJ` There are 14826 `ADJ` lemmas (25%), 40175 `ADJ` types (31%) and 189186 `ADJ` tokens (13%). Out of 17 observed tags, the rank of `ADJ` is: 3 in number of lemmas, 1 in number of types and 3 in number of tokens. The 10 most frequent `ADJ` lemmas: <em>český, velký, nový, další, první, jiný, druhý, vysoký, dobrý, celý</em> The 10 most frequent `ADJ` types: <em>první, další, české, nové, druhé, poslední, státní, dalších, možné, vlastní</em> The 10 most frequent ambiguous lemmas: <em>velký</em> (<tt><a href="cs_pdt-pos-ADJ.html">ADJ</a></tt> 2468, <tt><a href="cs_pdt-pos-ADV.html">ADV</a></tt> 1), <em>obchodní</em> (<tt><a href="cs_pdt-pos-ADJ.html">ADJ</a></tt> 588, <tt><a href="cs_pdt-pos-ADV.html">ADV</a></tt> 1), <em>starý</em> (<tt><a href="cs_pdt-pos-ADJ.html">ADJ</a></tt> 567, <tt><a href="cs_pdt-pos-NOUN.html">NOUN</a></tt> 5), <em>známý</em> (<tt><a href="cs_pdt-pos-ADJ.html">ADJ</a></tt> 560, <tt><a href="cs_pdt-pos-NOUN.html">NOUN</a></tt> 21), <em>domácí</em> (<tt><a href="cs_pdt-pos-ADJ.html">ADJ</a></tt> 515, <tt><a href="cs_pdt-pos-NOUN.html">NOUN</a></tt> 5), <em>mladý</em> (<tt><a href="cs_pdt-pos-ADJ.html">ADJ</a></tt> 443, <tt><a href="cs_pdt-pos-NOUN.html">NOUN</a></tt> 3), <em>třeba</em> (<tt><a href="cs_pdt-pos-ADJ.html">ADJ</a></tt> 409, <tt><a href="cs_pdt-pos-ADV.html">ADV</a></tt> 404), <em>blízký</em> (<tt><a href="cs_pdt-pos-ADJ.html">ADJ</a></tt> 314, <tt><a href="cs_pdt-pos-NOUN.html">NOUN</a></tt> 2), <em>vedoucí</em> (<tt><a href="cs_pdt-pos-ADJ.html">ADJ</a></tt> 156, <tt><a href="cs_pdt-pos-NOUN.html">NOUN</a></tt> 145), <em>spolkový</em> (<tt><a href="cs_pdt-pos-ADJ.html">ADJ</a></tt> 117, <tt><a href="cs_pdt-pos-NOUN.html">NOUN</a></tt> 1) The 10 most frequent ambiguous types: <em>vlastní</em> (<tt><a href="cs_pdt-pos-ADJ.html">ADJ</a></tt> 464, <tt><a href="cs_pdt-pos-VERB.html">VERB</a></tt> 76), <em>třeba</em> (<tt><a href="cs_pdt-pos-ADJ.html">ADJ</a></tt> 408, <tt><a href="cs_pdt-pos-ADV.html">ADV</a></tt> 372), <em>hlavní</em> (<tt><a href="cs_pdt-pos-ADJ.html">ADJ</a></tt> 298, <tt><a href="cs_pdt-pos-NOUN.html">NOUN</a></tt> 3), <em>tzv</em> (<tt><a href="cs_pdt-pos-ADJ.html">ADJ</a></tt> 359, <tt><a href="cs_pdt-pos-ADV.html">ADV</a></tt> 1), <em>domácí</em> (<tt><a href="cs_pdt-pos-ADJ.html">ADJ</a></tt> 230, <tt><a href="cs_pdt-pos-NOUN.html">NOUN</a></tt> 2), <em>dobré</em> (<tt><a href="cs_pdt-pos-ADJ.html">ADJ</a></tt> 211, <tt><a href="cs_pdt-pos-NOUN.html">NOUN</a></tt> 1), <em>vysoké</em> (<tt><a href="cs_pdt-pos-ADJ.html">ADJ</a></tt> 190, <tt><a href="cs_pdt-pos-NOUN.html">NOUN</a></tt> 1), <em>a</em> (<tt><a href="cs_pdt-pos-CCONJ.html">CCONJ</a></tt> 31068, <tt><a href="cs_pdt-pos-ADJ.html">ADJ</a></tt> 183, <tt><a href="cs_pdt-pos-NOUN.html">NOUN</a></tt> 49, <tt><a href="cs_pdt-pos-ADP.html">ADP</a></tt> 7), <em>lepší</em> (<tt><a href="cs_pdt-pos-ADJ.html">ADJ</a></tt> 169, <tt><a href="cs_pdt-pos-VERB.html">VERB</a></tt> 2), <em>o</em> (<tt><a href="cs_pdt-pos-ADP.html">ADP</a></tt> 9669, <tt><a href="cs_pdt-pos-ADJ.html">ADJ</a></tt> 110, <tt><a href="cs_pdt-pos-PUNCT.html">PUNCT</a></tt> 99, <tt><a href="cs_pdt-pos-NOUN.html">NOUN</a></tt> 4) * <em>vlastní</em> * <tt><a href="cs_pdt-pos-ADJ.html">ADJ</a></tt> 464: <em>Stavět <b>vlastní</b> výtopnu je prozatím patrně risk</em> * <tt><a href="cs_pdt-pos-VERB.html">VERB</a></tt> 76: <em>IPB v současné době přímo <b>vlastní</b> 45 procent akcií Premiéry TV .</em> * <em>třeba</em> * <tt><a href="cs_pdt-pos-ADJ.html">ADJ</a></tt> 408: <em>Změny jsou citelné , je <b>třeba</b> je lépe prezentovat</em> * <tt><a href="cs_pdt-pos-ADV.html">ADV</a></tt> 372: <em>Několikrát denně jsem telefonoval po celé Kanadě , ale <b>třeba</b> i do ČR .</em> * <em>hlavní</em> * <tt><a href="cs_pdt-pos-ADJ.html">ADJ</a></tt> 298: <em>Zatím je vyprodána celá <b>hlavní</b> tribuna s 3200 místy .</em> * <tt><a href="cs_pdt-pos-NOUN.html">NOUN</a></tt> 3: <em>Někdo přece musel vydat rozkaz střílet do davů a z něčích <b>hlavní</b> ty smrtící náboje vyšly .</em> * <em>tzv</em> * <tt><a href="cs_pdt-pos-ADJ.html">ADJ</a></tt> 359: <em>Notář v tomto řízení vystupuje jako <b>tzv</b> . soudní komisař .</em> * <tt><a href="cs_pdt-pos-ADV.html">ADV</a></tt> 1: <em>D . Kolářová : Tím , že není dostatečná legislativa , začala zoufalá kalvárie , mnozí majitelé se chovají <b>tzv</b> . tržně , to však znamená , že v praxi jednají podle zásady " co není zakázáno , je dovoleno " a pak vzniká morální džungle .</em> * <em>domácí</em> * <tt><a href="cs_pdt-pos-ADJ.html">ADJ</a></tt> 230: <em>Objevili <b>domácí</b> trh</em> * <tt><a href="cs_pdt-pos-NOUN.html">NOUN</a></tt> 2: <em>Za rozhodující moment považuji , že jsme za stavu 4 : 3 pro <b>domácí</b> nevyrovnali na 4 : 4 .</em> * <em>dobré</em> * <tt><a href="cs_pdt-pos-ADJ.html">ADJ</a></tt> 211: <em>Přesto není dosud výběr <b>dobré</b> a spolehlivé cestovky nijak jednoduchý .</em> * <tt><a href="cs_pdt-pos-NOUN.html">NOUN</a></tt> 1: <em>Stálí zákazníci , o jejichž solidnosti a <b>dobré</b> platební morálce se Kofa přesvědčila , mohou objednávat zboží i na fakturu .</em> * <em>vysoké</em> * <tt><a href="cs_pdt-pos-ADJ.html">ADJ</a></tt> 190: <em>Katalogy jsou na <b>vysoké</b> profesionální úrovni .</em> * <tt><a href="cs_pdt-pos-NOUN.html">NOUN</a></tt> 1: <em>Svou roli hrály i nízké mzdové náklady při současné <b>vysoké</b> kvalifikaci pracovní síly .</em> * <em>a</em> * <tt><a href="cs_pdt-pos-CCONJ.html">CCONJ</a></tt> 31068: <em>Zvedněte telefon <b>a</b> zavolejte .</em> * <tt><a href="cs_pdt-pos-ADJ.html">ADJ</a></tt> 183: <em><b>a</b> . s . Malostranské nám . 2 118 00 Praha 1 Tel . / fax : 684 62 55</em> * <tt><a href="cs_pdt-pos-NOUN.html">NOUN</a></tt> 49: <em>Ušetříte téměř 90 % proti variantě <b>a</b> ) .</em> * <tt><a href="cs_pdt-pos-ADP.html">ADP</a></tt> 7: <em>" Všichni chtěli kopírovat trend <b>a</b> la Boris Korbel , kdy se do přestupů vrážely obrovské částky , a projevuje se to dodnes , " dodává manažer FC Boby Brno .</em> * <em>lepší</em> * <tt><a href="cs_pdt-pos-ADJ.html">ADJ</a></tt> 169: <em>Izolace <b>lepší</b> než měření</em> * <tt><a href="cs_pdt-pos-VERB.html">VERB</a></tt> 2: <em>V jednotce se <b>lepší</b> nálada : " Porazíme je . "</em> * <em>o</em> * <tt><a href="cs_pdt-pos-ADP.html">ADP</a></tt> 9669: <em>Hodnota thajského vývozu se každým rokem zvyšuje <b>o</b> více než 12 % .</em> * <tt><a href="cs_pdt-pos-ADJ.html">ADJ</a></tt> 110: <em>Monet , spol . s r . <b>o</b> .</em> * <tt><a href="cs_pdt-pos-PUNCT.html">PUNCT</a></tt> 99: <em>UKRAJINA CHCE CHRÁNIT SVŮJ TRH <b>o</b></em> * <tt><a href="cs_pdt-pos-NOUN.html">NOUN</a></tt> 4: <em>Vítězem se stal britský boxer Benn , který vyhrál k . <b>o</b> . v desátém kole .</em> ## Morphology The form / lemma ratio of `ADJ` is 2.709767 (the average of all parts of speech is 2.181762). The 1st highest number of forms (32) was observed with the lemma “známý”: <em>nejznámější, nejznámějších, nejznámějším, neznáma, neznámo, neznámou, neznámá, neznámé, neznámého, neznámém, neznámí, neznámý, neznámých, neznámým, neznámými, znám, známa, známi, známo, známou, známy, známá, známé, známého, známém, známému, známí, známý, známých, známým, známými, známější</em>. The 2nd highest number of forms (31) was observed with the lemma “dobrý”: <em>Dobrú, dobrou, dobrá, dobré, dobrého, dobrém, dobrému, dobrý, dobrých, dobrým, dobrými, dobří, lepší, lepších, lepšího, lepším, lepšími, lepšímu, nedobrou, nedobrá, nedobré, nedobrého, nedobrý, nedobrých, nejlepší, nejlepších, nejlepšího, nejlepším, nejlepšími, nejlepšímu, nelepší</em>. The 3rd highest number of forms (31) was observed with the lemma “velký”: <em>největší, největších, největšího, největším, největšími, největšímu, nevelkou, nevelká, nevelké, nevelkého, nevelký, nevelkých, nevelkým, nevelkými, velcí, velkou, velká, velké, velkého, velkém, velkému, velký, velkých, velkým, velkými, větší, větších, většího, větším, většími, většímu</em>. `ADJ` occurs with 20 features: <tt><a href="cs_pdt-feat-Number.html">Number</a></tt> (184589; 98% instances), <tt><a href="cs_pdt-feat-Gender.html">Gender</a></tt> (184566; 98% instances), <tt><a href="cs_pdt-feat-Polarity.html">Polarity</a></tt> (181484; 96% instances), <tt><a href="cs_pdt-feat-Case.html">Case</a></tt> (173090; 91% instances), <tt><a href="cs_pdt-feat-Degree.html">Degree</a></tt> (165171; 87% instances), <tt><a href="cs_pdt-feat-Animacy.html">Animacy</a></tt> (75523; 40% instances), <tt><a href="cs_pdt-feat-VerbForm.html">VerbForm</a></tt> (14024; 7% instances), <tt><a href="cs_pdt-feat-Voice.html">Voice</a></tt> (14024; 7% instances), <tt><a href="cs_pdt-feat-Variant.html">Variant</a></tt> (11414; 6% instances), <tt><a href="cs_pdt-feat-Aspect.html">Aspect</a></tt> (9991; 5% instances), <tt><a href="cs_pdt-feat-NumType.html">NumType</a></tt> (4990; 3% instances), <tt><a href="cs_pdt-feat-NameType.html">NameType</a></tt> (4756; 3% instances), <tt><a href="cs_pdt-feat-Tense.html">Tense</a></tt> (4498; 2% instances), <tt><a href="cs_pdt-feat-Gender-psor.html">Gender[psor]</a></tt> (2707; 1% instances), <tt><a href="cs_pdt-feat-Poss.html">Poss</a></tt> (2707; 1% instances), <tt><a href="cs_pdt-feat-Foreign.html">Foreign</a></tt> (2670; 1% instances), <tt><a href="cs_pdt-feat-Abbr.html">Abbr</a></tt> (1715; 1% instances), <tt><a href="cs_pdt-feat-Hyph.html">Hyph</a></tt> (398; 0% instances), <tt><a href="cs_pdt-feat-Style.html">Style</a></tt> (172; 0% instances), <tt><a href="cs_pdt-feat-NumValue.html">NumValue</a></tt> (30; 0% instances) `ADJ` occurs with 67 feature-value pairs: `Abbr=Yes`, `Animacy=Anim`, `Animacy=Inan`, `Aspect=Imp`, `Aspect=Perf`, `Case=Acc`, `Case=Dat`, `Case=Gen`, `Case=Ins`, `Case=Loc`, `Case=Nom`, `Case=Voc`, `Degree=Cmp`, `Degree=Pos`, `Degree=Sup`, `Foreign=Yes`, `Gender=Fem`, `Gender=Fem,Masc`, `Gender=Fem,Neut`, `Gender=Masc`, `Gender=Neut`, `Gender[psor]=Fem`, `Gender[psor]=Masc`, `Hyph=Yes`, `NameType=Com`, `NameType=Com,Geo`, `NameType=Com,Giv`, `NameType=Com,Oth`, `NameType=Com,Pro`, `NameType=Com,Pro,Sur`, `NameType=Com,Sur`, `NameType=Geo`, `NameType=Geo,Giv`, `NameType=Geo,Oth`, `NameType=Geo,Pro`, `NameType=Geo,Sur`, `NameType=Giv`, `NameType=Giv,Sur`, `NameType=Nat`, `NameType=Oth`, `NameType=Oth,Sur`, `NameType=Pro`, `NameType=Sur`, `NumType=Mult,Sets`, `NumType=Ord`, `NumType=Sets`, `NumValue=1`, `Number=Dual`, `Number=Plur`, `Number=Plur,Sing`, `Number=Sing`, `Polarity=Neg`, `Polarity=Pos`, `Poss=Yes`, `Style=Arch`, `Style=Coll`, `Style=Expr`, `Style=Rare`, `Style=Slng`, `Style=Vrnc`, `Style=Vulg`, `Tense=Past`, `Tense=Pres`, `Variant=Short`, `VerbForm=Part`, `Voice=Act`, `Voice=Pass` `ADJ` occurs with 849 feature combinations. The most frequent feature combination is `Case=Gen|Degree=Pos|Gender=Fem|Number=Sing|Polarity=Pos` (13446 tokens). Examples: <em>české, evropské, nové, národní, politické, slovenské, státní, světové, celé, velké</em> ## Relations `ADJ` nodes are attached to their parents using 27 different relations: <tt><a href="cs_pdt-dep-amod.html">amod</a></tt> (157720; 83% instances), <tt><a href="cs_pdt-dep-root.html">root</a></tt> (8969; 5% instances), <tt><a href="cs_pdt-dep-conj.html">conj</a></tt> (8838; 5% instances), <tt><a href="cs_pdt-dep-dep.html">dep</a></tt> (1656; 1% instances), <tt><a href="cs_pdt-dep-obj.html">obj</a></tt> (1653; 1% instances), <tt><a href="cs_pdt-dep-xcomp.html">xcomp</a></tt> (1566; 1% instances), <tt><a href="cs_pdt-dep-obl.html">obl</a></tt> (1242; 1% instances), <tt><a href="cs_pdt-dep-ccomp.html">ccomp</a></tt> (1120; 1% instances), <tt><a href="cs_pdt-dep-nsubj.html">nsubj</a></tt> (975; 1% instances), <tt><a href="cs_pdt-dep-acl-relcl.html">acl:relcl</a></tt> (892; 0% instances), <tt><a href="cs_pdt-dep-advcl.html">advcl</a></tt> (807; 0% instances), <tt><a href="cs_pdt-dep-obl-arg.html">obl:arg</a></tt> (748; 0% instances), <tt><a href="cs_pdt-dep-flat-foreign.html">flat:foreign</a></tt> (723; 0% instances), <tt><a href="cs_pdt-dep-nmod.html">nmod</a></tt> (526; 0% instances), <tt><a href="cs_pdt-dep-appos.html">appos</a></tt> (448; 0% instances), <tt><a href="cs_pdt-dep-acl.html">acl</a></tt> (429; 0% instances), <tt><a href="cs_pdt-dep-orphan.html">orphan</a></tt> (289; 0% instances), <tt><a href="cs_pdt-dep-csubj.html">csubj</a></tt> (193; 0% instances), <tt><a href="cs_pdt-dep-parataxis.html">parataxis</a></tt> (151; 0% instances), <tt><a href="cs_pdt-dep-flat.html">flat</a></tt> (93; 0% instances), <tt><a href="cs_pdt-dep-nsubj-pass.html">nsubj:pass</a></tt> (60; 0% instances), <tt><a href="cs_pdt-dep-csubj-pass.html">csubj:pass</a></tt> (37; 0% instances), <tt><a href="cs_pdt-dep-iobj.html">iobj</a></tt> (36; 0% instances), <tt><a href="cs_pdt-dep-fixed.html">fixed</a></tt> (8; 0% instances), <tt><a href="cs_pdt-dep-advmod.html">advmod</a></tt> (3; 0% instances), <tt><a href="cs_pdt-dep-advmod-emph.html">advmod:emph</a></tt> (3; 0% instances), <tt><a href="cs_pdt-dep-vocative.html">vocative</a></tt> (1; 0% instances) Parents of `ADJ` nodes belong to 15 different parts of speech: <tt><a href="cs_pdt-pos-NOUN.html">NOUN</a></tt> (154390; 82% instances), <tt><a href="cs_pdt-pos-VERB.html">VERB</a></tt> (9087; 5% instances), (8969; 5% instances), <tt><a href="cs_pdt-pos-ADJ.html">ADJ</a></tt> (8279; 4% instances), <tt><a href="cs_pdt-pos-PROPN.html">PROPN</a></tt> (5606; 3% instances), <tt><a href="cs_pdt-pos-DET.html">DET</a></tt> (998; 1% instances), <tt><a href="cs_pdt-pos-NUM.html">NUM</a></tt> (861; 0% instances), <tt><a href="cs_pdt-pos-PRON.html">PRON</a></tt> (568; 0% instances), <tt><a href="cs_pdt-pos-ADV.html">ADV</a></tt> (297; 0% instances), <tt><a href="cs_pdt-pos-PART.html">PART</a></tt> (50; 0% instances), <tt><a href="cs_pdt-pos-ADP.html">ADP</a></tt> (43; 0% instances), <tt><a href="cs_pdt-pos-SYM.html">SYM</a></tt> (17; 0% instances), <tt><a href="cs_pdt-pos-CCONJ.html">CCONJ</a></tt> (15; 0% instances), <tt><a href="cs_pdt-pos-INTJ.html">INTJ</a></tt> (3; 0% instances), <tt><a href="cs_pdt-pos-SCONJ.html">SCONJ</a></tt> (3; 0% instances) 141070 (75%) `ADJ` nodes are leaves. 22131 (12%) `ADJ` nodes have one child. 6185 (3%) `ADJ` nodes have two children. 19800 (10%) `ADJ` nodes have three or more children. The highest child degree of a `ADJ` node is 19. Children of `ADJ` nodes are attached using 36 different relations: <tt><a href="cs_pdt-dep-punct.html">punct</a></tt> (26399; 21% instances), <tt><a href="cs_pdt-dep-obl.html">obl</a></tt> (14193; 11% instances), <tt><a href="cs_pdt-dep-advmod.html">advmod</a></tt> (14078; 11% instances), <tt><a href="cs_pdt-dep-cop.html">cop</a></tt> (11576; 9% instances), <tt><a href="cs_pdt-dep-conj.html">conj</a></tt> (8967; 7% instances), <tt><a href="cs_pdt-dep-cc.html">cc</a></tt> (7635; 6% instances), <tt><a href="cs_pdt-dep-nsubj.html">nsubj</a></tt> (7504; 6% instances), <tt><a href="cs_pdt-dep-aux-pass.html">aux:pass</a></tt> (5981; 5% instances), <tt><a href="cs_pdt-dep-obl-arg.html">obl:arg</a></tt> (5325; 4% instances), <tt><a href="cs_pdt-dep-nsubj-pass.html">nsubj:pass</a></tt> (4559; 4% instances), <tt><a href="cs_pdt-dep-mark.html">mark</a></tt> (3694; 3% instances), <tt><a href="cs_pdt-dep-csubj.html">csubj</a></tt> (2086; 2% instances), <tt><a href="cs_pdt-dep-case.html">case</a></tt> (2038; 2% instances), <tt><a href="cs_pdt-dep-advcl.html">advcl</a></tt> (1829; 1% instances), <tt><a href="cs_pdt-dep-flat-foreign.html">flat:foreign</a></tt> (1759; 1% instances), <tt><a href="cs_pdt-dep-advmod-emph.html">advmod:emph</a></tt> (1251; 1% instances), <tt><a href="cs_pdt-dep-aux.html">aux</a></tt> (1013; 1% instances), <tt><a href="cs_pdt-dep-obj.html">obj</a></tt> (986; 1% instances), <tt><a href="cs_pdt-dep-nmod.html">nmod</a></tt> (833; 1% instances), <tt><a href="cs_pdt-dep-xcomp.html">xcomp</a></tt> (824; 1% instances), <tt><a href="cs_pdt-dep-dep.html">dep</a></tt> (820; 1% instances), <tt><a href="cs_pdt-dep-expl-pv.html">expl:pv</a></tt> (537; 0% instances), <tt><a href="cs_pdt-dep-appos.html">appos</a></tt> (473; 0% instances), <tt><a href="cs_pdt-dep-amod.html">amod</a></tt> (371; 0% instances), <tt><a href="cs_pdt-dep-orphan.html">orphan</a></tt> (352; 0% instances), <tt><a href="cs_pdt-dep-nummod.html">nummod</a></tt> (319; 0% instances), <tt><a href="cs_pdt-dep-parataxis.html">parataxis</a></tt> (234; 0% instances), <tt><a href="cs_pdt-dep-ccomp.html">ccomp</a></tt> (232; 0% instances), <tt><a href="cs_pdt-dep-det.html">det</a></tt> (130; 0% instances), <tt><a href="cs_pdt-dep-acl-relcl.html">acl:relcl</a></tt> (122; 0% instances), <tt><a href="cs_pdt-dep-csubj-pass.html">csubj:pass</a></tt> (64; 0% instances), <tt><a href="cs_pdt-dep-flat.html">flat</a></tt> (45; 0% instances), <tt><a href="cs_pdt-dep-discourse.html">discourse</a></tt> (24; 0% instances), <tt><a href="cs_pdt-dep-acl.html">acl</a></tt> (9; 0% instances), <tt><a href="cs_pdt-dep-expl-pass.html">expl:pass</a></tt> (5; 0% instances), <tt><a href="cs_pdt-dep-vocative.html">vocative</a></tt> (3; 0% instances) Children of `ADJ` nodes belong to 16 different parts of speech: <tt><a href="cs_pdt-pos-NOUN.html">NOUN</a></tt> (28504; 23% instances), <tt><a href="cs_pdt-pos-PUNCT.html">PUNCT</a></tt> (26399; 21% instances), <tt><a href="cs_pdt-pos-AUX.html">AUX</a></tt> (18570; 15% instances), <tt><a href="cs_pdt-pos-ADV.html">ADV</a></tt> (15566; 12% instances), <tt><a href="cs_pdt-pos-ADJ.html">ADJ</a></tt> (8279; 7% instances), <tt><a href="cs_pdt-pos-CCONJ.html">CCONJ</a></tt> (7515; 6% instances), <tt><a href="cs_pdt-pos-VERB.html">VERB</a></tt> (6290; 5% instances), <tt><a href="cs_pdt-pos-SCONJ.html">SCONJ</a></tt> (3497; 3% instances), <tt><a href="cs_pdt-pos-PROPN.html">PROPN</a></tt> (3340; 3% instances), <tt><a href="cs_pdt-pos-DET.html">DET</a></tt> (2418; 2% instances), <tt><a href="cs_pdt-pos-ADP.html">ADP</a></tt> (2105; 2% instances), <tt><a href="cs_pdt-pos-PRON.html">PRON</a></tt> (2085; 2% instances), <tt><a href="cs_pdt-pos-NUM.html">NUM</a></tt> (1091; 1% instances), <tt><a href="cs_pdt-pos-PART.html">PART</a></tt> (583; 0% instances), <tt><a href="cs_pdt-pos-SYM.html">SYM</a></tt> (23; 0% instances), <tt><a href="cs_pdt-pos-INTJ.html">INTJ</a></tt> (5; 0% instances)
{ "pile_set_name": "Github" }
<!-- doc/src/sgml/ref/import_foreign_schema.sgml PostgreSQL documentation --> <refentry id="sql-importforeignschema"> <!--==========================orignal english content========================== <indexterm zone="sql-importforeignschema"> <primary>IMPORT FOREIGN SCHEMA</primary> </indexterm> ____________________________________________________________________________--> <indexterm zone="sql-importforeignschema"> <primary>IMPORT FOREIGN SCHEMA</primary> </indexterm> <!--==========================orignal english content========================== <refmeta> <refentrytitle>IMPORT FOREIGN SCHEMA</refentrytitle> <manvolnum>7</manvolnum> <refmiscinfo>SQL - Language Statements</refmiscinfo> </refmeta> ____________________________________________________________________________--> <refmeta> <refentrytitle>IMPORT FOREIGN SCHEMA</refentrytitle> <manvolnum>7</manvolnum> <refmiscinfo>SQL - Language Statements</refmiscinfo> </refmeta> <!--==========================orignal english content========================== <refnamediv> <refname>IMPORT FOREIGN SCHEMA</refname> <refpurpose>import table definitions from a foreign server</refpurpose> </refnamediv> ____________________________________________________________________________--> <refnamediv> <refname>IMPORT FOREIGN SCHEMA</refname> <refpurpose>从一个外部服务器导入表定义</refpurpose> </refnamediv> <refsynopsisdiv> <!--==========================orignal english content========================== <synopsis> IMPORT FOREIGN SCHEMA <replaceable class="parameter">remote_schema</replaceable> [ { LIMIT TO | EXCEPT } ( <replaceable class="parameter">table_name</replaceable> [, ...] ) ] FROM SERVER <replaceable class="parameter">server_name</replaceable> INTO <replaceable class="parameter">local_schema</replaceable> [ OPTIONS ( <replaceable class="parameter">option</replaceable> '<replaceable class="parameter">value</replaceable>' [, ... ] ) ] </synopsis> ____________________________________________________________________________--> <synopsis> IMPORT FOREIGN SCHEMA <replaceable class="parameter">remote_schema</replaceable> [ { LIMIT TO | EXCEPT } ( <replaceable class="parameter">table_name</replaceable> [, ...] ) ] FROM SERVER <replaceable class="parameter">server_name</replaceable> INTO <replaceable class="parameter">local_schema</replaceable> [ OPTIONS ( <replaceable class="parameter">option</replaceable> '<replaceable class="parameter">value</replaceable>' [, ... ] ) ] </synopsis> </refsynopsisdiv> <refsect1 id="sql-importforeignschema-description"> <!--==========================orignal english content========================== <title>Description</title> ____________________________________________________________________________--> <title>简介</title> <!--==========================orignal english content========================== <para> <command>IMPORT FOREIGN SCHEMA</command> creates foreign tables that represent tables existing on a foreign server. The new foreign tables will be owned by the user issuing the command and are created with the correct column definitions and options to match the remote tables. </para> ____________________________________________________________________________--> <para> <command>IMPORT FOREIGN SCHEMA</command>创建表示存在于 外部服务器上的表的外部表。新外部表将由发出该命令的用户所拥有并且用 匹配远程表的正确的列定义和选项创建。 </para> <!--==========================orignal english content========================== <para> By default, all tables and views existing in a particular schema on the foreign server are imported. Optionally, the list of tables can be limited to a specified subset, or specific tables can be excluded. The new foreign tables are all created in the target schema, which must already exist. </para> ____________________________________________________________________________--> <para> 默认情况下,存在于外部服务器上一个特定模式中的所有表和视图都会被导入。 根据需要,表的列表可以被限制到一个指定的子集,或者可以排除特定的表。 新外部表都被创建在一个必须已经存在的目标模式中。 </para> <!--==========================orignal english content========================== <para> To use <command>IMPORT FOREIGN SCHEMA</command>, the user must have <literal>USAGE</literal> privilege on the foreign server, as well as <literal>CREATE</literal> privilege on the target schema. </para> ____________________________________________________________________________--> <para> 要使用<command>IMPORT FOREIGN SCHEMA</command>,用户必 须具有外部服务器上的<literal>USAGE</literal>特权以及在目标模式上的 <literal>CREATE</literal>特权。 </para> </refsect1> <refsect1> <!--==========================orignal english content========================== <title>Parameters</title> ____________________________________________________________________________--> <title>参数</title> <variablelist> <varlistentry> <!--==========================orignal english content========================== <term><replaceable class="parameter">remote_schema</replaceable></term> ____________________________________________________________________________--> <term><replaceable class="parameter">remote_schema</replaceable></term> <listitem> <!--==========================orignal english content========================== <para> The remote schema to import from. The specific meaning of a remote schema depends on the foreign data wrapper in use. </para> ____________________________________________________________________________--> <para> 要从哪个远程模式导入。一个远程模式的特定含义依赖于所使用的外部数据包装器。 </para> </listitem> </varlistentry> <varlistentry> <!--==========================orignal english content========================== <term><literal>LIMIT TO ( <replaceable class="parameter">table_name</replaceable> [, ...] )</literal></term> ____________________________________________________________________________--> <term><literal>LIMIT TO ( <replaceable class="parameter">table_name</replaceable> [, ...] )</literal></term> <listitem> <!--==========================orignal english content========================== <para> Import only foreign tables matching one of the given table names. Other tables existing in the foreign schema will be ignored. </para> ____________________________________________________________________________--> <para> 只导入匹配给定表名之一的外部表。外部模式中其他的表将被忽略。 </para> </listitem> </varlistentry> <varlistentry> <!--==========================orignal english content========================== <term><literal>EXCEPT ( <replaceable class="parameter">table_name</replaceable> [, ...] )</literal></term> ____________________________________________________________________________--> <term><literal>EXCEPT ( <replaceable class="parameter">table_name</replaceable> [, ...] )</literal></term> <listitem> <!--==========================orignal english content========================== <para> Exclude specified foreign tables from the import. All tables existing in the foreign schema will be imported except the ones listed here. </para> ____________________________________________________________________________--> <para> 把指定的外部表排除在导入之外。除了列在这里的表之外,外部模式 中存在的所有表都将被导入。 </para> </listitem> </varlistentry> <varlistentry> <!--==========================orignal english content========================== <term><replaceable class="parameter">server_name</replaceable></term> ____________________________________________________________________________--> <term><replaceable class="parameter">server_name</replaceable></term> <listitem> <!--==========================orignal english content========================== <para> The foreign server to import from. </para> ____________________________________________________________________________--> <para> 要从哪个外部服务器导入。 </para> </listitem> </varlistentry> <varlistentry> <!--==========================orignal english content========================== <term><replaceable class="parameter">local_schema</replaceable></term> ____________________________________________________________________________--> <term><replaceable class="parameter">local_schema</replaceable></term> <listitem> <!--==========================orignal english content========================== <para> The schema in which the imported foreign tables will be created. </para> ____________________________________________________________________________--> <para> 被导入的外部表将创建在其中的模式。 </para> </listitem> </varlistentry> <varlistentry> <!--==========================orignal english content========================== <term><literal>OPTIONS ( <replaceable class="parameter">option</replaceable> '<replaceable class="parameter">value</replaceable>' [, ...] )</literal></term> ____________________________________________________________________________--> <term><literal>OPTIONS ( <replaceable class="parameter">option</replaceable> '<replaceable class="parameter">value</replaceable>' [, ...] )</literal></term> <listitem> <!--==========================orignal english content========================== <para> Options to be used during the import. The allowed option names and values are specific to each foreign data wrapper. </para> ____________________________________________________________________________--> <para> 要在导入期间使用的选项。允许使用的选项名称和值与每一个外部数据包装器 有关。 </para> </listitem> </varlistentry> </variablelist> </refsect1> <refsect1 id="sql-importforeignschema-examples"> <!--==========================orignal english content========================== <title>Examples</title> ____________________________________________________________________________--> <title>示例</title> <!--==========================orignal english content========================== <para> Import table definitions from a remote schema <structname>foreign_films</structname> on server <structname>film_server</structname>, creating the foreign tables in local schema <structname>films</structname>: <programlisting> IMPORT FOREIGN SCHEMA foreign_films FROM SERVER film_server INTO films; </programlisting> </para> ____________________________________________________________________________--> <para> 从服务器<structname>film_server</structname>上的远程模式<structname>foreign_films</structname> 中导入表定义,把外部表创建在本地模式<structname>films</structname>中: <programlisting> IMPORT FOREIGN SCHEMA foreign_films FROM SERVER film_server INTO films; </programlisting> </para> <!--==========================orignal english content========================== <para> As above, but import only the two tables <structname>actors</structname> and <literal>directors</literal> (if they exist): <programlisting> IMPORT FOREIGN SCHEMA foreign_films LIMIT TO (actors, directors) FROM SERVER film_server INTO films; </programlisting></para> ____________________________________________________________________________--> <para> 同上,但是只导入两个表<structname>actors</structname>和 <literal>directors</literal>(如果存在): <programlisting> IMPORT FOREIGN SCHEMA foreign_films LIMIT TO (actors, directors) FROM SERVER film_server INTO films; </programlisting></para> </refsect1> <refsect1 id="sql-importforeignschema-compatibility"> <!--==========================orignal english content========================== <title>Compatibility</title> ____________________________________________________________________________--> <title>兼容性</title> <!--==========================orignal english content========================== <para> The <command>IMPORT FOREIGN SCHEMA</command> command conforms to the <acronym>SQL</acronym> standard, except that the <literal>OPTIONS</literal> clause is a <productname>PostgreSQL</productname> extension. </para> ____________________________________________________________________________--> <para> <command>IMPORT FOREIGN SCHEMA</command>命令符合 <acronym>SQL</acronym>标准,不过<literal>OPTIONS</literal> 子句是一种<productname>PostgreSQL</productname>扩展。 </para> </refsect1> <refsect1> <!--==========================orignal english content========================== <title>See Also</title> ____________________________________________________________________________--> <title>另见</title> <simplelist type="inline"> <member><xref linkend="sql-createforeigntable"/></member> <member><xref linkend="sql-createserver"/></member> </simplelist> </refsect1> </refentry>
{ "pile_set_name": "Github" }
obj-y := core.o obj-$(CONFIG_SH_CLK_CPG) += cpg.o
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="utf-8"?> <layout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto"> <data> <variable name="conversionModel" type="com.weapon.joker.app.message.conversion.ConversionViewModel"/> <import type="me.tatarka.bindingcollectionadapter2.LayoutManagers"/> </data> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <android.support.v7.widget.Toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?actionBarSize" android:background="?colorPrimary" app:title="最近聊天" android:theme="@style/Base.ThemeOverlay.AppCompat.Dark.ActionBar" app:popupTheme="@style/ThemeOverlay.AppCompat.Light"/> <com.weapon.joker.lib.view.pullrefreshload.PullToRefreshRecyclerView android:id="@+id/recyclerView" android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" app:canLoadMore="@{false}" app:canRefresh="@{false}" app:itemBinding="@{conversionModel.singleItem}" app:itemIds="@{conversionModel.itemIds}" app:items="@{conversionModel.items}" app:layoutManager="@{LayoutManagers.linear()}"/> </LinearLayout> </layout>
{ "pile_set_name": "Github" }
package yaml const ( // The size of the input raw buffer. input_raw_buffer_size = 512 // The size of the input buffer. // It should be possible to decode the whole raw buffer. input_buffer_size = input_raw_buffer_size * 3 // The size of the output buffer. output_buffer_size = 128 // The size of the output raw buffer. // It should be possible to encode the whole output buffer. output_raw_buffer_size = (output_buffer_size*2 + 2) // The size of other stacks and queues. initial_stack_size = 16 initial_queue_size = 16 initial_string_size = 16 ) // Check if the character at the specified position is an alphabetical // character, a digit, '_', or '-'. func is_alpha(b []byte, i int) bool { return b[i] >= '0' && b[i] <= '9' || b[i] >= 'A' && b[i] <= 'Z' || b[i] >= 'a' && b[i] <= 'z' || b[i] == '_' || b[i] == '-' } // Check if the character at the specified position is a digit. func is_digit(b []byte, i int) bool { return b[i] >= '0' && b[i] <= '9' } // Get the value of a digit. func as_digit(b []byte, i int) int { return int(b[i]) - '0' } // Check if the character at the specified position is a hex-digit. func is_hex(b []byte, i int) bool { return b[i] >= '0' && b[i] <= '9' || b[i] >= 'A' && b[i] <= 'F' || b[i] >= 'a' && b[i] <= 'f' } // Get the value of a hex-digit. func as_hex(b []byte, i int) int { bi := b[i] if bi >= 'A' && bi <= 'F' { return int(bi) - 'A' + 10 } if bi >= 'a' && bi <= 'f' { return int(bi) - 'a' + 10 } return int(bi) - '0' } // Check if the character is ASCII. func is_ascii(b []byte, i int) bool { return b[i] <= 0x7F } // Check if the character at the start of the buffer can be printed unescaped. func is_printable(b []byte, i int) bool { return ((b[i] == 0x0A) || // . == #x0A (b[i] >= 0x20 && b[i] <= 0x7E) || // #x20 <= . <= #x7E (b[i] == 0xC2 && b[i+1] >= 0xA0) || // #0xA0 <= . <= #xD7FF (b[i] > 0xC2 && b[i] < 0xED) || (b[i] == 0xED && b[i+1] < 0xA0) || (b[i] == 0xEE) || (b[i] == 0xEF && // #xE000 <= . <= #xFFFD !(b[i+1] == 0xBB && b[i+2] == 0xBF) && // && . != #xFEFF !(b[i+1] == 0xBF && (b[i+2] == 0xBE || b[i+2] == 0xBF)))) } // Check if the character at the specified position is NUL. func is_z(b []byte, i int) bool { return b[i] == 0x00 } // Check if the beginning of the buffer is a BOM. func is_bom(b []byte, i int) bool { return b[0] == 0xEF && b[1] == 0xBB && b[2] == 0xBF } // Check if the character at the specified position is space. func is_space(b []byte, i int) bool { return b[i] == ' ' } // Check if the character at the specified position is tab. func is_tab(b []byte, i int) bool { return b[i] == '\t' } // Check if the character at the specified position is blank (space or tab). func is_blank(b []byte, i int) bool { //return is_space(b, i) || is_tab(b, i) return b[i] == ' ' || b[i] == '\t' } // Check if the character at the specified position is a line break. func is_break(b []byte, i int) bool { return (b[i] == '\r' || // CR (#xD) b[i] == '\n' || // LF (#xA) b[i] == 0xC2 && b[i+1] == 0x85 || // NEL (#x85) b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA8 || // LS (#x2028) b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA9) // PS (#x2029) } func is_crlf(b []byte, i int) bool { return b[i] == '\r' && b[i+1] == '\n' } // Check if the character is a line break or NUL. func is_breakz(b []byte, i int) bool { //return is_break(b, i) || is_z(b, i) return ( // is_break: b[i] == '\r' || // CR (#xD) b[i] == '\n' || // LF (#xA) b[i] == 0xC2 && b[i+1] == 0x85 || // NEL (#x85) b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA8 || // LS (#x2028) b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA9 || // PS (#x2029) // is_z: b[i] == 0) } // Check if the character is a line break, space, or NUL. func is_spacez(b []byte, i int) bool { //return is_space(b, i) || is_breakz(b, i) return ( // is_space: b[i] == ' ' || // is_breakz: b[i] == '\r' || // CR (#xD) b[i] == '\n' || // LF (#xA) b[i] == 0xC2 && b[i+1] == 0x85 || // NEL (#x85) b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA8 || // LS (#x2028) b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA9 || // PS (#x2029) b[i] == 0) } // Check if the character is a line break, space, tab, or NUL. func is_blankz(b []byte, i int) bool { //return is_blank(b, i) || is_breakz(b, i) return ( // is_blank: b[i] == ' ' || b[i] == '\t' || // is_breakz: b[i] == '\r' || // CR (#xD) b[i] == '\n' || // LF (#xA) b[i] == 0xC2 && b[i+1] == 0x85 || // NEL (#x85) b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA8 || // LS (#x2028) b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA9 || // PS (#x2029) b[i] == 0) } // Determine the width of the character. func width(b byte) int { // Don't replace these by a switch without first // confirming that it is being inlined. if b&0x80 == 0x00 { return 1 } if b&0xE0 == 0xC0 { return 2 } if b&0xF0 == 0xE0 { return 3 } if b&0xF8 == 0xF0 { return 4 } return 0 }
{ "pile_set_name": "Github" }
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- NewPage --> <html lang="en"> <head> <!-- Generated by javadoc (version 1.7.0_79) on Mon Jun 29 06:45:47 CEST 2015 --> <title>CommandLauncherProxy (Apache Ant API)</title> <meta name="date" content="2015-06-29"> <link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style"> </head> <body> <script type="text/javascript"><!-- if (location.href.indexOf('is-external=true') == -1) { parent.document.title="CommandLauncherProxy (Apache Ant API)"; } //--> </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <!-- ========= START OF TOP NAVBAR ======= --> <div class="topNav"><a name="navbar_top"> <!-- --> </a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../../overview-summary.html">Overview</a></li> <li><a href="package-summary.html">Package</a></li> <li class="navBarCell1Rev">Class</li> <li><a href="package-tree.html">Tree</a></li> <li><a href="../../../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../../../index-all.html">Index</a></li> <li><a href="../../../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li><a href="../../../../../../org/apache/tools/ant/taskdefs/launcher/CommandLauncher.html" title="class in org.apache.tools.ant.taskdefs.launcher"><span class="strong">Prev Class</span></a></li> <li><a href="../../../../../../org/apache/tools/ant/taskdefs/launcher/Java13CommandLauncher.html" title="class in org.apache.tools.ant.taskdefs.launcher"><span class="strong">Next Class</span></a></li> </ul> <ul class="navList"> <li><a href="../../../../../../index.html?org/apache/tools/ant/taskdefs/launcher/CommandLauncherProxy.html" target="_top">Frames</a></li> <li><a href="CommandLauncherProxy.html" target="_top">No Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_top"> <li><a href="../../../../../../allclasses-noframe.html">All Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_top"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <div> <ul class="subNavList"> <li>Summary:&nbsp;</li> <li>Nested&nbsp;|&nbsp;</li> <li><a href="#fields_inherited_from_class_org.apache.tools.ant.taskdefs.launcher.CommandLauncher">Field</a>&nbsp;|&nbsp;</li> <li><a href="#constructor_summary">Constr</a>&nbsp;|&nbsp;</li> <li><a href="#method_summary">Method</a></li> </ul> <ul class="subNavList"> <li>Detail:&nbsp;</li> <li>Field&nbsp;|&nbsp;</li> <li><a href="#constructor_detail">Constr</a>&nbsp;|&nbsp;</li> <li><a href="#method_detail">Method</a></li> </ul> </div> <a name="skip-navbar_top"> <!-- --> </a></div> <!-- ========= END OF TOP NAVBAR ========= --> <!-- ======== START OF CLASS DATA ======== --> <div class="header"> <div class="subTitle">org.apache.tools.ant.taskdefs.launcher</div> <h2 title="Class CommandLauncherProxy" class="title">Class CommandLauncherProxy</h2> </div> <div class="contentContainer"> <ul class="inheritance"> <li>java.lang.Object</li> <li> <ul class="inheritance"> <li><a href="../../../../../../org/apache/tools/ant/taskdefs/launcher/CommandLauncher.html" title="class in org.apache.tools.ant.taskdefs.launcher">org.apache.tools.ant.taskdefs.launcher.CommandLauncher</a></li> <li> <ul class="inheritance"> <li>org.apache.tools.ant.taskdefs.launcher.CommandLauncherProxy</li> </ul> </li> </ul> </li> </ul> <div class="description"> <ul class="blockList"> <li class="blockList"> <dl> <dt>Direct Known Subclasses:</dt> <dd><a href="../../../../../../org/apache/tools/ant/taskdefs/launcher/MacCommandLauncher.html" title="class in org.apache.tools.ant.taskdefs.launcher">MacCommandLauncher</a>, <a href="../../../../../../org/apache/tools/ant/taskdefs/launcher/OS2CommandLauncher.html" title="class in org.apache.tools.ant.taskdefs.launcher">OS2CommandLauncher</a>, <a href="../../../../../../org/apache/tools/ant/taskdefs/launcher/PerlScriptCommandLauncher.html" title="class in org.apache.tools.ant.taskdefs.launcher">PerlScriptCommandLauncher</a>, <a href="../../../../../../org/apache/tools/ant/taskdefs/launcher/ScriptCommandLauncher.html" title="class in org.apache.tools.ant.taskdefs.launcher">ScriptCommandLauncher</a>, <a href="../../../../../../org/apache/tools/ant/taskdefs/launcher/WinNTCommandLauncher.html" title="class in org.apache.tools.ant.taskdefs.launcher">WinNTCommandLauncher</a></dd> </dl> <hr> <br> <pre>public class <span class="strong">CommandLauncherProxy</span> extends <a href="../../../../../../org/apache/tools/ant/taskdefs/launcher/CommandLauncher.html" title="class in org.apache.tools.ant.taskdefs.launcher">CommandLauncher</a></pre> <div class="block">A command launcher that proxies another command launcher. Sub-classes override exec(args, env, workdir).</div> </li> </ul> </div> <div class="summary"> <ul class="blockList"> <li class="blockList"> <!-- =========== FIELD SUMMARY =========== --> <ul class="blockList"> <li class="blockList"><a name="field_summary"> <!-- --> </a> <h3>Field Summary</h3> <ul class="blockList"> <li class="blockList"><a name="fields_inherited_from_class_org.apache.tools.ant.taskdefs.launcher.CommandLauncher"> <!-- --> </a> <h3>Fields inherited from class&nbsp;org.apache.tools.ant.taskdefs.launcher.<a href="../../../../../../org/apache/tools/ant/taskdefs/launcher/CommandLauncher.html" title="class in org.apache.tools.ant.taskdefs.launcher">CommandLauncher</a></h3> <code><a href="../../../../../../org/apache/tools/ant/taskdefs/launcher/CommandLauncher.html#FILE_UTILS">FILE_UTILS</a></code></li> </ul> </li> </ul> <!-- ======== CONSTRUCTOR SUMMARY ======== --> <ul class="blockList"> <li class="blockList"><a name="constructor_summary"> <!-- --> </a> <h3>Constructor Summary</h3> <table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation"> <caption><span>Constructors</span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier</th> <th class="colLast" scope="col">Constructor and Description</th> </tr> <tr class="altColor"> <td class="colFirst"><code>protected </code></td> <td class="colLast"><code><strong><a href="../../../../../../org/apache/tools/ant/taskdefs/launcher/CommandLauncherProxy.html#CommandLauncherProxy(org.apache.tools.ant.taskdefs.launcher.CommandLauncher)">CommandLauncherProxy</a></strong>(<a href="../../../../../../org/apache/tools/ant/taskdefs/launcher/CommandLauncher.html" title="class in org.apache.tools.ant.taskdefs.launcher">CommandLauncher</a>&nbsp;launcher)</code>&nbsp;</td> </tr> </table> </li> </ul> <!-- ========== METHOD SUMMARY =========== --> <ul class="blockList"> <li class="blockList"><a name="method_summary"> <!-- --> </a> <h3>Method Summary</h3> <table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation"> <caption><span>Methods</span><span class="tabEnd">&nbsp;</span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Method and Description</th> </tr> <tr class="altColor"> <td class="colFirst"><code>java.lang.Process</code></td> <td class="colLast"><code><strong><a href="../../../../../../org/apache/tools/ant/taskdefs/launcher/CommandLauncherProxy.html#exec(org.apache.tools.ant.Project,%20java.lang.String[],%20java.lang.String[])">exec</a></strong>(<a href="../../../../../../org/apache/tools/ant/Project.html" title="class in org.apache.tools.ant">Project</a>&nbsp;project, java.lang.String[]&nbsp;cmd, java.lang.String[]&nbsp;env)</code> <div class="block">Launches the given command in a new process.</div> </td> </tr> </table> <ul class="blockList"> <li class="blockList"><a name="methods_inherited_from_class_org.apache.tools.ant.taskdefs.launcher.CommandLauncher"> <!-- --> </a> <h3>Methods inherited from class&nbsp;org.apache.tools.ant.taskdefs.launcher.<a href="../../../../../../org/apache/tools/ant/taskdefs/launcher/CommandLauncher.html" title="class in org.apache.tools.ant.taskdefs.launcher">CommandLauncher</a></h3> <code><a href="../../../../../../org/apache/tools/ant/taskdefs/launcher/CommandLauncher.html#exec(org.apache.tools.ant.Project,%20java.lang.String[],%20java.lang.String[],%20java.io.File)">exec</a>, <a href="../../../../../../org/apache/tools/ant/taskdefs/launcher/CommandLauncher.html#getShellLauncher(org.apache.tools.ant.Project)">getShellLauncher</a>, <a href="../../../../../../org/apache/tools/ant/taskdefs/launcher/CommandLauncher.html#getVMLauncher(org.apache.tools.ant.Project)">getVMLauncher</a>, <a href="../../../../../../org/apache/tools/ant/taskdefs/launcher/CommandLauncher.html#setShellLauncher(org.apache.tools.ant.Project,%20org.apache.tools.ant.taskdefs.launcher.CommandLauncher)">setShellLauncher</a>, <a href="../../../../../../org/apache/tools/ant/taskdefs/launcher/CommandLauncher.html#setVMLauncher(org.apache.tools.ant.Project,%20org.apache.tools.ant.taskdefs.launcher.CommandLauncher)">setVMLauncher</a></code></li> </ul> <ul class="blockList"> <li class="blockList"><a name="methods_inherited_from_class_java.lang.Object"> <!-- --> </a> <h3>Methods inherited from class&nbsp;java.lang.Object</h3> <code>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</code></li> </ul> </li> </ul> </li> </ul> </div> <div class="details"> <ul class="blockList"> <li class="blockList"> <!-- ========= CONSTRUCTOR DETAIL ======== --> <ul class="blockList"> <li class="blockList"><a name="constructor_detail"> <!-- --> </a> <h3>Constructor Detail</h3> <a name="CommandLauncherProxy(org.apache.tools.ant.taskdefs.launcher.CommandLauncher)"> <!-- --> </a> <ul class="blockListLast"> <li class="blockList"> <h4>CommandLauncherProxy</h4> <pre>protected&nbsp;CommandLauncherProxy(<a href="../../../../../../org/apache/tools/ant/taskdefs/launcher/CommandLauncher.html" title="class in org.apache.tools.ant.taskdefs.launcher">CommandLauncher</a>&nbsp;launcher)</pre> </li> </ul> </li> </ul> <!-- ============ METHOD DETAIL ========== --> <ul class="blockList"> <li class="blockList"><a name="method_detail"> <!-- --> </a> <h3>Method Detail</h3> <a name="exec(org.apache.tools.ant.Project, java.lang.String[], java.lang.String[])"> <!-- --> </a> <ul class="blockListLast"> <li class="blockList"> <h4>exec</h4> <pre>public&nbsp;java.lang.Process&nbsp;exec(<a href="../../../../../../org/apache/tools/ant/Project.html" title="class in org.apache.tools.ant">Project</a>&nbsp;project, java.lang.String[]&nbsp;cmd, java.lang.String[]&nbsp;env) throws java.io.IOException</pre> <div class="block">Launches the given command in a new process. Delegates this method to the proxied launcher.</div> <dl> <dt><strong>Overrides:</strong></dt> <dd><code><a href="../../../../../../org/apache/tools/ant/taskdefs/launcher/CommandLauncher.html#exec(org.apache.tools.ant.Project,%20java.lang.String[],%20java.lang.String[])">exec</a></code>&nbsp;in class&nbsp;<code><a href="../../../../../../org/apache/tools/ant/taskdefs/launcher/CommandLauncher.html" title="class in org.apache.tools.ant.taskdefs.launcher">CommandLauncher</a></code></dd> <dt><span class="strong">Parameters:</span></dt><dd><code>project</code> - the Ant project.</dd><dd><code>cmd</code> - the command line to execute as an array of strings.</dd><dd><code>env</code> - the environment to set as an array of strings.</dd> <dt><span class="strong">Returns:</span></dt><dd>the created Process.</dd> <dt><span class="strong">Throws:</span></dt> <dd><code>java.io.IOException</code> - forwarded from the exec method of the command launcher.</dd></dl> </li> </ul> </li> </ul> </li> </ul> </div> </div> <!-- ========= END OF CLASS DATA ========= --> <!-- ======= START OF BOTTOM NAVBAR ====== --> <div class="bottomNav"><a name="navbar_bottom"> <!-- --> </a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../../../../overview-summary.html">Overview</a></li> <li><a href="package-summary.html">Package</a></li> <li class="navBarCell1Rev">Class</li> <li><a href="package-tree.html">Tree</a></li> <li><a href="../../../../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../../../../index-all.html">Index</a></li> <li><a href="../../../../../../help-doc.html">Help</a></li> </ul> </div> <div class="subNav"> <ul class="navList"> <li><a href="../../../../../../org/apache/tools/ant/taskdefs/launcher/CommandLauncher.html" title="class in org.apache.tools.ant.taskdefs.launcher"><span class="strong">Prev Class</span></a></li> <li><a href="../../../../../../org/apache/tools/ant/taskdefs/launcher/Java13CommandLauncher.html" title="class in org.apache.tools.ant.taskdefs.launcher"><span class="strong">Next Class</span></a></li> </ul> <ul class="navList"> <li><a href="../../../../../../index.html?org/apache/tools/ant/taskdefs/launcher/CommandLauncherProxy.html" target="_top">Frames</a></li> <li><a href="CommandLauncherProxy.html" target="_top">No Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_bottom"> <li><a href="../../../../../../allclasses-noframe.html">All Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_bottom"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <div> <ul class="subNavList"> <li>Summary:&nbsp;</li> <li>Nested&nbsp;|&nbsp;</li> <li><a href="#fields_inherited_from_class_org.apache.tools.ant.taskdefs.launcher.CommandLauncher">Field</a>&nbsp;|&nbsp;</li> <li><a href="#constructor_summary">Constr</a>&nbsp;|&nbsp;</li> <li><a href="#method_summary">Method</a></li> </ul> <ul class="subNavList"> <li>Detail:&nbsp;</li> <li>Field&nbsp;|&nbsp;</li> <li><a href="#constructor_detail">Constr</a>&nbsp;|&nbsp;</li> <li><a href="#method_detail">Method</a></li> </ul> </div> <a name="skip-navbar_bottom"> <!-- --> </a></div> <!-- ======== END OF BOTTOM NAVBAR ======= --> </body> </html>
{ "pile_set_name": "Github" }
.. Copyright |copy| 2010 by Olivier Bonaventure .. This file is licensed under a `creative commons licence <http://creativecommons.org/licenses/by/3.0/>`_ Principles ########### The main objective of the network layer is to allow endsystems, connected to different networks, to exchange information through intermediate systems called :term:`router`. The unit of information in the network layer is called a :term:`packet`. .. figure:: svg/osi-network.png :align: center :scale: 80 The network layer in the reference model Before explaining the network layer in detail, it is useful to begin by analysing the service provided by the `datalink` layer. There are many variants of the datalink layer. Some provide a connection-oriented service while others provide a connectionless service. In this section, we focus on connectionless datalink layer services as they are the most widely used. Using a connection-oriented datalink layer causes some problems that are beyond the scope of this chapter. See :rfc:`3819` for a discussion on this topic. .. figure:: svg/osi-datalink.png :align: center :scale: 70 The point-to-point datalink layer There are three main types of datalink layers. The simplest datalink layer is when there are only two communicating systems that are directly connected through the physical layer. Such a datalink layer is used when there is a point-to-point link between the two communicating systems. The two systems can be endsystems or routers. :abbr:`PPP (Point-to-Point Protocol)`, defined in :rfc:`1661`, is an example of such a point-to-point datalink layer. Datalink layers exchange `frames` and a datalink :term:`frame` sent by a datalink layer entity on the left is transmitted through the physical layer, so that it can reach the datalink layer entity on the right. Point-to-point datalink layers can either provide an unreliable service (frames can be corrupted or lost) or a reliable service (in this case, the datalink layer includes retransmission mechanisms similar to the ones used in the transport layer). The unreliable service is frequently used above physical layers (e.g. optical fiber, twisted pairs) having a low bit error ratio while reliability mechanisms are often used in wireless networks to recover locally from transmission errors. The second type of datalink layer is the one used in Local Area Networks (LAN). Conceptually, a LAN is a set of communicating devices such that any two devices can directly exchange frames through the datalink layer. Both endsystems and routers can be connected to a LAN. Some LANs only connect a few devices, but there are LANs that can connect hundreds or even thousands of devices. .. figure:: svg/simple-lan.png :align: center :scale: 80 A local area network In the next chapter, we describe the organisation and the operation of Local Area Networks. An important difference between the point-to-point datalink layers and the datalink layers used in LANs is that in a LAN, each communicating device is identified by a unique `datalink layer address`. This address is usually embedded in the hardware of the device and different types of LANs use different types of datalink layer addresses. A communicating device attached to a LAN can send a datalink frame to any other communicating device that is attached to the same LAN. Most LANs also support special broadcast and multicast datalink layer addresses. A frame sent to the broadcast address of the LAN is delivered to all communicating devices that are attached to the LAN. The multicast addresses are used to identify groups of communicating devices. When a frame is sent towards a multicast datalink layer address, it is delivered by the LAN to all communicating devices that belong to the corresponding group. .. index:: NBMA, Non-Broadcast Multi-Access Networks The third type of datalink layers are used in Non-Broadcast Multi-Access (NBMA) networks. These networks are used to interconnect devices like a LAN. All devices attached to an NBMA network are identified by a unique datalink layer address. However, and this is the main difference between an NBMA network and a traditional LAN, the NBMA service only supports unicast. The datalink layer service provided by an NBMA network supports neither broadcast nor multicast. Unfortunately no datalink layer is able to send frames of unlimited side. Each datalink layer is characterised by a maximum frame size. There are more than a dozen different datalink layers and unfortunately most of them use a different maximum frame size. The network layer must cope with the heterogeneity of the datalink layer. The network layer itself relies on the following principles : #. Each network layer entity is identified by a `network layer address`. This address is independent of the datalink layer addresses that it may use. #. The service provided by the network layer does not depend on the service or the internal organisation of the underlying datalink layers. #. The network layer is conceptually divided into two planes : the `data plane` and the `control plane`. The `data plane` contains the protocols and mechanisms that allow hosts and routers to exchange packets carrying user data. The `control plane` contains the protocols and mechanisms that enable routers to efficiently learn how to forward packets towards their final destination. The independence of the network layer from the underlying datalink layer is a key principle of the network layer. It ensures that the network layer can be used to allow hosts attached to different types of datalink layers to exchange packets through intermediate routers. Furthermore, this allows the datalink layers and the network layer to evolve independently from each other. This enables the network layer to be easily adapted to a new datalink layer every time a new datalink layer is invented. There are two types of service that can be provided by the network layer : - an `unreliable connectionless` service - a `connection-oriented`, reliable or unreliable, service Connection-oriented services have been popular with technologies such as :term:`X.25` and :term:`ATM` or :term:`frame-relay`, but nowadays most networks use an `unreliable connectionless` service. This is our main focus in this chapter. Organisation of the network layer ================================= .. index:: datagram, virtual circuit There are two possible internal organisations of the network layer : - datagram - virtual circuits The internal organisation of the network is orthogonal to the service that it provides, but most of the time a datagram organisation is used to provide a connectionless service while a virtual circuit organisation is used in networks that provide a connection-oriented service. Datagram organisation --------------------- The first and most popular organisation of the network layer is the datagram organisation. This organisation is inspired by the organisation of the postal service. Each host is identified by a `network layer address`. To send information to a remote host, a host creates a packet that contains : - the network layer address of the destination host - its own network layer address - the information to be sent The network layer limits the maximum packet size. Thus, the information must have been divided in packets by the transport layer before being passed to the network layer. To understand the datagram organisation, let us consider the figure below. A network layer address, represented by a letter, has been assigned to each host and router. To send some information to host `J`, host `A` creates a packet containing its own address, the destination address and the information to be exchanged. .. figure:: svg/simple-internetwork.png :align: center :scale: 80 A simple internetwork .. index:: hop-by-hop forwarding With the datagram organisation, routers use `hop-by-hop forwarding`. This means that when a router receives a packet that is not destined to itself, it looks up the destination address of the packet in its `routing table`. A `routing table` is a data structure that maps each destination address (or set of destination addresses) to the outgoing interface over which a packet destined to this address must be forwarded to reach its final destination. The main constraint imposed on the routing tables is that they must allow any host in the network to reach any other host. This implies that each router must know a route towards each destination, but also that the paths composed from the information stored in the routing tables must not contain loops. Otherwise, some destinations would be unreachable. In the example above, host `A` sends its packet to router `R1`. `R1` consults its routing table and forwards the packet towards `R2`. Based on its own routing table, `R2` decides to forward the packet to `R5` that can deliver it to its destination. To allow hosts to exchange packets, a network relies on two different types of protocols and mechanisms. First, there must be a precise definition of the format of the packets that are sent by hosts and processed by routers. Second, the algorithm used by the routers to forward these packets must be defined. This protocol and this algorithm are part of the `data plane` of the network layer. The `data plane` contains all the protocols and algorithms that are used by hosts and routers to create and process the packets that contain user data. The `data plane`, and in particular the forwarding algorithm used by the routers, depends on the routing tables that are maintained on reach router. These routing tables can be maintained by using various techniques (manual configuration, distributed protocols, centralised computation, etc). These techniques are part of the `control plane` of the network layer. The `control plane` contains all the protocols and mechanisms that are used to compute and install routing tables on the routers. The datagram organisation has been very popular in computer networks. Datagram based network layers include IPv4 and IPv6 in the global Internet, CLNP defined by the ISO, IPX defined by Novell or XNS defined by Xerox [Perlman2000]_. Virtual circuit organisation ---------------------------- The main advantage of the datagram organisation is its simplicity. The principles of this organisation can easily be understood. Furthermore, it allows a host to easily send a packet towards any destination at any time. However, as each packet is forwarded independently by intermediate routers, packets sent by a host may not follow the same path to reach a given destination. This may cause packet reordering, which may be annoying for transport protocols. Furthermore, as a router using `hop-by-hop forwarding` always forwards packets sent towards the same destination over the same outgoing interface, this may cause congestion over some links. The second organisation of the network layer, called `virtual circuits`, has been inspired by the organisation of telephone networks. Telephone networks have been designed to carry phone calls that usually last a few minutes. Each phone is identified by a telephone number and is attached to a telephone switch. To initiate a phone call, a telephone first needs to send the destination's phone number to its local switch. The switch cooperates with the other switches in the network to create a bi-directional channel between the two telephones through the network. This channel will be used by the two telephones during the lifetime of the call and will be released at the end of the call. Until the 1960s, most of these channels were created manually, by telephone operators, upon request of the caller. Today's telephone networks use automated switches and allow several channels to be carried over the same physical link, but the principles remain roughly the same. In a network using virtual circuits, all hosts are identified with a network layer address. However, a host must explicitly request the establishment of a `virtual circuit` before being able to send packets to a destination host. The request to establish a virtual circuit is processed by the `control plane`, which installs state to create the virtual circuit between the source and the destination through intermediate routers. All the packets that are sent on the virtual circuit contain a virtual circuit identifier that allows the routers to determine to which virtual circuit each packet belongs. This is illustrated in the figure below with one virtual circuit between host `A` and host `I` and another one between host `A` and host `J`. .. figure:: svg/simple-internetwork-vc.png :align: center :scale: 70 A simple internetwork using virtual-circuits The establishment of a virtual circuit is performed using a `signalling protocol` in the `control plane`. Usually, the source host sends a signalling message to indicate to its router the address of the destination and possibly some performance characteristics of the virtual circuit to be established. The first router can process the signalling message in two different ways. A first solution is for the router to consult its routing table, remember the characteristics of the requested virtual circuit and forward it over its outgoing interface towards the destination. The signalling message is thus forwarded hop-by-hop until it reaches the destination and the virtual circuit is opened along the path followed by the signalling message. This is illustrated with the red virtual circuit in the figure below. .. figure:: svg/simple-internetwork-vc-estab.png :align: center :scale: 70 Virtual circuit establishment .. index:: source routing, label A second solution can be used if the routers know the entire topology of the network. In this case, the first router can use a technique called `source routing`. Upon reception of the signalling message, the first router chooses the path of the virtual circuit in the network. This path is encoded as the list of the addresses of all intermediate routers to reach the destination. It is included in the signalling message and intermediate routers can remove their address from the signalling message before forwarding it. This technique enables routers to spread the virtual circuits throughout the network better. If the routers know the load of remote links, they can also select the least loaded path when establishing a virtual circuit. This solution is illustrated with the blue circuit in the figure above. The last point to be discussed about the virtual circuit organisation is its `data plane`. The `data plane` mainly defines the format of the data packets and the algorithm used by routers to forward packets. The data packets contain a virtual circuit identifier, encoded as a fixed number of bits. These virtual circuit identifiers are usually called `labels`. Each host maintains a flow table that associates a label with each virtual circuit that is has established. When a router receives a packet containing a label, it extracts the label and consults its `label forwarding table`. This table is a data structure that maps each couple `(incoming interface, label)` to the outgoing interface to be used to forward the packet as well as the label that must be placed in the outgoing packets. In practice, the label forwarding table can be implemented as a vector and the couple `(incoming interface, label)` is the index of the entry in the vector that contains the outgoing interface and the outgoing label. Thus a single memory access is sufficient to consult the label forwarding table. The utilisation of the label forwarding table is illustrated in the figure below. .. figure:: svg/label-forwarding.png :align: center :scale: 70 Label forwarding tables in a network using virtual circuits The virtual circuit organisation has been mainly used in public networks, starting from X.25 and then Frame Relay and Asynchronous Transfer Mode (ATM) network. Both the datagram and virtual circuit organisations have advantages and drawbacks. The main advantage of the datagram organisation is that hosts can easily send packets to any number of destinations while the virtual circuit organisation requires the establishment of a virtual circuit before the transmission of a data packet. This solution can be costly for hosts that exchange small amounts of data. On the other hand, the main advantage of the virtual circuit organisation is that the forwarding algorithm used by routers is simpler than when using the datagram organisation. Furthermore, the utilisation of virtual circuits may allow the load to be better spread through the network thanks to the utilisation of multiple virtual circuits. The MultiProtocol Label Switching (MPLS) technique that we will discuss in another revision of this book can be considered as a good compromise between datagram and virtual circuits. MPLS uses virtual circuits between routers, but does not extend them to the endhosts. Additional information about MPLS may be found in [ML2011]_. .. maybe add more information The control plane ================= One of the objectives of the `control plane` in the network layer is to maintain the routing tables that are used on all routers. As indicated earlier, a routing table is a data structure that contains, for each destination address (or block of addresses) known by the router, the outgoing interface over which the router must forward a packet destined to this address. The routing table may also contain additional information such as the address of the next router on the path towards the destination or an estimation of the cost of this path. In this section, we discuss the three main techniques that can be used to maintain the routing tables in a network. Static routing -------------- .. comment:: comment formaliser l'absence de boucles The simplest solution is to pre-compute all the routing tables of all routers and to install them on each router. Several algorithms can be used to compute these tables. A simple solution is to use shortest path routing and to minimise the number of intermediate routers to reach each destination. More complex algorithms can take into account the expected load on the links to ensure that congestion does not occur for a given traffic demand. These algorithms must all ensure that : - all routers are configured with a route to reach each destination - none of the paths composed with the entries found in the routing tables contain a cycle. Such a cycle would lead to a forwarding loop. The figure below shows sample routing tables in a five routers network. .. figure:: svg/routing-tables.png :align: center :scale: 70 Routing tables in a simple network The main drawback of static routing is that it does not adapt to the evolution of the network. When a new router or link is added, all routing tables must be recomputed. Furthermore, when a link or router fails, the routing tables must be updated as well. .. include:: dv.rst .. include:: linkstate.rst
{ "pile_set_name": "Github" }
'use strict'; module.exports = function (app) { class Certify extends app.Service { constructor(ctx) { super(ctx); } * exec(cmd) { return { cmd: cmd, method: this.ctx.method, url: this.ctx.url, }; } } return Certify; };
{ "pile_set_name": "Github" }
/******************************************************************************* * HellFirePvP / Astral Sorcery 2020 * * All rights reserved. * The source code is available on github: https://github.com/HellFirePvP/AstralSorcery * For further details, see the License file there. ******************************************************************************/ package hellfirepvp.astralsorcery.client.util; import hellfirepvp.observerlib.api.client.StructureRenderLightManager; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; import net.minecraft.fluid.Fluids; import net.minecraft.fluid.IFluidState; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.math.BlockPos; import net.minecraft.world.ILightReader; import net.minecraft.world.LightType; import net.minecraft.world.biome.Biome; import net.minecraft.world.level.ColorResolver; import net.minecraft.world.lighting.WorldLightManager; import javax.annotation.Nullable; /** * This class is part of the Astral Sorcery Mod * The complete source code for this mod can be found on github. * Class: EmptyRenderWorld * Created by HellFirePvP * Date: 18.07.2019 / 16:35 */ public class EmptyRenderWorld implements ILightReader { private final Biome biome; public EmptyRenderWorld(Biome biome) { this.biome = biome; } @Override public WorldLightManager getLightManager() { return new StructureRenderLightManager(this.getMaxLightLevel()); } @Override public int getBlockColor(BlockPos blockPosIn, ColorResolver colorResolverIn) { return colorResolverIn.getColor(biome, (double) blockPosIn.getX(), (double) blockPosIn.getZ()); } @Override public int getLightFor(LightType lightType, BlockPos blockPos) { return this.getMaxLightLevel(); } @Nullable @Override public TileEntity getTileEntity(BlockPos blockPos) { return null; } @Override public BlockState getBlockState(BlockPos blockPos) { return Blocks.AIR.getDefaultState(); } @Override public IFluidState getFluidState(BlockPos blockPos) { return Fluids.EMPTY.getDefaultState(); } }
{ "pile_set_name": "Github" }
agents: - goal: [5, 4] name: agent0 start: [3, 6] - goal: [4, 1] name: agent1 start: [2, 2] - goal: [5, 5] name: agent2 start: [4, 2] - goal: [3, 4] name: agent3 start: [5, 6] - goal: [4, 3] name: agent4 start: [5, 7] - goal: [6, 3] name: agent5 start: [6, 7] - goal: [5, 3] name: agent6 start: [0, 4] map: dimensions: [8, 8] obstacles: - [3, 2] - [3, 0] - [6, 5] - [7, 2] - [0, 0] - [1, 4] - [0, 3] - [1, 1] - [1, 0] - [2, 1] - [1, 7] - [5, 2]
{ "pile_set_name": "Github" }
// // libtgvoip is free and unencumbered public domain software. // For more information, see http://unlicense.org or the UNLICENSE file // you should have received with this source code distribution. // #include <stdlib.h> #include <stdio.h> #include "AudioInputAudioUnitOSX.h" #include "../../logging.h" #include "../../audio/Resampler.h" #include "../../VoIPController.h" #define BUFFER_SIZE 960 #define CHECK_AU_ERROR(res, msg) if(res!=noErr){ LOGE("input: " msg": OSStatus=%d", (int)res); failed=true; return; } #define kOutputBus 0 #define kInputBus 1 using namespace tgvoip; using namespace tgvoip::audio; AudioInputAudioUnitLegacy::AudioInputAudioUnitLegacy(std::string deviceID) : AudioInput(deviceID){ remainingDataSize=0; isRecording=false; inBufferList.mBuffers[0].mData=malloc(10240); inBufferList.mBuffers[0].mDataByteSize=10240; inBufferList.mNumberBuffers=1; OSStatus status; AudioComponentDescription inputDesc={ .componentType = kAudioUnitType_Output, .componentSubType = kAudioUnitSubType_HALOutput, .componentFlags = 0, .componentFlagsMask = 0, .componentManufacturer = kAudioUnitManufacturer_Apple }; AudioComponent component=AudioComponentFindNext(NULL, &inputDesc); status=AudioComponentInstanceNew(component, &unit); CHECK_AU_ERROR(status, "Error creating AudioUnit"); UInt32 flag=0; status = AudioUnitSetProperty(unit, kAudioOutputUnitProperty_EnableIO, kAudioUnitScope_Output, kOutputBus, &flag, sizeof(flag)); CHECK_AU_ERROR(status, "Error enabling AudioUnit output"); flag=1; status = AudioUnitSetProperty(unit, kAudioOutputUnitProperty_EnableIO, kAudioUnitScope_Input, kInputBus, &flag, sizeof(flag)); CHECK_AU_ERROR(status, "Error enabling AudioUnit input"); SetCurrentDevice(deviceID); CFRunLoopRef theRunLoop = NULL; AudioObjectPropertyAddress propertyAddress = { kAudioHardwarePropertyRunLoop, kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyElementMaster }; status = AudioObjectSetPropertyData(kAudioObjectSystemObject, &propertyAddress, 0, NULL, sizeof(CFRunLoopRef), &theRunLoop); propertyAddress.mSelector = kAudioHardwarePropertyDefaultInputDevice; propertyAddress.mScope = kAudioObjectPropertyScopeGlobal; propertyAddress.mElement = kAudioObjectPropertyElementMaster; AudioObjectAddPropertyListener(kAudioObjectSystemObject, &propertyAddress, AudioInputAudioUnitLegacy::DefaultDeviceChangedCallback, this); AURenderCallbackStruct callbackStruct; callbackStruct.inputProc = AudioInputAudioUnitLegacy::BufferCallback; callbackStruct.inputProcRefCon=this; status = AudioUnitSetProperty(unit, kAudioOutputUnitProperty_SetInputCallback, kAudioUnitScope_Global, kInputBus, &callbackStruct, sizeof(callbackStruct)); CHECK_AU_ERROR(status, "Error setting input buffer callback"); status=AudioUnitInitialize(unit); CHECK_AU_ERROR(status, "Error initializing unit"); } AudioInputAudioUnitLegacy::~AudioInputAudioUnitLegacy(){ AudioObjectPropertyAddress propertyAddress; propertyAddress.mSelector = kAudioHardwarePropertyDefaultInputDevice; propertyAddress.mScope = kAudioObjectPropertyScopeGlobal; propertyAddress.mElement = kAudioObjectPropertyElementMaster; AudioObjectRemovePropertyListener(kAudioObjectSystemObject, &propertyAddress, AudioInputAudioUnitLegacy::DefaultDeviceChangedCallback, this); AudioUnitUninitialize(unit); AudioComponentInstanceDispose(unit); free(inBufferList.mBuffers[0].mData); } void AudioInputAudioUnitLegacy::Start(){ isRecording=true; OSStatus status=AudioOutputUnitStart(unit); CHECK_AU_ERROR(status, "Error starting AudioUnit"); } void AudioInputAudioUnitLegacy::Stop(){ isRecording=false; OSStatus status=AudioOutputUnitStart(unit); CHECK_AU_ERROR(status, "Error stopping AudioUnit"); } OSStatus AudioInputAudioUnitLegacy::BufferCallback(void *inRefCon, AudioUnitRenderActionFlags *ioActionFlags, const AudioTimeStamp *inTimeStamp, UInt32 inBusNumber, UInt32 inNumberFrames, AudioBufferList *ioData){ AudioInputAudioUnitLegacy* input=(AudioInputAudioUnitLegacy*) inRefCon; input->inBufferList.mBuffers[0].mDataByteSize=10240; AudioUnitRender(input->unit, ioActionFlags, inTimeStamp, inBusNumber, inNumberFrames, &input->inBufferList); input->HandleBufferCallback(&input->inBufferList); return noErr; } void AudioInputAudioUnitLegacy::HandleBufferCallback(AudioBufferList *ioData){ int i; for(i=0;i<ioData->mNumberBuffers;i++){ AudioBuffer buf=ioData->mBuffers[i]; size_t len=buf.mDataByteSize; if(hardwareSampleRate!=48000){ len=tgvoip::audio::Resampler::Convert((int16_t*)buf.mData, (int16_t*)(remainingData+remainingDataSize), buf.mDataByteSize/2, (10240-(buf.mDataByteSize+remainingDataSize))/2, 48000, hardwareSampleRate)*2; }else{ assert(remainingDataSize+buf.mDataByteSize<10240); memcpy(remainingData+remainingDataSize, buf.mData, buf.mDataByteSize); } remainingDataSize+=len; while(remainingDataSize>=BUFFER_SIZE*2){ InvokeCallback((unsigned char*)remainingData, BUFFER_SIZE*2); remainingDataSize-=BUFFER_SIZE*2; if(remainingDataSize>0){ memmove(remainingData, remainingData+(BUFFER_SIZE*2), remainingDataSize); } } } } void AudioInputAudioUnitLegacy::EnumerateDevices(std::vector<AudioInputDevice>& devs){ AudioObjectPropertyAddress propertyAddress = { kAudioHardwarePropertyDevices, kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyElementMaster }; UInt32 dataSize = 0; OSStatus status = AudioObjectGetPropertyDataSize(kAudioObjectSystemObject, &propertyAddress, 0, NULL, &dataSize); if(kAudioHardwareNoError != status) { LOGE("AudioObjectGetPropertyDataSize (kAudioHardwarePropertyDevices) failed: %i", status); return; } UInt32 deviceCount = (UInt32)(dataSize / sizeof(AudioDeviceID)); AudioDeviceID *audioDevices = (AudioDeviceID*)(malloc(dataSize)); status = AudioObjectGetPropertyData(kAudioObjectSystemObject, &propertyAddress, 0, NULL, &dataSize, audioDevices); if(kAudioHardwareNoError != status) { LOGE("AudioObjectGetPropertyData (kAudioHardwarePropertyDevices) failed: %i", status); free(audioDevices); audioDevices = NULL; return; } // Iterate through all the devices and determine which are input-capable propertyAddress.mScope = kAudioDevicePropertyScopeInput; for(UInt32 i = 0; i < deviceCount; ++i) { // Query device UID CFStringRef deviceUID = NULL; dataSize = sizeof(deviceUID); propertyAddress.mSelector = kAudioDevicePropertyDeviceUID; status = AudioObjectGetPropertyData(audioDevices[i], &propertyAddress, 0, NULL, &dataSize, &deviceUID); if(kAudioHardwareNoError != status) { LOGE("AudioObjectGetPropertyData (kAudioDevicePropertyDeviceUID) failed: %i", status); continue; } // Query device name CFStringRef deviceName = NULL; dataSize = sizeof(deviceName); propertyAddress.mSelector = kAudioDevicePropertyDeviceNameCFString; status = AudioObjectGetPropertyData(audioDevices[i], &propertyAddress, 0, NULL, &dataSize, &deviceName); if(kAudioHardwareNoError != status) { LOGE("AudioObjectGetPropertyData (kAudioDevicePropertyDeviceNameCFString) failed: %i", status); continue; } // Determine if the device is an input device (it is an input device if it has input channels) dataSize = 0; propertyAddress.mSelector = kAudioDevicePropertyStreamConfiguration; status = AudioObjectGetPropertyDataSize(audioDevices[i], &propertyAddress, 0, NULL, &dataSize); if(kAudioHardwareNoError != status) { LOGE("AudioObjectGetPropertyDataSize (kAudioDevicePropertyStreamConfiguration) failed: %i", status); continue; } AudioBufferList *bufferList = (AudioBufferList*)(malloc(dataSize)); status = AudioObjectGetPropertyData(audioDevices[i], &propertyAddress, 0, NULL, &dataSize, bufferList); if(kAudioHardwareNoError != status || 0 == bufferList->mNumberBuffers) { if(kAudioHardwareNoError != status) LOGE("AudioObjectGetPropertyData (kAudioDevicePropertyStreamConfiguration) failed: %i", status); free(bufferList); bufferList = NULL; continue; } free(bufferList); bufferList = NULL; AudioInputDevice dev; char buf[1024]; CFStringGetCString(deviceName, buf, 1024, kCFStringEncodingUTF8); dev.displayName=std::string(buf); CFStringGetCString(deviceUID, buf, 1024, kCFStringEncodingUTF8); dev.id=std::string(buf); if(dev.id.rfind("VPAUAggregateAudioDevice-0x")==0) continue; devs.push_back(dev); } free(audioDevices); audioDevices = NULL; } void AudioInputAudioUnitLegacy::SetCurrentDevice(std::string deviceID){ UInt32 size=sizeof(AudioDeviceID); AudioDeviceID inputDevice=0; OSStatus status; if(deviceID=="default"){ AudioObjectPropertyAddress propertyAddress; propertyAddress.mSelector = kAudioHardwarePropertyDefaultInputDevice; propertyAddress.mScope = kAudioObjectPropertyScopeGlobal; propertyAddress.mElement = kAudioObjectPropertyElementMaster; UInt32 propsize = sizeof(AudioDeviceID); status = AudioObjectGetPropertyData(kAudioObjectSystemObject, &propertyAddress, 0, NULL, &propsize, &inputDevice); CHECK_AU_ERROR(status, "Error getting default input device"); }else{ AudioObjectPropertyAddress propertyAddress = { kAudioHardwarePropertyDevices, kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyElementMaster }; UInt32 dataSize = 0; status = AudioObjectGetPropertyDataSize(kAudioObjectSystemObject, &propertyAddress, 0, NULL, &dataSize); CHECK_AU_ERROR(status, "Error getting devices size"); UInt32 deviceCount = (UInt32)(dataSize / sizeof(AudioDeviceID)); AudioDeviceID audioDevices[deviceCount]; status = AudioObjectGetPropertyData(kAudioObjectSystemObject, &propertyAddress, 0, NULL, &dataSize, audioDevices); CHECK_AU_ERROR(status, "Error getting device list"); for(UInt32 i = 0; i < deviceCount; ++i) { // Query device UID CFStringRef deviceUID = NULL; dataSize = sizeof(deviceUID); propertyAddress.mSelector = kAudioDevicePropertyDeviceUID; status = AudioObjectGetPropertyData(audioDevices[i], &propertyAddress, 0, NULL, &dataSize, &deviceUID); CHECK_AU_ERROR(status, "Error getting device uid"); char buf[1024]; CFStringGetCString(deviceUID, buf, 1024, kCFStringEncodingUTF8); if(deviceID==buf){ LOGV("Found device for id %s", buf); inputDevice=audioDevices[i]; break; } } if(!inputDevice){ LOGW("Requested device not found, using default"); SetCurrentDevice("default"); return; } } status =AudioUnitSetProperty(unit, kAudioOutputUnitProperty_CurrentDevice, kAudioUnitScope_Global, kInputBus, &inputDevice, size); CHECK_AU_ERROR(status, "Error setting input device"); AudioStreamBasicDescription hardwareFormat; size=sizeof(hardwareFormat); status=AudioUnitGetProperty(unit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Input, kInputBus, &hardwareFormat, &size); CHECK_AU_ERROR(status, "Error getting hardware format"); hardwareSampleRate=hardwareFormat.mSampleRate; AudioStreamBasicDescription desiredFormat={ .mSampleRate=hardwareFormat.mSampleRate, .mFormatID=kAudioFormatLinearPCM, .mFormatFlags=kAudioFormatFlagIsSignedInteger | kAudioFormatFlagIsPacked | kAudioFormatFlagsNativeEndian, .mFramesPerPacket=1, .mChannelsPerFrame=1, .mBitsPerChannel=16, .mBytesPerPacket=2, .mBytesPerFrame=2 }; status=AudioUnitSetProperty(unit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Output, kInputBus, &desiredFormat, sizeof(desiredFormat)); CHECK_AU_ERROR(status, "Error setting format"); LOGD("Switched capture device, new sample rate %d", hardwareSampleRate); this->currentDevice=deviceID; AudioObjectPropertyAddress propertyAddress = { kAudioDevicePropertyBufferFrameSize, kAudioObjectPropertyScopeGlobal, kAudioObjectPropertyElementMaster }; size=4; UInt32 bufferFrameSize; status=AudioObjectGetPropertyData(inputDevice, &propertyAddress, 0, NULL, &size, &bufferFrameSize); if(status==noErr){ estimatedDelay=bufferFrameSize/48; LOGD("CoreAudio buffer size for output device is %u frames (%u ms)", bufferFrameSize, estimatedDelay); } } OSStatus AudioInputAudioUnitLegacy::DefaultDeviceChangedCallback(AudioObjectID inObjectID, UInt32 inNumberAddresses, const AudioObjectPropertyAddress *inAddresses, void *inClientData){ LOGV("System default input device changed"); AudioInputAudioUnitLegacy* self=(AudioInputAudioUnitLegacy*)inClientData; if(self->currentDevice=="default"){ self->SetCurrentDevice(self->currentDevice); } return noErr; }
{ "pile_set_name": "Github" }
class AddCostCurrencyToVariants < ActiveRecord::Migration[4.2] def change add_column :spree_variants, :cost_currency, :string, after: :cost_price end end
{ "pile_set_name": "Github" }
import '../token.dart'; import 'directive.dart'; import 'node.dart'; import 'package:source_span/source_span.dart'; import 'selection_set.dart'; import 'type_condition.dart'; /// An inline fragment, which typically appears in a [SelectionSetContext]. class InlineFragmentContext extends Node { /// The source tokens. final Token ellipsisToken, onToken; /// The type which this fragment matches. final TypeConditionContext typeCondition; /// Any directives affixed to this inline fragment. final List<DirectiveContext> directives = []; /// The selections applied when the [typeCondition] is met. final SelectionSetContext selectionSet; InlineFragmentContext( this.ellipsisToken, this.onToken, this.typeCondition, this.selectionSet); /// Use [ellipsisToken] instead. @deprecated Token get ELLIPSIS => ellipsisToken; /// Use [onToken] instead. @deprecated Token get ON => onToken; @override FileSpan get span { var out = ellipsisToken.span.expand(onToken.span).expand(typeCondition.span); out = directives.fold<FileSpan>(out, (o, d) => o.expand(d.span)); return out.expand(selectionSet.span); } }
{ "pile_set_name": "Github" }
/*! @file Defines `boost::hana::filter`. @copyright Louis Dionne 2013-2016 Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) */ #ifndef BOOST_HANA_FILTER_HPP #define BOOST_HANA_FILTER_HPP #include <boost/hana/fwd/filter.hpp> #include <boost/hana/at.hpp> #include <boost/hana/bool.hpp> #include <boost/hana/chain.hpp> #include <boost/hana/concept/monad_plus.hpp> #include <boost/hana/concept/sequence.hpp> #include <boost/hana/config.hpp> #include <boost/hana/core/dispatch.hpp> #include <boost/hana/core/make.hpp> #include <boost/hana/detail/algorithm.hpp> #include <boost/hana/detail/array.hpp> #include <boost/hana/detail/decay.hpp> #include <boost/hana/empty.hpp> #include <boost/hana/lift.hpp> #include <boost/hana/unpack.hpp> #include <cstddef> #include <utility> BOOST_HANA_NAMESPACE_BEGIN //! @cond template <typename Xs, typename Pred> constexpr auto filter_t::operator()(Xs&& xs, Pred&& pred) const { using M = typename hana::tag_of<Xs>::type; using Filter = BOOST_HANA_DISPATCH_IF(filter_impl<M>, hana::MonadPlus<M>::value ); #ifndef BOOST_HANA_CONFIG_DISABLE_CONCEPT_CHECKS static_assert(hana::MonadPlus<M>::value, "hana::filter(xs, pred) requires 'xs' to be a MonadPlus"); #endif return Filter::apply(static_cast<Xs&&>(xs), static_cast<Pred&&>(pred)); } //! @endcond namespace detail { template <typename Pred, typename M> struct lift_or_empty { template <typename X> static constexpr auto helper(X&& x, hana::true_) { return hana::lift<M>(static_cast<X&&>(x)); } template <typename X> static constexpr auto helper(X&&, hana::false_) { return hana::empty<M>(); } template <typename X> constexpr auto operator()(X&& x) const { constexpr bool cond = decltype(std::declval<Pred>()(x))::value; return helper(static_cast<X&&>(x), hana::bool_c<cond>); } }; } template <typename M, bool condition> struct filter_impl<M, when<condition>> : default_ { template <typename Xs, typename Pred> static constexpr decltype(auto) apply(Xs&& xs, Pred const&) { return hana::chain(static_cast<Xs&&>(xs), detail::lift_or_empty<Pred, M>{} ); } }; namespace detail { template <bool ...b> struct filter_indices { static constexpr auto compute_indices() { constexpr bool bs[] = {b..., false}; // avoid empty array constexpr std::size_t N = detail::count(bs, bs + sizeof(bs), true); detail::array<std::size_t, N> indices{}; std::size_t* keep = &indices[0]; for (std::size_t i = 0; i < sizeof...(b); ++i) if (bs[i]) *keep++ = i; return indices; } static constexpr auto indices = compute_indices(); }; template <typename Pred> struct make_filter_indices { Pred const& pred; template <typename ...X> auto operator()(X&& ...x) const -> filter_indices< static_cast<bool>(detail::decay< decltype(pred(static_cast<X&&>(x))) >::type::value)... > { return {}; } }; } template <typename S> struct filter_impl<S, when<Sequence<S>::value>> { template <typename Indices, typename Xs, std::size_t ...i> static constexpr auto filter_helper(Xs&& xs, std::index_sequence<i...>) { return hana::make<S>( hana::at_c<Indices::indices[i]>(static_cast<Xs&&>(xs))... ); } template <typename Xs, typename Pred> static constexpr auto apply(Xs&& xs, Pred const& pred) { using Indices = decltype( hana::unpack(static_cast<Xs&&>(xs), detail::make_filter_indices<Pred>{pred}) ); return filter_impl::filter_helper<Indices>( static_cast<Xs&&>(xs), std::make_index_sequence<Indices::indices.size()>{} ); } }; BOOST_HANA_NAMESPACE_END #endif // !BOOST_HANA_FILTER_HPP
{ "pile_set_name": "Github" }
// Boost.Geometry // Copyright (c) 2017-2018, Oracle and/or its affiliates. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_GEOMETRY_PROJECTIONS_ESRI_HPP #define BOOST_GEOMETRY_PROJECTIONS_ESRI_HPP #include <boost/geometry/srs/projections/code.hpp> namespace boost { namespace geometry { namespace projections { #ifndef DOXYGEN_NO_DETAIL namespace detail { inline srs::dpar::parameters<> esri_to_parameters(int code) { using namespace srs::dpar; static const code_element arr[] = { {37001, srs::dpar::parameters<>(proj_longlat)(ellps_wgs66)(no_defs)}, {37002, srs::dpar::parameters<>(proj_longlat)(a,6378166)(b,6356784.283607107)(no_defs)}, {37003, srs::dpar::parameters<>(proj_longlat)(a,6378150)(b,6356768.337244385)(no_defs)}, {37004, srs::dpar::parameters<>(proj_longlat)(ellps_fschr60m)(no_defs)}, {37005, srs::dpar::parameters<>(proj_longlat)(a,6378270)(b,6356794.343434343)(no_defs)}, {37006, srs::dpar::parameters<>(proj_longlat)(a,6377295.664)(b,6356094.667915204)(no_defs)}, {37007, srs::dpar::parameters<>(proj_longlat)(a,6376896)(b,6355834.846687363)(no_defs)}, {37008, srs::dpar::parameters<>(proj_longlat)(r,6370997)(no_defs)}, {37201, srs::dpar::parameters<>(proj_longlat)(ellps_intl)(no_defs)}, {37202, srs::dpar::parameters<>(proj_longlat)(a,6377276.345)(b,6356075.41314024)(no_defs)}, {37203, srs::dpar::parameters<>(proj_longlat)(a,6377301.243)(b,6356100.230165384)(no_defs)}, {37204, srs::dpar::parameters<>(proj_longlat)(ellps_intl)(no_defs)}, {37205, srs::dpar::parameters<>(proj_longlat)(ellps_intl)(no_defs)}, {37206, srs::dpar::parameters<>(proj_longlat)(ellps_clrk80)(no_defs)}, {37207, srs::dpar::parameters<>(proj_longlat)(ellps_fschr60m)(no_defs)}, {37208, srs::dpar::parameters<>(proj_longlat)(ellps_clrk80)(no_defs)}, {37211, srs::dpar::parameters<>(proj_longlat)(ellps_clrk80)(no_defs)}, {37212, srs::dpar::parameters<>(proj_longlat)(ellps_intl)(no_defs)}, {37213, srs::dpar::parameters<>(proj_longlat)(ellps_intl)(no_defs)}, {37214, srs::dpar::parameters<>(proj_longlat)(ellps_intl)(no_defs)}, {37215, srs::dpar::parameters<>(proj_longlat)(ellps_intl)(no_defs)}, {37216, srs::dpar::parameters<>(proj_longlat)(ellps_intl)(no_defs)}, {37217, srs::dpar::parameters<>(proj_longlat)(ellps_intl)(no_defs)}, {37218, srs::dpar::parameters<>(proj_longlat)(ellps_intl)(no_defs)}, {37219, srs::dpar::parameters<>(proj_longlat)(ellps_intl)(no_defs)}, {37220, srs::dpar::parameters<>(proj_longlat)(ellps_clrk66)(no_defs)}, {37221, srs::dpar::parameters<>(proj_longlat)(ellps_intl)(no_defs)}, {37222, srs::dpar::parameters<>(proj_longlat)(ellps_intl)(no_defs)}, {37223, srs::dpar::parameters<>(proj_longlat)(a,6378249.2)(b,6356514.999904194)(no_defs)}, {37224, srs::dpar::parameters<>(proj_longlat)(ellps_intl)(no_defs)}, {37226, srs::dpar::parameters<>(proj_longlat)(ellps_intl)(no_defs)}, {37227, srs::dpar::parameters<>(proj_longlat)(ellps_intl)(no_defs)}, {37228, srs::dpar::parameters<>(proj_longlat)(ellps_clrk80)(no_defs)}, {37229, srs::dpar::parameters<>(proj_longlat)(a,6378270)(b,6356794.343434343)(no_defs)}, {37230, srs::dpar::parameters<>(proj_longlat)(ellps_intl)(no_defs)}, {37231, srs::dpar::parameters<>(proj_longlat)(ellps_aust_sa)(no_defs)}, {37232, srs::dpar::parameters<>(proj_longlat)(ellps_intl)(no_defs)}, {37233, srs::dpar::parameters<>(proj_longlat)(ellps_intl)(no_defs)}, {37234, srs::dpar::parameters<>(proj_longlat)(ellps_intl)(no_defs)}, {37235, srs::dpar::parameters<>(proj_longlat)(ellps_intl)(no_defs)}, {37237, srs::dpar::parameters<>(proj_longlat)(ellps_intl)(no_defs)}, {37238, srs::dpar::parameters<>(proj_longlat)(ellps_intl)(no_defs)}, {37239, srs::dpar::parameters<>(proj_longlat)(ellps_clrk66)(no_defs)}, {37240, srs::dpar::parameters<>(proj_longlat)(ellps_clrk80)(no_defs)}, {37241, srs::dpar::parameters<>(proj_longlat)(ellps_intl)(no_defs)}, {37242, srs::dpar::parameters<>(proj_longlat)(ellps_intl)(no_defs)}, {37243, srs::dpar::parameters<>(proj_longlat)(ellps_clrk66)(no_defs)}, {37245, srs::dpar::parameters<>(proj_longlat)(ellps_intl)(no_defs)}, {37246, srs::dpar::parameters<>(proj_longlat)(ellps_intl)(no_defs)}, {37247, srs::dpar::parameters<>(proj_longlat)(ellps_intl)(no_defs)}, {37249, srs::dpar::parameters<>(proj_longlat)(ellps_intl)(no_defs)}, {37250, srs::dpar::parameters<>(proj_longlat)(ellps_intl)(no_defs)}, {37251, srs::dpar::parameters<>(proj_longlat)(ellps_intl)(no_defs)}, {37252, srs::dpar::parameters<>(proj_longlat)(ellps_clrk66)(no_defs)}, {37253, srs::dpar::parameters<>(proj_longlat)(ellps_intl)(no_defs)}, {37254, srs::dpar::parameters<>(proj_longlat)(ellps_clrk80)(no_defs)}, {37255, srs::dpar::parameters<>(proj_longlat)(ellps_bessel)(no_defs)}, {37257, srs::dpar::parameters<>(proj_longlat)(ellps_krass)(no_defs)}, {37259, srs::dpar::parameters<>(proj_longlat)(ellps_intl)(no_defs)}, {37260, srs::dpar::parameters<>(proj_longlat)(ellps_clrk66)(no_defs)}, //{53001}, {53002, srs::dpar::parameters<>(proj_eqc)(lat_ts,60)(lat_0,0)(lon_0,0)(x_0,0)(y_0,0)(r,6371000)(units_m)(no_defs)}, {53003, srs::dpar::parameters<>(proj_mill)(lat_0,0)(lon_0,0)(x_0,0)(y_0,0)(r_au)(r,6371000)(units_m)(no_defs)}, {53004, srs::dpar::parameters<>(proj_merc)(lon_0,0)(k,1)(x_0,0)(y_0,0)(r,6371000)(units_m)(no_defs)}, {53008, srs::dpar::parameters<>(proj_sinu)(lon_0,0)(x_0,0)(y_0,0)(r,6371000)(units_m)(no_defs)}, {53009, srs::dpar::parameters<>(proj_moll)(lon_0,0)(x_0,0)(y_0,0)(r,6371000)(units_m)(no_defs)}, {53010, srs::dpar::parameters<>(proj_eck6)(lon_0,0)(x_0,0)(y_0,0)(r,6371000)(units_m)(no_defs)}, //{53011}, {53012, srs::dpar::parameters<>(proj_eck4)(lon_0,0)(x_0,0)(y_0,0)(r,6371000)(units_m)(no_defs)}, //{53013}, //{53014}, //{53015}, {53016, srs::dpar::parameters<>(proj_gall)(lon_0,0)(x_0,0)(y_0,0)(r,6371000)(units_m)(no_defs)}, //{53017}, //{53018}, //{53019}, {53021, srs::dpar::parameters<>(proj_poly)(lat_0,0)(lon_0,0)(x_0,0)(y_0,0)(r,6371000)(units_m)(no_defs)}, //{53022}, //{53023}, {53024, srs::dpar::parameters<>(proj_bonne)(lon_0,0)(lat_1,60)(x_0,0)(y_0,0)(r,6371000)(units_m)(no_defs)}, {53025, srs::dpar::parameters<>(proj_omerc)(lat_0,40)(lon_1,0)(lat_1,0)(lon_2,0)(lat_2,0)(k,1)(x_0,0)(y_0,0)(r,6371000)(units_m)(no_defs)}, {53026, srs::dpar::parameters<>(proj_stere)(lat_0,0)(lon_0,0)(k,1)(x_0,0)(y_0,0)(r,6371000)(units_m)(no_defs)}, {53027, srs::dpar::parameters<>(proj_eqdc)(lat_0,0)(lon_0,0)(lat_1,60)(lat_2,60)(x_0,0)(y_0,0)(r,6371000)(units_m)(no_defs)}, {53028, srs::dpar::parameters<>(proj_cass)(lat_0,0)(lon_0,0)(x_0,0)(y_0,0)(r,6371000)(units_m)(no_defs)}, {53029, srs::dpar::parameters<>(proj_vandg)(lon_0,0)(x_0,0)(y_0,0)(r_au)(r,6371000)(units_m)(no_defs)}, {53030, srs::dpar::parameters<>(proj_robin)(lon_0,0)(x_0,0)(y_0,0)(r,6371000)(units_m)(no_defs)}, {53031, srs::dpar::parameters<>(proj_tpeqd)(lat_1,0)(lon_1,0)(lat_2,60)(lon_2,60)(x_0,0)(y_0,0)(r,6371000)(units_m)(no_defs)}, {53032, srs::dpar::parameters<>(proj_aeqd)(lat_0,0)(lon_0,0)(x_0,0)(y_0,0)(r,6371000)(units_m)(no_defs)}, //{54001}, {54002, srs::dpar::parameters<>(proj_eqc)(lat_ts,60)(lat_0,0)(lon_0,0)(x_0,0)(y_0,0)(ellps_wgs84)(srs::dpar::datum_wgs84)(units_m)(no_defs)}, {54003, srs::dpar::parameters<>(proj_mill)(lat_0,0)(lon_0,0)(x_0,0)(y_0,0)(r_au)(ellps_wgs84)(srs::dpar::datum_wgs84)(units_m)(no_defs)}, {54004, srs::dpar::parameters<>(proj_merc)(lon_0,0)(k,1)(x_0,0)(y_0,0)(ellps_wgs84)(srs::dpar::datum_wgs84)(units_m)(no_defs)}, {54008, srs::dpar::parameters<>(proj_sinu)(lon_0,0)(x_0,0)(y_0,0)(ellps_wgs84)(srs::dpar::datum_wgs84)(units_m)(no_defs)}, {54009, srs::dpar::parameters<>(proj_moll)(lon_0,0)(x_0,0)(y_0,0)(ellps_wgs84)(srs::dpar::datum_wgs84)(units_m)(no_defs)}, {54010, srs::dpar::parameters<>(proj_eck6)(lon_0,0)(x_0,0)(y_0,0)(ellps_wgs84)(srs::dpar::datum_wgs84)(units_m)(no_defs)}, //{54011}, {54012, srs::dpar::parameters<>(proj_eck4)(lon_0,0)(x_0,0)(y_0,0)(ellps_wgs84)(srs::dpar::datum_wgs84)(units_m)(no_defs)}, //{54013}, //{54014}, //{54015}, {54016, srs::dpar::parameters<>(proj_gall)(lon_0,0)(x_0,0)(y_0,0)(ellps_wgs84)(srs::dpar::datum_wgs84)(units_m)(no_defs)}, //{54017}, //{54018}, //{54019}, {54021, srs::dpar::parameters<>(proj_poly)(lat_0,0)(lon_0,0)(x_0,0)(y_0,0)(ellps_wgs84)(srs::dpar::datum_wgs84)(units_m)(no_defs)}, //{54022}, //{54023}, {54024, srs::dpar::parameters<>(proj_bonne)(lon_0,0)(lat_1,60)(x_0,0)(y_0,0)(ellps_wgs84)(srs::dpar::datum_wgs84)(units_m)(no_defs)}, {54025, srs::dpar::parameters<>(proj_omerc)(lat_0,40)(lon_1,0)(lat_1,0)(lon_2,0)(lat_2,0)(k,1)(x_0,0)(y_0,0)(ellps_wgs84)(srs::dpar::datum_wgs84)(units_m)(no_defs)}, {54026, srs::dpar::parameters<>(proj_stere)(lat_0,0)(lon_0,0)(k,1)(x_0,0)(y_0,0)(ellps_wgs84)(srs::dpar::datum_wgs84)(units_m)(no_defs)}, {54027, srs::dpar::parameters<>(proj_eqdc)(lat_0,0)(lon_0,0)(lat_1,60)(lat_2,60)(x_0,0)(y_0,0)(ellps_wgs84)(srs::dpar::datum_wgs84)(units_m)(no_defs)}, {54028, srs::dpar::parameters<>(proj_cass)(lat_0,0)(lon_0,0)(x_0,0)(y_0,0)(ellps_wgs84)(srs::dpar::datum_wgs84)(units_m)(no_defs)}, {54029, srs::dpar::parameters<>(proj_vandg)(lon_0,0)(x_0,0)(y_0,0)(r_au)(ellps_wgs84)(srs::dpar::datum_wgs84)(units_m)(no_defs)}, {54030, srs::dpar::parameters<>(proj_robin)(lon_0,0)(x_0,0)(y_0,0)(ellps_wgs84)(srs::dpar::datum_wgs84)(units_m)(no_defs)}, {54031, srs::dpar::parameters<>(proj_tpeqd)(lat_1,0)(lon_1,0)(lat_2,60)(lon_2,60)(x_0,0)(y_0,0)(ellps_wgs84)(srs::dpar::datum_wgs84)(units_m)(no_defs)}, {54032, srs::dpar::parameters<>(proj_aeqd)(lat_0,0)(lon_0,0)(x_0,0)(y_0,0)(ellps_wgs84)(srs::dpar::datum_wgs84)(units_m)(no_defs)}, {65061, srs::dpar::parameters<>(proj_poly)(lat_0,13.47246635277778)(lon_0,-144.7487507055556)(x_0,50000.00000000001)(y_0,50000.00000000001)(ellps_clrk66)(srs::dpar::datum_nad27)(to_meter,0.3048006096012192)(no_defs)}, {65161, srs::dpar::parameters<>(proj_poly)(lat_0,13.47246635277778)(lon_0,-144.7487507055556)(x_0,50000)(y_0,50000)(ellps_grs80)(srs::dpar::datum_nad83)(units_m)(no_defs)}, {102001, srs::dpar::parameters<>(proj_aea)(lat_1,50)(lat_2,70)(lat_0,40)(lon_0,-96)(x_0,0)(y_0,0)(ellps_grs80)(srs::dpar::datum_nad83)(units_m)(no_defs)}, {102002, srs::dpar::parameters<>(proj_lcc)(lat_1,50)(lat_2,70)(lat_0,40)(lon_0,-96)(x_0,0)(y_0,0)(ellps_grs80)(srs::dpar::datum_nad83)(units_m)(no_defs)}, {102003, srs::dpar::parameters<>(proj_aea)(lat_1,29.5)(lat_2,45.5)(lat_0,37.5)(lon_0,-96)(x_0,0)(y_0,0)(ellps_grs80)(srs::dpar::datum_nad83)(units_m)(no_defs)}, {102004, srs::dpar::parameters<>(proj_lcc)(lat_1,33)(lat_2,45)(lat_0,39)(lon_0,-96)(x_0,0)(y_0,0)(ellps_grs80)(srs::dpar::datum_nad83)(units_m)(no_defs)}, {102005, srs::dpar::parameters<>(proj_eqdc)(lat_0,0)(lon_0,0)(lat_1,33)(lat_2,45)(x_0,0)(y_0,0)(ellps_grs80)(srs::dpar::datum_nad83)(units_m)(no_defs)}, {102006, srs::dpar::parameters<>(proj_aea)(lat_1,55)(lat_2,65)(lat_0,50)(lon_0,-154)(x_0,0)(y_0,0)(ellps_grs80)(srs::dpar::datum_nad83)(units_m)(no_defs)}, {102007, srs::dpar::parameters<>(proj_aea)(lat_1,8)(lat_2,18)(lat_0,13)(lon_0,-157)(x_0,0)(y_0,0)(ellps_grs80)(srs::dpar::datum_nad83)(units_m)(no_defs)}, {102008, srs::dpar::parameters<>(proj_aea)(lat_1,20)(lat_2,60)(lat_0,40)(lon_0,-96)(x_0,0)(y_0,0)(ellps_grs80)(srs::dpar::datum_nad83)(units_m)(no_defs)}, {102009, srs::dpar::parameters<>(proj_lcc)(lat_1,20)(lat_2,60)(lat_0,40)(lon_0,-96)(x_0,0)(y_0,0)(ellps_grs80)(srs::dpar::datum_nad83)(units_m)(no_defs)}, {102010, srs::dpar::parameters<>(proj_eqdc)(lat_0,0)(lon_0,0)(lat_1,20)(lat_2,60)(x_0,0)(y_0,0)(ellps_grs80)(srs::dpar::datum_nad83)(units_m)(no_defs)}, {102011, srs::dpar::parameters<>(proj_sinu)(lon_0,0)(x_0,0)(y_0,0)(ellps_wgs84)(srs::dpar::datum_wgs84)(units_m)(no_defs)}, {102012, srs::dpar::parameters<>(proj_lcc)(lat_1,30)(lat_2,62)(lat_0,0)(lon_0,105)(x_0,0)(y_0,0)(ellps_wgs84)(srs::dpar::datum_wgs84)(units_m)(no_defs)}, {102013, srs::dpar::parameters<>(proj_aea)(lat_1,43)(lat_2,62)(lat_0,30)(lon_0,10)(x_0,0)(y_0,0)(ellps_intl)(units_m)(no_defs)}, {102014, srs::dpar::parameters<>(proj_lcc)(lat_1,43)(lat_2,62)(lat_0,30)(lon_0,10)(x_0,0)(y_0,0)(ellps_intl)(units_m)(no_defs)}, {102015, srs::dpar::parameters<>(proj_lcc)(lat_1,-5)(lat_2,-42)(lat_0,-32)(lon_0,-60)(x_0,0)(y_0,0)(ellps_aust_sa)(units_m)(no_defs)}, {102016, srs::dpar::parameters<>(proj_aeqd)(lat_0,90)(lon_0,0)(x_0,0)(y_0,0)(ellps_wgs84)(srs::dpar::datum_wgs84)(units_m)(no_defs)}, {102017, srs::dpar::parameters<>(proj_laea)(lat_0,90)(lon_0,0)(x_0,0)(y_0,0)(ellps_wgs84)(srs::dpar::datum_wgs84)(units_m)(no_defs)}, {102018, srs::dpar::parameters<>(proj_stere)(lat_0,90)(lon_0,0)(k,1)(x_0,0)(y_0,0)(ellps_wgs84)(srs::dpar::datum_wgs84)(units_m)(no_defs)}, {102019, srs::dpar::parameters<>(proj_aeqd)(lat_0,-90)(lon_0,0)(x_0,0)(y_0,0)(ellps_wgs84)(srs::dpar::datum_wgs84)(units_m)(no_defs)}, {102020, srs::dpar::parameters<>(proj_laea)(lat_0,-90)(lon_0,0)(x_0,0)(y_0,0)(ellps_wgs84)(srs::dpar::datum_wgs84)(units_m)(no_defs)}, {102021, srs::dpar::parameters<>(proj_stere)(lat_0,-90)(lon_0,0)(k,1)(x_0,0)(y_0,0)(ellps_wgs84)(srs::dpar::datum_wgs84)(units_m)(no_defs)}, {102022, srs::dpar::parameters<>(proj_aea)(lat_1,20)(lat_2,-23)(lat_0,0)(lon_0,25)(x_0,0)(y_0,0)(ellps_wgs84)(srs::dpar::datum_wgs84)(units_m)(no_defs)}, {102023, srs::dpar::parameters<>(proj_eqdc)(lat_0,0)(lon_0,0)(lat_1,20)(lat_2,-23)(x_0,0)(y_0,0)(ellps_wgs84)(srs::dpar::datum_wgs84)(units_m)(no_defs)}, {102024, srs::dpar::parameters<>(proj_lcc)(lat_1,20)(lat_2,-23)(lat_0,0)(lon_0,25)(x_0,0)(y_0,0)(ellps_wgs84)(srs::dpar::datum_wgs84)(units_m)(no_defs)}, {102025, srs::dpar::parameters<>(proj_aea)(lat_1,15)(lat_2,65)(lat_0,30)(lon_0,95)(x_0,0)(y_0,0)(ellps_wgs84)(srs::dpar::datum_wgs84)(units_m)(no_defs)}, {102026, srs::dpar::parameters<>(proj_eqdc)(lat_0,0)(lon_0,0)(lat_1,15)(lat_2,65)(x_0,0)(y_0,0)(ellps_wgs84)(srs::dpar::datum_wgs84)(units_m)(no_defs)}, {102027, srs::dpar::parameters<>(proj_lcc)(lat_1,15)(lat_2,65)(lat_0,30)(lon_0,95)(x_0,0)(y_0,0)(ellps_wgs84)(srs::dpar::datum_wgs84)(units_m)(no_defs)}, {102028, srs::dpar::parameters<>(proj_aea)(lat_1,7)(lat_2,-32)(lat_0,-15)(lon_0,125)(x_0,0)(y_0,0)(ellps_wgs84)(srs::dpar::datum_wgs84)(units_m)(no_defs)}, {102029, srs::dpar::parameters<>(proj_eqdc)(lat_0,0)(lon_0,0)(lat_1,7)(lat_2,-32)(x_0,0)(y_0,0)(ellps_wgs84)(srs::dpar::datum_wgs84)(units_m)(no_defs)}, {102030, srs::dpar::parameters<>(proj_lcc)(lat_1,7)(lat_2,-32)(lat_0,-15)(lon_0,125)(x_0,0)(y_0,0)(ellps_wgs84)(srs::dpar::datum_wgs84)(units_m)(no_defs)}, {102031, srs::dpar::parameters<>(proj_eqdc)(lat_0,0)(lon_0,0)(lat_1,43)(lat_2,62)(x_0,0)(y_0,0)(ellps_intl)(units_m)(no_defs)}, {102032, srs::dpar::parameters<>(proj_eqdc)(lat_0,0)(lon_0,0)(lat_1,-5)(lat_2,-42)(x_0,0)(y_0,0)(ellps_aust_sa)(units_m)(no_defs)}, {102033, srs::dpar::parameters<>(proj_aea)(lat_1,-5)(lat_2,-42)(lat_0,-32)(lon_0,-60)(x_0,0)(y_0,0)(ellps_aust_sa)(units_m)(no_defs)}, {102065, srs::dpar::parameters<>(proj_krovak)(lat_0,49.5)(lon_0,24.83333333333333)(alpha,30.28813975277778)(k,0.9999)(x_0,0)(y_0,0)(ellps_bessel)(units_m)(no_defs)}, {102066, srs::dpar::parameters<>(proj_krovak)(lat_0,49.5)(lon_0,42.5)(alpha,30.28813975277778)(k,0.9999)(x_0,0)(y_0,0)(ellps_bessel)(pm,-17.66666666666667)(units_m)(no_defs)}, {102067, srs::dpar::parameters<>(proj_krovak)(lat_0,49.5)(lon_0,24.83333333333333)(alpha,30.28813975277778)(k,0.9999)(x_0,0)(y_0,0)(ellps_bessel)(units_m)(no_defs)}, {102091, srs::dpar::parameters<>(proj_tmerc)(lat_0,0)(lon_0,9)(k,0.9996)(x_0,1500000)(y_0,0)(ellps_intl)(units_m)(no_defs)}, {102092, srs::dpar::parameters<>(proj_tmerc)(lat_0,0)(lon_0,15)(k,0.9996)(x_0,2520000)(y_0,0)(ellps_intl)(units_m)(no_defs)}, {102101, srs::dpar::parameters<>(proj_tmerc)(lat_0,58)(lon_0,6.05625)(k,1)(x_0,0)(y_0,0)(a,6377492.018)(b,6356173.508712696)(units_m)(no_defs)}, {102102, srs::dpar::parameters<>(proj_tmerc)(lat_0,58)(lon_0,8.389583333333333)(k,1)(x_0,0)(y_0,0)(a,6377492.018)(b,6356173.508712696)(units_m)(no_defs)}, {102103, srs::dpar::parameters<>(proj_tmerc)(lat_0,58)(lon_0,10.72291666666667)(k,1)(x_0,0)(y_0,0)(a,6377492.018)(b,6356173.508712696)(units_m)(no_defs)}, {102104, srs::dpar::parameters<>(proj_tmerc)(lat_0,58)(lon_0,13.22291666666667)(k,1)(x_0,0)(y_0,0)(a,6377492.018)(b,6356173.508712696)(units_m)(no_defs)}, {102105, srs::dpar::parameters<>(proj_tmerc)(lat_0,58)(lon_0,16.88958333333333)(k,1)(x_0,0)(y_0,0)(a,6377492.018)(b,6356173.508712696)(units_m)(no_defs)}, {102106, srs::dpar::parameters<>(proj_tmerc)(lat_0,58)(lon_0,20.88958333333333)(k,1)(x_0,0)(y_0,0)(a,6377492.018)(b,6356173.508712696)(units_m)(no_defs)}, {102107, srs::dpar::parameters<>(proj_tmerc)(lat_0,58)(lon_0,24.88958333333333)(k,1)(x_0,0)(y_0,0)(a,6377492.018)(b,6356173.508712696)(units_m)(no_defs)}, {102108, srs::dpar::parameters<>(proj_tmerc)(lat_0,58)(lon_0,29.05625)(k,1)(x_0,0)(y_0,0)(a,6377492.018)(b,6356173.508712696)(units_m)(no_defs)}, {102110, srs::dpar::parameters<>(proj_lcc)(lat_1,44)(lat_2,49)(lat_0,46.5)(lon_0,3)(x_0,700000)(y_0,6600000)(ellps_grs80)(units_m)(no_defs)}, {102114, srs::dpar::parameters<>(proj_utm)(zone,4)(ellps_clrk66)(units_m)(no_defs)}, {102115, srs::dpar::parameters<>(proj_utm)(zone,5)(ellps_clrk66)(units_m)(no_defs)}, {102120, srs::dpar::parameters<>(proj_omerc)(lat_0,45.30916666666666)(lonc,-86)(alpha,337.255555555556)(k,0.9996)(x_0,2546731.495961392)(y_0,-4354009.816002033)(ellps_clrk66)(srs::dpar::datum_nad27)(to_meter,0.3048006096012192)(no_defs)}, {102121, srs::dpar::parameters<>(proj_omerc)(lat_0,45.30916666666666)(lonc,-86)(alpha,337.255555555556)(k,0.9996)(x_0,2546731.495961392)(y_0,-4354009.816002033)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102122, srs::dpar::parameters<>(proj_omerc)(lat_0,45.30916666666666)(lonc,-86)(alpha,337.255555555556)(k,0.9996)(x_0,2546731.496)(y_0,-4354009.816)(ellps_clrk66)(srs::dpar::datum_nad27)(units_m)(no_defs)}, {102123, srs::dpar::parameters<>(proj_omerc)(lat_0,45.30916666666666)(lonc,-86)(alpha,337.255555555556)(k,0.9996)(x_0,2546731.496)(y_0,-4354009.816)(ellps_grs80)(srs::dpar::datum_nad83)(units_m)(no_defs)}, {102132, srs::dpar::parameters<>(proj_utm)(zone,32)(a,6377492.018)(b,6356173.508712696)(units_m)(no_defs)}, {102133, srs::dpar::parameters<>(proj_utm)(zone,33)(a,6377492.018)(b,6356173.508712696)(units_m)(no_defs)}, {102134, srs::dpar::parameters<>(proj_utm)(zone,34)(a,6377492.018)(b,6356173.508712696)(units_m)(no_defs)}, {102135, srs::dpar::parameters<>(proj_utm)(zone,35)(a,6377492.018)(b,6356173.508712696)(units_m)(no_defs)}, {102140, srs::dpar::parameters<>(proj_tmerc)(lat_0,22.31213333333334)(lon_0,114.1785555555556)(k,1)(x_0,836694.05)(y_0,819069.8)(ellps_intl)(units_m)(no_defs)}, {102141, srs::dpar::parameters<>(proj_utm)(zone,49)(ellps_intl)(units_m)(no_defs)}, {102142, srs::dpar::parameters<>(proj_utm)(zone,50)(ellps_intl)(units_m)(no_defs)}, {102151, srs::dpar::parameters<>(proj_utm)(zone,51)(ellps_bessel)(units_m)(no_defs)}, {102152, srs::dpar::parameters<>(proj_utm)(zone,52)(ellps_bessel)(units_m)(no_defs)}, {102153, srs::dpar::parameters<>(proj_utm)(zone,53)(ellps_bessel)(units_m)(no_defs)}, {102154, srs::dpar::parameters<>(proj_utm)(zone,54)(ellps_bessel)(units_m)(no_defs)}, {102155, srs::dpar::parameters<>(proj_utm)(zone,55)(ellps_bessel)(units_m)(no_defs)}, {102156, srs::dpar::parameters<>(proj_utm)(zone,56)(ellps_bessel)(units_m)(no_defs)}, {102160, srs::dpar::parameters<>(proj_tmerc)(lat_0,39.66666666666666)(lon_0,-8.131906111111112)(k,1)(x_0,200180.598)(y_0,299913.01)(ellps_intl)(units_m)(no_defs)}, {102161, srs::dpar::parameters<>(proj_tmerc)(lat_0,39.66666666666666)(lon_0,-8.131906111111112)(k,1)(x_0,180.598)(y_0,-86.98999999999999)(ellps_intl)(units_m)(no_defs)}, {102162, srs::dpar::parameters<>(proj_utm)(zone,26)(ellps_intl)(units_m)(no_defs)}, {102163, srs::dpar::parameters<>(proj_bonne)(lon_0,-8.131906111111112)(lat_1,39.66666666666666)(x_0,0)(y_0,0)(ellps_bessel)(units_m)(no_defs)}, {102164, srs::dpar::parameters<>(proj_tmerc)(lat_0,39.66666666666666)(lon_0,-8.131906111111112)(k,1)(x_0,200000)(y_0,300000)(ellps_intl)(units_m)(no_defs)}, {102165, srs::dpar::parameters<>(proj_tmerc)(lat_0,39.66666666666666)(lon_0,-8.131906111111112)(k,1)(x_0,0)(y_0,0)(ellps_intl)(units_m)(no_defs)}, {102166, srs::dpar::parameters<>(proj_utm)(zone,25)(ellps_intl)(units_m)(no_defs)}, {102167, srs::dpar::parameters<>(proj_utm)(zone,28)(ellps_intl)(units_m)(no_defs)}, {102168, srs::dpar::parameters<>(proj_utm)(zone,26)(ellps_intl)(units_m)(no_defs)}, {102169, srs::dpar::parameters<>(proj_utm)(zone,28)(ellps_intl)(units_m)(no_defs)}, {102191, srs::dpar::parameters<>(proj_lcc)(lat_1,33.3)(lat_0,33.3)(lon_0,-5.4)(k_0,0.999625769)(x_0,500000)(y_0,300000)(a,6378249.2)(b,6356514.999904194)(units_m)(no_defs)}, {102192, srs::dpar::parameters<>(proj_lcc)(lat_1,29.7)(lat_0,29.7)(lon_0,-5.4)(k_0,0.9996155960000001)(x_0,500000)(y_0,300000)(a,6378249.2)(b,6356514.999904194)(units_m)(no_defs)}, {102193, srs::dpar::parameters<>(proj_lcc)(lat_1,26.1)(lat_0,26.1)(lon_0,-5.4)(k_0,0.9996)(x_0,1200000)(y_0,400000)(a,6378249.2)(b,6356514.999904194)(units_m)(no_defs)}, {102229, srs::dpar::parameters<>(proj_tmerc)(lat_0,30.5)(lon_0,-85.83333333333333)(k,0.99996)(x_0,200000)(y_0,0)(ellps_grs80)(units_m)(no_defs)}, {102230, srs::dpar::parameters<>(proj_tmerc)(lat_0,30)(lon_0,-87.5)(k,0.9999333333333333)(x_0,600000)(y_0,0)(ellps_grs80)(units_m)(no_defs)}, {102241, srs::dpar::parameters<>(proj_lcc)(lat_1,40)(lat_2,41.66666666666666)(lat_0,39.33333333333334)(lon_0,-122)(x_0,2000000)(y_0,500000)(ellps_grs80)(units_m)(no_defs)}, {102242, srs::dpar::parameters<>(proj_lcc)(lat_1,38.33333333333334)(lat_2,39.83333333333334)(lat_0,37.66666666666666)(lon_0,-122)(x_0,2000000)(y_0,500000)(ellps_grs80)(units_m)(no_defs)}, {102243, srs::dpar::parameters<>(proj_lcc)(lat_1,37.06666666666667)(lat_2,38.43333333333333)(lat_0,36.5)(lon_0,-120.5)(x_0,2000000)(y_0,500000)(ellps_grs80)(units_m)(no_defs)}, {102244, srs::dpar::parameters<>(proj_lcc)(lat_1,36)(lat_2,37.25)(lat_0,35.33333333333334)(lon_0,-119)(x_0,2000000)(y_0,500000)(ellps_grs80)(units_m)(no_defs)}, {102245, srs::dpar::parameters<>(proj_lcc)(lat_1,34.03333333333333)(lat_2,35.46666666666667)(lat_0,33.5)(lon_0,-118)(x_0,2000000)(y_0,500000)(ellps_grs80)(units_m)(no_defs)}, {102246, srs::dpar::parameters<>(proj_lcc)(lat_1,32.78333333333333)(lat_2,33.88333333333333)(lat_0,32.16666666666666)(lon_0,-116.25)(x_0,2000000)(y_0,500000)(ellps_grs80)(units_m)(no_defs)}, {102248, srs::dpar::parameters<>(proj_tmerc)(lat_0,31)(lon_0,-110.1666666666667)(k,0.9999)(x_0,213360)(y_0,0)(ellps_grs80)(units_m)(no_defs)}, {102249, srs::dpar::parameters<>(proj_tmerc)(lat_0,31)(lon_0,-111.9166666666667)(k,0.9999)(x_0,213360)(y_0,0)(ellps_grs80)(units_m)(no_defs)}, {102250, srs::dpar::parameters<>(proj_tmerc)(lat_0,31)(lon_0,-113.75)(k,0.9999333333333333)(x_0,213360)(y_0,0)(ellps_grs80)(units_m)(no_defs)}, {102251, srs::dpar::parameters<>(proj_lcc)(lat_1,34.93333333333333)(lat_2,36.23333333333333)(lat_0,34.33333333333334)(lon_0,-92)(x_0,400000)(y_0,0)(ellps_grs80)(units_m)(no_defs)}, {102252, srs::dpar::parameters<>(proj_lcc)(lat_1,33.3)(lat_2,34.76666666666667)(lat_0,32.66666666666666)(lon_0,-92)(x_0,400000)(y_0,400000)(ellps_grs80)(units_m)(no_defs)}, {102253, srs::dpar::parameters<>(proj_lcc)(lat_1,39.71666666666667)(lat_2,40.78333333333333)(lat_0,39.33333333333334)(lon_0,-105.5)(x_0,914401.8289)(y_0,304800.6096)(ellps_grs80)(units_m)(no_defs)}, {102254, srs::dpar::parameters<>(proj_lcc)(lat_1,38.45)(lat_2,39.75)(lat_0,37.83333333333334)(lon_0,-105.5)(x_0,914401.8289)(y_0,304800.6096)(ellps_grs80)(units_m)(no_defs)}, {102255, srs::dpar::parameters<>(proj_lcc)(lat_1,37.23333333333333)(lat_2,38.43333333333333)(lat_0,36.66666666666666)(lon_0,-105.5)(x_0,914401.8289)(y_0,304800.6096)(ellps_grs80)(units_m)(no_defs)}, {102256, srs::dpar::parameters<>(proj_lcc)(lat_1,41.2)(lat_2,41.86666666666667)(lat_0,40.83333333333334)(lon_0,-72.75)(x_0,304800.6096)(y_0,152400.3048)(ellps_grs80)(units_m)(no_defs)}, {102257, srs::dpar::parameters<>(proj_tmerc)(lat_0,38)(lon_0,-75.41666666666667)(k,0.999995)(x_0,200000)(y_0,0)(ellps_grs80)(units_m)(no_defs)}, {102258, srs::dpar::parameters<>(proj_tmerc)(lat_0,24.33333333333333)(lon_0,-81)(k,0.9999411764705882)(x_0,200000)(y_0,0)(ellps_grs80)(units_m)(no_defs)}, {102259, srs::dpar::parameters<>(proj_tmerc)(lat_0,24.33333333333333)(lon_0,-82)(k,0.9999411764705882)(x_0,200000)(y_0,0)(ellps_grs80)(units_m)(no_defs)}, {102260, srs::dpar::parameters<>(proj_lcc)(lat_1,29.58333333333333)(lat_2,30.75)(lat_0,29)(lon_0,-84.5)(x_0,600000)(y_0,0)(ellps_grs80)(units_m)(no_defs)}, {102261, srs::dpar::parameters<>(proj_tmerc)(lat_0,18.83333333333333)(lon_0,-155.5)(k,0.9999666666666667)(x_0,500000)(y_0,0)(ellps_grs80)(units_m)(no_defs)}, {102262, srs::dpar::parameters<>(proj_tmerc)(lat_0,20.33333333333333)(lon_0,-156.6666666666667)(k,0.9999666666666667)(x_0,500000)(y_0,0)(ellps_grs80)(units_m)(no_defs)}, {102263, srs::dpar::parameters<>(proj_tmerc)(lat_0,21.16666666666667)(lon_0,-158)(k,0.99999)(x_0,500000)(y_0,0)(ellps_grs80)(units_m)(no_defs)}, {102264, srs::dpar::parameters<>(proj_tmerc)(lat_0,21.83333333333333)(lon_0,-159.5)(k,0.99999)(x_0,500000)(y_0,0)(ellps_grs80)(units_m)(no_defs)}, {102265, srs::dpar::parameters<>(proj_tmerc)(lat_0,21.66666666666667)(lon_0,-160.1666666666667)(k,1)(x_0,500000)(y_0,0)(ellps_grs80)(units_m)(no_defs)}, {102266, srs::dpar::parameters<>(proj_tmerc)(lat_0,30)(lon_0,-82.16666666666667)(k,0.9999)(x_0,200000)(y_0,0)(ellps_grs80)(units_m)(no_defs)}, {102267, srs::dpar::parameters<>(proj_tmerc)(lat_0,30)(lon_0,-84.16666666666667)(k,0.9999)(x_0,700000)(y_0,0)(ellps_grs80)(units_m)(no_defs)}, {102268, srs::dpar::parameters<>(proj_tmerc)(lat_0,41.66666666666666)(lon_0,-112.1666666666667)(k,0.9999473684210526)(x_0,200000)(y_0,0)(ellps_grs80)(units_m)(no_defs)}, {102269, srs::dpar::parameters<>(proj_tmerc)(lat_0,41.66666666666666)(lon_0,-114)(k,0.9999473684210526)(x_0,500000)(y_0,0)(ellps_grs80)(units_m)(no_defs)}, {102270, srs::dpar::parameters<>(proj_tmerc)(lat_0,41.66666666666666)(lon_0,-115.75)(k,0.9999333333333333)(x_0,800000)(y_0,0)(ellps_grs80)(units_m)(no_defs)}, {102271, srs::dpar::parameters<>(proj_tmerc)(lat_0,36.66666666666666)(lon_0,-88.33333333333333)(k,0.9999749999999999)(x_0,300000)(y_0,0)(ellps_grs80)(units_m)(no_defs)}, {102272, srs::dpar::parameters<>(proj_tmerc)(lat_0,36.66666666666666)(lon_0,-90.16666666666667)(k,0.9999411764705882)(x_0,700000)(y_0,0)(ellps_grs80)(units_m)(no_defs)}, {102273, srs::dpar::parameters<>(proj_tmerc)(lat_0,37.5)(lon_0,-85.66666666666667)(k,0.9999666666666667)(x_0,100000)(y_0,250000)(ellps_grs80)(units_m)(no_defs)}, {102274, srs::dpar::parameters<>(proj_tmerc)(lat_0,37.5)(lon_0,-87.08333333333333)(k,0.9999666666666667)(x_0,900000)(y_0,250000)(ellps_grs80)(units_m)(no_defs)}, {102277, srs::dpar::parameters<>(proj_lcc)(lat_1,38.71666666666667)(lat_2,39.78333333333333)(lat_0,38.33333333333334)(lon_0,-98)(x_0,400000)(y_0,0)(ellps_grs80)(units_m)(no_defs)}, {102278, srs::dpar::parameters<>(proj_lcc)(lat_1,37.26666666666667)(lat_2,38.56666666666667)(lat_0,36.66666666666666)(lon_0,-98.5)(x_0,400000)(y_0,400000)(ellps_grs80)(units_m)(no_defs)}, {102279, srs::dpar::parameters<>(proj_lcc)(lat_1,37.96666666666667)(lat_2,38.96666666666667)(lat_0,37.5)(lon_0,-84.25)(x_0,500000)(y_0,0)(ellps_grs80)(units_m)(no_defs)}, {102280, srs::dpar::parameters<>(proj_lcc)(lat_1,36.73333333333333)(lat_2,37.93333333333333)(lat_0,36.33333333333334)(lon_0,-85.75)(x_0,500000)(y_0,500000)(ellps_grs80)(units_m)(no_defs)}, {102281, srs::dpar::parameters<>(proj_lcc)(lat_1,31.16666666666667)(lat_2,32.66666666666666)(lat_0,30.5)(lon_0,-92.5)(x_0,1000000)(y_0,0)(ellps_grs80)(units_m)(no_defs)}, {102282, srs::dpar::parameters<>(proj_lcc)(lat_1,29.3)(lat_2,30.7)(lat_0,28.5)(lon_0,-91.33333333333333)(x_0,1000000)(y_0,0)(ellps_grs80)(units_m)(no_defs)}, {102283, srs::dpar::parameters<>(proj_tmerc)(lat_0,43.66666666666666)(lon_0,-68.5)(k,0.9999)(x_0,300000)(y_0,0)(ellps_grs80)(units_m)(no_defs)}, {102284, srs::dpar::parameters<>(proj_tmerc)(lat_0,42.83333333333334)(lon_0,-70.16666666666667)(k,0.9999666666666667)(x_0,900000)(y_0,0)(ellps_grs80)(units_m)(no_defs)}, {102285, srs::dpar::parameters<>(proj_lcc)(lat_1,38.3)(lat_2,39.45)(lat_0,37.66666666666666)(lon_0,-77)(x_0,400000)(y_0,0)(ellps_grs80)(units_m)(no_defs)}, {102286, srs::dpar::parameters<>(proj_lcc)(lat_1,41.71666666666667)(lat_2,42.68333333333333)(lat_0,41)(lon_0,-71.5)(x_0,200000)(y_0,750000)(ellps_grs80)(units_m)(no_defs)}, {102287, srs::dpar::parameters<>(proj_lcc)(lat_1,41.28333333333333)(lat_2,41.48333333333333)(lat_0,41)(lon_0,-70.5)(x_0,500000)(y_0,0)(ellps_grs80)(units_m)(no_defs)}, {102288, srs::dpar::parameters<>(proj_lcc)(lat_1,45.48333333333333)(lat_2,47.08333333333334)(lat_0,44.78333333333333)(lon_0,-87)(x_0,8000000)(y_0,0)(ellps_grs80)(units_m)(no_defs)}, {102289, srs::dpar::parameters<>(proj_lcc)(lat_1,44.18333333333333)(lat_2,45.7)(lat_0,43.31666666666667)(lon_0,-84.36666666666666)(x_0,6000000)(y_0,0)(ellps_grs80)(units_m)(no_defs)}, {102290, srs::dpar::parameters<>(proj_lcc)(lat_1,42.1)(lat_2,43.66666666666666)(lat_0,41.5)(lon_0,-84.36666666666666)(x_0,4000000)(y_0,0)(ellps_grs80)(units_m)(no_defs)}, {102291, srs::dpar::parameters<>(proj_lcc)(lat_1,47.03333333333333)(lat_2,48.63333333333333)(lat_0,46.5)(lon_0,-93.09999999999999)(x_0,800000)(y_0,100000)(ellps_grs80)(units_m)(no_defs)}, {102292, srs::dpar::parameters<>(proj_lcc)(lat_1,45.61666666666667)(lat_2,47.05)(lat_0,45)(lon_0,-94.25)(x_0,800000)(y_0,100000)(ellps_grs80)(units_m)(no_defs)}, {102293, srs::dpar::parameters<>(proj_lcc)(lat_1,43.78333333333333)(lat_2,45.21666666666667)(lat_0,43)(lon_0,-94)(x_0,800000)(y_0,100000)(ellps_grs80)(units_m)(no_defs)}, {102294, srs::dpar::parameters<>(proj_tmerc)(lat_0,29.5)(lon_0,-88.83333333333333)(k,0.99995)(x_0,300000)(y_0,0)(ellps_grs80)(units_m)(no_defs)}, {102295, srs::dpar::parameters<>(proj_tmerc)(lat_0,29.5)(lon_0,-90.33333333333333)(k,0.99995)(x_0,700000)(y_0,0)(ellps_grs80)(units_m)(no_defs)}, {102296, srs::dpar::parameters<>(proj_tmerc)(lat_0,35.83333333333334)(lon_0,-90.5)(k,0.9999333333333333)(x_0,250000)(y_0,0)(ellps_grs80)(units_m)(no_defs)}, {102297, srs::dpar::parameters<>(proj_tmerc)(lat_0,35.83333333333334)(lon_0,-92.5)(k,0.9999333333333333)(x_0,500000)(y_0,0)(ellps_grs80)(units_m)(no_defs)}, {102298, srs::dpar::parameters<>(proj_tmerc)(lat_0,36.16666666666666)(lon_0,-94.5)(k,0.9999411764705882)(x_0,850000)(y_0,0)(ellps_grs80)(units_m)(no_defs)}, {102300, srs::dpar::parameters<>(proj_lcc)(lat_1,45)(lat_2,49)(lat_0,44.25)(lon_0,-109.5)(x_0,600000)(y_0,0)(ellps_grs80)(units_m)(no_defs)}, {102304, srs::dpar::parameters<>(proj_lcc)(lat_1,40)(lat_2,43)(lat_0,39.83333333333334)(lon_0,-100)(x_0,500000)(y_0,0)(ellps_grs80)(units_m)(no_defs)}, {102307, srs::dpar::parameters<>(proj_tmerc)(lat_0,34.75)(lon_0,-115.5833333333333)(k,0.9999)(x_0,200000)(y_0,8000000)(ellps_grs80)(units_m)(no_defs)}, {102308, srs::dpar::parameters<>(proj_tmerc)(lat_0,34.75)(lon_0,-116.6666666666667)(k,0.9999)(x_0,500000)(y_0,6000000)(ellps_grs80)(units_m)(no_defs)}, {102309, srs::dpar::parameters<>(proj_tmerc)(lat_0,34.75)(lon_0,-118.5833333333333)(k,0.9999)(x_0,800000)(y_0,4000000)(ellps_grs80)(units_m)(no_defs)}, {102310, srs::dpar::parameters<>(proj_tmerc)(lat_0,42.5)(lon_0,-71.66666666666667)(k,0.9999666666666667)(x_0,300000)(y_0,0)(ellps_grs80)(units_m)(no_defs)}, {102311, srs::dpar::parameters<>(proj_tmerc)(lat_0,38.83333333333334)(lon_0,-74.5)(k,0.9999)(x_0,150000)(y_0,0)(ellps_grs80)(units_m)(no_defs)}, {102312, srs::dpar::parameters<>(proj_tmerc)(lat_0,31)(lon_0,-104.3333333333333)(k,0.9999090909090909)(x_0,165000)(y_0,0)(ellps_grs80)(units_m)(no_defs)}, {102313, srs::dpar::parameters<>(proj_tmerc)(lat_0,31)(lon_0,-106.25)(k,0.9999)(x_0,500000)(y_0,0)(ellps_grs80)(units_m)(no_defs)}, {102314, srs::dpar::parameters<>(proj_tmerc)(lat_0,31)(lon_0,-107.8333333333333)(k,0.9999166666666667)(x_0,830000)(y_0,0)(ellps_grs80)(units_m)(no_defs)}, {102315, srs::dpar::parameters<>(proj_tmerc)(lat_0,38.83333333333334)(lon_0,-74.5)(k,0.9999)(x_0,150000)(y_0,0)(ellps_grs80)(units_m)(no_defs)}, {102316, srs::dpar::parameters<>(proj_tmerc)(lat_0,40)(lon_0,-76.58333333333333)(k,0.9999375)(x_0,250000)(y_0,0)(ellps_grs80)(units_m)(no_defs)}, {102317, srs::dpar::parameters<>(proj_tmerc)(lat_0,40)(lon_0,-78.58333333333333)(k,0.9999375)(x_0,350000)(y_0,0)(ellps_grs80)(units_m)(no_defs)}, {102318, srs::dpar::parameters<>(proj_lcc)(lat_1,40.66666666666666)(lat_2,41.03333333333333)(lat_0,40.16666666666666)(lon_0,-74)(x_0,300000)(y_0,0)(ellps_grs80)(units_m)(no_defs)}, {102320, srs::dpar::parameters<>(proj_lcc)(lat_1,47.43333333333333)(lat_2,48.73333333333333)(lat_0,47)(lon_0,-100.5)(x_0,600000)(y_0,0)(ellps_grs80)(units_m)(no_defs)}, {102321, srs::dpar::parameters<>(proj_lcc)(lat_1,46.18333333333333)(lat_2,47.48333333333333)(lat_0,45.66666666666666)(lon_0,-100.5)(x_0,600000)(y_0,0)(ellps_grs80)(units_m)(no_defs)}, {102322, srs::dpar::parameters<>(proj_lcc)(lat_1,40.43333333333333)(lat_2,41.7)(lat_0,39.66666666666666)(lon_0,-82.5)(x_0,600000)(y_0,0)(ellps_grs80)(units_m)(no_defs)}, {102323, srs::dpar::parameters<>(proj_lcc)(lat_1,38.73333333333333)(lat_2,40.03333333333333)(lat_0,38)(lon_0,-82.5)(x_0,600000)(y_0,0)(ellps_grs80)(units_m)(no_defs)}, {102324, srs::dpar::parameters<>(proj_lcc)(lat_1,35.56666666666667)(lat_2,36.76666666666667)(lat_0,35)(lon_0,-98)(x_0,600000)(y_0,0)(ellps_grs80)(units_m)(no_defs)}, {102325, srs::dpar::parameters<>(proj_lcc)(lat_1,33.93333333333333)(lat_2,35.23333333333333)(lat_0,33.33333333333334)(lon_0,-98)(x_0,600000)(y_0,0)(ellps_grs80)(units_m)(no_defs)}, {102326, srs::dpar::parameters<>(proj_lcc)(lat_1,44.33333333333334)(lat_2,46)(lat_0,43.66666666666666)(lon_0,-120.5)(x_0,2500000)(y_0,0)(ellps_grs80)(units_m)(no_defs)}, {102327, srs::dpar::parameters<>(proj_lcc)(lat_1,42.33333333333334)(lat_2,44)(lat_0,41.66666666666666)(lon_0,-120.5)(x_0,1500000)(y_0,0)(ellps_grs80)(units_m)(no_defs)}, {102330, srs::dpar::parameters<>(proj_tmerc)(lat_0,41.08333333333334)(lon_0,-71.5)(k,0.99999375)(x_0,100000)(y_0,0)(ellps_grs80)(units_m)(no_defs)}, {102334, srs::dpar::parameters<>(proj_lcc)(lat_1,44.41666666666666)(lat_2,45.68333333333333)(lat_0,43.83333333333334)(lon_0,-100)(x_0,600000)(y_0,0)(ellps_grs80)(units_m)(no_defs)}, {102335, srs::dpar::parameters<>(proj_lcc)(lat_1,42.83333333333334)(lat_2,44.4)(lat_0,42.33333333333334)(lon_0,-100.3333333333333)(x_0,600000)(y_0,0)(ellps_grs80)(units_m)(no_defs)}, {102336, srs::dpar::parameters<>(proj_lcc)(lat_1,35.25)(lat_2,36.41666666666666)(lat_0,34.33333333333334)(lon_0,-86)(x_0,600000)(y_0,0)(ellps_grs80)(units_m)(no_defs)}, {102337, srs::dpar::parameters<>(proj_lcc)(lat_1,34.65)(lat_2,36.18333333333333)(lat_0,34)(lon_0,-101.5)(x_0,200000)(y_0,1000000)(ellps_grs80)(units_m)(no_defs)}, {102338, srs::dpar::parameters<>(proj_lcc)(lat_1,32.13333333333333)(lat_2,33.96666666666667)(lat_0,31.66666666666667)(lon_0,-98.5)(x_0,600000)(y_0,2000000)(ellps_grs80)(units_m)(no_defs)}, {102339, srs::dpar::parameters<>(proj_lcc)(lat_1,30.11666666666667)(lat_2,31.88333333333333)(lat_0,29.66666666666667)(lon_0,-100.3333333333333)(x_0,700000)(y_0,3000000)(ellps_grs80)(units_m)(no_defs)}, {102340, srs::dpar::parameters<>(proj_lcc)(lat_1,28.38333333333333)(lat_2,30.28333333333334)(lat_0,27.83333333333333)(lon_0,-99)(x_0,600000)(y_0,4000000)(ellps_grs80)(units_m)(no_defs)}, {102341, srs::dpar::parameters<>(proj_lcc)(lat_1,26.16666666666667)(lat_2,27.83333333333333)(lat_0,25.66666666666667)(lon_0,-98.5)(x_0,300000)(y_0,5000000)(ellps_grs80)(units_m)(no_defs)}, {102342, srs::dpar::parameters<>(proj_lcc)(lat_1,40.71666666666667)(lat_2,41.78333333333333)(lat_0,40.33333333333334)(lon_0,-111.5)(x_0,500000)(y_0,1000000)(ellps_grs80)(units_m)(no_defs)}, {102343, srs::dpar::parameters<>(proj_lcc)(lat_1,39.01666666666667)(lat_2,40.65)(lat_0,38.33333333333334)(lon_0,-111.5)(x_0,500000)(y_0,2000000)(ellps_grs80)(units_m)(no_defs)}, {102344, srs::dpar::parameters<>(proj_lcc)(lat_1,37.21666666666667)(lat_2,38.35)(lat_0,36.66666666666666)(lon_0,-111.5)(x_0,500000)(y_0,3000000)(ellps_grs80)(units_m)(no_defs)}, {102345, srs::dpar::parameters<>(proj_tmerc)(lat_0,42.5)(lon_0,-72.5)(k,0.9999642857142857)(x_0,500000)(y_0,0)(ellps_grs80)(units_m)(no_defs)}, {102346, srs::dpar::parameters<>(proj_lcc)(lat_1,38.03333333333333)(lat_2,39.2)(lat_0,37.66666666666666)(lon_0,-78.5)(x_0,3500000)(y_0,2000000)(ellps_grs80)(units_m)(no_defs)}, {102347, srs::dpar::parameters<>(proj_lcc)(lat_1,36.76666666666667)(lat_2,37.96666666666667)(lat_0,36.33333333333334)(lon_0,-78.5)(x_0,3500000)(y_0,1000000)(ellps_grs80)(units_m)(no_defs)}, {102348, srs::dpar::parameters<>(proj_lcc)(lat_1,47.5)(lat_2,48.73333333333333)(lat_0,47)(lon_0,-120.8333333333333)(x_0,500000)(y_0,0)(ellps_grs80)(units_m)(no_defs)}, {102349, srs::dpar::parameters<>(proj_lcc)(lat_1,45.83333333333334)(lat_2,47.33333333333334)(lat_0,45.33333333333334)(lon_0,-120.5)(x_0,500000)(y_0,0)(ellps_grs80)(units_m)(no_defs)}, {102350, srs::dpar::parameters<>(proj_lcc)(lat_1,39)(lat_2,40.25)(lat_0,38.5)(lon_0,-79.5)(x_0,600000)(y_0,0)(ellps_grs80)(units_m)(no_defs)}, {102351, srs::dpar::parameters<>(proj_lcc)(lat_1,37.48333333333333)(lat_2,38.88333333333333)(lat_0,37)(lon_0,-81)(x_0,600000)(y_0,0)(ellps_grs80)(units_m)(no_defs)}, {102352, srs::dpar::parameters<>(proj_lcc)(lat_1,45.56666666666667)(lat_2,46.76666666666667)(lat_0,45.16666666666666)(lon_0,-90)(x_0,600000)(y_0,0)(ellps_grs80)(units_m)(no_defs)}, {102353, srs::dpar::parameters<>(proj_lcc)(lat_1,44.25)(lat_2,45.5)(lat_0,43.83333333333334)(lon_0,-90)(x_0,600000)(y_0,0)(ellps_grs80)(units_m)(no_defs)}, {102354, srs::dpar::parameters<>(proj_lcc)(lat_1,42.73333333333333)(lat_2,44.06666666666667)(lat_0,42)(lon_0,-90)(x_0,600000)(y_0,0)(ellps_grs80)(units_m)(no_defs)}, {102355, srs::dpar::parameters<>(proj_tmerc)(lat_0,40.5)(lon_0,-105.1666666666667)(k,0.9999375)(x_0,200000)(y_0,0)(ellps_grs80)(units_m)(no_defs)}, {102356, srs::dpar::parameters<>(proj_tmerc)(lat_0,40.5)(lon_0,-107.3333333333333)(k,0.9999375)(x_0,400000)(y_0,100000)(ellps_grs80)(units_m)(no_defs)}, {102357, srs::dpar::parameters<>(proj_tmerc)(lat_0,40.5)(lon_0,-108.75)(k,0.9999375)(x_0,600000)(y_0,0)(ellps_grs80)(units_m)(no_defs)}, {102358, srs::dpar::parameters<>(proj_tmerc)(lat_0,40.5)(lon_0,-110.0833333333333)(k,0.9999375)(x_0,800000)(y_0,100000)(ellps_grs80)(units_m)(no_defs)}, {102361, srs::dpar::parameters<>(proj_lcc)(lat_1,18.03333333333334)(lat_2,18.43333333333333)(lat_0,17.83333333333333)(lon_0,-66.43333333333334)(x_0,200000)(y_0,200000)(ellps_grs80)(units_m)(no_defs)}, {102491, srs::dpar::parameters<>(proj_lcc)(lat_1,36)(lat_0,36)(lon_0,2.7)(k_0,0.999625544)(x_0,500000)(y_0,300000)(a,6378249.2)(b,6356514.999904194)(units_m)(no_defs)}, {102492, srs::dpar::parameters<>(proj_lcc)(lat_1,33.3)(lat_0,33.3)(lon_0,2.7)(k_0,0.999625769)(x_0,500000)(y_0,300000)(a,6378249.2)(b,6356514.999904194)(units_m)(no_defs)}, {102581, srs::dpar::parameters<>(proj_lcc)(lat_1,49.5)(lat_0,49.5)(lon_0,2.337229166666667)(k_0,0.999877341)(x_0,600000)(y_0,1200000)(a,6378249.2)(b,6356514.999904194)(units_m)(no_defs)}, {102582, srs::dpar::parameters<>(proj_lcc)(lat_1,46.8)(lat_0,46.8)(lon_0,2.337229166666667)(k_0,0.99987742)(x_0,600000)(y_0,2200000)(a,6378249.2)(b,6356514.999904194)(units_m)(no_defs)}, {102583, srs::dpar::parameters<>(proj_lcc)(lat_1,44.1)(lat_0,44.1)(lon_0,2.337229166666667)(k_0,0.999877499)(x_0,600000)(y_0,3200000)(a,6378249.2)(b,6356514.999904194)(units_m)(no_defs)}, {102584, srs::dpar::parameters<>(proj_lcc)(lat_1,42.165)(lat_0,42.165)(lon_0,2.337229166666667)(k_0,0.99994471)(x_0,234.358)(y_0,4185861.369)(a,6378249.2)(b,6356514.999904194)(units_m)(no_defs)}, {102591, srs::dpar::parameters<>(proj_lcc)(lat_1,36)(lat_0,36)(lon_0,2.7)(k_0,0.999625544)(x_0,500135)(y_0,300090)(ellps_clrk80)(units_m)(no_defs)}, {102592, srs::dpar::parameters<>(proj_lcc)(lat_1,33.3)(lat_0,33.3)(lon_0,2.7)(k_0,0.999625769)(x_0,500135)(y_0,300090)(ellps_clrk80)(units_m)(no_defs)}, {102629, srs::dpar::parameters<>(proj_tmerc)(lat_0,30.5)(lon_0,-85.83333333333333)(k,0.99996)(x_0,200000)(y_0,0)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102630, srs::dpar::parameters<>(proj_tmerc)(lat_0,30)(lon_0,-87.5)(k,0.9999333333333333)(x_0,600000.0000000001)(y_0,0)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102631, srs::dpar::parameters<>(proj_omerc)(lat_0,57)(lonc,-133.6666666666667)(alpha,-36.86989764583333)(k,0.9999)(x_0,4999999.999999999)(y_0,-4999999.999999999)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102632, srs::dpar::parameters<>(proj_tmerc)(lat_0,54)(lon_0,-142)(k,0.9999)(x_0,500000.0000000002)(y_0,0)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102633, srs::dpar::parameters<>(proj_tmerc)(lat_0,54)(lon_0,-146)(k,0.9999)(x_0,500000.0000000002)(y_0,0)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102634, srs::dpar::parameters<>(proj_tmerc)(lat_0,54)(lon_0,-150)(k,0.9999)(x_0,500000.0000000002)(y_0,0)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102635, srs::dpar::parameters<>(proj_tmerc)(lat_0,54)(lon_0,-154)(k,0.9999)(x_0,500000.0000000002)(y_0,0)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102636, srs::dpar::parameters<>(proj_tmerc)(lat_0,54)(lon_0,-158)(k,0.9999)(x_0,500000.0000000002)(y_0,0)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102637, srs::dpar::parameters<>(proj_tmerc)(lat_0,54)(lon_0,-162)(k,0.9999)(x_0,500000.0000000002)(y_0,0)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102638, srs::dpar::parameters<>(proj_tmerc)(lat_0,54)(lon_0,-166)(k,0.9999)(x_0,500000.0000000002)(y_0,0)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102639, srs::dpar::parameters<>(proj_tmerc)(lat_0,54)(lon_0,-170)(k,0.9999)(x_0,500000.0000000002)(y_0,0)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102640, srs::dpar::parameters<>(proj_lcc)(lat_1,51.83333333333334)(lat_2,53.83333333333334)(lat_0,51)(lon_0,-176)(x_0,1000000)(y_0,0)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102641, srs::dpar::parameters<>(proj_lcc)(lat_1,40)(lat_2,41.66666666666666)(lat_0,39.33333333333334)(lon_0,-122)(x_0,2000000)(y_0,500000.0000000002)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102642, srs::dpar::parameters<>(proj_lcc)(lat_1,38.33333333333334)(lat_2,39.83333333333334)(lat_0,37.66666666666666)(lon_0,-122)(x_0,2000000)(y_0,500000.0000000002)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102643, srs::dpar::parameters<>(proj_lcc)(lat_1,37.06666666666667)(lat_2,38.43333333333333)(lat_0,36.5)(lon_0,-120.5)(x_0,2000000)(y_0,500000.0000000002)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102644, srs::dpar::parameters<>(proj_lcc)(lat_1,36)(lat_2,37.25)(lat_0,35.33333333333334)(lon_0,-119)(x_0,2000000)(y_0,500000.0000000002)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102645, srs::dpar::parameters<>(proj_lcc)(lat_1,34.03333333333333)(lat_2,35.46666666666667)(lat_0,33.5)(lon_0,-118)(x_0,2000000)(y_0,500000.0000000002)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102646, srs::dpar::parameters<>(proj_lcc)(lat_1,32.78333333333333)(lat_2,33.88333333333333)(lat_0,32.16666666666666)(lon_0,-116.25)(x_0,2000000)(y_0,500000.0000000002)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102648, srs::dpar::parameters<>(proj_tmerc)(lat_0,31)(lon_0,-110.1666666666667)(k,0.9999)(x_0,213360)(y_0,0)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102649, srs::dpar::parameters<>(proj_tmerc)(lat_0,31)(lon_0,-111.9166666666667)(k,0.9999)(x_0,213360)(y_0,0)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102650, srs::dpar::parameters<>(proj_tmerc)(lat_0,31)(lon_0,-113.75)(k,0.9999333333333333)(x_0,213360)(y_0,0)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102651, srs::dpar::parameters<>(proj_lcc)(lat_1,34.93333333333333)(lat_2,36.23333333333333)(lat_0,34.33333333333334)(lon_0,-92)(x_0,399999.9999999999)(y_0,0)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102652, srs::dpar::parameters<>(proj_lcc)(lat_1,33.3)(lat_2,34.76666666666667)(lat_0,32.66666666666666)(lon_0,-92)(x_0,399999.9999999999)(y_0,399999.9999999999)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102653, srs::dpar::parameters<>(proj_lcc)(lat_1,39.71666666666667)(lat_2,40.78333333333333)(lat_0,39.33333333333334)(lon_0,-105.5)(x_0,914401.8289)(y_0,304800.6096)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102654, srs::dpar::parameters<>(proj_lcc)(lat_1,38.45)(lat_2,39.75)(lat_0,37.83333333333334)(lon_0,-105.5)(x_0,914401.8289)(y_0,304800.6096)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102655, srs::dpar::parameters<>(proj_lcc)(lat_1,37.23333333333333)(lat_2,38.43333333333333)(lat_0,36.66666666666666)(lon_0,-105.5)(x_0,914401.8289)(y_0,304800.6096)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102656, srs::dpar::parameters<>(proj_lcc)(lat_1,41.2)(lat_2,41.86666666666667)(lat_0,40.83333333333334)(lon_0,-72.75)(x_0,304800.6096)(y_0,152400.3048)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102657, srs::dpar::parameters<>(proj_tmerc)(lat_0,38)(lon_0,-75.41666666666667)(k,0.999995)(x_0,200000)(y_0,0)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102658, srs::dpar::parameters<>(proj_tmerc)(lat_0,24.33333333333333)(lon_0,-81)(k,0.9999411764705882)(x_0,200000)(y_0,0)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102659, srs::dpar::parameters<>(proj_tmerc)(lat_0,24.33333333333333)(lon_0,-82)(k,0.9999411764705882)(x_0,200000)(y_0,0)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102660, srs::dpar::parameters<>(proj_lcc)(lat_1,29.58333333333333)(lat_2,30.75)(lat_0,29)(lon_0,-84.5)(x_0,600000.0000000001)(y_0,0)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102661, srs::dpar::parameters<>(proj_tmerc)(lat_0,18.83333333333333)(lon_0,-155.5)(k,0.9999666666666667)(x_0,500000.0000000002)(y_0,0)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102662, srs::dpar::parameters<>(proj_tmerc)(lat_0,20.33333333333333)(lon_0,-156.6666666666667)(k,0.9999666666666667)(x_0,500000.0000000002)(y_0,0)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102663, srs::dpar::parameters<>(proj_tmerc)(lat_0,21.16666666666667)(lon_0,-158)(k,0.99999)(x_0,500000.0000000002)(y_0,0)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102664, srs::dpar::parameters<>(proj_tmerc)(lat_0,21.83333333333333)(lon_0,-159.5)(k,0.99999)(x_0,500000.0000000002)(y_0,0)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102665, srs::dpar::parameters<>(proj_tmerc)(lat_0,21.66666666666667)(lon_0,-160.1666666666667)(k,1)(x_0,500000.0000000002)(y_0,0)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102666, srs::dpar::parameters<>(proj_tmerc)(lat_0,30)(lon_0,-82.16666666666667)(k,0.9999)(x_0,200000)(y_0,0)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102667, srs::dpar::parameters<>(proj_tmerc)(lat_0,30)(lon_0,-84.16666666666667)(k,0.9999)(x_0,700000)(y_0,0)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102668, srs::dpar::parameters<>(proj_tmerc)(lat_0,41.66666666666666)(lon_0,-112.1666666666667)(k,0.9999473684210526)(x_0,200000)(y_0,0)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102669, srs::dpar::parameters<>(proj_tmerc)(lat_0,41.66666666666666)(lon_0,-114)(k,0.9999473684210526)(x_0,500000.0000000002)(y_0,0)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102670, srs::dpar::parameters<>(proj_tmerc)(lat_0,41.66666666666666)(lon_0,-115.75)(k,0.9999333333333333)(x_0,799999.9999999999)(y_0,0)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102671, srs::dpar::parameters<>(proj_tmerc)(lat_0,36.66666666666666)(lon_0,-88.33333333333333)(k,0.9999749999999999)(x_0,300000)(y_0,0)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102672, srs::dpar::parameters<>(proj_tmerc)(lat_0,36.66666666666666)(lon_0,-90.16666666666667)(k,0.9999411764705882)(x_0,700000)(y_0,0)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102673, srs::dpar::parameters<>(proj_tmerc)(lat_0,37.5)(lon_0,-85.66666666666667)(k,0.9999666666666667)(x_0,100000)(y_0,250000)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102674, srs::dpar::parameters<>(proj_tmerc)(lat_0,37.5)(lon_0,-87.08333333333333)(k,0.9999666666666667)(x_0,900000.0000000001)(y_0,250000)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102675, srs::dpar::parameters<>(proj_lcc)(lat_1,42.06666666666667)(lat_2,43.26666666666667)(lat_0,41.5)(lon_0,-93.5)(x_0,1500000)(y_0,1000000)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102676, srs::dpar::parameters<>(proj_lcc)(lat_1,40.61666666666667)(lat_2,41.78333333333333)(lat_0,40)(lon_0,-93.5)(x_0,500000.0000000002)(y_0,0)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102677, srs::dpar::parameters<>(proj_lcc)(lat_1,38.71666666666667)(lat_2,39.78333333333333)(lat_0,38.33333333333334)(lon_0,-98)(x_0,399999.9999999999)(y_0,0)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102678, srs::dpar::parameters<>(proj_lcc)(lat_1,37.26666666666667)(lat_2,38.56666666666667)(lat_0,36.66666666666666)(lon_0,-98.5)(x_0,399999.9999999999)(y_0,399999.9999999999)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102679, srs::dpar::parameters<>(proj_lcc)(lat_1,37.96666666666667)(lat_2,38.96666666666667)(lat_0,37.5)(lon_0,-84.25)(x_0,500000.0000000002)(y_0,0)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102680, srs::dpar::parameters<>(proj_lcc)(lat_1,36.73333333333333)(lat_2,37.93333333333333)(lat_0,36.33333333333334)(lon_0,-85.75)(x_0,500000.0000000002)(y_0,500000.0000000002)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102681, srs::dpar::parameters<>(proj_lcc)(lat_1,31.16666666666667)(lat_2,32.66666666666666)(lat_0,30.5)(lon_0,-92.5)(x_0,1000000)(y_0,0)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102682, srs::dpar::parameters<>(proj_lcc)(lat_1,29.3)(lat_2,30.7)(lat_0,28.5)(lon_0,-91.33333333333333)(x_0,1000000)(y_0,0)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102683, srs::dpar::parameters<>(proj_tmerc)(lat_0,43.66666666666666)(lon_0,-68.5)(k,0.9999)(x_0,300000)(y_0,0)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102684, srs::dpar::parameters<>(proj_tmerc)(lat_0,42.83333333333334)(lon_0,-70.16666666666667)(k,0.9999666666666667)(x_0,900000.0000000001)(y_0,0)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102685, srs::dpar::parameters<>(proj_lcc)(lat_1,38.3)(lat_2,39.45)(lat_0,37.66666666666666)(lon_0,-77)(x_0,399999.9999999999)(y_0,0)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102686, srs::dpar::parameters<>(proj_lcc)(lat_1,41.71666666666667)(lat_2,42.68333333333333)(lat_0,41)(lon_0,-71.5)(x_0,200000)(y_0,750000.0000000001)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102687, srs::dpar::parameters<>(proj_lcc)(lat_1,41.28333333333333)(lat_2,41.48333333333333)(lat_0,41)(lon_0,-70.5)(x_0,500000.0000000002)(y_0,0)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102688, srs::dpar::parameters<>(proj_lcc)(lat_1,45.48333333333333)(lat_2,47.08333333333334)(lat_0,44.78333333333333)(lon_0,-87)(x_0,7999999.999999999)(y_0,0)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102689, srs::dpar::parameters<>(proj_lcc)(lat_1,44.18333333333333)(lat_2,45.7)(lat_0,43.31666666666667)(lon_0,-84.36666666666666)(x_0,6000000.000000001)(y_0,0)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102690, srs::dpar::parameters<>(proj_lcc)(lat_1,42.1)(lat_2,43.66666666666666)(lat_0,41.5)(lon_0,-84.36666666666666)(x_0,4000000)(y_0,0)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102691, srs::dpar::parameters<>(proj_lcc)(lat_1,47.03333333333333)(lat_2,48.63333333333333)(lat_0,46.5)(lon_0,-93.09999999999999)(x_0,799999.9999999999)(y_0,100000)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102692, srs::dpar::parameters<>(proj_lcc)(lat_1,45.61666666666667)(lat_2,47.05)(lat_0,45)(lon_0,-94.25)(x_0,799999.9999999999)(y_0,100000)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102693, srs::dpar::parameters<>(proj_lcc)(lat_1,43.78333333333333)(lat_2,45.21666666666667)(lat_0,43)(lon_0,-94)(x_0,799999.9999999999)(y_0,100000)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102694, srs::dpar::parameters<>(proj_tmerc)(lat_0,29.5)(lon_0,-88.83333333333333)(k,0.99995)(x_0,300000)(y_0,0)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102695, srs::dpar::parameters<>(proj_tmerc)(lat_0,29.5)(lon_0,-90.33333333333333)(k,0.99995)(x_0,700000)(y_0,0)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102696, srs::dpar::parameters<>(proj_tmerc)(lat_0,35.83333333333334)(lon_0,-90.5)(k,0.9999333333333333)(x_0,250000)(y_0,0)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102697, srs::dpar::parameters<>(proj_tmerc)(lat_0,35.83333333333334)(lon_0,-92.5)(k,0.9999333333333333)(x_0,500000.0000000002)(y_0,0)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102698, srs::dpar::parameters<>(proj_tmerc)(lat_0,36.16666666666666)(lon_0,-94.5)(k,0.9999411764705882)(x_0,850000)(y_0,0)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102700, srs::dpar::parameters<>(proj_lcc)(lat_1,45)(lat_2,49)(lat_0,44.25)(lon_0,-109.5)(x_0,600000.0000000001)(y_0,0)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102704, srs::dpar::parameters<>(proj_lcc)(lat_1,40)(lat_2,43)(lat_0,39.83333333333334)(lon_0,-100)(x_0,500000.0000000002)(y_0,0)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102707, srs::dpar::parameters<>(proj_tmerc)(lat_0,34.75)(lon_0,-115.5833333333333)(k,0.9999)(x_0,200000)(y_0,7999999.999999999)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102708, srs::dpar::parameters<>(proj_tmerc)(lat_0,34.75)(lon_0,-116.6666666666667)(k,0.9999)(x_0,500000.0000000002)(y_0,6000000.000000001)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102709, srs::dpar::parameters<>(proj_tmerc)(lat_0,34.75)(lon_0,-118.5833333333333)(k,0.9999)(x_0,799999.9999999999)(y_0,4000000)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102710, srs::dpar::parameters<>(proj_tmerc)(lat_0,42.5)(lon_0,-71.66666666666667)(k,0.9999666666666667)(x_0,300000)(y_0,0)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102711, srs::dpar::parameters<>(proj_tmerc)(lat_0,38.83333333333334)(lon_0,-74.5)(k,0.9999)(x_0,150000)(y_0,0)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102712, srs::dpar::parameters<>(proj_tmerc)(lat_0,31)(lon_0,-104.3333333333333)(k,0.9999090909090909)(x_0,165000)(y_0,0)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102713, srs::dpar::parameters<>(proj_tmerc)(lat_0,31)(lon_0,-106.25)(k,0.9999)(x_0,500000.0000000002)(y_0,0)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102714, srs::dpar::parameters<>(proj_tmerc)(lat_0,31)(lon_0,-107.8333333333333)(k,0.9999166666666667)(x_0,829999.9999999999)(y_0,0)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102715, srs::dpar::parameters<>(proj_tmerc)(lat_0,38.83333333333334)(lon_0,-74.5)(k,0.9999)(x_0,150000)(y_0,0)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102716, srs::dpar::parameters<>(proj_tmerc)(lat_0,40)(lon_0,-76.58333333333333)(k,0.9999375)(x_0,250000)(y_0,0)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102717, srs::dpar::parameters<>(proj_tmerc)(lat_0,40)(lon_0,-78.58333333333333)(k,0.9999375)(x_0,350000.0000000001)(y_0,0)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102718, srs::dpar::parameters<>(proj_lcc)(lat_1,40.66666666666666)(lat_2,41.03333333333333)(lat_0,40.16666666666666)(lon_0,-74)(x_0,300000)(y_0,0)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102719, srs::dpar::parameters<>(proj_lcc)(lat_1,34.33333333333334)(lat_2,36.16666666666666)(lat_0,33.75)(lon_0,-79)(x_0,609601.2199999999)(y_0,0)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102720, srs::dpar::parameters<>(proj_lcc)(lat_1,47.43333333333333)(lat_2,48.73333333333333)(lat_0,47)(lon_0,-100.5)(x_0,600000.0000000001)(y_0,0)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102721, srs::dpar::parameters<>(proj_lcc)(lat_1,46.18333333333333)(lat_2,47.48333333333333)(lat_0,45.66666666666666)(lon_0,-100.5)(x_0,600000.0000000001)(y_0,0)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102722, srs::dpar::parameters<>(proj_lcc)(lat_1,40.43333333333333)(lat_2,41.7)(lat_0,39.66666666666666)(lon_0,-82.5)(x_0,600000.0000000001)(y_0,0)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102723, srs::dpar::parameters<>(proj_lcc)(lat_1,38.73333333333333)(lat_2,40.03333333333333)(lat_0,38)(lon_0,-82.5)(x_0,600000.0000000001)(y_0,0)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102724, srs::dpar::parameters<>(proj_lcc)(lat_1,35.56666666666667)(lat_2,36.76666666666667)(lat_0,35)(lon_0,-98)(x_0,600000.0000000001)(y_0,0)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102725, srs::dpar::parameters<>(proj_lcc)(lat_1,33.93333333333333)(lat_2,35.23333333333333)(lat_0,33.33333333333334)(lon_0,-98)(x_0,600000.0000000001)(y_0,0)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102726, srs::dpar::parameters<>(proj_lcc)(lat_1,44.33333333333334)(lat_2,46)(lat_0,43.66666666666666)(lon_0,-120.5)(x_0,2500000)(y_0,0)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102727, srs::dpar::parameters<>(proj_lcc)(lat_1,42.33333333333334)(lat_2,44)(lat_0,41.66666666666666)(lon_0,-120.5)(x_0,1500000)(y_0,0)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102728, srs::dpar::parameters<>(proj_lcc)(lat_1,40.88333333333333)(lat_2,41.95)(lat_0,40.16666666666666)(lon_0,-77.75)(x_0,600000.0000000001)(y_0,0)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102729, srs::dpar::parameters<>(proj_lcc)(lat_1,39.93333333333333)(lat_2,40.96666666666667)(lat_0,39.33333333333334)(lon_0,-77.75)(x_0,600000.0000000001)(y_0,0)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102730, srs::dpar::parameters<>(proj_tmerc)(lat_0,41.08333333333334)(lon_0,-71.5)(k,0.99999375)(x_0,100000)(y_0,0)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102733, srs::dpar::parameters<>(proj_lcc)(lat_1,32.5)(lat_2,34.83333333333334)(lat_0,31.83333333333333)(lon_0,-81)(x_0,609600.0000000001)(y_0,0)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102734, srs::dpar::parameters<>(proj_lcc)(lat_1,44.41666666666666)(lat_2,45.68333333333333)(lat_0,43.83333333333334)(lon_0,-100)(x_0,600000.0000000001)(y_0,0)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102735, srs::dpar::parameters<>(proj_lcc)(lat_1,42.83333333333334)(lat_2,44.4)(lat_0,42.33333333333334)(lon_0,-100.3333333333333)(x_0,600000.0000000001)(y_0,0)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102736, srs::dpar::parameters<>(proj_lcc)(lat_1,35.25)(lat_2,36.41666666666666)(lat_0,34.33333333333334)(lon_0,-86)(x_0,600000.0000000001)(y_0,0)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102737, srs::dpar::parameters<>(proj_lcc)(lat_1,34.65)(lat_2,36.18333333333333)(lat_0,34)(lon_0,-101.5)(x_0,200000)(y_0,1000000)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102738, srs::dpar::parameters<>(proj_lcc)(lat_1,32.13333333333333)(lat_2,33.96666666666667)(lat_0,31.66666666666667)(lon_0,-98.5)(x_0,600000.0000000001)(y_0,2000000)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102739, srs::dpar::parameters<>(proj_lcc)(lat_1,30.11666666666667)(lat_2,31.88333333333333)(lat_0,29.66666666666667)(lon_0,-100.3333333333333)(x_0,700000)(y_0,3000000)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102740, srs::dpar::parameters<>(proj_lcc)(lat_1,28.38333333333333)(lat_2,30.28333333333334)(lat_0,27.83333333333333)(lon_0,-99)(x_0,600000.0000000001)(y_0,4000000)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102741, srs::dpar::parameters<>(proj_lcc)(lat_1,26.16666666666667)(lat_2,27.83333333333333)(lat_0,25.66666666666667)(lon_0,-98.5)(x_0,300000)(y_0,4999999.999999999)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102742, srs::dpar::parameters<>(proj_lcc)(lat_1,40.71666666666667)(lat_2,41.78333333333333)(lat_0,40.33333333333334)(lon_0,-111.5)(x_0,500000.0000000002)(y_0,1000000)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102743, srs::dpar::parameters<>(proj_lcc)(lat_1,39.01666666666667)(lat_2,40.65)(lat_0,38.33333333333334)(lon_0,-111.5)(x_0,500000.0000000002)(y_0,2000000)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102744, srs::dpar::parameters<>(proj_lcc)(lat_1,37.21666666666667)(lat_2,38.35)(lat_0,36.66666666666666)(lon_0,-111.5)(x_0,500000.0000000002)(y_0,3000000)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102745, srs::dpar::parameters<>(proj_tmerc)(lat_0,42.5)(lon_0,-72.5)(k,0.9999642857142857)(x_0,500000.0000000002)(y_0,0)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102746, srs::dpar::parameters<>(proj_lcc)(lat_1,38.03333333333333)(lat_2,39.2)(lat_0,37.66666666666666)(lon_0,-78.5)(x_0,3499999.999999999)(y_0,2000000)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102747, srs::dpar::parameters<>(proj_lcc)(lat_1,36.76666666666667)(lat_2,37.96666666666667)(lat_0,36.33333333333334)(lon_0,-78.5)(x_0,3499999.999999999)(y_0,1000000)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102748, srs::dpar::parameters<>(proj_lcc)(lat_1,47.5)(lat_2,48.73333333333333)(lat_0,47)(lon_0,-120.8333333333333)(x_0,500000.0000000002)(y_0,0)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102749, srs::dpar::parameters<>(proj_lcc)(lat_1,45.83333333333334)(lat_2,47.33333333333334)(lat_0,45.33333333333334)(lon_0,-120.5)(x_0,500000.0000000002)(y_0,0)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102750, srs::dpar::parameters<>(proj_lcc)(lat_1,39)(lat_2,40.25)(lat_0,38.5)(lon_0,-79.5)(x_0,600000.0000000001)(y_0,0)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102751, srs::dpar::parameters<>(proj_lcc)(lat_1,37.48333333333333)(lat_2,38.88333333333333)(lat_0,37)(lon_0,-81)(x_0,600000.0000000001)(y_0,0)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102752, srs::dpar::parameters<>(proj_lcc)(lat_1,45.56666666666667)(lat_2,46.76666666666667)(lat_0,45.16666666666666)(lon_0,-90)(x_0,600000.0000000001)(y_0,0)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102753, srs::dpar::parameters<>(proj_lcc)(lat_1,44.25)(lat_2,45.5)(lat_0,43.83333333333334)(lon_0,-90)(x_0,600000.0000000001)(y_0,0)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102754, srs::dpar::parameters<>(proj_lcc)(lat_1,42.73333333333333)(lat_2,44.06666666666667)(lat_0,42)(lon_0,-90)(x_0,600000.0000000001)(y_0,0)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102755, srs::dpar::parameters<>(proj_tmerc)(lat_0,40.5)(lon_0,-105.1666666666667)(k,0.9999375)(x_0,200000)(y_0,0)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102756, srs::dpar::parameters<>(proj_tmerc)(lat_0,40.5)(lon_0,-107.3333333333333)(k,0.9999375)(x_0,399999.9999999999)(y_0,100000)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102757, srs::dpar::parameters<>(proj_tmerc)(lat_0,40.5)(lon_0,-108.75)(k,0.9999375)(x_0,600000.0000000001)(y_0,0)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102758, srs::dpar::parameters<>(proj_tmerc)(lat_0,40.5)(lon_0,-110.0833333333333)(k,0.9999375)(x_0,799999.9999999999)(y_0,100000)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102761, srs::dpar::parameters<>(proj_lcc)(lat_1,18.03333333333334)(lat_2,18.43333333333333)(lat_0,17.83333333333333)(lon_0,-66.43333333333334)(x_0,200000)(y_0,200000)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {102766, srs::dpar::parameters<>(proj_poly)(lat_0,13.47246635277778)(lon_0,-144.7487507055556)(x_0,49999.99999999999)(y_0,49999.99999999999)(ellps_grs80)(srs::dpar::datum_nad83)(to_meter,0.3048006096012192)(no_defs)}, {103300, srs::dpar::parameters<>(proj_lcc)(lat_1,49.8333339)(lat_2,51.16666733333333)(lat_0,90)(lon_0,4.367486666666666)(x_0,150000.01256)(y_0,5400088.4378)(ellps_intl)(units_m)(no_defs)}, {104000, srs::dpar::parameters<>(proj_longlat)(ellps_clrk66)(srs::dpar::datum_nad27)(no_defs)}, {104101, srs::dpar::parameters<>(proj_longlat)(ellps_bessel)(no_defs)}, {104102, srs::dpar::parameters<>(proj_longlat)(ellps_bessel)(no_defs)}, {104103, srs::dpar::parameters<>(proj_longlat)(ellps_clrk80)(no_defs)}, {104104, srs::dpar::parameters<>(proj_longlat)(ellps_intl)(no_defs)}, {104105, srs::dpar::parameters<>(proj_longlat)(ellps_bessel)(no_defs)}, {104106, srs::dpar::parameters<>(proj_longlat)(ellps_intl)(no_defs)}, {104107, srs::dpar::parameters<>(proj_longlat)(ellps_grs80)(no_defs)}, {104108, srs::dpar::parameters<>(proj_longlat)(ellps_grs80)(no_defs)}, {104261, srs::dpar::parameters<>(proj_longlat)(a,6378249.2)(b,6356514.999904194)(no_defs)}, {104304, srs::dpar::parameters<>(proj_longlat)(a,6378249.2)(b,6356514.999904194)(no_defs)}, {104305, srs::dpar::parameters<>(proj_longlat)(ellps_clrk80)(no_defs)} }; const code_element * first = arr; const code_element * last = arr + sizeof(arr) / sizeof(code_element); const code_element * el = binary_find_code_element(first, last, code); return el != last ? el->parameters : srs::dpar::parameters<>(); } } #endif // DOXYGEN_NO_DETAIL }}} // namespace boost::geometry::projections #endif
{ "pile_set_name": "Github" }
/* * Copyright (c) 2017 Google, Inc * Written by Simon Glass <sjg@chromium.org> * * SPDX-License-Identifier: GPL-2.0+ */ #ifndef _DM_OFNODE_H #define _DM_OFNODE_H /* TODO(sjg@chromium.org): Drop fdtdec.h include */ #include <fdtdec.h> #include <dm/of.h> /* Enable checks to protect against invalid calls */ #undef OF_CHECKS struct resource; /** * ofnode - reference to a device tree node * * This union can hold either a straightforward pointer to a struct device_node * in the live device tree, or an offset within the flat device tree. In the * latter case, the pointer value is just the integer offset within the flat DT. * * Thus we can reference nodes in both the live tree (once available) and the * flat tree (until then). Functions are available to translate between an * ofnode and either an offset or a struct device_node *. * * The reference can also hold a null offset, in which case the pointer value * here is NULL. This corresponds to a struct device_node * value of * NULL, or an offset of -1. * * There is no ambiguity as to whether ofnode holds an offset or a node * pointer: when the live tree is active it holds a node pointer, otherwise it * holds an offset. The value itself does not need to be unique and in theory * the same value could point to a valid device node or a valid offset. We * could arrange for a unique value to be used (e.g. by making the pointer * point to an offset within the flat device tree in the case of an offset) but * this increases code size slightly due to the subtraction. Since it offers no * real benefit, the approach described here seems best. * * For now these points use constant types, since we don't allow writing * the DT. * * @np: Pointer to device node, used for live tree * @of_offset: Pointer into flat device tree, used for flat tree. Note that this * is not a really a pointer to a node: it is an offset value. See above. */ typedef union ofnode_union { const struct device_node *np; /* will be used for future live tree */ long of_offset; } ofnode; struct ofnode_phandle_args { ofnode node; int args_count; uint32_t args[OF_MAX_PHANDLE_ARGS]; }; /** * _ofnode_to_np() - convert an ofnode to a live DT node pointer * * This cannot be called if the reference contains an offset. * * @node: Reference containing struct device_node * (possibly invalid) * @return pointer to device node (can be NULL) */ static inline const struct device_node *ofnode_to_np(ofnode node) { #ifdef OF_CHECKS if (!of_live_active()) return NULL; #endif return node.np; } /** * ofnode_to_offset() - convert an ofnode to a flat DT offset * * This cannot be called if the reference contains a node pointer. * * @node: Reference containing offset (possibly invalid) * @return DT offset (can be -1) */ static inline int ofnode_to_offset(ofnode node) { #ifdef OF_CHECKS if (of_live_active()) return -1; #endif return node.of_offset; } /** * ofnode_valid() - check if an ofnode is valid * * @return true if the reference contains a valid ofnode, false if it is NULL */ static inline bool ofnode_valid(ofnode node) { if (of_live_active()) return node.np != NULL; else return node.of_offset != -1; } /** * offset_to_ofnode() - convert a DT offset to an ofnode * * @of_offset: DT offset (either valid, or -1) * @return reference to the associated DT offset */ static inline ofnode offset_to_ofnode(int of_offset) { ofnode node; if (of_live_active()) node.np = NULL; else node.of_offset = of_offset; return node; } /** * np_to_ofnode() - convert a node pointer to an ofnode * * @np: Live node pointer (can be NULL) * @return reference to the associated node pointer */ static inline ofnode np_to_ofnode(const struct device_node *np) { ofnode node; node.np = np; return node; } /** * ofnode_is_np() - check if a reference is a node pointer * * This function associated that if there is a valid live tree then all * references will use it. This is because using the flat DT when the live tree * is valid is not permitted. * * @node: reference to check (possibly invalid) * @return true if the reference is a live node pointer, false if it is a DT * offset */ static inline bool ofnode_is_np(ofnode node) { #ifdef OF_CHECKS /* * Check our assumption that flat tree offsets are not used when a * live tree is in use. */ assert(!ofnode_valid(node) || (of_live_active() ? _ofnode_to_np(node) : _ofnode_to_np(node))); #endif return of_live_active() && ofnode_valid(node); } /** * ofnode_equal() - check if two references are equal * * @return true if equal, else false */ static inline bool ofnode_equal(ofnode ref1, ofnode ref2) { /* We only need to compare the contents */ return ref1.of_offset == ref2.of_offset; } /** * ofnode_null() - Obtain a null ofnode * * This returns an ofnode which points to no node. It works both with the flat * tree and livetree. */ static inline ofnode ofnode_null(void) { ofnode node; if (of_live_active()) node.np = NULL; else node.of_offset = -1; return node; } /** * ofnode_read_u32() - Read a 32-bit integer from a property * * @ref: valid node reference to read property from * @propname: name of the property to read from * @outp: place to put value (if found) * @return 0 if OK, -ve on error */ int ofnode_read_u32(ofnode node, const char *propname, u32 *outp); /** * ofnode_read_s32() - Read a 32-bit integer from a property * * @ref: valid node reference to read property from * @propname: name of the property to read from * @outp: place to put value (if found) * @return 0 if OK, -ve on error */ static inline int ofnode_read_s32(ofnode node, const char *propname, s32 *out_value) { return ofnode_read_u32(node, propname, (u32 *)out_value); } /** * ofnode_read_u32_default() - Read a 32-bit integer from a property * * @ref: valid node reference to read property from * @propname: name of the property to read from * @def: default value to return if the property has no value * @return property value, or @def if not found */ int ofnode_read_u32_default(ofnode ref, const char *propname, u32 def); /** * ofnode_read_u64() - Read a 64-bit integer from a property * * @ref: valid node reference to read property from * @propname: name of the property to read from * @outp: place to put value (if found) * @return 0 if OK, -ve on error */ int ofnode_read_u64(ofnode node, const char *propname, u64 *outp); /** * ofnode_read_s32_default() - Read a 32-bit integer from a property * * @ref: valid node reference to read property from * @propname: name of the property to read from * @def: default value to return if the property has no value * @return property value, or @def if not found */ int ofnode_read_s32_default(ofnode node, const char *propname, s32 def); /** * ofnode_read_string() - Read a string from a property * * @ref: valid node reference to read property from * @propname: name of the property to read * @return string from property value, or NULL if there is no such property */ const char *ofnode_read_string(ofnode node, const char *propname); /** * ofnode_read_u32_array() - Find and read an array of 32 bit integers * * @node: valid node reference to read property from * @propname: name of the property to read * @out_values: pointer to return value, modified only if return value is 0 * @sz: number of array elements to read * * Search for a property in a device node and read 32-bit value(s) from * it. Returns 0 on success, -EINVAL if the property does not exist, * -ENODATA if property does not have a value, and -EOVERFLOW if the * property data isn't large enough. * * The out_values is modified only if a valid u32 value can be decoded. */ int ofnode_read_u32_array(ofnode node, const char *propname, u32 *out_values, size_t sz); /** * ofnode_write_u32_array() - Find and write an array of 32 bit integers * * @node: valid node reference to read property from * @propname: name of the property to read * @values: pointer to update value, modified only if return value is 0 * @sz: number of array elements to read * @return 0 on success, -EINVAL if the property does not exist, -ENODATA * if property does not have a value, and -EOVERFLOW is longer than sz. */ int ofnode_write_u32_array(ofnode node, const char *propname, u32 *values, size_t sz); /** * ofnode_read_bool() - read a boolean value from a property * * @node: valid node reference to read property from * @propname: name of property to read * @return true if property is present (meaning true), false if not present */ bool ofnode_read_bool(ofnode node, const char *propname); /** * ofnode_find_subnode() - find a named subnode of a parent node * * @node: valid reference to parent node * @subnode_name: name of subnode to find * @return reference to subnode (which can be invalid if there is no such * subnode) */ ofnode ofnode_find_subnode(ofnode node, const char *subnode_name); /** * ofnode_first_subnode() - find the first subnode of a parent node * * @node: valid reference to a valid parent node * @return reference to the first subnode (which can be invalid if the parent * node has no subnodes) */ ofnode ofnode_first_subnode(ofnode node); /** * ofnode_next_subnode() - find the next sibling of a subnode * * @node: valid reference to previous node (sibling) * @return reference to the next subnode (which can be invalid if the node * has no more siblings) */ ofnode ofnode_next_subnode(ofnode node); /** * ofnode_get_parent() - get the ofnode's parent (enclosing ofnode) * * @node: valid node to look up * @return ofnode reference of the parent node */ ofnode ofnode_get_parent(ofnode node); /** * ofnode_get_name() - get the name of a node * * @node: valid node to look up * @return name or node */ const char *ofnode_get_name(ofnode node); /** * ofnode_get_by_phandle() - get ofnode from phandle * * @phandle: phandle to look up * @return ofnode reference to the phandle */ ofnode ofnode_get_by_phandle(uint phandle); /** * ofnode_read_size() - read the size of a property * * @node: node to check * @propname: property to check * @return size of property if present, or -EINVAL if not */ int ofnode_read_size(ofnode node, const char *propname); /** * ofnode_get_addr_index() - get an address from a node * * This reads the register address from a node * * @node: node to read from * @index: Index of address to read (0 for first) * @return address, or FDT_ADDR_T_NONE if not present or invalid */ phys_addr_t ofnode_get_addr_index(ofnode node, int index); /** * ofnode_get_addr() - get an address from a node * * This reads the register address from a node * * @node: node to read from * @return address, or FDT_ADDR_T_NONE if not present or invalid */ phys_addr_t ofnode_get_addr(ofnode node); /** * ofnode_stringlist_search() - find a string in a string list and return index * * Note that it is possible for this function to succeed on property values * that are not NUL-terminated. That's because the function will stop after * finding the first occurrence of @string. This can for example happen with * small-valued cell properties, such as #address-cells, when searching for * the empty string. * * @node: node to check * @propname: name of the property containing the string list * @string: string to look up in the string list * * @return: * the index of the string in the list of strings * -ENODATA if the property is not found * -EINVAL on some other error */ int ofnode_stringlist_search(ofnode node, const char *propname, const char *string); /** * ofnode_read_string_index() - obtain an indexed string from a string list * * Note that this will successfully extract strings from properties with * non-NUL-terminated values. For example on small-valued cell properties * this function will return the empty string. * * If non-NULL, the length of the string (on success) or a negative error-code * (on failure) will be stored in the integer pointer to by lenp. * * @node: node to check * @propname: name of the property containing the string list * @index: index of the string to return * @lenp: return location for the string length or an error code on failure * * @return: * length of string, if found or -ve error value if not found */ int ofnode_read_string_index(ofnode node, const char *propname, int index, const char **outp); /** * ofnode_read_string_count() - find the number of strings in a string list * * @node: node to check * @propname: name of the property containing the string list * @return: * number of strings in the list, or -ve error value if not found */ int ofnode_read_string_count(ofnode node, const char *property); /** * ofnode_parse_phandle_with_args() - Find a node pointed by phandle in a list * * This function is useful to parse lists of phandles and their arguments. * Returns 0 on success and fills out_args, on error returns appropriate * errno value. * * Caller is responsible to call of_node_put() on the returned out_args->np * pointer. * * Example: * * phandle1: node1 { * #list-cells = <2>; * } * * phandle2: node2 { * #list-cells = <1>; * } * * node3 { * list = <&phandle1 1 2 &phandle2 3>; * } * * To get a device_node of the `node2' node you may call this: * ofnode_parse_phandle_with_args(node3, "list", "#list-cells", 0, 1, &args); * * @node: device tree node containing a list * @list_name: property name that contains a list * @cells_name: property name that specifies phandles' arguments count * @cells_count: Cell count to use if @cells_name is NULL * @index: index of a phandle to parse out * @out_args: optional pointer to output arguments structure (will be filled) * @return 0 on success (with @out_args filled out if not NULL), -ENOENT if * @list_name does not exist, -EINVAL if a phandle was not found, * @cells_name could not be found, the arguments were truncated or there * were too many arguments. */ int ofnode_parse_phandle_with_args(ofnode node, const char *list_name, const char *cells_name, int cell_count, int index, struct ofnode_phandle_args *out_args); /** * ofnode_count_phandle_with_args() - Count number of phandle in a list * * This function is useful to count phandles into a list. * Returns number of phandle on success, on error returns appropriate * errno value. * * @node: device tree node containing a list * @list_name: property name that contains a list * @cells_name: property name that specifies phandles' arguments count * @return number of phandle on success, -ENOENT if @list_name does not * exist, -EINVAL if a phandle was not found, @cells_name could not * be found. */ int ofnode_count_phandle_with_args(ofnode node, const char *list_name, const char *cells_name); /** * ofnode_path() - find a node by full path * * @path: Full path to node, e.g. "/bus/spi@1" * @return reference to the node found. Use ofnode_valid() to check if it exists */ ofnode ofnode_path(const char *path); /** * ofnode_get_chosen_prop() - get the value of a chosen property * * This looks for a property within the /chosen node and returns its value * * @propname: Property name to look for */ const char *ofnode_get_chosen_prop(const char *propname); /** * ofnode_get_chosen_node() - get the chosen node * * @return the chosen node if present, else ofnode_null() */ ofnode ofnode_get_chosen_node(const char *name); struct display_timing; /** * ofnode_decode_display_timing() - decode display timings * * Decode display timings from the supplied 'display-timings' node. * See doc/device-tree-bindings/video/display-timing.txt for binding * information. * * @node 'display-timing' node containing the timing subnodes * @index Index number to read (0=first timing subnode) * @config Place to put timings * @return 0 if OK, -FDT_ERR_NOTFOUND if not found */ int ofnode_decode_display_timing(ofnode node, int index, struct display_timing *config); /** * ofnode_get_property()- - get a pointer to the value of a node property * * @node: node to read * @propname: property to read * @lenp: place to put length on success * @return pointer to property, or NULL if not found */ const void *ofnode_get_property(ofnode node, const char *propname, int *lenp); /** * ofnode_hide_property() - hide a property * * @np: Pointer to device node holding property * @name: Name of property to hide * @return hidden name if ok, otherwise NULL */ const char *ofnode_hide_property(ofnode node, const char *propname); /** * ofnode_present_property() - present a property hidden before * * @np: Pointer to device node holding property * @name: Hidden name of property * @return 0 if ok, otherwise failed */ int ofnode_present_property(ofnode node, const char *propname); /** * ofnode_is_available() - check if a node is marked available * * @node: node to check * @return true if node's 'status' property is "okay" (or is missing) */ bool ofnode_is_available(ofnode node); /** * ofnode_get_addr_size() - get address and size from a property * * This does no address translation. It simply reads an property that contains * an address and a size value, one after the other. * * @node: node to read from * @propname: property to read * @sizep: place to put size value (on success) * @return address value, or FDT_ADDR_T_NONE on error */ phys_addr_t ofnode_get_addr_size(ofnode node, const char *propname, phys_size_t *sizep); /** * ofnode_read_u8_array_ptr() - find an 8-bit array * * Look up a property in a node and return a pointer to its contents as a * byte array of given length. The property must have at least enough data * for the array (count bytes). It may have more, but this will be ignored. * The data is not copied. * * @node node to examine * @propname name of property to find * @sz number of array elements * @return pointer to byte array if found, or NULL if the property is not * found or there is not enough data */ const uint8_t *ofnode_read_u8_array_ptr(ofnode node, const char *propname, size_t sz); /** * ofnode_read_pci_addr() - look up a PCI address * * Look at an address property in a node and return the PCI address which * corresponds to the given type in the form of fdt_pci_addr. * The property must hold one fdt_pci_addr with a lengh. * * @node node to examine * @type pci address type (FDT_PCI_SPACE_xxx) * @propname name of property to find * @addr returns pci address in the form of fdt_pci_addr * @return 0 if ok, -ENOENT if the property did not exist, -EINVAL if the * format of the property was invalid, -ENXIO if the requested * address type was not found */ int ofnode_read_pci_addr(ofnode node, enum fdt_pci_space type, const char *propname, struct fdt_pci_addr *addr); /** * ofnode_read_addr_cells() - Get the number of address cells for a node * * This walks back up the tree to find the closest #address-cells property * which controls the given node. * * @node: Node to check * @return number of address cells this node uses */ int ofnode_read_addr_cells(ofnode node); /** * ofnode_read_size_cells() - Get the number of size cells for a node * * This walks back up the tree to find the closest #size-cells property * which controls the given node. * * @node: Node to check * @return number of size cells this node uses */ int ofnode_read_size_cells(ofnode node); /** * ofnode_read_simple_addr_cells() - Get the address cells property in a node * * This function matches fdt_address_cells(). * * @np: Node pointer to check * @return value of #address-cells property in this node, or 2 if none */ int ofnode_read_simple_addr_cells(ofnode node); /** * ofnode_read_simple_size_cells() - Get the size cells property in a node * * This function matches fdt_size_cells(). * * @np: Node pointer to check * @return value of #size-cells property in this node, or 2 if none */ int ofnode_read_simple_size_cells(ofnode node); /** * ofnode_pre_reloc() - check if a node should be bound before relocation * * Device tree nodes can be marked as needing-to-be-bound in the loader stages * via special device tree properties. * * Before relocation this function can be used to check if nodes are required * in either SPL or TPL stages. * * After relocation and jumping into the real U-Boot binary it is possible to * determine if a node was bound in one of SPL/TPL stages. * * There are 3 settings currently in use * - * - u-boot,dm-pre-reloc: legacy and indicates any of TPL or SPL * Existing platforms only use it to indicate nodes needed in * SPL. Should probably be replaced by u-boot,dm-spl for * new platforms. * * @node: node to check * @eturns true if node is needed in SPL/TL, false otherwise */ bool ofnode_pre_reloc(ofnode node); int ofnode_read_resource(ofnode node, uint index, struct resource *res); int ofnode_read_resource_byname(ofnode node, const char *name, struct resource *res); /** * ofnode_for_each_subnode() - iterate over all subnodes of a parent * * @node: child node (ofnode, lvalue) * @parent: parent node (ofnode) * * This is a wrapper around a for loop and is used like so: * * ofnode node; * * ofnode_for_each_subnode(node, parent) { * Use node * ... * } * * Note that this is implemented as a macro and @node is used as * iterator in the loop. The parent variable can be a constant or even a * literal. */ #define ofnode_for_each_subnode(node, parent) \ for (node = ofnode_first_subnode(parent); \ ofnode_valid(node); \ node = ofnode_next_subnode(node)) #endif
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:drawable="@drawable/default_rect_touch_dark" android:state_selected="true"/> <item android:drawable="@drawable/default_rect_touch_dark" android:state_pressed="true"/> <item android:drawable="@drawable/default_rect_dark"/> </selector>
{ "pile_set_name": "Github" }
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. import {bindActionCreators} from 'redux'; import {getTeam} from 'mattermost-redux/selectors/entities/teams'; import {getTeam as fetchTeam, membersMinusGroupMembers, patchTeam, removeUserFromTeam, updateTeamMemberSchemeRoles, addUserToTeam} from 'mattermost-redux/actions/teams'; import {getAllGroups, getGroupsAssociatedToTeam} from 'mattermost-redux/selectors/entities/groups'; import { getGroupsAssociatedToTeam as fetchAssociatedGroups, linkGroupSyncable, unlinkGroupSyncable, patchGroupSyncable, } from 'mattermost-redux/actions/groups'; import {connect} from 'react-redux'; import {setNavigationBlocked} from 'actions/admin_actions'; import TeamDetails from './team_details'; function mapStateToProps(state, props) { const teamID = props.match.params.team_id; const team = getTeam(state, teamID); const groups = getGroupsAssociatedToTeam(state, teamID); const allGroups = getAllGroups(state, teamID); const totalGroups = groups.length; return { team, groups, totalGroups, allGroups, teamID, }; } function mapDispatchToProps(dispatch) { return { actions: bindActionCreators({ getTeam: fetchTeam, getGroups: fetchAssociatedGroups, patchTeam, linkGroupSyncable, unlinkGroupSyncable, membersMinusGroupMembers, setNavigationBlocked, patchGroupSyncable, removeUserFromTeam, addUserToTeam, updateTeamMemberSchemeRoles, }, dispatch), }; } export default connect(mapStateToProps, mapDispatchToProps)(TeamDetails);
{ "pile_set_name": "Github" }
{ "type" : "record", "name" : "AnyRecord", "namespace" : "com.linkedin.pegasus.generator.test", "fields" : [], "java" : { "class" : "com.linkedin.pegasus.generator.test.CustomAnyRecord" }, "avro" : { "translator" : { "class" : "com.linkedin.data.avro.AnyRecordTranslator" }, "schema" : { "type" : "record", "name" : "AvroAnyRecord", "namespace" : "com.linkedin.pegasus.generator.test.avro", "fields" : [ { "name" : "type", "type" : "string" }, { "name" : "value", "type" : "string" } ] } } }
{ "pile_set_name": "Github" }
/* * All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or * its licensors. * * For complete copyright and license terms please see the LICENSE at the root of this * distribution (the "License"). All use of this software is governed by the License, * or, if provided, by the license below or the license accompanying this file. Do not * remove or modify any license notices. This file is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * */ #include "WhiteBox_precompiled.h" #include "WhiteBoxComponent.h" #include <AzCore/Component/TransformBus.h> #include <AzCore/Serialization/SerializeContext.h> #include <Rendering/WhiteBoxMaterial.h> #include <Rendering/WhiteBoxRenderData.h> #include <Rendering/WhiteBoxRenderMeshInterface.h> #include <WhiteBox/WhiteBoxBus.h> namespace WhiteBox { void WhiteBoxComponent::Reflect(AZ::ReflectContext* context) { WhiteBoxRenderData::Reflect(context); if (auto serializeContext = azrtti_cast<AZ::SerializeContext*>(context)) { serializeContext->Class<WhiteBoxComponent, AZ::Component>()->Version(1)->Field( "WhiteBoxRenderData", &WhiteBoxComponent::m_whiteBoxRenderData); } } WhiteBoxComponent::WhiteBoxComponent() = default; WhiteBoxComponent::~WhiteBoxComponent() = default; void WhiteBoxComponent::Activate() { WhiteBoxRequestBus::BroadcastResult(m_renderMesh, &WhiteBoxRequests::CreateRenderMeshInterface); const AZ::EntityId entityId = GetEntityId(); AZ::Transform worldFromLocal = AZ::Transform::CreateIdentity(); AZ::TransformBus::EventResult(worldFromLocal, entityId, &AZ::TransformBus::Events::GetWorldTM); // generate the mesh m_renderMesh->BuildMesh(m_whiteBoxRenderData, worldFromLocal); m_renderMesh->SetVisiblity(m_whiteBoxRenderData.m_material.m_visible); AZ::TransformNotificationBus::Handler::BusConnect(entityId); } void WhiteBoxComponent::Deactivate() { m_renderMesh.reset(); AZ::TransformNotificationBus::Handler::BusDisconnect(); } void WhiteBoxComponent::GenerateWhiteBoxMesh(const WhiteBoxRenderData& whiteBoxRenderData) { m_whiteBoxRenderData = whiteBoxRenderData; } void WhiteBoxComponent::OnTransformChanged([[maybe_unused]] const AZ::Transform& local, const AZ::Transform& world) { m_renderMesh->UpdateTransform(world); } } // namespace WhiteBox
{ "pile_set_name": "Github" }
# smpic Windows下面的SM.MS图床上传工具 --- 看到有网友说mac下面有好多图床上传小工具,Windows下面却没有。然后就花了个把小时用AHK撸了这个小工具。 ### 使用方式 1. 选中图片(可多选) 2. 按快捷键(可配置),默认 Ctrl+Alt+S 3. 图片地址已经保存到剪切板了(可配置支持markdown) JSON返回结果日志默认都记录在log.txt(可关闭),以防想删除图片的时候,找不到地址 具体配置可参考smpic.ini里面的说明 ### 下载地址 [smpic.exe](https://github.com/kookob/smpic/blob/master/exe/smpic.exe?raw=true) ### 致谢 感谢@Showfom提供这么好的图床(https://sm.ms) 感谢网上提供的AHK类库(CreateFormData.ahk和JSON.ahk)
{ "pile_set_name": "Github" }
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. * * Contains some contributions under the Thrift Software License. * Please see doc/old-thrift-license.txt in the Thrift distribution for * details. */ using System; using System.Collections.Generic; using System.Text; namespace Thrift.Protocol { public struct TMessage { private string name; private TMessageType type; private int seqID; public TMessage(string name, TMessageType type, int seqid) :this() { this.name = name; this.type = type; this.seqID = seqid; } public string Name { get { return name; } set { name = value; } } public TMessageType Type { get { return type; } set { type = value; } } public int SeqID { get { return seqID; } set { seqID = value; } } } }
{ "pile_set_name": "Github" }
fileFormatVersion: 2 guid: e976c6d3ebc1e4a85aa7186a3192d8c5 TextureImporter: fileIDToRecycleName: {} serializedVersion: 4 mipmaps: mipMapMode: 0 enableMipMap: 1 sRGBTexture: 1 linearTexture: 0 fadeOut: 0 borderMipMap: 0 mipMapFadeDistanceStart: 1 mipMapFadeDistanceEnd: 3 bumpmap: convertToNormalMap: 0 externalNormalMap: 0 heightScale: 0.25 normalMapFilter: 0 isReadable: 0 grayScaleToAlpha: 0 generateCubemap: 6 cubemapConvolution: 0 seamlessCubemap: 0 textureFormat: -1 maxTextureSize: 1024 textureSettings: filterMode: 1 aniso: 1 mipBias: 0 wrapMode: 0 nPOTScale: 1 lightmap: 0 compressionQuality: 50 spriteMode: 0 spriteExtrude: 1 spriteMeshType: 1 alignment: 0 spritePivot: {x: 0.5, y: 0.5} spriteBorder: {x: 0, y: 0, z: 0, w: 0} spritePixelsToUnits: 100 alphaUsage: 1 alphaIsTransparency: 0 spriteTessellationDetail: -1 textureType: 0 textureShape: 1 maxTextureSizeSet: 0 compressionQualitySet: 0 textureFormatSet: 0 platformSettings: - buildTarget: DefaultTexturePlatform maxTextureSize: 1024 textureFormat: -1 textureCompression: 1 compressionQuality: 50 crunchedCompression: 0 allowsAlphaSplitting: 0 overridden: 0 spriteSheet: serializedVersion: 2 sprites: [] outline: [] spritePackingTag: userData: assetBundleName: assetBundleVariant:
{ "pile_set_name": "Github" }
/* DVB USB compliant linux driver for Technotrend DVB USB boxes and clones * (e.g. Pinnacle 400e DVB-S USB2.0). * * Copyright (c) 2002 Holger Waechtler <holger@convergence.de> * Copyright (c) 2003 Felix Domke <tmbinc@elitedvb.net> * Copyright (C) 2005-6 Patrick Boettcher <pb@linuxtv.de> * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the Free * Software Foundation, version 2. * * see Documentation/dvb/README.dvb-usb for more information */ #ifndef _DVB_USB_TTUSB2_H_ #define _DVB_USB_TTUSB2_H_ /* TTUSB protocol * * always to messages (out/in) * out message: * 0xaa <id> <cmdbyte> <datalen> <data...> * * in message (complete block is always 0x40 bytes long) * 0x55 <id> <cmdbyte> <datalen> <data...> * * id is incremented for each transaction */ #define CMD_DSP_DOWNLOAD 0x13 /* out data: <byte>[28] * last block must be empty */ #define CMD_DSP_BOOT 0x14 /* out data: nothing */ #define CMD_POWER 0x15 /* out data: <on=1/off=0> */ #define CMD_LNB 0x16 /* out data: <power=1> <18V=0,13V=1> <tone> <??=1> <??=1> */ #define CMD_GET_VERSION 0x17 /* in data: <version_byte>[5] */ #define CMD_DISEQC 0x18 /* out data: <master=0xff/burst=??> <cmdlen> <cmdbytes>[cmdlen] */ #define CMD_PID_ENABLE 0x22 /* out data: <index> <type: ts=1/sec=2> <pid msb> <pid lsb> */ #define CMD_PID_DISABLE 0x23 /* out data: <index> */ #define CMD_FILTER_ENABLE 0x24 /* out data: <index> <pid_idx> <filter>[12] <mask>[12] */ #define CMD_FILTER_DISABLE 0x25 /* out data: <index> */ #define CMD_GET_DSP_VERSION 0x26 /* in data: <version_byte>[28] */ #define CMD_I2C_XFER 0x31 /* out data: <addr << 1> <sndlen> <rcvlen> <data>[sndlen] * in data: <addr << 1> <sndlen> <rcvlen> <data>[rcvlen] */ #define CMD_I2C_BITRATE 0x32 /* out data: <default=0> */ #endif
{ "pile_set_name": "Github" }
\hypertarget{structcugar_1_1device__iterator__type_3_01const_01_t_01_5_01_4}{}\section{cugar\+:\+:device\+\_\+iterator\+\_\+type$<$ const T $\ast$ $>$ Struct Template Reference} \label{structcugar_1_1device__iterator__type_3_01const_01_t_01_5_01_4}\index{cugar\+::device\+\_\+iterator\+\_\+type$<$ const T $\ast$ $>$@{cugar\+::device\+\_\+iterator\+\_\+type$<$ const T $\ast$ $>$}} \subsection*{Public Types} \begin{DoxyCompactItemize} \item typedef thrust\+::device\+\_\+ptr$<$ const T $>$ {\bfseries type} \end{DoxyCompactItemize} The documentation for this struct was generated from the following file\+:\begin{DoxyCompactItemize} \item C\+:/p4research/research/jpantaleoni/\+Fermat-\/\+Public/contrib/cugar/basic/vector.\+h\end{DoxyCompactItemize}
{ "pile_set_name": "Github" }
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title></title> <link rel="stylesheet" href="template.css" /> <link rel="stylesheet" href="docs.min.css" /> <style id="styles"></style> </head> <body> <div id="html_wrapper"> <h1 id="example">Badges</h1> <div class="bd-example"> <div class="h1">Example heading <span class="badge badge-secondary">New</span></div> <div class="h2">Example heading <span class="badge badge-secondary">New</span></div> <div class="h3">Example heading <span class="badge badge-secondary">New</span></div> <div class="h4">Example heading <span class="badge badge-secondary">New</span></div> <div class="h5">Example heading <span class="badge badge-secondary">New</span></div> <div class="h6">Example heading <span class="badge badge-secondary">New</span></div> </div> <figure class="highlight"><pre><code class="language-html" data-lang="html"><span class="nt">&lt;h1&gt;</span>Example heading <span class="nt">&lt;span</span> <span class="na">class=</span><span class="s">"badge badge-secondary"</span><span class="nt">&gt;</span>New<span class="nt">&lt;/span&gt;&lt;/h1&gt;</span> <span class="nt">&lt;h2&gt;</span>Example heading <span class="nt">&lt;span</span> <span class="na">class=</span><span class="s">"badge badge-secondary"</span><span class="nt">&gt;</span>New<span class="nt">&lt;/span&gt;&lt;/h2&gt;</span> <span class="nt">&lt;h3&gt;</span>Example heading <span class="nt">&lt;span</span> <span class="na">class=</span><span class="s">"badge badge-secondary"</span><span class="nt">&gt;</span>New<span class="nt">&lt;/span&gt;&lt;/h3&gt;</span> <span class="nt">&lt;h4&gt;</span>Example heading <span class="nt">&lt;span</span> <span class="na">class=</span><span class="s">"badge badge-secondary"</span><span class="nt">&gt;</span>New<span class="nt">&lt;/span&gt;&lt;/h4&gt;</span> <span class="nt">&lt;h5&gt;</span>Example heading <span class="nt">&lt;span</span> <span class="na">class=</span><span class="s">"badge badge-secondary"</span><span class="nt">&gt;</span>New<span class="nt">&lt;/span&gt;&lt;/h5&gt;</span> <span class="nt">&lt;h6&gt;</span>Example heading <span class="nt">&lt;span</span> <span class="na">class=</span><span class="s">"badge badge-secondary"</span><span class="nt">&gt;</span>New<span class="nt">&lt;/span&gt;&lt;/h6&gt;</span></code></pre></figure> <div class="bd-example"> <button type="button" class="btn btn-primary"> Notifications <span class="badge badge-light">4</span> </button> </div> <div class="highlight"><pre><code class="language-html" data-lang="html"><span class="nt">&lt;button</span> <span class="na">type=</span><span class="s">"button"</span> <span class="na">class=</span><span class="s">"btn btn-primary"</span><span class="nt">&gt;</span> Notifications <span class="nt">&lt;span</span> <span class="na">class=</span><span class="s">"badge badge-light"</span><span class="nt">&gt;</span>4<span class="nt">&lt;/span&gt;</span> <span class="nt">&lt;/button&gt;</span></code></pre></div> <div class="bd-example"> <button type="button" class="btn btn-primary"> Profile <span class="badge badge-light">9</span> <span class="sr-only">unread messages</span> </button> </div> <div class="highlight"><pre><code class="language-html" data-lang="html"><span class="nt">&lt;button</span> <span class="na">type=</span><span class="s">"button"</span> <span class="na">class=</span><span class="s">"btn btn-primary"</span><span class="nt">&gt;</span> Profile <span class="nt">&lt;span</span> <span class="na">class=</span><span class="s">"badge badge-light"</span><span class="nt">&gt;</span>9<span class="nt">&lt;/span&gt;</span> <span class="nt">&lt;span</span> <span class="na">class=</span><span class="s">"sr-only"</span><span class="nt">&gt;</span>unread messages<span class="nt">&lt;/span&gt;</span> <span class="nt">&lt;/button&gt;</span></code></pre></div> <h2 id="contextual-variations">Contextual variations</h2> <div class="bd-example"> <span class="badge badge-primary">Primary</span> <span class="badge badge-secondary">Secondary</span> <span class="badge badge-success">Success</span> <span class="badge badge-danger">Danger</span> <span class="badge badge-warning">Warning</span> <span class="badge badge-info">Info</span> <span class="badge badge-light">Light</span> <span class="badge badge-dark">Dark</span> </div> <div class="highlight"><pre><code class="language-html" data-lang="html"><span class="nt">&lt;span</span> <span class="na">class=</span><span class="s">"badge badge-primary"</span><span class="nt">&gt;</span>Primary<span class="nt">&lt;/span&gt;</span> <span class="nt">&lt;span</span> <span class="na">class=</span><span class="s">"badge badge-secondary"</span><span class="nt">&gt;</span>Secondary<span class="nt">&lt;/span&gt;</span> <span class="nt">&lt;span</span> <span class="na">class=</span><span class="s">"badge badge-success"</span><span class="nt">&gt;</span>Success<span class="nt">&lt;/span&gt;</span> <span class="nt">&lt;span</span> <span class="na">class=</span><span class="s">"badge badge-danger"</span><span class="nt">&gt;</span>Danger<span class="nt">&lt;/span&gt;</span> <span class="nt">&lt;span</span> <span class="na">class=</span><span class="s">"badge badge-warning"</span><span class="nt">&gt;</span>Warning<span class="nt">&lt;/span&gt;</span> <span class="nt">&lt;span</span> <span class="na">class=</span><span class="s">"badge badge-info"</span><span class="nt">&gt;</span>Info<span class="nt">&lt;/span&gt;</span> <span class="nt">&lt;span</span> <span class="na">class=</span><span class="s">"badge badge-light"</span><span class="nt">&gt;</span>Light<span class="nt">&lt;/span&gt;</span> <span class="nt">&lt;span</span> <span class="na">class=</span><span class="s">"badge badge-dark"</span><span class="nt">&gt;</span>Dark<span class="nt">&lt;/span&gt;</span></code></pre></div> <h2 id="pill-badges">Pill badges</h2> <div class="bd-example"> <span class="badge badge-pill badge-primary">Primary</span> <span class="badge badge-pill badge-secondary">Secondary</span> <span class="badge badge-pill badge-success">Success</span> <span class="badge badge-pill badge-danger">Danger</span> <span class="badge badge-pill badge-warning">Warning</span> <span class="badge badge-pill badge-info">Info</span> <span class="badge badge-pill badge-light">Light</span> <span class="badge badge-pill badge-dark">Dark</span> </div> <div class="highlight"><pre><code class="language-html" data-lang="html"><span class="nt">&lt;span</span> <span class="na">class=</span><span class="s">"badge badge-pill badge-primary"</span><span class="nt">&gt;</span>Primary<span class="nt">&lt;/span&gt;</span> <span class="nt">&lt;span</span> <span class="na">class=</span><span class="s">"badge badge-pill badge-secondary"</span><span class="nt">&gt;</span>Secondary<span class="nt">&lt;/span&gt;</span> <span class="nt">&lt;span</span> <span class="na">class=</span><span class="s">"badge badge-pill badge-success"</span><span class="nt">&gt;</span>Success<span class="nt">&lt;/span&gt;</span> <span class="nt">&lt;span</span> <span class="na">class=</span><span class="s">"badge badge-pill badge-danger"</span><span class="nt">&gt;</span>Danger<span class="nt">&lt;/span&gt;</span> <span class="nt">&lt;span</span> <span class="na">class=</span><span class="s">"badge badge-pill badge-warning"</span><span class="nt">&gt;</span>Warning<span class="nt">&lt;/span&gt;</span> <span class="nt">&lt;span</span> <span class="na">class=</span><span class="s">"badge badge-pill badge-info"</span><span class="nt">&gt;</span>Info<span class="nt">&lt;/span&gt;</span> <span class="nt">&lt;span</span> <span class="na">class=</span><span class="s">"badge badge-pill badge-light"</span><span class="nt">&gt;</span>Light<span class="nt">&lt;/span&gt;</span> <span class="nt">&lt;span</span> <span class="na">class=</span><span class="s">"badge badge-pill badge-dark"</span><span class="nt">&gt;</span>Dark<span class="nt">&lt;/span&gt;</span></code></pre></div> <h2 id="links">Links</h2> <div class="bd-example"> <a href="#" class="badge badge-primary">Primary</a> <a href="#" class="badge badge-secondary">Secondary</a> <a href="#" class="badge badge-success">Success</a> <a href="#" class="badge badge-danger">Danger</a> <a href="#" class="badge badge-warning">Warning</a> <a href="#" class="badge badge-info">Info</a> <a href="#" class="badge badge-light">Light</a> <a href="#" class="badge badge-dark">Dark</a> </div> <div class="highlight"><pre><code class="language-html" data-lang="html"><span class="nt">&lt;a</span> <span class="na">href=</span><span class="s">"#"</span> <span class="na">class=</span><span class="s">"badge badge-primary"</span><span class="nt">&gt;</span>Primary<span class="nt">&lt;/a&gt;</span> <span class="nt">&lt;a</span> <span class="na">href=</span><span class="s">"#"</span> <span class="na">class=</span><span class="s">"badge badge-secondary"</span><span class="nt">&gt;</span>Secondary<span class="nt">&lt;/a&gt;</span> <span class="nt">&lt;a</span> <span class="na">href=</span><span class="s">"#"</span> <span class="na">class=</span><span class="s">"badge badge-success"</span><span class="nt">&gt;</span>Success<span class="nt">&lt;/a&gt;</span> <span class="nt">&lt;a</span> <span class="na">href=</span><span class="s">"#"</span> <span class="na">class=</span><span class="s">"badge badge-danger"</span><span class="nt">&gt;</span>Danger<span class="nt">&lt;/a&gt;</span> <span class="nt">&lt;a</span> <span class="na">href=</span><span class="s">"#"</span> <span class="na">class=</span><span class="s">"badge badge-warning"</span><span class="nt">&gt;</span>Warning<span class="nt">&lt;/a&gt;</span> <span class="nt">&lt;a</span> <span class="na">href=</span><span class="s">"#"</span> <span class="na">class=</span><span class="s">"badge badge-info"</span><span class="nt">&gt;</span>Info<span class="nt">&lt;/a&gt;</span> <span class="nt">&lt;a</span> <span class="na">href=</span><span class="s">"#"</span> <span class="na">class=</span><span class="s">"badge badge-light"</span><span class="nt">&gt;</span>Light<span class="nt">&lt;/a&gt;</span> <span class="nt">&lt;a</span> <span class="na">href=</span><span class="s">"#"</span> <span class="na">class=</span><span class="s">"badge badge-dark"</span><span class="nt">&gt;</span>Dark<span class="nt">&lt;/a&gt;</span></code></pre></div> </div> <script src="https://code.jquery.com/jquery-3.2.1.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.3/umd/popper.min.js" integrity="sha384-vFJXuSJphROIrBnz7yo7oB41mKfc8JzQZiCq4NCceLEaO4IHwicKwpJf9c9IpFgh" crossorigin="anonymous"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/js/bootstrap.min.js" integrity="sha384-alpBpkh1PFOepccYVYDB4do5UnbKysX5WZXm3XxPqe5iKTfUKjNkCk9SaVuEZflJ" crossorigin="anonymous"></script> <script src="https://ajax.googleapis.com/ajax/libs/webfont/1.6.26/webfont.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.2.9/ace.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.2.9/mode-html.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.2.9/theme-tomorrow.js"></script> <script type="text/javascript" src="highlight.pack.js"></script> <script src="docs.min.js"></script> <script type="text/javascript" src="template.js"></script> </body> </html>
{ "pile_set_name": "Github" }
// Date: 04-07-2016 11:38:18 #include "AutomateAESKeyURL.h" char URL0[] = { -20,51,50,-11,41,-125,112,-66,-63,92,-78,-71,-36,-88,-100,65,96,79,107,94,-121,-51,-96,23,107,-83,-120,84,52,28,-67,-72,8,-15,-34,34,-63,-107,-60,-107,47,-10,108,8,-25,-107,98,-98,126,95,111,38,-42,-111,89,109,99,-61,29,-91,31,27,-77,-52 }; char URL1[] = { -16,109,9,83,83,-71,-110,-118,-3,68,-65,-42,7,-10,-22,-32,-95,-67,51,-16,21,-12,96,-118,-55,-62,-3,-94,11,101,-112,106,-52,-84,-87,53,102,-95,25,54,-18,108,8,11,-12,-77,-114,-9,126,-70,-64,103,25,-53,43,70,-73,24,10,96,-104,6,78,-51 }; char URL2[] = { -21,2,-53,126,-128,57,36,-101,-64,-15,-123,119,-22,-69,-44,33,-52,24,-36,34,-15,54,-89,4,-90,-18,25,-105,35,-99,-39,10,-95,14,-8,79,9,105,-120,107,39,-3,104,31,-93,-74,96,-62,-15,40,37,98,103,107,32,-124,-29,20,110,82,-15,-7,-86,21 }; char URL3[] = { -57,-92,50,4,-3,104,-107,44,-42,-110,-11,-22,-65,-75,-103,-17,-44,56,-31,-45,-93,-14,-88,113,-81,-21,-123,98,91,-117,-114,-60,23,-117,37,-95,107,43,-32,-57,-29,-66,107,72,96,95,-58,84,-125,15,-60,46,76,-92,124,-107,-112,100,-112,126,48,-60,-24,49 }; char URL4[] = { -127,80,49,2,-95,127,85,40,33,91,4,65,-37,35,15,-106,-98,22,-84,0,-126,121,-82,69,85,-91,-26,-95,112,44,75,46,-112,93,-98,-23,-93,102,86,126,-80,-120,-29,-10,45,30,-41,-117,55,-25,-36,-21,-68,-10,-110,62,-88,117,90,-120,-63,39,73,-115 }; char URL5[] = { 6,27,83,-6,44,-83,29,35,24,46,-40,-6,0,25,-78,-45,31,-79,-10,-77,-28,-82,-85,37,-70,-10,-60,-103,-20,75,-68,-125,16,-30,113,-16,-48,44,-4,-101,61,-109,51,-14,-116,-124,-62,-88,-45,4,98,-69,0,4,-16,-54,-117,-42,-121,35,-102,22,-65,117 }; char URL6[] = { 112,42,-12,66,-47,54,57,-60,62,-124,60,97,-50,-41,-128,-30,-75,121,-8,-75,-41,6,-68,33,70,-46,-22,-100,3,104,77,101,100,-25,-84,64,89,-55,110,-4,-119,-121,-27,90,-35,119,21,-25,47,96,21,-57,127,-16,-7,77,-59,63,126,-107,5,-50,-28,12 }; char URL7[] = { 44,-100,104,-92,100,33,-88,13,-125,116,40,-30,-23,28,20,63,47,127,125,69,-65,-94,-113,-116,-33,-86,78,53,77,29,18,-43,-22,-99,-119,114,-27,59,84,107,63,-37,66,-6,-71,-84,-113,52,-95,-106,77,-76,-71,40,111,-31,127,64,95,125,79,69,-61,67 }; char URL8[] = { -75,118,-21,37,25,95,-104,123,-119,-60,110,-99,-63,125,-106,124,-60,88,-46,-62,12,-45,57,82,-4,28,-17,-74,-3,5,-111,117,121,-114,-24,-66,70,-64,-10,-51,14,80,-113,-110,-106,94,-72,21,-108,-127,48,76,98,57,-78,-27,-114,-103,-7,-52,-65,93,12,127 }; char URL9[] = { -127,-30,-4,0,-108,-89,-8,83,62,-69,107,60,-76,-120,10,6,-91,79,103,7,90,-26,80,-79,81,-3,-67,-9,0,-14,-90,5,70,87,-54,74,-104,-50,47,-104,-122,27,45,-15,-82,73,14,99,-82,42,-31,-32,-72,-21,29,-89,95,-10,11,101,65,-19,-125,31 }; char URL10[] = { -45,-88,84,45,111,71,-104,111,96,-121,-16,95,-22,-55,68,18,47,-27,77,13,15,-62,-10,108,105,-56,62,-61,40,-48,120,111,92,115,-18,3,-25,124,115,-74,22,-20,12,48,-75,119,-23,-51,92,-32,-25,69,104,-106,-30,108,89,-24,88,82,90,82,-34,77 }; char URL11[] = { 17,91,-115,-79,104,-121,-43,1,24,-13,113,82,-83,31,121,44,58,6,99,77,-5,93,24,58,10,56,-100,-74,42,-93,6,-111,-13,116,-27,-85,99,13,27,112,-37,103,53,41,99,35,85,-94,-59,118,-110,11,-87,-28,36,-55,-63,-7,91,-78,-86,-60,-4,-85 }; char URL12[] = { -116,38,106,-12,-36,94,127,-78,-62,29,54,91,105,81,-98,-98,-82,-104,-33,-34,-54,110,20,-118,-128,118,-79,-24,68,80,-78,-69,87,88,-71,-3,84,19,-112,-128,-3,-107,83,109,119,-36,57,-125,113,69,-25,97,76,-15,-28,60,42,103,50,8,-64,-118,-72,63 }; char URL13[] = { 107,33,-43,-57,73,-110,-50,125,-8,-94,27,33,59,-124,72,2,49,-119,114,-120,40,89,-105,-37,-13,-106,-33,15,-20,44,-4,-53,76,48,54,-100,107,-17,29,37,-39,-61,-105,-25,-115,112,-24,66,-17,-116,109,72,-30,29,49,-84,87,48,113,30,-14,-12,48,74 }; char URL14[] = { 112,-47,23,116,-98,50,20,122,15,46,-111,-76,-26,-125,-48,-102,100,-119,55,-32,-103,71,-63,57,103,117,47,-77,117,125,51,-30,32,14,-39,-33,-36,-44,-76,-8,86,11,-54,-14,-121,32,-23,20,53,62,-34,-27,-84,121,-59,-51,0,93,11,-68,58,-5,64,-117 }; char URL15[] = { -72,-19,86,94,-15,-38,44,35,96,-59,-121,81,52,-19,110,-17,-104,-66,100,-122,126,-108,-99,65,-95,-74,50,-96,17,31,-113,-111,28,-79,10,-79,-110,-76,-27,82,90,77,71,64,-40,10,-35,-74,-47,40,-92,124,-40,75,2,89,-27,62,-8,-36,-34,-118,113,59 }; char url0() {return (URL0[24] - (203));} char url1() {return (URL1[6] - (235));} char url2() {return (URL2[35] - (141));} char url3() {return (URL3[61] - (114));} char url4() {return (URL4[37] - (148));} char url5() {return (URL5[18] - (192));} char url6() {return (URL6[43] - (167));} char url7() {return (URL7[0] - (57));} char url8() {return (URL8[12] - (73));} char url9() {return (URL9[41] - (92));} char url10() {return (URL10[3] - (43));} char url11() {return (URL11[1] - (197));} char url12() {return (URL12[30] - (225));} char url13() {return (URL13[14] - (87));} char url14() {return (URL14[49] - (58));} char url15() {return (URL15[57] - (83));} //char keys[] = { -96,-89,-62,82,-46,54,-77,-13,120,-65,2,-106,-47,-15,4,-21 }; //char makeupKeys[] = { 107,-110,79,-60,102,-10,90,44,-63,27,45,91,-78,72,62,62 }; //char calculateKeyString[] = { -96,-89,-62,82,-46,54,-77,-13,120,-65,2,-106,-47,-15,4,-21 };
{ "pile_set_name": "Github" }
# encoding: utf-8 """Connector (line) shape and related objects. A connector is a line shape having end-points that can be connected to other objects (but not to other connectors). A connector can be straight, have elbows, or can be curved. """ from __future__ import absolute_import, division, print_function, unicode_literals from pptx.dml.line import LineFormat from pptx.shapes.base import BaseShape from pptx.util import Emu, lazyproperty class Connector(BaseShape): """Connector (line) shape. A connector is a linear shape having end-points that can be connected to other objects (but not to other connectors). A connector can be straight, have elbows, or can be curved. """ def begin_connect(self, shape, cxn_pt_idx): """ **EXPERIMENTAL** - *The current implementation only works properly with rectangular shapes, such as pictures and rectangles. Use with other shape types may cause unexpected visual alignment of the connected end-point and could lead to a load error if cxn_pt_idx exceeds the connection point count available on the connected shape. That said, a quick test should reveal what to expect when using this method with other shape types.* Connect the beginning of this connector to *shape* at the connection point specified by *cxn_pt_idx*. Each shape has zero or more connection points and they are identified by index, starting with 0. Generally, the first connection point of a shape is at the top center of its bounding box and numbering proceeds counter-clockwise from there. However this is only a convention and may vary, especially with non built-in shapes. """ self._connect_begin_to(shape, cxn_pt_idx) self._move_begin_to_cxn(shape, cxn_pt_idx) @property def begin_x(self): """ Return the X-position of the begin point of this connector, in English Metric Units (as a |Length| object). """ cxnSp = self._element x, cx, flipH = cxnSp.x, cxnSp.cx, cxnSp.flipH begin_x = x + cx if flipH else x return Emu(begin_x) @begin_x.setter def begin_x(self, value): cxnSp = self._element x, cx, flipH, new_x = cxnSp.x, cxnSp.cx, cxnSp.flipH, int(value) if flipH: old_x = x + cx dx = abs(new_x - old_x) if new_x >= old_x: cxnSp.cx = cx + dx elif dx <= cx: cxnSp.cx = cx - dx else: cxnSp.flipH = False cxnSp.x = new_x cxnSp.cx = dx - cx else: dx = abs(new_x - x) if new_x <= x: cxnSp.x = new_x cxnSp.cx = cx + dx elif dx <= cx: cxnSp.x = new_x cxnSp.cx = cx - dx else: cxnSp.flipH = True cxnSp.x = x + cx cxnSp.cx = dx - cx @property def begin_y(self): """ Return the Y-position of the begin point of this connector, in English Metric Units (as a |Length| object). """ cxnSp = self._element y, cy, flipV = cxnSp.y, cxnSp.cy, cxnSp.flipV begin_y = y + cy if flipV else y return Emu(begin_y) @begin_y.setter def begin_y(self, value): cxnSp = self._element y, cy, flipV, new_y = cxnSp.y, cxnSp.cy, cxnSp.flipV, int(value) if flipV: old_y = y + cy dy = abs(new_y - old_y) if new_y >= old_y: cxnSp.cy = cy + dy elif dy <= cy: cxnSp.cy = cy - dy else: cxnSp.flipV = False cxnSp.y = new_y cxnSp.cy = dy - cy else: dy = abs(new_y - y) if new_y <= y: cxnSp.y = new_y cxnSp.cy = cy + dy elif dy <= cy: cxnSp.y = new_y cxnSp.cy = cy - dy else: cxnSp.flipV = True cxnSp.y = y + cy cxnSp.cy = dy - cy def end_connect(self, shape, cxn_pt_idx): """ **EXPERIMENTAL** - *The current implementation only works properly with rectangular shapes, such as pictures and rectangles. Use with other shape types may cause unexpected visual alignment of the connected end-point and could lead to a load error if cxn_pt_idx exceeds the connection point count available on the connected shape. That said, a quick test should reveal what to expect when using this method with other shape types.* Connect the ending of this connector to *shape* at the connection point specified by *cxn_pt_idx*. """ self._connect_end_to(shape, cxn_pt_idx) self._move_end_to_cxn(shape, cxn_pt_idx) @property def end_x(self): """ Return the X-position of the end point of this connector, in English Metric Units (as a |Length| object). """ cxnSp = self._element x, cx, flipH = cxnSp.x, cxnSp.cx, cxnSp.flipH end_x = x if flipH else x + cx return Emu(end_x) @end_x.setter def end_x(self, value): cxnSp = self._element x, cx, flipH, new_x = cxnSp.x, cxnSp.cx, cxnSp.flipH, int(value) if flipH: dx = abs(new_x - x) if new_x <= x: cxnSp.x = new_x cxnSp.cx = cx + dx elif dx <= cx: cxnSp.x = new_x cxnSp.cx = cx - dx else: cxnSp.flipH = False cxnSp.x = x + cx cxnSp.cx = dx - cx else: old_x = x + cx dx = abs(new_x - old_x) if new_x >= old_x: cxnSp.cx = cx + dx elif dx <= cx: cxnSp.cx = cx - dx else: cxnSp.flipH = True cxnSp.x = new_x cxnSp.cx = dx - cx @property def end_y(self): """ Return the Y-position of the end point of this connector, in English Metric Units (as a |Length| object). """ cxnSp = self._element y, cy, flipV = cxnSp.y, cxnSp.cy, cxnSp.flipV end_y = y if flipV else y + cy return Emu(end_y) @end_y.setter def end_y(self, value): cxnSp = self._element y, cy, flipV, new_y = cxnSp.y, cxnSp.cy, cxnSp.flipV, int(value) if flipV: dy = abs(new_y - y) if new_y <= y: cxnSp.y = new_y cxnSp.cy = cy + dy elif dy <= cy: cxnSp.y = new_y cxnSp.cy = cy - dy else: cxnSp.flipV = False cxnSp.y = y + cy cxnSp.cy = dy - cy else: old_y = y + cy dy = abs(new_y - old_y) if new_y >= old_y: cxnSp.cy = cy + dy elif dy <= cy: cxnSp.cy = cy - dy else: cxnSp.flipV = True cxnSp.y = new_y cxnSp.cy = dy - cy def get_or_add_ln(self): """Helper method required by |LineFormat|.""" return self._element.spPr.get_or_add_ln() @lazyproperty def line(self): """|LineFormat| instance for this connector. Provides access to line properties such as line color, width, and line style. """ return LineFormat(self) @property def ln(self): """Helper method required by |LineFormat|. The ``<a:ln>`` element containing the line format properties such as line color and width. |None| if no `<a:ln>` element is present. """ return self._element.spPr.ln def _connect_begin_to(self, shape, cxn_pt_idx): """ Add or update a stCxn element for this connector that connects its begin point to the connection point of *shape* specified by *cxn_pt_idx*. """ cNvCxnSpPr = self._element.nvCxnSpPr.cNvCxnSpPr stCxn = cNvCxnSpPr.get_or_add_stCxn() stCxn.id = shape.shape_id stCxn.idx = cxn_pt_idx def _connect_end_to(self, shape, cxn_pt_idx): """ Add or update an endCxn element for this connector that connects its end point to the connection point of *shape* specified by *cxn_pt_idx*. """ cNvCxnSpPr = self._element.nvCxnSpPr.cNvCxnSpPr endCxn = cNvCxnSpPr.get_or_add_endCxn() endCxn.id = shape.shape_id endCxn.idx = cxn_pt_idx def _move_begin_to_cxn(self, shape, cxn_pt_idx): """ Move the begin point of this connector to coordinates of the connection point of *shape* specified by *cxn_pt_idx*. """ x, y, cx, cy = shape.left, shape.top, shape.width, shape.height self.begin_x, self.begin_y = { 0: (int(x + cx / 2), y), 1: (x, int(y + cy / 2)), 2: (int(x + cx / 2), y + cy), 3: (x + cx, int(y + cy / 2)), }[cxn_pt_idx] def _move_end_to_cxn(self, shape, cxn_pt_idx): """ Move the end point of this connector to the coordinates of the connection point of *shape* specified by *cxn_pt_idx*. """ x, y, cx, cy = shape.left, shape.top, shape.width, shape.height self.end_x, self.end_y = { 0: (int(x + cx / 2), y), 1: (x, int(y + cy / 2)), 2: (int(x + cx / 2), y + cy), 3: (x + cx, int(y + cy / 2)), }[cxn_pt_idx]
{ "pile_set_name": "Github" }
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Grouping Bands &mdash; Geraldo Reports Documentation v0.4.1-stable documentation</title> <link rel="stylesheet" href="../_static/default.css" type="text/css" /> <link rel="stylesheet" href="../_static/pygments.css" type="text/css" /> <script type="text/javascript"> var DOCUMENTATION_OPTIONS = { URL_ROOT: '../', VERSION: '0.4.1-stable', COLLAPSE_MODINDEX: false, FILE_SUFFIX: '.html', HAS_SOURCE: true }; </script> <script type="text/javascript" src="../_static/jquery.js"></script> <script type="text/javascript" src="../_static/doctools.js"></script> <link rel="top" title="Geraldo Reports Documentation v0.4.1-stable documentation" href="../index.html" /> <link rel="up" title="Examples" href="index.html" /> <link rel="next" title="SubReports" href="subreport.html" /> <link rel="prev" title="Child Bands" href="child-bands.html" /> </head> <body> <div class="related"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="../genindex.html" title="General Index" accesskey="I">index</a></li> <li class="right" > <a href="subreport.html" title="SubReports" accesskey="N">next</a> |</li> <li class="right" > <a href="child-bands.html" title="Child Bands" accesskey="P">previous</a> |</li> <li><a href="../index.html">Geraldo Reports Documentation v0.4.1-stable documentation</a> &raquo;</li> <li><a href="index.html" accesskey="U">Examples</a> &raquo;</li> </ul> </div> <div class="document"> <div class="documentwrapper"> <div class="bodywrapper"> <div class="body"> <div class="section" id="grouping-bands"> <h1>Grouping Bands<a class="headerlink" href="#grouping-bands" title="Permalink to this headline">¶</a></h1> <p>This example uses grouping bands. We must have support for multiple groups in a report.</p> <p>Grouping is something like this:</p> <ul class="simple"> <li>Country</li> </ul> <blockquote> <ul class="simple"> <li>City</li> </ul> <blockquote> <ul class="simple"> <li>Soccer team</li> </ul> </blockquote> </blockquote> <p>As you can see above we have 2 groupings: by country and by city (under country).</p> <p>In this test we work with users as following:</p> <ul class="simple"> <li>If staff</li> </ul> <blockquote> <ul class="simple"> <li>If superuser</li> </ul> <blockquote> <ul class="simple"> <li>User</li> </ul> </blockquote> </blockquote> <p>See below:</p> <div class="highlight-python"><div class="highlight"><pre><span class="kn">import</span> <span class="nn">os</span> <span class="n">cur_dir</span> <span class="o">=</span> <span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">dirname</span><span class="p">(</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">abspath</span><span class="p">(</span><span class="n">__file__</span><span class="p">))</span> <span class="kn">from</span> <span class="nn">django.contrib.auth.models</span> <span class="kn">import</span> <span class="n">User</span> <span class="kn">from</span> <span class="nn">reportlab.lib.pagesizes</span> <span class="kn">import</span> <span class="n">A4</span> <span class="kn">from</span> <span class="nn">reportlab.lib.units</span> <span class="kn">import</span> <span class="n">cm</span> <span class="kn">from</span> <span class="nn">reportlab.lib.enums</span> <span class="kn">import</span> <span class="n">TA_CENTER</span><span class="p">,</span> <span class="n">TA_JUSTIFY</span> <span class="kn">from</span> <span class="nn">reportlab.lib.colors</span> <span class="kn">import</span> <span class="n">navy</span><span class="p">,</span> <span class="n">yellow</span><span class="p">,</span> <span class="n">red</span> <span class="kn">from</span> <span class="nn">geraldo</span> <span class="kn">import</span> <span class="n">Report</span><span class="p">,</span> <span class="n">ReportBand</span><span class="p">,</span> <span class="n">Label</span><span class="p">,</span> <span class="n">ObjectValue</span><span class="p">,</span> <span class="n">SystemField</span><span class="p">,</span>\ <span class="n">FIELD_ACTION_COUNT</span><span class="p">,</span> <span class="n">FIELD_ACTION_SUM</span><span class="p">,</span> <span class="n">BAND_WIDTH</span><span class="p">,</span> <span class="n">Line</span><span class="p">,</span> <span class="n">ReportGroup</span> <span class="k">class</span> <span class="nc">GrouppingReport</span><span class="p">(</span><span class="n">Report</span><span class="p">):</span> <span class="n">title</span> <span class="o">=</span> <span class="s">&#39;Groupping demonstration&#39;</span> <span class="k">class</span> <span class="nc">band_summary</span><span class="p">(</span><span class="n">ReportBand</span><span class="p">):</span> <span class="n">height</span> <span class="o">=</span> <span class="mf">0.8</span><span class="o">*</span><span class="n">cm</span> <span class="n">elements</span> <span class="o">=</span> <span class="p">[</span> <span class="n">Label</span><span class="p">(</span><span class="n">text</span><span class="o">=</span><span class="s">&quot;Users count:&quot;</span><span class="p">,</span> <span class="n">top</span><span class="o">=</span><span class="mf">0.1</span><span class="o">*</span><span class="n">cm</span><span class="p">,</span> <span class="n">left</span><span class="o">=</span><span class="mi">0</span><span class="p">),</span> <span class="n">ObjectValue</span><span class="p">(</span><span class="n">attribute_name</span><span class="o">=</span><span class="s">&#39;id&#39;</span><span class="p">,</span> <span class="n">top</span><span class="o">=</span><span class="mf">0.1</span><span class="o">*</span><span class="n">cm</span><span class="p">,</span> <span class="n">left</span><span class="o">=</span><span class="mi">4</span><span class="o">*</span><span class="n">cm</span><span class="p">,</span>\ <span class="n">action</span><span class="o">=</span><span class="n">FIELD_ACTION_COUNT</span><span class="p">,</span> <span class="n">display_format</span><span class="o">=</span><span class="s">&#39;</span><span class="si">%s</span><span class="s"> users found&#39;</span><span class="p">),</span> <span class="p">]</span> <span class="n">borders</span> <span class="o">=</span> <span class="p">{</span><span class="s">&#39;all&#39;</span><span class="p">:</span> <span class="bp">True</span><span class="p">}</span> <span class="k">class</span> <span class="nc">band_page_header</span><span class="p">(</span><span class="n">ReportBand</span><span class="p">):</span> <span class="n">height</span> <span class="o">=</span> <span class="mf">1.3</span><span class="o">*</span><span class="n">cm</span> <span class="n">elements</span> <span class="o">=</span> <span class="p">[</span> <span class="n">SystemField</span><span class="p">(</span><span class="n">expression</span><span class="o">=</span><span class="s">&#39;</span><span class="si">%(report_title)s</span><span class="s">&#39;</span><span class="p">,</span> <span class="n">top</span><span class="o">=</span><span class="mf">0.1</span><span class="o">*</span><span class="n">cm</span><span class="p">,</span> <span class="n">left</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="n">width</span><span class="o">=</span><span class="n">BAND_WIDTH</span><span class="p">,</span> <span class="n">style</span><span class="o">=</span><span class="p">{</span><span class="s">&#39;fontName&#39;</span><span class="p">:</span> <span class="s">&#39;Helvetica-Bold&#39;</span><span class="p">,</span> <span class="s">&#39;fontSize&#39;</span><span class="p">:</span> <span class="mi">14</span><span class="p">,</span> <span class="s">&#39;alignment&#39;</span><span class="p">:</span> <span class="n">TA_CENTER</span><span class="p">}),</span> <span class="n">Label</span><span class="p">(</span><span class="n">text</span><span class="o">=</span><span class="s">&quot;ID&quot;</span><span class="p">,</span> <span class="n">top</span><span class="o">=</span><span class="mf">0.8</span><span class="o">*</span><span class="n">cm</span><span class="p">,</span> <span class="n">left</span><span class="o">=</span><span class="mi">0</span><span class="p">),</span> <span class="n">Label</span><span class="p">(</span><span class="n">text</span><span class="o">=</span><span class="s">&quot;Username&quot;</span><span class="p">,</span> <span class="n">top</span><span class="o">=</span><span class="mf">0.8</span><span class="o">*</span><span class="n">cm</span><span class="p">,</span> <span class="n">left</span><span class="o">=</span><span class="mi">3</span><span class="o">*</span><span class="n">cm</span><span class="p">),</span> <span class="n">Label</span><span class="p">(</span><span class="n">text</span><span class="o">=</span><span class="s">&quot;First name&quot;</span><span class="p">,</span> <span class="n">top</span><span class="o">=</span><span class="mf">0.8</span><span class="o">*</span><span class="n">cm</span><span class="p">,</span> <span class="n">left</span><span class="o">=</span><span class="mi">8</span><span class="o">*</span><span class="n">cm</span><span class="p">),</span> <span class="n">Label</span><span class="p">(</span><span class="n">text</span><span class="o">=</span><span class="s">&quot;Superuser&quot;</span><span class="p">,</span> <span class="n">top</span><span class="o">=</span><span class="mf">0.8</span><span class="o">*</span><span class="n">cm</span><span class="p">,</span> <span class="n">left</span><span class="o">=</span><span class="mi">13</span><span class="o">*</span><span class="n">cm</span><span class="p">),</span> <span class="n">Label</span><span class="p">(</span><span class="n">text</span><span class="o">=</span><span class="s">&quot;Staff&quot;</span><span class="p">,</span> <span class="n">top</span><span class="o">=</span><span class="mf">0.8</span><span class="o">*</span><span class="n">cm</span><span class="p">,</span> <span class="n">left</span><span class="o">=</span><span class="mi">18</span><span class="o">*</span><span class="n">cm</span><span class="p">),</span> <span class="p">]</span> <span class="n">borders</span> <span class="o">=</span> <span class="p">{</span><span class="s">&#39;bottom&#39;</span><span class="p">:</span> <span class="n">Line</span><span class="p">(</span><span class="n">stroke_color</span><span class="o">=</span><span class="n">red</span><span class="p">,</span> <span class="n">stroke_width</span><span class="o">=</span><span class="mi">3</span><span class="p">)}</span> <span class="k">class</span> <span class="nc">band_page_footer</span><span class="p">(</span><span class="n">ReportBand</span><span class="p">):</span> <span class="n">height</span> <span class="o">=</span> <span class="mf">0.5</span><span class="o">*</span><span class="n">cm</span> <span class="n">elements</span> <span class="o">=</span> <span class="p">[</span> <span class="n">Label</span><span class="p">(</span><span class="n">text</span><span class="o">=</span><span class="s">&#39;Created with Geraldo Reports&#39;</span><span class="p">,</span> <span class="n">top</span><span class="o">=</span><span class="mf">0.1</span><span class="o">*</span><span class="n">cm</span><span class="p">),</span> <span class="p">]</span> <span class="n">borders</span> <span class="o">=</span> <span class="p">{</span><span class="s">&#39;top&#39;</span><span class="p">:</span> <span class="n">Line</span><span class="p">(</span><span class="n">stroke_color</span><span class="o">=</span><span class="n">navy</span><span class="p">)}</span> <span class="k">class</span> <span class="nc">band_detail</span><span class="p">(</span><span class="n">ReportBand</span><span class="p">):</span> <span class="n">height</span> <span class="o">=</span> <span class="mf">0.7</span><span class="o">*</span><span class="n">cm</span> <span class="n">elements</span> <span class="o">=</span> <span class="p">[</span> <span class="n">ObjectValue</span><span class="p">(</span><span class="n">attribute_name</span><span class="o">=</span><span class="s">&#39;id&#39;</span><span class="p">,</span> <span class="n">top</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="n">left</span><span class="o">=</span><span class="mi">1</span><span class="o">*</span><span class="n">cm</span><span class="p">),</span> <span class="n">ObjectValue</span><span class="p">(</span><span class="n">attribute_name</span><span class="o">=</span><span class="s">&#39;username&#39;</span><span class="p">,</span> <span class="n">top</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="n">left</span><span class="o">=</span><span class="mi">3</span><span class="o">*</span><span class="n">cm</span><span class="p">),</span> <span class="n">ObjectValue</span><span class="p">(</span><span class="n">attribute_name</span><span class="o">=</span><span class="s">&#39;first_name&#39;</span><span class="p">,</span> <span class="n">top</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="n">left</span><span class="o">=</span><span class="mi">8</span><span class="o">*</span><span class="n">cm</span><span class="p">),</span> <span class="n">ObjectValue</span><span class="p">(</span><span class="n">attribute_name</span><span class="o">=</span><span class="s">&#39;is_superuser&#39;</span><span class="p">,</span> <span class="n">top</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="n">left</span><span class="o">=</span><span class="mi">13</span><span class="o">*</span><span class="n">cm</span><span class="p">,</span> <span class="n">get_value</span><span class="o">=</span><span class="k">lambda</span> <span class="n">instance</span><span class="p">:</span> <span class="n">instance</span><span class="o">.</span><span class="n">is_superuser</span> <span class="ow">and</span> <span class="s">&#39;Yes&#39;</span> <span class="ow">or</span> <span class="s">&#39;No&#39;</span><span class="p">),</span> <span class="n">ObjectValue</span><span class="p">(</span><span class="n">attribute_name</span><span class="o">=</span><span class="s">&#39;is_staff&#39;</span><span class="p">,</span> <span class="n">top</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="n">left</span><span class="o">=</span><span class="mi">18</span><span class="o">*</span><span class="n">cm</span><span class="p">,</span> <span class="n">get_value</span><span class="o">=</span><span class="k">lambda</span> <span class="n">instance</span><span class="p">:</span> <span class="n">instance</span><span class="o">.</span><span class="n">is_staff</span> <span class="ow">and</span> <span class="s">&#39;Yes&#39;</span> <span class="ow">or</span> <span class="s">&#39;No&#39;</span><span class="p">),</span> <span class="p">]</span> <span class="n">groups</span> <span class="o">=</span> <span class="p">[</span> <span class="n">ReportGroup</span><span class="p">(</span><span class="n">attribute_name</span><span class="o">=</span><span class="s">&#39;is_superuser&#39;</span><span class="p">,</span> <span class="n">band_header</span><span class="o">=</span><span class="n">ReportBand</span><span class="p">(</span> <span class="n">height</span><span class="o">=</span><span class="mf">0.7</span><span class="o">*</span><span class="n">cm</span><span class="p">,</span> <span class="n">elements</span><span class="o">=</span><span class="p">[</span> <span class="n">ObjectValue</span><span class="p">(</span><span class="n">attribute_name</span><span class="o">=</span><span class="s">&#39;is_superuser&#39;</span><span class="p">,</span> <span class="n">left</span><span class="o">=</span><span class="mi">0</span><span class="p">,</span> <span class="n">top</span><span class="o">=</span><span class="mf">0.1</span><span class="o">*</span><span class="n">cm</span><span class="p">,</span> <span class="n">get_value</span><span class="o">=</span><span class="k">lambda</span> <span class="n">instance</span><span class="p">:</span> <span class="s">&#39;Superuser: &#39;</span> <span class="o">+</span> <span class="p">(</span><span class="n">instance</span><span class="o">.</span><span class="n">is_superuser</span> <span class="ow">and</span> <span class="s">&#39;Yes&#39;</span> <span class="ow">or</span> <span class="s">&#39;No&#39;</span><span class="p">),</span> <span class="n">style</span><span class="o">=</span><span class="p">{</span><span class="s">&#39;fontName&#39;</span><span class="p">:</span> <span class="s">&#39;Helvetica-Bold&#39;</span><span class="p">,</span> <span class="s">&#39;fontSize&#39;</span><span class="p">:</span> <span class="mi">12</span><span class="p">})</span> <span class="p">],</span> <span class="n">borders</span><span class="o">=</span><span class="p">{</span><span class="s">&#39;bottom&#39;</span><span class="p">:</span> <span class="bp">True</span><span class="p">},</span> <span class="p">),</span> <span class="n">band_footer</span><span class="o">=</span><span class="n">ReportBand</span><span class="p">(</span> <span class="n">height</span><span class="o">=</span><span class="mf">0.7</span><span class="o">*</span><span class="n">cm</span><span class="p">,</span> <span class="n">elements</span><span class="o">=</span><span class="p">[</span> <span class="n">ObjectValue</span><span class="p">(</span><span class="n">attribute_name</span><span class="o">=</span><span class="s">&#39;id&#39;</span><span class="p">,</span> <span class="n">action</span><span class="o">=</span><span class="n">FIELD_ACTION_COUNT</span><span class="p">,</span> <span class="n">display_format</span><span class="o">=</span><span class="s">&#39;</span><span class="si">%s</span><span class="s"> superusers&#39;</span><span class="p">,</span> <span class="n">left</span><span class="o">=</span><span class="mi">0</span><span class="o">*</span><span class="n">cm</span><span class="p">,</span> <span class="n">top</span><span class="o">=</span><span class="mf">0.1</span><span class="o">*</span><span class="n">cm</span><span class="p">),</span> <span class="n">ObjectValue</span><span class="p">(</span><span class="n">attribute_name</span><span class="o">=</span><span class="s">&#39;id&#39;</span><span class="p">,</span> <span class="n">action</span><span class="o">=</span><span class="n">FIELD_ACTION_SUM</span><span class="p">,</span> <span class="n">display_format</span><span class="o">=</span><span class="s">&#39;</span><span class="si">%s</span><span class="s"> is the sum of IDs above&#39;</span><span class="p">,</span> <span class="n">left</span><span class="o">=</span><span class="mi">4</span><span class="o">*</span><span class="n">cm</span><span class="p">,</span> <span class="n">top</span><span class="o">=</span><span class="mf">0.1</span><span class="o">*</span><span class="n">cm</span><span class="p">),</span> <span class="p">],</span> <span class="n">borders</span><span class="o">=</span><span class="p">{</span><span class="s">&#39;top&#39;</span><span class="p">:</span> <span class="bp">True</span><span class="p">},</span> <span class="p">),</span> <span class="p">),</span> <span class="n">ReportGroup</span><span class="p">(</span><span class="n">attribute_name</span><span class="o">=</span><span class="s">&#39;is_staff&#39;</span><span class="p">,</span> <span class="n">band_header</span><span class="o">=</span><span class="n">ReportBand</span><span class="p">(</span> <span class="n">height</span><span class="o">=</span><span class="mf">0.7</span><span class="o">*</span><span class="n">cm</span><span class="p">,</span> <span class="n">elements</span><span class="o">=</span><span class="p">[</span> <span class="n">ObjectValue</span><span class="p">(</span><span class="n">attribute_name</span><span class="o">=</span><span class="s">&#39;is_staff&#39;</span><span class="p">,</span> <span class="n">left</span><span class="o">=</span><span class="mf">0.5</span><span class="o">*</span><span class="n">cm</span><span class="p">,</span> <span class="n">top</span><span class="o">=</span><span class="mf">0.1</span><span class="o">*</span><span class="n">cm</span><span class="p">,</span> <span class="n">get_value</span><span class="o">=</span><span class="k">lambda</span> <span class="n">instance</span><span class="p">:</span> <span class="s">&#39;Staff: &#39;</span> <span class="o">+</span> <span class="p">(</span><span class="n">instance</span><span class="o">.</span><span class="n">is_staff</span> <span class="ow">and</span> <span class="s">&#39;Yes&#39;</span> <span class="ow">or</span> <span class="s">&#39;No&#39;</span><span class="p">))</span> <span class="p">],</span> <span class="n">borders</span><span class="o">=</span><span class="p">{</span><span class="s">&#39;bottom&#39;</span><span class="p">:</span> <span class="bp">True</span><span class="p">},</span> <span class="p">),</span> <span class="n">band_footer</span><span class="o">=</span><span class="n">ReportBand</span><span class="p">(</span> <span class="n">height</span><span class="o">=</span><span class="mf">0.7</span><span class="o">*</span><span class="n">cm</span><span class="p">,</span> <span class="n">elements</span><span class="o">=</span><span class="p">[</span> <span class="n">ObjectValue</span><span class="p">(</span><span class="n">attribute_name</span><span class="o">=</span><span class="s">&#39;id&#39;</span><span class="p">,</span> <span class="n">action</span><span class="o">=</span><span class="n">FIELD_ACTION_COUNT</span><span class="p">,</span> <span class="n">display_format</span><span class="o">=</span><span class="s">&#39;</span><span class="si">%s</span><span class="s"> staffs&#39;</span><span class="p">,</span> <span class="n">left</span><span class="o">=</span><span class="mf">0.5</span><span class="o">*</span><span class="n">cm</span><span class="p">,</span> <span class="n">top</span><span class="o">=</span><span class="mf">0.1</span><span class="o">*</span><span class="n">cm</span><span class="p">)</span> <span class="p">],</span> <span class="n">borders</span><span class="o">=</span><span class="p">{</span><span class="s">&#39;top&#39;</span><span class="p">:</span> <span class="bp">True</span><span class="p">},</span> <span class="p">),</span> <span class="p">),</span> <span class="p">]</span> </pre></div> </div> <p>Generating PDF...</p> <div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">queryset</span> <span class="o">=</span> <span class="n">User</span><span class="o">.</span><span class="n">objects</span><span class="o">.</span><span class="n">order_by</span><span class="p">(</span><span class="s">&#39;is_superuser&#39;</span><span class="p">,</span><span class="s">&#39;is_staff&#39;</span><span class="p">,</span><span class="s">&#39;id&#39;</span><span class="p">)</span> <span class="gp">&gt;&gt;&gt; </span><span class="n">report</span> <span class="o">=</span> <span class="n">GrouppingReport</span><span class="p">(</span><span class="n">queryset</span><span class="o">=</span><span class="n">queryset</span><span class="p">)</span> <span class="gp">&gt;&gt;&gt; </span><span class="kn">from</span> <span class="nn">geraldo.generators</span> <span class="kn">import</span> <span class="n">PDFGenerator</span> <span class="gp">&gt;&gt;&gt; </span><span class="n">report</span><span class="o">.</span><span class="n">generate_by</span><span class="p">(</span><span class="n">PDFGenerator</span><span class="p">,</span> <span class="n">filename</span><span class="o">=</span><span class="n">os</span><span class="o">.</span><span class="n">path</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">cur_dir</span><span class="p">,</span> <span class="s">&#39;output/groupping-report.pdf&#39;</span><span class="p">))</span> </pre></div> </div> <p>The Result</p> <ul class="simple"> <li><a class="reference external" href="http://geraldo.svn.sourceforge.net/viewvc/geraldo/examples/groupping-report.pdf">http://geraldo.svn.sourceforge.net/viewvc/geraldo/examples/groupping-report.pdf</a></li> </ul> </div> </div> </div> </div> <div class="sphinxsidebar"> <div class="sphinxsidebarwrapper"> <h4>Previous topic</h4> <p class="topless"><a href="child-bands.html" title="previous chapter">Child Bands</a></p> <h4>Next topic</h4> <p class="topless"><a href="subreport.html" title="next chapter">SubReports</a></p> <h3>This Page</h3> <ul class="this-page-menu"> <li><a href="../_sources/examples/grouping.txt" rel="nofollow">Show Source</a></li> </ul> <div id="searchbox" style="display: none"> <h3>Quick search</h3> <form class="search" action="../search.html" method="get"> <input type="text" name="q" size="18" /> <input type="submit" value="Go" /> <input type="hidden" name="check_keywords" value="yes" /> <input type="hidden" name="area" value="default" /> </form> <p class="searchtip" style="font-size: 90%"> Enter search terms or a module, class or function name. </p> </div> <script type="text/javascript">$('#searchbox').show(0);</script> </div> </div> <div class="clearer"></div> </div> <div class="related"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="../genindex.html" title="General Index" >index</a></li> <li class="right" > <a href="subreport.html" title="SubReports" >next</a> |</li> <li class="right" > <a href="child-bands.html" title="Child Bands" >previous</a> |</li> <li><a href="../index.html">Geraldo Reports Documentation v0.4.1-stable documentation</a> &raquo;</li> <li><a href="index.html" >Examples</a> &raquo;</li> </ul> </div> <div class="footer"> &copy; Copyright 2009-2010, Marinho Brandao. Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 0.6.3. </div> </body> </html>
{ "pile_set_name": "Github" }
/// See LICENSE for license details. package midas.widgets import chisel3._ import chisel3.util._ import junctions._ import freechips.rocketchip.amba.axi4.AXI4Bundle import freechips.rocketchip.config.{Parameters, Field} object AXI4Printf { def apply(io: AXI4Bundle, name: String): Unit = { val cyclecount = RegInit(0.U(64.W)) cyclecount := cyclecount + 1.U when (io.aw.fire()) { printf(s"[${name},awfire,%x] addr %x, len %x, size %x, burst %x, lock %x, cache %x, prot %x, qos %x, id %x, user %x\n", cyclecount, io.aw.bits.addr, io.aw.bits.len, io.aw.bits.size, io.aw.bits.burst, io.aw.bits.lock, io.aw.bits.cache, io.aw.bits.prot, io.aw.bits.qos, io.aw.bits.id, io.aw.bits.user.asUInt ) } when (io.w.fire()) { printf(s"[${name},wfire,%x] data %x, last %x, strb %x\n", cyclecount, io.w.bits.data, io.w.bits.last, io.w.bits.strb, ) } when (io.b.fire()) { printf(s"[${name},bfire,%x] resp %x, id %x, user %x\n", cyclecount, io.b.bits.resp, io.b.bits.id, io.b.bits.user.asUInt ) } when (io.ar.fire()) { printf(s"[${name},arfire,%x] addr %x, len %x, size %x, burst %x, lock %x, cache %x, prot %x, qos %x, id %x, user %x\n", cyclecount, io.ar.bits.addr, io.ar.bits.len, io.ar.bits.size, io.ar.bits.burst, io.ar.bits.lock, io.ar.bits.cache, io.ar.bits.prot, io.ar.bits.qos, io.ar.bits.id, io.ar.bits.user.asUInt ) } when (io.r.fire()) { printf(s"[${name},rfire,%x] resp %x, data %x, last %x, id %x, user %x\n", cyclecount, io.r.bits.resp, io.r.bits.data, io.r.bits.last, io.r.bits.id, io.r.bits.user.asUInt ) } } def apply(io: NastiIO, name: String)(implicit p: Parameters): Unit = apply(Nasti2AXI4.toMonitor(io), name) }
{ "pile_set_name": "Github" }
package cli import ( "flag" "fmt" "strconv" ) // Int64Flag is a flag with type int64 type Int64Flag struct { Name string Usage string EnvVar string FilePath string Required bool Hidden bool Value int64 Destination *int64 } // String returns a readable representation of this value // (for usage defaults) func (f Int64Flag) String() string { return FlagStringer(f) } // GetName returns the name of the flag func (f Int64Flag) GetName() string { return f.Name } // IsRequired returns whether or not the flag is required func (f Int64Flag) IsRequired() bool { return f.Required } // TakesValue returns true of the flag takes a value, otherwise false func (f Int64Flag) TakesValue() bool { return true } // GetUsage returns the usage string for the flag func (f Int64Flag) GetUsage() string { return f.Usage } // GetValue returns the flags value as string representation and an empty // string if the flag takes no value at all. func (f Int64Flag) GetValue() string { return fmt.Sprintf("%d", f.Value) } // Apply populates the flag given the flag set and environment // Ignores errors func (f Int64Flag) Apply(set *flag.FlagSet) { _ = f.ApplyWithError(set) } // ApplyWithError populates the flag given the flag set and environment func (f Int64Flag) ApplyWithError(set *flag.FlagSet) error { if envVal, ok := flagFromFileEnv(f.FilePath, f.EnvVar); ok { envValInt, err := strconv.ParseInt(envVal, 0, 64) if err != nil { return fmt.Errorf("could not parse %s as int value for flag %s: %s", envVal, f.Name, err) } f.Value = envValInt } eachName(f.Name, func(name string) { if f.Destination != nil { set.Int64Var(f.Destination, name, f.Value, f.Usage) return } set.Int64(name, f.Value, f.Usage) }) return nil } // Int64 looks up the value of a local Int64Flag, returns // 0 if not found func (c *Context) Int64(name string) int64 { return lookupInt64(name, c.flagSet) } // GlobalInt64 looks up the value of a global Int64Flag, returns // 0 if not found func (c *Context) GlobalInt64(name string) int64 { if fs := lookupGlobalFlagSet(name, c); fs != nil { return lookupInt64(name, fs) } return 0 } func lookupInt64(name string, set *flag.FlagSet) int64 { f := set.Lookup(name) if f != nil { parsed, err := strconv.ParseInt(f.Value.String(), 0, 64) if err != nil { return 0 } return parsed } return 0 }
{ "pile_set_name": "Github" }
/* * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * Other licenses: * ----------------------------------------------------------------------------- * Commercial licenses for this work are available. These replace the above * ASL 2.0 and offer limited warranties, support, maintenance, and commercial * database integrations. * * For more information, please visit: http://www.jooq.org/licenses * * * * * * * * * * * * * * * * */ package org.jooq.impl; import static org.jooq.SQLDialect.DEFAULT; import static org.jooq.tools.StringUtils.defaultIfNull; import org.jooq.Configuration; import org.jooq.Meta; import org.jooq.MetaProvider; import org.jooq.SQLDialect; import org.jooq.Source; /** * A {@link MetaProvider} implementation that can handle different types of * {@link Source} content. * * @author Lukas Eder */ final class SourceMetaProvider implements MetaProvider { private final Configuration configuration; private final Source[] sources; SourceMetaProvider(Configuration configuration, Source... sources) { this.configuration = configuration; this.sources = sources; } @Override public final Meta provide() { if (sources.length > 0) { String s = sources[0].readString(); sources[0] = Source.of(s); // TODO: Implement more thorough and reusable "isXML()" check in MiniJAXB if (s.startsWith("<?xml") || s.startsWith("<information_schema") || s.startsWith("<!--")) return new InformationSchemaMetaProvider(configuration, sources).provide(); } SQLDialect dialect = configuration.settings().getInterpreterDialect(); switch (defaultIfNull(dialect, DEFAULT).family()) { case DEFAULT: return new InterpreterMetaProvider(configuration, sources).provide(); case DERBY: case H2: case HSQLDB: case SQLITE: return new TranslatingMetaProvider(configuration, sources).provide(); default: throw new UnsupportedOperationException("Interpreter dialect not yet supported: " + dialect); } } }
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="UTF-8"?> <project name="OrderedActivity" default="help"> <!-- The local.properties file is created and updated by the 'android' tool. It contains the path to the SDK. It should *NOT* be checked into Version Control Systems. --> <loadproperties srcFile="local.properties" /> <!-- The ant.properties file can be created by you. It is only edited by the 'android' tool to add properties to it. This is the place to change some Ant specific build properties. Here are some properties you may want to change/update: source.dir The name of the source directory. Default is 'src'. out.dir The name of the output directory. Default is 'bin'. For other overridable properties, look at the beginning of the rules files in the SDK, at tools/ant/build.xml Properties related to the SDK location or the project target should be updated using the 'android' tool with the 'update' action. This file is an integral part of the build system for your application and should be checked into Version Control Systems. --> <property file="ant.properties" /> <!-- The project.properties file is created and updated by the 'android' tool, as well as ADT. This contains project specific properties such as project target, and library dependencies. Lower level build properties are stored in ant.properties (or in .classpath for Eclipse projects). This file is an integral part of the build system for your application and should be checked into Version Control Systems. --> <loadproperties srcFile="project.properties" /> <!-- quick check on sdk.dir --> <fail message="sdk.dir is missing. Make sure to generate local.properties using 'android update project'" unless="sdk.dir" /> <!-- extension targets. Uncomment the ones where you want to do custom work in between standard targets --> <!-- <target name="-pre-build"> </target> <target name="-pre-compile"> </target> /* This is typically used for code obfuscation. Compiled code location: ${out.classes.absolute.dir} If this is not done in place, override ${out.dex.input.absolute.dir} */ <target name="-post-compile"> </target> --> <!-- Import the actual build file. To customize existing targets, there are two options: - Customize only one target: - copy/paste the target into this file, *before* the <import> task. - customize it to your needs. - Customize the whole content of build.xml - copy/paste the content of the rules files (minus the top node) into this file, replacing the <import> task. - customize to your needs. *********************** ****** IMPORTANT ****** *********************** In all cases you must update the value of version-tag below to read 'custom' instead of an integer, in order to avoid having your file be overridden by tools such as "android update project" --> <!-- version-tag: 1 --> <import file="${sdk.dir}/tools/ant/build.xml" /> </project>
{ "pile_set_name": "Github" }
// Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See LICENSE in the project root for license information. // // Office UI Fabric // -------------------------------------------------- // SCSS template for building a bundle of Fabric and Fabric Components CSS. @import '../../../src/sass/_Fabric.Common.scss'; <% var relativePath = '../../../src/'; // Then, include each dependency dependencies.forEach(function(dep) { %> @import '<%= relativePath + dep %>';<% }); %>
{ "pile_set_name": "Github" }
var Container = require('../AppContainer'); var Conversation = require('../Model/Conversation'); var Participant = require('../Model/ConversationParticipant'); /** * @param {Namespace} namespace * @param {Function} callback */ module.exports = function PreloadConversations(namespace, callback) { Container.getLogger().info('PreloadConversations for %s', namespace.getName()); function onConversationResult(row) { var participants = JSON.parse(row.participants); var conversation = new Conversation(row.id); conversation.setIsGroup(row.is_group); for(var index in participants) { if(participants.hasOwnProperty(index)){ var participant = namespace.getSubscriberWithOfflines(participants[index].id, participants[index].name); participant.setOnline(false); participant.join(conversation.getId()); conversation.addParticipant(participant); namespace.addSubscriber(participant); } } namespace.getConversations().add(conversation); } function onConversationsPreloaded() { callback(null, namespace); } namespace.getDatabase().loadConversations(onConversationResult, onConversationsPreloaded); };
{ "pile_set_name": "Github" }
/* * reserved comment block * DO NOT REMOVE OR ALTER! */ /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.sun.org.apache.xpath.internal.functions; import com.sun.org.apache.xml.internal.dtm.DTM; import com.sun.org.apache.xpath.internal.XPathContext; import com.sun.org.apache.xpath.internal.objects.XObject; import com.sun.org.apache.xpath.internal.objects.XString; /** * @xsl.usage advanced */ public class FuncUnparsedEntityURI extends FunctionOneArg { static final long serialVersionUID = 845309759097448178L; /** * Execute the function. The function must return * a valid object. * @param xctxt The current execution context. * @return A valid XObject. * * @throws javax.xml.transform.TransformerException */ public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { String name = m_arg0.execute(xctxt).str(); int context = xctxt.getCurrentNode(); DTM dtm = xctxt.getDTM(context); int doc = dtm.getDocument(); String uri = dtm.getUnparsedEntityURI(name); return new XString(uri); } }
{ "pile_set_name": "Github" }
// // Generated by class-dump 3.5 (64 bit) (Debug version compiled Oct 25 2017 03:49:04). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2015 by Steve Nygard. // #import "IAirDropProgressViewController.h" #import "TDraggingSource-Protocol.h" @class NSString; @interface TAirDropReceiverProgressViewController : IAirDropProgressViewController <TDraggingSource> { struct shared_ptr<TAirDropReceiverOperationController> _receiverOpController; struct TNSRef<NSMutableArray, void> _downloads; } + (void)startReceivingWithOperation:(struct __SFOperation *)arg1; - (id).cxx_construct; - (void).cxx_destruct; - (BOOL)ignoreModifierKeysForDraggingSession:(id)arg1; - (id)namesOfPromisedFilesDroppedAtDestination:(id)arg1; - (void)draggingSession:(id)arg1 endedAtPoint:(struct CGPoint)arg2 operation:(unsigned long long)arg3; - (unsigned long long)draggingSession:(id)arg1 sourceOperationMaskForDraggingContext:(long long)arg2; - (void)startDragInView:(id)arg1 withEvent:(id)arg2; - (void)showOrUpdateStatusView; - (void)showOrUpdateAskUserView; - (_Bool)shouldShowFlyOverAnimation; - (void)nwOperationEventBlocked:(id)arg1 opController:(struct INWOperationController *)arg2; - (void)nwOperationEventConnecting:(id)arg1 opController:(struct INWOperationController *)arg2; - (void)nwOperationEventErrorOccurred:(id)arg1 opController:(struct INWOperationController *)arg2; - (void)nwOperationEventFinished:(id)arg1 opController:(struct INWOperationController *)arg2; - (void)nwOperationEventPostprocess:(id)arg1 opController:(struct INWOperationController *)arg2; - (void)nwOperationEventConverting:(id)arg1 opController:(struct INWOperationController *)arg2; - (void)nwOperationEventProgress:(id)arg1 opController:(struct INWOperationController *)arg2; - (void)nwOperationEventPreprocess:(id)arg1 opController:(struct INWOperationController *)arg2; - (void)nwOperationEventConflict:(id)arg1 opController:(struct INWOperationController *)arg2; - (void)nwOperationEventStarted:(id)arg1 opController:(struct INWOperationController *)arg2; - (void)nwOperationEventCanceled:(id)arg1 opController:(struct INWOperationController *)arg2; - (void)nwOperationEventAskUser:(id)arg1 opController:(struct INWOperationController *)arg2; - (void)preflightNWOperationEvent:(long long)arg1 results:(id)arg2 opController:(struct INWOperationController *)arg3; - (void)browserViewWillBeRemovedFromWindow; - (void)openButtonPressed:(id)arg1; - (void)okButtonPressed:(id)arg1; - (void)superOKButtonPressed:(id)arg1; - (id)createProgressForURL:(id)arg1; - (void)resume; - (long long)currentNWOperationEvent; - (shared_ptr_466d67c7)operationController; - (void)aboutToTearDown; - (id)initWithReceiverOperation:(struct __SFOperation *)arg1; // Remaining properties @property(readonly, copy) NSString *debugDescription; @property(readonly, copy) NSString *description; @property(readonly) unsigned long long hash; @property(readonly) Class superclass; @end
{ "pile_set_name": "Github" }
{ "name": "The Leukemia & Lymphoma Society, Inc.", "displayName": "The Leukemia & Lymphoma Society", "properties": [ "lls.org" ] }
{ "pile_set_name": "Github" }
## 功能介绍 vector绝对值最大标准化是对vector数据按照最大值和最小值进行标准化的组件, 将数据归一到-1和1之间。 ## 参数说明 <!-- OLD_TABLE --> <!-- This is the start of auto-generated parameter info --> <!-- DO NOT EDIT THIS PART!!! --> | 名称 | 中文名称 | 描述 | 类型 | 是否必须? | 默认值 | | --- | --- | --- | --- | --- | --- | | selectedCol | 选中的列名 | 计算列对应的列名 | String | ✓ | | | outputCol | 输出结果列 | 输出结果列列名,可选,默认null | String | | null |<!-- This is the end of auto-generated parameter info --> ## 脚本示例 #### 脚本 ```python data = np.array([["a", "10.0, 100"],\ ["b", "-2.5, 9"],\ ["c", "100.2, 1"],\ ["d", "-99.9, 100"],\ ["a", "1.4, 1"],\ ["b", "-2.2, 9"],\ ["c", "100.9, 1"]]) df = pd.DataFrame({"col" : data[:,0], "vec" : data[:,1]}) data = dataframeToOperator(df, schemaStr="col string, vec string",op_type="batch") res = VectorMaxAbsScaler()\ .setSelectedCol("vec") res.fit(data).transform(data).collectToDataframe() ``` #### 结果 col1|vec ----|--- c|1.0,0.01 b|-0.024777006937561942,0.09 d|-0.9900891972249752,1.0 a|0.09910802775024777,1.0 b|-0.02180376610505451,0.09 c|0.9930624380574826,0.01 a|0.013875123885034686,0.01
{ "pile_set_name": "Github" }
// Copyright 2009 the Sputnik authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /** * Operator --x uses [[Default Value]] * * @path ch11/11.4/11.4.5/S11.4.5_A2.2_T1.js * @description If Type(value) is Object, evaluate ToPrimitive(value, Number) */ //CHECK#1 var object = {valueOf: function() {return 1}}; if (--object !== 1 - 1) { $ERROR('#1: var object = {valueOf: function() {return 1}}; --object === 1 - 1. Actual: ' + (--object)); } else { if (object !== 1 - 1) { $ERROR('#1: var object = {valueOf: function() {return 1}}; --object; object === 1 - 1. Actual: ' + (object)); } } //CHECK#2 var object = {valueOf: function() {return 1}, toString: function() {return 0}}; if (--object !== 1 - 1) { $ERROR('#2: var object = {valueOf: function() {return 1}, toString: function() {return 0}}; --object === 1 - 1. Actual: ' + (--object)); } else { if (object !== 1 - 1) { $ERROR('#2: var object = {valueOf: function() {return 1}, toString: function() {return 0}}; --object; object === 1 - 1. Actual: ' + (object)); } } //CHECK#3 var object = {valueOf: function() {return 1}, toString: function() {return {}}}; if (--object !== 1 - 1) { $ERROR('#3: var object = {valueOf: function() {return 1}, toString: function() {return {}}}; --object === 1 - 1. Actual: ' + (--object)); } else { if (object !== 1 - 1) { $ERROR('#3: var object = {valueOf: function() {return 1}, toString: function() {return {}}}; --object; object === 1 - 1. Actual: ' + (object)); } } //CHECK#4 try { var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; if (--object !== 1 - 1) { $ERROR('#4.1: var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; --object === 1 - 1. Actual: ' + (--object)); } else { if (object !== 1 - 1) { $ERROR('#4.1: var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; --object; object === 1 - 1. Actual: ' + (object)); } } } catch (e) { if (e === "error") { $ERROR('#4.2: var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; --object not throw "error"'); } else { $ERROR('#4.3: var object = {valueOf: function() {return 1}, toString: function() {throw "error"}}; --object not throw Error. Actual: ' + (e)); } } //CHECK#5 var object = {toString: function() {return 1}}; if (--object !== 1 - 1) { $ERROR('#5.1: var object = {toString: function() {return 1}}; --object === 1 - 1. Actual: ' + (--object)); } else { if (object !== 1 - 1) { $ERROR('#5.2: var object = {toString: function() {return 1}}; --object; object === 1 - 1. Actual: ' + (object)); } } //CHECK#6 var object = {valueOf: function() {return {}}, toString: function() {return 1}} if (--object !== 1 - 1) { $ERROR('#6.1: var object = {valueOf: function() {return {}}, toString: function() {return 1}}; --object === 1 - 1. Actual: ' + (--object)); } else { if (object !== 1 - 1) { $ERROR('#6.2: var object = {valueOf: function() {return {}}, toString: function() {return 1}}; --object; object === 1 - 1. Actual: ' + (object)); } } //CHECK#7 try { var object = {valueOf: function() {throw "error"}, toString: function() {return 1}}; --object; $ERROR('#7.1: var object = {valueOf: function() {throw "error"}, toString: function() {return 1}}; --object throw "error". Actual: ' + (--object)); } catch (e) { if (e !== "error") { $ERROR('#7.2: var object = {valueOf: function() {throw "error"}, toString: function() {return 1}}; --object throw "error". Actual: ' + (e)); } } //CHECK#8 try { var object = {valueOf: function() {return {}}, toString: function() {return {}}}; --object; $ERROR('#8.1: var object = {valueOf: function() {return {}}, toString: function() {return {}}}; --object throw TypeError. Actual: ' + (--object)); } catch (e) { if ((e instanceof TypeError) !== true) { $ERROR('#8.2: var object = {valueOf: function() {return {}}, toString: function() {return {}}}; --object throw TypeError. Actual: ' + (e)); } }
{ "pile_set_name": "Github" }
package semver import ( "database/sql/driver" "fmt" ) // Scan implements the database/sql.Scanner interface. func (v *Version) Scan(src interface{}) (err error) { var str string switch src := src.(type) { case string: str = src case []byte: str = string(src) default: return fmt.Errorf("Version.Scan: cannot convert %T to string.", src) } if t, err := Parse(str); err == nil { *v = t } return } // Value implements the database/sql/driver.Valuer interface. func (v Version) Value() (driver.Value, error) { return v.String(), nil }
{ "pile_set_name": "Github" }
/** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ (function (factory) { if (typeof module === "object" && typeof module.exports === "object") { var v = factory(null, exports); if (v !== undefined) module.exports = v; } else if (typeof define === "function" && define.amd) { define("@angular/common/locales/asa", ["require", "exports"], factory); } })(function (require, exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); // THIS CODE IS GENERATED - DO NOT MODIFY // See angular/tools/gulp-tasks/cldr/extract.js var u = undefined; function plural(n) { if (n === 1) return 1; return 5; } exports.default = [ 'asa', [['icheheavo', 'ichamthi'], u, u], u, [ ['J', 'J', 'J', 'J', 'A', 'I', 'J'], ['Jpi', 'Jtt', 'Jnn', 'Jtn', 'Alh', 'Ijm', 'Jmo'], ['Jumapili', 'Jumatatu', 'Jumanne', 'Jumatano', 'Alhamisi', 'Ijumaa', 'Jumamosi'], ['Jpi', 'Jtt', 'Jnn', 'Jtn', 'Alh', 'Ijm', 'Jmo'] ], u, [ ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D'], ['Jan', 'Feb', 'Mac', 'Apr', 'Mei', 'Jun', 'Jul', 'Ago', 'Sep', 'Okt', 'Nov', 'Dec'], [ 'Januari', 'Februari', 'Machi', 'Aprili', 'Mei', 'Juni', 'Julai', 'Agosti', 'Septemba', 'Oktoba', 'Novemba', 'Desemba' ] ], u, [['KM', 'BM'], u, ['Kabla yakwe Yethu', 'Baada yakwe Yethu']], 1, [6, 0], ['dd/MM/y', 'd MMM y', 'd MMMM y', 'EEEE, d MMMM y'], ['HH:mm', 'HH:mm:ss', 'HH:mm:ss z', 'HH:mm:ss zzzz'], ['{1} {0}', u, u, u], ['.', ',', ';', '%', '+', '-', 'E', '×', '‰', '∞', 'NaN', ':'], ['#,##0.###', '#,##0%', '#,##0.00 ¤', '#E0'], 'TSh', 'shilingi ya Tandhania', { 'JPY': ['JP¥', '¥'], 'TZS': ['TSh'], 'USD': ['US$', '$'] }, plural ]; }); //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXNhLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vcGFja2FnZXMvY29tbW9uL2xvY2FsZXMvYXNhLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOzs7Ozs7R0FNRzs7Ozs7Ozs7Ozs7O0lBRUgseUNBQXlDO0lBQ3pDLCtDQUErQztJQUUvQyxJQUFNLENBQUMsR0FBRyxTQUFTLENBQUM7SUFFcEIsZ0JBQWdCLENBQVM7UUFDdkIsSUFBSSxDQUFDLEtBQUssQ0FBQztZQUFFLE9BQU8sQ0FBQyxDQUFDO1FBQ3RCLE9BQU8sQ0FBQyxDQUFDO0lBQ1gsQ0FBQztJQUVELGtCQUFlO1FBQ2IsS0FBSyxFQUFFLENBQUMsQ0FBQyxXQUFXLEVBQUUsVUFBVSxDQUFDLEVBQUUsQ0FBQyxFQUFFLENBQUMsQ0FBQyxFQUFFLENBQUM7UUFDM0M7WUFDRSxDQUFDLEdBQUcsRUFBRSxHQUFHLEVBQUUsR0FBRyxFQUFFLEdBQUcsRUFBRSxHQUFHLEVBQUUsR0FBRyxFQUFFLEdBQUcsQ0FBQyxFQUFFLENBQUMsS0FBSyxFQUFFLEtBQUssRUFBRSxLQUFLLEVBQUUsS0FBSyxFQUFFLEtBQUssRUFBRSxLQUFLLEVBQUUsS0FBSyxDQUFDO1lBQ3RGLENBQUMsVUFBVSxFQUFFLFVBQVUsRUFBRSxTQUFTLEVBQUUsVUFBVSxFQUFFLFVBQVUsRUFBRSxRQUFRLEVBQUUsVUFBVSxDQUFDO1lBQ2pGLENBQUMsS0FBSyxFQUFFLEtBQUssRUFBRSxLQUFLLEVBQUUsS0FBSyxFQUFFLEtBQUssRUFBRSxLQUFLLEVBQUUsS0FBSyxDQUFDO1NBQ2xEO1FBQ0QsQ0FBQztRQUNEO1lBQ0UsQ0FBQyxHQUFHLEVBQUUsR0FBRyxFQUFFLEdBQUcsRUFBRSxHQUFHLEVBQUUsR0FBRyxFQUFFLEdBQUcsRUFBRSxHQUFHLEVBQUUsR0FBRyxFQUFFLEdBQUcsRUFBRSxHQUFHLEVBQUUsR0FBRyxFQUFFLEdBQUcsQ0FBQztZQUM1RCxDQUFDLEtBQUssRUFBRSxLQUFLLEVBQUUsS0FBSyxFQUFFLEtBQUssRUFBRSxLQUFLLEVBQUUsS0FBSyxFQUFFLEtBQUssRUFBRSxLQUFLLEVBQUUsS0FBSyxFQUFFLEtBQUssRUFBRSxLQUFLLEVBQUUsS0FBSyxDQUFDO1lBQ3BGO2dCQUNFLFNBQVMsRUFBRSxVQUFVLEVBQUUsT0FBTyxFQUFFLFFBQVEsRUFBRSxLQUFLLEVBQUUsTUFBTSxFQUFFLE9BQU8sRUFBRSxRQUFRLEVBQUUsVUFBVTtnQkFDdEYsUUFBUSxFQUFFLFNBQVMsRUFBRSxTQUFTO2FBQy9CO1NBQ0Y7UUFDRCxDQUFDLEVBQUUsQ0FBQyxDQUFDLElBQUksRUFBRSxJQUFJLENBQUMsRUFBRSxDQUFDLEVBQUUsQ0FBQyxtQkFBbUIsRUFBRSxtQkFBbUIsQ0FBQyxDQUFDLEVBQUUsQ0FBQyxFQUFFLENBQUMsQ0FBQyxFQUFFLENBQUMsQ0FBQztRQUMzRSxDQUFDLFNBQVMsRUFBRSxTQUFTLEVBQUUsVUFBVSxFQUFFLGdCQUFnQixDQUFDO1FBQ3BELENBQUMsT0FBTyxFQUFFLFVBQVUsRUFBRSxZQUFZLEVBQUUsZUFBZSxDQUFDLEVBQUUsQ0FBQyxTQUFTLEVBQUUsQ0FBQyxFQUFFLENBQUMsRUFBRSxDQUFDLENBQUM7UUFDMUUsQ0FBQyxHQUFHLEVBQUUsR0FBRyxFQUFFLEdBQUcsRUFBRSxHQUFHLEVBQUUsR0FBRyxFQUFFLEdBQUcsRUFBRSxHQUFHLEVBQUUsR0FBRyxFQUFFLEdBQUcsRUFBRSxHQUFHLEVBQUUsS0FBSyxFQUFFLEdBQUcsQ0FBQztRQUM5RCxDQUFDLFdBQVcsRUFBRSxRQUFRLEVBQUUsWUFBWSxFQUFFLEtBQUssQ0FBQyxFQUFFLEtBQUssRUFBRSx1QkFBdUI7UUFDNUUsRUFBQyxLQUFLLEVBQUUsQ0FBQyxLQUFLLEVBQUUsR0FBRyxDQUFDLEVBQUUsS0FBSyxFQUFFLENBQUMsS0FBSyxDQUFDLEVBQUUsS0FBSyxFQUFFLENBQUMsS0FBSyxFQUFFLEdBQUcsQ0FBQyxFQUFDLEVBQUUsTUFBTTtLQUNuRSxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBAbGljZW5zZVxuICogQ29weXJpZ2h0IEdvb2dsZSBJbmMuIEFsbCBSaWdodHMgUmVzZXJ2ZWQuXG4gKlxuICogVXNlIG9mIHRoaXMgc291cmNlIGNvZGUgaXMgZ292ZXJuZWQgYnkgYW4gTUlULXN0eWxlIGxpY2Vuc2UgdGhhdCBjYW4gYmVcbiAqIGZvdW5kIGluIHRoZSBMSUNFTlNFIGZpbGUgYXQgaHR0cHM6Ly9hbmd1bGFyLmlvL2xpY2Vuc2VcbiAqL1xuXG4vLyBUSElTIENPREUgSVMgR0VORVJBVEVEIC0gRE8gTk9UIE1PRElGWVxuLy8gU2VlIGFuZ3VsYXIvdG9vbHMvZ3VscC10YXNrcy9jbGRyL2V4dHJhY3QuanNcblxuY29uc3QgdSA9IHVuZGVmaW5lZDtcblxuZnVuY3Rpb24gcGx1cmFsKG46IG51bWJlcik6IG51bWJlciB7XG4gIGlmIChuID09PSAxKSByZXR1cm4gMTtcbiAgcmV0dXJuIDU7XG59XG5cbmV4cG9ydCBkZWZhdWx0IFtcbiAgJ2FzYScsIFtbJ2ljaGVoZWF2bycsICdpY2hhbXRoaSddLCB1LCB1XSwgdSxcbiAgW1xuICAgIFsnSicsICdKJywgJ0onLCAnSicsICdBJywgJ0knLCAnSiddLCBbJ0pwaScsICdKdHQnLCAnSm5uJywgJ0p0bicsICdBbGgnLCAnSWptJywgJ0ptbyddLFxuICAgIFsnSnVtYXBpbGknLCAnSnVtYXRhdHUnLCAnSnVtYW5uZScsICdKdW1hdGFubycsICdBbGhhbWlzaScsICdJanVtYWEnLCAnSnVtYW1vc2knXSxcbiAgICBbJ0pwaScsICdKdHQnLCAnSm5uJywgJ0p0bicsICdBbGgnLCAnSWptJywgJ0ptbyddXG4gIF0sXG4gIHUsXG4gIFtcbiAgICBbJ0onLCAnRicsICdNJywgJ0EnLCAnTScsICdKJywgJ0onLCAnQScsICdTJywgJ08nLCAnTicsICdEJ10sXG4gICAgWydKYW4nLCAnRmViJywgJ01hYycsICdBcHInLCAnTWVpJywgJ0p1bicsICdKdWwnLCAnQWdvJywgJ1NlcCcsICdPa3QnLCAnTm92JywgJ0RlYyddLFxuICAgIFtcbiAgICAgICdKYW51YXJpJywgJ0ZlYnJ1YXJpJywgJ01hY2hpJywgJ0FwcmlsaScsICdNZWknLCAnSnVuaScsICdKdWxhaScsICdBZ29zdGknLCAnU2VwdGVtYmEnLFxuICAgICAgJ09rdG9iYScsICdOb3ZlbWJhJywgJ0Rlc2VtYmEnXG4gICAgXVxuICBdLFxuICB1LCBbWydLTScsICdCTSddLCB1LCBbJ0thYmxhIHlha3dlIFlldGh1JywgJ0JhYWRhIHlha3dlIFlldGh1J11dLCAxLCBbNiwgMF0sXG4gIFsnZGQvTU0veScsICdkIE1NTSB5JywgJ2QgTU1NTSB5JywgJ0VFRUUsIGQgTU1NTSB5J10sXG4gIFsnSEg6bW0nLCAnSEg6bW06c3MnLCAnSEg6bW06c3MgeicsICdISDptbTpzcyB6enp6J10sIFsnezF9IHswfScsIHUsIHUsIHVdLFxuICBbJy4nLCAnLCcsICc7JywgJyUnLCAnKycsICctJywgJ0UnLCAnw5cnLCAn4oCwJywgJ+KInicsICdOYU4nLCAnOiddLFxuICBbJyMsIyMwLiMjIycsICcjLCMjMCUnLCAnIywjIzAuMDDCoMKkJywgJyNFMCddLCAnVFNoJywgJ3NoaWxpbmdpIHlhIFRhbmRoYW5pYScsXG4gIHsnSlBZJzogWydKUMKlJywgJ8KlJ10sICdUWlMnOiBbJ1RTaCddLCAnVVNEJzogWydVUyQnLCAnJCddfSwgcGx1cmFsXG5dO1xuIl19
{ "pile_set_name": "Github" }
# CONFIG_LOCALVERSION_AUTO is not set CONFIG_KERNEL_XZ=y # CONFIG_SWAP is not set CONFIG_SYSVIPC=y CONFIG_POSIX_MQUEUE=y CONFIG_FHANDLE=y CONFIG_NO_HZ=y CONFIG_HIGH_RES_TIMERS=y CONFIG_LOG_BUF_SHIFT=16 # CONFIG_UTS_NS is not set # CONFIG_IPC_NS is not set # CONFIG_PID_NS is not set # CONFIG_NET_NS is not set CONFIG_RELAY=y # CONFIG_COMPAT_BRK is not set CONFIG_JUMP_LABEL=y CONFIG_MODULES=y CONFIG_MODULE_UNLOAD=y # CONFIG_BLK_DEV_BSG is not set # CONFIG_IOSCHED_DEADLINE is not set # CONFIG_IOSCHED_CFQ is not set CONFIG_ARCH_BCM2709=y CONFIG_SMP=y CONFIG_HAVE_ARM_ARCH_TIMER=y CONFIG_VMSPLIT_2G=y CONFIG_PREEMPT=y CONFIG_AEABI=y CONFIG_CMA=y CONFIG_UACCESS_WITH_MEMCPY=y CONFIG_USE_OF=y CONFIG_AUTO_ZRELADDR=y CONFIG_CPU_FREQ=y # CONFIG_CPU_FREQ_STAT is not set CONFIG_VFP=y CONFIG_NEON=y CONFIG_KERNEL_MODE_NEON=y # CONFIG_SUSPEND is not set CONFIG_NET=y CONFIG_PACKET=y CONFIG_UNIX=y CONFIG_INET=y CONFIG_IP_MULTICAST=y CONFIG_IP_PNP=y CONFIG_IP_PNP_DHCP=y CONFIG_IP_PNP_BOOTP=y CONFIG_IP_PNP_RARP=y CONFIG_NET_IPIP=y CONFIG_SYN_COOKIES=y # CONFIG_INET_XFRM_MODE_TRANSPORT is not set # CONFIG_INET_XFRM_MODE_TUNNEL is not set # CONFIG_INET_XFRM_MODE_BEET is not set # CONFIG_INET_LRO is not set CONFIG_IPV6=y CONFIG_IPV6_MULTIPLE_TABLES=y CONFIG_VLAN_8021Q=y CONFIG_BPF_JIT=y CONFIG_CFG80211=y CONFIG_MAC80211=y CONFIG_RFKILL=y CONFIG_DEVTMPFS=y CONFIG_DEVTMPFS_MOUNT=y # CONFIG_FIRMWARE_IN_KERNEL is not set CONFIG_DMA_CMA=y CONFIG_CMA_SIZE_MBYTES=5 CONFIG_CONNECTOR=y CONFIG_BCM2835_SMI=y CONFIG_SCSI=y # CONFIG_SCSI_PROC_FS is not set # CONFIG_SCSI_LOWLEVEL is not set CONFIG_NETDEVICES=y CONFIG_TUN=y CONFIG_USB_USBNET=y # CONFIG_USB_NET_AX8817X is not set # CONFIG_USB_NET_AX88179_178A is not set # CONFIG_USB_NET_CDCETHER is not set # CONFIG_USB_NET_CDC_NCM is not set CONFIG_USB_NET_SMSC95XX=y # CONFIG_USB_NET_NET1080 is not set # CONFIG_USB_NET_CDC_SUBSET is not set # CONFIG_USB_NET_ZAURUS is not set CONFIG_RTL8192CU=y # CONFIG_INPUT_MOUSEDEV is not set CONFIG_INPUT_EVDEV=y # CONFIG_INPUT_KEYBOARD is not set # CONFIG_INPUT_MOUSE is not set CONFIG_INPUT_MISC=y CONFIG_INPUT_UINPUT=y # CONFIG_SERIO is not set # CONFIG_LEGACY_PTYS is not set # CONFIG_DEVKMEM is not set CONFIG_HW_RANDOM=y CONFIG_HW_RANDOM_BCM2708=y CONFIG_RAW_DRIVER=y CONFIG_BRCM_CHAR_DRIVERS=y CONFIG_BCM_VC_CMA=y CONFIG_BCM_VCIO=y CONFIG_BCM_VC_SM=y # CONFIG_BCM2835_DEVGPIOMEM is not set # CONFIG_BCM2835_SMI_DEV is not set CONFIG_I2C=y CONFIG_I2C_BCM2708=y CONFIG_SPI=y CONFIG_SPI_BCM2708=y CONFIG_GPIO_SYSFS=y # CONFIG_HWMON is not set CONFIG_THERMAL=y CONFIG_THERMAL_BCM2835=y CONFIG_WATCHDOG=y CONFIG_BCM2708_WDT=y CONFIG_REGULATOR=y CONFIG_FB=y CONFIG_FIRMWARE_EDID=y CONFIG_FB_MODE_HELPERS=y CONFIG_FB_BCM2708=y CONFIG_FRAMEBUFFER_CONSOLE=y CONFIG_SOUND=y CONFIG_SND=y # CONFIG_SND_SUPPORT_OLD_API is not set # CONFIG_SND_VERBOSE_PROCFS is not set CONFIG_SND_BCM2835=y # CONFIG_SND_SPI is not set # CONFIG_SND_USB is not set CONFIG_USB=y CONFIG_USB_ANNOUNCE_NEW_DEVICES=y CONFIG_USB_DYNAMIC_MINORS=y CONFIG_USB_DWCOTG=y CONFIG_USB_ACM=y CONFIG_MMC=y CONFIG_MMC_BLOCK_MINORS=32 CONFIG_MMC_BCM2835=y CONFIG_MMC_BCM2835_DMA=y CONFIG_MMC_SDHCI=y CONFIG_MMC_SDHCI_PLTFM=y CONFIG_NEW_LEDS=y CONFIG_LEDS_CLASS=y CONFIG_LEDS_GPIO=y CONFIG_LEDS_TRIGGERS=y CONFIG_DMADEVICES=y CONFIG_DMA_BCM2708=y CONFIG_MAILBOX=y CONFIG_BCM2835_MBOX=y # CONFIG_IOMMU_SUPPORT is not set CONFIG_RASPBERRYPI_FIRMWARE=y CONFIG_EXT2_FS=y CONFIG_EXT3_FS=y # CONFIG_EXT3_FS_XATTR is not set CONFIG_EXT4_FS=y CONFIG_FANOTIFY=y CONFIG_MSDOS_FS=y CONFIG_VFAT_FS=y CONFIG_FAT_DEFAULT_CODEPAGE=850 CONFIG_FAT_DEFAULT_IOCHARSET="utf8" CONFIG_TMPFS=y CONFIG_TMPFS_POSIX_ACL=y CONFIG_NLS_DEFAULT="utf8" CONFIG_NLS_CODEPAGE_437=y CONFIG_NLS_CODEPAGE_850=y CONFIG_NLS_ASCII=y CONFIG_NLS_ISO8859_1=y CONFIG_NLS_ISO8859_15=y CONFIG_NLS_UTF8=y CONFIG_STRIP_ASM_SYMS=y CONFIG_PANIC_ON_OOPS=y CONFIG_STRICT_DEVMEM=y CONFIG_CRYPTO_ANSI_CPRNG=y # CONFIG_CRYPTO_HW is not set CONFIG_ARM_CRYPTO=y CONFIG_CRYPTO_SHA1_ARM_NEON=y CONFIG_CRYPTO_SHA512_ARM_NEON=y CONFIG_CRYPTO_AES_ARM=y
{ "pile_set_name": "Github" }
<?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ namespace Magento\Catalog\Test\Constraint; use Magento\Mtf\Constraint\AbstractConstraint; use Magento\Catalog\Test\Page\Adminhtml\CatalogProductIndex; use Magento\Mtf\Fixture\FixtureInterface; /** * Assert that symbol before price is correct. */ class AssertAddBeforeForPrice extends AbstractConstraint { /** * Assert that symbol before price is correct. * * @param FixtureInterface $product * @param CatalogProductIndex $productGrid * @param string $priceTypeSymbol * @param \Magento\Catalog\Test\Page\Adminhtml\CatalogProductNew $catalogProductNew */ public function processAssert( FixtureInterface $product, CatalogProductIndex $productGrid, string $priceTypeSymbol, \Magento\Catalog\Test\Page\Adminhtml\CatalogProductNew $catalogProductNew ) { $filter = ['sku' => $product->getSku()]; $productGrid->open(); $productGrid->getProductGrid()->searchAndOpen($filter); $catalogProductNew->getProductForm()->openSection('customer-options'); /** @var \Magento\Catalog\Test\Block\Adminhtml\Product\Edit\Section\Options $options */ $options = $catalogProductNew->getProductForm()->getSection('customer-options'); $customOptions = $product->getCustomOptions()['import']['options']; foreach ($customOptions as $customOption) { /** @var array $valuesFromForm */ $valuesFromForm = $options->getValuesDataForOption( $customOption['options'], $customOption['type'], $customOption['title'] ); foreach ($valuesFromForm as $value) { \PHPUnit\Framework\Assert::assertEquals($priceTypeSymbol, $value['add_before']); } } } /** * {@inheritdoc} */ public function toString() { return 'Price for custom options has correct addbefore.'; } }
{ "pile_set_name": "Github" }
/* * Copyright (C) 2009 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 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. * * Neither the name of Google Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT * OWNER 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 "config.h" #include "WebHTTPBody.h" #include "FormData.h" using namespace WebCore; namespace WebKit { class WebHTTPBodyPrivate : public FormData { }; void WebHTTPBody::initialize() { assign(static_cast<WebHTTPBodyPrivate*>(FormData::create().releaseRef())); } void WebHTTPBody::reset() { assign(0); } void WebHTTPBody::assign(const WebHTTPBody& other) { WebHTTPBodyPrivate* p = const_cast<WebHTTPBodyPrivate*>(other.m_private); if (p) p->ref(); assign(p); } size_t WebHTTPBody::elementCount() const { ASSERT(!isNull()); return m_private->elements().size(); } bool WebHTTPBody::elementAt(size_t index, Element& result) const { ASSERT(!isNull()); if (index >= m_private->elements().size()) return false; const FormDataElement& element = m_private->elements()[index]; result.data.reset(); result.filePath.reset(); result.fileStart = 0; result.fileLength = 0; result.modificationTime = 0.0; result.blobURL = KURL(); switch (element.m_type) { case FormDataElement::data: result.type = Element::TypeData; result.data.assign(element.m_data.data(), element.m_data.size()); break; case FormDataElement::encodedFile: result.type = Element::TypeFile; result.filePath = element.m_filename; #if ENABLE(BLOB) result.fileStart = element.m_fileStart; result.fileLength = element.m_fileLength; result.modificationTime = element.m_expectedFileModificationTime; #endif break; #if ENABLE(BLOB) case FormDataElement::encodedBlob: result.type = Element::TypeBlob; result.blobURL = element.m_blobURL; break; #endif default: ASSERT_NOT_REACHED(); return false; } return true; } void WebHTTPBody::appendData(const WebData& data) { ensureMutable(); // FIXME: FormDataElement::m_data should be a SharedBuffer<char>. Then we // could avoid this buffer copy. m_private->appendData(data.data(), data.size()); } void WebHTTPBody::appendFile(const WebString& filePath) { ensureMutable(); m_private->appendFile(filePath); } void WebHTTPBody::appendFileRange(const WebString& filePath, long long fileStart, long long fileLength, double modificationTime) { #if ENABLE(BLOB) ensureMutable(); m_private->appendFileRange(filePath, fileStart, fileLength, modificationTime); #endif } void WebHTTPBody::appendBlob(const WebURL& blobURL) { #if ENABLE(BLOB) ensureMutable(); m_private->appendBlob(blobURL); #endif } long long WebHTTPBody::identifier() const { ASSERT(!isNull()); return m_private->identifier(); } void WebHTTPBody::setIdentifier(long long identifier) { ensureMutable(); return m_private->setIdentifier(identifier); } WebHTTPBody::WebHTTPBody(const PassRefPtr<FormData>& data) : m_private(static_cast<WebHTTPBodyPrivate*>(data.releaseRef())) { } WebHTTPBody& WebHTTPBody::operator=(const PassRefPtr<FormData>& data) { assign(static_cast<WebHTTPBodyPrivate*>(data.releaseRef())); return *this; } WebHTTPBody::operator PassRefPtr<FormData>() const { return m_private; } void WebHTTPBody::assign(WebHTTPBodyPrivate* p) { // p is already ref'd for us by the caller if (m_private) m_private->deref(); m_private = p; } void WebHTTPBody::ensureMutable() { ASSERT(!isNull()); if (!m_private->hasOneRef()) assign(static_cast<WebHTTPBodyPrivate*>(m_private->copy().releaseRef())); } } // namespace WebKit
{ "pile_set_name": "Github" }
#!/bin/bash # Planets revisited. # Associate the name of each planet with its distance from the sun. for planet in "Mercury 36" "Venus 67" "Earth 93" "Mars 142" "Jupiter 483" do set -- $planet # Parses variable "planet" #+ and sets positional parameters. # The "--" prevents nasty surprises if $planet is null or #+ begins with a dash. # May need to save original positional parameters, #+ since they get overwritten. # One way of doing this is to use an array, # original_params=("$@") echo "$1 $2,000,000 miles from the sun" #-------two tabs---concatenate zeroes onto parameter $2 done # (Thanks, S.C., for additional clarification.) exit 0
{ "pile_set_name": "Github" }
"""This modules contains all modules related to importing Netimmerse/Gamebryo nif files to Blender.""" # ***** BEGIN LICENSE BLOCK ***** # # Copyright © 2020, NIF File Format Library and Tools contributors. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # # * 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. # # * Neither the name of the NIF File Format Library and Tools # project nor the names of its contributors may be used to endorse # or promote products derived from this software without specific # prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 # COPYRIGHT OWNER 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. # # ***** END LICENSE BLOCK *****
{ "pile_set_name": "Github" }
/** * Copyright (c) 2015-2020, Michael Yang 杨福海 (fuhai999@gmail.com). * <p> * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * <p> * http://www.apache.org/licenses/LICENSE-2.0 * <p> * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package io.jboot.app.config.support.nacos; import com.alibaba.nacos.api.NacosFactory; import com.alibaba.nacos.api.config.ConfigService; import io.jboot.app.config.ConfigUtil; import io.jboot.app.config.JbootConfigManager; import java.io.IOException; import java.io.StringReader; import java.util.Objects; import java.util.Properties; /** * @author michael yang (fuhai999@gmail.com) * @Date: 2020/2/8 */ public class NacosConfigManager { private static final NacosConfigManager ME = new NacosConfigManager(); public static NacosConfigManager me() { return ME; } private Properties contentProperties; /** * 初始化 nacos 配置监听 */ public void init(JbootConfigManager configManager) { NacosServerConfig nacosServerConfig = configManager.get(NacosServerConfig.class); if (!nacosServerConfig.isEnable() || !nacosServerConfig.isConfigOk()) { return; } try { ConfigService configService = NacosFactory.createConfigService(nacosServerConfig.toProperties()); String content = configService.getConfig(nacosServerConfig.getDataId() , nacosServerConfig.getGroup(), 3000); if (ConfigUtil.isNotBlank(content)) { contentProperties = str2Properties(content); if (contentProperties != null) { configManager.setRemoteProperties(contentProperties); } } new NacosConfigIniter(this, configManager).initListener(configService, nacosServerConfig); } catch (Exception e) { e.printStackTrace(); } } /** * 接收到 nacos 服务器消息 * @param configManager * @param configInfo */ public void onReceiveConfigInfo(JbootConfigManager configManager, String configInfo) { Properties properties = str2Properties(configInfo); if (contentProperties == null) { contentProperties = properties; configManager.setRemoteProperties(properties); } else { for (Object key : properties.keySet()) { String newValue = properties.getProperty(key.toString()); String oldValue = contentProperties.getProperty(key.toString()); if (!Objects.equals(newValue, oldValue)) { contentProperties.put(key, newValue); configManager.setRemoteProperty(key.toString(), newValue); configManager.notifyChangeListeners(key.toString(),newValue,oldValue); } } } } private Properties str2Properties(String content) { try { Properties properties = new Properties(); properties.load(new StringReader(content)); return properties; } catch (IOException e) { e.printStackTrace(); } return null; } }
{ "pile_set_name": "Github" }
[com.spazedog.lib.rootfw](../index.md) / [ShellStream](index.md) / [streamId](.) # streamId `fun streamId(): `[`Int`](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) Return this stream's id Each new [ShellStream](index.md) get's an id. This method will return the id of this stream
{ "pile_set_name": "Github" }
/* * Copyright(c) 2011-2016 Intel Corporation. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * Authors: * Zhi Wang <zhi.a.wang@intel.com> * * Contributors: * Ping Gao <ping.a.gao@intel.com> * Tina Zhang <tina.zhang@intel.com> * Chanbin Du <changbin.du@intel.com> * Min He <min.he@intel.com> * Bing Niu <bing.niu@intel.com> * Zhenyu Wang <zhenyuw@linux.intel.com> * */ #include <linux/kthread.h> #include "gem/i915_gem_context.h" #include "gem/i915_gem_pm.h" #include "gt/intel_context.h" #include "i915_drv.h" #include "gvt.h" #define RING_CTX_OFF(x) \ offsetof(struct execlist_ring_context, x) static void set_context_pdp_root_pointer( struct execlist_ring_context *ring_context, u32 pdp[8]) { int i; for (i = 0; i < 8; i++) ring_context->pdps[i].val = pdp[7 - i]; } static void update_shadow_pdps(struct intel_vgpu_workload *workload) { struct drm_i915_gem_object *ctx_obj = workload->req->hw_context->state->obj; struct execlist_ring_context *shadow_ring_context; struct page *page; if (WARN_ON(!workload->shadow_mm)) return; if (WARN_ON(!atomic_read(&workload->shadow_mm->pincount))) return; page = i915_gem_object_get_page(ctx_obj, LRC_STATE_PN); shadow_ring_context = kmap(page); set_context_pdp_root_pointer(shadow_ring_context, (void *)workload->shadow_mm->ppgtt_mm.shadow_pdps); kunmap(page); } /* * when populating shadow ctx from guest, we should not overrride oa related * registers, so that they will not be overlapped by guest oa configs. Thus * made it possible to capture oa data from host for both host and guests. */ static void sr_oa_regs(struct intel_vgpu_workload *workload, u32 *reg_state, bool save) { struct drm_i915_private *dev_priv = workload->vgpu->gvt->dev_priv; u32 ctx_oactxctrl = dev_priv->perf.ctx_oactxctrl_offset; u32 ctx_flexeu0 = dev_priv->perf.ctx_flexeu0_offset; int i = 0; u32 flex_mmio[] = { i915_mmio_reg_offset(EU_PERF_CNTL0), i915_mmio_reg_offset(EU_PERF_CNTL1), i915_mmio_reg_offset(EU_PERF_CNTL2), i915_mmio_reg_offset(EU_PERF_CNTL3), i915_mmio_reg_offset(EU_PERF_CNTL4), i915_mmio_reg_offset(EU_PERF_CNTL5), i915_mmio_reg_offset(EU_PERF_CNTL6), }; if (workload->ring_id != RCS0) return; if (save) { workload->oactxctrl = reg_state[ctx_oactxctrl + 1]; for (i = 0; i < ARRAY_SIZE(workload->flex_mmio); i++) { u32 state_offset = ctx_flexeu0 + i * 2; workload->flex_mmio[i] = reg_state[state_offset + 1]; } } else { reg_state[ctx_oactxctrl] = i915_mmio_reg_offset(GEN8_OACTXCONTROL); reg_state[ctx_oactxctrl + 1] = workload->oactxctrl; for (i = 0; i < ARRAY_SIZE(workload->flex_mmio); i++) { u32 state_offset = ctx_flexeu0 + i * 2; u32 mmio = flex_mmio[i]; reg_state[state_offset] = mmio; reg_state[state_offset + 1] = workload->flex_mmio[i]; } } } static int populate_shadow_context(struct intel_vgpu_workload *workload) { struct intel_vgpu *vgpu = workload->vgpu; struct intel_gvt *gvt = vgpu->gvt; int ring_id = workload->ring_id; struct drm_i915_gem_object *ctx_obj = workload->req->hw_context->state->obj; struct execlist_ring_context *shadow_ring_context; struct page *page; void *dst; unsigned long context_gpa, context_page_num; int i; page = i915_gem_object_get_page(ctx_obj, LRC_STATE_PN); shadow_ring_context = kmap(page); sr_oa_regs(workload, (u32 *)shadow_ring_context, true); #define COPY_REG(name) \ intel_gvt_hypervisor_read_gpa(vgpu, workload->ring_context_gpa \ + RING_CTX_OFF(name.val), &shadow_ring_context->name.val, 4) #define COPY_REG_MASKED(name) {\ intel_gvt_hypervisor_read_gpa(vgpu, workload->ring_context_gpa \ + RING_CTX_OFF(name.val),\ &shadow_ring_context->name.val, 4);\ shadow_ring_context->name.val |= 0xffff << 16;\ } COPY_REG_MASKED(ctx_ctrl); COPY_REG(ctx_timestamp); if (ring_id == RCS0) { COPY_REG(bb_per_ctx_ptr); COPY_REG(rcs_indirect_ctx); COPY_REG(rcs_indirect_ctx_offset); } #undef COPY_REG #undef COPY_REG_MASKED intel_gvt_hypervisor_read_gpa(vgpu, workload->ring_context_gpa + sizeof(*shadow_ring_context), (void *)shadow_ring_context + sizeof(*shadow_ring_context), I915_GTT_PAGE_SIZE - sizeof(*shadow_ring_context)); sr_oa_regs(workload, (u32 *)shadow_ring_context, false); kunmap(page); if (IS_RESTORE_INHIBIT(shadow_ring_context->ctx_ctrl.val)) return 0; gvt_dbg_sched("ring id %d workload lrca %x", ring_id, workload->ctx_desc.lrca); context_page_num = gvt->dev_priv->engine[ring_id]->context_size; context_page_num = context_page_num >> PAGE_SHIFT; if (IS_BROADWELL(gvt->dev_priv) && ring_id == RCS0) context_page_num = 19; i = 2; while (i < context_page_num) { context_gpa = intel_vgpu_gma_to_gpa(vgpu->gtt.ggtt_mm, (u32)((workload->ctx_desc.lrca + i) << I915_GTT_PAGE_SHIFT)); if (context_gpa == INTEL_GVT_INVALID_ADDR) { gvt_vgpu_err("Invalid guest context descriptor\n"); return -EFAULT; } page = i915_gem_object_get_page(ctx_obj, LRC_HEADER_PAGES + i); dst = kmap(page); intel_gvt_hypervisor_read_gpa(vgpu, context_gpa, dst, I915_GTT_PAGE_SIZE); kunmap(page); i++; } return 0; } static inline bool is_gvt_request(struct i915_request *req) { return i915_gem_context_force_single_submission(req->gem_context); } static void save_ring_hw_state(struct intel_vgpu *vgpu, int ring_id) { struct drm_i915_private *dev_priv = vgpu->gvt->dev_priv; u32 ring_base = dev_priv->engine[ring_id]->mmio_base; i915_reg_t reg; reg = RING_INSTDONE(ring_base); vgpu_vreg(vgpu, i915_mmio_reg_offset(reg)) = I915_READ_FW(reg); reg = RING_ACTHD(ring_base); vgpu_vreg(vgpu, i915_mmio_reg_offset(reg)) = I915_READ_FW(reg); reg = RING_ACTHD_UDW(ring_base); vgpu_vreg(vgpu, i915_mmio_reg_offset(reg)) = I915_READ_FW(reg); } static int shadow_context_status_change(struct notifier_block *nb, unsigned long action, void *data) { struct i915_request *req = data; struct intel_gvt *gvt = container_of(nb, struct intel_gvt, shadow_ctx_notifier_block[req->engine->id]); struct intel_gvt_workload_scheduler *scheduler = &gvt->scheduler; enum intel_engine_id ring_id = req->engine->id; struct intel_vgpu_workload *workload; unsigned long flags; if (!is_gvt_request(req)) { spin_lock_irqsave(&scheduler->mmio_context_lock, flags); if (action == INTEL_CONTEXT_SCHEDULE_IN && scheduler->engine_owner[ring_id]) { /* Switch ring from vGPU to host. */ intel_gvt_switch_mmio(scheduler->engine_owner[ring_id], NULL, ring_id); scheduler->engine_owner[ring_id] = NULL; } spin_unlock_irqrestore(&scheduler->mmio_context_lock, flags); return NOTIFY_OK; } workload = scheduler->current_workload[ring_id]; if (unlikely(!workload)) return NOTIFY_OK; switch (action) { case INTEL_CONTEXT_SCHEDULE_IN: spin_lock_irqsave(&scheduler->mmio_context_lock, flags); if (workload->vgpu != scheduler->engine_owner[ring_id]) { /* Switch ring from host to vGPU or vGPU to vGPU. */ intel_gvt_switch_mmio(scheduler->engine_owner[ring_id], workload->vgpu, ring_id); scheduler->engine_owner[ring_id] = workload->vgpu; } else gvt_dbg_sched("skip ring %d mmio switch for vgpu%d\n", ring_id, workload->vgpu->id); spin_unlock_irqrestore(&scheduler->mmio_context_lock, flags); atomic_set(&workload->shadow_ctx_active, 1); break; case INTEL_CONTEXT_SCHEDULE_OUT: save_ring_hw_state(workload->vgpu, ring_id); atomic_set(&workload->shadow_ctx_active, 0); break; case INTEL_CONTEXT_SCHEDULE_PREEMPTED: save_ring_hw_state(workload->vgpu, ring_id); break; default: WARN_ON(1); return NOTIFY_OK; } wake_up(&workload->shadow_ctx_status_wq); return NOTIFY_OK; } static void shadow_context_descriptor_update(struct intel_context *ce, struct intel_vgpu_workload *workload) { u64 desc = ce->lrc_desc; /* * Update bits 0-11 of the context descriptor which includes flags * like GEN8_CTX_* cached in desc_template */ desc &= ~(0x3 << GEN8_CTX_ADDRESSING_MODE_SHIFT); desc |= workload->ctx_desc.addressing_mode << GEN8_CTX_ADDRESSING_MODE_SHIFT; ce->lrc_desc = desc; } static int copy_workload_to_ring_buffer(struct intel_vgpu_workload *workload) { struct intel_vgpu *vgpu = workload->vgpu; struct i915_request *req = workload->req; void *shadow_ring_buffer_va; u32 *cs; int err; if (IS_GEN(req->i915, 9) && is_inhibit_context(req->hw_context)) intel_vgpu_restore_inhibit_context(vgpu, req); /* * To track whether a request has started on HW, we can emit a * breadcrumb at the beginning of the request and check its * timeline's HWSP to see if the breadcrumb has advanced past the * start of this request. Actually, the request must have the * init_breadcrumb if its timeline set has_init_bread_crumb, or the * scheduler might get a wrong state of it during reset. Since the * requests from gvt always set the has_init_breadcrumb flag, here * need to do the emit_init_breadcrumb for all the requests. */ if (req->engine->emit_init_breadcrumb) { err = req->engine->emit_init_breadcrumb(req); if (err) { gvt_vgpu_err("fail to emit init breadcrumb\n"); return err; } } /* allocate shadow ring buffer */ cs = intel_ring_begin(workload->req, workload->rb_len / sizeof(u32)); if (IS_ERR(cs)) { gvt_vgpu_err("fail to alloc size =%ld shadow ring buffer\n", workload->rb_len); return PTR_ERR(cs); } shadow_ring_buffer_va = workload->shadow_ring_buffer_va; /* get shadow ring buffer va */ workload->shadow_ring_buffer_va = cs; memcpy(cs, shadow_ring_buffer_va, workload->rb_len); cs += workload->rb_len / sizeof(u32); intel_ring_advance(workload->req, cs); return 0; } static void release_shadow_wa_ctx(struct intel_shadow_wa_ctx *wa_ctx) { if (!wa_ctx->indirect_ctx.obj) return; i915_gem_object_unpin_map(wa_ctx->indirect_ctx.obj); i915_gem_object_put(wa_ctx->indirect_ctx.obj); wa_ctx->indirect_ctx.obj = NULL; wa_ctx->indirect_ctx.shadow_va = NULL; } static void set_context_ppgtt_from_shadow(struct intel_vgpu_workload *workload, struct i915_gem_context *ctx) { struct intel_vgpu_mm *mm = workload->shadow_mm; struct i915_ppgtt *ppgtt = i915_vm_to_ppgtt(ctx->vm); int i = 0; if (mm->ppgtt_mm.root_entry_type == GTT_TYPE_PPGTT_ROOT_L4_ENTRY) { px_dma(ppgtt->pd) = mm->ppgtt_mm.shadow_pdps[0]; } else { for (i = 0; i < GVT_RING_CTX_NR_PDPS; i++) { struct i915_page_directory * const pd = i915_pd_entry(ppgtt->pd, i); /* skip now as current i915 ppgtt alloc won't allocate top level pdp for non 4-level table, won't impact shadow ppgtt. */ if (!pd) break; px_dma(pd) = mm->ppgtt_mm.shadow_pdps[i]; } } } static int intel_gvt_workload_req_alloc(struct intel_vgpu_workload *workload) { struct intel_vgpu *vgpu = workload->vgpu; struct intel_vgpu_submission *s = &vgpu->submission; struct drm_i915_private *dev_priv = vgpu->gvt->dev_priv; struct i915_request *rq; lockdep_assert_held(&dev_priv->drm.struct_mutex); if (workload->req) return 0; rq = i915_request_create(s->shadow[workload->ring_id]); if (IS_ERR(rq)) { gvt_vgpu_err("fail to allocate gem request\n"); return PTR_ERR(rq); } workload->req = i915_request_get(rq); return 0; } /** * intel_gvt_scan_and_shadow_workload - audit the workload by scanning and * shadow it as well, include ringbuffer,wa_ctx and ctx. * @workload: an abstract entity for each execlist submission. * * This function is called before the workload submitting to i915, to make * sure the content of the workload is valid. */ int intel_gvt_scan_and_shadow_workload(struct intel_vgpu_workload *workload) { struct intel_vgpu *vgpu = workload->vgpu; struct intel_vgpu_submission *s = &vgpu->submission; struct drm_i915_private *dev_priv = vgpu->gvt->dev_priv; int ret; lockdep_assert_held(&dev_priv->drm.struct_mutex); if (workload->shadow) return 0; if (!test_and_set_bit(workload->ring_id, s->shadow_ctx_desc_updated)) shadow_context_descriptor_update(s->shadow[workload->ring_id], workload); ret = intel_gvt_scan_and_shadow_ringbuffer(workload); if (ret) return ret; if (workload->ring_id == RCS0 && workload->wa_ctx.indirect_ctx.size) { ret = intel_gvt_scan_and_shadow_wa_ctx(&workload->wa_ctx); if (ret) goto err_shadow; } workload->shadow = true; return 0; err_shadow: release_shadow_wa_ctx(&workload->wa_ctx); return ret; } static void release_shadow_batch_buffer(struct intel_vgpu_workload *workload); static int prepare_shadow_batch_buffer(struct intel_vgpu_workload *workload) { struct intel_gvt *gvt = workload->vgpu->gvt; const int gmadr_bytes = gvt->device_info.gmadr_bytes_in_cmd; struct intel_vgpu_shadow_bb *bb; int ret; list_for_each_entry(bb, &workload->shadow_bb, list) { /* For privilge batch buffer and not wa_ctx, the bb_start_cmd_va * is only updated into ring_scan_buffer, not real ring address * allocated in later copy_workload_to_ring_buffer. pls be noted * shadow_ring_buffer_va is now pointed to real ring buffer va * in copy_workload_to_ring_buffer. */ if (bb->bb_offset) bb->bb_start_cmd_va = workload->shadow_ring_buffer_va + bb->bb_offset; if (bb->ppgtt) { /* for non-priv bb, scan&shadow is only for * debugging purpose, so the content of shadow bb * is the same as original bb. Therefore, * here, rather than switch to shadow bb's gma * address, we directly use original batch buffer's * gma address, and send original bb to hardware * directly */ if (bb->clflush & CLFLUSH_AFTER) { drm_clflush_virt_range(bb->va, bb->obj->base.size); bb->clflush &= ~CLFLUSH_AFTER; } i915_gem_object_finish_access(bb->obj); bb->accessing = false; } else { bb->vma = i915_gem_object_ggtt_pin(bb->obj, NULL, 0, 0, 0); if (IS_ERR(bb->vma)) { ret = PTR_ERR(bb->vma); goto err; } /* relocate shadow batch buffer */ bb->bb_start_cmd_va[1] = i915_ggtt_offset(bb->vma); if (gmadr_bytes == 8) bb->bb_start_cmd_va[2] = 0; /* No one is going to touch shadow bb from now on. */ if (bb->clflush & CLFLUSH_AFTER) { drm_clflush_virt_range(bb->va, bb->obj->base.size); bb->clflush &= ~CLFLUSH_AFTER; } ret = i915_gem_object_set_to_gtt_domain(bb->obj, false); if (ret) goto err; ret = i915_vma_move_to_active(bb->vma, workload->req, 0); if (ret) goto err; i915_gem_object_finish_access(bb->obj); bb->accessing = false; } } return 0; err: release_shadow_batch_buffer(workload); return ret; } static void update_wa_ctx_2_shadow_ctx(struct intel_shadow_wa_ctx *wa_ctx) { struct intel_vgpu_workload *workload = container_of(wa_ctx, struct intel_vgpu_workload, wa_ctx); struct i915_request *rq = workload->req; struct execlist_ring_context *shadow_ring_context = (struct execlist_ring_context *)rq->hw_context->lrc_reg_state; shadow_ring_context->bb_per_ctx_ptr.val = (shadow_ring_context->bb_per_ctx_ptr.val & (~PER_CTX_ADDR_MASK)) | wa_ctx->per_ctx.shadow_gma; shadow_ring_context->rcs_indirect_ctx.val = (shadow_ring_context->rcs_indirect_ctx.val & (~INDIRECT_CTX_ADDR_MASK)) | wa_ctx->indirect_ctx.shadow_gma; } static int prepare_shadow_wa_ctx(struct intel_shadow_wa_ctx *wa_ctx) { struct i915_vma *vma; unsigned char *per_ctx_va = (unsigned char *)wa_ctx->indirect_ctx.shadow_va + wa_ctx->indirect_ctx.size; if (wa_ctx->indirect_ctx.size == 0) return 0; vma = i915_gem_object_ggtt_pin(wa_ctx->indirect_ctx.obj, NULL, 0, CACHELINE_BYTES, 0); if (IS_ERR(vma)) return PTR_ERR(vma); /* FIXME: we are not tracking our pinned VMA leaving it * up to the core to fix up the stray pin_count upon * free. */ wa_ctx->indirect_ctx.shadow_gma = i915_ggtt_offset(vma); wa_ctx->per_ctx.shadow_gma = *((unsigned int *)per_ctx_va + 1); memset(per_ctx_va, 0, CACHELINE_BYTES); update_wa_ctx_2_shadow_ctx(wa_ctx); return 0; } static void update_vreg_in_ctx(struct intel_vgpu_workload *workload) { struct intel_vgpu *vgpu = workload->vgpu; struct drm_i915_private *dev_priv = vgpu->gvt->dev_priv; u32 ring_base; ring_base = dev_priv->engine[workload->ring_id]->mmio_base; vgpu_vreg_t(vgpu, RING_START(ring_base)) = workload->rb_start; } static void release_shadow_batch_buffer(struct intel_vgpu_workload *workload) { struct intel_vgpu *vgpu = workload->vgpu; struct drm_i915_private *dev_priv = vgpu->gvt->dev_priv; struct intel_vgpu_shadow_bb *bb, *pos; if (list_empty(&workload->shadow_bb)) return; bb = list_first_entry(&workload->shadow_bb, struct intel_vgpu_shadow_bb, list); mutex_lock(&dev_priv->drm.struct_mutex); list_for_each_entry_safe(bb, pos, &workload->shadow_bb, list) { if (bb->obj) { if (bb->accessing) i915_gem_object_finish_access(bb->obj); if (bb->va && !IS_ERR(bb->va)) i915_gem_object_unpin_map(bb->obj); if (bb->vma && !IS_ERR(bb->vma)) { i915_vma_unpin(bb->vma); i915_vma_close(bb->vma); } i915_gem_object_put(bb->obj); } list_del(&bb->list); kfree(bb); } mutex_unlock(&dev_priv->drm.struct_mutex); } static int prepare_workload(struct intel_vgpu_workload *workload) { struct intel_vgpu *vgpu = workload->vgpu; struct intel_vgpu_submission *s = &vgpu->submission; int ring = workload->ring_id; int ret = 0; ret = intel_vgpu_pin_mm(workload->shadow_mm); if (ret) { gvt_vgpu_err("fail to vgpu pin mm\n"); return ret; } if (workload->shadow_mm->type != INTEL_GVT_MM_PPGTT || !workload->shadow_mm->ppgtt_mm.shadowed) { gvt_vgpu_err("workload shadow ppgtt isn't ready\n"); return -EINVAL; } update_shadow_pdps(workload); set_context_ppgtt_from_shadow(workload, s->shadow[ring]->gem_context); ret = intel_vgpu_sync_oos_pages(workload->vgpu); if (ret) { gvt_vgpu_err("fail to vgpu sync oos pages\n"); goto err_unpin_mm; } ret = intel_vgpu_flush_post_shadow(workload->vgpu); if (ret) { gvt_vgpu_err("fail to flush post shadow\n"); goto err_unpin_mm; } ret = copy_workload_to_ring_buffer(workload); if (ret) { gvt_vgpu_err("fail to generate request\n"); goto err_unpin_mm; } ret = prepare_shadow_batch_buffer(workload); if (ret) { gvt_vgpu_err("fail to prepare_shadow_batch_buffer\n"); goto err_unpin_mm; } ret = prepare_shadow_wa_ctx(&workload->wa_ctx); if (ret) { gvt_vgpu_err("fail to prepare_shadow_wa_ctx\n"); goto err_shadow_batch; } if (workload->prepare) { ret = workload->prepare(workload); if (ret) goto err_shadow_wa_ctx; } return 0; err_shadow_wa_ctx: release_shadow_wa_ctx(&workload->wa_ctx); err_shadow_batch: release_shadow_batch_buffer(workload); err_unpin_mm: intel_vgpu_unpin_mm(workload->shadow_mm); return ret; } static int dispatch_workload(struct intel_vgpu_workload *workload) { struct intel_vgpu *vgpu = workload->vgpu; struct drm_i915_private *dev_priv = vgpu->gvt->dev_priv; struct i915_request *rq; int ring_id = workload->ring_id; int ret; gvt_dbg_sched("ring id %d prepare to dispatch workload %p\n", ring_id, workload); mutex_lock(&vgpu->vgpu_lock); mutex_lock(&dev_priv->drm.struct_mutex); ret = intel_gvt_workload_req_alloc(workload); if (ret) goto err_req; ret = intel_gvt_scan_and_shadow_workload(workload); if (ret) goto out; ret = populate_shadow_context(workload); if (ret) { release_shadow_wa_ctx(&workload->wa_ctx); goto out; } ret = prepare_workload(workload); out: if (ret) { /* We might still need to add request with * clean ctx to retire it properly.. */ rq = fetch_and_zero(&workload->req); i915_request_put(rq); } if (!IS_ERR_OR_NULL(workload->req)) { gvt_dbg_sched("ring id %d submit workload to i915 %p\n", ring_id, workload->req); i915_request_add(workload->req); workload->dispatched = true; } err_req: if (ret) workload->status = ret; mutex_unlock(&dev_priv->drm.struct_mutex); mutex_unlock(&vgpu->vgpu_lock); return ret; } static struct intel_vgpu_workload *pick_next_workload( struct intel_gvt *gvt, int ring_id) { struct intel_gvt_workload_scheduler *scheduler = &gvt->scheduler; struct intel_vgpu_workload *workload = NULL; mutex_lock(&gvt->sched_lock); /* * no current vgpu / will be scheduled out / no workload * bail out */ if (!scheduler->current_vgpu) { gvt_dbg_sched("ring id %d stop - no current vgpu\n", ring_id); goto out; } if (scheduler->need_reschedule) { gvt_dbg_sched("ring id %d stop - will reschedule\n", ring_id); goto out; } if (!scheduler->current_vgpu->active || list_empty(workload_q_head(scheduler->current_vgpu, ring_id))) goto out; /* * still have current workload, maybe the workload disptacher * fail to submit it for some reason, resubmit it. */ if (scheduler->current_workload[ring_id]) { workload = scheduler->current_workload[ring_id]; gvt_dbg_sched("ring id %d still have current workload %p\n", ring_id, workload); goto out; } /* * pick a workload as current workload * once current workload is set, schedule policy routines * will wait the current workload is finished when trying to * schedule out a vgpu. */ scheduler->current_workload[ring_id] = container_of( workload_q_head(scheduler->current_vgpu, ring_id)->next, struct intel_vgpu_workload, list); workload = scheduler->current_workload[ring_id]; gvt_dbg_sched("ring id %d pick new workload %p\n", ring_id, workload); atomic_inc(&workload->vgpu->submission.running_workload_num); out: mutex_unlock(&gvt->sched_lock); return workload; } static void update_guest_context(struct intel_vgpu_workload *workload) { struct i915_request *rq = workload->req; struct intel_vgpu *vgpu = workload->vgpu; struct intel_gvt *gvt = vgpu->gvt; struct drm_i915_gem_object *ctx_obj = rq->hw_context->state->obj; struct execlist_ring_context *shadow_ring_context; struct page *page; void *src; unsigned long context_gpa, context_page_num; int i; struct drm_i915_private *dev_priv = gvt->dev_priv; u32 ring_base; u32 head, tail; u16 wrap_count; gvt_dbg_sched("ring id %d workload lrca %x\n", rq->engine->id, workload->ctx_desc.lrca); head = workload->rb_head; tail = workload->rb_tail; wrap_count = workload->guest_rb_head >> RB_HEAD_WRAP_CNT_OFF; if (tail < head) { if (wrap_count == RB_HEAD_WRAP_CNT_MAX) wrap_count = 0; else wrap_count += 1; } head = (wrap_count << RB_HEAD_WRAP_CNT_OFF) | tail; ring_base = dev_priv->engine[workload->ring_id]->mmio_base; vgpu_vreg_t(vgpu, RING_TAIL(ring_base)) = tail; vgpu_vreg_t(vgpu, RING_HEAD(ring_base)) = head; context_page_num = rq->engine->context_size; context_page_num = context_page_num >> PAGE_SHIFT; if (IS_BROADWELL(gvt->dev_priv) && rq->engine->id == RCS0) context_page_num = 19; i = 2; while (i < context_page_num) { context_gpa = intel_vgpu_gma_to_gpa(vgpu->gtt.ggtt_mm, (u32)((workload->ctx_desc.lrca + i) << I915_GTT_PAGE_SHIFT)); if (context_gpa == INTEL_GVT_INVALID_ADDR) { gvt_vgpu_err("invalid guest context descriptor\n"); return; } page = i915_gem_object_get_page(ctx_obj, LRC_HEADER_PAGES + i); src = kmap(page); intel_gvt_hypervisor_write_gpa(vgpu, context_gpa, src, I915_GTT_PAGE_SIZE); kunmap(page); i++; } intel_gvt_hypervisor_write_gpa(vgpu, workload->ring_context_gpa + RING_CTX_OFF(ring_header.val), &workload->rb_tail, 4); page = i915_gem_object_get_page(ctx_obj, LRC_STATE_PN); shadow_ring_context = kmap(page); #define COPY_REG(name) \ intel_gvt_hypervisor_write_gpa(vgpu, workload->ring_context_gpa + \ RING_CTX_OFF(name.val), &shadow_ring_context->name.val, 4) COPY_REG(ctx_ctrl); COPY_REG(ctx_timestamp); #undef COPY_REG intel_gvt_hypervisor_write_gpa(vgpu, workload->ring_context_gpa + sizeof(*shadow_ring_context), (void *)shadow_ring_context + sizeof(*shadow_ring_context), I915_GTT_PAGE_SIZE - sizeof(*shadow_ring_context)); kunmap(page); } void intel_vgpu_clean_workloads(struct intel_vgpu *vgpu, intel_engine_mask_t engine_mask) { struct intel_vgpu_submission *s = &vgpu->submission; struct drm_i915_private *dev_priv = vgpu->gvt->dev_priv; struct intel_engine_cs *engine; struct intel_vgpu_workload *pos, *n; intel_engine_mask_t tmp; /* free the unsubmited workloads in the queues. */ for_each_engine_masked(engine, dev_priv, engine_mask, tmp) { list_for_each_entry_safe(pos, n, &s->workload_q_head[engine->id], list) { list_del_init(&pos->list); intel_vgpu_destroy_workload(pos); } clear_bit(engine->id, s->shadow_ctx_desc_updated); } } static void complete_current_workload(struct intel_gvt *gvt, int ring_id) { struct intel_gvt_workload_scheduler *scheduler = &gvt->scheduler; struct intel_vgpu_workload *workload = scheduler->current_workload[ring_id]; struct intel_vgpu *vgpu = workload->vgpu; struct intel_vgpu_submission *s = &vgpu->submission; struct i915_request *rq = workload->req; int event; mutex_lock(&vgpu->vgpu_lock); mutex_lock(&gvt->sched_lock); /* For the workload w/ request, needs to wait for the context * switch to make sure request is completed. * For the workload w/o request, directly complete the workload. */ if (rq) { wait_event(workload->shadow_ctx_status_wq, !atomic_read(&workload->shadow_ctx_active)); /* If this request caused GPU hang, req->fence.error will * be set to -EIO. Use -EIO to set workload status so * that when this request caused GPU hang, didn't trigger * context switch interrupt to guest. */ if (likely(workload->status == -EINPROGRESS)) { if (workload->req->fence.error == -EIO) workload->status = -EIO; else workload->status = 0; } if (!workload->status && !(vgpu->resetting_eng & BIT(ring_id))) { update_guest_context(workload); for_each_set_bit(event, workload->pending_events, INTEL_GVT_EVENT_MAX) intel_vgpu_trigger_virtual_event(vgpu, event); } i915_request_put(fetch_and_zero(&workload->req)); } gvt_dbg_sched("ring id %d complete workload %p status %d\n", ring_id, workload, workload->status); scheduler->current_workload[ring_id] = NULL; list_del_init(&workload->list); if (workload->status || vgpu->resetting_eng & BIT(ring_id)) { /* if workload->status is not successful means HW GPU * has occurred GPU hang or something wrong with i915/GVT, * and GVT won't inject context switch interrupt to guest. * So this error is a vGPU hang actually to the guest. * According to this we should emunlate a vGPU hang. If * there are pending workloads which are already submitted * from guest, we should clean them up like HW GPU does. * * if it is in middle of engine resetting, the pending * workloads won't be submitted to HW GPU and will be * cleaned up during the resetting process later, so doing * the workload clean up here doesn't have any impact. **/ intel_vgpu_clean_workloads(vgpu, BIT(ring_id)); } workload->complete(workload); atomic_dec(&s->running_workload_num); wake_up(&scheduler->workload_complete_wq); if (gvt->scheduler.need_reschedule) intel_gvt_request_service(gvt, INTEL_GVT_REQUEST_EVENT_SCHED); mutex_unlock(&gvt->sched_lock); mutex_unlock(&vgpu->vgpu_lock); } struct workload_thread_param { struct intel_gvt *gvt; int ring_id; }; static int workload_thread(void *priv) { struct workload_thread_param *p = (struct workload_thread_param *)priv; struct intel_gvt *gvt = p->gvt; int ring_id = p->ring_id; struct intel_gvt_workload_scheduler *scheduler = &gvt->scheduler; struct intel_vgpu_workload *workload = NULL; struct intel_vgpu *vgpu = NULL; int ret; bool need_force_wake = (INTEL_GEN(gvt->dev_priv) >= 9); DEFINE_WAIT_FUNC(wait, woken_wake_function); struct intel_runtime_pm *rpm = &gvt->dev_priv->runtime_pm; kfree(p); gvt_dbg_core("workload thread for ring %d started\n", ring_id); while (!kthread_should_stop()) { add_wait_queue(&scheduler->waitq[ring_id], &wait); do { workload = pick_next_workload(gvt, ring_id); if (workload) break; wait_woken(&wait, TASK_INTERRUPTIBLE, MAX_SCHEDULE_TIMEOUT); } while (!kthread_should_stop()); remove_wait_queue(&scheduler->waitq[ring_id], &wait); if (!workload) break; gvt_dbg_sched("ring id %d next workload %p vgpu %d\n", workload->ring_id, workload, workload->vgpu->id); intel_runtime_pm_get(rpm); gvt_dbg_sched("ring id %d will dispatch workload %p\n", workload->ring_id, workload); if (need_force_wake) intel_uncore_forcewake_get(&gvt->dev_priv->uncore, FORCEWAKE_ALL); /* * Update the vReg of the vGPU which submitted this * workload. The vGPU may use these registers for checking * the context state. The value comes from GPU commands * in this workload. */ update_vreg_in_ctx(workload); ret = dispatch_workload(workload); if (ret) { vgpu = workload->vgpu; gvt_vgpu_err("fail to dispatch workload, skip\n"); goto complete; } gvt_dbg_sched("ring id %d wait workload %p\n", workload->ring_id, workload); i915_request_wait(workload->req, 0, MAX_SCHEDULE_TIMEOUT); complete: gvt_dbg_sched("will complete workload %p, status: %d\n", workload, workload->status); complete_current_workload(gvt, ring_id); if (need_force_wake) intel_uncore_forcewake_put(&gvt->dev_priv->uncore, FORCEWAKE_ALL); intel_runtime_pm_put_unchecked(rpm); if (ret && (vgpu_is_vm_unhealthy(ret))) enter_failsafe_mode(vgpu, GVT_FAILSAFE_GUEST_ERR); } return 0; } void intel_gvt_wait_vgpu_idle(struct intel_vgpu *vgpu) { struct intel_vgpu_submission *s = &vgpu->submission; struct intel_gvt *gvt = vgpu->gvt; struct intel_gvt_workload_scheduler *scheduler = &gvt->scheduler; if (atomic_read(&s->running_workload_num)) { gvt_dbg_sched("wait vgpu idle\n"); wait_event(scheduler->workload_complete_wq, !atomic_read(&s->running_workload_num)); } } void intel_gvt_clean_workload_scheduler(struct intel_gvt *gvt) { struct intel_gvt_workload_scheduler *scheduler = &gvt->scheduler; struct intel_engine_cs *engine; enum intel_engine_id i; gvt_dbg_core("clean workload scheduler\n"); for_each_engine(engine, gvt->dev_priv, i) { atomic_notifier_chain_unregister( &engine->context_status_notifier, &gvt->shadow_ctx_notifier_block[i]); kthread_stop(scheduler->thread[i]); } } int intel_gvt_init_workload_scheduler(struct intel_gvt *gvt) { struct intel_gvt_workload_scheduler *scheduler = &gvt->scheduler; struct workload_thread_param *param = NULL; struct intel_engine_cs *engine; enum intel_engine_id i; int ret; gvt_dbg_core("init workload scheduler\n"); init_waitqueue_head(&scheduler->workload_complete_wq); for_each_engine(engine, gvt->dev_priv, i) { init_waitqueue_head(&scheduler->waitq[i]); param = kzalloc(sizeof(*param), GFP_KERNEL); if (!param) { ret = -ENOMEM; goto err; } param->gvt = gvt; param->ring_id = i; scheduler->thread[i] = kthread_run(workload_thread, param, "gvt workload %d", i); if (IS_ERR(scheduler->thread[i])) { gvt_err("fail to create workload thread\n"); ret = PTR_ERR(scheduler->thread[i]); goto err; } gvt->shadow_ctx_notifier_block[i].notifier_call = shadow_context_status_change; atomic_notifier_chain_register(&engine->context_status_notifier, &gvt->shadow_ctx_notifier_block[i]); } return 0; err: intel_gvt_clean_workload_scheduler(gvt); kfree(param); param = NULL; return ret; } static void i915_context_ppgtt_root_restore(struct intel_vgpu_submission *s, struct i915_ppgtt *ppgtt) { int i; if (i915_vm_is_4lvl(&ppgtt->vm)) { px_dma(ppgtt->pd) = s->i915_context_pml4; } else { for (i = 0; i < GEN8_3LVL_PDPES; i++) { struct i915_page_directory * const pd = i915_pd_entry(ppgtt->pd, i); px_dma(pd) = s->i915_context_pdps[i]; } } } /** * intel_vgpu_clean_submission - free submission-related resource for vGPU * @vgpu: a vGPU * * This function is called when a vGPU is being destroyed. * */ void intel_vgpu_clean_submission(struct intel_vgpu *vgpu) { struct intel_vgpu_submission *s = &vgpu->submission; struct intel_engine_cs *engine; enum intel_engine_id id; intel_vgpu_select_submission_ops(vgpu, ALL_ENGINES, 0); i915_context_ppgtt_root_restore(s, i915_vm_to_ppgtt(s->shadow[0]->vm)); for_each_engine(engine, vgpu->gvt->dev_priv, id) intel_context_unpin(s->shadow[id]); kmem_cache_destroy(s->workloads); } /** * intel_vgpu_reset_submission - reset submission-related resource for vGPU * @vgpu: a vGPU * @engine_mask: engines expected to be reset * * This function is called when a vGPU is being destroyed. * */ void intel_vgpu_reset_submission(struct intel_vgpu *vgpu, intel_engine_mask_t engine_mask) { struct intel_vgpu_submission *s = &vgpu->submission; if (!s->active) return; intel_vgpu_clean_workloads(vgpu, engine_mask); s->ops->reset(vgpu, engine_mask); } static void i915_context_ppgtt_root_save(struct intel_vgpu_submission *s, struct i915_ppgtt *ppgtt) { int i; if (i915_vm_is_4lvl(&ppgtt->vm)) { s->i915_context_pml4 = px_dma(ppgtt->pd); } else { for (i = 0; i < GEN8_3LVL_PDPES; i++) { struct i915_page_directory * const pd = i915_pd_entry(ppgtt->pd, i); s->i915_context_pdps[i] = px_dma(pd); } } } /** * intel_vgpu_setup_submission - setup submission-related resource for vGPU * @vgpu: a vGPU * * This function is called when a vGPU is being created. * * Returns: * Zero on success, negative error code if failed. * */ int intel_vgpu_setup_submission(struct intel_vgpu *vgpu) { struct drm_i915_private *i915 = vgpu->gvt->dev_priv; struct intel_vgpu_submission *s = &vgpu->submission; struct intel_engine_cs *engine; struct i915_gem_context *ctx; enum intel_engine_id i; int ret; mutex_lock(&i915->drm.struct_mutex); ctx = i915_gem_context_create_kernel(i915, I915_PRIORITY_MAX); if (IS_ERR(ctx)) { ret = PTR_ERR(ctx); goto out_unlock; } i915_gem_context_set_force_single_submission(ctx); i915_context_ppgtt_root_save(s, i915_vm_to_ppgtt(ctx->vm)); for_each_engine(engine, i915, i) { struct intel_context *ce; INIT_LIST_HEAD(&s->workload_q_head[i]); s->shadow[i] = ERR_PTR(-EINVAL); ce = intel_context_create(ctx, engine); if (IS_ERR(ce)) { ret = PTR_ERR(ce); goto out_shadow_ctx; } if (!USES_GUC_SUBMISSION(i915)) { /* Max ring buffer size */ const unsigned int ring_size = 512 * SZ_4K; ce->ring = __intel_context_ring_size(ring_size); } ret = intel_context_pin(ce); intel_context_put(ce); if (ret) goto out_shadow_ctx; s->shadow[i] = ce; } bitmap_zero(s->shadow_ctx_desc_updated, I915_NUM_ENGINES); s->workloads = kmem_cache_create_usercopy("gvt-g_vgpu_workload", sizeof(struct intel_vgpu_workload), 0, SLAB_HWCACHE_ALIGN, offsetof(struct intel_vgpu_workload, rb_tail), sizeof_field(struct intel_vgpu_workload, rb_tail), NULL); if (!s->workloads) { ret = -ENOMEM; goto out_shadow_ctx; } atomic_set(&s->running_workload_num, 0); bitmap_zero(s->tlb_handle_pending, I915_NUM_ENGINES); i915_gem_context_put(ctx); mutex_unlock(&i915->drm.struct_mutex); return 0; out_shadow_ctx: i915_context_ppgtt_root_restore(s, i915_vm_to_ppgtt(ctx->vm)); for_each_engine(engine, i915, i) { if (IS_ERR(s->shadow[i])) break; intel_context_unpin(s->shadow[i]); intel_context_put(s->shadow[i]); } i915_gem_context_put(ctx); out_unlock: mutex_unlock(&i915->drm.struct_mutex); return ret; } /** * intel_vgpu_select_submission_ops - select virtual submission interface * @vgpu: a vGPU * @engine_mask: either ALL_ENGINES or target engine mask * @interface: expected vGPU virtual submission interface * * This function is called when guest configures submission interface. * * Returns: * Zero on success, negative error code if failed. * */ int intel_vgpu_select_submission_ops(struct intel_vgpu *vgpu, intel_engine_mask_t engine_mask, unsigned int interface) { struct intel_vgpu_submission *s = &vgpu->submission; const struct intel_vgpu_submission_ops *ops[] = { [INTEL_VGPU_EXECLIST_SUBMISSION] = &intel_vgpu_execlist_submission_ops, }; int ret; if (WARN_ON(interface >= ARRAY_SIZE(ops))) return -EINVAL; if (WARN_ON(interface == 0 && engine_mask != ALL_ENGINES)) return -EINVAL; if (s->active) s->ops->clean(vgpu, engine_mask); if (interface == 0) { s->ops = NULL; s->virtual_submission_interface = 0; s->active = false; gvt_dbg_core("vgpu%d: remove submission ops\n", vgpu->id); return 0; } ret = ops[interface]->init(vgpu, engine_mask); if (ret) return ret; s->ops = ops[interface]; s->virtual_submission_interface = interface; s->active = true; gvt_dbg_core("vgpu%d: activate ops [ %s ]\n", vgpu->id, s->ops->name); return 0; } /** * intel_vgpu_destroy_workload - destroy a vGPU workload * @workload: workload to destroy * * This function is called when destroy a vGPU workload. * */ void intel_vgpu_destroy_workload(struct intel_vgpu_workload *workload) { struct intel_vgpu_submission *s = &workload->vgpu->submission; release_shadow_batch_buffer(workload); release_shadow_wa_ctx(&workload->wa_ctx); if (workload->shadow_mm) intel_vgpu_mm_put(workload->shadow_mm); kmem_cache_free(s->workloads, workload); } static struct intel_vgpu_workload * alloc_workload(struct intel_vgpu *vgpu) { struct intel_vgpu_submission *s = &vgpu->submission; struct intel_vgpu_workload *workload; workload = kmem_cache_zalloc(s->workloads, GFP_KERNEL); if (!workload) return ERR_PTR(-ENOMEM); INIT_LIST_HEAD(&workload->list); INIT_LIST_HEAD(&workload->shadow_bb); init_waitqueue_head(&workload->shadow_ctx_status_wq); atomic_set(&workload->shadow_ctx_active, 0); workload->status = -EINPROGRESS; workload->vgpu = vgpu; return workload; } #define RING_CTX_OFF(x) \ offsetof(struct execlist_ring_context, x) static void read_guest_pdps(struct intel_vgpu *vgpu, u64 ring_context_gpa, u32 pdp[8]) { u64 gpa; int i; gpa = ring_context_gpa + RING_CTX_OFF(pdps[0].val); for (i = 0; i < 8; i++) intel_gvt_hypervisor_read_gpa(vgpu, gpa + i * 8, &pdp[7 - i], 4); } static int prepare_mm(struct intel_vgpu_workload *workload) { struct execlist_ctx_descriptor_format *desc = &workload->ctx_desc; struct intel_vgpu_mm *mm; struct intel_vgpu *vgpu = workload->vgpu; enum intel_gvt_gtt_type root_entry_type; u64 pdps[GVT_RING_CTX_NR_PDPS]; switch (desc->addressing_mode) { case 1: /* legacy 32-bit */ root_entry_type = GTT_TYPE_PPGTT_ROOT_L3_ENTRY; break; case 3: /* legacy 64-bit */ root_entry_type = GTT_TYPE_PPGTT_ROOT_L4_ENTRY; break; default: gvt_vgpu_err("Advanced Context mode(SVM) is not supported!\n"); return -EINVAL; } read_guest_pdps(workload->vgpu, workload->ring_context_gpa, (void *)pdps); mm = intel_vgpu_get_ppgtt_mm(workload->vgpu, root_entry_type, pdps); if (IS_ERR(mm)) return PTR_ERR(mm); workload->shadow_mm = mm; return 0; } #define same_context(a, b) (((a)->context_id == (b)->context_id) && \ ((a)->lrca == (b)->lrca)) /** * intel_vgpu_create_workload - create a vGPU workload * @vgpu: a vGPU * @ring_id: ring index * @desc: a guest context descriptor * * This function is called when creating a vGPU workload. * * Returns: * struct intel_vgpu_workload * on success, negative error code in * pointer if failed. * */ struct intel_vgpu_workload * intel_vgpu_create_workload(struct intel_vgpu *vgpu, int ring_id, struct execlist_ctx_descriptor_format *desc) { struct intel_vgpu_submission *s = &vgpu->submission; struct list_head *q = workload_q_head(vgpu, ring_id); struct intel_vgpu_workload *last_workload = NULL; struct intel_vgpu_workload *workload = NULL; struct drm_i915_private *dev_priv = vgpu->gvt->dev_priv; u64 ring_context_gpa; u32 head, tail, start, ctl, ctx_ctl, per_ctx, indirect_ctx; u32 guest_head; int ret; ring_context_gpa = intel_vgpu_gma_to_gpa(vgpu->gtt.ggtt_mm, (u32)((desc->lrca + 1) << I915_GTT_PAGE_SHIFT)); if (ring_context_gpa == INTEL_GVT_INVALID_ADDR) { gvt_vgpu_err("invalid guest context LRCA: %x\n", desc->lrca); return ERR_PTR(-EINVAL); } intel_gvt_hypervisor_read_gpa(vgpu, ring_context_gpa + RING_CTX_OFF(ring_header.val), &head, 4); intel_gvt_hypervisor_read_gpa(vgpu, ring_context_gpa + RING_CTX_OFF(ring_tail.val), &tail, 4); guest_head = head; head &= RB_HEAD_OFF_MASK; tail &= RB_TAIL_OFF_MASK; list_for_each_entry_reverse(last_workload, q, list) { if (same_context(&last_workload->ctx_desc, desc)) { gvt_dbg_el("ring id %d cur workload == last\n", ring_id); gvt_dbg_el("ctx head %x real head %lx\n", head, last_workload->rb_tail); /* * cannot use guest context head pointer here, * as it might not be updated at this time */ head = last_workload->rb_tail; break; } } gvt_dbg_el("ring id %d begin a new workload\n", ring_id); /* record some ring buffer register values for scan and shadow */ intel_gvt_hypervisor_read_gpa(vgpu, ring_context_gpa + RING_CTX_OFF(rb_start.val), &start, 4); intel_gvt_hypervisor_read_gpa(vgpu, ring_context_gpa + RING_CTX_OFF(rb_ctrl.val), &ctl, 4); intel_gvt_hypervisor_read_gpa(vgpu, ring_context_gpa + RING_CTX_OFF(ctx_ctrl.val), &ctx_ctl, 4); if (!intel_gvt_ggtt_validate_range(vgpu, start, _RING_CTL_BUF_SIZE(ctl))) { gvt_vgpu_err("context contain invalid rb at: 0x%x\n", start); return ERR_PTR(-EINVAL); } workload = alloc_workload(vgpu); if (IS_ERR(workload)) return workload; workload->ring_id = ring_id; workload->ctx_desc = *desc; workload->ring_context_gpa = ring_context_gpa; workload->rb_head = head; workload->guest_rb_head = guest_head; workload->rb_tail = tail; workload->rb_start = start; workload->rb_ctl = ctl; if (ring_id == RCS0) { intel_gvt_hypervisor_read_gpa(vgpu, ring_context_gpa + RING_CTX_OFF(bb_per_ctx_ptr.val), &per_ctx, 4); intel_gvt_hypervisor_read_gpa(vgpu, ring_context_gpa + RING_CTX_OFF(rcs_indirect_ctx.val), &indirect_ctx, 4); workload->wa_ctx.indirect_ctx.guest_gma = indirect_ctx & INDIRECT_CTX_ADDR_MASK; workload->wa_ctx.indirect_ctx.size = (indirect_ctx & INDIRECT_CTX_SIZE_MASK) * CACHELINE_BYTES; if (workload->wa_ctx.indirect_ctx.size != 0) { if (!intel_gvt_ggtt_validate_range(vgpu, workload->wa_ctx.indirect_ctx.guest_gma, workload->wa_ctx.indirect_ctx.size)) { gvt_vgpu_err("invalid wa_ctx at: 0x%lx\n", workload->wa_ctx.indirect_ctx.guest_gma); kmem_cache_free(s->workloads, workload); return ERR_PTR(-EINVAL); } } workload->wa_ctx.per_ctx.guest_gma = per_ctx & PER_CTX_ADDR_MASK; workload->wa_ctx.per_ctx.valid = per_ctx & 1; if (workload->wa_ctx.per_ctx.valid) { if (!intel_gvt_ggtt_validate_range(vgpu, workload->wa_ctx.per_ctx.guest_gma, CACHELINE_BYTES)) { gvt_vgpu_err("invalid per_ctx at: 0x%lx\n", workload->wa_ctx.per_ctx.guest_gma); kmem_cache_free(s->workloads, workload); return ERR_PTR(-EINVAL); } } } gvt_dbg_el("workload %p ring id %d head %x tail %x start %x ctl %x\n", workload, ring_id, head, tail, start, ctl); ret = prepare_mm(workload); if (ret) { kmem_cache_free(s->workloads, workload); return ERR_PTR(ret); } /* Only scan and shadow the first workload in the queue * as there is only one pre-allocated buf-obj for shadow. */ if (list_empty(workload_q_head(vgpu, ring_id))) { intel_runtime_pm_get(&dev_priv->runtime_pm); mutex_lock(&dev_priv->drm.struct_mutex); ret = intel_gvt_scan_and_shadow_workload(workload); mutex_unlock(&dev_priv->drm.struct_mutex); intel_runtime_pm_put_unchecked(&dev_priv->runtime_pm); } if (ret) { if (vgpu_is_vm_unhealthy(ret)) enter_failsafe_mode(vgpu, GVT_FAILSAFE_GUEST_ERR); intel_vgpu_destroy_workload(workload); return ERR_PTR(ret); } return workload; } /** * intel_vgpu_queue_workload - Qeue a vGPU workload * @workload: the workload to queue in */ void intel_vgpu_queue_workload(struct intel_vgpu_workload *workload) { list_add_tail(&workload->list, workload_q_head(workload->vgpu, workload->ring_id)); intel_gvt_kick_schedule(workload->vgpu->gvt); wake_up(&workload->vgpu->gvt->scheduler.waitq[workload->ring_id]); }
{ "pile_set_name": "Github" }
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.hadoop.hdfs.server.blockmanagement; import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_NAMENODE_MAX_FULL_BLOCK_REPORT_LEASES; import static org.apache.hadoop.hdfs.DFSConfigKeys.DFS_NAMENODE_FULL_BLOCK_REPORT_LEASE_LENGTH_MS; import com.google.common.base.Joiner; import java.util.function.Supplier; import com.google.common.util.concurrent.Uninterruptibles; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hdfs.MiniDFSCluster; import org.apache.hadoop.hdfs.protocol.DatanodeID; import org.apache.hadoop.hdfs.server.protocol.BlockReportContext; import org.apache.hadoop.test.GenericTestUtils; import org.apache.log4j.Level; import org.junit.Assert; import org.junit.After; import org.junit.BeforeClass; import org.junit.Test; import java.io.IOException; import java.util.HashSet; import java.util.concurrent.Semaphore; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicReference; public class TestBlockReportRateLimiting { static final Logger LOG = LoggerFactory.getLogger(TestBlockReportRateLimiting.class); private static void setFailure(AtomicReference<String> failure, String what) { failure.compareAndSet("", what); LOG.error("Test error: " + what); } @After public void restoreNormalBlockManagerFaultInjector() { BlockManagerFaultInjector.instance = new BlockManagerFaultInjector(); } @BeforeClass public static void raiseBlockManagerLogLevels() { GenericTestUtils.setLogLevel(BlockManager.LOG, Level.ALL); GenericTestUtils.setLogLevel(BlockReportLeaseManager.LOG, Level.ALL); } @Test(timeout=180000) public void testRateLimitingDuringDataNodeStartup() throws Exception { Configuration conf = new Configuration(); conf.setInt(DFS_NAMENODE_MAX_FULL_BLOCK_REPORT_LEASES, 1); conf.setLong(DFS_NAMENODE_FULL_BLOCK_REPORT_LEASE_LENGTH_MS, 20L * 60L * 1000L); final Semaphore fbrSem = new Semaphore(0); final HashSet<DatanodeID> expectedFbrDns = new HashSet<>(); final HashSet<DatanodeID> fbrDns = new HashSet<>(); final AtomicReference<String> failure = new AtomicReference<String>(""); final BlockManagerFaultInjector injector = new BlockManagerFaultInjector() { private int numLeases = 0; @Override public void incomingBlockReportRpc(DatanodeID nodeID, BlockReportContext context) throws IOException { LOG.info("Incoming full block report from " + nodeID + ". Lease ID = 0x" + Long.toHexString(context.getLeaseId())); if (context.getLeaseId() == 0) { setFailure(failure, "Got unexpected rate-limiting-" + "bypassing full block report RPC from " + nodeID); } fbrSem.acquireUninterruptibly(); synchronized (this) { fbrDns.add(nodeID); if (!expectedFbrDns.remove(nodeID)) { setFailure(failure, "Got unexpected full block report " + "RPC from " + nodeID + ". expectedFbrDns = " + Joiner.on(", ").join(expectedFbrDns)); } LOG.info("Proceeding with full block report from " + nodeID + ". Lease ID = 0x" + Long.toHexString(context.getLeaseId())); } } @Override public void requestBlockReportLease(DatanodeDescriptor node, long leaseId) { if (leaseId == 0) { return; } synchronized (this) { numLeases++; expectedFbrDns.add(node); LOG.info("requestBlockReportLease(node=" + node + ", leaseId=0x" + Long.toHexString(leaseId) + "). " + "expectedFbrDns = " + Joiner.on(", ").join(expectedFbrDns)); if (numLeases > 1) { setFailure(failure, "More than 1 lease was issued at once."); } } } @Override public void removeBlockReportLease(DatanodeDescriptor node, long leaseId) { LOG.info("removeBlockReportLease(node=" + node + ", leaseId=0x" + Long.toHexString(leaseId) + ")"); synchronized (this) { numLeases--; } } }; BlockManagerFaultInjector.instance = injector; final int NUM_DATANODES = 5; MiniDFSCluster cluster = new MiniDFSCluster.Builder(conf).numDataNodes(NUM_DATANODES).build(); cluster.waitActive(); for (int n = 1; n <= NUM_DATANODES; n++) { LOG.info("Waiting for " + n + " datanode(s) to report in."); fbrSem.release(); Uninterruptibles.sleepUninterruptibly(20, TimeUnit.MILLISECONDS); final int currentN = n; GenericTestUtils.waitFor(new Supplier<Boolean>() { @Override public Boolean get() { synchronized (injector) { if (fbrDns.size() > currentN) { setFailure(failure, "Expected at most " + currentN + " datanodes to have sent a block report, but actually " + fbrDns.size() + " have."); } return (fbrDns.size() >= currentN); } } }, 25, 50000); } cluster.shutdown(); Assert.assertEquals("", failure.get()); } /** * Start a 2-node cluster with only one block report lease. When the * first datanode gets a lease, kill it. Then wait for the lease to * expire, and the second datanode to send a full block report. */ @Test(timeout=180000) public void testLeaseExpiration() throws Exception { Configuration conf = new Configuration(); conf.setInt(DFS_NAMENODE_MAX_FULL_BLOCK_REPORT_LEASES, 1); conf.setLong(DFS_NAMENODE_FULL_BLOCK_REPORT_LEASE_LENGTH_MS, 100L); final Semaphore gotFbrSem = new Semaphore(0); final AtomicReference<String> failure = new AtomicReference<>(); final AtomicReference<MiniDFSCluster> cluster = new AtomicReference<>(); final AtomicReference<String> datanodeToStop = new AtomicReference<>(); final BlockManagerFaultInjector injector = new BlockManagerFaultInjector() { @Override public void incomingBlockReportRpc(DatanodeID nodeID, BlockReportContext context) throws IOException { if (context.getLeaseId() == 0) { setFailure(failure, "Got unexpected rate-limiting-" + "bypassing full block report RPC from " + nodeID); } if (nodeID.getXferAddr().equals(datanodeToStop.get())) { throw new IOException("Injecting failure into block " + "report RPC for " + nodeID); } gotFbrSem.release(); } @Override public void requestBlockReportLease(DatanodeDescriptor node, long leaseId) { if (leaseId == 0) { return; } datanodeToStop.compareAndSet(null, node.getXferAddr()); } @Override public void removeBlockReportLease(DatanodeDescriptor node, long leaseId) { } }; try { BlockManagerFaultInjector.instance = injector; cluster.set(new MiniDFSCluster.Builder(conf).numDataNodes(2).build()); cluster.get().waitActive(); Assert.assertNotNull(cluster.get().stopDataNode(datanodeToStop.get())); gotFbrSem.acquire(); Assert.assertNull(failure.get()); } finally { if (cluster.get() != null) { cluster.get().shutdown(); } } } }
{ "pile_set_name": "Github" }
/* Copyright (c) 2012 The Chromium Authors. All rights reserved. * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ body.uber-frame { -webkit-margin-start: 155px; color: rgb(48, 57, 66); } html[dir='rtl'] body.uber-frame { /* Enable vertical scrollbar at all times in RTL to avoid visual glitches when * showing sub-pages that vertically overflow. */ overflow-y: scroll; } /* TODO(dbeam): Remove .page class from overlays in settings so the junk below * isn't necessary. */ body.uber-frame #extension-settings.page, body.uber-frame #mainview-content .page, body.uber-frame .subpage-sheet-container .page, body.uber-frame > .page { -webkit-margin-end: 24px; min-width: 576px; padding-bottom: 20px; padding-top: 55px; } body.uber-frame header { background-image: -webkit-linear-gradient(white, white 40%, rgba(255, 255, 255, 0.92)); left: 155px; /* <section>s in options currently amount to 638px total, broken up into * 600px max-width + 18px -webkit-padding-start + 20px -webkit-margin-end * so we mirror this value here so the headers match width and horizontal * alignment when scrolling sideways. */ max-width: 738px; min-width: 600px; position: fixed; right: 0; top: 0; /* list.css sets a z-index of up to 2, this is set to 3 to ensure that the * header is in front of the selected list item. */ z-index: 3; } html[dir='rtl'] body.uber-frame header { left: 0; right: 155px; } body.uber-frame header > .search-field-container, body.uber-frame header > .header-extras, body.uber-frame header > button { position: absolute; right: 20px; top: 21px; } html[dir='rtl'] body.uber-frame header > .search-field-container, html[dir='rtl'] body.uber-frame header > .header-extras, html[dir='rtl'] body.uber-frame header > button { left: 20px; right: auto; } body.uber-frame header input[type='search'], body.uber-frame header input[type='text'], body.uber-frame header button { margin: 0; } body.uber-frame header > h1 { margin: 0; padding: 21px 0 13px; } /* Create a border under the h1 (but before anything that gets appended * to the end of the header). */ body.uber-frame header > h1::after { -webkit-margin-end: 20px; background-color: #eee; content: ' '; display: block; height: 1px; position: relative; top: 13px; } body.uber-frame footer { border-top: 1px solid #eee; margin-top: 16px; /* min-width and max-width should match the header */ max-width: 638px; min-width: 600px; padding: 8px 0; } /* Sections are used in options pages, help page and history page. This defines * the section metrics to match the header metrics above. */ body.uber-frame section { -webkit-padding-start: 18px; margin-bottom: 24px; margin-top: 8px; max-width: 600px; } body.uber-frame section:last-of-type { margin-bottom: 0; } body.uber-frame section > h3 { -webkit-margin-start: -18px; } body.uber-frame section > div:only-of-type { -webkit-box-flex: 1; }
{ "pile_set_name": "Github" }
krb5_copy_keyblock - Copy a keyblock. ======================================= .. .. c:function:: krb5_error_code krb5_copy_keyblock(krb5_context context, const krb5_keyblock * from, krb5_keyblock ** to) .. :param: **[in]** **context** - Library context **[in]** **from** - Keyblock to be copied **[out]** **to** - Copy of keyblock *from* .. :retval: - 0 Success; otherwise - Kerberos error codes .. This function creates a new keyblock with the same contents as *from* . Use :c:func:`krb5_free_keyblock()` to free *to* when it is no longer needed. ..
{ "pile_set_name": "Github" }
%YAML 1.1 %TAG !u! tag:unity3d.com,2011: --- !u!21 &2100000 Material: serializedVersion: 6 m_ObjectHideFlags: 0 m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 0} m_Name: Particle m_Shader: {fileID: 10721, guid: 0000000000000000f000000000000000, type: 0} m_ShaderKeywords: _EMISSION m_LightmapFlags: 1 m_CustomRenderQueue: 3000 stringTagMap: {} m_SavedProperties: serializedVersion: 2 m_TexEnvs: - first: name: _BumpMap second: m_Texture: {fileID: 0} m_Scale: {x: 1, y: 1} m_Offset: {x: 0, y: 0} - first: name: _DetailAlbedoMap second: m_Texture: {fileID: 0} m_Scale: {x: 1, y: 1} m_Offset: {x: 0, y: 0} - first: name: _DetailMask second: m_Texture: {fileID: 0} m_Scale: {x: 1, y: 1} m_Offset: {x: 0, y: 0} - first: name: _DetailNormalMap second: m_Texture: {fileID: 0} m_Scale: {x: 1, y: 1} m_Offset: {x: 0, y: 0} - first: name: _EmissionMap second: m_Texture: {fileID: 0} m_Scale: {x: 1, y: 1} m_Offset: {x: 0, y: 0} - first: name: _MainTex second: m_Texture: {fileID: 2800000, guid: 097cd0846b8b8724fbca87a4ead287da, type: 3} m_Scale: {x: 1, y: 1} m_Offset: {x: 0, y: 0} - first: name: _MetallicGlossMap second: m_Texture: {fileID: 0} m_Scale: {x: 1, y: 1} m_Offset: {x: 0, y: 0} - first: name: _OcclusionMap second: m_Texture: {fileID: 0} m_Scale: {x: 1, y: 1} m_Offset: {x: 0, y: 0} - first: name: _ParallaxMap second: m_Texture: {fileID: 0} m_Scale: {x: 1, y: 1} m_Offset: {x: 0, y: 0} m_Floats: - first: name: _BumpScale second: 1 - first: name: _Cutoff second: 0.5 - first: name: _DetailNormalMapScale second: 1 - first: name: _DstBlend second: 0 - first: name: _GlossMapScale second: 1 - first: name: _Glossiness second: 0.5 - first: name: _GlossyReflections second: 1 - first: name: _Metallic second: 0 - first: name: _Mode second: 0 - first: name: _OcclusionStrength second: 1 - first: name: _Parallax second: 0.02 - first: name: _SmoothnessTextureChannel second: 0 - first: name: _SpecularHighlights second: 1 - first: name: _SrcBlend second: 1 - first: name: _UVSec second: 0 - first: name: _ZWrite second: 1 m_Colors: - first: name: _Color second: {r: 1, g: 1, b: 1, a: 1} - first: name: _EmissionColor second: {r: 0, g: 0, b: 0, a: 1}
{ "pile_set_name": "Github" }
/* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 3.0 */ package org.commoncrawl.rpc.compiler.generated; public class TokenMgrError extends Error { /* * Ordinals for various reasons why an Error of this type can be thrown. */ /** * Lexical error occured. */ static final int LEXICAL_ERROR = 0; /** * An attempt wass made to create a second instance of a static token manager. */ static final int STATIC_LEXER_ERROR = 1; /** * Tried to change to an invalid lexical state. */ static final int INVALID_LEXICAL_STATE = 2; /** * Detected (and bailed out of) an infinite loop in the token manager. */ static final int LOOP_DETECTED = 3; /** * Indicates the reason why the exception is thrown. It will have * one of the above 4 values. */ int errorCode; /** * Replaces unprintable characters by their espaced (or unicode escaped) * equivalents in the given string */ protected static final String addEscapes(String str) { StringBuffer retval = new StringBuffer(); char ch; for (int i = 0; i < str.length(); i++) { switch (str.charAt(i)) { case 0 : continue; case '\b': retval.append("\\b"); continue; case '\t': retval.append("\\t"); continue; case '\n': retval.append("\\n"); continue; case '\f': retval.append("\\f"); continue; case '\r': retval.append("\\r"); continue; case '\"': retval.append("\\\""); continue; case '\'': retval.append("\\\'"); continue; case '\\': retval.append("\\\\"); continue; default: if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) { String s = "0000" + Integer.toString(ch, 16); retval.append("\\u" + s.substring(s.length() - 4, s.length())); } else { retval.append(ch); } continue; } } return retval.toString(); } /** * Returns a detailed message for the Error when it is thrown by the * token manager to indicate a lexical error. * Parameters : * EOFSeen : indicates if EOF caused the lexicl error * curLexState : lexical state in which this error occured * errorLine : line number when the error occured * errorColumn : column number when the error occured * errorAfter : prefix that was seen before this error occured * curchar : the offending character * Note: You can customize the lexical error message by modifying this method. */ protected static String LexicalError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar) { return("Lexical error at line " + errorLine + ", column " + errorColumn + ". Encountered: " + (EOFSeen ? "<EOF> " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + (int)curChar + "), ") + "after : \"" + addEscapes(errorAfter) + "\""); } /** * You can also modify the body of this method to customize your error messages. * For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE are not * of end-users concern, so you can return something like : * * "Internal Error : Please file a bug report .... " * * from this method for such cases in the release version of your parser. */ public String getMessage() { return super.getMessage(); } /* * Constructors of various flavors follow. */ public TokenMgrError() { } public TokenMgrError(String message, int reason) { super(message); errorCode = reason; } public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar, int reason) { this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason); } }
{ "pile_set_name": "Github" }
/* eslint max-len: 0 */ import React from 'react'; import { BootstrapTable, TableHeaderColumn } from 'react-bootstrap-table'; const products = []; function addProducts(quantity) { const startId = products.length; for (let i = 0; i < quantity; i++) { const id = startId + i; if (i < 3) { products.push({ id: id, name: 'Item name ' + id, price: 2100 + i, expand: [ { fieldA: 'test1', fieldB: (i + 1) * 99, fieldC: (i + 1) * Math.random() * 100, fieldD: '123eedd' + i }, { fieldA: 'test2', fieldB: i * 99, fieldC: i * Math.random() * 100, fieldD: '123eedd' + i } ] }); } else { products.push({ id: id, name: 'Item name ' + id, price: 2100 + i }); } } } addProducts(5); class BSTable extends React.Component { render() { if (this.props.data) { return ( <BootstrapTable data={ this.props.data }> <TableHeaderColumn dataField='fieldA' isKey={ true }>Field A</TableHeaderColumn> <TableHeaderColumn dataField='fieldB'>Field B</TableHeaderColumn> <TableHeaderColumn dataField='fieldC'>Field C</TableHeaderColumn> <TableHeaderColumn dataField='fieldD'>Field D</TableHeaderColumn> </BootstrapTable>); } else { return (<p>?</p>); } } } export default class ExpandRow extends React.Component { constructor(props) { super(props); } isExpandableRow(row) { if (row.id < 3) return true; else return false; } expandComponent(row) { return ( <BSTable data={ row.expand } /> ); } render() { const options = { expandRowBgColor: 'rgb(242, 255, 163)', expandBy: 'column' // Currently, available value is row and column, default is row }; return ( <BootstrapTable data={ products } options={ options } expandableRow={ this.isExpandableRow } expandComponent={ this.expandComponent } search> <TableHeaderColumn dataField='id' isKey={ true }>Product ID</TableHeaderColumn> <TableHeaderColumn dataField='name' expandable={ false }>Product Name</TableHeaderColumn> <TableHeaderColumn dataField='price' expandable={ false }>Product Price</TableHeaderColumn> </BootstrapTable> ); } }
{ "pile_set_name": "Github" }
module.exports = { detect: function() { return !!process.env.CIRCLECI }, configuration: function() { console.log(' Circle CI Detected') return { service: 'circleci', build: process.env.CIRCLE_BUILD_NUM + '.' + process.env.CIRCLE_NODE_INDEX, job: process.env.CIRCLE_BUILD_NUM + '.' + process.env.CIRCLE_NODE_INDEX, commit: process.env.CIRCLE_SHA1, branch: process.env.CIRCLE_BRANCH, pr: process.env.CIRCLE_PR_NUMBER, slug: detectRepoSlug(), } function detectRepoSlug() { if (process.env.CIRCLE_PROJECT_REPONAME) { // CircleCI 1.0 // CIRCLE_PROJECT_REPONAME=codecov // CIRCLE_PROJECT_USERNAME=codecov-node // CIRCLE_REPOSITORY_URL=https://github.com/codecov/codecov-node (note: GitHub Web URL) return ( process.env.CIRCLE_PROJECT_USERNAME + '/' + process.env.CIRCLE_PROJECT_REPONAME ) } if (process.env.CIRCLE_REPOSITORY_URL) { // CircleCI 2.0 // CIRCLE_REPOSITORY_URL=git@github.com:codecov/codecov-node.git (note: Git/SSH URL) return process.env.CIRCLE_REPOSITORY_URL.replace(/^.*:/, '').replace( /\.git$/, '' ) } throw new Error('Cannot detect repository slug.') } }, }
{ "pile_set_name": "Github" }
/****************************************************************************** * $Id: depth.h, v1.0 2010/08/30 SethDart Exp $ * * Project: OpenCPN * Purpose: Dashboard Plugin * Author: Jean-Eudes Onfray * *************************************************************************** * Copyright (C) 2010 by David S. Register * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * *************************************************************************** */ #ifndef __DEPTH_H__ #define __DEPTH_H__ // For compilers that support precompilation, includes "wx/wx.h". #include <wx/wxprec.h> #ifdef __BORLANDC__ #pragma hdrstop #endif // for all others, include the necessary headers (this file is usually all you // need because it includes almost all "standard" wxWidgets headers) #ifndef WX_PRECOMP #include <wx/wx.h> #endif // Warn: div by 0 if count == 1 #define DEPTH_RECORD_COUNT 30 #include "instrument.h" class DashboardInstrument_Depth: public DashboardInstrument { public: DashboardInstrument_Depth( wxWindow *parent, wxWindowID id, wxString title); ~DashboardInstrument_Depth(void){} wxSize GetSize( int orient, wxSize hint ); void SetData(int, double, wxString); private: protected: double m_ArrayDepth[DEPTH_RECORD_COUNT]; double m_MaxDepth; double m_Depth; wxString m_DepthUnit; wxString m_Temp; void Draw(wxGCDC* dc); void DrawBackground(wxGCDC* dc); void DrawForeground(wxGCDC* dc); }; #endif // __DEPTH_H__
{ "pile_set_name": "Github" }
--- - name: "waiting on each job id" async_status_custom: jid: "{{ os_heat_group['ansible_job_id'] }}" register: job_result until: job_result.finished retries: "{{ async_retries | default(60) }}" - name: "Append outputitem to topology_outputs" set_fact: topology_outputs_os_heat: "{{ topology_outputs_os_heat + [job_result] }}"
{ "pile_set_name": "Github" }
#ifndef LIBTCC_H #define LIBTCC_H #ifndef LIBTCCAPI # define LIBTCCAPI #endif #ifdef __cplusplus extern "C" { #endif struct TCCState; typedef struct TCCState TCCState; typedef void (*TCCErrorFunc)(void *opaque, const char *msg); /* create a new TCC compilation context */ LIBTCCAPI TCCState *tcc_new(void); /* free a TCC compilation context */ LIBTCCAPI void tcc_delete(TCCState *s); /* set CONFIG_TCCDIR at runtime */ LIBTCCAPI void tcc_set_lib_path(TCCState *s, const char *path); /* set error/warning display callback */ LIBTCCAPI void tcc_set_error_func(TCCState *s, void *error_opaque, TCCErrorFunc error_func); /* return error/warning callback */ LIBTCCAPI TCCErrorFunc tcc_get_error_func(TCCState *s); /* return error/warning callback opaque pointer */ LIBTCCAPI void *tcc_get_error_opaque(TCCState *s); /* set options as from command line (multiple supported) */ LIBTCCAPI void tcc_set_options(TCCState *s, const char *str); /*****************************/ /* preprocessor */ /* add include path */ LIBTCCAPI int tcc_add_include_path(TCCState *s, const char *pathname); /* add in system include path */ LIBTCCAPI int tcc_add_sysinclude_path(TCCState *s, const char *pathname); /* define preprocessor symbol 'sym'. value can be NULL, sym can be "sym=val" */ LIBTCCAPI void tcc_define_symbol(TCCState *s, const char *sym, const char *value); /* undefine preprocess symbol 'sym' */ LIBTCCAPI void tcc_undefine_symbol(TCCState *s, const char *sym); /*****************************/ /* compiling */ /* add a file (C file, dll, object, library, ld script). Return -1 if error. */ LIBTCCAPI int tcc_add_file(TCCState *s, const char *filename); /* compile a string containing a C source. Return -1 if error. */ LIBTCCAPI int tcc_compile_string(TCCState *s, const char *buf); /*****************************/ /* linking commands */ /* set output type. MUST BE CALLED before any compilation */ LIBTCCAPI int tcc_set_output_type(TCCState *s, int output_type); #define TCC_OUTPUT_MEMORY 1 /* output will be run in memory (default) */ #define TCC_OUTPUT_EXE 2 /* executable file */ #define TCC_OUTPUT_DLL 3 /* dynamic library */ #define TCC_OUTPUT_OBJ 4 /* object file */ #define TCC_OUTPUT_PREPROCESS 5 /* only preprocess (used internally) */ /* equivalent to -Lpath option */ LIBTCCAPI int tcc_add_library_path(TCCState *s, const char *pathname); /* the library name is the same as the argument of the '-l' option */ LIBTCCAPI int tcc_add_library(TCCState *s, const char *libraryname); /* add a symbol to the compiled program */ LIBTCCAPI int tcc_add_symbol(TCCState *s, const char *name, const void *val); /* output an executable, library or object file. DO NOT call tcc_relocate() before. */ LIBTCCAPI int tcc_output_file(TCCState *s, const char *filename); /* link and run main() function and return its value. DO NOT call tcc_relocate() before. */ LIBTCCAPI int tcc_run(TCCState *s, int argc, char **argv); /* do all relocations (needed before using tcc_get_symbol()) */ LIBTCCAPI int tcc_relocate(TCCState *s1, void *ptr); /* possible values for 'ptr': - TCC_RELOCATE_AUTO : Allocate and manage memory internally - NULL : return required memory size for the step below - memory address : copy code to memory passed by the caller returns -1 if error. */ #define TCC_RELOCATE_AUTO (void*)1 /* return symbol value or NULL if not found */ LIBTCCAPI void *tcc_get_symbol(TCCState *s, const char *name); /* return symbol value or NULL if not found */ LIBTCCAPI void tcc_list_symbols(TCCState *s, void *ctx, void (*symbol_cb)(void *ctx, const char *name, const void *val)); #ifdef __cplusplus } #endif #endif
{ "pile_set_name": "Github" }
# 图片预加载 浏览前预加载图片,使用jquery封装插件,其中有三个实例展示。 - 图片无序预加载,翻页展示,loading显示百分比进度 - qq表情无序预加载,打开展示,显示loading - 漫画有序预加载,翻页展示 ### 初始化代码 ``` bash function PreLoad(imgs, options) { this.imgs = (typeof imgs === 'string') ? [imgs] : imgs; this.opts = $.extend({}, PreLoad.DEFAULTS, options); //合并default值和参数 if [[ this.opts.order === "ordered" ]]; then this._ordered(); //有序预加载 fi else this._unordered(); //无序预加载 } PreLoad.DEFAULTS = { order: 'unordered', //无序预加载 each: null, //每张图片加载完毕后执行 all: null //所有图片加载完后执行 }; ``` ### 无序预加载代码 ``` bash PreLoad.prototype._unordered = function(){ var imgs = this.imgs, opts = this.opts, count = 0, len = imgs.length; $.each(imgs, function(i, src) { if [[ typeof src != 'string' ]]; then return; fi var imgObj = new Image(); $(imgObj).on('load error', function(e) { opts.each && opts.each(count); if [[ count >= len - 1 ]]; then opts.all && opts.all(); fi count++; }) imgObj.src = src; }); }; ``` ### 有序预加载代码 ``` bash PreLoad.prototype._ordered = function() { var opts = this.opts, imgs = this.imgs, len = imgs.length, count = 0; load(); function load() { var imgObj = new Image(); $(imgObj).on('load error', function(e) { opts.each && opts.each(count); if [[ count >= len ]]; then //所有图片已经加载完毕 opts.all && opts.all(); fi else load(); count++; }); imgObj.src = imgs[count]; } } ``` ### 扩展方法 ``` bash $.extend({ preload: function(imgs, opts) { new PreLoad(imgs, opts); } }); ``` ### 调用 ``` bash $.preload(imgs,{ order: '', each: function(count) { }, all: function() { } }) }); ```
{ "pile_set_name": "Github" }
/* Copyright IBM Corp. 2016 All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ package dockercontroller import ( "archive/tar" "bytes" "compress/gzip" "context" "encoding/hex" "errors" "fmt" "io" "os" "testing" "time" "github.com/fsouza/go-dockerclient" "github.com/spf13/viper" "github.com/stretchr/testify/assert" "github.com/inklabsfoundation/inkchain/common/ledger/testutil" "github.com/inklabsfoundation/inkchain/common/util" "github.com/inklabsfoundation/inkchain/core/chaincode/platforms" "github.com/inklabsfoundation/inkchain/core/container/ccintf" coreutil "github.com/inklabsfoundation/inkchain/core/testutil" pb "github.com/inklabsfoundation/inkchain/protos/peer" ) func TestHostConfig(t *testing.T) { coreutil.SetupTestConfig() var hostConfig = new(docker.HostConfig) err := viper.UnmarshalKey("vm.docker.hostConfig", hostConfig) if err != nil { t.Fatalf("Load docker HostConfig wrong, error: %s", err.Error()) } testutil.AssertNotEquals(t, hostConfig.LogConfig, nil) testutil.AssertEquals(t, hostConfig.LogConfig.Type, "json-file") testutil.AssertEquals(t, hostConfig.LogConfig.Config["max-size"], "50m") testutil.AssertEquals(t, hostConfig.LogConfig.Config["max-file"], "5") } func TestGetDockerHostConfig(t *testing.T) { os.Setenv("CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE", "overlay") os.Setenv("CORE_VM_DOCKER_HOSTCONFIG_CPUSHARES", fmt.Sprint(1024*1024*1024*2)) coreutil.SetupTestConfig() hostConfig := getDockerHostConfig() testutil.AssertNotNil(t, hostConfig) testutil.AssertEquals(t, hostConfig.NetworkMode, "overlay") testutil.AssertEquals(t, hostConfig.LogConfig.Type, "json-file") testutil.AssertEquals(t, hostConfig.LogConfig.Config["max-size"], "50m") testutil.AssertEquals(t, hostConfig.LogConfig.Config["max-file"], "5") testutil.AssertEquals(t, hostConfig.Memory, int64(1024*1024*1024*2)) testutil.AssertEquals(t, hostConfig.CPUShares, int64(1024*1024*1024*2)) } func Test_Deploy(t *testing.T) { dvm := DockerVM{} ccid := ccintf.CCID{ChaincodeSpec: &pb.ChaincodeSpec{ChaincodeId: &pb.ChaincodeID{Name: "simple"}}} //get the tarball for codechain tarRdr := getCodeChainBytesInMem() args := make([]string, 1) env := make([]string, 1) ctx := context.Background() // getMockClient returns error getClientErr = true dvm.getClientFnc = getMockClient err := dvm.Deploy(ctx, ccid, args, env, tarRdr) testerr(t, err, false) getClientErr = false // Failure case: dockerClient.BuildImage returns error buildErr = true dvm.getClientFnc = getMockClient err = dvm.Deploy(ctx, ccid, args, env, tarRdr) testerr(t, err, false) buildErr = false // Success case err = dvm.Deploy(ctx, ccid, args, env, tarRdr) testerr(t, err, true) } func Test_Start(t *testing.T) { dvm := DockerVM{} ccid := ccintf.CCID{ChaincodeSpec: &pb.ChaincodeSpec{ChaincodeId: &pb.ChaincodeID{Name: "simple"}}} args := make([]string, 1) env := make([]string, 1) ctx := context.Background() // Failure cases // case 1: getMockClient returns error dvm.getClientFnc = getMockClient getClientErr = true err := dvm.Start(ctx, ccid, args, env, nil, nil) testerr(t, err, false) getClientErr = false // case 2: dockerClient.CreateContainer returns error createErr = true err = dvm.Start(ctx, ccid, args, env, nil, nil) testerr(t, err, false) createErr = false // case 3: dockerClient.CreateContainer returns docker.noSuchImgErr noSuchImgErr = true err = dvm.Start(ctx, ccid, args, env, nil, nil) testerr(t, err, false) chaincodePath := "github.com/inklabsfoundation/inkchain/examples/chaincode/go/chaincode_example01" spec := &pb.ChaincodeSpec{Type: pb.ChaincodeSpec_GOLANG, ChaincodeId: &pb.ChaincodeID{Name: "ex01", Path: chaincodePath}, Input: &pb.ChaincodeInput{Args: util.ToChaincodeArgs("f")}} codePackage, err := platforms.GetDeploymentPayload(spec) if err != nil { t.Fatal() } cds := &pb.ChaincodeDeploymentSpec{ChaincodeSpec: spec, CodePackage: codePackage} bldr := func() (io.Reader, error) { return platforms.GenerateDockerBuild(cds) } // case 4: start called with builder and dockerClient.CreateContainer returns // docker.noSuchImgErr and dockerClient.Start returns error viper.Set("vm.docker.attachStdout", true) startErr = true err = dvm.Start(ctx, ccid, args, env, bldr, nil) testerr(t, err, false) startErr = false // Success cases err = dvm.Start(ctx, ccid, args, env, bldr, nil) testerr(t, err, true) noSuchImgErr = false // dockerClient.StopContainer returns error stopErr = true err = dvm.Start(ctx, ccid, args, env, nil, nil) testerr(t, err, true) stopErr = false // dockerClient.KillContainer returns error killErr = true err = dvm.Start(ctx, ccid, args, env, nil, nil) testerr(t, err, true) killErr = false // dockerClient.RemoveContainer returns error removeErr = true err = dvm.Start(ctx, ccid, args, env, nil, nil) testerr(t, err, true) removeErr = false err = dvm.Start(ctx, ccid, args, env, nil, nil) testerr(t, err, true) //test preLaunchFunc works correctly preLaunchStr := "notset" preLaunchFunc := func() error { preLaunchStr = "set" return nil } err = dvm.Start(ctx, ccid, args, env, nil, preLaunchFunc) testerr(t, err, true) assert.Equal(t, preLaunchStr, "set") preLaunchFunc = func() error { return fmt.Errorf("testing error path") } err = dvm.Start(ctx, ccid, args, env, nil, preLaunchFunc) testerr(t, err, false) } func Test_Stop(t *testing.T) { dvm := DockerVM{} ccid := ccintf.CCID{ChaincodeSpec: &pb.ChaincodeSpec{ChaincodeId: &pb.ChaincodeID{Name: "simple"}}} ctx := context.Background() // Failure case: getMockClient returns error getClientErr = true dvm.getClientFnc = getMockClient err := dvm.Stop(ctx, ccid, 10, true, true) testerr(t, err, false) getClientErr = false // Success case err = dvm.Stop(ctx, ccid, 10, true, true) testerr(t, err, true) } func Test_Destroy(t *testing.T) { dvm := DockerVM{} ccid := ccintf.CCID{ChaincodeSpec: &pb.ChaincodeSpec{ChaincodeId: &pb.ChaincodeID{Name: "simple"}}} ctx := context.Background() // Failure cases // Case 1: getMockClient returns error getClientErr = true dvm.getClientFnc = getMockClient err := dvm.Destroy(ctx, ccid, true, true) testerr(t, err, false) getClientErr = false // Case 2: dockerClient.RemoveImageExtended returns error removeImgErr = true err = dvm.Destroy(ctx, ccid, true, true) testerr(t, err, false) removeImgErr = false // Success case err = dvm.Destroy(ctx, ccid, true, true) testerr(t, err, true) } type testCase struct { name string ccid ccintf.CCID formatFunc func(string) (string, error) expectedOutput string } func TestGetVMName(t *testing.T) { dvm := DockerVM{} var tc []testCase tc = append(tc, testCase{"mycc", ccintf.CCID{ChaincodeSpec: &pb.ChaincodeSpec{ChaincodeId: &pb.ChaincodeID{Name: "mycc"}}, NetworkID: "dev", PeerID: "peer0", Version: "1.0"}, formatImageName, fmt.Sprintf("%s-%s", "dev-peer0-mycc-1.0", hex.EncodeToString(util.ComputeSHA256([]byte("dev-peer0-mycc-1.0"))))}, testCase{"mycc-nonetworkid", ccintf.CCID{ChaincodeSpec: &pb.ChaincodeSpec{ChaincodeId: &pb.ChaincodeID{Name: "mycc"}}, PeerID: "peer1", Version: "1.0"}, formatImageName, fmt.Sprintf("%s-%s", "peer1-mycc-1.0", hex.EncodeToString(util.ComputeSHA256([]byte("peer1-mycc-1.0"))))}, testCase{"myCC", ccintf.CCID{ChaincodeSpec: &pb.ChaincodeSpec{ChaincodeId: &pb.ChaincodeID{Name: "myCC"}}, NetworkID: "Dev", PeerID: "Peer0", Version: "1.0"}, formatImageName, fmt.Sprintf("%s-%s", "dev-peer0-mycc-1.0", hex.EncodeToString(util.ComputeSHA256([]byte("Dev-Peer0-myCC-1.0"))))}, testCase{"mycc-nopeerid", ccintf.CCID{ChaincodeSpec: &pb.ChaincodeSpec{ChaincodeId: &pb.ChaincodeID{Name: "mycc"}}, NetworkID: "dev", Version: "1.0"}, formatImageName, fmt.Sprintf("%s-%s", "dev-mycc-1.0", hex.EncodeToString(util.ComputeSHA256([]byte("dev-mycc-1.0"))))}, testCase{"myCC", ccintf.CCID{ChaincodeSpec: &pb.ChaincodeSpec{ChaincodeId: &pb.ChaincodeID{Name: "myCC"}}, NetworkID: "dev", PeerID: "peer0", Version: "1.0"}, formatImageName, fmt.Sprintf("%s-%s", "dev-peer0-mycc-1.0", hex.EncodeToString(util.ComputeSHA256([]byte("dev-peer0-myCC-1.0"))))}, testCase{"myCC-preserveCase", ccintf.CCID{ChaincodeSpec: &pb.ChaincodeSpec{ChaincodeId: &pb.ChaincodeID{Name: "myCC"}}, NetworkID: "Dev", PeerID: "Peer0", Version: "1.0"}, nil, fmt.Sprintf("%s", "Dev-Peer0-myCC-1.0")}, testCase{"invalidCharsFormatFunction", ccintf.CCID{ChaincodeSpec: &pb.ChaincodeSpec{ChaincodeId: &pb.ChaincodeID{Name: "myCC"}}, NetworkID: "Dev", PeerID: "Peer0", Version: "1.0"}, formatInvalidChars, fmt.Sprintf("%s", "inv-lid-character--")}) for _, test := range tc { name, err := dvm.GetVMName(test.ccid, test.formatFunc) assert.Nil(t, err, "Expected nil error") assert.Equal(t, test.expectedOutput, name, "Unexpected output for test case name: %s", test.name) } } func TestFormatImageName_invalidChars(t *testing.T) { _, err := formatImageName("invalid*chars") assert.NotNil(t, err, "Expected error") } func getCodeChainBytesInMem() io.Reader { startTime := time.Now() inputbuf := bytes.NewBuffer(nil) gw := gzip.NewWriter(inputbuf) tr := tar.NewWriter(gw) dockerFileContents := []byte("FROM busybox:latest\n\nCMD echo hello") dockerFileSize := int64(len([]byte(dockerFileContents))) tr.WriteHeader(&tar.Header{Name: "Dockerfile", Size: dockerFileSize, ModTime: startTime, AccessTime: startTime, ChangeTime: startTime}) tr.Write([]byte(dockerFileContents)) tr.Close() gw.Close() return inputbuf } func testerr(t *testing.T, err error, succ bool) { if succ { assert.NoError(t, err, "Expected success but got error") } else { assert.Error(t, err, "Expected failure but succeeded") } } func getMockClient() (dockerClient, error) { if getClientErr { return nil, errors.New("Failed to get client") } return &mockClient{noSuchImgErrReturned: false}, nil } type mockClient struct { noSuchImgErrReturned bool } var getClientErr, createErr, noSuchImgErr, buildErr, removeImgErr, startErr, stopErr, killErr, removeErr bool func (c *mockClient) CreateContainer(options docker.CreateContainerOptions) (*docker.Container, error) { if createErr { return nil, errors.New("Error creating the container") } else if noSuchImgErr && !c.noSuchImgErrReturned { c.noSuchImgErrReturned = true return nil, docker.ErrNoSuchImage } return &docker.Container{}, nil } func (c *mockClient) StartContainer(id string, cfg *docker.HostConfig) error { if startErr { return errors.New("Error starting the container") } return nil } func (c *mockClient) AttachToContainer(opts docker.AttachToContainerOptions) error { if opts.Success != nil { opts.Success <- struct{}{} } return nil } func (c *mockClient) BuildImage(opts docker.BuildImageOptions) error { if buildErr { return errors.New("Error building image") } return nil } func (c *mockClient) RemoveImageExtended(id string, opts docker.RemoveImageOptions) error { if removeImgErr { return errors.New("Error removing extended image") } return nil } func (c *mockClient) StopContainer(id string, timeout uint) error { if stopErr { return errors.New("Error stopping container") } return nil } func (c *mockClient) KillContainer(opts docker.KillContainerOptions) error { if killErr { return errors.New("Error killing container") } return nil } func (c *mockClient) RemoveContainer(opts docker.RemoveContainerOptions) error { if removeErr { return errors.New("Error removing container") } return nil } func formatInvalidChars(name string) (string, error) { return "inv@lid*character$/", nil }
{ "pile_set_name": "Github" }
module.exports = { request:[ ['StructureSize', 2, 57] , ['SecurityFlags', 1, 0] , ['RequestedOplockLevel', 1, 0] , ['ImpersonationLevel', 4, 0x00000002] , ['SmbCreateFlags', 8, 0] , ['Reserved', 8, 0] , ['DesiredAccess', 4, 0x00100081] , ['FileAttributes', 4, 0x00000000] , ['ShareAccess', 4, 0x00000007] , ['CreateDisposition', 4, 0x00000001] , ['CreateOptions', 4, 0x00000020] , ['NameOffset', 2] , ['NameLength', 2] , ['CreateContextsOffset', 4] , ['CreateContextsLength', 4] , ['Buffer', 'NameLength'] , ['Reserved2', 2, 0x4200] , ['CreateContexts', 'CreateContextsLength', ''] ] , response:[ ['StructureSize', 2] , ['OplockLevel', 1] , ['Flags', 1] , ['CreateAction', 4] , ['CreationTime', 8] , ['LastAccessTime', 8] , ['LastWriteTime', 8] , ['ChangeTime', 8] , ['AllocationSize', 8] , ['EndofFile', 8] , ['FileAttributes', 4] , ['Reserved2', 4] , ['FileId', 16] , ['CreateContextsOffset', 4] , ['CreateContextsLength', 4] , ['Buffer', 'CreateContextsLength'] ] }
{ "pile_set_name": "Github" }
#version 430 in vec3 position_FS; in vec2 texCoord_FS; layout(location = 0) out vec4 albedo_out; layout(location = 1) out vec4 worldPosition_out; layout(location = 2) out vec4 normal_out; layout(location = 3) out vec4 specularEmission_out; layout(location = 4) out vec4 lightScattering_out; struct Material { sampler2D diffusemap; }; layout (std140, row_major) uniform Camera{ vec3 eyePosition; mat4 m_View; mat4 viewProjectionMatrix; vec4 frustumPlanes[6]; }; uniform Material material; uniform int isReflection; uniform int isRefraction; uniform int range = 700; uniform float alphaDiscardThreshold = 0.5; float alphaDistanceFactor(float dist) { return 0.01f * (dist-range); } void main() { float dist = length(eyePosition - position_FS); vec4 albedo = texture(material.diffusemap, texCoord_FS).rgba; float alpha = albedo.a; if (alpha < alphaDiscardThreshold) discard; if (isReflection == 0 && isRefraction == 0){ alpha *= alphaDistanceFactor(dist); } albedo_out = vec4(albedo.rgb,alpha); worldPosition_out = vec4(position_FS,1); normal_out = vec4(0,0,1,1); specularEmission_out = vec4(1,0,0,1); lightScattering_out = vec4(0,0,0,1); }
{ "pile_set_name": "Github" }
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>netcoreapp2.2</TargetFramework> <LangVersion>latest</LangVersion> <Nullable>enable</Nullable> </PropertyGroup> <ItemGroup> <ProjectReference Include="..\Chinook.Domain\Chinook.Domain.csproj" /> </ItemGroup> <ItemGroup> <Compile Remove="DataModels\**" /> </ItemGroup> <ItemGroup> <EmbeddedResource Remove="DataModels\**" /> </ItemGroup> <ItemGroup> <None Remove="DataModels\**" /> </ItemGroup> <ItemGroup> <PackageReference Include="Microsoft.EntityFrameworkCore.Abstractions" Version="2.2.6" /> <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.2.6" /> <PackageReference Include="Microsoft.Extensions.Logging" Version="2.2.0" /> </ItemGroup> <ItemGroup> <Folder Include="Configurations" /> <Folder Include="Repositories" /> </ItemGroup> </Project>
{ "pile_set_name": "Github" }
// Copyright 2014 The oauth2 Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Package oauth2 provides support for making // OAuth2 authorized and authenticated HTTP requests. // It can additionally grant authorization with Bearer JWT. package oauth2 import ( "bytes" "errors" "net/http" "net/url" "strings" "sync" "golang.org/x/net/context" "golang.org/x/oauth2/internal" ) // NoContext is the default context you should supply if not using // your own context.Context (see https://golang.org/x/net/context). var NoContext = context.TODO() // Config describes a typical 3-legged OAuth2 flow, with both the // client application information and the server's endpoint URLs. type Config struct { // ClientID is the application's ID. ClientID string // ClientSecret is the application's secret. ClientSecret string // Endpoint contains the resource server's token endpoint // URLs. These are constants specific to each server and are // often available via site-specific packages, such as // google.Endpoint or github.Endpoint. Endpoint Endpoint // RedirectURL is the URL to redirect users going through // the OAuth flow, after the resource owner's URLs. RedirectURL string // Scope specifies optional requested permissions. Scopes []string } // A TokenSource is anything that can return a token. type TokenSource interface { // Token returns a token or an error. // Token must be safe for concurrent use by multiple goroutines. // The returned Token must not be modified. Token() (*Token, error) } // Endpoint contains the OAuth 2.0 provider's authorization and token // endpoint URLs. type Endpoint struct { AuthURL string TokenURL string } var ( // AccessTypeOnline and AccessTypeOffline are options passed // to the Options.AuthCodeURL method. They modify the // "access_type" field that gets sent in the URL returned by // AuthCodeURL. // // Online is the default if neither is specified. If your // application needs to refresh access tokens when the user // is not present at the browser, then use offline. This will // result in your application obtaining a refresh token the // first time your application exchanges an authorization // code for a user. AccessTypeOnline AuthCodeOption = SetAuthURLParam("access_type", "online") AccessTypeOffline AuthCodeOption = SetAuthURLParam("access_type", "offline") // ApprovalForce forces the users to view the consent dialog // and confirm the permissions request at the URL returned // from AuthCodeURL, even if they've already done so. ApprovalForce AuthCodeOption = SetAuthURLParam("approval_prompt", "force") ) // An AuthCodeOption is passed to Config.AuthCodeURL. type AuthCodeOption interface { setValue(url.Values) } type setParam struct{ k, v string } func (p setParam) setValue(m url.Values) { m.Set(p.k, p.v) } // SetAuthURLParam builds an AuthCodeOption which passes key/value parameters // to a provider's authorization endpoint. func SetAuthURLParam(key, value string) AuthCodeOption { return setParam{key, value} } // AuthCodeURL returns a URL to OAuth 2.0 provider's consent page // that asks for permissions for the required scopes explicitly. // // State is a token to protect the user from CSRF attacks. You must // always provide a non-zero string and validate that it matches the // the state query parameter on your redirect callback. // See http://tools.ietf.org/html/rfc6749#section-10.12 for more info. // // Opts may include AccessTypeOnline or AccessTypeOffline, as well // as ApprovalForce. func (c *Config) AuthCodeURL(state string, opts ...AuthCodeOption) string { var buf bytes.Buffer buf.WriteString(c.Endpoint.AuthURL) v := url.Values{ "response_type": {"code"}, "client_id": {c.ClientID}, "redirect_uri": internal.CondVal(c.RedirectURL), "scope": internal.CondVal(strings.Join(c.Scopes, " ")), "state": internal.CondVal(state), } for _, opt := range opts { opt.setValue(v) } if strings.Contains(c.Endpoint.AuthURL, "?") { buf.WriteByte('&') } else { buf.WriteByte('?') } buf.WriteString(v.Encode()) return buf.String() } // PasswordCredentialsToken converts a resource owner username and password // pair into a token. // // Per the RFC, this grant type should only be used "when there is a high // degree of trust between the resource owner and the client (e.g., the client // is part of the device operating system or a highly privileged application), // and when other authorization grant types are not available." // See https://tools.ietf.org/html/rfc6749#section-4.3 for more info. // // The HTTP client to use is derived from the context. // If nil, http.DefaultClient is used. func (c *Config) PasswordCredentialsToken(ctx context.Context, username, password string) (*Token, error) { return retrieveToken(ctx, c, url.Values{ "grant_type": {"password"}, "username": {username}, "password": {password}, "scope": internal.CondVal(strings.Join(c.Scopes, " ")), }) } // Exchange converts an authorization code into a token. // // It is used after a resource provider redirects the user back // to the Redirect URI (the URL obtained from AuthCodeURL). // // The HTTP client to use is derived from the context. // If a client is not provided via the context, http.DefaultClient is used. // // The code will be in the *http.Request.FormValue("code"). Before // calling Exchange, be sure to validate FormValue("state"). func (c *Config) Exchange(ctx context.Context, code string) (*Token, error) { return retrieveToken(ctx, c, url.Values{ "grant_type": {"authorization_code"}, "code": {code}, "redirect_uri": internal.CondVal(c.RedirectURL), "scope": internal.CondVal(strings.Join(c.Scopes, " ")), }) } // Client returns an HTTP client using the provided token. // The token will auto-refresh as necessary. The underlying // HTTP transport will be obtained using the provided context. // The returned client and its Transport should not be modified. func (c *Config) Client(ctx context.Context, t *Token) *http.Client { return NewClient(ctx, c.TokenSource(ctx, t)) } // TokenSource returns a TokenSource that returns t until t expires, // automatically refreshing it as necessary using the provided context. // // Most users will use Config.Client instead. func (c *Config) TokenSource(ctx context.Context, t *Token) TokenSource { tkr := &tokenRefresher{ ctx: ctx, conf: c, } if t != nil { tkr.refreshToken = t.RefreshToken } return &reuseTokenSource{ t: t, new: tkr, } } // tokenRefresher is a TokenSource that makes "grant_type"=="refresh_token" // HTTP requests to renew a token using a RefreshToken. type tokenRefresher struct { ctx context.Context // used to get HTTP requests conf *Config refreshToken string } // WARNING: Token is not safe for concurrent access, as it // updates the tokenRefresher's refreshToken field. // Within this package, it is used by reuseTokenSource which // synchronizes calls to this method with its own mutex. func (tf *tokenRefresher) Token() (*Token, error) { if tf.refreshToken == "" { return nil, errors.New("oauth2: token expired and refresh token is not set") } tk, err := retrieveToken(tf.ctx, tf.conf, url.Values{ "grant_type": {"refresh_token"}, "refresh_token": {tf.refreshToken}, }) if err != nil { return nil, err } if tf.refreshToken != tk.RefreshToken { tf.refreshToken = tk.RefreshToken } return tk, err } // reuseTokenSource is a TokenSource that holds a single token in memory // and validates its expiry before each call to retrieve it with // Token. If it's expired, it will be auto-refreshed using the // new TokenSource. type reuseTokenSource struct { new TokenSource // called when t is expired. mu sync.Mutex // guards t t *Token } // Token returns the current token if it's still valid, else will // refresh the current token (using r.Context for HTTP client // information) and return the new one. func (s *reuseTokenSource) Token() (*Token, error) { s.mu.Lock() defer s.mu.Unlock() if s.t.Valid() { return s.t, nil } t, err := s.new.Token() if err != nil { return nil, err } s.t = t return t, nil } // StaticTokenSource returns a TokenSource that always returns the same token. // Because the provided token t is never refreshed, StaticTokenSource is only // useful for tokens that never expire. func StaticTokenSource(t *Token) TokenSource { return staticTokenSource{t} } // staticTokenSource is a TokenSource that always returns the same Token. type staticTokenSource struct { t *Token } func (s staticTokenSource) Token() (*Token, error) { return s.t, nil } // HTTPClient is the context key to use with golang.org/x/net/context's // WithValue function to associate an *http.Client value with a context. var HTTPClient internal.ContextKey // NewClient creates an *http.Client from a Context and TokenSource. // The returned client is not valid beyond the lifetime of the context. // // As a special case, if src is nil, a non-OAuth2 client is returned // using the provided context. This exists to support related OAuth2 // packages. func NewClient(ctx context.Context, src TokenSource) *http.Client { if src == nil { c, err := internal.ContextClient(ctx) if err != nil { return &http.Client{Transport: internal.ErrorTransport{err}} } return c } return &http.Client{ Transport: &Transport{ Base: internal.ContextTransport(ctx), Source: ReuseTokenSource(nil, src), }, } } // ReuseTokenSource returns a TokenSource which repeatedly returns the // same token as long as it's valid, starting with t. // When its cached token is invalid, a new token is obtained from src. // // ReuseTokenSource is typically used to reuse tokens from a cache // (such as a file on disk) between runs of a program, rather than // obtaining new tokens unnecessarily. // // The initial token t may be nil, in which case the TokenSource is // wrapped in a caching version if it isn't one already. This also // means it's always safe to wrap ReuseTokenSource around any other // TokenSource without adverse effects. func ReuseTokenSource(t *Token, src TokenSource) TokenSource { // Don't wrap a reuseTokenSource in itself. That would work, // but cause an unnecessary number of mutex operations. // Just build the equivalent one. if rt, ok := src.(*reuseTokenSource); ok { if t == nil { // Just use it directly. return rt } src = rt.new } return &reuseTokenSource{ t: t, new: src, } }
{ "pile_set_name": "Github" }
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef __C_SEND_RESULT_H__ #define __C_SEND_RESULT_H__ #include "CCommon.h" #ifdef __cplusplus extern "C" { #endif typedef enum E_CSendStatus_ { E_SEND_OK = 0, E_SEND_FLUSH_DISK_TIMEOUT = 1, E_SEND_FLUSH_SLAVE_TIMEOUT = 2, E_SEND_SLAVE_NOT_AVAILABLE = 3 } CSendStatus; typedef struct _SendResult_ { CSendStatus sendStatus; char msgId[MAX_MESSAGE_ID_LENGTH]; long long offset; } CSendResult; #ifdef __cplusplus } #endif #endif //__C_PRODUCER_H__
{ "pile_set_name": "Github" }
[access "refs/heads/*"] abandon = group flame-core label-Code-Review = -2..+2 group flame-core label-Workflow = -1..+1 group flame-core [access "refs/tags/*"] pushSignedTag = group flame-release [receive] requireChangeId = true requireContributorAgreement = true [submit] mergeContent = true
{ "pile_set_name": "Github" }
#!perl BEGIN { if ($ENV{PERL_CORE}) { chdir 't' if -d 't'; @INC = '../lib'; } } use Test::More tests => 18; use Attribute::Handlers; sub Args : ATTR(CODE) { my ($package, $symbol, $referent, $attr, $data, $phase, $filename, $linenum) = @_; is( $package, 'main', 'package' ); is( $symbol, \*foo, 'symbol' ); is( $referent, \&foo, 'referent' ); is( $attr, 'Args', 'attr' ); is( ref $data, 'ARRAY', 'data' ); is( $data->[0], 'bar', 'data' ); is( $phase, 'CHECK', 'phase' ); is( $filename, __FILE__, 'filename' ); is( $linenum, 26, 'linenum' ); } sub foo :Args(bar) {} my $ref; sub myref { $ref = shift; } my $b; #line 42 eval "my \$bar :SArgs(grumpf); \$b = \\\$bar"; is( $b, $ref, 'referent' ); sub SArgs : ATTR(SCALAR) { my ($package, $symbol, $referent, $attr, $data, $phase, $filename, $linenum) = @_; is( $package, 'main', 'package' ); is( $symbol, 'LEXICAL', 'symbol' ); myref($referent); is( $attr, 'SArgs', 'attr' ); is( ref $data, 'ARRAY', 'data' ); is( $data->[0], 'grumpf', 'data' ); is( $phase, 'CHECK', 'phase' ); TODO: { local $TODO = "Doesn't work correctly" if $] < 5.008; is( $filename, __FILE__, 'filename' ); is( $linenum, 42, 'linenum' ); } }
{ "pile_set_name": "Github" }
// DATA_TEMPLATE: empty_table oTest.fnStart( "Custom data source property - property given" ); $(document).ready( function () { var oInit = { "sAjaxSource": "../../../examples/ajax/sources/custom_prop.txt", "sAjaxDataProp": "demo" }; $('#example').dataTable( oInit ); oTest.fnWaitTest( "10 rows shown on the first page", null, function () { return $('#example tbody tr').length == 10; } ); oTest.fnTest( "Initial sort occured", null, function () { return $('#example tbody td:eq(0)').html() == "Gecko"; } ); /* Need to use the WaitTest for sorting due to the setTimeout datatables uses */ oTest.fnTest( "Sorting (first click) on second column", function () { $('#example thead th:eq(1)').click(); }, function () { return $('#example tbody td:eq(1)').html() == "All others"; } ); oTest.fnTest( "Sorting (second click) on second column", function () { $('#example thead th:eq(1)').click(); }, function () { return $('#example tbody td:eq(1)').html() == "Seamonkey 1.1"; } ); oTest.fnTest( "Sorting (third click) on second column", function () { $('#example thead th:eq(1)').click(); }, function () { return $('#example tbody td:eq(1)').html() == "All others"; } ); oTest.fnTest( "Sorting (first click) on numeric column", function () { $('#example thead th:eq(3)').click(); }, function () { return $('#example tbody td:eq(3)').html() == "-"; } ); oTest.fnTest( "Sorting (second click) on numeric column", function () { $('#example thead th:eq(3)').click(); }, function () { return $('#example tbody td:eq(3)').html() == "522.1"; } ); oTest.fnTest( "Sorting multi-column (first click)", function () { $('#example thead th:eq(0)').click(); oDispacher.click( $('#example thead th:eq(1)')[0], { 'shift': true } ); }, function () { var b = $('#example tbody td:eq(0)').html() == "Gecko" && $('#example tbody td:eq(1)').html() == "Camino 1.0"; return b; } ); oTest.fnTest( "Sorting multi-column - sorting second column only", function () { $('#example thead th:eq(1)').click(); }, function () { return $('#example tbody td:eq(1)').html() == "All others"; } ); /* Basic paging */ oTest.fnTest( "Paging to second page", function () { $('#example_next').click(); }, function () { return $('#example tbody td:eq(1)').html() == "IE Mobile"; } ); oTest.fnTest( "Paging to first page", function () { $('#example_previous').click(); }, function () { return $('#example tbody td:eq(1)').html() == "All others"; } ); oTest.fnTest( "Attempting to page back beyond the first page", function () { $('#example_previous').click(); }, function () { return $('#example tbody td:eq(1)').html() == "All others"; } ); /* Changing length */ oTest.fnTest( "Changing table length to 25 records", function () { $("select[name=example_length]").val('25').change(); }, function () { return $('#example tbody tr').length == 25; } ); oTest.fnTest( "Changing table length to 50 records", function () { $("select[name=example_length]").val('50').change(); }, function () { return $('#example tbody tr').length == 50; } ); oTest.fnTest( "Changing table length to 100 records", function () { $("select[name=example_length]").val('100').change(); }, function () { return $('#example tbody tr').length == 57; } ); oTest.fnTest( "Changing table length to 10 records", function () { $("select[name=example_length]").val('10').change(); }, function () { return $('#example tbody tr').length == 10; } ); /* * Information element */ oTest.fnTest( "Information on zero config", null, function () { return document.getElementById('example_info').innerHTML == "Showing 1 to 10 of 57 entries"; } ); oTest.fnTest( "Information on second page", function () { $('#example_next').click(); }, function () { return document.getElementById('example_info').innerHTML == "Showing 11 to 20 of 57 entries"; } ); oTest.fnTest( "Information on third page", function () { $('#example_next').click(); }, function () { return document.getElementById('example_info').innerHTML == "Showing 21 to 30 of 57 entries"; } ); oTest.fnComplete(); } );
{ "pile_set_name": "Github" }
// Copyright 2020 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. syntax = "proto3"; package google.ads.googleads.v5.services; import "google/ads/googleads/v5/enums/access_role.proto"; import "google/ads/googleads/v5/enums/response_content_type.proto"; import "google/ads/googleads/v5/resources/customer.proto"; import "google/api/annotations.proto"; import "google/api/client.proto"; import "google/api/field_behavior.proto"; import "google/api/resource.proto"; import "google/protobuf/field_mask.proto"; option csharp_namespace = "Google.Ads.GoogleAds.V5.Services"; option go_package = "google.golang.org/genproto/googleapis/ads/googleads/v5/services;services"; option java_multiple_files = true; option java_outer_classname = "CustomerServiceProto"; option java_package = "com.google.ads.googleads.v5.services"; option objc_class_prefix = "GAA"; option php_namespace = "Google\\Ads\\GoogleAds\\V5\\Services"; option ruby_package = "Google::Ads::GoogleAds::V5::Services"; // Proto file describing the Customer service. // Service to manage customers. service CustomerService { option (google.api.default_host) = "googleads.googleapis.com"; // Returns the requested customer in full detail. rpc GetCustomer(GetCustomerRequest) returns (google.ads.googleads.v5.resources.Customer) { option (google.api.http) = { get: "/v5/{resource_name=customers/*}" }; option (google.api.method_signature) = "resource_name"; } // Updates a customer. Operation statuses are returned. rpc MutateCustomer(MutateCustomerRequest) returns (MutateCustomerResponse) { option (google.api.http) = { post: "/v5/customers/{customer_id=*}:mutate" body: "*" }; option (google.api.method_signature) = "customer_id,operation"; } // Returns resource names of customers directly accessible by the // user authenticating the call. rpc ListAccessibleCustomers(ListAccessibleCustomersRequest) returns (ListAccessibleCustomersResponse) { option (google.api.http) = { get: "/v5/customers:listAccessibleCustomers" }; } // Creates a new client under manager. The new client customer is returned. rpc CreateCustomerClient(CreateCustomerClientRequest) returns (CreateCustomerClientResponse) { option (google.api.http) = { post: "/v5/customers/{customer_id=*}:createCustomerClient" body: "*" }; option (google.api.method_signature) = "customer_id,customer_client"; } } // Request message for [CustomerService.GetCustomer][google.ads.googleads.v5.services.CustomerService.GetCustomer]. message GetCustomerRequest { // Required. The resource name of the customer to fetch. string resource_name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { type: "googleads.googleapis.com/Customer" } ]; } // Request message for [CustomerService.MutateCustomer][google.ads.googleads.v5.services.CustomerService.MutateCustomer]. message MutateCustomerRequest { // Required. The ID of the customer being modified. string customer_id = 1 [(google.api.field_behavior) = REQUIRED]; // Required. The operation to perform on the customer CustomerOperation operation = 4 [(google.api.field_behavior) = REQUIRED]; // If true, the request is validated but not executed. Only errors are // returned, not results. bool validate_only = 5; // The response content type setting. Determines whether the mutable resource // or just the resource name should be returned post mutation. google.ads.googleads.v5.enums.ResponseContentTypeEnum.ResponseContentType response_content_type = 6; } // Request message for [CustomerService.CreateCustomerClient][google.ads.googleads.v5.services.CustomerService.CreateCustomerClient]. message CreateCustomerClientRequest { // Required. The ID of the Manager under whom client customer is being created. string customer_id = 1 [(google.api.field_behavior) = REQUIRED]; // Required. The new client customer to create. The resource name on this customer // will be ignored. google.ads.googleads.v5.resources.Customer customer_client = 2 [(google.api.field_behavior) = REQUIRED]; // Email address of the user who should be invited on the created client // customer. Accessible only to customers on the allow-list. optional string email_address = 5; // The proposed role of user on the created client customer. // Accessible only to customers on the allow-list. google.ads.googleads.v5.enums.AccessRoleEnum.AccessRole access_role = 4; } // A single update on a customer. message CustomerOperation { // Mutate operation. Only updates are supported for customer. google.ads.googleads.v5.resources.Customer update = 1; // FieldMask that determines which resource fields are modified in an update. google.protobuf.FieldMask update_mask = 2; } // Response message for CreateCustomerClient mutate. message CreateCustomerClientResponse { // The resource name of the newly created customer client. string resource_name = 2; // Link for inviting user to access the created customer. Accessible to // allowlisted customers only. string invitation_link = 3; } // Response message for customer mutate. message MutateCustomerResponse { // Result for the mutate. MutateCustomerResult result = 2; } // The result for the customer mutate. message MutateCustomerResult { // Returned for successful operations. string resource_name = 1; // The mutated customer with only mutable fields after mutate. The fields will // only be returned when response_content_type is set to "MUTABLE_RESOURCE". google.ads.googleads.v5.resources.Customer customer = 2; } // Request message for [CustomerService.ListAccessibleCustomers][google.ads.googleads.v5.services.CustomerService.ListAccessibleCustomers]. message ListAccessibleCustomersRequest { } // Response message for [CustomerService.ListAccessibleCustomers][google.ads.googleads.v5.services.CustomerService.ListAccessibleCustomers]. message ListAccessibleCustomersResponse { // Resource name of customers directly accessible by the // user authenticating the call. repeated string resource_names = 1; }
{ "pile_set_name": "Github" }
/** \file * * This file contains special DoxyGen information for the generation of the main page and other special * documentation pages. It is not a project source file. */ /** \mainpage MIDI Input Device Demo * * \section Sec_Compat Demo Compatibility: * * The following list indicates what microcontrollers are compatible with this demo. * * \li Series 7 USB AVRs (AT90USBxxx7) * \li Series 6 USB AVRs (AT90USBxxx6) * \li Series 4 USB AVRs (ATMEGAxxU4) * \li Series 2 USB AVRs (AT90USBxx2, ATMEGAxxU2) * \li Series AU XMEGA AVRs (ATXMEGAxxxAxU) * \li Series B XMEGA AVRs (ATXMEGAxxxBx) * \li Series C XMEGA AVRs (ATXMEGAxxxCx) * * \section Sec_Info USB Information: * * The following table gives a rundown of the USB utilization of this demo. * * <table> * <tr> * <td><b>USB Mode:</b></td> * <td>Device</td> * </tr> * <tr> * <td><b>USB Class:</b></td> * <td>Audio Class</td> * </tr> * <tr> * <td><b>USB Subclass:</b></td> * <td>Standard Audio Device</td> * </tr> * <tr> * <td><b>Relevant Standards:</b></td> * <td>USBIF Audio Class Specification \n * USB-MIDI Audio Class Extension Specification \n * General MIDI Specification</td> * </tr> * <tr> * <td><b>Supported USB Speeds:</b></td> * <td>Full Speed Mode</td> * </tr> * </table> * * \section Sec_Description Project Description: * * MIDI demonstration application. This gives a simple reference * application for implementing the USB-MIDI class in USB devices. * It is built upon the USB Audio class. * * Joystick movements are translated into note on/off messages and * are sent to the host PC as MIDI streams which can be read by any * MIDI program supporting MIDI IN devices. * * If the HWB is not pressed, channel 1 (default piano) is used. If * the HWB is pressed, then channel 10 (default percussion) is selected. * * This device implements MIDI-THRU mode, with the IN MIDI data being * generated by the device itself. OUT MIDI data is discarded. * * \section Sec_Options Project Options * * The following defines can be found in this demo, which can control the demo behaviour when defined, or changed in value. * * <table> * <tr> * <td> * None * </td> * </tr> * </table> */
{ "pile_set_name": "Github" }
## # Cleaner resource file # Author: pedro ubuntu [ r00t-3xp10it ] # Manually delete payloads left in target # execute: meterpreter > resource /path/to/cleaner.rc ## search -d C:\\Users\\Public -f FaaF.AssA rm C:\\Users\\Public\\FaaF.AssA
{ "pile_set_name": "Github" }
import React, { Component } from 'react'; import * as ReactDOM from 'react-dom'; import { Card, Drawer, Form, Button, Col, Row, Input, Select, DatePicker, Icon, } from 'antd'; import styles from './index.less'; import esriLoader from 'esri-loader' import dxsj from '@/assets/map/dxsj.png'; import qxsj from '@/assets/map/qxsj.png'; import slgc from '@/assets/map/slgc.png'; import swsj from '@/assets/map/swsj.png'; import tdsj from '@/assets/map/tdsj.png'; import trsj from '@/assets/map/trsj.png'; import zbsj from '@/assets/map/zbsj.png'; @Form.create() class ArcgisMap extends Component { constructor(props) { super(props) this.tileMapUrl = "https://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer" this.state = { width: props.width || -1, height: props.height || -1, } } componentDidMount() { this.updateSize(); window.addEventListener('resize', () => this.updateSize()); this.initMap(); } componentWillUnmount() { window.removeEventListener('resize', () => this.updateSize()); } updateSize() { try { const parentDom = ReactDOM.findDOMNode(this).parentNode; let { width, height } = this.props; //如果props没有指定height和width就自适应 width = "100%"; if (!height) { height = parentDom.offsetHeight - 64; } this.setState({ width, height }); } catch (ignore) { } } initMap() { const mapURL = { url: "http://127.0.0.1:86/arcgis_js_api/library/4.10/dojo/dojo.js" } esriLoader.loadModules([ "esri/Map", "esri/Basemap", "esri/layers/TileLayer", "esri/views/MapView", "esri/views/SceneView", "esri/widgets/BasemapToggle", "esri/layers/MapImageLayer", "dojo/domReady!" ], mapURL).then(([ Map, Basemap, TileLayer, MapView, SceneView, BasemapToggle, MapImageLayer]) => { let layer = new TileLayer({ url: this.tileMapUrl }) let baseMap = new Basemap({ baseLayers: [layer], title: "自定义底图", id: "myBasemap" }); // 创建一个Map实例 let map = new Map({ basemap: baseMap, }); // 创建SceneView实例并引用地图实例 let view = new MapView({ center: [-117.18, 34.06], map: map, container: "mapDiv", zoom: 5 }); var toggle = new BasemapToggle({ //设置属性 view: view, // 提供对地图'topo'底图的访问的视图 nextBasemap: "hybrid" // 允许切换到“混合”底图 }); view.ui.add(toggle, "bottom-right"); }) } openQueryMenu = (res) => { console.log(res); this.setState({ visible: true, }); }; onClose = () => { this.setState({ visible: false, }); }; render() { const { form: { getFieldDecorator }, } = this.props; return ( <div> <div id="mapDiv" style={this.state}></div> <div id="container" className={styles.container}> <div id="dock"> <ul> <li> <span>气象数据</span> <a href="javascript:void(0);" onClick={() => this.openQueryMenu('qxsj')}><img src={qxsj}></img></a> </li> <li> <span>水文数据</span> <a href="javascript:void(0);" onClick={() => this.openQueryMenu('swsj')}><img src={swsj}></img></a> </li> <li> <span>植被数据</span> <a href="javascript:void(0);" onClick={() => this.openQueryMenu('zbsj')}><img src={zbsj}></img></a> </li> <li> <span>土壤数据</span> <a href="javascript:void(0);" onClick={() => this.openQueryMenu('trsj')}><img src={trsj}></img></a> </li> <li> <span>地形数据</span> <a href="javascript:void(0);" onClick={() => this.openQueryMenu('dxsj')}><img src={dxsj}></img></a> </li> <li> <span>土地利用数据</span> <a href="javascript:void(0);" onClick={() => this.openQueryMenu('tdsj')}><img src={tdsj}></img></a> </li> <li> <span>水利工程数据</span> <a href="javascript:void(0);" onClick={() => this.openQueryMenu('slgc')}><img src={slgc}></img></a> </li> </ul> </div> </div> <Drawer title="数据查询" placement="left" width={350} closable={false} onClose={this.onClose} visible={this.state.visible} > <Form layout="vertical" hideRequiredMark> <Row gutter={16}> <Col span={12}> <Form.Item label="Name"> {getFieldDecorator('name', { rules: [{ required: true, message: 'Please enter user name' }], })(<Input placeholder="Please enter user name" />)} </Form.Item> </Col> <Col span={12}> <Form.Item label="Url"> {getFieldDecorator('url', { rules: [{ required: true, message: 'Please enter url' }], })( <Input style={{ width: '100%' }} addonBefore="http://" addonAfter=".com" placeholder="Please enter url" /> )} </Form.Item> </Col> </Row> </Form> </Drawer> </div> ) } } export default ArcgisMap;
{ "pile_set_name": "Github" }
/* Reference mpz functions. Copyright 1997, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. This file is part of the GNU MP Library test suite. The GNU MP Library test suite is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. The GNU MP Library test suite is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with the GNU MP Library test suite. If not, see http://www.gnu.org/licenses/. */ /* always do assertion checking */ #define WANT_ASSERT 1 #include <stdio.h> #include <stdlib.h> /* for free */ #include "gmp.h" #include "gmp-impl.h" #include "longlong.h" #include "tests.h" /* Change this to "#define TRACE(x) x" for some traces. */ #define TRACE(x) /* FIXME: Shouldn't use plain mpz functions in a reference routine. */ void refmpz_combit (mpz_ptr r, unsigned long bit) { if (mpz_tstbit (r, bit)) mpz_clrbit (r, bit); else mpz_setbit (r, bit); } unsigned long refmpz_hamdist (mpz_srcptr x, mpz_srcptr y) { mp_size_t xsize, ysize, tsize; mp_ptr xp, yp; unsigned long ret; if ((SIZ(x) < 0 && SIZ(y) >= 0) || (SIZ(y) < 0 && SIZ(x) >= 0)) return ULONG_MAX; xsize = ABSIZ(x); ysize = ABSIZ(y); tsize = MAX (xsize, ysize); xp = refmpn_malloc_limbs (tsize); refmpn_zero (xp, tsize); refmpn_copy (xp, PTR(x), xsize); yp = refmpn_malloc_limbs (tsize); refmpn_zero (yp, tsize); refmpn_copy (yp, PTR(y), ysize); if (SIZ(x) < 0) refmpn_neg (xp, xp, tsize); if (SIZ(x) < 0) refmpn_neg (yp, yp, tsize); ret = refmpn_hamdist (xp, yp, tsize); free (xp); free (yp); return ret; } /* (0/b), with mpz b; is 1 if b=+/-1, 0 otherwise */ #define JACOBI_0Z(b) JACOBI_0LS (PTR(b)[0], SIZ(b)) /* (a/b) effect due to sign of b: mpz/mpz */ #define JACOBI_BSGN_ZZ_BIT1(a, b) JACOBI_BSGN_SS_BIT1 (SIZ(a), SIZ(b)) /* (a/b) effect due to sign of a: mpz/unsigned-mpz, b odd; is (-1/b) if a<0, or +1 if a>=0 */ #define JACOBI_ASGN_ZZU_BIT1(a, b) JACOBI_ASGN_SU_BIT1 (SIZ(a), PTR(b)[0]) int refmpz_kronecker (mpz_srcptr a_orig, mpz_srcptr b_orig) { unsigned long twos; mpz_t a, b; int result_bit1 = 0; if (mpz_sgn (b_orig) == 0) return JACOBI_Z0 (a_orig); /* (a/0) */ if (mpz_sgn (a_orig) == 0) return JACOBI_0Z (b_orig); /* (0/b) */ if (mpz_even_p (a_orig) && mpz_even_p (b_orig)) return 0; if (mpz_cmp_ui (b_orig, 1) == 0) return 1; mpz_init_set (a, a_orig); mpz_init_set (b, b_orig); if (mpz_sgn (b) < 0) { result_bit1 ^= JACOBI_BSGN_ZZ_BIT1 (a, b); mpz_neg (b, b); } if (mpz_even_p (b)) { twos = mpz_scan1 (b, 0L); mpz_tdiv_q_2exp (b, b, twos); result_bit1 ^= JACOBI_TWOS_U_BIT1 (twos, PTR(a)[0]); } if (mpz_sgn (a) < 0) { result_bit1 ^= JACOBI_N1B_BIT1 (PTR(b)[0]); mpz_neg (a, a); } if (mpz_even_p (a)) { twos = mpz_scan1 (a, 0L); mpz_tdiv_q_2exp (a, a, twos); result_bit1 ^= JACOBI_TWOS_U_BIT1 (twos, PTR(b)[0]); } for (;;) { ASSERT (mpz_odd_p (a)); ASSERT (mpz_odd_p (b)); ASSERT (mpz_sgn (a) > 0); ASSERT (mpz_sgn (b) > 0); TRACE (printf ("top\n"); mpz_trace (" a", a); mpz_trace (" b", b)); if (mpz_cmp (a, b) < 0) { TRACE (printf ("swap\n")); mpz_swap (a, b); result_bit1 ^= JACOBI_RECIP_UU_BIT1 (PTR(a)[0], PTR(b)[0]); } if (mpz_cmp_ui (b, 1) == 0) break; mpz_sub (a, a, b); TRACE (printf ("sub\n"); mpz_trace (" a", a)); if (mpz_sgn (a) == 0) goto zero; twos = mpz_scan1 (a, 0L); mpz_fdiv_q_2exp (a, a, twos); TRACE (printf ("twos %lu\n", twos); mpz_trace (" a", a)); result_bit1 ^= JACOBI_TWOS_U_BIT1 (twos, PTR(b)[0]); } mpz_clear (a); mpz_clear (b); return JACOBI_BIT1_TO_PN (result_bit1); zero: mpz_clear (a); mpz_clear (b); return 0; } /* Same as mpz_kronecker, but ignoring factors of 2 on b */ int refmpz_jacobi (mpz_srcptr a, mpz_srcptr b) { ASSERT_ALWAYS (mpz_sgn (b) > 0); ASSERT_ALWAYS (mpz_odd_p (b)); return refmpz_kronecker (a, b); } /* Legendre symbol via powm. p must be an odd prime. */ int refmpz_legendre (mpz_srcptr a, mpz_srcptr p) { int res; mpz_t r; mpz_t e; ASSERT_ALWAYS (mpz_sgn (p) > 0); ASSERT_ALWAYS (mpz_odd_p (p)); mpz_init (r); mpz_init (e); mpz_fdiv_r (r, a, p); mpz_set (e, p); mpz_sub_ui (e, e, 1); mpz_fdiv_q_2exp (e, e, 1); mpz_powm (r, r, e, p); /* Normalize to a more or less symmetric range around zero */ if (mpz_cmp (r, e) > 0) mpz_sub (r, r, p); ASSERT_ALWAYS (mpz_cmpabs_ui (r, 1) <= 0); res = mpz_sgn (r); mpz_clear (r); mpz_clear (e); return res; } int refmpz_kronecker_ui (mpz_srcptr a, unsigned long b) { mpz_t bz; int ret; mpz_init_set_ui (bz, b); ret = refmpz_kronecker (a, bz); mpz_clear (bz); return ret; } int refmpz_kronecker_si (mpz_srcptr a, long b) { mpz_t bz; int ret; mpz_init_set_si (bz, b); ret = refmpz_kronecker (a, bz); mpz_clear (bz); return ret; } int refmpz_ui_kronecker (unsigned long a, mpz_srcptr b) { mpz_t az; int ret; mpz_init_set_ui (az, a); ret = refmpz_kronecker (az, b); mpz_clear (az); return ret; } int refmpz_si_kronecker (long a, mpz_srcptr b) { mpz_t az; int ret; mpz_init_set_si (az, a); ret = refmpz_kronecker (az, b); mpz_clear (az); return ret; } void refmpz_pow_ui (mpz_ptr w, mpz_srcptr b, unsigned long e) { mpz_t s, t; unsigned long i; mpz_init_set_ui (t, 1L); mpz_init_set (s, b); if ((e & 1) != 0) mpz_mul (t, t, s); for (i = 2; i <= e; i <<= 1) { mpz_mul (s, s, s); if ((i & e) != 0) mpz_mul (t, t, s); } mpz_set (w, t); mpz_clear (s); mpz_clear (t); }
{ "pile_set_name": "Github" }
"use strict"; class Container { constructor(node) { this.node = node; } toJSON() { return this.items; } } module.exports = Container;
{ "pile_set_name": "Github" }
<?xml version="1.0" encoding="UTF-8"?> <!-- ~ Copyright 2011-2019 the original author or authors. ~ ~ Licensed under the Apache License, Version 2.0 (the "License"); ~ you may not use this file except in compliance with the License. ~ You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, software ~ distributed under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for the specific language governing permissions and ~ limitations under the License. --> <configuration> <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> <encoder> <pattern>%-25thread %-37logger %msg%n</pattern> </encoder> </appender> <root level="OFF"> <appender-ref ref="STDOUT"/> </root> </configuration>
{ "pile_set_name": "Github" }
//===- TestConvVectorization.cpp - Vectorization of Conv ops --------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// #include "mlir/Conversion/VectorToSCF/VectorToSCF.h" #include "mlir/Dialect/Linalg/Passes.h" #include "mlir/Dialect/Linalg/Transforms/Hoisting.h" #include "mlir/Dialect/Linalg/Transforms/Transforms.h" #include "mlir/Dialect/Vector/VectorTransforms.h" #include "mlir/Pass/Pass.h" #include "mlir/Pass/PassManager.h" #include "mlir/Transforms/DialectConversion.h" #include "mlir/Transforms/LoopUtils.h" #include "mlir/Transforms/Passes.h" using namespace mlir; using namespace vector; namespace { /// A pass converting MLIR Linalg ops into Vector ops. class TestConvVectorization : public PassWrapper<TestConvVectorization, OperationPass<ModuleOp>> { void runOnOperation() override; void getDependentDialects(DialectRegistry &registry) const override { registry.insert<VectorDialect>(); registry.insert<linalg::LinalgDialect>(); registry.insert<scf::SCFDialect>(); registry.insert<AffineDialect>(); registry.insert<StandardOpsDialect>(); } }; } // namespace void TestConvVectorization::runOnOperation() { MLIRContext *context = &getContext(); ModuleOp module = getOperation(); ConversionTarget target(*context); target.addLegalDialect<AffineDialect, scf::SCFDialect, StandardOpsDialect, VectorDialect>(); target.addLegalOp<ModuleOp, FuncOp, ModuleTerminatorOp, ReturnOp>(); target.addLegalOp<linalg::FillOp, linalg::YieldOp>(); SmallVector<OwningRewritePatternList, 4> stage1Patterns; linalg::populateConvVectorizationPatterns(context, stage1Patterns); OwningRewritePatternList stage2Patterns = linalg::getLinalgTilingCanonicalizationPatterns(context); stage2Patterns.insert<linalg::AffineMinSCFCanonicalizationPattern>(context); auto stage3Transforms = [](Operation *op) { PassManager pm(op->getContext()); pm.addPass(createLoopInvariantCodeMotionPass()); if (failed(pm.run(cast<ModuleOp>(op)))) llvm_unreachable("Unexpected failure in cleanup pass pipeline."); op->walk([](FuncOp func) { promoteSingleIterationLoops(func); linalg::hoistViewAllocOps(func); linalg::hoistRedundantVectorTransfers(func); }); return success(); }; linalg::applyStagedPatterns(module, stage1Patterns, stage2Patterns, stage3Transforms); //===--------------------------------------------------------------------===// // Post staged patterns transforms //===--------------------------------------------------------------------===// VectorTransformsOptions vectorTransformsOptions{ VectorContractLowering::Dot, VectorTransposeLowering::EltWise}; OwningRewritePatternList vectorTransferPatterns; // Pattern is not applied because rank-reducing vector transfer is not yet // supported as can be seen in splitFullAndPartialTransferPrecondition, // VectorTransforms.cpp vectorTransferPatterns.insert<VectorTransferFullPartialRewriter>( context, vectorTransformsOptions); applyPatternsAndFoldGreedily(module, vectorTransferPatterns); // Programmatic controlled lowering of linalg.copy and linalg.fill. PassManager pm(context); pm.addPass(createConvertLinalgToLoopsPass()); if (failed(pm.run(module))) llvm_unreachable("Unexpected failure in linalg to loops pass."); // Programmatic controlled lowering of vector.contract only. OwningRewritePatternList vectorContractLoweringPatterns; populateVectorContractLoweringPatterns(vectorContractLoweringPatterns, context, vectorTransformsOptions); applyPatternsAndFoldGreedily(module, vectorContractLoweringPatterns); // Programmatic controlled lowering of vector.transfer only. OwningRewritePatternList vectorToLoopsPatterns; populateVectorToSCFConversionPatterns(vectorToLoopsPatterns, context, VectorTransferToSCFOptions()); applyPatternsAndFoldGreedily(module, vectorToLoopsPatterns); // Ensure we drop the marker in the end. module.walk([](linalg::LinalgOp op) { op.removeAttr(linalg::LinalgTransforms::kLinalgTransformMarker); }); } namespace mlir { void registerTestConvVectorization() { PassRegistration<TestConvVectorization> testTransformPatternsPass( "test-conv-vectorization", "Test vectorization of convolutions"); } } // namespace mlir
{ "pile_set_name": "Github" }