text:
cask 'java' do
  version '1.9,181'
  sha256 '0755e848c061419313510a88508512b8d58ae9c79bd01d460e6b436dc13dfac1'

  url "http://download.oracle.com/otn-pub/java/jdk/#{version.minor}+#{version.after_comma}/jdk-#{version.minor}_osx-x64_bin.dmg",
      cookies: {
                 'oraclelicense' => 'accept-securebackup-cookie',
               }
  name 'Java Standard Edition Development Kit'
  homepage "https://www.oracle.com/technetwork/java/javase/downloads/jdk#{version.minor}-downloads-3848520.html"

  pkg "JDK #{version.minor}.pkg"

  postflight do
    system_command '/usr/libexec/PlistBuddy',
                   args: ['-c', 'Add :JavaVM:JVMCapabilities: string BundledApp', "/Library/Java/JavaVirtualMachines/jdk-#{version.minor}.jdk/Contents/Info.plist"],
                   sudo: true
    system_command '/usr/libexec/PlistBuddy',
                   args: ['-c', 'Add :JavaVM:JVMCapabilities: string JNI', "/Library/Java/JavaVirtualMachines/jdk-#{version.minor}.jdk/Contents/Info.plist"],
                   sudo: true
    system_command '/usr/libexec/PlistBuddy',
                   args: ['-c', 'Add :JavaVM:JVMCapabilities: string WebStart', "/Library/Java/JavaVirtualMachines/jdk-#{version.minor}.jdk/Contents/Info.plist"],
                   sudo: true
    system_command '/usr/libexec/PlistBuddy',
                   args: ['-c', 'Add :JavaVM:JVMCapabilities: string Applets', "/Library/Java/JavaVirtualMachines/jdk-#{version.minor}.jdk/Contents/Info.plist"],
                   sudo: true
    system_command '/bin/ln',
                   args: ['-nsf', '--', "/Library/Java/JavaVirtualMachines/jdk-#{version.minor}.jdk/Contents/Home", '/Library/Java/Home'],
                   sudo: true
    system_command '/bin/mkdir',
                   args: ['-p', '--', "/Library/Java/JavaVirtualMachines/jdk-#{version.minor}.jdk/Contents/Home/bundle/Libraries"],
                   sudo: true
    system_command '/bin/ln',
                   args: ['-nsf', '--', "/Library/Java/JavaVirtualMachines/jdk-#{version.minor}.jdk/Contents/Home/lib/server/libjvm.dylib", "/Library/Java/JavaVirtualMachines/jdk-#{version.minor}.jdk/Contents/Home/bundle/Libraries/libserver.dylib"],
                   sudo: true

    if MacOS.version <= :mavericks
      system_command '/bin/rm',
                     args: ['-rf', '--', '/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK'],
                     sudo: true
      system_command '/bin/ln',
                     args: ['-nsf', '--', "/Library/Java/JavaVirtualMachines/jdk-#{version.minor}.jdk/Contents", '/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK'],
                     sudo: true
    end
  end

  uninstall_preflight do
    if File.exist?("#{HOMEBREW_PREFIX}/Caskroom/java-jdk-javadoc")
      system_command 'brew', args: ['cask', 'uninstall', 'java-jdk-javadoc']
    end
  end

  uninstall pkgutil:   [
                         "com.oracle.jdk-#{version.minor}",
                         'com.oracle.jre',
                       ],
            launchctl: [
                         'com.oracle.java.Helper-Tool',
                         'com.oracle.java.Java-Updater',
                       ],
            quit:      [
                         'com.oracle.java.Java-Updater',
                         'net.java.openjdk.cmd', # Java Control Panel
                       ],
            delete:    [
                         '/Library/Internet Plug-Ins/JavaAppletPlugin.plugin',
                         "/Library/Java/JavaVirtualMachines/jdk-#{version.minor}.jdk/Contents",
                         '/Library/PreferencePanes/JavaControlPanel.prefPane',
                         '/Library/Java/Home',
                         if MacOS.version <= :mavericks
                           [
                             '/usr/lib/java/libjdns_sd.jnilib',
                             '/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK',
                           ]
                         end,
                       ].keep_if { |v| !v.nil? }

  zap delete: [
                '~/Library/Caches/com.oracle.java.Java-Updater',
                '~/Library/Caches/Oracle.MacJREInstaller',
                '~/Library/Caches/net.java.openjdk.cmd',
              ],
      trash:  [
                '/Library/Application Support/Oracle/Java',
                '/Library/Preferences/com.oracle.java.Deployment.plist',
                '/Library/Preferences/com.oracle.java.Helper-Tool.plist',
                '~/Library/Application Support/Java/',
                '~/Library/Application Support/Oracle/Java',
                '~/Library/Preferences/com.oracle.java.Java-Updater.plist',
                '~/Library/Preferences/com.oracle.java.JavaAppletPlugin.plist',
                '~/Library/Preferences/com.oracle.javadeployment.plist',
              ],
      rmdir:  [
                "/Library/Java/JavaVirtualMachines/jdk-#{version.minor}.jdk",
                '~/Library/Application Support/Oracle/',
              ]

  caveats <<-EOS.undent
    This Cask makes minor modifications to the JRE to prevent issues with
    packaged applications, as discussed here:

      https://bugs.eclipse.org/bugs/show_bug.cgi?id=411361

    If your Java application still asks for JRE installation, you might need
    to reboot or logout/login.

    Installing this Cask means you have AGREED to the Oracle Binary Code
    License Agreement for Java SE at

      https://www.oracle.com/technetwork/java/javase/terms/license/index.html
  EOS
end


text:
#ifndef _NR_H_
#define _NR_H_

#ifndef _FCOMPLEX_DECLARE_T_
typedef struct FCOMPLEX {double r,i;} fcomplex;
#define _FCOMPLEX_DECLARE_T_
#endif /* _FCOMPLEX_DECLARE_T_ */

#ifndef _ARITHCODE_DECLARE_T_
typedef struct {
	unsigned long *ilob,*iupb,*ncumfq,jdif,nc,minint,nch,ncum,nrad;
} arithcode;
#define _ARITHCODE_DECLARE_T_
#endif /* _ARITHCODE_DECLARE_T_ */

#ifndef _HUFFCODE_DECLARE_T_
typedef struct {
	unsigned long *icod,*ncod,*left,*right,nch,nodemax;
} huffcode;
#define _HUFFCODE_DECLARE_T_
#endif /* _HUFFCODE_DECLARE_T_ */

#include <stdio.h>

#if defined(__STDC__) || defined(ANSI) || defined(NRANSI) /* ANSI */

void addint(double **uf, double **uc, double **res, int nf);
void airy(double x, double *ai, double *bi, double *aip, double *bip);
void amebsa(double **p, double y[], int ndim, double pb[],	double *yb,
	double ftol, double (*funk)(double []), int *iter, double temptr);
void amoeba(double **p, double y[], int ndim, double ftol,
	double (*funk)(double []), int *iter);
double amotry(double **p, double y[], double psum[], int ndim,
	double (*funk)(double []), int ihi, double fac);
double amotsa(double **p, double y[], double psum[], int ndim, double pb[],
	double *yb, double (*funk)(double []), int ihi, double *yhi, double fac);
void anneal(double x[], double y[], int iorder[], int ncity);
double anorm2(double **a, int n);
void arcmak(unsigned long nfreq[], unsigned long nchh, unsigned long nradd,
	arithcode *acode);
void arcode(unsigned long *ich, unsigned char **codep, unsigned long *lcode,
	unsigned long *lcd, int isign, arithcode *acode);
void arcsum(unsigned long iin[], unsigned long iout[], unsigned long ja,
	int nwk, unsigned long nrad, unsigned long nc);
void asolve(unsigned long n, double b[], double x[], int itrnsp);
void atimes(unsigned long n, double x[], double r[], int itrnsp);
void avevar(double data[], unsigned long n, double *ave, double *var);
void balanc(double **a, int n);
void banbks(double **a, unsigned long n, int m1, int m2, double **al,
	unsigned long indx[], double b[]);
void bandec(double **a, unsigned long n, int m1, int m2, double **al,
	unsigned long indx[], double *d);
void banmul(double **a, unsigned long n, int m1, int m2, double x[], double b[]);
void bcucof(double y[], double y1[], double y2[], double y12[], double d1,
	double d2, double **c);
void bcuint(double y[], double y1[], double y2[], double y12[],
	double x1l, double x1u, double x2l, double x2u, double x1,
	double x2, double *ansy, double *ansy1, double *ansy2);
void beschb(double x, double *gam1, double *gam2, double *gampl,
	double *gammi);
double bessi(int n, double x);
double bessi0(double x);
double bessi1(double x);
void bessik(double x, double xnu, double *ri, double *rk, double *rip,
	double *rkp);
double bessj(int n, double x);
double bessj0(double x);
double bessj1(double x);
void bessjy(double x, double xnu, double *rj, double *ry, double *rjp,
	double *ryp);
double bessk(int n, double x);
double bessk0(double x);
double bessk1(double x);
double bessy(int n, double x);
double bessy0(double x);
double bessy1(double x);
double beta(double z, double w);
double betacf(double a, double b, double x);
double betai(double a, double b, double x);
double bico(int n, int k);
void bksub(int ne, int nb, int jf, int k1, int k2, double ***c);
double bnldev(double pp, int n, long *idum);
double brent(double ax, double bx, double cx,
	double (*f)(double), double tol, double *xmin);
void broydn(double x[], int n, int *check,
	void (*vecfunc)(int, double [], double []));
void bsstep(double y[], double dydx[], int nv, double *xx, double htry,
	double eps, double yscal[], double *hdid, double *hnext,
	void (*derivs)(double, double [], double []));
void caldat(long julian, int *mm, int *id, int *iyyy);
void chder(double a, double b, double c[], double cder[], int n);
double chebev(double a, double b, double c[], int m, double x);
void chebft(double a, double b, double c[], int n, double (*func)(double));
void chebpc(double c[], double d[], int n);
void chint(double a, double b, double c[], double cint[], int n);
double chixy(double bang);
void choldc(double **a, int n, double p[]);
void cholsl(double **a, int n, double p[], double b[], double x[]);
void chsone(double bins[], double ebins[], int nbins, int knstrn,
	double *df, double *chsq, double *prob);
void chstwo(double bins1[], double bins2[], int nbins, int knstrn,
	double *df, double *chsq, double *prob);
void cisi(double x, double *ci, double *si);
void cntab1(int **nn, int ni, int nj, double *chisq,
	double *df, double *prob, double *cramrv, double *ccc);
void cntab2(int **nn, int ni, int nj, double *h, double *hx, double *hy,
	double *hygx, double *hxgy, double *uygx, double *uxgy, double *uxy);
void convlv(double data[], unsigned long n, double respns[], unsigned long m,
	int isign, double ans[]);
void copy(double **aout, double **ain, int n);
void correl(double data1[], double data2[], unsigned long n, double ans[]);
void cosft(double y[], int n, int isign);
void cosft1(double y[], int n);
void cosft2(double y[], int n, int isign);
void covsrt(double **covar, int ma, int ia[], int mfit);
void crank(unsigned long n, double w[], double *s);
void cyclic(double a[], double b[], double c[], double alpha, double beta,
	double r[], double x[], unsigned long n);
void daub4(double a[], unsigned long n, int isign);
double dawson(double x);
double dbrent(double ax, double bx, double cx,
	double (*f)(double), double (*df)(double), double tol, double *xmin);
void ddpoly(double c[], int nc, double x, double pd[], int nd);
int decchk(char string[], int n, char *ch);
void derivs(double x, double y[], double dydx[]);
double df1dim(double x);
void dfour1(double data[], unsigned long nn, int isign);
void dfpmin(double p[], int n, double gtol, int *iter, double *fret,
	double (*func)(double []), void (*dfunc)(double [], double []));
double dfridr(double (*func)(double), double x, double h, double *err);
void dftcor(double w, double delta, double a, double b, double endpts[],
	double *corre, double *corim, double *corfac);
void dftint(double (*func)(double), double a, double b, double w,
	double *cosint, double *sinint);
void difeq(int k, int k1, int k2, int jsf, int is1, int isf,
	int indexv[], int ne, double **s, double **y);
void dlinmin(double p[], double xi[], int n, double *fret,
	double (*func)(double []), void (*dfunc)(double [], double[]));
double dpythag(double a, double b);
void drealft(double data[], unsigned long n, int isign);
void dsprsax(double sa[], unsigned long ija[], double x[], double b[],
	unsigned long n);
void dsprstx(double sa[], unsigned long ija[], double x[], double b[],
	unsigned long n);
void dsvbksb(double **u, double w[], double **v, int m, int n, double b[],
	double x[]);
void dsvdcmp(double **a, int m, int n, double w[], double **v);
void eclass(int nf[], int n, int lista[], int listb[], int m);
void eclazz(int nf[], int n, int (*equiv)(int, int));
double ei(double x);
void eigsrt(double d[], double **v, int n);
double elle(double phi, double ak);
double ellf(double phi, double ak);
double ellpi(double phi, double en, double ak);
void elmhes(double **a, int n);
double erfcc(double x);
float erff(float x);
double erffc(double x);
void eulsum(double *sum, double term, int jterm, double wksp[]);
double evlmem(double fdt, double d[], int m, double xms);
double expdev(long *idum);
double expint(int n, double x);
double f1(double x);
double f1dim(double x);
double f2(double y);
double f3(double z);
double factln(int n);
double factrl(int n);
void fasper(double x[], double y[], unsigned long n, double ofac, double hifac,
	double wk1[], double wk2[], unsigned long nwk, unsigned long *nout,
	unsigned long *jmax, double *prob);
void fdjac(int n, double x[], double fvec[], double **df,
	void (*vecfunc)(int, double [], double []));
void fgauss(double x, double a[], double *y, double dyda[], int na);
void fill0(double **u, int n);
void fit(double x[], double y[], int ndata, double sig[], int mwt,
	double *a, double *b, double *siga, double *sigb, double *chi2, double *q);
void fitexy(double x[], double y[], int ndat, double sigx[], double sigy[],
	double *a, double *b, double *siga, double *sigb, double *chi2, double *q);
void fixrts(double d[], int m);
void fleg(double x, double pl[], int nl);
void flmoon(int n, int nph, long *jd, double *frac);
//double fmin(double x[]);
void four1(double data[], unsigned long nn, int isign);
void fourew(FILE *file[5], int *na, int *nb, int *nc, int *nd);
void fourfs(FILE *file[5], unsigned long nn[], int ndim, int isign);
void fourn(double data[], unsigned long nn[], int ndim, int isign);
void fpoly(double x, double p[], int np);
void fred2(int n, double a, double b, double t[], double f[], double w[],
	double (*g)(double), double (*ak)(double, double));
double fredin(double x, int n, double a, double b, double t[], double f[], double w[],
	double (*g)(double), double (*ak)(double, double));
void frenel(double x, double *s, double *c);
void frprmn(double p[], int n, double ftol, int *iter, double *fret,
	double (*func)(double []), void (*dfunc)(double [], double []));
void ftest(double data1[], unsigned long n1, double data2[], unsigned long n2,
	double *f, double *prob);
double gamdev(int ia, long *idum);
double gammln(double xx);
double gammp(double a, double x);
double gammq(double a, double x);
double gasdev(long *idum);
void gaucof(int n, double a[], double b[], double amu0, double x[], double w[]);
void gauher(double x[], double w[], int n);
void gaujac(double x[], double w[], int n, double alf, double bet);
void gaulag(double x[], double w[], int n, double alf);
void gauleg(double x1, double x2, double x[], double w[], int n);
void gaussj(double **a, int n, double **b, int m);
void gcf(double *gammcf, double a, double x, double *gln);
double golden(double ax, double bx, double cx, double (*f)(double), double tol,
	double *xmin);
void gser(double *gamser, double a, double x, double *gln);
void hpsel(unsigned long m, unsigned long n, double arr[], double heap[]);
void hpsort(unsigned long n, double ra[]);
void hqr(double **a, int n, double wr[], double wi[]);
void hufapp(unsigned long index[], unsigned long nprob[], unsigned long n,
	unsigned long i);
void hufdec(unsigned long *ich, unsigned char *code, unsigned long lcode,
	unsigned long *nb, huffcode *hcode);
void hufenc(unsigned long ich, unsigned char **codep, unsigned long *lcode,
	unsigned long *nb, huffcode *hcode);
void hufmak(unsigned long nfreq[], unsigned long nchin, unsigned long *ilong,
	unsigned long *nlong, huffcode *hcode);
void hunt(double xx[], unsigned long n, double x, unsigned long *jlo);
void hypdrv(double s, double yy[], double dyyds[]);
fcomplex hypgeo(fcomplex a, fcomplex b, fcomplex c, fcomplex z);
void hypser(fcomplex a, fcomplex b, fcomplex c, fcomplex z,
	fcomplex *series, fcomplex *deriv);
unsigned short icrc(unsigned short crc, unsigned char *bufptr,
	unsigned long len, short jinit, int jrev);
unsigned short icrc1(unsigned short crc, unsigned char onech);
unsigned long igray(unsigned long n, int is);
void iindexx(unsigned long n, long arr[], unsigned long indx[]);
void indexx(unsigned long n, double arr[], unsigned long indx[]);
void interp(double **uf, double **uc, int nf);
int irbit1(unsigned long *iseed);
int irbit2(unsigned long *iseed);
void jacobi(double **a, int n, double d[], double **v, int *nrot);
void jacobn(double x, double y[], double dfdx[], double **dfdy, int n);
long julday(int mm, int id, int iyyy);
void kendl1(double data1[], double data2[], unsigned long n, double *tau, double *z,
	double *prob);
void kendl2(double **tab, int i, int j, double *tau, double *z, double *prob);
void kermom(double w[], double y, int m);
void ks2d1s(double x1[], double y1[], unsigned long n1,
	void (*quadvl)(double, double, double *, double *, double *, double *),
	double *d1, double *prob);
void ks2d2s(double x1[], double y1[], unsigned long n1, double x2[], double y2[],
	unsigned long n2, double *d, double *prob);
void ksone(double data[], unsigned long n, double (*func)(double), double *d,
	double *prob);
void kstwo(double data1[], unsigned long n1, double data2[], unsigned long n2,
	double *d, double *prob);
void laguer(fcomplex a[], int m, fcomplex *x, int *its);
void lfit(double x[], double y[], double sig[], int ndat, double a[], int ia[],
	int ma, double **covar, double *chisq, void (*funcs)(double, double [], int));
void linbcg(unsigned long n, double b[], double x[], int itol, double tol,
	 int itmax, int *iter, double *err);
void linmin(double p[], double xi[], int n, double *fret,
	double (*func)(double []));
void lnsrch(int n, double xold[], double fold, double g[], double p[], double x[],
	 double *f, double stpmax, int *check, double (*func)(double []));
void load(double x1, double v[], double y[]);
void load1(double x1, double v1[], double y[]);
void load2(double x2, double v2[], double y[]);
void locate(double xx[], unsigned long n, double x, unsigned long *j);
void lop(double **out, double **u, int n);
void lubksb(double **a, int n, int *indx, double b[]);
void ludcmp(double **a, int n, int *indx, double *d);
void machar(int *ibeta, int *it, int *irnd, int *ngrd,
	int *machep, int *negep, int *iexp, int *minexp, int *maxexp,
	double *eps, double *epsneg, double *xmin, double *xmax);
void matadd(double **a, double **b, double **c, int n);
void matsub(double **a, double **b, double **c, int n);
void medfit(double x[], double y[], int ndata, double *a, double *b, double *abdev);
void memcof(double data[], int n, int m, double *xms, double d[]);
int metrop(double de, double t);
void mgfas(double **u, int n, int maxcyc);
void mglin(double **u, int n, int ncycle);
double midexp(double (*funk)(double), double aa, double bb, int n);
double midinf(double (*funk)(double), double aa, double bb, int n);
double midpnt(double (*func)(double), double a, double b, int n);
double midsql(double (*funk)(double), double aa, double bb, int n);
double midsqu(double (*funk)(double), double aa, double bb, int n);
void miser(double (*func)(double []), double regn[], int ndim, unsigned long npts,
	double dith, double *ave, double *var);
void mmid(double y[], double dydx[], int nvar, double xs, double htot,
	int nstep, double yout[], void (*derivs)(double, double[], double[]));
void mnbrak(double *ax, double *bx, double *cx, double *fa, double *fb,
	double *fc, double (*func)(double));
void mnewt(int ntrial, double x[], int n, double tolx, double tolf);
void moment(double data[], int n, double *ave, double *adev, double *sdev,
	double *var, double *skew, double *curt);
void mp2dfr(unsigned char a[], unsigned char s[], int n, int *m);
void mpadd(unsigned char w[], unsigned char u[], unsigned char v[], int n);
void mpdiv(unsigned char q[], unsigned char r[], unsigned char u[],
	unsigned char v[], int n, int m);
void mpinv(unsigned char u[], unsigned char v[], int n, int m);
void mplsh(unsigned char u[], int n);
void mpmov(unsigned char u[], unsigned char v[], int n);
void mpmul(unsigned char w[], unsigned char u[], unsigned char v[], int n,
	int m);
void mpneg(unsigned char u[], int n);
void mppi(int n);
void mprove(double **a, double **alud, int n, int indx[], double b[],
	double x[]);
void mpsad(unsigned char w[], unsigned char u[], int n, int iv);
void mpsdv(unsigned char w[], unsigned char u[], int n, int iv, int *ir);
void mpsmu(unsigned char w[], unsigned char u[], int n, int iv);
void mpsqrt(unsigned char w[], unsigned char u[], unsigned char v[], int n,
	int m);
void mpsub(int *is, unsigned char w[], unsigned char u[], unsigned char v[],
	int n);
void mrqcof(double x[], double y[], double sig[], int ndata, double a[],
	int ia[], int ma, double **alpha, double beta[], double *chisq,
	void (*funcs)(double, double [], double *, double [], int));
void mrqmin(double x[], double y[], double sig[], int ndata, double a[],
	int ia[], int ma, double **covar, double **alpha, double *chisq,
	void (*funcs)(double, double [], double *, double [], int), double *alamda);
void newt(double x[], int n, int *check,
	void (*vecfunc)(int, double [], double []));
void odeint(double ystart[], int nvar, double x1, double x2,
	double eps, double h1, double hmin, int *nok, int *nbad,
	void (*derivs)(double, double [], double []),
	void (*rkqs)(double [], double [], int, double *, double, double,
	double [], double *, double *, void (*)(double, double [], double [])));
void orthog(int n, double anu[], double alpha[], double beta[], double a[],
	double b[]);
void pade(double cof[], int n, double *resid);
void pccheb(double d[], double c[], int n);
void pcshft(double a, double b, double d[], int n);
void pearsn(double x[], double y[], unsigned long n, double *r, double *prob,
	double *z);
void period(double x[], double y[], int n, double ofac, double hifac,
	double px[], double py[], int np, int *nout, int *jmax, double *prob);
void piksr2(int n, double arr[], double brr[]);
void piksrt(int n, double arr[]);
void pinvs(int ie1, int ie2, int je1, int jsf, int jc1, int k,
	double ***c, double **s);
double plgndr(int l, int m, double x);
double poidev(double xm, long *idum);
void polcoe(double x[], double y[], int n, double cof[]);
void polcof(double xa[], double ya[], int n, double cof[]);
void poldiv(double u[], int n, double v[], int nv, double q[], double r[]);
void polin2(double x1a[], double x2a[], double **ya, int m, int n,
	double x1, double x2, double *y, double *dy);
void polint(double xa[], double ya[], int n, double x, double *y, double *dy);
void powell(double p[], double **xi, int n, double ftol, int *iter, double *fret,
	double (*func)(double []));
void predic(double data[], int ndata, double d[], int m, double future[], int nfut);
double probks(double alam);
void psdes(unsigned long *lword, unsigned long *irword);
void pwt(double a[], unsigned long n, int isign);
void pwtset(int n);
double pythag(double a, double b);
void pzextr(int iest, double xest, double yest[], double yz[], double dy[],
	int nv);
double qgaus(double (*func)(double), double a, double b);
void qrdcmp(double **a, int n, double *c, double *d, int *sing);
double qromb(double (*func)(double), double a, double b);
double qromo(double (*func)(double), double a, double b,
	double (*choose)(double (*)(double), double, double, int));
void qroot(double p[], int n, double *b, double *c, double eps);
void qrsolv(double **a, int n, double c[], double d[], double b[]);
void qrupdt(double **r, double **qt, int n, double u[], double v[]);
double qsimp(double (*func)(double), double a, double b);
double qtrap(double (*func)(double), double a, double b);
double quad3d(double (*func)(double, double, double), double x1, double x2);
void quadct(double x, double y, double xx[], double yy[], unsigned long nn,
	double *fa, double *fb, double *fc, double *fd);
void quadmx(double **a, int n);
void quadvl(double x, double y, double *fa, double *fb, double *fc, double *fd);
double ran0(long *idum);
double ran1(long *idum);
double ran2(long *idum);
double ran3(long *idum);
double ran4(long *idum);
void rank(unsigned long n, unsigned long indx[], unsigned long irank[]);
void ranpt(double pt[], double regn[], int n);
void ratint(double xa[], double ya[], int n, double x, double *y, double *dy);
void ratlsq(double (*fn)(double), double a, double b, int mm, int kk,
	double cof[], double *dev);
double ratval(double x, double cof[], int mm, int kk);
double rc(double x, double y);
double rd(double x, double y, double z);
void realft(double data[], unsigned long n, int isign);
void rebin(double rc, int nd, double r[], double xin[], double xi[]);
void red(int iz1, int iz2, int jz1, int jz2, int jm1, int jm2, int jmf,
	int ic1, int jc1, int jcf, int kc, double ***c, double **s);
void relax(double **u, double **rhs, int n);
void relax2(double **u, double **rhs, int n);
void resid(double **res, double **u, double **rhs, int n);
double revcst(double x[], double y[], int iorder[], int ncity, int n[]);
void reverse(int iorder[], int ncity, int n[]);
double rf(double x, double y, double z);
double rj(double x, double y, double z, double p);
void rk4(double y[], double dydx[], int n, double x, double h, double yout[],
	void (*derivs)(double, double [], double []));
void rkck(double y[], double dydx[], int n, double x, double h,
	double yout[], double yerr[], void (*derivs)(double, double [], double []));
void rkdumb(double vstart[], int nvar, double x1, double x2, int nstep,
	void (*derivs)(double, double [], double []));
void rkqs(double y[], double dydx[], int n, double *x,
	double htry, double eps, double yscal[], double *hdid, double *hnext,
	void (*derivs)(double, double [], double []));
void rlft3(double ***data, double **speq, unsigned long nn1,
	unsigned long nn2, unsigned long nn3, int isign);
double rofunc(double b);
void rotate(double **r, double **qt, int n, int i, double a, double b);
void rsolv(double **a, int n, double d[], double b[]);
void rstrct(double **uc, double **uf, int nc);
double rtbis(double (*func)(double), double x1, double x2, double xacc);
double rtflsp(double (*func)(double), double x1, double x2, double xacc);
double rtnewt(void (*funcd)(double, double *, double *), double x1, double x2,
	double xacc);
double rtsafe(void (*funcd)(double, double *, double *), double x1, double x2,
	double xacc);
double rtsec(double (*func)(double), double x1, double x2, double xacc);
void rzextr(int iest, double xest, double yest[], double yz[], double dy[], int nv);
void savgol(double c[], int np, int nl, int nr, int ld, int m);
void score(double xf, double y[], double f[]);
void scrsho(double (*fx)(double));
//double select(unsigned long k, unsigned long n, double arr[]);
double selip(unsigned long k, unsigned long n, double arr[]);
void shell(unsigned long n, double a[]);
void shoot(int n, double v[], double f[]);
void shootf(int n, double v[], double f[]);
void simp1(double **a, int mm, int ll[], int nll, int iabf, int *kp,
	double *bmax);
void simp2(double **a, int n, int l2[], int nl2, int *ip, int kp, double *q1);
void simp3(double **a, int i1, int k1, int ip, int kp);
void simplx(double **a, int m, int n, int m1, int m2, int m3, int *icase,
	int izrov[], int iposv[]);
void simpr(double y[], double dydx[], double dfdx[], double **dfdy,
	int n, double xs, double htot, int nstep, double yout[],
	void (*derivs)(double, double [], double []));
void sinft(double y[], int n);
void slvsm2(double **u, double **rhs);
void slvsml(double **u, double **rhs);
void sncndn(double uu, double emmc, double *sn, double *cn, double *dn);
double snrm(unsigned long n, double sx[], int itol);
void sobseq(int *n, double x[]);
void solvde(int itmax, double conv, double slowc, double scalv[],
	int indexv[], int ne, int nb, int m, double **y, double ***c, double **s);
void sor(double **a, double **b, double **c, double **d, double **e,
	double **f, double **u, int jmax, double rjac);
void sort(unsigned long n, double arr[]);
void sort2(unsigned long n, double arr[], double brr[]);
void sort3(unsigned long n, double ra[], double rb[], double rc[]);
void spctrm(FILE *fp, double p[], int m, int k, int ovrlap);
void spear(double data1[], double data2[], unsigned long n, double *d, double *zd,
	double *probd, double *rs, double *probrs);
void sphbes(int n, double x, double *sj, double *sy, double *sjp, double *syp);
void splie2(double x1a[], double x2a[], double **ya, int m, int n, double **y2a);
void splin2(double x1a[], double x2a[], double **ya, double **y2a, int m, int n,
	double x1, double x2, double *y);
void spline(double x[], double y[], int n, double yp1, double ypn, double y2[]);
void splint(double xa[], double ya[], double y2a[], int n, double x, double *y);
void spread(double y, double yy[], unsigned long n, double x, int m);
void sprsax(double sa[], unsigned long ija[], double x[], double b[],
	unsigned long n);
void sprsin(double **a, int n, double thresh, unsigned long nmax, double sa[],
	unsigned long ija[]);
void sprspm(double sa[], unsigned long ija[], double sb[], unsigned long ijb[],
	double sc[], unsigned long ijc[]);
void sprstm(double sa[], unsigned long ija[], double sb[], unsigned long ijb[],
	double thresh, unsigned long nmax, double sc[], unsigned long ijc[]);
void sprstp(double sa[], unsigned long ija[], double sb[], unsigned long ijb[]);
void sprstx(double sa[], unsigned long ija[], double x[], double b[],
	unsigned long n);
void stifbs(double y[], double dydx[], int nv, double *xx,
	double htry, double eps, double yscal[], double *hdid, double *hnext,
	void (*derivs)(double, double [], double []));
void stiff(double y[], double dydx[], int n, double *x,
	double htry, double eps, double yscal[], double *hdid, double *hnext,
	void (*derivs)(double, double [], double []));
void stoerm(double y[], double d2y[], int nv, double xs,
	double htot, int nstep, double yout[],
	void (*derivs)(double, double [], double []));
void svbksb(double **u, double w[], double **v, int m, int n, double b[],
	double x[]);
void svdcmp(double **a, int m, int n, double w[], double **v);
void svdfit(double x[], double y[], double sig[], int ndata, double a[],
	int ma, double **u, double **v, double w[], double *chisq,
	void (*funcs)(double, double [], int));
void svdvar(double **v, int ma, double w[], double **cvm);
void toeplz(double r[], double x[], double y[], int n);
void tptest(double data1[], double data2[], unsigned long n, double *t, double *prob);
void tqli(double d[], double e[], int n, double **z);
double trapzd(double (*func)(double), double a, double b, int n);
void tred2(double **a, int n, double d[], double e[]);
void tridag(double a[], double b[], double c[], double r[], double u[],
	unsigned long n);
double trncst(double x[], double y[], int iorder[], int ncity, int n[]);
void trnspt(int iorder[], int ncity, int n[]);
void ttest(double data1[], unsigned long n1, double data2[], unsigned long n2,
	double *t, double *prob);
void tutest(double data1[], unsigned long n1, double data2[], unsigned long n2,
	double *t, double *prob);
void twofft(double data1[], double data2[], double fft1[], double fft2[],
	unsigned long n);
void vander(double x[], double w[], double q[], int n);
void vegas(double regn[], int ndim, double (*fxn)(double [], double), int init,
	unsigned long ncall, int itmx, int nprn, double *tgral, double *sd,
	double *chi2a);
void voltra(int n, int m, double t0, double h, double *t, double **f,
	double (*g)(int, double), double (*ak)(int, int, double, double));
void wt1(double a[], unsigned long n, int isign,
	void (*wtstep)(double [], unsigned long, int));
void wtn(double a[], unsigned long nn[], int ndim, int isign,
	void (*wtstep)(double [], unsigned long, int));
void wwghts(double wghts[], int n, double h,
	void (*kermom)(double [], double ,int));
int zbrac(double (*func)(double), double *x1, double *x2);
void zbrak(double (*fx)(double), double x1, double x2, int n, double xb1[],
	double xb2[], int *nb);
double zbrent(double (*func)(double), double x1, double x2, double tol);
void zrhqr(double a[], int m, double rtr[], double rti[]);
double zriddr(double (*func)(double), double x1, double x2, double xacc);
void zroots(fcomplex a[], int m, fcomplex roots[], int polish);

#else /* ANSI */
/* traditional - K&R */

void addint();
void airy();
void amebsa();
void amoeba();
double amotry();
double amotsa();
void anneal();
double anorm2();
void arcmak();
void arcode();
void arcsum();
void asolve();
void atimes();
void avevar();
void balanc();
void banbks();
void bandec();
void banmul();
void bcucof();
void bcuint();
void beschb();
double bessi();
double bessi0();
double bessi1();
void bessik();
double bessj();
double bessj0();
double bessj1();
void bessjy();
double bessk();
double bessk0();
double bessk1();
double bessy();
double bessy0();
double bessy1();
double beta();
double betacf();
double betai();
double bico();
void bksub();
double bnldev();
double brent();
void broydn();
void bsstep();
void caldat();
void chder();
double chebev();
void chebft();
void chebpc();
void chint();
double chixy();
void choldc();
void cholsl();
void chsone();
void chstwo();
void cisi();
void cntab1();
void cntab2();
void convlv();
void copy();
void correl();
void cosft();
void cosft1();
void cosft2();
void covsrt();
void crank();
void cyclic();
void daub4();
double dawson();
double dbrent();
void ddpoly();
int decchk();
void derivs();
double df1dim();
void dfour1();
void dfpmin();
double dfridr();
void dftcor();
void dftint();
void difeq();
void dlinmin();
double dpythag();
void drealft();
void dsprsax();
void dsprstx();
void dsvbksb();
void dsvdcmp();
void eclass();
void eclazz();
double ei();
void eigsrt();
double elle();
double ellf();
double ellpi();
void elmhes();
double erfcc();
double erff();
double erffc();
void eulsum();
double evlmem();
double expdev();
double expint();
double f1();
double f1dim();
double f2();
double f3();
double factln();
double factrl();
void fasper();
void fdjac();
void fgauss();
void fill0();
void fit();
void fitexy();
void fixrts();
void fleg();
void flmoon();
//double fmin();
void four1();
void fourew();
void fourfs();
void fourn();
void fpoly();
void fred2();
double fredin();
void frenel();
void frprmn();
void ftest();
double gamdev();
double gammln();
double gammp();
double gammq();
double gasdev();
void gaucof();
void gauher();
void gaujac();
void gaulag();
void gauleg();
void gaussj();
void gcf();
double golden();
void gser();
void hpsel();
void hpsort();
void hqr();
void hufapp();
void hufdec();
void hufenc();
void hufmak();
void hunt();
void hypdrv();
fcomplex hypgeo();
void hypser();
unsigned short icrc();
unsigned short icrc1();
int igray();
void iindexx();
void indexx();
void interp();
int irbit1();
int irbit2();
void jacobi();
void jacobn();
long julday();
void kendl1();
void kendl2();
void kermom();
void ks2d1s();
void ks2d2s();
void ksone();
void kstwo();
void laguer();
void lfit();
void linbcg();
void linmin();
void lnsrch();
void load();
void load1();
void load2();
void locate();
void lop();
void lubksb();
void ludcmp();
void machar();
void matadd();
void matsub();
void medfit();
void memcof();
int metrop();
void mgfas();
void mglin();
double midexp();
double midinf();
double midpnt();
double midsql();
double midsqu();
void miser();
void mmid();
void mnbrak();
void mnewt();
void moment();
void mp2dfr();
void mpadd();
void mpdiv();
void mpinv();
void mplsh();
void mpmov();
void mpmul();
void mpneg();
void mppi();
void mprove();
void mpsad();
void mpsdv();
void mpsmu();
void mpsqrt();
void mpsub();
void mrqcof();
void mrqmin();
void newt();
void odeint();
void orthog();
void pade();
void pccheb();
void pcshft();
void pearsn();
void period();
void piksr2();
void piksrt();
void pinvs();
double plgndr();
double poidev();
void polcoe();
void polcof();
void poldiv();
void polin2();
void polint();
void powell();
void predic();
double probks();
void psdes();
void pwt();
void pwtset();
double pythag();
void pzextr();
double qgaus();
void qrdcmp();
double qromb();
double qromo();
void qroot();
void qrsolv();
void qrupdt();
double qsimp();
double qtrap();
double quad3d();
void quadct();
void quadmx();
void quadvl();
double ran0();
double ran1();
double ran2();
double ran3();
double ran4();
void rank();
void ranpt();
void ratint();
void ratlsq();
double ratval();
double rc();
double rd();
void realft();
void rebin();
void red();
void relax();
void relax2();
void resid();
double revcst();
void reverse();
double rf();
double rj();
void rk4();
void rkck();
void rkdumb();
void rkqs();
void rlft3();
double rofunc();
void rotate();
void rsolv();
void rstrct();
double rtbis();
double rtflsp();
double rtnewt();
double rtsafe();
double rtsec();
void rzextr();
void savgol();
void score();
void scrsho();
double select();
double selip();
void shell();
void shoot();
void shootf();
void simp1();
void simp2();
void simp3();
void simplx();
void simpr();
void sinft();
void slvsm2();
void slvsml();
void sncndn();
double snrm();
void sobseq();
void solvde();
void sor();
void sort();
void sort2();
void sort3();
void spctrm();
void spear();
void sphbes();
void splie2();
void splin2();
void spline();
void splint();
void spread();
void sprsax();
void sprsin();
void sprspm();
void sprstm();
void sprstp();
void sprstx();
void stifbs();
void stiff();
void stoerm();
void svbksb();
void svdcmp();
void svdfit();
void svdvar();
void toeplz();
void tptest();
void tqli();
double trapzd();
void tred2();
void tridag();
double trncst();
void trnspt();
void ttest();
void tutest();
void twofft();
void vander();
void vegas();
void voltra();
void wt1();
void wtn();
void wwghts();
int zbrac();
void zbrak();
double zbrent();
void zrhqr();
double zriddr();
void zroots();

#endif /* ANSI */

#endif /* _NR_H_ */

redpajama_set_name: RedPajamaGithub


text:
using System;
using System.Windows;
using System.Windows.Controls;
using SuperMap.Web.Mapping;
using SuperMap.Web.Core;

namespace iServerJava6R_SampleCode
{
    public partial class TDTMapTest : Page
    {
        String m_layerType = "vec";
        String m_projection = "900913";

        public TDTMapTest()
        {
            InitializeComponent();
        }

        private void comboBoxProjType_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (comboBoxProjType != null)
            {
                if (comboBoxProjType.SelectedIndex == 0)
                {
                    m_layerType = "vec";
                }
                else if (comboBoxProjType.SelectedIndex == 1)
                {
                    m_layerType = "img";
                }
                else if (comboBoxProjType.SelectedIndex == 2)
                {
                    m_layerType = "ter";
                }
                RefreshMap();
            }

        }

        private void comboBoxMapType_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (comboBoxMapType != null)
            {
                if (comboBoxMapType.SelectedIndex == 0)
                {
                    m_projection = "900913";
                }
                else if (comboBoxMapType.SelectedIndex == 1)
                {
                    m_projection = "4326";
                }
                RefreshMap();
            }
        }
        //移除图层重新加载
        private void RefreshMap()
        {
            myMap.Layers.Clear();
            TileTDTMapsLayer layer1 = new TileTDTMapsLayer();
            layer1.LayerType = m_layerType;
            layer1.Projection = m_projection;
            TileTDTMapsLayer layer2 = new TileTDTMapsLayer();
            layer2.IsLabel = true;
            layer2.LayerType = m_layerType;
            layer2.Projection = m_projection;
            myMap.Layers.Add(layer1);
            myMap.Layers.Add(layer2);
        }
    }

    public class TileTDTMapsLayer : TiledCachedLayer
    {
        //是否是标签图层
        private Boolean isLabel = false;

        //投影坐标系,天地图支持4326和3857两种,分别对应EPSG:4326和EPSG:900913
        private string projection = "900913";

        //EPSG:4326对应的是c,而EPSG:900913对应的是w
        private string proj = "c";
        //vec:矢量图层,cva:矢量标签图层,img:影像图层,cia:影像标签图层,ter:地形,cta:地形标签图层
        private string layerType = "vec";
        private Int32 levelOffset = 1;
        private const string URL = "http://t{subdomain}.tianditu.com/DataServer?T={layerType}_{proj}&x={tileX}&y={tileY}&l={level}";

        //定义基本URL
        private string[] subDomains = { "0", "1", "2", "3", "4", "5" };

        public Boolean IsLabel
        {
            get { return this.isLabel; }
            set { this.isLabel = value; }
        }
        public string Projection
        {
            get { return this.projection; }
            set { this.projection = value; RefreshResolutions(); }
        }

        //定义地图类型的依赖属性,只允许设置为
        public string LayerType
        {
            get { return this.layerType; }
            set { this.layerType = value; }
        }

        private static void OnMapTypePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            TileTDTMapsLayer layer = d as TileTDTMapsLayer;
            if (layer.IsInitialized)
            {
                layer.ChangeTileSource();
            }
        }

        //改变地图类型触发刷新
        private void ChangeTileSource()
        {
            if (!base.IsInitialized)
            {
                base.Initialize();
            }
            else
            {
                base.Refresh();
            }
        }

        public TileTDTMapsLayer()
        { }

        public override void Initialize()
        {
            this.Url = TileTDTMapsLayer.URL;
            RefreshResolutions();

            base.Initialize();
        }
        private void RefreshResolutions()
        {
            string lt = this.layerType;
            Int32 resStart = 0;
            Int32 resLength = 0;
            if (lt == "vec")
            {
                resStart = 0;
                resLength = 17;
                this.levelOffset = 1;
            }
            else if (lt == "img")
            {
                resStart = 1;
                resLength = 17;
                this.levelOffset = 2;
            }
            else if (lt == "ter")
            {
                resStart = 0;
                resLength = 13;
                this.levelOffset = 1;
            }
            this.Resolutions = new double[resLength + 1 - resStart];
            if (this.projection == "4326")
            {
                this.Bounds = new Rectangle2D(-179.99999999999997, -90.0, 180.00000000000023, 89.99999999999994);
                this.Origin = new Point2D(-180, 90);
                for (Int32 i = resStart; i <= resLength; i++)
                {
                    this.Resolutions[i - resStart] = (1.40625 / 2 / Math.Pow(2, i));
                }
                this.proj = "c";
            }
            //EPSG:900913
            else
            {
                this.Bounds = new Rectangle2D(-20037508.3392, -20037508.3392, 20037508.3392, 20037508.3392);
                this.Origin = new Point2D(-20037508.3392, 20037508.3392);

                for (Int32 i = resStart; i <= resLength; i++)
                {

                    this.Resolutions[i - resStart] = (156543.0339 / 2 / Math.Pow(2, i));
                }
                this.proj = "w";
            }
        }

        //重写返回Url函数
        public override string GetTileUrl(int indexX, int indexY, int level)
        {
            level += this.levelOffset;
            string serverURL = TileTDTMapsLayer.URL;
			string lt = this.layerType;
			if(this.isLabel){
				if(lt=="vec")lt = "cva";
				if(lt=="img")lt = "cia";
				if(lt=="ter")lt = "cta";
			}
            Random random =new Random();
			serverURL = serverURL.Replace("{subdomain}", Math.Round(random.NextDouble() * 7).ToString());
			serverURL = serverURL.Replace("{tileX}", indexX.ToString());
			serverURL = serverURL.Replace("{tileY}", indexY.ToString());
			serverURL = serverURL.Replace("{level}", level.ToString());
			serverURL = serverURL.Replace("{proj}", this.proj);
			serverURL = serverURL.Replace("{layerType}", lt);
            return serverURL;
        }

    }
}


text:
from __future__ import unicode_literals

import django.contrib.gis.db.models.fields
from django.db import migrations, models

class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='Airspace',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('ident', models.CharField(blank=True, max_length=16)),
                ('name', models.CharField(max_length=128)),
                ('upper_desc', models.CharField(max_length=16)),
                ('upper_val', models.IntegerField()),
                ('upper_uom', models.CharField(blank=True, max_length=16)),
                ('upper_code', models.CharField(blank=True, max_length=16)),
                ('lower_desc', models.CharField(max_length=16)),
                ('lower_val', models.IntegerField()),
                ('lower_uom', models.CharField(blank=True, max_length=16)),
                ('lower_code', models.CharField(blank=True, max_length=16)),
                ('type_code', models.CharField(max_length=16)),
                ('local_type', models.CharField(max_length=16)),
                ('airspace_class', models.CharField(max_length=16)),
                ('mil_code', models.CharField(max_length=16)),
                ('comm_name', models.CharField(blank=True, max_length=128)),
                ('level', models.CharField(max_length=16)),
                ('sector', models.CharField(blank=True, max_length=64)),
                ('onshore', models.IntegerField()),
                ('exclusion', models.IntegerField()),
                ('wkhr_code', models.CharField(max_length=16)),
                ('wkhr_remark', models.CharField(blank=True, max_length=128)),
                ('mpoly', django.contrib.gis.db.models.fields.MultiPolygonField(srid=4326)),
            ],
        ),
    ]


text:
package my.alphatheta.locasee.api.retrofit2;

import okhttp3.ResponseBody;
import retrofit2.Call;
import retrofit2.http.*;

import java.util.Map;

/**
 * Interface for Sourcing requests under api/data/
 */
public interface Sourcing {
    String SUBPATH = "data"; //As per the name data store. Sourcing is the verb. Don't ask why.

    // TODO: Spliced usage to primarily utilize Place only and mechanized extra components response via typed component names in query parameter

    @GET(SUBPATH + "/{sourceName}/{sourceRefId}")
    Call<ResponseBody> getPlaceComposite(@Path("sourceName") final String sourceName, @Path("sourceRefId") final String sourceRefId);

    @POST(SUBPATH + "/{sourceName}/{sourceRefId}")
    Call<ResponseBody> updatePlaceComposite(@Path("sourceName") final String sourceName, @Path("sourceRefId") final String sourceRefId, @QueryMap final Map<String, String> queryMap);

    /**
     * Search Locasee for places that matches the provided query map.
     *
     * @param queryMap         Query parameters. Use {@link LocaseeUtil#getParameterizedQueryMap(Object)} by
     *                         passing a new Place and declare the fields that will be used in the search.
     * @param resultCountLimit Optional limit to limit the amount of results returned. Can be zero.
     * @return A list of {@link my.alphatheta.locasee.api.composite.PlaceComposite} in json
     */
    @GET(SUBPATH + "/search")
    Call<ResponseBody> searchPlaceComposite(@QueryMap final Map<String, String> queryMap, @Query("limit") int resultCountLimit);
}


text:
SYNONYM

#### According to
Index Fungorum

#### Published in
null

#### Original name
Tryblidium elasticae Koord.

### Remarks
null


text:
package org.uberfire.client.workbench.annotations;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import javax.inject.Qualifier;

import org.uberfire.client.workbench.type.ClientResourceType;

/**
 * Definition of a supported resource types
 */
@Qualifier
@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.TYPE })
public @interface AssociatedResources {

    Class<? extends ClientResourceType>[] value();

}


text:
Most of the operators accept a list of functional options to impact the Observable behaviour.

As an example:

```go
observable.Map(func(_ context.Context, i interface{}) (interface{}, error) {
	return i.(int) * 10, nil
}, rxgo.WithContext(),
   rxgo.WithCPUPool(),
   rxgo.WithBufferedChannel(1))
```

## WithBufferedChannel

Configure the capacity of the output channel.

```go
rxgo.WithBufferedChannel(1) // Create a buffered channel with a 1 capacity
```

## WithContext

Allows passing a context. The Observable will listen to its done signal to close itself.

```go
rxgo.WithContext(ctx)
```

## WithObservationStrategy

* Lazy (default): consume when an Observer starts to subscribe.

```go
rxgo.WithObservation(rxgo.Lazy)
```

* Eager: consumer when the Observable is created:

```go
rxgo.WithObservation(rxgo.Eager)
```

## WithErrorStrategy

* StopOnError (default): stop processing if the Observable produces an error.

```go
rxgo.WithErrorStrategy(rxgo.StopOnError)
```

* ContinueOnError: continue processing items if the Observable produces an error.

```go
rxgo.WithErrorStrategy(rxgo.ContinueOnError)
```

This strategy is propagated to the parent(s) Observable(s).

## WithPool

Convert the operator in a parallel operator and specify the number of concurrent goroutines.

```go
rxgo.WithPool(8) // Creates a pool of 8 goroutines
```

## WithCPUPool

Convert the operator in a parallel operator and specify the number of concurrent goroutines as `runtime.NumCPU()`.

```go
rxgo.WithCPUPool()
```

## Serialize

Force an Observable to produce items sequentially.

```go
rxgo.Serialize()
```

This option should be used in coordination with `rxgo.WithPool(n)` or `rxgo.WithCPUPool()`.

## WithPublishStrategy

Create a [Connectable Observable](../README.md#connectable-observable).

```go
rxgo.WithPublishStrategy()
```

This option is propagated to the parent(s) Observable(s).


text:
<?php
/**
 * English Upgrades Lexicon Topic for Revolution setup.
 *
 * @package setup
 * @subpackage lexicon
 */
$_lang['add_column'] = 'Aggiunte `[[+column]]` nuove colonne a `[[+table]]`.';
$_lang['add_index'] = 'Aggiunto nuovo indice su `[[+index]]` per la tabella `[[+table]]`.';
$_lang['add_moduser_classkey'] = 'Aggiunto il campo class_key per supportare derivati di modUser.';
$_lang['added_cachepwd'] = 'Aggiunto campo cachepwd mancante nelle prime releases di Revolution.';
$_lang['added_content_ft_idx'] = 'Aggiunto nuovo indice full-text `content_ft_idx` sui campi `pagetitle`, `longtitle`, `description`, `introtext`, `content`.';
$_lang['allow_null_properties'] = 'Correzione per consentire null per `[[+class]]`.`properties`.';
$_lang['alter_activeuser_action'] = 'Modificato il campo modActiveUser `action` per consentire etichette azione piu\' lunghe.';
$_lang['alter_usermessage_messageread'] = 'Cambiato il campo modUserMessage `messageread` in `read`.';
$_lang['alter_usermessage_postdate'] = 'Cambiato il campo modUserMessage `postdate` da INT a DATETIME e rinominato `date_sent`.';
$_lang['alter_usermessage_subject'] = 'Cambiato il campo modUserMessage `subject` da VARCHAR(60) a VARCHAR(255).';
$_lang['change_column'] = 'Cambiato il campo `[[+old]]` in `[[+new]]` nella tabella `[[+table]]`.';
$_lang['change_default_value'] = 'Cambiato il valore di default per la colonna `[[+column]]` in "[[+value]]" nella tabella `[[+table]]`.';
$_lang['connector_acls_removed'] = 'Rimosso connettore contesto ACLs.';
$_lang['connector_acls_not_removed'] = 'Non e\' stato possibile rimuovere connettore contesto ACLs.';
$_lang['connector_ctx_removed'] = '';
$_lang['connector_ctx_not_removed'] = 'Non e\' stato possibile rimuovere connettore contesto.';
$_lang['data_remove_error'] = 'Errore durante la rimozione dei dati per la classe `[[+class]]`.';
$_lang['data_remove_success'] = 'Rimossi con successo i dati dalla tabella per la classe `[[+class]]`.';
$_lang['drop_column'] = 'Eliminata colonna `[[+column]]` dalla tabella `[[+table]]`.';
$_lang['drop_index'] = 'Eliminato indice `[[+index]]` nella tabella `[[+table]]`.';
$_lang['lexiconentry_createdon_null'] = 'Cambiato il campo modLexiconEntry `createdon` per consentire NULL.';
$_lang['lexiconentry_focus_alter'] = 'Cambiato modLexiconEntry `focus` da VARCHAR(100) a INT(10).';
$_lang['lexiconentry_focus_alter_int'] = 'Aggiornati i dati della colonna modLexiconEntry `focus` da stringa a nuova chiave esterna intera da modLexiconTopic.';
$_lang['lexiconfocus_add_id'] = 'Aggiunta colonna modLexiconFocus `id`.';
$_lang['lexiconfocus_add_pk'] = 'Aggiunta chiave primaria modLexiconFocus PRIMARY KEY alla colonna `id`.';
$_lang['lexiconfocus_alter_pk'] = 'Cambiato modLexiconFocus `name` da PRIMARY KEY a UNIQUE KEY';
$_lang['lexiconfocus_drop_pk'] = 'Eliminata la chiave primaria modLexiconFocus PRIMARY KEY.';
$_lang['modify_column'] = 'Colonna `[[+column]]` modificata da `[[+old]]` a `[[+new]]` nella tabella `[[+table]]`';
$_lang['rename_column'] = 'Rinominata colonna `[[+old]]` in `[[+new]]` nella tabella `[[+table]]`.';
$_lang['rename_table'] = 'Rinominata la tabella `[[+old]]` in `[[+new]]`.';
$_lang['remove_fulltext_index'] = 'Rimosso indice full-text `[[+index]]`.';
$_lang['systemsetting_xtype_fix'] = 'Corretto con successo xtypes per modSystemSettings.';
$_lang['transportpackage_manifest_text'] = 'Modificata colonna `manifest` in TEXT da MEDIUMTEXT su `[[+class]]`.';
$_lang['update_closure_table'] = 'Aggiornamento closure table data per la classe `[[+class]]`.';
$_lang['update_table_column_data'] = 'Aggiornati i dati nella colonna [[+column]] della tabella [[+table]] ( [[+class]] )';
$_lang['iso_country_code_converted'] = 'Convertiti correttamente i nomi delle nazioni per il profilo utente nei codici ISO.';
$_lang['legacy_cleanup_complete'] = 'Legacy file clean up complete.';
$_lang['legacy_cleanup_count'] = 'Removed [[+files]] file(s) and [[+folders]] folder(s).';


text:
<!doctype html>

  <meta charset="UTF-8">
  <title>Example - example-text-input-directive-production</title>

<form name="myForm" ng-controller="ExampleController">
  Single word:
    <input type="text" name="input" ng-model="example.text"
           ng-pattern="example.word" required ng-trim="false">

      Required!

      Single word only!

  text = {{example.text}}

  myForm.input.$valid = {{myForm.input.$valid}}

  myForm.input.$error = {{myForm.input.$error}}

  myForm.$valid = {{myForm.$valid}}

  myForm.$error.required = {{!!myForm.$error.required}}

 </form>


text:
package org.codehaus.groovy.control;

/**
* The phases of the GroovyCompiler. This is an enum facade on top of the
* Phases object. In general, prefer using this object over Phases.
*/
public enum CompilePhase {

    /**
    * source files are opened and environment configured
    */
    INITIALIZATION(Phases.INITIALIZATION),

    /**
    * the grammar is used to produce tree of tokens representing the source code
    */
    PARSING(Phases.PARSING),

    /**
    * An abstract syntax tree (AST) is created from token trees
    */
    CONVERSION(Phases.CONVERSION),

    /**
    * Performs consistency and validity checks that the grammar can't check for, and resolves classes
    */
    SEMANTIC_ANALYSIS(Phases.SEMANTIC_ANALYSIS),

    /**
    * Complete building the AST
    */
    CANONICALIZATION(Phases.CANONICALIZATION),

    /**
    * instruction set is chosen, for example java5 or pre java5
    */
    INSTRUCTION_SELECTION(Phases.INSTRUCTION_SELECTION),

    /**
    * creates the binary output in memory
    */
    CLASS_GENERATION(Phases.CLASS_GENERATION),

    /**
    * write the binary output to the file system
    */
    OUTPUT(Phases.OUTPUT),

    /**
    * Perform any last cleanup
    */
    FINALIZATION(Phases.FINALIZATION),
    ;

    /**
    * The phases as an array, with a null entry.
    */
    public static CompilePhase[] phases = {
        null,
        INITIALIZATION,
        PARSING,
        CONVERSION,
        SEMANTIC_ANALYSIS,
        CANONICALIZATION,
        INSTRUCTION_SELECTION,
        CLASS_GENERATION,
        OUTPUT,
        FINALIZATION,
    };

    int phaseNumber;
    CompilePhase(int phaseNumber) {
        this.phaseNumber = phaseNumber;
    }

    /**
    * Returns the underlying integer Phase number.
    */
    public int getPhaseNumber() {
        return phaseNumber;
    }

    /**
     * Returns the CompilePhase for the given integer phase number.
     * @param phaseNumber
     *      the phase number
     * @return
     *      the CompilePhase or null if not found
     */
    public static CompilePhase fromPhaseNumber(int phaseNumber) {
        for (CompilePhase phase : values()) {
            if (phase.phaseNumber == phaseNumber) {
                return phase;
            }
        }
        return null;
    }
}


text:
package db

import (
	"fmt"
	"hash/fnv"
	"time"
)

type Message interface {
	Time() time.Time
	SetTime(t time.Time)
	UnixNano() int64

	HashID() uint64
	Key() []byte

	Data() []byte
	SetData(buf []byte)

	String() string
}

// message is the default implementation of Message.
type message struct {
	time time.Time

	key []byte

	// text encoding of timestamp
	ts []byte

	// binary encoded field data
	data []byte
}

func ParseMessagesString(buf string) ([]Message, error) {
	return ParseMessages([]byte(buf))
}

func ParseMessages(buf []byte) ([]Message, error) {
	messages := []Message{}
	var (
		pos   int
		block []byte
	)
	for {
		pos, block = scanTo(buf, pos, '\n')
		pos++

		if len(block) == 0 {
			break
		}

		if start := skipWhitespace(block, 0); block[start] == '#' {
			continue
		}

		m, err := parseMessage(buf, time.Now().UTC())
		if err != nil {
			return nil, fmt.Errorf("unable to parse '%s': %v", string(block), err)
		}
		messages = append(messages, m)

		if pos >= len(buf) {
			break
		}
	}

	return messages, nil
}

func parseMessage(buf []byte, defaultTime time.Time) (Message, error) {
	return nil, nil
}

func NewMessage(time time.Time) Message {
	//TODO: fix this here
	return &message{time: time}
}

func (m *message) Data() []byte {
	return m.data
}
func (m *message) SetData(b []byte) {
	m.data = b
}
func (m *message) Key() []byte {
	return m.key
}

func (m *message) Time() time.Time {
	return m.time
}

func (m *message) SetTime(t time.Time) {
	m.time = t
}

func (m *message) UnixNano() int64 {
	return m.Time().UnixNano()
}

func (m *message) HashID() uint64 {
	h := fnv.New64a()
	h.Write(m.key)
	sum := h.Sum64()
	return sum
}

func (m *message) String() string {
	return fmt.Sprintf("%s %d", m.Key(), m.UnixNano())
}

// skipWhitespace returns the end position within buf, starting at i after
// scanning over spaces in tags
func skipWhitespace(buf []byte, i int) int {
	for {
		if i >= len(buf) {
			return i
		}

		if buf[i] == '\\' {
			i += 2
			continue
		}
		if buf[i] == ' ' || buf[i] == '\t' {
			i++
			continue
		}
		break
	}
	return i
}

// scanTo returns the end position in buf and the next consecutive block
// of bytes, starting from i and ending with stop byte.  If there are leading
// spaces or escaped chars, they are skipped.
func scanTo(buf []byte, i int, stop byte) (int, []byte) {
	start := i
	for {
		// reached the end of buf?
		if i >= len(buf) {
			break
		}

		if buf[i] == '\\' {
			i += 2
			continue
		}

		// reached end of block?
		if buf[i] == stop {
			break
		}
		i++
	}

	return i, buf[start:i]
}


text:
/* eslint-disable */
import { listenTo, createRef } from './helpers';

export default function onChildChanged(path, sequence,  options = {}) {
  listenTo(createRef(path, options), path, 'child_changed', sequence,  data => {
    this.context.controller.getSequence(sequence)(
      Object.assign(
        {
          key: data.key,
          value: data.val()
        },
        options.payload || {}
      )
    );
  });
}


text:
#include "tensorflow/compiler/xla/tests/client_library_test_base.h"

#include <memory>
#include <string>
#include <utility>

#include "absl/strings/str_cat.h"
#include "tensorflow/compiler/xla/client/client_library.h"
#include "tensorflow/compiler/xla/client/local_client.h"
#include "tensorflow/compiler/xla/client/xla_builder.h"
#include "tensorflow/compiler/xla/execution_options_util.h"
#include "tensorflow/compiler/xla/literal_util.h"
#include "tensorflow/compiler/xla/service/platform_util.h"
#include "tensorflow/compiler/xla/shape_util.h"
#include "tensorflow/compiler/xla/status_macros.h"
#include "tensorflow/compiler/xla/statusor.h"
#include "tensorflow/compiler/xla/test_helpers.h"
#include "tensorflow/tsl/platform/logging.h"

namespace xla {
namespace {

// Name of the interpreter backend.
constexpr char kInterpreter[] = "interpreter";

// Wrapper function that creates a nicer error message (than a bare
// value()) if the platform we intend to test is not available.
LocalClient* GetOrCreateLocalClientOrDie(
    const LocalClientOptions& client_options) {
  StatusOr<LocalClient*> result =
      ClientLibrary::GetOrCreateLocalClient(client_options);
  TF_CHECK_OK(result.status()) << " could not create local client for testing";
  return result.value();
}

// Helper functions to get the reference platform.
se::Platform* GetReferencePlatform() {
  auto result = PlatformUtil::GetPlatform(kInterpreter);
  TF_CHECK_OK(result.status()) << "could not get interpreter platform";
  return result.value();
}

}  // namespace

ClientLibraryTestBase::ClientLibraryTestBase(
    se::Platform* platform, const LocalClientOptions& client_options)
    : client_(GetOrCreateLocalClientOrDie(client_options)),
      execution_options_(CreateDefaultExecutionOptions()) {
  CHECK_EQ(platform, client_options.platform());

  LocalClientOptions ref_options;
  ref_options.set_platform(GetReferencePlatform());
  ref_client_ = GetOrCreateLocalClientOrDie(ref_options);

  // Disabling constant_folding so that tests (usually written using Constants)
  // will exercise the intended code paths, instead of being constant folded.
  //
  // TODO(b/38354253): Constant folding is currently disabled. Change tests to
  // use Parameters instead of Constants, and re-enable constant folding by
  // default.
  execution_options_.mutable_debug_options()->add_xla_disable_hlo_passes(
      "constant_folding");

  execution_options_.mutable_debug_options()
      ->set_xla_hlo_evaluator_use_fast_path(true);
}

ClientLibraryTestBase::ClientLibraryTestBase(se::Platform* platform)
    : execution_options_(CreateDefaultExecutionOptions()) {
  LocalClientOptions default_options;
  default_options.set_platform(platform);
  client_ = GetOrCreateLocalClientOrDie(default_options);

  LocalClientOptions ref_options;
  ref_options.set_platform(GetReferencePlatform());
  ref_client_ = GetOrCreateLocalClientOrDie(ref_options);

  execution_options_.mutable_debug_options()->add_xla_disable_hlo_passes(
      "constant_folding");

  execution_options_.mutable_debug_options()
      ->set_xla_hlo_evaluator_use_fast_path(true);
}

std::string ClientLibraryTestBase::TestName() const {
  return ::testing::UnitTest::GetInstance()->current_test_info()->name();
}

StatusOr<std::unique_ptr<GlobalData>> ClientLibraryTestBase::Execute(
    XlaBuilder* builder, absl::Span<GlobalData* const> arguments) {
  // Build the computation, as a convenience.
  TF_ASSIGN_OR_RETURN(auto computation, builder->Build());
  return client_->Execute(computation, arguments, &execution_options_);
}

StatusOr<Literal> ClientLibraryTestBase::ExecuteAndTransfer(
    const XlaComputation& computation, absl::Span<GlobalData* const> arguments,
    const Shape* shape_with_output_layout) {
  ExecutionOptions execution_options = execution_options_;
  if (shape_with_output_layout != nullptr) {
    *execution_options.mutable_shape_with_output_layout() =
        shape_with_output_layout->ToProto();
  }
  return client_->ExecuteAndTransfer(computation, arguments,
                                     &execution_options);
}

StatusOr<Literal> ClientLibraryTestBase::ExecuteAndTransfer(
    XlaBuilder* builder, absl::Span<GlobalData* const> arguments,
    const Shape* shape_with_output_layout) {
  // Build the computation, as a convenience.
  TF_ASSIGN_OR_RETURN(auto computation, builder->Build());
  return ExecuteAndTransfer(computation, arguments, shape_with_output_layout);
}

StatusOr<Literal> ClientLibraryTestBase::ExecuteAndTransferReference(
    const XlaComputation& computation, absl::Span<GlobalData* const> arguments,
    const Shape* shape_with_output_layout) {
  ExecutionOptions execution_options = execution_options_;
  if (shape_with_output_layout != nullptr) {
    *execution_options.mutable_shape_with_output_layout() =
        shape_with_output_layout->ToProto();
  }
  execution_options.clear_device_handles();
  return ref_client_->ExecuteAndTransfer(computation, arguments,
                                         &execution_options);
}

std::string ClientLibraryTestBase::ExecuteToString(
    XlaBuilder* builder, absl::Span<GlobalData* const> arguments) {
  auto computation_status = builder->Build();
  if (!computation_status.ok()) {
    return computation_status.status().ToString();
  }
  auto computation = std::move(computation_status).value();

  auto result =
      client_->ExecuteAndTransfer(computation, arguments, &execution_options_);
  if (!result.ok()) {
    return result.status().ToString();
  } else {
    return result.value().ToString();
  }
}

void ClientLibraryTestBase::ComputeAndCompareR1(
    XlaBuilder* builder, const tsl::core::Bitmap& expected,
    absl::Span<GlobalData* const> arguments) {
  Literal expected_literal = LiteralUtil::CreateR1(expected);
  ClientLibraryTestBase::ComputeAndCompareLiteral(builder, expected_literal,
                                                  arguments);
}

void ClientLibraryTestBase::ComputeAndCompareLiteral(
    XlaBuilder* builder, const Literal& expected,
    absl::Span<GlobalData* const> arguments, const Shape* shape_with_layout) {
  EXPECT_IS_OK(ComputeAndCompareLiteralWithStatus(builder, expected, arguments,
                                                  shape_with_layout));
}

void ClientLibraryTestBase::ComputeAndCompareLiteral(
    XlaBuilder* builder, const Literal& expected,
    absl::Span<GlobalData* const> arguments, ErrorSpec error,
    const Shape* shape_with_layout) {
  EXPECT_IS_OK(ComputeAndCompareLiteralWithStatus(builder, expected, arguments,
                                                  error, shape_with_layout));
}

Status ClientLibraryTestBase::ComputeAndCompareLiteralWithAllOutputLayouts(
    const xla::XlaComputation& computation, const Literal& expected,
    absl::Span<GlobalData* const> arguments,
    const std::function<void(const Literal& actual,
                             const std::string& error_message)>&
        verify_output) {
  // Try with no layout requirement.
  TF_ASSIGN_OR_RETURN(auto actual, ExecuteAndTransfer(computation, arguments));
  verify_output(actual, "");

  // Try with all output layouts.
  std::vector<int64_t> minor_to_major(expected.shape().rank());
  std::iota(minor_to_major.begin(), minor_to_major.end(), 0);
  do {
    auto layout = ShapeUtil::MakeShapeWithDenseLayout(
        expected.shape().element_type(), expected.shape().dimensions(),
        minor_to_major);
    TF_ASSIGN_OR_RETURN(auto actual,
                        ExecuteAndTransfer(computation, arguments, &layout));
    verify_output(actual,
                  absl::StrCat("Test with output layout: ",
                               ShapeUtil::HumanStringWithLayout(layout)));
  } while (std::next_permutation(minor_to_major.begin(), minor_to_major.end()));
  return OkStatus();
}

Status ClientLibraryTestBase::ComputeAndCompareLiteralWithAllInputLayouts(
    const xla::XlaComputation& computation, const Literal& /*expected*/,
    absl::Span<GlobalData* const> arguments,
    const std::function<void(const Literal& actual,
                             const std::string& error_message)>& verify_output,
    const Shape* output_with_layout) {
  std::vector<GlobalData*> arguments_with_layout;
  std::vector<std::string> layout_strings;
  // This is a recursive function. It's an std::function instead of a lambda
  // because it needs to capture itself. The index is the index of the argument
  // to try all layouts for.
  std::function<Status(int64_t)> choose;
  choose = [&, this](int64_t index) -> Status {
    if (index < arguments.size()) {
      // Try out all layouts for the operand.
      TF_ASSIGN_OR_RETURN(auto literal,
                          client_->Transfer(*arguments[index], nullptr));
      // Skip tuples because they don't have a rank.
      if (literal.shape().IsTuple()) {
        layout_strings.push_back(
            ShapeUtil::HumanStringWithLayout(literal.shape()));
        arguments_with_layout.push_back(arguments[index]);
        TF_RETURN_IF_ERROR(choose(index + 1));
        arguments_with_layout.pop_back();
        layout_strings.pop_back();
        return OkStatus();
      }

      std::vector<int64_t> minor_to_major(literal.shape().rank());
      std::iota(minor_to_major.begin(), minor_to_major.end(), 0);
      do {
        auto literal_relayout =
            literal.Relayout(LayoutUtil::MakeLayout(minor_to_major));
        layout_strings.push_back(
            ShapeUtil::HumanStringWithLayout(literal_relayout.shape()));
        TF_ASSIGN_OR_RETURN(auto data,
                            client_->TransferToServer(literal_relayout));
        arguments_with_layout.push_back(data.get());
        TF_RETURN_IF_ERROR(choose(index + 1));
        arguments_with_layout.pop_back();
        layout_strings.pop_back();
      } while (
          std::next_permutation(minor_to_major.begin(), minor_to_major.end()));
      return OkStatus();
    }

    // Every argument has an assigned layout.
    TF_ASSIGN_OR_RETURN(
        auto actual,
        ExecuteAndTransfer(computation,
                           absl::Span<GlobalData* const>(arguments_with_layout),
                           output_with_layout));
    std::string error_message = "Test with input layouts: ";
    for (const auto& str : layout_strings) {
      absl::StrAppend(&error_message, str, " ");
    }
    verify_output(actual, error_message);
    return OkStatus();
  };

  return choose(0);
}

StatusOr<Literal> ClientLibraryTestBase::ComputeAndTransfer(
    XlaBuilder* builder, absl::Span<GlobalData* const> arguments_passed_in,
    const Shape* shape_with_layout) {
  std::vector<GlobalData*> arguments(arguments_passed_in.begin(),
                                     arguments_passed_in.end());

  // Transfer and use elements of arguments_, if the AddParam() API was used.
  std::vector<std::unique_ptr<GlobalData>> owning_arguments;
  if (!arguments_.empty()) {
    CHECK(arguments.empty());
    for (const auto& argument : arguments_) {
      TF_ASSIGN_OR_RETURN(
          std::unique_ptr<GlobalData> owned_argument,
          client_->TransferToServer(MaybeConvertLiteralToBfloat16(argument)));
      owning_arguments.push_back(std::move(owned_argument));
      arguments.push_back(owning_arguments.back().get());
    }
  }

  TF_ASSIGN_OR_RETURN(auto computation, builder->Build());
  return ExecuteAndTransfer(computation, arguments, shape_with_layout);
}

Status ClientLibraryTestBase::ComputeAndCompareLiteralWithStatus(
    XlaBuilder* builder, const Literal& expected,
    absl::Span<GlobalData* const> arguments_passed_in,
    const Shape* shape_with_layout) {
  std::vector<GlobalData*> arguments(arguments_passed_in.begin(),
                                     arguments_passed_in.end());

  // Transfer and use elements of arguments_, if the AddParam() API was used.
  std::vector<std::unique_ptr<GlobalData>> owning_arguments;
  if (!arguments_.empty()) {
    CHECK(arguments.empty());
    for (const auto& argument : arguments_) {
      TF_ASSIGN_OR_RETURN(
          std::unique_ptr<GlobalData> owned_argument,
          client_->TransferToServer(MaybeConvertLiteralToBfloat16(argument)));
      owning_arguments.push_back(std::move(owned_argument));
      arguments.push_back(owning_arguments.back().get());
    }
  }

  TF_ASSIGN_OR_RETURN(auto computation, builder->Build());
  if (ShapeUtil::ElementIsFloating(expected.shape()) ||
      ShapeUtil::ElementIsComplex(expected.shape())) {
    LOG(WARNING) << "performing exact comparison of floating point numbers";
  }
  // We allow using a float expected literal for a bfloat16 output. In this
  // case, we need to convert the expected literal to bfloat16.
  const Literal* expected_ptr = &expected;
  Literal converted_expected;
  Shape layout_shape;
  if (use_bfloat16_) {
    converted_expected = LiteralUtil::ConvertF32ToBF16(expected);
    expected_ptr = &converted_expected;
    if (shape_with_layout != nullptr) {
      layout_shape = *shape_with_layout;
      ShapeUtil::ForEachMutableSubshape(
          &layout_shape, [&](Shape* subshape, const ShapeIndex& /*index*/) {
            if (subshape->element_type() == F32) {
              subshape->set_element_type(BF16);
            }
          });
      shape_with_layout = &layout_shape;
    }
  }
  auto expect_equal = [&](const Literal& actual,
                          const std::string& error_message) {
    EXPECT_TRUE(LiteralTestUtil::Equal(*expected_ptr, actual)) << error_message;
  };
  if (execution_options_.debug_options().xla_test_all_output_layouts()) {
    return ComputeAndCompareLiteralWithAllOutputLayouts(
        computation, *expected_ptr, arguments, expect_equal);
  }
  if (execution_options_.debug_options().xla_test_all_input_layouts()) {
    return ComputeAndCompareLiteralWithAllInputLayouts(
        computation, *expected_ptr, arguments, expect_equal, shape_with_layout);
  }
  TF_ASSIGN_OR_RETURN(auto actual, ExecuteAndTransfer(computation, arguments,
                                                      shape_with_layout));
  EXPECT_TRUE(LiteralTestUtil::Equal(*expected_ptr, actual));
  return OkStatus();
}

Status ClientLibraryTestBase::ComputeAndCompareLiteralWithStatus(
    XlaBuilder* builder, const Literal& expected,
    absl::Span<GlobalData* const> arguments_passed_in, ErrorSpec error,
    const Shape* shape_with_layout) {
  std::vector<GlobalData*> arguments(arguments_passed_in.begin(),
                                     arguments_passed_in.end());

  // Transfer and use elements of arguments_, if the AddParam() API was used.
  std::vector<std::unique_ptr<GlobalData>> owning_arguments;
  if (!arguments_.empty()) {
    CHECK(arguments.empty());
    for (const auto& argument : arguments_) {
      TF_ASSIGN_OR_RETURN(
          std::unique_ptr<GlobalData> owned_argument,
          client_->TransferToServer(MaybeConvertLiteralToBfloat16(argument)));
      owning_arguments.push_back(std::move(owned_argument));
      arguments.push_back(owning_arguments.back().get());
    }
  }

  TF_ASSIGN_OR_RETURN(auto computation, builder->Build());
  // We allow using a float expected literal for a bfloat16 output. In this
  // case, we need to convert the expected literal to bfloat16.
  const Literal* expected_ptr = &expected;
  Literal converted_expected;
  Shape layout_shape;
  if (use_bfloat16_) {
    converted_expected = LiteralUtil::ConvertF32ToBF16(expected);
    expected_ptr = &converted_expected;
    if (shape_with_layout != nullptr) {
      layout_shape = *shape_with_layout;
      ShapeUtil::ForEachMutableSubshape(
          &layout_shape, [&](Shape* subshape, const ShapeIndex& /*index*/) {
            if (subshape->element_type() == F32) {
              subshape->set_element_type(BF16);
            }
          });
      shape_with_layout = &layout_shape;
    }
  }
  auto expect_near = [&](const Literal& actual,
                         const std::string& error_message) {
    EXPECT_TRUE(LiteralTestUtil::Near(*expected_ptr, actual, error))
        << error_message;
  };
  if (execution_options_.debug_options().xla_test_all_output_layouts()) {
    return ComputeAndCompareLiteralWithAllOutputLayouts(
        computation, *expected_ptr, arguments, expect_near);
  }
  if (execution_options_.debug_options().xla_test_all_input_layouts()) {
    return ComputeAndCompareLiteralWithAllInputLayouts(
        computation, *expected_ptr, arguments, expect_near, shape_with_layout);
  }
  TF_ASSIGN_OR_RETURN(auto actual, ExecuteAndTransfer(computation, arguments,
                                                      shape_with_layout));
  EXPECT_TRUE(LiteralTestUtil::Near(*expected_ptr, actual, error));
  return OkStatus();
}

void ClientLibraryTestBase::ComputeAndCompareR1U8(
    XlaBuilder* builder, absl::string_view expected,
    absl::Span<GlobalData* const> arguments) {
  auto actual_status = ExecuteAndTransfer(builder, arguments);
  EXPECT_IS_OK(actual_status.status());
  if (!actual_status.ok()) {
    return;
  }
  auto actual = std::move(actual_status).value();

  // Turn the expected value into a literal.
  Literal expected_literal = LiteralUtil::CreateR1U8(expected);

  VLOG(1) << "expected: " << expected_literal.ToString();
  VLOG(1) << "actual:   " << actual.ToString();

  EXPECT_EQ(expected, actual.GetR1U8AsString());
}

void ClientLibraryTestBase::ComputeAndCompareTuple(
    XlaBuilder* builder, const Literal& expected,
    absl::Span<GlobalData* const> arguments) {
  auto actual_status = ExecuteAndTransfer(builder, arguments);
  EXPECT_IS_OK(actual_status.status());
  if (!actual_status.ok()) {
    return;
  }
  auto actual = std::move(actual_status).value();
  EXPECT_TRUE(LiteralTestUtil::Equal(expected, actual));
}

void ClientLibraryTestBase::ComputeAndCompareTuple(
    XlaBuilder* builder, const Literal& expected,
    absl::Span<GlobalData* const> arguments, ErrorSpec error) {
  auto actual_status = ExecuteAndTransfer(builder, arguments);
  EXPECT_IS_OK(actual_status.status());
  if (!actual_status.ok()) {
    return;
  }
  auto actual = std::move(actual_status).value();
  EXPECT_TRUE(LiteralTestUtil::Near(expected, actual, error));
}

void ClientLibraryTestBase::ComputeAndCompare(
    XlaBuilder* builder, absl::Span<const Literal> arguments) {
  auto status_or_data = ComputeValueAndReference(builder, arguments);
  EXPECT_IS_OK(status_or_data);
  if (!status_or_data.ok()) {
    return;
  }
  Literal reference, result;
  std::tie(reference, result) = std::move(status_or_data).value();
  EXPECT_TRUE(LiteralTestUtil::Equal(reference, result));
}

void ClientLibraryTestBase::ComputeAndCompare(
    XlaBuilder* builder, absl::Span<const Literal> arguments, ErrorSpec error) {
  auto status_or_data = ComputeValueAndReference(builder, arguments);
  EXPECT_IS_OK(status_or_data);
  if (!status_or_data.ok()) {
    return;
  }
  Literal reference, result;
  std::tie(reference, result) = std::move(status_or_data).value();
  EXPECT_TRUE(LiteralTestUtil::Near(reference, result, error));
}

StatusOr<std::pair<Literal, Literal>>
ClientLibraryTestBase::ComputeValueAndReference(
    XlaBuilder* builder, absl::Span<const Literal> arguments) {
  // Transfer the arguments to the executor service. We put the unique_ptr's
  // into a vector to keep the data alive on the service until the end of this
  // function.
  std::vector<std::unique_ptr<GlobalData>> argument_data;
  std::vector<std::unique_ptr<GlobalData>> ref_argument_data;

  // Use `arguments_` if the AddParam() API was used.  Otherwise, use
  // plain `arguments`.
  if (!arguments_.empty()) {
    CHECK_EQ(arguments.size(), 0);
    arguments = arguments_;
  }

  for (const auto& arg : arguments) {
    TF_ASSIGN_OR_RETURN(auto data, client_->TransferToServer(arg.Clone()));
    TF_ASSIGN_OR_RETURN(auto ref_data, ref_client_->TransferToServer(arg));
    argument_data.push_back(std::move(data));
    ref_argument_data.push_back(std::move(ref_data));
  }

  // Create raw pointers to the GlobalData for the rest of the call stack.
  std::vector<GlobalData*> argument_data_ptr;
  std::transform(
      argument_data.begin(), argument_data.end(),
      std::back_inserter(argument_data_ptr),
      [](const std::unique_ptr<GlobalData>& data) { return data.get(); });
  std::vector<GlobalData*> ref_argument_data_ptr;
  std::transform(
      ref_argument_data.begin(), ref_argument_data.end(),
      std::back_inserter(ref_argument_data_ptr),
      [](const std::unique_ptr<GlobalData>& data) { return data.get(); });

  TF_ASSIGN_OR_RETURN(auto computation, builder->Build());

  TF_ASSIGN_OR_RETURN(auto result,
                      ExecuteAndTransfer(computation, argument_data_ptr));

  TF_ASSIGN_OR_RETURN(auto reference, ExecuteAndTransferReference(
                                          computation, ref_argument_data_ptr));

  return std::make_pair(std::move(reference), std::move(result));
}

XlaComputation ClientLibraryTestBase::CreateScalarRelu() {
  XlaBuilder builder("relu");
  auto shape = ShapeUtil::MakeShape(use_bfloat16_ ? BF16 : F32, {});
  auto z_value = Parameter(&builder, 0, shape, "z_value");
  auto zero = use_bfloat16_
                  ? ConstantR0<bfloat16>(&builder, static_cast<bfloat16>(0.0f))
                  : ConstantR0<float>(&builder, 0.0f);
  Max(z_value, zero);
  auto computation_status = builder.Build();
  TF_CHECK_OK(computation_status.status());
  return std::move(computation_status).value();
}

XlaComputation ClientLibraryTestBase::CreateScalarMax() {
  XlaBuilder builder("max");
  auto shape = ShapeUtil::MakeShape(use_bfloat16_ ? BF16 : F32, {});
  auto x = Parameter(&builder, 0, shape, "x");
  auto y = Parameter(&builder, 1, shape, "y");
  Max(x, y);
  auto computation_status = builder.Build();
  TF_CHECK_OK(computation_status.status());
  return std::move(computation_status).value();
}

XlaComputation ClientLibraryTestBase::CreateScalarReluSensitivity() {
  XlaBuilder builder("relu_sensitivity");
  auto shape = ShapeUtil::MakeShape(use_bfloat16_ ? BF16 : F32, {});
  auto activation = Parameter(&builder, 0, shape, "activation");
  auto backprop = Parameter(&builder, 1, shape, "backprop");
  auto zero = use_bfloat16_
                  ? ConstantR0<bfloat16>(&builder, static_cast<bfloat16>(0.0f))
                  : ConstantR0<float>(&builder, 0.0f);
  auto activation_gtz = Gt(activation, zero);
  Select(activation_gtz, /*on_true=*/backprop, /*on_false=*/zero);

  auto computation_status = builder.Build();
  TF_CHECK_OK(computation_status.status());
  return std::move(computation_status).value();
}

std::unique_ptr<Array2D<float>> ClientLibraryTestBase::CreatePatternedMatrix(
    int rows, int cols, float offset) {
  auto array = std::make_unique<Array2D<float>>(rows, cols);
  for (int64_t row = 0; row < rows; ++row) {
    for (int64_t col = 0; col < cols; ++col) {
      (*array)(row, col) = col + (row * 1000.0f) + offset;
    }
  }
  return array;
}

std::unique_ptr<Array2D<float>>
ClientLibraryTestBase::CreatePatternedMatrixWithZeroPadding(int rows, int cols,
                                                            int rows_padded,
                                                            int cols_padded) {
  CHECK_GE(rows_padded, rows);
  CHECK_GE(cols_padded, cols);
  auto array = std::make_unique<Array2D<float>>(rows_padded, cols_padded, 0.0);
  for (int64_t row = 0; row < rows; ++row) {
    for (int64_t col = 0; col < cols; ++col) {
      (*array)(row, col) = col + (row * 1000.0f);
    }
  }
  return array;
}

XlaOp ClientLibraryTestBase::AddParam(const Literal& argument,
                                      XlaBuilder* builder) {
  arguments_.push_back(argument.Clone());
  return Parameter(builder, /*parameter_number=*/arguments_.size() - 1,
                   MaybeConvertShapeToBfloat16(argument.shape()), "");
}

XlaOp ClientLibraryTestBase::CreateConstantFromLiteral(const Literal& literal,
                                                       XlaBuilder* builder) {
  return ConstantLiteral(builder, use_bfloat16_
                                      ? LiteralUtil::ConvertF32ToBF16(literal)
                                      : LiteralSlice(literal));
}

StatusOr<std::unique_ptr<GlobalData>>
ClientLibraryTestBase::CreateParameterAndTransferLiteral(
    int64_t parameter_number, const Literal& literal, const std::string& name,
    XlaBuilder* builder, XlaOp* data_handle) {
  return CreateParameterAndTransferLiteral(parameter_number, literal, name,
                                           nullptr, builder, data_handle);
}

Shape ClientLibraryTestBase::MaybeConvertShapeToBfloat16(const Shape& shape) {
  if (!use_bfloat16_) {
    return shape;
  }
  Shape new_shape = shape;
  ShapeUtil::ForEachMutableSubshape(&new_shape,
                                    [](Shape* subshape, const ShapeIndex&) {
                                      if (subshape->element_type() == F32) {
                                        subshape->set_element_type(BF16);
                                      }
                                    });
  return new_shape;
}

Literal ClientLibraryTestBase::MaybeConvertLiteralToBfloat16(
    const Literal& literal) {
  if (use_bfloat16_) {
    return LiteralUtil::ConvertF32ToBF16(literal);
  }
  return literal.Clone();
}

StatusOr<std::unique_ptr<GlobalData>>
ClientLibraryTestBase::CreateParameterAndTransferLiteral(
    int64_t parameter_number, const Literal& literal, const std::string& name,
    const DeviceHandle* device_handle, XlaBuilder* builder,
    XlaOp* data_handle) {
  Literal param_literal = MaybeConvertLiteralToBfloat16(literal);
  TF_ASSIGN_OR_RETURN(auto data,
                      client_->TransferToServer(param_literal, device_handle));
  *data_handle =
      Parameter(builder, parameter_number, param_literal.shape(), name);
  return data;
}

}  // namespace xla


text:
package org.apache.kylin.metadata.filter;

import java.nio.ByteBuffer;

import org.apache.kylin.common.util.BytesUtil;

/**
 * A simple code system where all values are strings and conform to string comparison system.
 *
 * @author yangli9
 */
public class StringCodeSystem implements IFilterCodeSystem<String> {

    public static final StringCodeSystem INSTANCE = new StringCodeSystem();

    protected StringCodeSystem() {
        // singleton
    }

    @Override
    public boolean isNull(String value) {
        return value == null;
    }

    @Override
    public int compare(String tupleValue, String constValue) {
        return tupleValue.compareTo(constValue);
    }

    @Override
    public void serialize(String value, ByteBuffer buffer) {
        BytesUtil.writeUTFString(value, buffer);
    }

    @Override
    public String deserialize(ByteBuffer buffer) {
        return BytesUtil.readUTFString(buffer);
    }

}


text:
angular.module('dashboard.Login', [
  'dashboard.Config',
  'dashboard.services.Cache',
  'dashboard.services.Session',
  'ui.router'
])

.config(function config($stateProvider) {
  $stateProvider
    .state('public.login', {
      url: '/login',
      controller: 'LoginCtrl',
      templateUrl: 'app/login/Login.html',
      data: {
        pageTitle: 'Login'
      }
    });
})

.controller('LoginCtrl', function LoginCtrl($scope, $state, $window, Config, SessionService, CacheService) {

  var self = this;

  this.init = function() {
    $scope.login = {};
    $scope.clickLogin = self.clickLogin;
  };

  this.clickLogin = function() {
    SessionService.logIn($scope.login.email, $scope.login.password)
      .then(function(response) {
        var desiredState = CacheService.get('desiredState');
        CacheService.reset(); //clear out all previous cache when login
        if (desiredState) {
          $state.go(desiredState.state.name, desiredState.params);
        } else {
          $state.go('dashboard');
        }
      })
      .catch(function(response) {
        if (response && response[0] && response[0].error && response[0].error.message) {
          alert(response[0].error.message);
        } else {
          alert("Invalid login.");
        }
      });
  };

  self.init();
})

;


text:
#define LOG_TAG "ProcessCallStack"
// #define LOG_NDEBUG 0

#include <string.h>
#include <stdio.h>
#include <dirent.h>

#include <utils/Log.h>
#include <utils/Errors.h>
#include <utils/ProcessCallStack.h>
#include <utils/Printer.h>

#include <limits.h>

namespace android {

enum {
    // Max sizes for various dynamically generated strings
    MAX_TIME_STRING = 64,
    MAX_PROC_PATH = 1024,

    // Dump related prettiness constants
    IGNORE_DEPTH_CURRENT_THREAD = 2,
};

static const char* CALL_STACK_PREFIX = "  ";
static const char* PATH_THREAD_NAME = "/proc/self/task/%d/comm";
static const char* PATH_SELF_TASK = "/proc/self/task";

static void dumpProcessHeader(Printer& printer, pid_t pid, const char* timeStr) {
    if (timeStr == NULL) {
        ALOGW("%s: timeStr was NULL", __FUNCTION__);
        return;
    }

    char path[PATH_MAX];
    char procNameBuf[MAX_PROC_PATH];
    char* procName = NULL;
    FILE* fp;

    snprintf(path, sizeof(path), "/proc/%d/cmdline", pid);
    if ((fp = fopen(path, "r"))) {
        procName = fgets(procNameBuf, sizeof(procNameBuf), fp);
        fclose(fp);
    }

    if (!procName) {
        procName = const_cast<char*>("<unknown>");
    }

    printer.printLine();
    printer.printLine();
    printer.printFormatLine("----- pid %d at %s -----", pid, timeStr);
    printer.printFormatLine("Cmd line: %s", procName);
}

static void dumpProcessFooter(Printer& printer, pid_t pid) {
    printer.printLine();
    printer.printFormatLine("----- end %d -----", pid);
    printer.printLine();
}

static String8 getThreadName(pid_t tid) {
    char path[PATH_MAX];
    char* procName = NULL;
    char procNameBuf[MAX_PROC_PATH];
    FILE* fp;

    snprintf(path, sizeof(path), PATH_THREAD_NAME, tid);
    if ((fp = fopen(path, "r"))) {
        procName = fgets(procNameBuf, sizeof(procNameBuf), fp);
        fclose(fp);
    } else {
        ALOGE("%s: Failed to open %s", __FUNCTION__, path);
    }

    if (procName == NULL) {
        // Reading /proc/self/task/%d/comm failed due to a race
        return String8::format("[err-unknown-tid-%d]", tid);
    }

    // Strip ending newline
    strtok(procName, "\n");

    return String8(procName);
}

static String8 getTimeString(struct tm tm) {
    char timestr[MAX_TIME_STRING];
    // i.e. '2013-10-22 14:42:05'
    strftime(timestr, sizeof(timestr), "%F %T", &tm);

    return String8(timestr);
}

/*
 * Implementation of ProcessCallStack
 */
ProcessCallStack::ProcessCallStack() {
}

ProcessCallStack::ProcessCallStack(const ProcessCallStack& rhs) :
        mThreadMap(rhs.mThreadMap),
        mTimeUpdated(rhs.mTimeUpdated) {
}

ProcessCallStack::~ProcessCallStack() {
}

void ProcessCallStack::clear() {
    mThreadMap.clear();
    mTimeUpdated = tm();
}

void ProcessCallStack::update() {
    DIR *dp;
    struct dirent *ep;
    struct dirent entry;

    dp = opendir(PATH_SELF_TASK);
    if (dp == NULL) {
        ALOGE("%s: Failed to update the process's call stacks (errno = %d, '%s')",
              __FUNCTION__, errno, strerror(errno));
        return;
    }

    pid_t selfPid = getpid();

    clear();

    // Get current time.
#ifndef USE_MINGW
    {
        time_t t = time(NULL);
        struct tm tm;
        localtime_r(&t, &tm);

        mTimeUpdated = tm;
    }

    /*
     * Each tid is a directory inside of /proc/self/task
     * - Read every file in directory => get every tid
     */
    int code;
    while ((code = readdir_r(dp, &entry, &ep)) == 0 && ep != NULL) {
        pid_t tid = -1;
        sscanf(ep->d_name, "%d", &tid);

        if (tid < 0) {
            // Ignore '.' and '..'
            ALOGV("%s: Failed to read tid from %s/%s",
                  __FUNCTION__, PATH_SELF_TASK, ep->d_name);
            continue;
        }

        ssize_t idx = mThreadMap.add(tid, ThreadInfo());
        if (idx < 0) { // returns negative error value on error
            ALOGE("%s: Failed to add new ThreadInfo (errno = %zd, '%s')",
                  __FUNCTION__, idx, strerror(-idx));
            continue;
        }

        ThreadInfo& threadInfo = mThreadMap.editValueAt(static_cast<size_t>(idx));

        /*
         * Ignore CallStack::update and ProcessCallStack::update for current thread
         * - Every other thread doesn't need this since we call update off-thread
         */
        int ignoreDepth = (selfPid == tid) ? IGNORE_DEPTH_CURRENT_THREAD : 0;

        // Update thread's call stacks
        threadInfo.callStack.update(ignoreDepth, tid);

        // Read/save thread name
        threadInfo.threadName = getThreadName(tid);

        ALOGV("%s: Got call stack for tid %d (size %zu)",
              __FUNCTION__, tid, threadInfo.callStack.size());
    }
    if (code != 0) { // returns positive error value on error
        ALOGE("%s: Failed to readdir from %s (errno = %d, '%s')",
              __FUNCTION__, PATH_SELF_TASK, -code, strerror(code));
    }
#endif

    closedir(dp);
}

void ProcessCallStack::log(const char* logtag, android_LogPriority priority,
                           const char* prefix) const {
    LogPrinter printer(logtag, priority, prefix, /*ignoreBlankLines*/false);
    print(printer);
}

void ProcessCallStack::print(Printer& printer) const {
    /*
     * Print the header/footer with the regular printer.
     * Print the callstack with an additional two spaces as the prefix for legibility.
     */
    PrefixPrinter csPrinter(printer, CALL_STACK_PREFIX);
    printInternal(printer, csPrinter);
}

void ProcessCallStack::printInternal(Printer& printer, Printer& csPrinter) const {
    dumpProcessHeader(printer, getpid(),
                      getTimeString(mTimeUpdated).string());

    for (size_t i = 0; i < mThreadMap.size(); ++i) {
        pid_t tid = mThreadMap.keyAt(i);
        const ThreadInfo& threadInfo = mThreadMap.valueAt(i);
        const String8& threadName = threadInfo.threadName;

        printer.printLine("");
        printer.printFormatLine("\"%s\" sysTid=%d", threadName.string(), tid);

        threadInfo.callStack.print(csPrinter);
    }

    dumpProcessFooter(printer, getpid());
}

void ProcessCallStack::dump(int fd, int indent, const char* prefix) const {

    if (indent < 0) {
        ALOGW("%s: Bad indent (%d)", __FUNCTION__, indent);
        return;
    }

    FdPrinter printer(fd, static_cast<unsigned int>(indent), prefix);
    print(printer);
}

String8 ProcessCallStack::toString(const char* prefix) const {

    String8 dest;
    String8Printer printer(&dest, prefix);
    print(printer);

    return dest;
}

size_t ProcessCallStack::size() const {
    return mThreadMap.size();
}

}; //namespace android


text:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:useLevel="false"
    >
    <solid android:color="@color/bottom_yellow"/>
    <padding android:left="1dip"
        android:right="1dip"
        android:bottom="1dip"/>

    <stroke android:width="1dip"
        android:color="@color/bottom_yellow"
        />
    <!--边框宽度-->
</shape>